diff mbox series

[isar-cip-core,1/4] U-Boot: Add custom BBB U-Boot and partitioning

Message ID 20220818040428.11124-2-Shivanand.Kunijadar@toshiba-tsip.com (mailing list archive)
State Handled Elsewhere
Headers show
Series SWUpdate on BBB | expand

Commit Message

Shivanand Kunijadar Aug. 18, 2022, 4:04 a.m. UTC
From: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>

Add custom-built BBB U-Boot and adapt partitioning
layout.

Signed-off-by: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
---
 recipes-bsp/u-boot-bbb/files/boot-bbb.scr.in |  79 +++++++++++++++++++
 recipes-bsp/u-boot-bbb/files/fw_env.config   |   1 +
 recipes-bsp/u-boot-bbb/files/ubootenv-bbb    | Bin 0 -> 131072 bytes
 recipes-bsp/u-boot-bbb/u-boot-bbb_2022.05.bb |  59 ++++++++++++++
 wic/bbb-u-boot.wks.in                        |  13 +++
 5 files changed, 152 insertions(+)
 create mode 100644 recipes-bsp/u-boot-bbb/files/boot-bbb.scr.in
 create mode 100644 recipes-bsp/u-boot-bbb/files/fw_env.config
 create mode 100644 recipes-bsp/u-boot-bbb/files/ubootenv-bbb
 create mode 100644 recipes-bsp/u-boot-bbb/u-boot-bbb_2022.05.bb
 create mode 100644 wic/bbb-u-boot.wks.in
diff mbox series

Patch

