From: Henning Schild <henning.schild@siemens.com>
To: isar-users@googlegroups.com
Cc: vijaikumar.kanagarajan@gmail.com
Subject: Re: [PATCH 1/2] meta-isar/raspbios: get rid of distro config script
Date: Thu, 3 Mar 2022 14:47:16 +0100 [thread overview]
Message-ID: <20220303144716.17c92f5f@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <20220303132425.31172-1-work@hennsch.de>
This is still pretty hacky but much less than before. We should in fact
use wic and deprecate that rpi-sdimg. And the config.txt and
cmdline.txt should maybe move to a package.
https://github.com/siemens/jailhouse-images
is using wic and has those files in a package.
These changes would work well together with my "add quality check
helper to image class", but we still have debian !systemd where a
configure script can potentially mess around.
In fact the whole interface (DISTRO_CONFIG_SCRIPT) can maybe be
deprecated at some point. It is from the early days and is in
invitation for bad style and hacks which should go into packages.
But let us first see how there changes to one target are received.
Henning
Am Thu, 3 Mar 2022 14:24:24 +0100
schrieb Henning Schild <work@hennsch.de>:
> From: Henning Schild <henning.schild@siemens.com>
>
> All the steps are actually related to "imaging" and not to the rootfs.
> Move stuff to imaging class and out of configure script.
>
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
> meta-isar/classes/rpi-sdimg.bbclass | 31
> ++++++++++++++++++- meta-isar/conf/distro/raspios-bullseye.conf |
> 1 - meta-isar/conf/distro/raspios-configscript.sh | 29
> ----------------- 3 files changed, 30 insertions(+), 31 deletions(-)
> delete mode 100644 meta-isar/conf/distro/raspios-configscript.sh
>
> diff --git a/meta-isar/classes/rpi-sdimg.bbclass
> b/meta-isar/classes/rpi-sdimg.bbclass index
> 1efc1c405d9b..dde121d2616e 100644 ---
> a/meta-isar/classes/rpi-sdimg.bbclass +++
> b/meta-isar/classes/rpi-sdimg.bbclass @@ -17,6 +17,7 @@
> IMAGE_ROOTFS_ALIGNMENT = "4096" SDIMG =
> "${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.sdimg" SDIMG_ROOTFS =
> "${DEPLOY_DIR_IMAGE}/${EXT4_IMAGE_FILE}"
> +do_rpi_sdimg[cleandirs] = "${WORKDIR}/rpi_sdimg/"
> do_rpi_sdimg () {
> # Align partitions
> ROOTFS_SIZE=$(du -b ${SDIMG_ROOTFS} | cut -f 1)
> @@ -47,7 +48,22 @@ do_rpi_sdimg () {
> BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG} unit b print | awk '/
> 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }') rm -f
> ${WORKDIR}/boot.img mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C
> ${WORKDIR}/boot.img $BOOT_BLOCKS
> - mcopy -i ${WORKDIR}/boot.img -s ${IMAGE_ROOTFS}/boot/* ::/
> + cp -a ${IMAGE_ROOTFS}/boot ${WORKDIR}/rpi_sdimg/
> + cat > ${WORKDIR}/rpi_sdimg/boot/config.txt << EOF
> +[pi3]
> +# Restore UART0/ttyAMA0 over GPIOs 14 & 15
> +dtoverlay=miniuart-bt
> +
> +[all]
> +EOF
> +
> + cat > ${WORKDIR}/rpi_sdimg/boot/cmdline.txt << EOF
> +console=${MACHINE_SERIAL},${BAUDRATE_TTY} console=tty1 \
> +root=/dev/mmcblk0p2 rootfstype=ext4 fsck.repair=yes \
> +rootwait quiet
> +EOF
> +
> + mcopy -i ${WORKDIR}/boot.img -s ${WORKDIR}/rpi_sdimg/boot/* ::/
>
> # Burn Partitions
> dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1
> bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync @@ -55,3
> +71,16 @@ do_rpi_sdimg () { }
>
> addtask rpi_sdimg before do_build after do_ext4_image
> +
> +do_ext4_image[prefuncs] += " append_boot_fstab"
> +do_ext4_image[postfuncs] += " restore_fstab"
> +
> +append_boot_fstab() {
> + grep boot ${IMAGE_ROOTFS} && return 0
> + cp -f ${IMAGE_ROOTFS}/etc/fstab ${WORKDIR}/fstab.orig
> + echo "/dev/mmcblk0p1 /boot vfat defaults
> 0 2" | sudo tee -a ${IMAGE_ROOTFS}/etc/fstab +}
> +
> +restore_fstab() {
> + sudo cp -f ${WORKDIR}/fstab.orig ${IMAGE_ROOTFS}/etc/fstab
> +}
> diff --git a/meta-isar/conf/distro/raspios-bullseye.conf
> b/meta-isar/conf/distro/raspios-bullseye.conf index
> cf8cb8996d86..5e4a09c9d941 100644 ---
> a/meta-isar/conf/distro/raspios-bullseye.conf +++
> b/meta-isar/conf/distro/raspios-bullseye.conf @@ -16,7 +16,6 @@
> DISTRO_APT_SOURCES_arm64 ?= "conf/distro/raspios-bullseye-64.list"
> DISTRO_BOOTSTRAP_KEYS =
> "http://raspbian.raspberrypi.org/raspbian.public.key;sha256sum=ca59cd4f2bcbc3a1d41ba6815a02a8dc5c175467a59bd87edeac458f4a5345de"
> DISTRO_BOOTSTRAP_KEYS_arm64 = "" -DISTRO_CONFIG_SCRIPT ?=
> "${LAYERDIR_isar}/conf/distro/raspios-configscript.sh" DISTRO_KERNELS
> ?= "kernel kernel7 kernel7l kernel8"
> THIRD_PARTY_APT_KEYS +=
> "http://archive.raspberrypi.org/debian/raspberrypi.gpg.key;sha256sum=76603890d82a492175caf17aba68dc73acb1189c9fd58ec0c19145dfa3866d56"
> diff --git a/meta-isar/conf/distro/raspios-configscript.sh
> b/meta-isar/conf/distro/raspios-configscript.sh deleted file mode
> 100644 index 6120a379c75e..000000000000 ---
> a/meta-isar/conf/distro/raspios-configscript.sh +++ /dev/null
> @@ -1,29 +0,0 @@
> -#!/bin/sh
> -#
> -# This software is a part of ISAR.
> -# Copyright (C) 2022 ilbers GmbH
> -
> -set -e
> -
> -readonly MACHINE_SERIAL="$1"
> -readonly BAUDRATE_TTY="$2"
> -
> -cat > /boot/config.txt << EOF
> -[pi3]
> -# Restore UART0/ttyAMA0 over GPIOs 14 & 15
> -dtoverlay=miniuart-bt
> -
> -[all]
> -EOF
> -
> -cat > /boot/cmdline.txt << EOF
> -console=${MACHINE_SERIAL},${BAUDRATE_TTY} console=tty1 \
> -root=/dev/mmcblk0p2 rootfstype=ext4 fsck.repair=yes \
> -rootwait quiet
> -EOF
> -
> -cat > /etc/fstab << EOF
> -proc /proc proc defaults 0 0
> -/dev/mmcblk0p1 /boot vfat defaults 0 2
> -/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
> -EOF
next prev parent reply other threads:[~2022-03-03 13:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-03 13:24 Henning Schild
2022-03-03 13:24 ` [PATCH 2/2] meta-isar/rpi-sdimg: take boot content out of rootfs Henning Schild
2022-03-03 13:47 ` Henning Schild [this message]
2022-03-17 13:51 ` [PATCH 1/2] meta-isar/raspbios: get rid of distro config script Anton Mikanovich
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=20220303144716.17c92f5f@md1za8fc.ad001.siemens.net \
--to=henning.schild@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=vijaikumar.kanagarajan@gmail.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