Add uboot instructions

master
Jiajie Chen 6 years ago
parent a712f37c65
commit 58932e0bee

@ -0,0 +1,18 @@
How to use u-boot to boot rCore in Raspberry Pi
===============
Tested under QEMU.
Instructions:
1. Build u-boot
1. Download aarch64 toolchain and u-boot source
2. `make rpi_3_defconfig ARCH=arm CROSS_COMPILE=aarch64-elf-`
3. `make all ARCH=arm CROSS_COMILE=aarch64-elf-`
4. A file named `u-boot.bin` should be generated
2. Use u-boot to run rCore
1. `make run arch=aarch64 u_boot=/path/to/u-boot.bin`
2. In u-boot, enter following commands:
1. `mmc read 0x1000000 0 ${nblocks}`, where ${nblocks} can be probed if you enter a large enought number
2. `bootelf -p 0x1000000`
3. rCore should boot now

@ -16,18 +16,19 @@
# #
# Options: # Options:
# arch = x86_64 | riscv32 | riscv64 | aarch64 # arch = x86_64 | riscv32 | riscv64 | aarch64
# d = int | in_asm | ... QEMU debug info # d = int | in_asm | ... QEMU debug info
# mode = debug | release # mode = debug | release
# LOG = off | error | warn | info | debug | trace # LOG = off | error | warn | info | debug | trace
# SFSIMG = <sfsimg> SFS image path of user programs # SFSIMG = <sfsimg> SFS image path of user programs
# smp = 1 | 2 | ... SMP core number # smp = 1 | 2 | ... SMP core number
# graphic = on | off enable/disable qemu graphical output # graphic = on | off Enable/disable qemu graphical output
# board = none Running on QEMU # board = none Running on QEMU
# | u540 Only available on riscv64, run on HiFive U540, use Sv39 # | u540 Only available on riscv64, run on HiFive U540, use Sv39
# | raspi3 Only available on aarch64, run on Raspberry Pi 3 Model B/B+ # | raspi3 Only available on aarch64, run on Raspberry Pi 3 Model B/B+
# pci_passthru = 0000:00:00.1 Only available on x86_64, passthrough the specified PCI device # pci_passthru = 0000:00:00.1 Only available on x86_64, passthrough the specified PCI device
# init = /bin/ls Only available on riscv64, run specified program instead of user shell # init = /bin/ls Only available on riscv64, run specified program instead of user shell
# extra_nic = on | off Only available on x86_64, add an additional e1000 nic # extra_nic = on | off Only available on x86_64, add an additional e1000 nic
# u_boot = /path/to/u-boot.bin Only available on aarch64, use u-boot to boot rcore
arch ?= riscv64 arch ?= riscv64
board ?= none board ?= none
@ -114,6 +115,10 @@ qemu_opts += \
-machine $(board) \ -machine $(board) \
-serial null -serial mon:stdio \ -serial null -serial mon:stdio \
-kernel $(kernel_img) -kernel $(kernel_img)
ifneq ($(u_boot), )
qemu_opts += \
-sd $(bootloader)
endif
endif endif
ifdef d ifdef d
@ -262,8 +267,12 @@ else ifeq ($(arch), riscv64)
make -j && \ make -j && \
cp bbl $(abspath $@) cp bbl $(abspath $@)
else ifeq ($(arch), aarch64) else ifeq ($(arch), aarch64)
ifneq ($(u_boot), )
@cp $(u_boot) $@
else
@$(objcopy) $(bootloader) --strip-all -O binary $@ @$(objcopy) $(bootloader) --strip-all -O binary $@
endif endif
endif
kernel: kernel:
@echo Building $(arch) kernel @echo Building $(arch) kernel

Loading…
Cancel
Save