Skip to content

Commit 3e8dc19

Browse files
committed
feat: add u-boot load boot.src guide
1 parent abfc352 commit 3e8dc19

File tree

3 files changed

+54
-5
lines changed

3 files changed

+54
-5
lines changed

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,11 @@
44
*.efi
55
*.EFI
66

7+
boot.scr
8+
dtb
9+
Image
10+
711
/test
8-
/rootfs
12+
/rootfs
13+
/u-boot
14+
/edk2

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,16 @@ uefi-shell:
6161
qemu-system-aarch64 -m 1024 -smp 2 -cpu cortex-a57 -M virt -nographic \
6262
-drive if=pflash,format=raw,readonly=on,file=QEMU_EFI_64M.fd \
6363
-drive if=pflash,format=raw,file=varstore.img \
64-
-drive file=fat:rw:test
64+
-drive file=fat:rw:edk2
65+
66+
uboot-env:
67+
qemu-system-aarch64 -m 1024 -smp 2 -cpu cortex-a57 -M virt -nographic \
68+
-bios u-boot.bin \
69+
-device loader,file=u-boot/boot.scr,addr=0x40200000 \
70+
-drive file=fat:rw:u-boot \
71+
-drive if=none,file=$(shell find openwrt-*-squashfs-rootfs.img),id=hd0 \
72+
-device virtio-blk-device,drive=hd0 \
73+
$(EXTRA_ARG)
6574

6675
uboot-efi:
6776
qemu-system-aarch64 -m 1024 -smp 2 -cpu cortex-a57 -M virt -nographic \
@@ -72,3 +81,7 @@ uboot-efi:
7281

7382
parted-list:
7483
parted $(ARGS) unit MiB print
84+
85+
boot.src:
86+
mkimage -A arm64 -O linux -T script -C none \
87+
-d u-boot/boot.txt u-boot/boot.scr

README.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pkill -f qemu-system-aarch64
1919
- Ubuntu 26.04
2020

2121
```
22-
sudo apt install qemu-system-arm make
22+
sudo apt install qemu-system-arm make u-boot-tools
2323
```
2424
- OpenWrt files https://downloads.openwrt.org/releases/24.10.5/targets/armsr/armv8/
2525

@@ -45,12 +45,42 @@ pkill -f qemu-system-aarch64
4545
- UEFI Shell https://github.com/pbatard/UEFI-Shell
4646

4747
```
48-
mkdir -p test/EFI/BOOT
49-
cp shellaa64.efi test/EFI/BOOT/BOOTAA64.EFI
48+
mkdir -p edk2/EFI/BOOT
49+
cp shellaa64.efi edk2/EFI/BOOT/BOOTAA64.EFI
5050
5151
make uefi-shell
5252
```
5353

54+
- U-Boot boot.src (as a disk partition)
55+
56+
```sh
57+
mkdir -p u-boot/boot
58+
cp openwrt-24.10.5-armsr-armv8-generic-kernel.bin u-boot/boot/Image
59+
touch u-boot/boot.txt
60+
```
61+
62+
edit `u-boot/boot.txt`
63+
```sh
64+
fatload virtio 1 ${kernel_addr_r} /boot/Image
65+
setenv bootargs root=fe00
66+
booti ${kernel_addr_r} - ${fdtcontroladdr}
67+
68+
echo "Boot failed!"
69+
```
70+
71+
```sh
72+
make boot.src
73+
make uboot-env
74+
75+
# enter u-boot
76+
source ${scriptaddr}
77+
```
78+
79+
U-Boot `.CONFIG`
80+
```sh
81+
CONFIG_BOOTCOMMAND="source ${scriptaddr}"
82+
```
83+
5484
### Guide
5585

5686
https://openwrt.org/docs/guide-user/virtualization/qemu

0 commit comments

Comments
 (0)