All of lore.kernel.org
 help / color / mirror / Atom feed
* [isar-cip-core] swupdate: add recipe to cause kernel panic during system boot
@ 2022-01-27 14:20 Shivanand.Kunijadar
  2022-01-27 15:55 ` Jan Kiszka
  0 siblings, 1 reply; 11+ messages in thread
From: Shivanand.Kunijadar @ 2022-01-27 14:20 UTC (permalink / raw)
  To: cip-dev, jan.kiszka, quirin.gylstorff; +Cc: Shivanand Kunijadar, dinesh.kumar

From: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>

Cc: dinesh.kumar@toshiba-tsip.com,
    kazuhiro3.hayashi@toshiba.co.jp,
    akihiro27.suzuki@toshiba.co.jp

This recipe adds necessary scripts to cause kernel panic during system
boot, these scripts are required to test swupdate rollback feature.

Signed-off-by: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
---
 kas/opt/swupdate-rollback.yml                 | 19 +++++++++++++
 .../files/sysrq-panic.service                 | 10 +++++++
 .../swupdate-rollback/files/sysrq-panic.sh    |  4 +++
 .../swupdate-rollback/swupdate-rollback.bb    | 27 +++++++++++++++++++
 4 files changed, 60 insertions(+)
 create mode 100644 kas/opt/swupdate-rollback.yml
 create mode 100644 recipes-core/swupdate-rollback/files/sysrq-panic.service
 create mode 100644 recipes-core/swupdate-rollback/files/sysrq-panic.sh
 create mode 100644 recipes-core/swupdate-rollback/swupdate-rollback.bb

diff --git a/kas/opt/swupdate-rollback.yml b/kas/opt/swupdate-rollback.yml
new file mode 100644
index 0000000..a3b0e28
--- /dev/null
+++ b/kas/opt/swupdate-rollback.yml
@@ -0,0 +1,19 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Toshiba Corporation, 2022
+#
+# Authors:
+#  Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
+#
+# SPDX-License-Identifier: MIT
+#
+# This kas file adds necessary scripts to cause kernel panic during system boot
+# which are required to test swupdate rollback feature
+
+header:
+  version: 10
+
+local_conf_header:
+  swupdate: |
+    IMAGE_INSTALL_append = " swupdate-rollback"
diff --git a/recipes-core/swupdate-rollback/files/sysrq-panic.service b/recipes-core/swupdate-rollback/files/sysrq-panic.service
new file mode 100644
index 0000000..ae868f9
--- /dev/null
+++ b/recipes-core/swupdate-rollback/files/sysrq-panic.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=sysrq panic
+
+[Service]
+Type=oneshot
+ExecStart=/root/sysrq-panic.sh
+
+[Install]
+WantedBy=default.target
+
diff --git a/recipes-core/swupdate-rollback/files/sysrq-panic.sh b/recipes-core/swupdate-rollback/files/sysrq-panic.sh
new file mode 100644
index 0000000..a3c1bb7
--- /dev/null
+++ b/recipes-core/swupdate-rollback/files/sysrq-panic.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+echo c > /proc/sysrq-trigger
+
diff --git a/recipes-core/swupdate-rollback/swupdate-rollback.bb b/recipes-core/swupdate-rollback/swupdate-rollback.bb
new file mode 100644
index 0000000..5c93bb5
--- /dev/null
+++ b/recipes-core/swupdate-rollback/swupdate-rollback.bb
@@ -0,0 +1,27 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Toshiba Corporation, 2022
+#
+# Authors:
+#  Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
+#
+# SPDX-License-Identifier: MIT
+#
+
+inherit dpkg-raw
+
+DESCRIPTION = "Script and service files to cause kernel panic"
+
+SRC_URI = " \
+    file://sysrq-panic.sh \
+    file://sysrq-panic.service"
+
+do_install() {
+	install -v -d ${D}/root
+	install -v -m 0755 ${WORKDIR}/sysrq-panic.sh ${D}/root/
+	install -v -d ${D}/lib/systemd/system
+	install -v -m 0644 ${WORKDIR}/sysrq-panic.service ${D}/lib/systemd/system/
+	install -v -d ${D}/etc/systemd/system/default.target.wants
+	ln -s /lib/systemd/system/sysrq-panic.service ${D}/etc/systemd/system/default.target.wants/
+}
-- 
2.20.1




^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [isar-cip-core] swupdate: add recipe to cause kernel panic during system boot
  2022-01-27 14:20 [isar-cip-core] swupdate: add recipe to cause kernel panic during system boot Shivanand.Kunijadar
@ 2022-01-27 15:55 ` Jan Kiszka
  2022-02-01 15:35   ` [isar-cip-core v2 0/2] Add necessary steps to verify swupdate Shivanand.Kunijadar
                     ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Jan Kiszka @ 2022-01-27 15:55 UTC (permalink / raw)
  To: Shivanand.Kunijadar, cip-dev, quirin.gylstorff; +Cc: dinesh.kumar

On 27.01.22 15:20, Shivanand.Kunijadar@toshiba-tsip.com wrote:
> From: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
> 
> Cc: dinesh.kumar@toshiba-tsip.com,
>      kazuhiro3.hayashi@toshiba.co.jp,
>      akihiro27.suzuki@toshiba.co.jp
> 
> This recipe adds necessary scripts to cause kernel panic during system
> boot, these scripts are required to test swupdate rollback feature.

Valuable piece in the puzzle! I would just use a different name than 
"swupdate-rollback". Effectively, this creates a broken boot, not only 
for swupdate, no? Then call it accordingly.

The fact that a broken boot will trigger a rollback under swupdate is a 
consequence, but not directly related to these changes.

> 
> Signed-off-by: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
> ---
>   kas/opt/swupdate-rollback.yml                 | 19 +++++++++++++
>   .../files/sysrq-panic.service                 | 10 +++++++
>   .../swupdate-rollback/files/sysrq-panic.sh    |  4 +++
>   .../swupdate-rollback/swupdate-rollback.bb    | 27 +++++++++++++++++++
>   4 files changed, 60 insertions(+)
>   create mode 100644 kas/opt/swupdate-rollback.yml
>   create mode 100644 recipes-core/swupdate-rollback/files/sysrq-panic.service
>   create mode 100644 recipes-core/swupdate-rollback/files/sysrq-panic.sh
>   create mode 100644 recipes-core/swupdate-rollback/swupdate-rollback.bb
> 
> diff --git a/kas/opt/swupdate-rollback.yml b/kas/opt/swupdate-rollback.yml
> new file mode 100644
> index 0000000..a3b0e28
> --- /dev/null
> +++ b/kas/opt/swupdate-rollback.yml
> @@ -0,0 +1,19 @@
> +#
> +# CIP Core, generic profile
> +#
> +# Copyright (c) Toshiba Corporation, 2022
> +#
> +# Authors:
> +#  Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
> +#
> +# SPDX-License-Identifier: MIT
> +#
> +# This kas file adds necessary scripts to cause kernel panic during system boot
> +# which are required to test swupdate rollback feature
> +
> +header:
> +  version: 10
> +
> +local_conf_header:
> +  swupdate: |
> +    IMAGE_INSTALL_append = " swupdate-rollback"
> diff --git a/recipes-core/swupdate-rollback/files/sysrq-panic.service b/recipes-core/swupdate-rollback/files/sysrq-panic.service
> new file mode 100644
> index 0000000..ae868f9
> --- /dev/null
> +++ b/recipes-core/swupdate-rollback/files/sysrq-panic.service
> @@ -0,0 +1,10 @@
> +[Unit]
> +Description=sysrq panic
> +
> +[Service]
> +Type=oneshot
> +ExecStart=/root/sysrq-panic.sh
> +
> +[Install]
> +WantedBy=default.target
> +
> diff --git a/recipes-core/swupdate-rollback/files/sysrq-panic.sh b/recipes-core/swupdate-rollback/files/sysrq-panic.sh
> new file mode 100644
> index 0000000..a3c1bb7
> --- /dev/null
> +++ b/recipes-core/swupdate-rollback/files/sysrq-panic.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +
> +echo c > /proc/sysrq-trigger

Why not doing that directly in the service file (/bin/sh -c "...")?

Jan

> +
> diff --git a/recipes-core/swupdate-rollback/swupdate-rollback.bb b/recipes-core/swupdate-rollback/swupdate-rollback.bb
> new file mode 100644
> index 0000000..5c93bb5
> --- /dev/null
> +++ b/recipes-core/swupdate-rollback/swupdate-rollback.bb
> @@ -0,0 +1,27 @@
> +#
> +# CIP Core, generic profile
> +#
> +# Copyright (c) Toshiba Corporation, 2022
> +#
> +# Authors:
> +#  Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
> +#
> +# SPDX-License-Identifier: MIT
> +#
> +
> +inherit dpkg-raw
> +
> +DESCRIPTION = "Script and service files to cause kernel panic"
> +
> +SRC_URI = " \
> +    file://sysrq-panic.sh \
> +    file://sysrq-panic.service"
> +
> +do_install() {
> +	install -v -d ${D}/root
> +	install -v -m 0755 ${WORKDIR}/sysrq-panic.sh ${D}/root/
> +	install -v -d ${D}/lib/systemd/system
> +	install -v -m 0644 ${WORKDIR}/sysrq-panic.service ${D}/lib/systemd/system/
> +	install -v -d ${D}/etc/systemd/system/default.target.wants
> +	ln -s /lib/systemd/system/sysrq-panic.service ${D}/etc/systemd/system/default.target.wants/
> +}


-- 
Siemens AG, Technology
Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [isar-cip-core v2 0/2] Add necessary steps to verify swupdate
  2022-01-27 15:55 ` Jan Kiszka
