diff options
author | Jeremy Soller <jeremy@system76.com> | 2021-01-15 20:49:36 -0700 |
---|---|---|
committer | Jeremy Soller <jeremy@system76.com> | 2021-01-15 20:49:36 -0700 |
commit | 0b3ea0479418d13b1c12d39fd1c2591e3c295760 (patch) | |
tree | 4dd99311ecd53cdc1da31609145f811a24406ce1 | |
parent | 9c44627a3cfa260d2a2b935ff0f7674755190721 (diff) |
Build u-boot from source, WIP raspi3 target
-rw-r--r-- | .gitmodules | 4 | ||||
-rwxr-xr-x | aarch64.sh | 75 | ||||
m--------- | u-boot | 0 | ||||
-rw-r--r-- | u-boot.bin | bin | 745312 -> 0 bytes |
4 files changed, 66 insertions, 13 deletions
diff --git a/.gitmodules b/.gitmodules index 9641a61..0ddadc4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -38,3 +38,7 @@ path = bootloader-coreboot url = https://gitlab.redox-os.org/redox-os/bootloader-coreboot.git branch = master +[submodule "u-boot"] + path = u-boot + url = https://github.com/qemu/u-boot.git + branch = master @@ -2,6 +2,62 @@ set -ex +MACHINE=virt + +U_BOOT="build/u-boot/${MACHINE}.bin" +case "${MACHINE}" in + raspi3) + U_BOOT_CONFIG=rpi_3_defconfig + LOAD_ADDR=0x00000000 + ENTRY_ADDR=0x00001000 + IMAGE_ADDR=0x01000000 + QEMU_ARGS=( + -M raspi3 + -device "loader,file=build/kernel.uimage,addr=${IMAGE_ADDR},force-raw=on" + -kernel "${U_BOOT}" + -nographic + -serial null + -serial mon:stdio + -s + ) + ;; + virt) + U_BOOT_CONFIG=qemu_arm64_defconfig + LOAD_ADDR=0x40000000 + ENTRY_ADDR=0x40001000 + IMAGE_ADDR=0x41000000 + QEMU_ARGS=( + -M virt + -cpu cortex-a57 + -bios "${U_BOOT}" + -device "loader,file=build/kernel.uimage,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=aarch64-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 @@ -13,21 +69,14 @@ make build/initfs.tag mkimage \ -A arm64 \ - -O "linux" \ + -O linux \ -T kernel \ -C none \ - -a 0x40000000 \ - -e 0x40001000 \ - -n 'Redox kernel (qemu AArch64 virt)' \ + -a "${LOAD_ADDR}" \ + -e "${ENTRY_ADDR}" \ + -n "Redox kernel (qemu AArch64 ${MACHINE})" \ -d build/kernel \ build/kernel.uimage -qemu-system-aarch64 \ - -M virt \ - -cpu cortex-a57 \ - -bios u-boot.bin \ - -device loader,file=build/kernel.uimage,addr=0x41000000,force-raw=on \ - -serial mon:stdio \ - -nographic \ - -s \ - "$@" +qemu-system-aarch64 "${QEMU_ARGS[@]}" "$@" + diff --git a/u-boot b/u-boot new file mode 160000 +Subproject b0db69b4e1e1bf1109bd9d4a5185cbd4058f4a8 diff --git a/u-boot.bin b/u-boot.bin Binary files differdeleted file mode 100644 index d57bf73..0000000 --- a/u-boot.bin +++ /dev/null |