diff --git a/recipes-bsp/u-boot-bbb/files/boot-bbb.scr.in b/recipes-bsp/u-boot-bbb/files/boot-bbb.scr.in
new file mode 100644
index 0000000..65bf9e4
--- /dev/null
+++ b/recipes-bsp/u-boot-bbb/files/boot-bbb.scr.in
@@ -0,0 +1,79 @@ 
+setenv loadaddr 0x82000000
+setenv fdtaddr 0x88000000
+setenv rdaddr 0x88080000
+
+echo "#########################################################"
+if printenv ustate; then
+    echo "ustate value is ${ustate}"
+    if test ${ustate} = 0; then
+        ## swprovisioning did not run, nothing to do.
+        echo "ustate is: ok"
+        echo "Update did not run. Boot normally."
+    elif test ${ustate} = 1; then
+        ## swprovisioning did perform an update, hence
+        ## * set new state to "testing"
+        ## * switch root filesystems
+
+        setenv ustate 2
+        #echo "setting swprovisioning state to: testing"
+        echo "Setting ustate to: testing"
+        echo "ustate value has been changed to ${ustate}"
+
+        setenv chg "${bootpart_root}"
+        setenv bootpart_root "${bootpart_root2}"
+        setenv bootpart_root2 "${chg}"
+        echo "new bootpart: ${bootpart_root} (was: ${bootpart_root2})"
+
+        saveenv
+    elif test ${ustate} = 2; then
+        ## swprovisioning did not run, the update is not confirmed
+        ## working by the swprovisioning daemon, hence
+        ## * set new state to "failed"
+        ## * switch back to old root filesystem
+
+        setenv chg "${bootpart_root}"
+        setenv bootpart_root "${bootpart_root2}"
+        setenv bootpart_root2 "${chg}"
+        echo "update not confirmed working!, restored root to ${bootpart_root} (was: ${bootpart_root2})"
+
+        setenv ustate 3
+        #echo "setting swprovisioning state to: failed"
+        echo "Setting ustate to: failed"
+        echo "ustate value has been changed to ${ustate}"
+
+        saveenv
+    elif test ${ustate} = 3; then
+        ## Return ustate from 3 to 0 to handle new update
+        setenv ustate 0
+        echo "Return ustate to normal boot to be able to handle new update"
+        echo "Setting ustate to: ok"
+        echo "ustate value has been changed to ${ustate}"
+
+        saveenv
+    else
+        ## error handling
+        echo "unsupported ustate value ${ustate}. reset."
+
+	reset
+    fi
+else
+    ## first bootup of device, initialize environment
+    #echo "doing first-run initialization of swprovisioning environment"
+    echo "doing first-run initialization of environment variables"
+    setenv ustate 0
+    setenv bootpart_root 2
+    setenv bootpart_root2 3
+    echo "Setting ustate to: ok"
+    echo "ustate value has been created. The value is ${ustate}."
+
+    saveenv
+fi
+echo "#########################################################"
+
+setenv bootargs "console=ttyO0,115200 root=/dev/mmcblk0p${bootpart_root} ro rootwait omap_wdt.early_enable=1 omap_wdt.timer_margin=60"
+
+load mmc 0:1 ${fdtaddr} am335x-boneblack.dtb
+load mmc 0:1 ${loadaddr} vmlinuz
+load mmc 0:1 ${rdaddr} initrd
+setenv rdsize ${filesize}
+bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}
diff --git a/recipes-bsp/u-boot-bbb/files/fw_env.config b/recipes-bsp/u-boot-bbb/files/fw_env.config
new file mode 100644
index 0000000..dc22d7a
--- /dev/null
+++ b/recipes-bsp/u-boot-bbb/files/fw_env.config
@@ -0,0 +1 @@ 
+/boot/uboot.env	0x0000	0x20000
diff --git a/recipes-bsp/u-boot-bbb/files/ubootenv-bbb b/recipes-bsp/u-boot-bbb/files/ubootenv-bbb
new file mode 100644
index 0000000000000000000000000000000000000000..cd1e027d2abaad0859fd2d5c1adf0718f8c99f2e
GIT binary patch
literal 131072
zcmeI2VQ<?w5{CU#h~0eHVq-_Plhm;x;F`9(2->E-c8lF_f^5mDF1F;8<TPp4!2N;y
z&-c!dl4Zwf(qiv`1Kwgc5y|0j_>de9$^7f*fB!wqC!hQ<pSQyNq6p^miJvc1GfmQH
zxlE!_5tng#WyV=nih!A9X_3uhfA7|Pt<2tSw$Q?r$sy*yd-ndfj~~xoKt@y`_p=sE
zi}Ge6HPMI&+VrY54wq3Lma*UM9`!u0HO|63^22$*e{^jVK^o3u{~0n)&tL!M^78n~
z_q^v$J}BZm31@!)xO;eddiv_*q~C{NRt8~EO!8z=`m-#IU~Cj$i5+4$KGWrVHN;m^
zlzA3Ng+-W`QfO<1QItz+k;l{IdR1kwMyAM?`6S*Hv@Jq17$<3%-}uSYOrz3>7D(bV
zkk24T{qj?s8fg&X`g?w{Efdd*c((}P!`_)%H<~7+Z|vJ;oTu@uvc<rH1F=MZU@ml!
zF*1*}eeZTl-DXEOI<Z@Jt2d6~bvaAY<+Wej6k;6sJ#Og2^k#EZkgA7IGzHM8ssl7U
z#RQZ*jE!IBH!hKszDz9Sr*Ro9i*Zn3ikCjVjDFcdt2QqD17iW&Y&&&==+k83i;@m9
zI?H5!(JU@Di%ccxWSS=Wv14&ieRRZfD=AAaE(;&4$}_Y0BAndFGWHC9bQ>96lZI*J
znZ<Q%#4@ARC-cZI3`iSq*frkupzG<s+M;@{ugj{swv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H{0wh2JBtQZrKmsH{0wh2JBtQZrKmsH{0wh2JBtQZrKmsH{0wh2J
zBtQZrKmsH{0wh2JBtQZrKmsH{0wh2JBtQZrKmsH{0wh2JBtQZrKmsH{0wh2JBtQZr
zKmsH{0wh2JBtQZrKmsH{0wh2JBtQZrKmsH{0wh2JBtQZrKmsH{0wh2JBtQZrKmsH{
z0wh2JBtQZrKmsH{0wh2JBtQZrKmsH{0wh2JBtQZrKmsH{0wh2JBtQZrKmsH{0wh2J
zBtQZrKmsH{0wh2JBtQZrKmsH{0wh2JBtQZrKmsH{0wh2JBtQZrKmsH{0wh2JBtQZr
zKmsH{0wh2JBtQZrKmsH{0wh2JBtQZrKmsH{0wh2JBtQZrKmsH{0wh2JBtQZrKmsH{
K0wnNXBJdw}wR>3r

literal 0
HcmV?d00001

diff --git a/recipes-bsp/u-boot-bbb/u-boot-bbb_2022.05.bb b/recipes-bsp/u-boot-bbb/u-boot-bbb_2022.05.bb
new file mode 100644
index 0000000..a8d2a5a
--- /dev/null
+++ b/recipes-bsp/u-boot-bbb/u-boot-bbb_2022.05.bb
@@ -0,0 +1,59 @@ 
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2022
+#
+# Authors:
+#  Christian Storm <christian.storm@siemens.com>
+#
+# SPDX-License-Identifier: MIT
+#
+
+DESCRIPTION = "U-Boot for BBB"
+
+# To build u-boot-tools package
+U_BOOT_TOOLS_PACKAGE = "1"
+U_BOOT_CONFIG_PACKAGE = "1"
+
+require recipes-bsp/u-boot/u-boot-custom.inc
+
+U_BOOT_REV = "c4fddedc48f336eabc4ce3f74940e6aa372de18c"
+
+SRC_URI += " \
+    git://gitlab.denx.de/u-boot/u-boot.git;rev=${U_BOOT_REV};protocol=https \
+    file://boot-bbb.scr.in \
+    file://fw_env.config \
+    file://ubootenv-bbb"
+
+# Build U-Boot with MLO (MLO does not build with $ make spl)
+U_BOOT_BIN = ""
+
+U_BOOT_CONFIG = "am335x_evm_defconfig"
+
+S = "${WORKDIR}/git"
+
+DEBIAN_BUILD_DEPENDS =. "openssl, u-boot-tools,"
+
+do_prepare_build_append() {
+    echo "MLO /usr/lib/u-boot/${MACHINE}" > \
+        ${S}/debian/u-boot-${MACHINE}.install
+    echo "u-boot.img /usr/lib/u-boot/${MACHINE}" >> \
+        ${S}/debian/u-boot-${MACHINE}.install
+    echo "tools/env/fw_printenv   /usr/bin/" >> \
+        ${S}/debian/u-boot-tools.install
+    echo "tools/env/fw_env.config	/etc" >> \
+        ${S}/debian/u-boot-tools.install
+
+    echo "\ngen_bootscript:" >> ${S}/debian/rules
+    echo "\tmkimage -A arm -O linux -T script -d ../boot-bbb.scr.in ../boot.scr" >> ${S}/debian/rules
+    sed -i 's/\(override_dh_auto_build:\)/\1 gen_bootscript/' ${S}/debian/rules
+
+    # Install BBB's fw_env.config
+    install -v -m 0644 ${WORKDIR}/fw_env.config ${S}/tools/env/fw_env.config
+}
+
+dpkg_runbuild_append() {
+    mkdir -p ${DEPLOY_DIR_IMAGE}
+    install ${WORKDIR}/boot.scr ${DEPLOY_DIR_IMAGE}/boot.scr
+    install ${WORKDIR}/ubootenv-bbb ${DEPLOY_DIR_IMAGE}/uboot.env
+}
diff --git a/wic/bbb-u-boot.wks.in b/wic/bbb-u-boot.wks.in
new file mode 100644
index 0000000..f1cf410
--- /dev/null
+++ b/wic/bbb-u-boot.wks.in
@@ -0,0 +1,13 @@ 
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2019
+#
+# SPDX-License-Identifier: MIT
+#
+part --source bootimg-partition --ondisk mmcblk0p1 --fstype vfat --label boot --align 1 --size 32 --overhead-factor 1 --extra-space 0 --active
+part / --source rootfs-u-boot --ondisk mmcblk0p2 --fstype ext4 --label platformA --align 1024 --size 2048
+part / --source rootfs-u-boot --ondisk mmcblk0p3 --fstype ext4 --label platformB --align 1024 --size 2048
+
+bootloader --append "rw rootwait"
+