Browse Source

dubhe: qspi-image: Build core-image-minimal recipe as rootfs
IMAGE_FSTYPES using "+=" instead of "=" to generate rootfs in tar.gz
Make qspi-image recipe to build the SD image and the initramfs image.
Rename and standardize the recipe's output binaries/images.
So, this recipe will now generate:
- OS boot stack binary to be flashed to QSPI (all boot modes)
- device tree blob to be fetched from TFTP server (all boot modes)
- Kernel image to be fetched from TFTP server (SD and NFS boot)
- Kernel image + initramfs rootfs to be fetched from TFTP server (initramfs boot)
- NFS rootfs in .tar.gz to be hosted in the NFS server (NFS boot, default)
- SD image in .img to be flashed to SD card (SD boot)

weiheng.cheng 4 months ago
parent
commit
8f57a447ef

+ 0 - 2
recipes-core/images/core-image-minimal.bbappend

@@ -13,8 +13,6 @@ IMAGE_INSTALL += " \
 
 IMAGE_INSTALL:starfive-dubhe += "\
 	packagegroup-starfive-dubhe-essentials \
-	packagegroup-starfive-dubhe-ltp \
-	mtd-utils \
 	"
 
 IMAGE_INSTALL:starfive-jh8100 += "\

+ 47 - 9
recipes-core/images/qspi-image_0.1.bb

@@ -1,25 +1,63 @@
 SUMMARY = "QSPI Image Creator"
-DESCRIPTION = "Recipe to create a QSPI Image"
+DESCRIPTION = "Generate QSPI boot firmware, kernel image, device tree blob, kernel bundled with initramfs, NFS and SD rootfs image"
 LICENSE = "CLOSED"
 
 inherit core-image
 
-DEPENDS = "deploy-bootfiles"
+DEPENDS = "deploy-bootfiles core-image-minimal"
 
 LIC_FILES_CHKSUM = ""
 
-IMAGE_FSTYPES = "qspi"
+# Generate QSPI firmware & SD rootfs (NFS rootfs will be auto-generated by default IMAGE_FSTYPES, which is tar.gz)
+IMAGE_FSTYPES += " qspi qspi_sd"
 
-do_rootfs[depends] += "dubhe-image-initramfs:do_rootfs"
+# Set image naming as such: Image-<boot_mode>-<machine>
+#   Image-initramfs-starfive-dubhe (initramfs boot)
+#   Image-nfs-starfive-dubhe       (NFS boot)
+#   Image-sd-starfive-dubhe        (SD boot)
+IMAGE_BASENAME = "Image-nfs"
+
+IMAGE_TYPEDEP:qspi_sd = "ext4 wic wic.gz wic.bmap"
+
+do_rootfs[depends] += " \
+	dubhe-image-initramfs:do_rootfs \
+	"
 
 do_image[depends] += "\
 	deploy-bootfiles:do_deploy \
 	u-boot-starfive:do_deploy \
 	"
 
-IMAGE_CMD:qspi(){
-	dd if=${DEPLOY_DIR_IMAGE}/bootcode.bin of=${DEPLOY_DIR_IMAGE}/starfive-dubhe-qspi-tftpboot.bin bs=32 seek=0 count=128
-	dd if=${DEPLOY_DIR_IMAGE}/bootjump.bin of=${DEPLOY_DIR_IMAGE}/starfive-dubhe-qspi-tftpboot.bin bs=32 seek=128 count=128
-	dd if=${DEPLOY_DIR_IMAGE}/u-boot-spl.bin of=${DEPLOY_DIR_IMAGE}/starfive-dubhe-qspi-tftpboot.bin bs=32 seek=256 count=8192
-	dd if=${DEPLOY_DIR_IMAGE}/u-boot.itb of=${DEPLOY_DIR_IMAGE}/starfive-dubhe-qspi-tftpboot.bin bs=32 seek=8448 count=32768
+# Generate a boot firmware image that contains bootcode, bootjump, U-Boot SPL, U-Boot proper & OpenSBI
+IMAGE_CMD:qspi() {
+	dd if=${DEPLOY_DIR_IMAGE}/bootcode.bin of=${DEPLOY_DIR_IMAGE}/${MACHINE}-qspi-firmware.bin bs=32 seek=0 count=128
+	dd if=${DEPLOY_DIR_IMAGE}/bootjump.bin of=${DEPLOY_DIR_IMAGE}/${MACHINE}-qspi-firmware.bin bs=32 seek=128 count=128
+	dd if=${DEPLOY_DIR_IMAGE}/u-boot-spl.bin of=${DEPLOY_DIR_IMAGE}/${MACHINE}-qspi-firmware.bin bs=32 seek=256 count=8192
+	dd if=${DEPLOY_DIR_IMAGE}/u-boot.itb of=${DEPLOY_DIR_IMAGE}/${MACHINE}-qspi-firmware.bin bs=32 seek=8448 count=32768
 }
+
+# Generate SD image using bmaptool
+IMAGE_CMD:qspi_sd() {
+	cd ${IMGDEPLOYDIR}
+	bmaptool copy ${IMAGE_BASENAME}-${MACHINE}.wic.gz ${DEPLOY_DIR_IMAGE}/Image-sd-${MACHINE}.img
+}
+
+# Create an output folder for all machine variations across Dubhe series
+do_create_output_folder() {
+	rm -rf ${DEPLOY_DIR_IMAGE}/Dubhe-*0
+
+	mkdir -p ${DEPLOY_DIR_IMAGE}/Dubhe-80
+	cp ${DEPLOY_DIR_IMAGE}/${MACHINE}-qspi-firmware.bin ${DEPLOY_DIR_IMAGE}/Dubhe-80
+	cp ${DEPLOY_DIR_IMAGE}/Image ${DEPLOY_DIR_IMAGE}/Dubhe-80
+	cp ${DEPLOY_DIR_IMAGE}/Image-initramfs-${MACHINE}.bin ${DEPLOY_DIR_IMAGE}/Dubhe-80
+	cp ${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}.tar.gz ${DEPLOY_DIR_IMAGE}/Dubhe-80
+	cp ${DEPLOY_DIR_IMAGE}/Image-sd-${MACHINE}.img ${DEPLOY_DIR_IMAGE}/Dubhe-80
+
+	cp -r ${DEPLOY_DIR_IMAGE}/Dubhe-80 ${DEPLOY_DIR_IMAGE}/Dubhe-90
+
+	cp ${DEPLOY_DIR_IMAGE}/dubhe80_fpga.dtb ${DEPLOY_DIR_IMAGE}/Dubhe-80
+	cp ${DEPLOY_DIR_IMAGE}/dubhe90_fpga.dtb ${DEPLOY_DIR_IMAGE}/Dubhe-90
+}
+addtask do_create_output_folder before do_populate_lic_deploy after do_image_complete
+
+COMPATIBLE_MACHINE = "starfive-dubhe"