From patchwork Thu Aug 18 04:04:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivanand Kunijadar X-Patchwork-Id: 12946707 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F778C28B2B for ; Thu, 18 Aug 2022 04:12:39 +0000 (UTC) Received: from mo-csw.securemx.jp (mo-csw.securemx.jp [210.130.202.154]) by mx.groups.io with SMTP id smtpd.web12.38189.1660795954217081874 for ; Wed, 17 Aug 2022 21:12:34 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: toshiba-tsip.com, ip: 210.130.202.154, mailfrom: shivanand.kunijadar@toshiba-tsip.com) Received: by mo-csw.securemx.jp (mx-mo-csw1515) id 27I4CWej019408; Thu, 18 Aug 2022 13:12:32 +0900 X-Iguazu-Qid: 34tMdeWZcVITNmwVb5 X-Iguazu-QSIG: v=2; s=0; t=1660795951; q=34tMdeWZcVITNmwVb5; m=FB/Wo3FAEoUiMfyNC6d3WfWEbNKh1rVWR+1j8/gALIQ= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1510) id 27I4CVr3038142 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 18 Aug 2022 13:12:31 +0900 From: Shivanand.Kunijadar@toshiba-tsip.com To: cip-dev@lists.cip-project.org, jan.kiszka@siemens.com Cc: Shivanand Kunijadar , dinesh.kumar@toshiba-tsip.com, kazuhiro3.hayashi@toshiba.co.jp Subject: [isar-cip-core 1/4] U-Boot: Add custom BBB U-Boot and partitioning Date: Thu, 18 Aug 2022 09:34:25 +0530 X-TSB-HOP2: ON Message-Id: <20220818040428.11124-2-Shivanand.Kunijadar@toshiba-tsip.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220818040428.11124-1-Shivanand.Kunijadar@toshiba-tsip.com> References: <20220818040428.11124-1-Shivanand.Kunijadar@toshiba-tsip.com> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Aug 2022 04:12:28.0126 (UTC) FILETIME=[BA9197E0:01D8B2B8] List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 18 Aug 2022 04:12:39 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/9285 From: Shivanand Kunijadar Add custom-built BBB U-Boot and adapt partitioning layout. Signed-off-by: Shivanand Kunijadar --- 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 --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 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 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 +# +# 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" + From patchwork Thu Aug 18 04:04:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivanand Kunijadar X-Patchwork-Id: 12946704 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73161C25B0E for ; Thu, 18 Aug 2022 04:12:39 +0000 (UTC) Received: from mo-csw.securemx.jp (mo-csw.securemx.jp [210.130.202.153]) by mx.groups.io with SMTP id smtpd.web10.38229.1660795954663093844 for ; Wed, 17 Aug 2022 21:12:35 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: toshiba-tsip.com, ip: 210.130.202.153, mailfrom: shivanand.kunijadar@toshiba-tsip.com) Received: by mo-csw.securemx.jp (mx-mo-csw1514) id 27I4CWZ9006018; Thu, 18 Aug 2022 13:12:33 +0900 X-Iguazu-Qid: 34tKqchBWzQtdtd1ar X-Iguazu-QSIG: v=2; s=0; t=1660795952; q=34tKqchBWzQtdtd1ar; m=uo8JsbZM3EBYAZo86qqv+49FJ5hgZpokyzsGT2RDL+M= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1513) id 27I4CWco040388 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 18 Aug 2022 13:12:32 +0900 From: Shivanand.Kunijadar@toshiba-tsip.com To: cip-dev@lists.cip-project.org, jan.kiszka@siemens.com Cc: Shivanand Kunijadar , dinesh.kumar@toshiba-tsip.com, kazuhiro3.hayashi@toshiba.co.jp Subject: [isar-cip-core 2/4] SWUpdate: add SWUpdate support to BBB Date: Thu, 18 Aug 2022 09:34:26 +0530 X-TSB-HOP2: ON Message-Id: <20220818040428.11124-3-Shivanand.Kunijadar@toshiba-tsip.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220818040428.11124-1-Shivanand.Kunijadar@toshiba-tsip.com> References: <20220818040428.11124-1-Shivanand.Kunijadar@toshiba-tsip.com> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Aug 2022 04:12:28.0189 (UTC) FILETIME=[BA9B34D0:01D8B2B8] List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 18 Aug 2022 04:12:39 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/9287 From: Shivanand Kunijadar This patch adds following changes to support swupdate on BBB - swupdate handler configuration file - Add settings related to swupdate to bbb.conf - Add u-boot specific sw-description.tmpl Signed-off-by: Shivanand Kunijadar --- conf/machine/bbb.conf | 23 ++++++++++++++-- recipes-core/images/files/sw-description.tmpl | 15 +++-------- recipes-core/images/swupdate.inc | 7 ++--- .../files/swupdate.handler.u-boot.ini | 26 +++++++++++++++++++ 4 files changed, 54 insertions(+), 17 deletions(-) create mode 100644 recipes-core/swupdate-handler-roundrobin/files/swupdate.handler.u-boot.ini diff --git a/conf/machine/bbb.conf b/conf/machine/bbb.conf index b592f4d..9cde442 100644 --- a/conf/machine/bbb.conf +++ b/conf/machine/bbb.conf @@ -8,7 +8,26 @@ DISTRO_ARCH = "armhf" -IMAGE_FSTYPES ?= "wic" -IMAGER_INSTALL += "u-boot-omap" +IMAGE_FSTYPES ?= "ext4-img" + +PREFERRED_PROVIDER_u-boot-${MACHINE} = "u-boot-bbb" +PREFERRED_PROVIDER_u-boot-tools = "u-boot-bbb" + +DTB_FILES = "am335x-boneblack.dtb" + +IMAGE_BOOT_FILES = " \ + /usr/lib/u-boot/bbb/u-boot.img;u-boot.img \ + /usr/lib/u-boot/bbb/MLO;MLO \ + ${DEPLOY_DIR_IMAGE}/boot.scr;boot.scr \ + ${DEPLOY_DIR_IMAGE}/uboot.env;uboot.env \ + ${DEPLOY_DIR_IMAGE}/${DTB_FILES};${DTB_FILES} \ + ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE};vmlinuz \ + ${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE};initrd" IMAGE_INSTALL += "u-boot-script" + +IMAGER_INSTALL += "u-boot-bbb" +IMAGER_BUILD_DEPS += "u-boot-bbb" + +# Currently supported bootloader bindings for SWUpdate are 'u-boot' and 'efibootguard'. +SWUPDATE_BOOTLOADER = "u-boot" diff --git a/recipes-core/images/files/sw-description.tmpl b/recipes-core/images/files/sw-description.tmpl index f5cafeb..f6e7bdc 100644 --- a/recipes-core/images/files/sw-description.tmpl +++ b/recipes-core/images/files/sw-description.tmpl @@ -11,10 +11,10 @@ software = { version = "0.2"; - name = "cip software update"; + name = "cip software update" images: ({ filename = "${ROOTFS_PARTITION_NAME}"; - device = "C:BOOT0:linux.efi->fedcba98-7654-3210-cafe-5e0710000001,C:BOOT1:linux.efi->fedcba98-7654-3210-cafe-5e0710000002"; + device = "/dev/mmcblk0p2,/dev/mmcblk0p3"; type = "roundrobin"; compressed = "zlib"; filesystem = "ext4"; @@ -22,14 +22,5 @@ software = subtype = "image"; }; }); - files: ({ - filename = "linux.efi"; - path = "linux.efi"; - type = "roundrobin"; - device = "C:BOOT0:linux.efi->BOOT0,C:BOOT1:linux.efi->BOOT1"; - filesystem = "vfat"; - properties: { - subtype = "kernel"; - }; - }); } + diff --git a/recipes-core/images/swupdate.inc b/recipes-core/images/swupdate.inc index e0252df..2677046 100644 --- a/recipes-core/images/swupdate.inc +++ b/recipes-core/images/swupdate.inc @@ -14,11 +14,12 @@ inherit read-only-rootfs ROOTFS_PARTITION_NAME = "${IMAGE_FULLNAME}.wic.p4.gz" -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" +EXTRACT_PARTITIONS = "img4" +ROOTFS_PARTITION_NAME = "${IMAGE_FULLNAME}.wic.p2.gz" SRC_URI += "file://sw-description.tmpl" TEMPLATE_FILES += "sw-description.tmpl" +TEMPLATE_VARS += "PN ROOTFS_PARTITION_NAME KERNEL_IMAGE INITRD_IMAGE" -TEMPLATE_VARS += "ROOTFS_PARTITION_NAME" +SWU_ADDITIONAL_FILES += "${ROOTFS_PARTITION_NAME}" -SWU_ADDITIONAL_FILES += "linux.efi ${ROOTFS_PARTITION_NAME}" diff --git a/recipes-core/swupdate-handler-roundrobin/files/swupdate.handler.u-boot.ini b/recipes-core/swupdate-handler-roundrobin/files/swupdate.handler.u-boot.ini new file mode 100644 index 0000000..aff1105 --- /dev/null +++ b/recipes-core/swupdate-handler-roundrobin/files/swupdate.handler.u-boot.ini @@ -0,0 +1,26 @@ +[image] +chainhandler=raw + +[image.selector] +method=cmdline_rr +key=root + +[image.bootenv] +ustate=1 + +[kernel] +chainhandler=rawfile + +[kernel.selector] +method=cmdline_rrmap +key=root + +[kernel.bootenv] +kernelfile=C:BOOT${rrindex}:vmlinuz-linux + +[initrd] +chainhandler=rawfile + +[initrd.selector] +method=cmdline_rrmap +key=root From patchwork Thu Aug 18 04:04:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivanand Kunijadar X-Patchwork-Id: 12946705 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 802C1C32774 for ; Thu, 18 Aug 2022 04:12:39 +0000 (UTC) Received: from mo-csw.securemx.jp (mo-csw.securemx.jp [210.130.202.154]) by mx.groups.io with SMTP id smtpd.web10.38230.1660795955001224132 for ; Wed, 17 Aug 2022 21:12:35 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: toshiba-tsip.com, ip: 210.130.202.154, mailfrom: shivanand.kunijadar@toshiba-tsip.com) Received: by mo-csw.securemx.jp (mx-mo-csw1515) id 27I4CXjH019485; Thu, 18 Aug 2022 13:12:34 +0900 X-Iguazu-Qid: 34tMXISijY6hN7RMHJ X-Iguazu-QSIG: v=2; s=0; t=1660795953; q=34tMXISijY6hN7RMHJ; m=uYi5ad5Gi27dB8YSQXUebnAX0oLqDnA522OwR/JzUeY= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1512) id 27I4CXxR024107 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 18 Aug 2022 13:12:33 +0900 From: Shivanand.Kunijadar@toshiba-tsip.com To: cip-dev@lists.cip-project.org, jan.kiszka@siemens.com Cc: Shivanand Kunijadar , dinesh.kumar@toshiba-tsip.com, kazuhiro3.hayashi@toshiba.co.jp Subject: [isar-cip-core 3/4] customizations: add custom modifications for swupdate Date: Thu, 18 Aug 2022 09:34:27 +0530 X-TSB-HOP2: ON Message-Id: <20220818040428.11124-4-Shivanand.Kunijadar@toshiba-tsip.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220818040428.11124-1-Shivanand.Kunijadar@toshiba-tsip.com> References: <20220818040428.11124-1-Shivanand.Kunijadar@toshiba-tsip.com> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Aug 2022 04:12:28.0283 (UTC) FILETIME=[BAA98CB0:01D8B2B8] List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 18 Aug 2022 04:12:39 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/9286 From: Shivanand Kunijadar Add /boot entry at /etc/fstab for /etc/fw_config and also add network settings for SSH connection Signed-off-by: Shivanand Kunijadar --- recipes-core/customizations/common.inc | 5 ++++- recipes-core/customizations/files/interfaces | 6 ++++++ recipes-core/images/cip-core-image.bb | 9 +++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 recipes-core/customizations/files/interfaces diff --git a/recipes-core/customizations/common.inc b/recipes-core/customizations/common.inc index 1124ff2..e5f31ca 100644 --- a/recipes-core/customizations/common.inc +++ b/recipes-core/customizations/common.inc @@ -17,7 +17,8 @@ SRC_URI = " \ file://postinst \ file://ethernet \ file://99-silent-printk.conf \ - file://99-watchdog.conf" + file://99-watchdog.conf \ + file://interfaces" WIRELESS_FIRMWARE_PACKAGE ?= "" INSTALL_WIRELESS_TOOLS ??= "0" @@ -38,4 +39,6 @@ do_install() { install -v -d ${D}/etc/systemd/system.conf.d install -v -m 644 ${WORKDIR}/99-watchdog.conf ${D}/etc/systemd/system.conf.d/ + + install -v -m 644 ${WORKDIR}/interfaces ${D}/etc/network/interfaces.d/ } diff --git a/recipes-core/customizations/files/interfaces b/recipes-core/customizations/files/interfaces new file mode 100644 index 0000000..be04284 --- /dev/null +++ b/recipes-core/customizations/files/interfaces @@ -0,0 +1,6 @@ +auto eth0 +iface eth0 inet static + address 192.168.2.2 + netmask 255.255.255.0 + network 192.168.2.0 + broadcast 192.168.2.255 diff --git a/recipes-core/images/cip-core-image.bb b/recipes-core/images/cip-core-image.bb index 3f8c320..7bf0f22 100644 --- a/recipes-core/images/cip-core-image.bb +++ b/recipes-core/images/cip-core-image.bb @@ -18,3 +18,12 @@ IMAGE_INSTALL += "customizations" CIP_IMAGE_OPTIONS ?= "" include ${CIP_IMAGE_OPTIONS} + +image_configure_fstab_append () { + # Add /boot to /etc/fstab for fw_printenv + echo "/dev/mmcblk0p1 /boot vfat defaults,nofail 0 0" | sudo tee -a ${IMAGE_ROOTFS}/etc/fstab + # remove /var partition + sudo sed -i '/LABEL=var/d' ${IMAGE_ROOTFS}/etc/fstab + # make /dev/root as read-write + sudo sed -i 's/defaults,ro/defaults/' ${IMAGE_ROOTFS}/etc/fstab +} From patchwork Thu Aug 18 04:04:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivanand Kunijadar X-Patchwork-Id: 12946703 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71245C00140 for ; Thu, 18 Aug 2022 04:12:39 +0000 (UTC) Received: from mo-csw.securemx.jp (mo-csw.securemx.jp [210.130.202.153]) by mx.groups.io with SMTP id smtpd.web12.38191.1660795956713326893 for ; Wed, 17 Aug 2022 21:12:37 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: toshiba-tsip.com, ip: 210.130.202.153, mailfrom: shivanand.kunijadar@toshiba-tsip.com) Received: by mo-csw.securemx.jp (mx-mo-csw1514) id 27I4CZXM006110; Thu, 18 Aug 2022 13:12:35 +0900 X-Iguazu-Qid: 34tIWdU4gpg8cBpjrV X-Iguazu-QSIG: v=2; s=0; t=1660795955; q=34tIWdU4gpg8cBpjrV; m=8kT2+HKbezwEJBvSlV6jfQ0Qh9JxTbzmYCMPndihBiA= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1512) id 27I4CYM3024152 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 18 Aug 2022 13:12:35 +0900 From: Shivanand.Kunijadar@toshiba-tsip.com To: cip-dev@lists.cip-project.org, jan.kiszka@siemens.com Cc: Shivanand Kunijadar , dinesh.kumar@toshiba-tsip.com, kazuhiro3.hayashi@toshiba.co.jp Subject: [isar-cip-core 4/4] Added README for BBB swupdate Date: Thu, 18 Aug 2022 09:34:28 +0530 X-TSB-HOP2: ON Message-Id: <20220818040428.11124-5-Shivanand.Kunijadar@toshiba-tsip.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220818040428.11124-1-Shivanand.Kunijadar@toshiba-tsip.com> References: <20220818040428.11124-1-Shivanand.Kunijadar@toshiba-tsip.com> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Aug 2022 04:12:28.0332 (UTC) FILETIME=[BAB106C0:01D8B2B8] List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 18 Aug 2022 04:12:39 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/9288 From: Shivanand Kunijadar Signed-off-by: Shivanand Kunijadar --- doc/README.swupdate.bbb.md | 90 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 doc/README.swupdate.bbb.md diff --git a/doc/README.swupdate.bbb.md b/doc/README.swupdate.bbb.md new file mode 100644 index 0000000..82b96aa --- /dev/null +++ b/doc/README.swupdate.bbb.md @@ -0,0 +1,90 @@ +# SWUpdate support for the CIP core image + +This document describes how to build and test the SWUpdate on BBB + +Start with cloning the isar-cip-core repository: +``` +host$ git clone https://gitlab.com/cip-project/cip-core/isar-cip-core.git +host$ cd isar-cip-core +``` + +# Building and testing the CIP Core image + +Set up `kas-container` as described in the [top-level README](../README.md). +Then build the image which will later serve as update package: +``` +host$ ./kas-container build kas-cip.yml:kas/board/bbb.yml:kas/opt/swupdate.yml +``` + +To flash, e.g., the BeagleBone Black image to an SD card, run +``` +dd if=build/tmp/deploy/images/bbb/cip-core-image-cip-core-bullseye-bbb.wic \ + of=/dev/ bs=1M status=progress +``` + +or via bmap-tools +``` +bmaptool copy build/tmp/deploy/images/bbb/cip-core-image-cip-core-bullseye-bbb.wic /dev/ +``` + +Prepare the hardware connections + +* Connect a serial port cable between the host PC and the BBB +* Connect an Ethernet cable between the host PC and the BBB + +Insert SD card to BBB, hold S2 button while applying power suppy to BBB. + +Once the system is up, check which partition is booted, e.g. with "df -h" command : +``` +root@demo:~# df -h +Filesystem Size Used Avail Use% Mounted on +udev 238M 0 238M 0% /dev +tmpfs 500M 6.5M 494M 2% /run +/dev/mmcblk0p2 2.5G 297M 2.1G 13% / +tmpfs 249M 0 249M 0% /dev/shm +tmpfs 5.0M 0 5.0M 0% /run/lock +tmpfs 249M 0 249M 0% /sys/fs/cgroup +tmpfs 249M 0 249M 0% /tmp +/dev/mmcblk0p1 32M 936K 32M 3% /boot +``` + +In host PC, configure below settings for Ethernet IPv4. + +* IP address: 192.168.2.1 +* Subnet mask: 255.255.255.0 + +Execute below command to confirm 192.168.2.1 is accessible from BBB. +``` +root@demo:~# ping 192.168.2.1 +``` + +Copy .swu file to BBB from host PC using below command. +``` +host$ scp build/tmp/deploy/images/bbb/cip-core-image-cip-core-bullseye-bbb.swu root@192.168.2.2:/root/ +``` + +Now apply swupdate and reboot +``` +root@demo:~# swupdate -i cip-core-image-cip-core-bullseye-bbb.swu +root@demo:~# reboot +``` + +Check which partition is booted, e.g. with "df -h" command and the rootfs should have changed +``` +root@demo:~# df -h +Filesystem Size Used Avail Use% Mounted on +udev 238M 0 238M 0% /dev +tmpfs 500M 6.5M 494M 2% /run +/dev/mmcblk0p3 2.5G 297M 2.1G 13% / +tmpfs 249M 0 249M 0% /dev/shm +tmpfs 5.0M 0 5.0M 0% /run/lock +tmpfs 249M 0 249M 0% /sys/fs/cgroup +tmpfs 249M 0 249M 0% /tmp +/dev/mmcblk0p1 32M 936K 32M 3% /boot +``` + +Set ustate to 0 after successful swupdate +``` +root@demo:~# ln -s /usr/bin/fw_printenv /usr/bin/fw_setenv +root@demo:~# fw_setenv ustate 0 +```