mirror of
git://git.yoctoproject.org/meta-raspberrypi.git
synced 2025-07-19 21:09:03 +02:00
Support using u-boot with Image format for raspberrypi3-64
For raspberrypi3-64 we need to use the Image or Image.gz format with u-boot instead of the legacy uImage format. We also need to issue the 'booti' command to boot the kernel instead of 'bootm'. Signed-off-by: Paul Barker <pbarker@toganlabs.com>
This commit is contained in:
parent
43e0169ab7
commit
e9bb7f0c6d
|
@ -55,7 +55,7 @@ do_image_rpi_sdimg[depends] = " \
|
|||
dosfstools-native:do_populate_sysroot \
|
||||
virtual/kernel:do_deploy \
|
||||
${IMAGE_BOOTLOADER}:do_deploy \
|
||||
${@bb.utils.contains('KERNEL_IMAGETYPE', 'uImage', 'u-boot:do_deploy', '',d)} \
|
||||
${@bb.utils.contains('RPI_USE_U_BOOT', '1', 'u-boot:do_deploy', '',d)} \
|
||||
"
|
||||
|
||||
# SD card image name
|
||||
|
@ -136,16 +136,13 @@ IMAGE_CMD_rpi-sdimg () {
|
|||
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.${DTB_EXT} ::overlays/${DTB_BASE_NAME}.${DTB_EXT}
|
||||
done
|
||||
fi
|
||||
case "${KERNEL_IMAGETYPE}" in
|
||||
"uImage")
|
||||
if [ "${RPI_USE_U_BOOT}" = "1" ]; then
|
||||
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/u-boot.bin ::${SDIMG_KERNELIMAGE}
|
||||
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::uImage
|
||||
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::${KERNEL_IMAGETYPE}
|
||||
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/boot.scr ::boot.scr
|
||||
;;
|
||||
*)
|
||||
else
|
||||
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::${SDIMG_KERNELIMAGE}
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ -n ${FATPAYLOAD} ] ; then
|
||||
echo "Copying payload into VFAT"
|
||||
|
@ -160,14 +157,10 @@ IMAGE_CMD_rpi-sdimg () {
|
|||
mcopy -i ${WORKDIR}/boot.img -v ${WORKDIR}/image-version-info ::
|
||||
|
||||
# Deploy vfat partition (for u-boot case only)
|
||||
case "${KERNEL_IMAGETYPE}" in
|
||||
"uImage")
|
||||
if [ "${RPI_USE_U_BOOT}" = "1" ]; then
|
||||
cp ${WORKDIR}/boot.img ${IMGDEPLOYDIR}/${SDIMG_VFAT}
|
||||
ln -sf ${SDIMG_VFAT} ${SDIMG_LINK_VFAT}
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Burn Partitions
|
||||
dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
|
||||
|
|
|
@ -41,7 +41,17 @@ KERNEL_DEVICETREE ?= " \
|
|||
overlays/pi3-miniuart-bt.dtbo \
|
||||
overlays/vc4-kms-v3d.dtbo \
|
||||
"
|
||||
KERNEL_IMAGETYPE ?= "Image"
|
||||
|
||||
# By default:
|
||||
#
|
||||
# * When u-boot is disabled use the "Image" format which can be directly loaded
|
||||
# by the rpi firmware.
|
||||
#
|
||||
# * When u-boot is enabled use the "uImage" format and the "bootm" command
|
||||
# within u-boot to load the kernel.
|
||||
KERNEL_BOOTCMD ??= "bootm"
|
||||
KERNEL_IMAGETYPE_UBOOT ??= "uImage"
|
||||
KERNEL_IMAGETYPE ?= "${@bb.utils.contains('RPI_USE_U_BOOT', '1', '${KERNEL_IMAGETYPE_UBOOT}', 'Image', d)}"
|
||||
|
||||
MACHINE_FEATURES += "apm usbhost keyboard vfat ext2 screen touchscreen alsa bluetooth wifi sdio"
|
||||
|
||||
|
@ -83,7 +93,7 @@ def make_dtb_boot_files(d):
|
|||
|
||||
IMAGE_BOOT_FILES ?= "bcm2835-bootfiles/* \
|
||||
${@make_dtb_boot_files(d)} \
|
||||
${@bb.utils.contains('KERNEL_IMAGETYPE', 'uImage', \
|
||||
${@bb.utils.contains('RPI_USE_U_BOOT', '1', \
|
||||
'${KERNEL_IMAGETYPE} u-boot.bin;${SDIMG_KERNELIMAGE} boot.scr', \
|
||||
'${KERNEL_IMAGETYPE};${SDIMG_KERNELIMAGE}', d)} \
|
||||
"
|
||||
|
|
|
@ -39,3 +39,8 @@ VC4_CMA_SIZE ?= "cma-256"
|
|||
|
||||
UBOOT_MACHINE = "rpi_3_config"
|
||||
MACHINE_FEATURES_append = " vc4graphics"
|
||||
|
||||
# When u-boot is enabled we need to use the "Image" format and the "booti"
|
||||
# command to load the kernel
|
||||
KERNEL_IMAGETYPE_UBOOT ?= "Image"
|
||||
KERNEL_BOOTCMD ?= "booti"
|
||||
|
|
|
@ -105,10 +105,12 @@ To disable rpi boot logo, set this variable in local.conf:
|
|||
|
||||
To have u-boot load kernel image, set in your local.conf:
|
||||
|
||||
KERNEL_IMAGETYPE = "uImage"
|
||||
RPI_USE_U_BOOT = "1"
|
||||
|
||||
This will make kernel.img be u-boot image which will load uImage. By default,
|
||||
kernel.img is the actual kernel image (ex. Image).
|
||||
This will select the appropriate image format for use with u-boot automatically.
|
||||
For further customisation the KERNEL_IMAGETYPE and KERNEL_BOOTCMD variables can
|
||||
be overridden to select the exact kernel image type (eg. zImage) and u-boot
|
||||
command (eg. bootz) to be used.
|
||||
|
||||
## Image with Initramfs
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs
|
||||
fatload mmc 0:1 ${kernel_addr_r} uImage
|
||||
bootm ${kernel_addr_r} - ${fdt_addr}
|
3
recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in
Normal file
3
recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in
Normal file
|
@ -0,0 +1,3 @@
|
|||
fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs
|
||||
fatload mmc 0:1 ${kernel_addr_r} @@KERNEL_IMAGETYPE@@
|
||||
@@KERNEL_BOOTCMD@@ ${kernel_addr_r} - ${fdt_addr}
|
|
@ -5,9 +5,12 @@ COMPATIBLE_MACHINE = "^rpi$"
|
|||
|
||||
DEPENDS = "u-boot-mkimage-native"
|
||||
|
||||
SRC_URI = "file://boot.cmd"
|
||||
SRC_URI = "file://boot.cmd.in"
|
||||
|
||||
do_compile() {
|
||||
sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \
|
||||
-e 's/@@KERNEL_BOOTCMD@@/${KERNEL_BOOTCMD}/' \
|
||||
"${WORKDIR}/boot.cmd.in" > "${WORKDIR}/boot.cmd"
|
||||
mkimage -A arm -T script -C none -n "Boot script" -d "${WORKDIR}/boot.cmd" boot.scr
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user