@ 2022-02-01 15:35   ` Shivanand.Kunijadar
  2022-02-03 11:23     ` quirin.gylstorff
  2022-02-01 15:35   ` [isar-cip-core v2 1/2] Add recipe to cause kernel panic during system boot Shivanand.Kunijadar
  2022-02-01 15:35   ` [isar-cip-core v2 2/2] README.swupdate.md: add readme file with steps to verify swupdate Kunijadar Shivanand
  2 siblings, 1 reply; 11+ messages in thread
From: Shivanand.Kunijadar @ 2022-02-01 15:35 UTC (permalink / raw)
  To: cip-dev, jan.kiszka, quirin.gylstorff
  Cc: Shivanand Kunijadar, dinesh.kumar, kazuhiro3.hayashi, akihiro27.suzuki

From: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>

The current isar-cip-core provides verification of successful swupdate
but lacks the recipe to verify swupdate-rollback feature, the below
patches provides the necessary script to verify swupdate-rollback. 

Shivanand Kunijadar (2):
  Add recipe to cause kernel panic during system boot
  README.swupdate.md: add readme file with steps to verify swupdate

 doc/README.swupdate.md                        | 208 ++++++++++++++++++
 kas/opt/kernel-panic.yml                      |  18 ++
 .../kernel-panic/files/sysrq-panic.service    |  10 +
 recipes-core/kernel-panic/kernel-panic.bb     |  24 ++
 4 files changed, 260 insertions(+)
 create mode 100644 doc/README.swupdate.md
 create mode 100644 kas/opt/kernel-panic.yml
 create mode 100644 recipes-core/kernel-panic/files/sysrq-panic.service
 create mode 100644 recipes-core/kernel-panic/kernel-panic.bb

-- 
2.20.1




^ permalink raw reply	[flat|nested] 11+ messages in thread

* [isar-cip-core v2 1/2] Add recipe to cause kernel panic during system boot
  2022-01-27 15:55 ` Jan Kiszka
  2022-02-01 15:35   ` [isar-cip-core v2 0/2] Add necessary steps to verify swupdate Shivanand.Kunijadar
@ 2022-02-01 15:35   ` Shivanand.Kunijadar
  2022-02-04  6:50     ` Jan Kiszka
  2022-02-01 15:35   ` [isar-cip-core v2 2/2] README.swupdate.md: add readme file with steps to verify swupdate Kunijadar Shivanand
  2 siblings, 1 reply; 11+ messages in thread
From: Shivanand.Kunijadar @ 2022-02-01 15:35 UTC (permalink / raw)
  To: cip-dev, jan.kiszka, quirin.gylstorff
  Cc: Shivanand Kunijadar, dinesh.kumar, kazuhiro3.hayashi, akihiro27.suzuki

From: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>

This recipe adds systemd service to cause kernel panic during system
boot.
It helps to check the swupdate-rollback feature.

Signed-off-by: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
---
 kas/opt/kernel-panic.yml                      | 18 ++++++++++++++
 .../kernel-panic/files/sysrq-panic.service    | 10 ++++++++
 recipes-core/kernel-panic/kernel-panic.bb     | 24 +++++++++++++++++++
 3 files changed, 52 insertions(+)
 create mode 100644 kas/opt/kernel-panic.yml
 create mode 100644 recipes-core/kernel-panic/files/sysrq-panic.service
 create mode 100644 recipes-core/kernel-panic/kernel-panic.bb

diff --git a/kas/opt/kernel-panic.yml b/kas/opt/kernel-panic.yml
new file mode 100644
index 0000000..47df7b1
--- /dev/null
+++ b/kas/opt/kernel-panic.yml
@@ -0,0 +1,18 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Toshiba Corporation, 2022
+#
+# Authors:
+#  Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
+#
+# SPDX-License-Identifier: MIT
+#
+# This kas file adds systemd service file to cause kernel panic during system boot.
+
+header:
+  version: 10
+
+local_conf_header:
+  kernel-panic: |
+    IMAGE_INSTALL_append = " kernel-panic"
diff --git a/recipes-core/kernel-panic/files/sysrq-panic.service b/recipes-core/kernel-panic/files/sysrq-panic.service
new file mode 100644
index 0000000..169a97c
--- /dev/null
+++ b/recipes-core/kernel-panic/files/sysrq-panic.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=sysrq panic
+
+[Service]
+Type=oneshot
+ExecStart=/bin/sh -c "echo c > /proc/sysrq-trigger"
+
+[Install]
+WantedBy=default.target
+
diff --git a/recipes-core/kernel-panic/kernel-panic.bb b/recipes-core/kernel-panic/kernel-panic.bb
new file mode 100644
index 0000000..511febb
--- /dev/null
+++ b/recipes-core/kernel-panic/kernel-panic.bb
@@ -0,0 +1,24 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Toshiba Corporation, 2022
+#
+# Authors:
+#  Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
+#
+# SPDX-License-Identifier: MIT
+#
+
+inherit dpkg-raw
+
+DESCRIPTION = "Systemd service file to cause kernel panic"
+
+SRC_URI = " \
+    file://sysrq-panic.service"
+
+do_install() {
+	install -v -d ${D}/lib/systemd/system
+	install -v -m 0644 ${WORKDIR}/sysrq-panic.service ${D}/lib/systemd/system/
+	install -v -d ${D}/etc/systemd/system/default.target.wants
+	ln -s /lib/systemd/system/sysrq-panic.service ${D}/etc/systemd/system/default.target.wants/
+}
-- 
2.20.1




^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [isar-cip-core v2 2/2] README.swupdate.md: add readme file with steps to verify swupdate
  2022-01-27 15:55 ` Jan Kiszka
  2022-02-01 15:35   ` [isar-cip-core v2 0/2] Add necessary steps to verify swupdate Shivanand.Kunijadar
  2022-02-01 15:35   ` [isar-cip-core v2 1/2] Add recipe to cause kernel panic during system boot Shivanand.Kunijadar
@ 2022-02-01 15:35   ` Kunijadar Shivanand
  2022-02-03 11:57     ` Quirin Gylstorff
  2 siblings, 1 reply; 11+ messages in thread
From: Kunijadar Shivanand @ 2022-02-01 15:35 UTC (permalink / raw)
  To: cip-dev, jan.kiszka, quirin.gylstorff
  Cc: Shivanand Kunijadar, dinesh.kumar, kazuhiro3.hayashi, akihiro27.suzuki

From: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>

Prepare readme file with necessary steps to verify swupdate feature
with rollback functionality.

Signed-off-by: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
---
 doc/README.swupdate.md | 208 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 208 insertions(+)
 create mode 100644 doc/README.swupdate.md

