summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Soller <jeremy@system76.com>2021-05-12 20:42:20 -0600
committerJeremy Soller <jeremy@system76.com>2021-05-12 20:42:20 -0600
commitba8c21024a808192b73265290a8b75067b47fbd3 (patch)
treee775095aba93872035c2783e10bd7ba4bba6b8e9
parent91396f45d642283e0b332c483aec151eaa6048c9 (diff)
riscv64 buildriscv64
-rw-r--r--config/riscv64.toml311
l---------filesystem.toml2
m---------kernel0
-rw-r--r--mk/config.mk6
-rwxr-xr-xriscv64.sh74
5 files changed, 389 insertions, 4 deletions
diff --git a/config/riscv64.toml b/config/riscv64.toml
new file mode 100644
index 0000000..d56e0cb
--- /dev/null
+++ b/config/riscv64.toml
@@ -0,0 +1,311 @@
+# This is the default configuration file
+
+# General settings
+[general]
+# Do not prompt if settings are not defined
+prompt = false
+
+# Package settings
+[packages]
+#acid = {}
+# audiod = {}
+#autoconf = {}
+#automake = {}
+#bash = {}
+#binutils = {}
+ca-certificates = {}
+#cairo = {}
+#cairodemo = {}
+#cargo = {}
+#cleye = {}
+#cmatrix = {}
+# contain = {}
+coreutils = {}
+#cpal = {}
+#curl = {}
+dash = {}
+#diffutils = {}
+#dosbox = {}
+# drivers = {}
+#drivers-041 = {}
+#duktape = {}
+#eduke32 = {}
+#exampled = {}
+#expat = {}
+extrautils = {}
+#fd = {}
+#ffmpeg = {}
+# findutils = {}
+#freeciv = {}
+#freedoom = {}
+#freeglut = {}
+#freetype = {}
+#friar = {} # mio patch
+#game-2048 = {}
+#games = {}
+#gawk = {}
+#gcc = {}
+# gdbserver = {}
+#gears = {}
+#generaluser-gs = {}
+#gettext = {}
+#gigalomania = {}
+#git = {}
+#glib = {}
+#glium = {}
+#glutin = {}
+#gnu-binutils = {}
+#gnu-grep = {}
+#gnu-make = {}
+#gstreamer = {}
+#harfbuzz = {}
+#hematite = {}
+#init = {}
+# installer = {}
+ion = {}
+ipcd = {}
+#jansson = {}
+#keyboard-sfx = {}
+#lci = {}
+#libc-bench = {}
+#libffi = {}
+#libiconv = {}
+#libjpeg = {}
+#liborbital = {}
+#libpng = {}
+#libsodium = {}
+#llvm = {}
+logd = {}
+#lua = {}
+#mdp = {}
+#mesa = {}
+#mesa_glu = {}
+#miniserve = {}
+#nasm = {}
+#ncdu = {}
+#ncurses = {}
+#ncursesw = {}
+# netdb = {}
+# netstack = {}
+# netsurf = {}
+# netutils = {}
+#neverball = {}
+#newlib = {}
+#newlibtest = {}
+#nulld = {}
+#openjazz = {}
+#openssl = {}
+#openttd = {}
+#openttd-opengfx = {}
+#openttd-openmsx = {}
+#openttd-opensfx = {}
+#orbclient = {}
+# orbdata = {}
+# orbital = {}
+# orbterm = {}
+# orbutils = {}
+#osdemo = {}
+#pastel = {}
+#patch = {}
+#pciids = {}
+#pcre = {}
+#periodictable = {}
+#perl = {}
+#pixelcannon = {}
+#pixman = {}
+# pkgutils = {}
+#powerline = {}
+#prboom = {}
+ptyd = {}
+#python = {}
+#qemu = {}
+#randd = {}
+#readline = {} # ncurses
+redoxfs = {}
+#redox-fatfs = {}
+#redox-ssh = {}
+#relibc = {}
+#relibc-tests = {}
+#ripgrep = {}
+#rodioplay = {}
+#rs-nes = {}
+#rust = {}
+#rust64 = {}
+#rust-cairo = {}
+#rust-cairo-demo = {}
+#rustual-boy = {}
+#schismtracker = {}
+#scummvm = {}
+#sdl = {}
+#sdl2 = {}
+#sdl2_gears = {}
+#sdl_gfx = {}
+#sdl_image = {}
+#sdl_mixer = {}
+#sdl_ttf = {}
+#sdl-player = {}
+#sed = {}
+#servo = {}
+#shellstorm = {}
+# smith = {}
+#sodium = {}
+#sopwith = {}
+#ssh = {}
+# strace = {}
+#syobonaction = {}
+#terminfo = {}
+#termplay = {}
+#timidity = {}
+#ttf-hack = {}
+userutils = {}
+uutils = {}
+#vim = {}
+#vttest = {}
+#webrender = {}
+#winit = {}
+#xz = {}
+#zerod = {}
+#zlib = {}
+
+# User settings
+[users.root]
+password = "password"
+uid = 0
+gid = 0
+name = "root"
+home = "/root"
+
+[users.user]
+# Password is unset
+password = ""
+
+[[files]]
+path = "/etc/init.d/00_base"
+data = """
+ipcd
+logd
+dash -c ptyd # CRASHES without dash?
+# pcid /etc/pcid.d/
+"""
+
+[[files]]
+path = "/etc/init.d/10_net"
+data = """
+# smolnetd
+# dnsd
+# dhcpd -b
+"""
+
+[[files]]
+path = "/etc/init.d/20_orbital"
+data = """
+# audiod
+# orbital display:3/activate orblogin launcher
+"""
+
+[[files]]
+path = "/etc/init.d/30_console"
+data = """
+# getty display:2
+getty debug: -J
+"""
+
+[[files]]
+path = "/etc/net/dns"
+data = """
+208.67.222.222
+"""
+
+[[files]]
+path = "/etc/net/ip"
+data = """
+10.0.2.15
+"""
+
+[[files]]
+path = "/etc/net/ip_router"
+data = """
+10.0.2.2
+"""
+
+[[files]]
+path = "/etc/net/ip_subnet"
+data = """
+255.255.255.0
+"""
+
+[[files]]
+path = "/etc/net/mac"
+data = """
+54-52-00-ab-cd-ef
+"""
+
+[[files]]
+path = "/etc/pkg.d/50_redox"
+data = "https://static.redox-os.org/pkg"
+
+[[files]]
+path = "/etc/group"
+data = """
+root;0;root
+user;1000;user
+sudo;1;user
+"""
+
+[[files]]
+path = "/etc/hostname"
+data = """
+redox
+"""
+
+[[files]]
+path = "/usr/bin"
+data = "/bin"
+symlink = true
+
+[[files]]
+path = "/usr/games"
+data = "/games"
+symlink = true
+
+[[files]]
+path = "/usr/include"
+data = "/include"
+symlink = true
+
+[[files]]
+path = "/usr/lib"
+data = "/lib"
+symlink = true
+
+[[files]]
+path = "/usr/share"
+data = "/share"
+symlink = true
+
+[[files]]
+path = "/tmp"
+data = ""
+directory= true
+# 0o1777
+mode = 1023
+
+[[files]]
+path = "/dev/null"
+data = "null:"
+symlink = true
+
+[[files]]
+path = "/dev/random"
+data = "rand:"
+symlink = true
+
+[[files]]
+path = "/dev/urandom"
+data = "rand:"
+symlink = true
+
+[[files]]
+path = "/dev/zero"
+data = "zero:"
+symlink = true
diff --git a/filesystem.toml b/filesystem.toml
index e909590..25d85ae 120000
--- a/filesystem.toml
+++ b/filesystem.toml
@@ -1 +1 @@
-config/aarch64.toml \ No newline at end of file
+config/riscv64.toml \ No newline at end of file
diff --git a/kernel b/kernel
-Subproject 8130e4752babd24c21abc0bb32b27f9abcad5d2
+Subproject 6f7749365826aba49e76c31029666281018d07e
diff --git a/mk/config.mk b/mk/config.mk
index 61f4996..f600097 100644
--- a/mk/config.mk
+++ b/mk/config.mk
@@ -1,12 +1,12 @@
-include .config
# Configuration
-## Architecture to build Redox for (aarch64 or x86_64)
-ARCH?=aarch64
+## Architecture to build Redox for (aarch64, riscv64, or x86_64)
+ARCH?=riscv64
## Flags to pass to the installer (empty to download binary packages)
INSTALLER_FLAGS?=--cookbook=cookbook
## Enabled to use binary prefix (much faster)
-PREFIX_BINARY?=1
+PREFIX_BINARY?=0
## Filesystem size in MB (256 is the default)
FILESYSTEM_SIZE?=48
diff --git a/riscv64.sh b/riscv64.sh
new file mode 100755
index 0000000..45c78ed
--- /dev/null
+++ b/riscv64.sh
@@ -0,0 +1,74 @@
+#!/usr/bin/env bash
+
+set -ex
+
+MACHINE=virt
+
+U_BOOT="build/u-boot/${MACHINE}.bin"
+IMAGE="build/kernel_live.uimage"
+case "${MACHINE}" in
+ virt)
+ # UART at 0x9000000
+ U_BOOT_CONFIG=qemu_riscv64_defconfig
+ LOAD_ADDR=0x40000000
+ ENTRY_ADDR=0x40001000
+ IMAGE_ADDR=0x44000000
+ QEMU_ARGS=(
+ -M virt
+ -m 1G
+ -bios "${U_BOOT}"
+ -device "loader,file=${IMAGE},addr=${IMAGE_ADDR},force-raw=on"
+ -nographic
+ -serial mon:stdio
+ -s
+ )
+ ;;
+esac
+
+if [ ! -f "${U_BOOT}" ]
+then
+ make prefix
+
+ make -C u-boot distclean
+ make -C u-boot "${U_BOOT_CONFIG}"
+
+ sed -i \
+ 's/^CONFIG_BOOTCOMMAND=.*$/CONFIG_BOOTCOMMAND="bootm '"${IMAGE_ADDR}"' - ${fdtcontroladdr}"/' \
+ u-boot/.config
+
+ TARGET=riscv64-unknown-redox
+ env CROSS_COMPILE="${TARGET}-" \
+ PATH="${PWD}/prefix/${TARGET}/relibc-install/bin/:${PATH}" \
+ make -C u-boot -j "$(nproc)"
+
+ mkdir -pv build/u-boot
+ cp -v u-boot/u-boot.bin "${U_BOOT}"
+fi
+
+mkdir -p build
+# rm -f build/libkernel.a build/kernel
+rm -f build/kernel
+touch build/bootloader
+touch kernel
+make build/kernel
+make build/initfs.tag
+make build/filesystem.bin
+make build/kernel_live
+
+mkimage \
+ -A riscv \
+ -O linux \
+ -T kernel \
+ -C none \
+ -a "${LOAD_ADDR}" \
+ -e "${ENTRY_ADDR}" \
+ -n "Redox kernel (riscv64 ${MACHINE})" \
+ -d build/kernel_live \
+ "${IMAGE}"
+
+if [ -n "${QEMU_ARGS}" ]
+then
+ qemu-system-riscv64 "${QEMU_ARGS[@]}" "$@"
+else
+ sudo cp -v "${IMAGE}" /srv/tftp
+fi