summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Barker <pbarker@toganlabs.com>2017-09-08 10:12:54 +0000
committerAndrei Gherzan <andrei@gherzan.com>2017-09-24 20:39:35 +0100
commite9bb7f0c6d3f77312970034ca0a63b3df0e3ba8e (patch)
tree992506e7939fc0f27f4ece212db0134c56d7e128
parent43e0169ab7f5143fab3ec12a788557a6306c8476 (diff)
downloadmeta-raspberrypi-e9bb7f0c6d3f77312970034ca0a63b3df0e3ba8e.tar.gz
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>
-rw-r--r--classes/sdcard_image-rpi.bbclass21
-rw-r--r--conf/machine/include/rpi-base.inc14
-rw-r--r--conf/machine/raspberrypi3-64.conf5
-rw-r--r--docs/extra-build-config.md8
-rw-r--r--recipes-bsp/rpi-u-boot-scr/files/boot.cmd3
-rw-r--r--recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in3
-rw-r--r--recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bb5
7 files changed, 36 insertions, 23 deletions
diff --git a/classes/sdcard_image-rpi.bbclass b/classes/sdcard_image-rpi.bbclass
index 6d34a29..6b7433e 100644
--- a/classes/sdcard_image-rpi.bbclass
+++ b/classes/sdcard_image-rpi.bbclass
@@ -55,7 +55,7 @@ do_image_rpi_sdimg[depends] = " \
55 dosfstools-native:do_populate_sysroot \ 55 dosfstools-native:do_populate_sysroot \
56 virtual/kernel:do_deploy \ 56 virtual/kernel:do_deploy \
57 ${IMAGE_BOOTLOADER}:do_deploy \ 57 ${IMAGE_BOOTLOADER}:do_deploy \
58 ${@bb.utils.contains('KERNEL_IMAGETYPE', 'uImage', 'u-boot:do_deploy', '',d)} \ 58 ${@bb.utils.contains('RPI_USE_U_BOOT', '1', 'u-boot:do_deploy', '',d)} \
59 " 59 "
60 60
61# SD card image name 61# SD card image name
@@ -136,16 +136,13 @@ IMAGE_CMD_rpi-sdimg () {
136 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.${DTB_EXT} ::overlays/${DTB_BASE_NAME}.${DTB_EXT} 136 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.${DTB_EXT} ::overlays/${DTB_BASE_NAME}.${DTB_EXT}
137 done 137 done
138 fi 138 fi
139 case "${KERNEL_IMAGETYPE}" in 139 if [ "${RPI_USE_U_BOOT}" = "1" ]; then
140 "uImage")
141 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/u-boot.bin ::${SDIMG_KERNELIMAGE} 140 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/u-boot.bin ::${SDIMG_KERNELIMAGE}
142 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::uImage 141 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::${KERNEL_IMAGETYPE}
143 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/boot.scr ::boot.scr 142 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/boot.scr ::boot.scr
144 ;; 143 else
145 *)
146 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::${SDIMG_KERNELIMAGE} 144 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::${SDIMG_KERNELIMAGE}
147 ;; 145 fi
148 esac
149 146
150 if [ -n ${FATPAYLOAD} ] ; then 147 if [ -n ${FATPAYLOAD} ] ; then
151 echo "Copying payload into VFAT" 148 echo "Copying payload into VFAT"
@@ -160,14 +157,10 @@ IMAGE_CMD_rpi-sdimg () {
160 mcopy -i ${WORKDIR}/boot.img -v ${WORKDIR}/image-version-info :: 157 mcopy -i ${WORKDIR}/boot.img -v ${WORKDIR}/image-version-info ::
161 158
162 # Deploy vfat partition (for u-boot case only) 159 # Deploy vfat partition (for u-boot case only)
163 case "${KERNEL_IMAGETYPE}" in 160 if [ "${RPI_USE_U_BOOT}" = "1" ]; then
164 "uImage")
165 cp ${WORKDIR}/boot.img ${IMGDEPLOYDIR}/${SDIMG_VFAT} 161 cp ${WORKDIR}/boot.img ${IMGDEPLOYDIR}/${SDIMG_VFAT}
166 ln -sf ${SDIMG_VFAT} ${SDIMG_LINK_VFAT} 162 ln -sf ${SDIMG_VFAT} ${SDIMG_LINK_VFAT}
167 ;; 163 fi
168 *)
169 ;;
170 esac
171 164
172 # Burn Partitions 165 # Burn Partitions
173 dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync 166 dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
diff --git a/conf/machine/include/rpi-base.inc b/conf/machine/include/rpi-base.inc
index f29db29..970f4d8 100644
--- a/conf/machine/include/rpi-base.inc
+++ b/conf/machine/include/rpi-base.inc
@@ -41,7 +41,17 @@ KERNEL_DEVICETREE ?= " \
41 overlays/pi3-miniuart-bt.dtbo \ 41 overlays/pi3-miniuart-bt.dtbo \
42 overlays/vc4-kms-v3d.dtbo \ 42 overlays/vc4-kms-v3d.dtbo \
43 " 43 "
44KERNEL_IMAGETYPE ?= "Image" 44
45# By default:
46#
47# * When u-boot is disabled use the "Image" format which can be directly loaded
48# by the rpi firmware.
49#
50# * When u-boot is enabled use the "uImage" format and the "bootm" command
51# within u-boot to load the kernel.
52KERNEL_BOOTCMD ??= "bootm"
53KERNEL_IMAGETYPE_UBOOT ??= "uImage"
54KERNEL_IMAGETYPE ?= "${@bb.utils.contains('RPI_USE_U_BOOT', '1', '${KERNEL_IMAGETYPE_UBOOT}', 'Image', d)}"
45 55
46MACHINE_FEATURES += "apm usbhost keyboard vfat ext2 screen touchscreen alsa bluetooth wifi sdio" 56MACHINE_FEATURES += "apm usbhost keyboard vfat ext2 screen touchscreen alsa bluetooth wifi sdio"
47 57
@@ -83,7 +93,7 @@ def make_dtb_boot_files(d):
83 93
84IMAGE_BOOT_FILES ?= "bcm2835-bootfiles/* \ 94IMAGE_BOOT_FILES ?= "bcm2835-bootfiles/* \
85 ${@make_dtb_boot_files(d)} \ 95 ${@make_dtb_boot_files(d)} \
86 ${@bb.utils.contains('KERNEL_IMAGETYPE', 'uImage', \ 96 ${@bb.utils.contains('RPI_USE_U_BOOT', '1', \
87 '${KERNEL_IMAGETYPE} u-boot.bin;${SDIMG_KERNELIMAGE} boot.scr', \ 97 '${KERNEL_IMAGETYPE} u-boot.bin;${SDIMG_KERNELIMAGE} boot.scr', \
88 '${KERNEL_IMAGETYPE};${SDIMG_KERNELIMAGE}', d)} \ 98 '${KERNEL_IMAGETYPE};${SDIMG_KERNELIMAGE}', d)} \
89 " 99 "
diff --git a/conf/machine/raspberrypi3-64.conf b/conf/machine/raspberrypi3-64.conf
index 237684a..ebc9f38 100644
--- a/conf/machine/raspberrypi3-64.conf
+++ b/conf/machine/raspberrypi3-64.conf
@@ -39,3 +39,8 @@ VC4_CMA_SIZE ?= "cma-256"
39 39
40UBOOT_MACHINE = "rpi_3_config" 40UBOOT_MACHINE = "rpi_3_config"
41MACHINE_FEATURES_append = " vc4graphics" 41MACHINE_FEATURES_append = " vc4graphics"
42
43# When u-boot is enabled we need to use the "Image" format and the "booti"
44# command to load the kernel
45KERNEL_IMAGETYPE_UBOOT ?= "Image"
46KERNEL_BOOTCMD ?= "booti"
diff --git a/docs/extra-build-config.md b/docs/extra-build-config.md
index 8d4f897..380d969 100644
--- a/docs/extra-build-config.md
+++ b/docs/extra-build-config.md
@@ -105,10 +105,12 @@ To disable rpi boot logo, set this variable in local.conf:
105 105
106To have u-boot load kernel image, set in your local.conf: 106To have u-boot load kernel image, set in your local.conf:
107 107
108 KERNEL_IMAGETYPE = "uImage" 108 RPI_USE_U_BOOT = "1"
109 109
110This will make kernel.img be u-boot image which will load uImage. By default, 110This will select the appropriate image format for use with u-boot automatically.
111kernel.img is the actual kernel image (ex. Image). 111For further customisation the KERNEL_IMAGETYPE and KERNEL_BOOTCMD variables can
112be overridden to select the exact kernel image type (eg. zImage) and u-boot
113command (eg. bootz) to be used.
112 114
113## Image with Initramfs 115## Image with Initramfs
114 116
diff --git a/recipes-bsp/rpi-u-boot-scr/files/boot.cmd b/recipes-bsp/rpi-u-boot-scr/files/boot.cmd
deleted file mode 100644
index 2e8452e..0000000
--- a/recipes-bsp/rpi-u-boot-scr/files/boot.cmd
+++ /dev/null
@@ -1,3 +0,0 @@
1fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs
2fatload mmc 0:1 ${kernel_addr_r} uImage
3bootm ${kernel_addr_r} - ${fdt_addr}
diff --git a/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in b/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in
new file mode 100644
index 0000000..ad54cd0
--- /dev/null
+++ b/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in
@@ -0,0 +1,3 @@
1fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs
2fatload mmc 0:1 ${kernel_addr_r} @@KERNEL_IMAGETYPE@@
3@@KERNEL_BOOTCMD@@ ${kernel_addr_r} - ${fdt_addr}
diff --git a/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bb b/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bb
index c938c3b..3457300 100644
--- a/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bb
+++ b/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bb
@@ -5,9 +5,12 @@ COMPATIBLE_MACHINE = "^rpi$"
5 5
6DEPENDS = "u-boot-mkimage-native" 6DEPENDS = "u-boot-mkimage-native"
7 7
8SRC_URI = "file://boot.cmd" 8SRC_URI = "file://boot.cmd.in"
9 9
10do_compile() { 10do_compile() {
11 sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \
12 -e 's/@@KERNEL_BOOTCMD@@/${KERNEL_BOOTCMD}/' \
13 "${WORKDIR}/boot.cmd.in" > "${WORKDIR}/boot.cmd"
11 mkimage -A arm -T script -C none -n "Boot script" -d "${WORKDIR}/boot.cmd" boot.scr 14 mkimage -A arm -T script -C none -n "Boot script" -d "${WORKDIR}/boot.cmd" boot.scr
12} 15}
13 16