Skip to content

Commit

Permalink
rpi-cmdline, rpi-u-boot-src: Enable to support USB boot
Browse files Browse the repository at this point in the history
Raspberry Pi 4 board can boot the image from USB memory.
But, current meta-raspberrypi supports only SD boot.

This commit supports to switch SD boot and USB boot parameter.
If user want to use USB boot, please add ENABLE_USBBOOT valirable
in your conf/local.conf file.

 ENABLE_USBBOOT="1"

Signed-off-by: Harunobu Kurokawa <[email protected]>
  • Loading branch information
harunobukurokawa committed May 5, 2023
1 parent bf948e0 commit 50909af
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion recipes-bsp/bootfiles/rpi-cmdline.bb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ inherit deploy nopackages
CMDLINE_DWC_OTG ?= "dwc_otg.lpm_enable=0"

CMDLINE_ROOT_FSTYPE ?= "rootfstype=ext4"
CMDLINE_ROOTFS ?= "root=/dev/mmcblk0p2 ${CMDLINE_ROOT_FSTYPE} rootwait"
CMDLINE_ROOT_PARTITION ?= "${@oe.utils.conditional("ENABLE_USBBOOT", "1", "sda2", "mmcblk0p2", d)}"

CMDLINE_ROOTFS ?= "root=/dev/${CMDLINE_ROOT_PARTITION} ${CMDLINE_ROOT_FSTYPE} rootwait"

CMDLINE_SERIAL ?= "${@oe.utils.conditional("ENABLE_UART", "1", "console=serial0,115200", "", d)}"

Expand Down
4 changes: 2 additions & 2 deletions recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs
fatload mmc 0:1 ${kernel_addr_r} @@KERNEL_IMAGETYPE@@
if test ! -e mmc 0:1 uboot.env; then saveenv; fi;
fatload @@BOOT_DEVTYPE@@ 0:1 ${kernel_addr_r} @@KERNEL_IMAGETYPE@@
if test ! -e @@BOOT_DEVTYPE@@ 0:1 uboot.env; then saveenv; fi;
@@KERNEL_BOOTCMD@@ ${kernel_addr_r} - ${fdt_addr}
3 changes: 3 additions & 0 deletions recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ INHIBIT_DEFAULT_DEPS = "1"

SRC_URI = "file://boot.cmd.in"

BOOT_DEVTYPE ?= "${@oe.utils.conditional("ENABLE_USBBOOT", "1", "usb", "mmc", d)}"

do_compile() {
sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \
-e 's/@@KERNEL_BOOTCMD@@/${KERNEL_BOOTCMD}/' \
-e 's/@@BOOT_DEVTYPE@@/${BOOT_DEVTYPE}/' \
"${WORKDIR}/boot.cmd.in" > "${WORKDIR}/boot.cmd"
mkimage -A ${UBOOT_ARCH} -T script -C none -n "Boot script" -d "${WORKDIR}/boot.cmd" boot.scr
}
Expand Down

0 comments on commit 50909af

Please sign in to comment.