diff --git a/doc/README.swupdate.md b/doc/README.swupdate.md
new file mode 100644
index 0000000..56bc77c
--- /dev/null
+++ b/doc/README.swupdate.md
@@ -0,0 +1,208 @@
+
+Clone the isar-cip-core repository
+```
+host$ git clone https://gitlab.com/cip-project/cip-core/isar-cip-core.git
+```
+
+Install `kas-container` from the [kas project](https://github.com/siemens/kas):
+
+```
+host$ wget https://raw.githubusercontent.com/siemens/kas/2.6.2/kas-container
+host$ chmod a+x kas-container
+```
+
+Build the image for swupdate
+
+```
+host$ ./kas-container --isar build kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml
+```
+- save the generated swu build/tmp/deploy/images/qemu-amd64/cip-core-image-cip-core-buster-qemu-amd64.swu in a separate folder (ex: tmp)
+- modify the image for example add a new version to the image by adding PV=2.0.0 to cip-core-image.bb
+- rebuild the image using above command and start the new target
+```
+host$ SWUPDATE_BOOT=y ./start-qemu.sh amd64
+```
+
+Copy `cip-core-image-cip-core-buster-qemu-amd64.swu` file from `tmp` folder to the running system
+
+```
+root@demo:~# scp <host-user>@<host-ip>:<path-to-swu-file>/tmp/cip-core-image-cip-core-buster-qemu-amd64.swu .
+```
+
+Check which partition is booted, e.g. with lsblk:
+
+```
+root@demo:~# lsblk
+NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
+sda      8:0    0    2G  0 disk
+├─sda1   8:1    0 16.4M  0 part
+├─sda2   8:2    0   32M  0 part
+├─sda3   8:3    0   32M  0 part
+├─sda4   8:4    0 1000M  0 part /
+└─sda5   8:5    0 1000M  0 part
+```
+
+Apply swupdate and reboot
+```
+root@demo:~# swupdate -i cip-core-image-cip-core-buster-qemu-amd64.swu
+root@demo:~# reboot
+```
+Check which partition is booted, e.g. with lsblk and the rootfs should have changed
+```
+root@demo:~# lsblk
+NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
+sda      8:0    0    2G  0 disk
+├─sda1   8:1    0 16.4M  0 part
+├─sda2   8:2    0   32M  0 part
+├─sda3   8:3    0   32M  0 part
+├─sda4   8:4    0 1000M  0 part
+└─sda5   8:5    0 1000M  0 part /
+```
+
+Check bootloader ustate after swupdate
+```
+root@demo:~# bg_printenv
+----------------------------
+Config Partition #0 Values:
+in_progress:      no
+revision:         2
+kernel:           C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
+kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
+watchdog timeout: 60 seconds
+ustate:           0 (OK)
+
+user variables:
+
+----------------------------
+ Config Partition #1 Values:
+in_progress:      no
+revision:         3
+kernel:           C:BOOT1:vmlinuz
+kernelargs:       root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002 console=tty0 console=ttyS0,115200 rootwait earlyprintk rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
+watchdog timeout: 60 seconds
+ustate:           2 (TESTING)
+```
+
+if Partition #1 usate is 2 (TESTING) then execute below command to confirm swupdate and the command will set ustate to "OK"
+```
+root@demo:~# bg_setenv -c
+```
+
+# swupdate rollback example
+
+Build the image for swupdate with service which causes kernel panic during system boot using below command.
+
+```
+host$ ./kas-container --isar build kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml:kas/opt/kernel-panic.yml
+```
+- save the generated swu build/tmp/deploy/images/qemu-amd64/cip-core-image-cip-core-buster-qemu-amd64.swu in a separate folder (ex: tmp)
+- build the image again without `kernel-panic.yml` recipe using below command
+```
+host$ ./kas-container --isar build kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml
+```
+
+Start the target on QEMU
+```
+host$ SWUPDATE_BOOT=y ./start-qemu.sh amd64
+```
+
+Copy `cip-core-image-cip-core-buster-qemu-amd64.swu` file from `tmp` folder to the running system
+
+```
+root@demo:~# scp <host-user>@<host-ip>:<path-to-swu-file>/tmp/cip-core-image-cip-core-buster-qemu-amd64.swu .
+```
+
+Check which partition is booted, e.g. with lsblk:
+
+```
+root@demo:~# lsblk
+NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
+sda      8:0    0    2G  0 disk
+├─sda1   8:1    0 16.4M  0 part
+├─sda2   8:2    0   32M  0 part
+├─sda3   8:3    0   32M  0 part
+├─sda4   8:4    0 1000M  0 part /
+└─sda5   8:5    0 1000M  0 part
+```
+
+Check bootloader ustate before swupdate and should be as below
+```
+root@demo:~# bg_printenv
+----------------------------
+Config Partition #0 Values:
+in_progress:      no
+revision:         2
+kernel:           C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
+kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
+watchdog timeout: 60 seconds
+ustate:           0 (OK)
+
+user variables:
+----------------------------
+Config Partition #1 Values:
+in_progress:      no
+revision:         1
+kernel:           C:BOOT1:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
+kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002 rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
+watchdog timeout: 60 seconds
+ustate:           0 (OK)
+```
+
+Apply swupdate as below
+```
+root@demo:~# swupdate -i cip-core-image-cip-core-buster-qemu-amd64.swu
+```
+
+check bootloader ustate after swupdate. if the swupdate is successful then **revision number** should increase to **3** and status should be changed to **INSTALLED** for Partition #1.
+```
+root@demo:~# bg_printenv
+----------------------------
+Config Partition #0 Values:
+in_progress:      no
+revision:         2
+kernel:           C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
+kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
+watchdog timeout: 60 seconds
+ustate:           0 (OK)
+
+user variables:
+----------------------------
+Config Partition #1 Values:
+in_progress:      no
+revision:         3
+kernel:           C:BOOT1:vmlinuz
+kernelargs:       root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002 console=tty0 console=ttyS0,115200 rootwait earlyprintk rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
+watchdog timeout: 60 seconds
+ustate:           1 (INSTALLED)
+```
+
+Execute reboot command
+- reboot command should cause kernel panic error.
+- watchdog timer should expire and restart the qemu. bootloader should select previous partition to boot.
+```
+root@demo:~# reboot
+```
+
+Once the system is restarted, check the bootloader ustate
+- if update is failed then **revision number** should reduce to **0** and status should change to **FAILED** for Partition #1.
+```
+root@demo:~# bg_printenv
+----------------------------
+ Config Partition #0 Values:
+in_progress:      no
+revision:         2
+kernel:           C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
+kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw initrd=cip-core-image-cip-corg
+watchdog timeout: 60 seconds
+ustate:           0 (OK)
+
+user variables:
+----------------------------
+ Config Partition #1 Values:
+in_progress:      no
+revision:         0
+kernel:           C:BOOT1:vmlinuz
+kernelargs:       root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002 console=tty0 console=ttyS0,115200 rootwait earlyprintk rw initrd=cip-core-image-cip-corg
+watchdog timeout: 60 seconds
+ustate:           3 (FAILED)
+```
-- 
2.20.1




^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [isar-cip-core v2 0/2] Add necessary steps to verify swupdate
  2022-02-01 15:35   ` [isar-cip-core v2 0/2] Add necessary steps to verify swupdate Shivanand.Kunijadar
@ 2022-02-03 11:23     ` quirin.gylstorff
  0 siblings, 0 replies; 11+ messages in thread
From: quirin.gylstorff @ 2022-02-03 11:23 UTC (permalink / raw)
  To: Shivanand.Kunijadar, cip-dev, jan.kiszka, Chris Paterson
  Cc: dinesh.kumar, kazuhiro3.hayashi, akihiro27.suzuki, Cedric Hombourger

Hi,

On 2/1/22 16:35, Shivanand.Kunijadar@toshiba-tsip.com wrote:
> From: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
> 
> The current isar-cip-core provides verification of successful swupdate
> but lacks the recipe to verify swupdate-rollback feature, the below
> patches provides the necessary script to verify swupdate-rollback.
> 
> Shivanand Kunijadar (2):
>    Add recipe to cause kernel panic during system boot
>    README.swupdate.md: add readme file with steps to verify swupdate
> 
>   doc/README.swupdate.md                        | 208 ++++++++++++++++++
>   kas/opt/kernel-panic.yml                      |  18 ++
>   .../kernel-panic/files/sysrq-panic.service    |  10 +
>   recipes-core/kernel-panic/kernel-panic.bb     |  24 ++
>   4 files changed, 260 insertions(+)
>   create mode 100644 doc/README.swupdate.md
>   create mode 100644 kas/opt/kernel-panic.yml
>   create mode 100644 recipes-core/kernel-panic/files/sysrq-panic.service
>   create mode 100644 recipes-core/kernel-panic/kernel-panic.bb
> 


Should we try to automate this with LAVA. With 
https://github.com/siemens/mtda it should be possible.

@Chris what are your thoughts.

Kind regards

Quirin


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [isar-cip-core v2 2/2] README.swupdate.md: add readme file with steps to verify swupdate
  2022-02-01 15:35   ` [isar-cip-core v2 2/2] README.swupdate.md: add readme file with steps to verify swupdate Kunijadar Shivanand
@ 2022-02-03 11:57     ` Quirin Gylstorff
  2022-02-04  6:48       ` Jan Kiszka
  0 siblings, 1 reply; 11+ messages in thread
From: Quirin Gylstorff @ 2022-02-03 11:57 UTC (permalink / raw)
  To: Shivanand.Kunijadar, cip-dev, jan.kiszka
  Cc: dinesh.kumar, kazuhiro3.hayashi, akihiro27.suzuki

Hi,

On 2/1/22 16:35, Shivanand.Kunijadar@toshiba-tsip.com wrote:
> From: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
> 
> Prepare readme file with necessary steps to verify swupdate feature
> with rollback functionality.
> 
> Signed-off-by: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
> ---
>   doc/README.swupdate.md | 208 +++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 208 insertions(+)
>   create mode 100644 doc/README.swupdate.md
> 
> diff --git a/doc/README.swupdate.md b/doc/README.swupdate.md
> new file mode 100644
> index 0000000..56bc77c
> --- /dev/null
> +++ b/doc/README.swupdate.md
> @@ -0,0 +1,208 @@
> +
> +Clone the isar-cip-core repository
> +```
> +host$ git clone https://gitlab.com/cip-project/cip-core/isar-cip-core.git
> +```
> +
> +Install `kas-container` from the [kas project](https://github.com/siemens/kas):
> +
> +```
> +host$ wget https://raw.githubusercontent.com/siemens/kas/2.6.2/kas-container
> +host$ chmod a+x kas-container
> +```
> +
> +Build the image for swupdate
> +
> +```
> +host$ ./kas-container --isar build kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml

Would it be better to use ./kas-container menu?

> +```
> +- save the generated swu build/tmp/deploy/images/qemu-amd64/cip-core-image-cip-core-buster-qemu-amd64.swu in a separate folder (ex: tmp)
> +- modify the image for example add a new version to the image by adding PV=2.0.0 to cip-core-image.bb
> +- rebuild the image using above command and start the new target
> +```
> +host$ SWUPDATE_BOOT=y ./start-qemu.sh amd64
> +```
> +
> +Copy `cip-core-image-cip-core-buster-qemu-amd64.swu` file from `tmp` folder to the running system
> +
> +```
> +root@demo:~# scp <host-user>@<host-ip>:<path-to-swu-file>/tmp/cip-core-image-cip-core-buster-qemu-amd64.swu .
> +```

According to https://wiki.qemu.org/Documentation/Networking the default 
host ip should be 10.0.2.2.
> +
> +Check which partition is booted, e.g. with lsblk:
> +
> +```
> +root@demo:~# lsblk
> +NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
> +sda      8:0    0    2G  0 disk
> +├─sda1   8:1    0 16.4M  0 part
> +├─sda2   8:2    0   32M  0 part
> +├─sda3   8:3    0   32M  0 part
> +├─sda4   8:4    0 1000M  0 part /
> +└─sda5   8:5    0 1000M  0 part
> +```
> +
> +Apply swupdate and reboot
> +```
> +root@demo:~# swupdate -i cip-core-image-cip-core-buster-qemu-amd64.swu
> +root@demo:~# reboot
> +```
> +Check which partition is booted, e.g. with lsblk and the rootfs should have changed
> +```
> +root@demo:~# lsblk
> +NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
> +sda      8:0    0    2G  0 disk
> +├─sda1   8:1    0 16.4M  0 part
> +├─sda2   8:2    0   32M  0 part
> +├─sda3   8:3    0   32M  0 part
> +├─sda4   8:4    0 1000M  0 part
> +└─sda5   8:5    0 1000M  0 part /
> +```
> +
> +Check bootloader ustate after swupdate
> +```
> +root@demo:~# bg_printenv
> +----------------------------
> +Config Partition #0 Values:
> +in_progress:      no
> +revision:         2
> +kernel:           C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
> +kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
> +watchdog timeout: 60 seconds
> +ustate:           0 (OK)
> +
> +user variables:
> +
> +----------------------------
> + Config Partition #1 Values:
> +in_progress:      no
> +revision:         3
> +kernel:           C:BOOT1:vmlinuz
> +kernelargs:       root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002 console=tty0 console=ttyS0,115200 rootwait earlyprintk rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
> +watchdog timeout: 60 seconds
> +ustate:           2 (TESTING)
> +```
> +
> +if Partition #1 usate is 2 (TESTING) then execute below command to confirm swupdate and the command will set ustate to "OK"
> +```
> +root@demo:~# bg_setenv -c
> +```
> +
> +# swupdate rollback example
> +
> +Build the image for swupdate with service which causes kernel panic during system boot using below command.
> +
> +```
> +host$ ./kas-container --isar build kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml:kas/opt/kernel-panic.yml
> +```
> +- save the generated swu build/tmp/deploy/images/qemu-amd64/cip-core-image-cip-core-buster-qemu-amd64.swu in a separate folder (ex: tmp)
> +- build the image again without `kernel-panic.yml` recipe using below command
> +```
> +host$ ./kas-container --isar build kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml
> +```
> +
> +Start the target on QEMU
> +```
> +host$ SWUPDATE_BOOT=y ./start-qemu.sh amd64
> +```
> +
> +Copy `cip-core-image-cip-core-buster-qemu-amd64.swu` file from `tmp` folder to the running system
> +
> +```
> +root@demo:~# scp <host-user>@<host-ip>:<path-to-swu-file>/tmp/cip-core-image-cip-core-buster-qemu-amd64.swu .
> +```
> +
> +Check which partition is booted, e.g. with lsblk:
> +
> +```
> +root@demo:~# lsblk
> +NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
> +sda      8:0    0    2G  0 disk
> +├─sda1   8:1    0 16.4M  0 part
> +├─sda2   8:2    0   32M  0 part
> +├─sda3   8:3    0   32M  0 part
> +├─sda4   8:4    0 1000M  0 part /
> +└─sda5   8:5    0 1000M  0 part
> +```
> +
> +Check bootloader ustate before swupdate and should be as below
> +```
> +root@demo:~# bg_printenv
> +----------------------------
> +Config Partition #0 Values:
> +in_progress:      no
> +revision:         2
> +kernel:           C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
> +kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
> +watchdog timeout: 60 seconds
> +ustate:           0 (OK)
> +
> +user variables:
> +----------------------------
> +Config Partition #1 Values:
> +in_progress:      no
> +revision:         1
> +kernel:           C:BOOT1:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
> +kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002 rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
> +watchdog timeout: 60 seconds
> +ustate:           0 (OK > +```
> +
> +Apply swupdate as below
> +```
> +root@demo:~# swupdate -i cip-core-image-cip-core-buster-qemu-amd64.swu
> +```
> +
> +check bootloader ustate after swupdate. if the swupdate is successful then **revision number** should increase to **3** and status should be changed to **INSTALLED** for Partition #1.
> +```
> +root@demo:~# bg_printenv
> +----------------------------
> +Config Partition #0 Values:
> +in_progress:      no
> +revision:         2
> +kernel:           C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
> +kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
> +watchdog timeout: 60 seconds
> +ustate:           0 (OK)
> +
> +user variables:
> +----------------------------
> +Config Partition #1 Values:
> +in_progress:      no
> +revision:         3
> +kernel:           C:BOOT1:vmlinuz
> +kernelargs:       root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002 console=tty0 console=ttyS0,115200 rootwait earlyprintk rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
> +watchdog timeout: 60 seconds
> +ustate:           1 (INSTALLED)
> +```
> +
> +Execute reboot command
> +- reboot command should cause kernel panic error.
> +- watchdog timer should expire and restart the qemu. bootloader should select previous partition to boot.
> +```
> +root@demo:~# reboot
> +```
> +
> +Once the system is restarted, check the bootloader ustate
> +- if update is failed then **revision number** should reduce to **0** and status should change to **FAILED** for Partition #1.
> +```
> +root@demo:~# bg_printenv
> +----------------------------
> + Config Partition #0 Values:
> +in_progress:      no
> +revision:         2
> +kernel:           C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
> +kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw initrd=cip-core-image-cip-corg
> +watchdog timeout: 60 seconds
> +ustate:           0 (OK)
> +
> +user variables:
> +----------------------------
> + Config Partition #1 Values:
> +in_progress:      no
> +revision:         0
> +kernel:           C:BOOT1:vmlinuz
> +kernelargs:       root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002 console=tty0 console=ttyS0,115200 rootwait earlyprintk rw initrd=cip-core-image-cip-corg
> +watchdog timeout: 60 seconds
> +ustate:           3 (FAILED)
> +```

Quirin



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [isar-cip-core v2 2/2] README.swupdate.md: add readme file with steps to verify swupdate
  2022-02-03 11:57     ` Quirin Gylstorff
@ 2022-02-04  6:48       ` Jan Kiszka
  2022-02-08 11:32         ` [isar-cip-core v3] " Kunijadar Shivanand
  0 siblings, 1 reply; 11+ messages in thread
From: Jan Kiszka @ 2022-02-04  6:48 UTC (permalink / raw)
  To: Gylstorff Quirin, Shivanand.Kunijadar, cip-dev
  Cc: dinesh.kumar, kazuhiro3.hayashi, akihiro27.suzuki

On 03.02.22 12:57, Gylstorff Quirin wrote:
> Hi,
> 
> On 2/1/22 16:35, Shivanand.Kunijadar@toshiba-tsip.com wrote:
>> From: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
>>
>> Prepare readme file with necessary steps to verify swupdate feature
>> with rollback functionality.
>>
>> Signed-off-by: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
>> ---
>>   doc/README.swupdate.md | 208 +++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 208 insertions(+)
>>   create mode 100644 doc/README.swupdate.md
>>
>> diff --git a/doc/README.swupdate.md b/doc/README.swupdate.md
>> new file mode 100644
>> index 0000000..56bc77c
>> --- /dev/null
>> +++ b/doc/README.swupdate.md
>> @@ -0,0 +1,208 @@
>> +
>> +Clone the isar-cip-core repository
>> +```
>> +host$ git clone
>> https://gitlab.com/cip-project/cip-core/isar-cip-core.git
>> +```
>> +
>> +Install `kas-container` from the [kas
>> project](https://github.com/siemens/kas):
>> +
>> +```
>> +host$ wget
>> https://raw.githubusercontent.com/siemens/kas/2.6.2/kas-container
>> +host$ chmod a+x kas-container
>> +```
>> +

Please refer to the existing instructions, rather than duplicating them.
Otherwise, we have to patch the kas-container version information in yet
another place.

>> +Build the image for swupdate
>> +
>> +```
>> +host$ ./kas-container --isar build
>> kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml
> 
> Would it be better to use ./kas-container menu?

Technically the same, but the above is probably easier to describe here.
But drop the obsolete "--isar".

> 
>> +```
>> +- save the generated swu
>> build/tmp/deploy/images/qemu-amd64/cip-core-image-cip-core-buster-qemu-amd64.swu
>> in a separate folder (ex: tmp)
>> +- modify the image for example add a new version to the image by
>> adding PV=2.0.0 to cip-core-image.bb
>> +- rebuild the image using above command and start the new target
>> +```
>> +host$ SWUPDATE_BOOT=y ./start-qemu.sh amd64
>> +```

OK, here that explicit building above, not using kas-container menu,
requires this explicit "SWUPDATE_BOOT=y". But not a major issue, also
given that we will add the panic option below, something that is likely
not helpful to expose in the kconfig menu.

>> +
>> +Copy `cip-core-image-cip-core-buster-qemu-amd64.swu` file from `tmp`
>> folder to the running system
>> +
>> +```
>> +root@demo:~# scp
>> <host-user>@<host-ip>:<path-to-swu-file>/tmp/cip-core-image-cip-core-buster-qemu-amd64.swu
>> .
>> +```
> 
> According to https://wiki.qemu.org/Documentation/Networking the default
> host ip should be 10.0.2.2.

Indeed, would be one variable less.

>> +
>> +Check which partition is booted, e.g. with lsblk:
>> +
>> +```
>> +root@demo:~# lsblk
>> +NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
>> +sda      8:0    0    2G  0 disk
>> +├─sda1   8:1    0 16.4M  0 part
>> +├─sda2   8:2    0   32M  0 part
>> +├─sda3   8:3    0   32M  0 part
>> +├─sda4   8:4    0 1000M  0 part /
>> +└─sda5   8:5    0 1000M  0 part
>> +```
>> +
>> +Apply swupdate and reboot
>> +```
>> +root@demo:~# swupdate -i cip-core-image-cip-core-buster-qemu-amd64.swu
>> +root@demo:~# reboot
>> +```
>> +Check which partition is booted, e.g. with lsblk and the rootfs
>> should have changed
>> +```
>> +root@demo:~# lsblk
>> +NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
>> +sda      8:0    0    2G  0 disk
>> +├─sda1   8:1    0 16.4M  0 part
>> +├─sda2   8:2    0   32M  0 part
>> +├─sda3   8:3    0   32M  0 part
>> +├─sda4   8:4    0 1000M  0 part
>> +└─sda5   8:5    0 1000M  0 part /
>> +```
>> +
>> +Check bootloader ustate after swupdate
>> +```
>> +root@demo:~# bg_printenv
>> +----------------------------
>> +Config Partition #0 Values:
>> +in_progress:      no
>> +revision:         2
>> +kernel:          
>> C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
>> +kernelargs:       console=tty0 console=ttyS0,115200 rootwait
>> earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw
>> initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
>> +watchdog timeout: 60 seconds
>> +ustate:           0 (OK)
>> +
>> +user variables:
>> +
>> +----------------------------
>> + Config Partition #1 Values:
>> +in_progress:      no
>> +revision:         3
>> +kernel:           C:BOOT1:vmlinuz
>> +kernelargs:       root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002
>> console=tty0 console=ttyS0,115200 rootwait earlyprintk rw
>> initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
>> +watchdog timeout: 60 seconds
>> +ustate:           2 (TESTING)
>> +```
>> +
>> +if Partition #1 usate is 2 (TESTING) then execute below command to
>> confirm swupdate and the command will set ustate to "OK"
>> +```
>> +root@demo:~# bg_setenv -c
>> +```
>> +
>> +# swupdate rollback example
>> +
>> +Build the image for swupdate with service which causes kernel panic
>> during system boot using below command.
>> +
>> +```
>> +host$ ./kas-container --isar build
>> kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml:kas/opt/kernel-panic.yml

Again, no more "--isar".

>>
>> +```
>> +- save the generated swu
>> build/tmp/deploy/images/qemu-amd64/cip-core-image-cip-core-buster-qemu-amd64.swu
>> in a separate folder (ex: tmp)
>> +- build the image again without `kernel-panic.yml` recipe using below
>> command
>> +```
>> +host$ ./kas-container --isar build
>> kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml

Also here.

>> +```
>> +
>> +Start the target on QEMU
>> +```
>> +host$ SWUPDATE_BOOT=y ./start-qemu.sh amd64
>> +```
>> +
>> +Copy `cip-core-image-cip-core-buster-qemu-amd64.swu` file from `tmp`
>> folder to the running system
>> +
>> +```
>> +root@demo:~# scp
>> <host-user>@<host-ip>:<path-to-swu-file>/tmp/cip-core-image-cip-core-buster-qemu-amd64.swu
>> .
>> +```
>> +
>> +Check which partition is booted, e.g. with lsblk:
>> +
>> +```
>> +root@demo:~# lsblk
>> +NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
>> +sda      8:0    0    2G  0 disk
>> +├─sda1   8:1    0 16.4M  0 part
>> +├─sda2   8:2    0   32M  0 part
>> +├─sda3   8:3    0   32M  0 part
>> +├─sda4   8:4    0 1000M  0 part /
>> +└─sda5   8:5    0 1000M  0 part
>> +```
>> +
>> +Check bootloader ustate before swupdate and should be as below
>> +```
>> +root@demo:~# bg_printenv
>> +----------------------------
>> +Config Partition #0 Values:
>> +in_progress:      no
>> +revision:         2
>> +kernel:          
>> C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
>> +kernelargs:       console=tty0 console=ttyS0,115200 rootwait
>> earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw
>> initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
>> +watchdog timeout: 60 seconds
>> +ustate:           0 (OK)
>> +
>> +user variables:
>> +----------------------------
>> +Config Partition #1 Values:
>> +in_progress:      no
>> +revision:         1
>> +kernel:          
>> C:BOOT1:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
>> +kernelargs:       console=tty0 console=ttyS0,115200 rootwait
>> earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002 rw
>> initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
>> +watchdog timeout: 60 seconds
>> +ustate:           0 (OK > +```
>> +
>> +Apply swupdate as below
>> +```
>> +root@demo:~# swupdate -i cip-core-image-cip-core-buster-qemu-amd64.swu
>> +```
>> +
>> +check bootloader ustate after swupdate. if the swupdate is successful
>> then **revision number** should increase to **3** and status should be
>> changed to **INSTALLED** for Partition #1.
>> +```
>> +root@demo:~# bg_printenv
>> +----------------------------
>> +Config Partition #0 Values:
>> +in_progress:      no
>> +revision:         2
>> +kernel:          
>> C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
>> +kernelargs:       console=tty0 console=ttyS0,115200 rootwait
>> earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw
>> initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
>> +watchdog timeout: 60 seconds
>> +ustate:           0 (OK)
>> +
>> +user variables:
>> +----------------------------
>> +Config Partition #1 Values:
>> +in_progress:      no
>> +revision:         3
>> +kernel:           C:BOOT1:vmlinuz
>> +kernelargs:       root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002
>> console=tty0 console=ttyS0,115200 rootwait earlyprintk rw
>> initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
>> +watchdog timeout: 60 seconds
>> +ustate:           1 (INSTALLED)
>> +```
>> +
>> +Execute reboot command
>> +- reboot command should cause kernel panic error.
>> +- watchdog timer should expire and restart the qemu. bootloader
>> should select previous partition to boot.
>> +```
>> +root@demo:~# reboot
>> +```
>> +
>> +Once the system is restarted, check the bootloader ustate
>> +- if update is failed then **revision number** should reduce to **0**
>> and status should change to **FAILED** for Partition #1.
>> +```
>> +root@demo:~# bg_printenv
>> +----------------------------
>> + Config Partition #0 Values:
>> +in_progress:      no
>> +revision:         2
>> +kernel:          
>> C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
>> +kernelargs:       console=tty0 console=ttyS0,115200 rootwait
>> earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw
>> initrd=cip-core-image-cip-corg
>> +watchdog timeout: 60 seconds
>> +ustate:           0 (OK)
>> +
>> +user variables:
>> +----------------------------
>> + Config Partition #1 Values:
>> +in_progress:      no
>> +revision:         0
>> +kernel:           C:BOOT1:vmlinuz
>> +kernelargs:       root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002
>> console=tty0 console=ttyS0,115200 rootwait earlyprintk rw
>> initrd=cip-core-image-cip-corg
>> +watchdog timeout: 60 seconds
>> +ustate:           3 (FAILED)
>> +```
> 
> Quirin
> 

Thanks,
Jan

-- 
Siemens AG, Technology
Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [isar-cip-core v2 1/2] Add recipe to cause kernel panic during system boot
  2022-02-01 15:35   ` [isar-cip-core v2 1/2] Add recipe to cause kernel panic during system boot Shivanand.Kunijadar
@ 2022-02-04  6:50     ` Jan Kiszka
  0 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2022-02-04  6:50 UTC (permalink / raw)
  To: Shivanand.Kunijadar, cip-dev, quirin.gylstorff
  Cc: dinesh.kumar, kazuhiro3.hayashi, akihiro27.suzuki

On 01.02.22 16:35, Shivanand.Kunijadar@toshiba-tsip.com wrote:
> From: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
> 
> This recipe adds systemd service to cause kernel panic during system
> boot.
> It helps to check the swupdate-rollback feature.
> 
> Signed-off-by: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
> ---
>  kas/opt/kernel-panic.yml                      | 18 ++++++++++++++
>  .../kernel-panic/files/sysrq-panic.service    | 10 ++++++++
>  recipes-core/kernel-panic/kernel-panic.bb     | 24 +++++++++++++++++++
>  3 files changed, 52 insertions(+)
>  create mode 100644 kas/opt/kernel-panic.yml
>  create mode 100644 recipes-core/kernel-panic/files/sysrq-panic.service
>  create mode 100644 recipes-core/kernel-panic/kernel-panic.bb
> 
> diff --git a/kas/opt/kernel-panic.yml b/kas/opt/kernel-panic.yml
> new file mode 100644
> index 0000000..47df7b1
> --- /dev/null
> +++ b/kas/opt/kernel-panic.yml
> @@ -0,0 +1,18 @@
> +#
> +# CIP Core, generic profile
> +#
> +# Copyright (c) Toshiba Corporation, 2022
> +#
> +# Authors:
> +#  Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
> +#
> +# SPDX-License-Identifier: MIT
> +#
> +# This kas file adds systemd service file to cause kernel panic during system boot.
> +
> +header:
> +  version: 10
> +
> +local_conf_header:
> +  kernel-panic: |
> +    IMAGE_INSTALL_append = " kernel-panic"
> diff --git a/recipes-core/kernel-panic/files/sysrq-panic.service b/recipes-core/kernel-panic/files/sysrq-panic.service
> new file mode 100644
> index 0000000..169a97c
> --- /dev/null
> +++ b/recipes-core/kernel-panic/files/sysrq-panic.service
> @@ -0,0 +1,10 @@
> +[Unit]
> +Description=sysrq panic
> +
> +[Service]
> +Type=oneshot
> +ExecStart=/bin/sh -c "echo c > /proc/sysrq-trigger"
> +
> +[Install]
> +WantedBy=default.target
> +
> diff --git a/recipes-core/kernel-panic/kernel-panic.bb b/recipes-core/kernel-panic/kernel-panic.bb
> new file mode 100644
> index 0000000..511febb
> --- /dev/null
> +++ b/recipes-core/kernel-panic/kernel-panic.bb
> @@ -0,0 +1,24 @@
> +#
> +# CIP Core, generic profile
> +#
> +# Copyright (c) Toshiba Corporation, 2022
> +#
> +# Authors:
> +#  Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
> +#
> +# SPDX-License-Identifier: MIT
> +#
> +
> +inherit dpkg-raw
> +
> +DESCRIPTION = "Systemd service file to cause kernel panic"
> +
> +SRC_URI = " \
> +    file://sysrq-panic.service"
> +
> +do_install() {
> +	install -v -d ${D}/lib/systemd/system
> +	install -v -m 0644 ${WORKDIR}/sysrq-panic.service ${D}/lib/systemd/system/
> +	install -v -d ${D}/etc/systemd/system/default.target.wants
> +	ln -s /lib/systemd/system/sysrq-panic.service ${D}/etc/systemd/system/default.target.wants/
> +}

Applied already to next, dropping the extra new-line in sysrq-panic.service.

Thanks,
Jan

-- 
Siemens AG, Technology
Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [isar-cip-core v3] README.swupdate.md: add readme file with steps to verify swupdate
  2022-02-04  6:48       ` Jan Kiszka
@ 2022-02-08 11:32         ` Kunijadar Shivanand
  2022-02-08 18:42           ` Jan Kiszka
  0 siblings, 1 reply; 11+ messages in thread
From: Kunijadar Shivanand @ 2022-02-08 11:32 UTC (permalink / raw)
  To: cip-dev, jan.kiszka, quirin.gylstorff
  Cc: Shivanand Kunijadar, dinesh.kumar, kazuhiro3.hayashi, akihiro27.suzuki

From: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>

Prepare readme file with necessary steps to verify swupdate feature
with rollback functionality.

Signed-off-by: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
---
 doc/README.swupdate.md | 203 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 203 insertions(+)
 create mode 100644 doc/README.swupdate.md

diff --git a/doc/README.swupdate.md b/doc/README.swupdate.md
new file mode 100644
index 0000000..05768da
--- /dev/null
+++ b/doc/README.swupdate.md
@@ -0,0 +1,203 @@
+
+Clone the isar-cip-core repository
+```
+host$ git clone https://gitlab.com/cip-project/cip-core/isar-cip-core.git
+```
+
+Build the CIP Core image
+
+Set up `kas-container` as described in the [top-level README](../README.md).
+Then build the image:
+```
+host$ ./kas-container build kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml
+```
+- save the generated swu build/tmp/deploy/images/qemu-amd64/cip-core-image-cip-core-buster-qemu-amd64.swu in a separate folder (ex: tmp)
+- modify the image for example add a new version to the image by adding PV=2.0.0 to cip-core-image.bb
+- rebuild the image using above command and start the new target
+```
+host$ SWUPDATE_BOOT=y ./start-qemu.sh amd64
+```
+
+Copy `cip-core-image-cip-core-buster-qemu-amd64.swu` file from `tmp` folder to the running system
+
+```
+root@demo:~# scp <host-user>@10.0.2.2:<path-to-swu-file>/tmp/cip-core-image-cip-core-buster-qemu-amd64.swu .
+```
+
+Check which partition is booted, e.g. with lsblk:
+
+```
+root@demo:~# lsblk
+NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
+sda      8:0    0    2G  0 disk
+├─sda1   8:1    0 16.4M  0 part
+├─sda2   8:2    0   32M  0 part
+├─sda3   8:3    0   32M  0 part
+├─sda4   8:4    0 1000M  0 part /
+└─sda5   8:5    0 1000M  0 part
+```
+
+Apply swupdate and reboot
+```
+root@demo:~# swupdate -i cip-core-image-cip-core-buster-qemu-amd64.swu
+root@demo:~# reboot
+```
+Check which partition is booted, e.g. with lsblk and the rootfs should have changed
+```
+root@demo:~# lsblk
+NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
+sda      8:0    0    2G  0 disk
+├─sda1   8:1    0 16.4M  0 part
+├─sda2   8:2    0   32M  0 part
+├─sda3   8:3    0   32M  0 part
+├─sda4   8:4    0 1000M  0 part
+└─sda5   8:5    0 1000M  0 part /
+```
+
+Check bootloader ustate after swupdate
+```
+root@demo:~# bg_printenv
+----------------------------
+Config Partition #0 Values:
+in_progress:      no
+revision:         2
+kernel:           C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
+kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
+watchdog timeout: 60 seconds
+ustate:           0 (OK)
+
+user variables:
+
+----------------------------
+ Config Partition #1 Values:
+in_progress:      no
+revision:         3
+kernel:           C:BOOT1:vmlinuz
+kernelargs:       root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002 console=tty0 console=ttyS0,115200 rootwait earlyprintk rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
+watchdog timeout: 60 seconds
+ustate:           2 (TESTING)
+```
+
+if Partition #1 usate is 2 (TESTING) then execute below command to confirm swupdate and the command will set ustate to "OK"
+```
+root@demo:~# bg_setenv -c
+```
+
+# swupdate rollback example
+
+Build the image for swupdate with service which causes kernel panic during system boot using below command.
+
+```
+host$ ./kas-container build kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml:kas/opt/kernel-panic.yml
+```
+- save the generated swu build/tmp/deploy/images/qemu-amd64/cip-core-image-cip-core-buster-qemu-amd64.swu in a separate folder (ex: tmp)
+- build the image again without `kernel-panic.yml` recipe using below command
+```
+host$ ./kas-container build kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml
+```
+
+Start the target on QEMU
+```
+host$ SWUPDATE_BOOT=y ./start-qemu.sh amd64
+```
+
+Copy `cip-core-image-cip-core-buster-qemu-amd64.swu` file from `tmp` folder to the running system
+
+```
+root@demo:~# scp <host-user>@10.0.2.2:<path-to-swu-file>/tmp/cip-core-image-cip-core-buster-qemu-amd64.swu .
+```
+
+Check which partition is booted, e.g. with lsblk:
+
+```
+root@demo:~# lsblk
+NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
+sda      8:0    0    2G  0 disk
+├─sda1   8:1    0 16.4M  0 part
+├─sda2   8:2    0   32M  0 part
+├─sda3   8:3    0   32M  0 part
+├─sda4   8:4    0 1000M  0 part /
+└─sda5   8:5    0 1000M  0 part
+```
+
+Check bootloader ustate before swupdate and should be as below
+```
+root@demo:~# bg_printenv
+----------------------------
+Config Partition #0 Values:
+in_progress:      no
+revision:         2
+kernel:           C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
+kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
+watchdog timeout: 60 seconds
+ustate:           0 (OK)
+
+user variables:
+----------------------------
+Config Partition #1 Values:
+in_progress:      no
+revision:         1
+kernel:           C:BOOT1:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
+kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002 rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
+watchdog timeout: 60 seconds
+ustate:           0 (OK)
+```
+
+Apply swupdate as below
+```
+root@demo:~# swupdate -i cip-core-image-cip-core-buster-qemu-amd64.swu
+```
+
+check bootloader ustate after swupdate. if the swupdate is successful then **revision number** should increase to **3** and status should be changed to **INSTALLED** for Partition #1.
+```
+root@demo:~# bg_printenv
+----------------------------
+Config Partition #0 Values:
+in_progress:      no
+revision:         2
+kernel:           C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
+kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
+watchdog timeout: 60 seconds
+ustate:           0 (OK)
+
+user variables:
+----------------------------
+Config Partition #1 Values:
+in_progress:      no
+revision:         3
+kernel:           C:BOOT1:vmlinuz
+kernelargs:       root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002 console=tty0 console=ttyS0,115200 rootwait earlyprintk rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
+watchdog timeout: 60 seconds
+ustate:           1 (INSTALLED)
+```
+
+Execute reboot command
+- reboot command should cause kernel panic error.
+- watchdog timer should expire and restart the qemu. bootloader should select previous partition to boot.
+```
+root@demo:~# reboot
+```
+
+Once the system is restarted, check the bootloader ustate
+- if update is failed then **revision number** should reduce to **0** and status should change to **FAILED** for Partition #1.
+```
+root@demo:~# bg_printenv
+----------------------------
+ Config Partition #0 Values:
+in_progress:      no
+revision:         2
+kernel:           C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
+kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw initrd=cip-core-image-cip-corg
+watchdog timeout: 60 seconds
+ustate:           0 (OK)
+
+user variables:
+----------------------------
+ Config Partition #1 Values:
+in_progress:      no
+revision:         0
+kernel:           C:BOOT1:vmlinuz
+kernelargs:       root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002 console=tty0 console=ttyS0,115200 rootwait earlyprintk rw initrd=cip-core-image-cip-corg
+watchdog timeout: 60 seconds
+ustate:           3 (FAILED)
+```
-- 
2.20.1




^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [isar-cip-core v3] README.swupdate.md: add readme file with steps to verify swupdate
  2022-02-08 11:32         ` [isar-cip-core v3] " Kunijadar Shivanand
@ 2022-02-08 18:42           ` Jan Kiszka
  0 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2022-02-08 18:42 UTC (permalink / raw)
  To: Shivanand.Kunijadar, cip-dev, quirin.gylstorff
  Cc: dinesh.kumar, kazuhiro3.hayashi, akihiro27.suzuki

On 08.02.22 12:32, Shivanand.Kunijadar@toshiba-tsip.com wrote:
> From: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
> 
> Prepare readme file with necessary steps to verify swupdate feature
> with rollback functionality.
> 
> Signed-off-by: Shivanand Kunijadar <Shivanand.Kunijadar@toshiba-tsip.com>
> ---
>  doc/README.swupdate.md | 203 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 203 insertions(+)
>  create mode 100644 doc/README.swupdate.md
> 
> diff --git a/doc/README.swupdate.md b/doc/README.swupdate.md
> new file mode 100644
> index 0000000..05768da
> --- /dev/null
> +++ b/doc/README.swupdate.md
> @@ -0,0 +1,203 @@
> +
> +Clone the isar-cip-core repository
> +```
> +host$ git clone https://gitlab.com/cip-project/cip-core/isar-cip-core.git
> +```
> +
> +Build the CIP Core image
> +
> +Set up `kas-container` as described in the [top-level README](../README.md).
> +Then build the image:
> +```
> +host$ ./kas-container build kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml
> +```
> +- save the generated swu build/tmp/deploy/images/qemu-amd64/cip-core-image-cip-core-buster-qemu-amd64.swu in a separate folder (ex: tmp)
> +- modify the image for example add a new version to the image by adding PV=2.0.0 to cip-core-image.bb
> +- rebuild the image using above command and start the new target
> +```
> +host$ SWUPDATE_BOOT=y ./start-qemu.sh amd64
> +```
> +
> +Copy `cip-core-image-cip-core-buster-qemu-amd64.swu` file from `tmp` folder to the running system
> +
> +```
> +root@demo:~# scp <host-user>@10.0.2.2:<path-to-swu-file>/tmp/cip-core-image-cip-core-buster-qemu-amd64.swu .
> +```
> +
> +Check which partition is booted, e.g. with lsblk:
> +
> +```
> +root@demo:~# lsblk
> +NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
> +sda      8:0    0    2G  0 disk
> +├─sda1   8:1    0 16.4M  0 part
> +├─sda2   8:2    0   32M  0 part
> +├─sda3   8:3    0   32M  0 part
> +├─sda4   8:4    0 1000M  0 part /
> +└─sda5   8:5    0 1000M  0 part
> +```
> +
> +Apply swupdate and reboot
> +```
> +root@demo:~# swupdate -i cip-core-image-cip-core-buster-qemu-amd64.swu
> +root@demo:~# reboot
> +```
> +Check which partition is booted, e.g. with lsblk and the rootfs should have changed
> +```
> +root@demo:~# lsblk
> +NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
> +sda      8:0    0    2G  0 disk
> +├─sda1   8:1    0 16.4M  0 part
> +├─sda2   8:2    0   32M  0 part
> +├─sda3   8:3    0   32M  0 part
> +├─sda4   8:4    0 1000M  0 part
> +└─sda5   8:5    0 1000M  0 part /
> +```
> +
> +Check bootloader ustate after swupdate
> +```
> +root@demo:~# bg_printenv
> +----------------------------
> +Config Partition #0 Values:
> +in_progress:      no
> +revision:         2
> +kernel:           C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
> +kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
> +watchdog timeout: 60 seconds
> +ustate:           0 (OK)
> +
> +user variables:
> +
> +----------------------------
> + Config Partition #1 Values:
> +in_progress:      no
> +revision:         3
> +kernel:           C:BOOT1:vmlinuz
> +kernelargs:       root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002 console=tty0 console=ttyS0,115200 rootwait earlyprintk rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
> +watchdog timeout: 60 seconds
> +ustate:           2 (TESTING)
> +```
> +
> +if Partition #1 usate is 2 (TESTING) then execute below command to confirm swupdate and the command will set ustate to "OK"
> +```
> +root@demo:~# bg_setenv -c
> +```
> +
> +# swupdate rollback example
> +
> +Build the image for swupdate with service which causes kernel panic during system boot using below command.
> +
> +```
> +host$ ./kas-container build kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml:kas/opt/kernel-panic.yml
> +```
> +- save the generated swu build/tmp/deploy/images/qemu-amd64/cip-core-image-cip-core-buster-qemu-amd64.swu in a separate folder (ex: tmp)
> +- build the image again without `kernel-panic.yml` recipe using below command
> +```
> +host$ ./kas-container build kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml
> +```
> +
> +Start the target on QEMU
> +```
> +host$ SWUPDATE_BOOT=y ./start-qemu.sh amd64
> +```
> +
> +Copy `cip-core-image-cip-core-buster-qemu-amd64.swu` file from `tmp` folder to the running system
> +
> +```
> +root@demo:~# scp <host-user>@10.0.2.2:<path-to-swu-file>/tmp/cip-core-image-cip-core-buster-qemu-amd64.swu .
> +```
> +
> +Check which partition is booted, e.g. with lsblk:
> +
> +```
> +root@demo:~# lsblk
> +NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
> +sda      8:0    0    2G  0 disk
> +├─sda1   8:1    0 16.4M  0 part
> +├─sda2   8:2    0   32M  0 part
> +├─sda3   8:3    0   32M  0 part
> +├─sda4   8:4    0 1000M  0 part /
> +└─sda5   8:5    0 1000M  0 part
> +```
> +
> +Check bootloader ustate before swupdate and should be as below
> +```
> +root@demo:~# bg_printenv
> +----------------------------
> +Config Partition #0 Values:
> +in_progress:      no
> +revision:         2
> +kernel:           C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
> +kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
> +watchdog timeout: 60 seconds
> +ustate:           0 (OK)
> +
> +user variables:
> +----------------------------
> +Config Partition #1 Values:
> +in_progress:      no
> +revision:         1
> +kernel:           C:BOOT1:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
> +kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002 rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
> +watchdog timeout: 60 seconds
> +ustate:           0 (OK)
> +```
> +
> +Apply swupdate as below
> +```
> +root@demo:~# swupdate -i cip-core-image-cip-core-buster-qemu-amd64.swu
> +```
> +
> +check bootloader ustate after swupdate. if the swupdate is successful then **revision number** should increase to **3** and status should be changed to **INSTALLED** for Partition #1.
> +```
> +root@demo:~# bg_printenv
> +----------------------------
> +Config Partition #0 Values:
> +in_progress:      no
> +revision:         2
> +kernel:           C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
> +kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
> +watchdog timeout: 60 seconds
> +ustate:           0 (OK)
> +
> +user variables:
> +----------------------------
> +Config Partition #1 Values:
> +in_progress:      no
> +revision:         3
> +kernel:           C:BOOT1:vmlinuz
> +kernelargs:       root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002 console=tty0 console=ttyS0,115200 rootwait earlyprintk rw initrd=cip-core-image-cip-core-buster-qemu-amd64-initrd.img
> +watchdog timeout: 60 seconds
> +ustate:           1 (INSTALLED)
> +```
> +
> +Execute reboot command
> +- reboot command should cause kernel panic error.
> +- watchdog timer should expire and restart the qemu. bootloader should select previous partition to boot.
> +```
> +root@demo:~# reboot
> +```
> +
> +Once the system is restarted, check the bootloader ustate
> +- if update is failed then **revision number** should reduce to **0** and status should change to **FAILED** for Partition #1.
> +```
> +root@demo:~# bg_printenv
> +----------------------------
> + Config Partition #0 Values:
> +in_progress:      no
> +revision:         2
> +kernel:           C:BOOT0:cip-core-image-cip-core-buster-qemu-amd64-vmlinuz
> +kernelargs:       console=tty0 console=ttyS0,115200 rootwait earlyprintk root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000001 rw initrd=cip-core-image-cip-corg
> +watchdog timeout: 60 seconds
> +ustate:           0 (OK)
> +
> +user variables:
> +----------------------------
> + Config Partition #1 Values:
> +in_progress:      no
> +revision:         0
> +kernel:           C:BOOT1:vmlinuz
> +kernelargs:       root=PARTUUID=fedcba98-7654-3210-cafe-5e0710000002 console=tty0 console=ttyS0,115200 rootwait earlyprintk rw initrd=cip-core-image-cip-corg
> +watchdog timeout: 60 seconds
> +ustate:           3 (FAILED)
> +```

Thanks, applied.

Jan

-- 
Siemens AG, Technology
Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-02-08 18:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27 14:20 [isar-cip-core] swupdate: add recipe to cause kernel panic during system boot Shivanand.Kunijadar
2022-01-27 15:55 ` Jan Kiszka
2022-02-01 15:35   ` [isar-cip-core v2 0/2] Add necessary steps to verify swupdate Shivanand.Kunijadar
2022-02-03 11:23     ` quirin.gylstorff
2022-02-01 15:35   ` [isar-cip-core v2 1/2] Add recipe to cause kernel panic during system boot Shivanand.Kunijadar
2022-02-04  6:50     ` Jan Kiszka
2022-02-01 15:35   ` [isar-cip-core v2 2/2] README.swupdate.md: add readme file with steps to verify swupdate Kunijadar Shivanand
2022-02-03 11:57     ` Quirin Gylstorff
2022-02-04  6:48       ` Jan Kiszka
2022-02-08 11:32         ` [isar-cip-core v3] " Kunijadar Shivanand
2022-02-08 18:42           ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.