* [PATCH 1/2] meta-isar/raspbios: get rid of distro config script
@ 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
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Henning Schild @ 2022-03-03 13:24 UTC (permalink / raw)
To: isar-users; +Cc: vijaikumar.kanagarajan, Henning Schild
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
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] meta-isar/rpi-sdimg: take boot content out of rootfs
2022-03-03 13:24 [PATCH 1/2] meta-isar/raspbios: get rid of distro config script Henning Schild
@ 2022-03-03 13:24 ` Henning Schild
2022-03-03 13:47 ` [PATCH 1/2] meta-isar/raspbios: get rid of distro config script Henning Schild
2022-03-17 13:51 ` Anton Mikanovich
2 siblings, 0 replies; 4+ messages in thread
From: Henning Schild @ 2022-03-03 13:24 UTC (permalink / raw)
To: isar-users; +Cc: vijaikumar.kanagarajan, Henning Schild
From: Henning Schild <henning.schild@siemens.com>
boot is an extra partition which gets mounted over, no need to keep the
content in the underlying rootfs
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
meta-isar/classes/rpi-sdimg.bbclass | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/meta-isar/classes/rpi-sdimg.bbclass b/meta-isar/classes/rpi-sdimg.bbclass
index dde121d2616e..4bde61bf6b48 100644
--- a/meta-isar/classes/rpi-sdimg.bbclass
+++ b/meta-isar/classes/rpi-sdimg.bbclass
@@ -84,3 +84,16 @@ append_boot_fstab() {
restore_fstab() {
sudo cp -f ${WORKDIR}/fstab.orig ${IMAGE_ROOTFS}/etc/fstab
}
+
+do_ext4_image[prefuncs] += " empty_boot_folder"
+do_ext4_image[postfuncs] += " restore_boot_folder"
+
+empty_boot_folder() {
+ sudo mv ${IMAGE_ROOTFS}/boot ${WORKDIR}/boot.orig
+ sudo mkdir -p ${IMAGE_ROOTFS}/boot
+}
+
+restore_boot_folder() {
+ sudo rm -rf ${IMAGE_ROOTFS}/boot
+ sudo mv ${WORKDIR}/boot.orig ${IMAGE_ROOTFS}/boot
+}
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] meta-isar/raspbios: get rid of distro config script
2022-03-03 13:24 [PATCH 1/2] meta-isar/raspbios: get rid of distro config script 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
2022-03-17 13:51 ` Anton Mikanovich
2 siblings, 0 replies; 4+ messages in thread
From: Henning Schild @ 2022-03-03 13:47 UTC (permalink / raw)
To: isar-users; +Cc: vijaikumar.kanagarajan
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] meta-isar/raspbios: get rid of distro config script
2022-03-03 13:24 [PATCH 1/2] meta-isar/raspbios: get rid of distro config script 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 ` [PATCH 1/2] meta-isar/raspbios: get rid of distro config script Henning Schild
@ 2022-03-17 13:51 ` Anton Mikanovich
2 siblings, 0 replies; 4+ messages in thread
From: Anton Mikanovich @ 2022-03-17 13:51 UTC (permalink / raw)
To: Henning Schild, isar-users; +Cc: vijaikumar.kanagarajan, Henning Schild
03.03.2022 16:24, Henning Schild wrote:
> 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>
Patchset applied to next, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-17 13:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 13:24 [PATCH 1/2] meta-isar/raspbios: get rid of distro config script 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 ` [PATCH 1/2] meta-isar/raspbios: get rid of distro config script Henning Schild
2022-03-17 13:51 ` Anton Mikanovich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox