]> git.baikalelectronics.ru Git - openembedded-baikal.git/commitdiff
Add task for creating bfk3.rom
authorBaikal Electronics <support@baikalelectronics.ru>
Tue, 27 Sep 2022 14:27:18 +0000 (17:27 +0300)
committerBaikal Electronics <support@baikalelectronics.ru>
Tue, 27 Sep 2022 14:27:18 +0000 (17:27 +0300)
meta-baikal/recipes-core/images/core-image-minimal.bbappend
meta-baikal/recipes-kernel/linux/linux-umulti.inc

index 3e58b35d4addd873187cbfdd74f22257b08a838d..113e3e538dfe7322bdf1d56fd51983796bee49d2 100644 (file)
@@ -19,4 +19,32 @@ baikal_deploy () {
     cp -f ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.cpio.lzma ${BAIKAL_IMAGES}/initramfs.lzma
 }
 
-IMAGE_POSTPROCESS_COMMAND += "baikal_deploy;"
+UBOOT_SECTION_END = "786432"
+UBOOTENV_SECTION_END = "917504"
+LINUX_FDT_SECTION_END = "983040"
+FITIMAGE_SECTION_END = "15335424"
+
+check_size_fitness () {
+    cur_size=$( wc -c $1 | cut -d' ' -f1)
+    if [ $cur_size -gt $2 ]; then
+        bberror "$3 exceeds maximum size."
+    fi
+    padding=$( expr $2 - $cur_size )
+    dd if=/dev/zero count=1 bs=$padding >> $1
+}
+
+baikal_build_bootrom () {
+    cd ${WORKDIR}
+    cat ${BAIKAL_IMAGES}/${MACHINE}.u-boot.bin > ${MACHINE}.rom
+    check_size_fitness ${MACHINE}.rom ${UBOOT_SECTION_END} ${MACHINE}.u-boot.bin
+    cat ${BAIKAL_IMAGES}/${MACHINE}.bin >> ${MACHINE}.rom
+    check_size_fitness ${MACHINE}.rom ${UBOOTENV_SECTION_END} ${MACHINE}.bin
+    cat ${BAIKAL_IMAGES}/${MACHINE}.dtb >> ${MACHINE}.rom
+    check_size_fitness ${MACHINE}.rom ${LINUX_FDT_SECTION_END} ${MACHINE}.dtb
+    cat ${BAIKAL_IMAGES}/uMulti >> ${MACHINE}.rom
+    check_size_fitness ${MACHINE}.rom ${FITIMAGE_SECTION_END} uMulti
+
+    cp -f ${MACHINE}.rom -t ${BAIKAL_IMAGES}
+}
+
+IMAGE_POSTPROCESS_COMMAND += "baikal_deploy;baikal_build_bootrom;"
index 5b850f81d12c78e9a2961cef8a78fc72e19ed641..d98f01e3483c6bd510cb91fc82cef76e4b431496 100644 (file)
@@ -20,7 +20,7 @@ baikal_do_uinitramfs () {
     uboot-mkimage -A ${UBOOT_ARCH} -O linux -T ramdisk -C ${BAIKAL_COMP_ALG} \
             -a ${UBOOT_RD_LOADADDRESS} -e ${UBOOT_RD_ENTRYPOINT} \
             -d "${BAIKAL_IMAGES}/initramfs${BAIKAL_COMP_ALG_EXTENSION}" \
-            -n "-" \
+            -n "uInitramfs Image for bfk3 board" \
             ${BAIKAL_IMAGES}/${MACHINE}.uInitramfs
 }
 
@@ -28,12 +28,12 @@ baikal_do_uinitrd () {
     uboot-mkimage -A ${UBOOT_ARCH} -O linux -T ramdisk -C ${BAIKAL_COMP_ALG} \
             -a ${UBOOT_RDI_LOADADDRESS} -e ${UBOOT_RDI_ENTRYPOINT} \
             -d "${BAIKAL_IMAGES}/initrd${BAIKAL_COMP_ALG_EXTENSION}" \
-            -n "+" \
+            -n "uInitrd Image for bfk3 board" \
             ${BAIKAL_IMAGES}/${MACHINE}.uInitrd
 }
 
 baikal_do_ubootdtb () {
-               cat << EOF >> ${UBOOT_DTS_FILE}
+               cat << EOF > ${UBOOT_DTS_FILE}
 /dts-v1/;
 
 / {