From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7077548512919945216 X-Received: by 2002:a17:907:6d9d:b0:6da:7d4c:287f with SMTP id sb29-20020a1709076d9d00b006da7d4c287fmr19898081ejc.741.1647870176561; Mon, 21 Mar 2022 06:42:56 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6402:50d0:b0:419:3683:ff25 with SMTP id h16-20020a05640250d000b004193683ff25ls2763965edb.2.gmail; Mon, 21 Mar 2022 06:42:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiNGwmGuPSCcnNQv0Mwrvbn5AlUteGl36b8YdzuBjWoXN7EuQGcmIl64R/6OG/Z0OZmA28 X-Received: by 2002:aa7:d98f:0:b0:419:1200:91e0 with SMTP id u15-20020aa7d98f000000b00419120091e0mr15706895eds.145.1647870175651; Mon, 21 Mar 2022 06:42:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647870175; cv=none; d=google.com; s=arc-20160816; b=C/HoEm+cRFu1Ly81RGhSuTzWzpYbNwQsIwOrcfiXzmKentk3MBYT1S6W9Wi/yyXZGN woekuRpXW62Qi5fr7BMMgcYMM1MFNnxyxEgGKSxOqRPFeMV+p/ZeGQU1AL6x7U5NQO2c IAqP+xuUoS2aZ2mF1tlFjncfcF21rlytaiZ3ipk5/oxuqmacz6AxWNy0sgCml6Y9kEUS hmtcBLO0DJXi/UdTSaTdeftdeVFDvjK5irtaWOO+e8XelgB5HMOo/t7gD7POIFwFFWm8 cK0qQNqWPdPcYtTZi8YJ9/kL8XSGMRhaNlmcYZ11QycL2xy2SS7F7SS5ZdJ4IUCI/u+0 ig6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=ad/dWurIahhF9WkYEiutSevm3B4fGADcbk4j9vN9FV4=; b=fGPrhNkwjZE5YFq30t/DQ6iEFA7430h632Psh8bOvZYpfJDs6tv1HzV42464WKXsPi NOnWOO/SpYF33hKCLUiuw3ykrWHwdzdEwefYlbjeS3fHCaIwxMPc9dt4fm9lJUNWahXA mAR5nq61XQGMqaUO2mhOH3imEKNChi9YrABCr2lxDHk/adYx8HwdRDzVHebx+XmoLJFE G5h/UnHE6+JOmcB/PbpG+SI3B67iwvInuGwEabtmSJq8OhizqNvzoDKHD8qfkrBeJmLt xvsSRTgWkiIjeXTmYdpGO6cyIVfgMxPLbTU4nl81pWsD6pi8fGjcqwThuWgb56BPYcEJ G6Nw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Return-Path: Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id bm16-20020a170906c05000b006dff891c710si217449ejb.2.2022.03.21.06.42.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Mar 2022 06:42:55 -0700 (PDT) Received-SPF: pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Received: from localhost.localdomain (mm-13-42-214-37.mgts.dynamic.pppoe.byfly.by [37.214.42.13] (may be forged)) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8) with ESMTPSA id 22LDgqbb012870 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Mar 2022 14:42:54 +0100 From: Anton Mikanovich To: isar-users@googlegroups.com Cc: Anton Mikanovich Subject: [PATCH 1/3] rpi: Introduce bootconfig-rpi package Date: Mon, 21 Mar 2022 16:42:44 +0300 Message-Id: <20220321134246.17405-2-amikan@ilbers.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220321134246.17405-1-amikan@ilbers.de> References: <20220321134246.17405-1-amikan@ilbers.de> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-TUID: E1HdLAoPf1N2 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 --- 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 " + +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