From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH 1/3] rpi: Introduce bootconfig-rpi package
Date: Mon, 21 Mar 2022 16:42:44 +0300 [thread overview]
Message-ID: <20220321134246.17405-2-amikan@ilbers.de> (raw)
In-Reply-To: <20220321134246.17405-1-amikan@ilbers.de>
Move boot/config.txt and boot/cmdline.txt handling for Raspberry into
bootconfig-${MACHINE} package to make them universal for any Raspberry
Pi target.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
meta-isar/classes/rpi-sdimg.bbclass | 13 ---------
.../conf/distro/raspbian-configscript.sh | 6 ----
meta-isar/conf/machine/rpi-common.conf | 3 +-
meta-isar/conf/multiconfig/rpi-stretch.conf | 3 +-
.../bootconfig-rpi/bootconfig-rpi.bb | 28 +++++++++++++++++++
.../bootconfig-rpi/files/cmdline.txt.tmpl | 1 +
.../bootconfig-rpi/files/config.txt | 5 ++++
.../recipes-bsp/bootconfig-rpi/files/postinst | 9 ++++++
8 files changed, 47 insertions(+), 21 deletions(-)
create mode 100644 meta-isar/recipes-bsp/bootconfig-rpi/bootconfig-rpi.bb
create mode 100644 meta-isar/recipes-bsp/bootconfig-rpi/files/cmdline.txt.tmpl
create mode 100644 meta-isar/recipes-bsp/bootconfig-rpi/files/config.txt
create mode 100644 meta-isar/recipes-bsp/bootconfig-rpi/files/postinst
diff --git a/meta-isar/classes/rpi-sdimg.bbclass b/meta-isar/classes/rpi-sdimg.bbclass
index 4bde61b..e36970c 100644
--- a/meta-isar/classes/rpi-sdimg.bbclass
+++ b/meta-isar/classes/rpi-sdimg.bbclass
@@ -49,19 +49,6 @@ do_rpi_sdimg () {
rm -f ${WORKDIR}/boot.img
mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS
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/* ::/
diff --git a/meta-isar/conf/distro/raspbian-configscript.sh b/meta-isar/conf/distro/raspbian-configscript.sh
index fca2265..d66fa03 100644
--- a/meta-isar/conf/distro/raspbian-configscript.sh
+++ b/meta-isar/conf/distro/raspbian-configscript.sh
@@ -13,9 +13,3 @@ if [ -f /etc/inittab ]; then
echo "T0:23:respawn:/sbin/getty -L $MACHINE_SERIAL $BAUDRATE_TTY vt100" \
>> /etc/inittab
fi
-
-KERNEL_IMAGE="$(find /boot -maxdepth 1 -name "vmlinuz*" -printf "%P\n")"
-
-cat > /boot/config.txt << EOF
-kernel=$KERNEL_IMAGE
-EOF
diff --git a/meta-isar/conf/machine/rpi-common.conf b/meta-isar/conf/machine/rpi-common.conf
index ff73e09..b508d2a 100644
--- a/meta-isar/conf/machine/rpi-common.conf
+++ b/meta-isar/conf/machine/rpi-common.conf
@@ -21,4 +21,5 @@ IMAGE_PREINSTALL += " \
systemd-sysv \
"
-IMAGE_INSTALL += "expand-on-first-boot"
+IMAGE_INSTALL += "expand-on-first-boot \
+ bootconfig-${MACHINE}"
diff --git a/meta-isar/conf/multiconfig/rpi-stretch.conf b/meta-isar/conf/multiconfig/rpi-stretch.conf
index fccb1e6..63f9adc 100644
--- a/meta-isar/conf/multiconfig/rpi-stretch.conf
+++ b/meta-isar/conf/multiconfig/rpi-stretch.conf
@@ -33,4 +33,5 @@ IMAGE_PREINSTALL += " \
vim \
"
-IMAGE_INSTALL += "sshd-regen-keys"
+IMAGE_INSTALL += "sshd-regen-keys \
+ bootconfig-${MACHINE}"
diff --git a/meta-isar/recipes-bsp/bootconfig-rpi/bootconfig-rpi.bb b/meta-isar/recipes-bsp/bootconfig-rpi/bootconfig-rpi.bb
new file mode 100644
index 0000000..648c728
--- /dev/null
+++ b/meta-isar/recipes-bsp/bootconfig-rpi/bootconfig-rpi.bb
@@ -0,0 +1,28 @@
+# This software is a part of ISAR.
+# Copyright (C) 2022 ilbers GmbH
+
+DESCRIPTION = "Boot config for Raspberry PI boards"
+MAINTAINER = "isar-users <isar-users@googlegroups.com>"
+
+SRC_URI = "file://config.txt \
+ file://cmdline.txt.tmpl"
+
+inherit dpkg-raw
+
+TEMPLATE_VARS = "MACHINE_SERIAL BAUDRATE_TTY"
+TEMPLATE_FILES = "cmdline.txt.tmpl"
+
+# Exceptions for RPi1
+SRC_URI_append_rpi = " file://postinst"
+SRC_URI_remove_rpi = "file://cmdline.txt.tmpl"
+TEMPLATE_FILES_remove_rpi = "cmdline.txt.tmpl"
+
+PN = "bootconfig-${MACHINE}"
+
+do_install() {
+ install -v -d ${D}/boot/
+ install -v -m 644 ${WORKDIR}/config.txt ${D}/boot/
+ if [ -f "${WORKDIR}/cmdline.txt" ]; then
+ install -v -m 644 ${WORKDIR}/cmdline.txt ${D}/boot/
+ fi
+}
diff --git a/meta-isar/recipes-bsp/bootconfig-rpi/files/cmdline.txt.tmpl b/meta-isar/recipes-bsp/bootconfig-rpi/files/cmdline.txt.tmpl
new file mode 100644
index 0000000..a243bd2
--- /dev/null
+++ b/meta-isar/recipes-bsp/bootconfig-rpi/files/cmdline.txt.tmpl
@@ -0,0 +1 @@
+console=${MACHINE_SERIAL},${BAUDRATE_TTY} console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 fsck.repair=yes rootwait quiet
diff --git a/meta-isar/recipes-bsp/bootconfig-rpi/files/config.txt b/meta-isar/recipes-bsp/bootconfig-rpi/files/config.txt
new file mode 100644
index 0000000..417d53f
--- /dev/null
+++ b/meta-isar/recipes-bsp/bootconfig-rpi/files/config.txt
@@ -0,0 +1,5 @@
+[pi3]
+# Restore UART0/ttyAMA0 over GPIOs 14 & 15
+dtoverlay=miniuart-bt
+
+[all]
diff --git a/meta-isar/recipes-bsp/bootconfig-rpi/files/postinst b/meta-isar/recipes-bsp/bootconfig-rpi/files/postinst
new file mode 100644
index 0000000..ba6d4e2
--- /dev/null
+++ b/meta-isar/recipes-bsp/bootconfig-rpi/files/postinst
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set -e
+
+KERNEL_IMAGE="$(find /boot -maxdepth 1 -name "vmlinuz*" -printf "%P\n")"
+
+cat > /boot/config.txt << EOF
+kernel=$KERNEL_IMAGE
+EOF
--
2.17.1
next prev parent reply other threads:[~2022-03-21 13:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-21 13:42 [PATCH 0/3] Replace rpi-sdimg by wic Anton Mikanovich
2022-03-21 13:42 ` Anton Mikanovich [this message]
2022-03-21 13:42 ` [PATCH 2/3] rpi: Migrate to WIC Anton Mikanovich
2022-03-21 13:42 ` [PATCH 3/3] doc: Change rpi-sdimg related documentation Anton Mikanovich
2022-03-28 17:50 ` [PATCH 0/3] Replace rpi-sdimg by wic 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=20220321134246.17405-2-amikan@ilbers.de \
--to=amikan@ilbers.de \
--cc=isar-users@googlegroups.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