public inbox for cip-dev@lists.cip-project.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: <Shivanand.Kunijadar@toshiba-tsip.com>,
	<cip-dev@lists.cip-project.org>, <quirin.gylstorff@siemens.com>
Cc: <dinesh.kumar@toshiba-tsip.com>
Subject: Re: [isar-cip-core] swupdate: add recipe to cause kernel panic during system boot
Date: Thu, 27 Jan 2022 16:55:39 +0100	[thread overview]
Message-ID: <52fae1ea-25fc-e692-2b51-e503681d2efb@siemens.com> (raw)
In-Reply-To: <20220127142042.6692-1-Shivanand.Kunijadar@toshiba-tsip.com>

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


  reply	other threads:[~2022-01-27 15:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52fae1ea-25fc-e692-2b51-e503681d2efb@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=Shivanand.Kunijadar@toshiba-tsip.com \
    --cc=cip-dev@lists.cip-project.org \
    --cc=dinesh.kumar@toshiba-tsip.com \
    --cc=quirin.gylstorff@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox