* [Buildroot] [PATCH v2 0/5] package/petitboot: misc enhancement
@ 2023-09-15 15:58 Reza Arbab
2023-09-15 15:58 ` [Buildroot] [PATCH v2 1/5] package/petitboot: fix HOST_PROG_SHUTDOWN value Reza Arbab
` (4 more replies)
0 siblings, 5 replies; 16+ messages in thread
From: Reza Arbab @ 2023-09-15 15:58 UTC (permalink / raw)
To: buildroot; +Cc: Reza Arbab, Laurent Vivier, Joel Stanley
The br2-external tree used to build OpenPOWER firmware has long carried
petitboot as a custom package[1]. Now that petitboot has been added to
buildroot proper, it would be nice to leverage the base package instead.
To make that transition easier, here is a set of patches which port over
some of the enhancements made to that external package.
Beyond these, there are a couple of more involved things left:
* User separation (i.e. the petitboot shell runs as 'petituser')
* Support for MTD devices
[1] https://github.com/open-power/op-build/tree/master/openpower/package/petitboot
---
v2:
* Use Laurent's suggested additions to "run pb-console at boot" patch.
Reza Arbab (5):
package/petitboot: fix HOST_PROG_SHUTDOWN value
package/petitboot: run pb-console at boot
package/petitboot: poll removable devices
package/petitboot: enable discovery of software RAID devices
package/petitboot: enable discovery of SCSI devices
package/petitboot/63-md-raid-arrays.rules | 41 ++++++++++++
package/petitboot/65-md-incremental.rules | 69 ++++++++++++++++++++
package/petitboot/66-add-sg-module.rules | 2 +
package/petitboot/petitboot-console-ui.rules | 5 ++
package/petitboot/petitboot.mk | 20 +++++-
package/petitboot/removable-event-poll.rules | 3 +
package/petitboot/sysctl.conf | 1 +
system/Config.in | 2 +-
8 files changed, 141 insertions(+), 2 deletions(-)
create mode 100644 package/petitboot/63-md-raid-arrays.rules
create mode 100644 package/petitboot/65-md-incremental.rules
create mode 100644 package/petitboot/66-add-sg-module.rules
create mode 100644 package/petitboot/petitboot-console-ui.rules
create mode 100644 package/petitboot/removable-event-poll.rules
create mode 100644 package/petitboot/sysctl.conf
--
2.39.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH v2 1/5] package/petitboot: fix HOST_PROG_SHUTDOWN value
2023-09-15 15:58 [Buildroot] [PATCH v2 0/5] package/petitboot: misc enhancement Reza Arbab
@ 2023-09-15 15:58 ` Reza Arbab
2023-09-17 18:09 ` Arnout Vandecappelle via buildroot
2023-09-15 15:58 ` [Buildroot] [PATCH v2 2/5] package/petitboot: run pb-console at boot Reza Arbab
` (3 subsequent siblings)
4 siblings, 1 reply; 16+ messages in thread
From: Reza Arbab @ 2023-09-15 15:58 UTC (permalink / raw)
To: buildroot; +Cc: Reza Arbab, Laurent Vivier, Joel Stanley
HOST_PROG_SHUTDOWN currently references a file that doesn't exist. Fix
by setting it to /usr/libexec/petitboot/bb-kexec-reboot, which this
package already installs but doesn't use.
Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
---
package/petitboot/petitboot.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package/petitboot/petitboot.mk b/package/petitboot/petitboot.mk
index 8b4c14207ec4..8d220f88f45a 100644
--- a/package/petitboot/petitboot.mk
+++ b/package/petitboot/petitboot.mk
@@ -21,7 +21,7 @@ PETITBOOT_CONF_OPTS = \
--without-twin-x11 \
$(if $(BR2_PACKAGE_BUSYBOX),--enable-busybox,--disable-busybox) \
HOST_PROG_KEXEC=/usr/sbin/kexec \
- HOST_PROG_SHUTDOWN=/usr/sbin/kexec-restart
+ HOST_PROG_SHUTDOWN=/usr/libexec/petitboot/bb-kexec-reboot
# HPA and Busybox tftp are supported. HPA tftp is part of Buildroot's tftpd
# package.
--
2.39.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH v2 2/5] package/petitboot: run pb-console at boot
2023-09-15 15:58 [Buildroot] [PATCH v2 0/5] package/petitboot: misc enhancement Reza Arbab
2023-09-15 15:58 ` [Buildroot] [PATCH v2 1/5] package/petitboot: fix HOST_PROG_SHUTDOWN value Reza Arbab
@ 2023-09-15 15:58 ` Reza Arbab
2023-09-17 18:44 ` Arnout Vandecappelle via buildroot
` (2 more replies)
2023-09-15 15:58 ` [Buildroot] [PATCH v2 3/5] package/petitboot: poll removable devices Reza Arbab
` (2 subsequent siblings)
4 siblings, 3 replies; 16+ messages in thread
From: Reza Arbab @ 2023-09-15 15:58 UTC (permalink / raw)
To: buildroot; +Cc: Reza Arbab, Laurent Vivier, Joel Stanley
Install a udev rule to run the petitboot UI on commonly-known consoles
instead of getty. To prevent the kernel's console output from trampling
the UI, also add a sysctl file to reduce the kernel log levels to
KERN_ALERT.
Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
---
v2:
* Add ttyGF* to list of commonly-known consoles.
* Don't select BR2_TARGET_GENERIC_GETTY by default.
package/petitboot/petitboot-console-ui.rules | 5 +++++
package/petitboot/petitboot.mk | 4 ++++
package/petitboot/sysctl.conf | 1 +
system/Config.in | 2 +-
4 files changed, 11 insertions(+), 1 deletion(-)
create mode 100644 package/petitboot/petitboot-console-ui.rules
create mode 100644 package/petitboot/sysctl.conf
diff --git a/package/petitboot/petitboot-console-ui.rules b/package/petitboot/petitboot-console-ui.rules
new file mode 100644
index 000000000000..e5c188387bc5
--- /dev/null
+++ b/package/petitboot/petitboot-console-ui.rules
@@ -0,0 +1,5 @@
+# spawn a petitboot UI on common user-visible interface devices
+SUBSYSTEM=="tty", KERNEL=="hvc*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
+SUBSYSTEM=="tty", KERNEL=="tty0", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
+SUBSYSTEM=="tty", KERNEL=="ttyGF*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
+SUBSYSTEM=="tty", KERNEL=="ttyS*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
diff --git a/package/petitboot/petitboot.mk b/package/petitboot/petitboot.mk
index 8d220f88f45a..556d41230237 100644
--- a/package/petitboot/petitboot.mk
+++ b/package/petitboot/petitboot.mk
@@ -55,6 +55,10 @@ define PETITBOOT_POST_INSTALL
$(TARGET_DIR)/etc/petitboot/boot.d/90-sort-dtb
$(INSTALL) -m 0755 -D $(PETITBOOT_PKGDIR)/S15pb-discover \
$(TARGET_DIR)/etc/init.d/S15pb-discover
+ $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/petitboot-console-ui.rules \
+ $(TARGET_DIR)/etc/udev/rules.d/petitboot-console-ui.rules
+ $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/sysctl.conf \
+ $(TARGET_DIR)/etc/sysctl.d/petitboot.conf
mkdir -p $(TARGET_DIR)/usr/share/udhcpc/default.script.d/
ln -sf /usr/sbin/pb-udhcpc \
$(TARGET_DIR)/usr/share/udhcpc/default.script.d/
diff --git a/package/petitboot/sysctl.conf b/package/petitboot/sysctl.conf
new file mode 100644
index 000000000000..02ab8e3275b5
--- /dev/null
+++ b/package/petitboot/sysctl.conf
@@ -0,0 +1 @@
+kernel.printk = 1 1 1 1
diff --git a/system/Config.in b/system/Config.in
index 24798dc06803..9587dd9ce4db 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -375,7 +375,7 @@ config BR2_SYSTEM_BIN_SH
menuconfig BR2_TARGET_GENERIC_GETTY
bool "Run a getty (login prompt) after boot"
- default y
+ default y if !BR2_PACKAGE_PETITBOOT
if BR2_TARGET_GENERIC_GETTY
config BR2_TARGET_GENERIC_GETTY_PORT
--
2.39.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH v2 3/5] package/petitboot: poll removable devices
2023-09-15 15:58 [Buildroot] [PATCH v2 0/5] package/petitboot: misc enhancement Reza Arbab
2023-09-15 15:58 ` [Buildroot] [PATCH v2 1/5] package/petitboot: fix HOST_PROG_SHUTDOWN value Reza Arbab
2023-09-15 15:58 ` [Buildroot] [PATCH v2 2/5] package/petitboot: run pb-console at boot Reza Arbab
@ 2023-09-15 15:58 ` Reza Arbab
2023-09-18 6:45 ` Joel Stanley
2023-09-15 15:58 ` [Buildroot] [PATCH v2 4/5] package/petitboot: enable discovery of software RAID devices Reza Arbab
2023-09-15 15:58 ` [Buildroot] [PATCH v2 5/5] package/petitboot: enable discovery of SCSI devices Reza Arbab
4 siblings, 1 reply; 16+ messages in thread
From: Reza Arbab @ 2023-09-15 15:58 UTC (permalink / raw)
To: buildroot; +Cc: Reza Arbab, Laurent Vivier, Joel Stanley
Add a udev rule to enable notification of media change events on
removable devices, so petitboot can dynamically adapt to them.
Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
---
package/petitboot/petitboot.mk | 2 ++
package/petitboot/removable-event-poll.rules | 3 +++
2 files changed, 5 insertions(+)
create mode 100644 package/petitboot/removable-event-poll.rules
diff --git a/package/petitboot/petitboot.mk b/package/petitboot/petitboot.mk
index 556d41230237..9326738aa038 100644
--- a/package/petitboot/petitboot.mk
+++ b/package/petitboot/petitboot.mk
@@ -57,6 +57,8 @@ define PETITBOOT_POST_INSTALL
$(TARGET_DIR)/etc/init.d/S15pb-discover
$(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/petitboot-console-ui.rules \
$(TARGET_DIR)/etc/udev/rules.d/petitboot-console-ui.rules
+ $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/removable-event-poll.rules \
+ $(TARGET_DIR)/etc/udev/rules.d/removable-event-poll.rules
$(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/sysctl.conf \
$(TARGET_DIR)/etc/sysctl.d/petitboot.conf
mkdir -p $(TARGET_DIR)/usr/share/udhcpc/default.script.d/
diff --git a/package/petitboot/removable-event-poll.rules b/package/petitboot/removable-event-poll.rules
new file mode 100644
index 000000000000..57bb74d3c00c
--- /dev/null
+++ b/package/petitboot/removable-event-poll.rules
@@ -0,0 +1,3 @@
+# petitboot needs notification for media change events on removable devices,
+# which we only get if we've set the poll_msecs sysfs attribute.
+ACTION!="remove", ATTR{removable}=="1", ATTR{events_poll_msecs}="2000"
--
2.39.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH v2 4/5] package/petitboot: enable discovery of software RAID devices
2023-09-15 15:58 [Buildroot] [PATCH v2 0/5] package/petitboot: misc enhancement Reza Arbab
` (2 preceding siblings ...)
2023-09-15 15:58 ` [Buildroot] [PATCH v2 3/5] package/petitboot: poll removable devices Reza Arbab
@ 2023-09-15 15:58 ` Reza Arbab
2023-09-17 18:58 ` Arnout Vandecappelle via buildroot
2023-09-18 6:43 ` Joel Stanley
2023-09-15 15:58 ` [Buildroot] [PATCH v2 5/5] package/petitboot: enable discovery of SCSI devices Reza Arbab
4 siblings, 2 replies; 16+ messages in thread
From: Reza Arbab @ 2023-09-15 15:58 UTC (permalink / raw)
To: buildroot; +Cc: Reza Arbab, Laurent Vivier, Joel Stanley
Petitboot can support filesystems on software RAID arrays. If mdadm is
selected, install the associated udev rules to assemble the device.
Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
---
package/petitboot/63-md-raid-arrays.rules | 41 ++++++++++++++
package/petitboot/65-md-incremental.rules | 69 +++++++++++++++++++++++
package/petitboot/petitboot.mk | 10 ++++
3 files changed, 120 insertions(+)
create mode 100644 package/petitboot/63-md-raid-arrays.rules
create mode 100644 package/petitboot/65-md-incremental.rules
diff --git a/package/petitboot/63-md-raid-arrays.rules b/package/petitboot/63-md-raid-arrays.rules
new file mode 100644
index 000000000000..92aec36e69d4
--- /dev/null
+++ b/package/petitboot/63-md-raid-arrays.rules
@@ -0,0 +1,41 @@
+# do not edit this file, it will be overwritten on update
+
+SUBSYSTEM!="block", GOTO="md_end"
+
+# handle md arrays
+ACTION!="add|change", GOTO="md_end"
+KERNEL!="md*", GOTO="md_end"
+
+# partitions have no md/{array_state,metadata_version}, but should not
+# for that reason be ignored.
+ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"
+
+# container devices have a metadata version of e.g. 'external:ddf' and
+# never leave state 'inactive'
+ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
+TEST!="md/array_state", ENV{SYSTEMD_READY}="0", GOTO="md_end"
+ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0", GOTO="md_end"
+LABEL="md_ignore_state"
+
+IMPORT{program}="/sbin/mdadm --detail --export $devnode"
+ENV{DEVTYPE}=="disk", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}", OPTIONS+="string_escape=replace"
+ENV{DEVTYPE}=="disk", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}"
+ENV{DEVTYPE}=="disk", ENV{MD_DEVNAME}=="?*", SYMLINK+="md/$env{MD_DEVNAME}"
+ENV{DEVTYPE}=="partition", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}-part%n", OPTIONS+="string_escape=replace"
+ENV{DEVTYPE}=="partition", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}-part%n"
+ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[^0-9]", SYMLINK+="md/$env{MD_DEVNAME}%n"
+ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[0-9]", SYMLINK+="md/$env{MD_DEVNAME}p%n"
+
+IMPORT{builtin}="blkid"
+OPTIONS+="link_priority=100"
+OPTIONS+="watch"
+ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
+ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
+
+ENV{MD_LEVEL}=="raid[1-9]*", ENV{SYSTEMD_WANTS}+="mdmonitor.service"
+
+# Tell systemd to run mdmon for our container, if we need it.
+ENV{MD_LEVEL}=="raid[1-9]*", ENV{MD_CONTAINER}=="?*", PROGRAM="/usr/bin/readlink $env{MD_CONTAINER}", ENV{MD_MON_THIS}="%c"
+ENV{MD_MON_THIS}=="?*", PROGRAM="/usr/bin/basename $env{MD_MON_THIS}", ENV{SYSTEMD_WANTS}+="mdmon@%c.service"
+
+LABEL="md_end"
diff --git a/package/petitboot/65-md-incremental.rules b/package/petitboot/65-md-incremental.rules
new file mode 100644
index 000000000000..153d12fe6f7e
--- /dev/null
+++ b/package/petitboot/65-md-incremental.rules
@@ -0,0 +1,69 @@
+# This file causes block devices with Linux RAID (mdadm) signatures to
+# automatically cause mdadm to be run.
+# See udev(8) for syntax
+
+# Don't process any events if anaconda is running as anaconda brings up
+# raid devices manually
+ENV{ANACONDA}=="?*", GOTO="md_end"
+
+# Also don't process disks that are slated to be a multipath device
+ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="md_end"
+
+# We process add events on block devices (since they are ready as soon as
+# they are added to the system), but we must process change events as well
+# on any dm devices (like LUKS partitions or LVM logical volumes) and on
+# md devices because both of these first get added, then get brought live
+# and trigger a change event. The reason we don't process change events
+# on bare hard disks is because if you stop all arrays on a disk, then
+# run fdisk on the disk to change the partitions, when fdisk exits it
+# triggers a change event, and we want to wait until all the fdisks on
+# all member disks are done before we do anything. Unfortunately, we have
+# no way of knowing that, so we just have to let those arrays be brought
+# up manually after fdisk has been run on all of the disks.
+
+# First, process all add events (md and dm devices will not really do
+# anything here, just regular disks, and this also won't get any imsm
+# array members either)
+SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_FS_TYPE}=="linux_raid_member", \
+ RUN+="/sbin/mdadm -I --export $env{DEVNAME}"
+
+# Next, check to make sure the BIOS raid stuff wasn't turned off via cmdline
+IMPORT{cmdline}="noiswmd"
+IMPORT{cmdline}="nodmraid"
+ENV{noiswmd}=="?*", GOTO="md_imsm_inc_end"
+ENV{nodmraid}=="?*", GOTO="md_imsm_inc_end"
+SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="isw_raid_member", \
+ RUN+="/sbin/mdadm -I $env{DEVNAME}"
+LABEL="md_imsm_inc_end"
+
+SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}=="?*", \
+ RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
+SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}!="?*", \
+ RUN+="/sbin/mdadm -If $name"
+
+# Next make sure that this isn't a dm device we should skip for some reason
+ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_change_end"
+ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="dm_change_end"
+ENV{DM_SUSPENDED}=="1", GOTO="dm_change_end"
+KERNEL=="dm-*", SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="linux_raid_member", \
+ ACTION=="change", RUN+="/sbin/mdadm -I $env{DEVNAME}"
+LABEL="dm_change_end"
+
+# Finally catch any nested md raid arrays. If we brought up an md raid
+# array that's part of another md raid array, it won't be ready to be used
+# until the change event that occurs when it becomes live
+KERNEL=="md*", SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="linux_raid_member", \
+ ACTION=="change", RUN+="/sbin/mdadm -I $env{DEVNAME}"
+
+# In case the initramfs only started some of the arrays in our container,
+# run incremental assembly on the container itself. Note: we ran mdadm
+# on the container in 64-md-raid.rules, and that's how the MD_LEVEL
+# environment variable is already set. If that disappears from the other
+# file, we will need to add this line into the middle of the next rule:
+# IMPORT{program}="/sbin/mdadm -D --export $tempnode", \
+
+SUBSYSTEM=="block", ACTION=="add|change", KERNEL=="md*", \
+ ENV{MD_LEVEL}=="container", RUN+="/sbin/mdadm -I $env{DEVNAME}"
+
+
+LABEL="md_end"
diff --git a/package/petitboot/petitboot.mk b/package/petitboot/petitboot.mk
index 9326738aa038..596e801b781c 100644
--- a/package/petitboot/petitboot.mk
+++ b/package/petitboot/petitboot.mk
@@ -46,6 +46,16 @@ else
PETITBOOT_CONF_OPTS += --without-fdt
endif
+ifeq ($(BR2_PACKAGE_MDADM),y)
+define PETITBOOT_POST_INSTALL_MDADM
+ $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/63-md-raid-arrays.rules \
+ $(TARGET_DIR)/etc/udev/rules.d/63-md-raid-arrays.rules
+ $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/65-md-incremental.rules \
+ $(TARGET_DIR)/etc/udev/rules.d/65-md-incremental.rules
+endef
+PETITBOOT_POST_INSTALL_TARGET_HOOKS += PETITBOOT_POST_INSTALL_MDADM
+endif
+
define PETITBOOT_POST_INSTALL
$(INSTALL) -D -m 0755 $(@D)/utils/bb-kexec-reboot \
$(TARGET_DIR)/usr/libexec/petitboot/bb-kexec-reboot
--
2.39.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Buildroot] [PATCH v2 5/5] package/petitboot: enable discovery of SCSI devices
2023-09-15 15:58 [Buildroot] [PATCH v2 0/5] package/petitboot: misc enhancement Reza Arbab
` (3 preceding siblings ...)
2023-09-15 15:58 ` [Buildroot] [PATCH v2 4/5] package/petitboot: enable discovery of software RAID devices Reza Arbab
@ 2023-09-15 15:58 ` Reza Arbab
2023-09-17 19:01 ` Arnout Vandecappelle via buildroot
2023-09-18 6:43 ` Joel Stanley
4 siblings, 2 replies; 16+ messages in thread
From: Reza Arbab @ 2023-09-15 15:58 UTC (permalink / raw)
To: buildroot; +Cc: Reza Arbab, Laurent Vivier, Joel Stanley
It's likely that the "sg" kernel driver needed to scan SCSI devices is a
module. Install a udev rule to load it automatically when devices are
present.
Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
---
package/petitboot/66-add-sg-module.rules | 2 ++
package/petitboot/petitboot.mk | 2 ++
2 files changed, 4 insertions(+)
create mode 100644 package/petitboot/66-add-sg-module.rules
diff --git a/package/petitboot/66-add-sg-module.rules b/package/petitboot/66-add-sg-module.rules
new file mode 100644
index 000000000000..ae18d28c570e
--- /dev/null
+++ b/package/petitboot/66-add-sg-module.rules
@@ -0,0 +1,2 @@
+# load modules to scsi disks, if they aren't in kernel
+SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe sg"
diff --git a/package/petitboot/petitboot.mk b/package/petitboot/petitboot.mk
index 596e801b781c..590b58e9c71a 100644
--- a/package/petitboot/petitboot.mk
+++ b/package/petitboot/petitboot.mk
@@ -63,6 +63,8 @@ define PETITBOOT_POST_INSTALL
$(TARGET_DIR)/etc/petitboot/boot.d/01-create-default-dtb
$(INSTALL) -D -m 0755 $(@D)/utils/hooks/90-sort-dtb \
$(TARGET_DIR)/etc/petitboot/boot.d/90-sort-dtb
+ $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/66-add-sg-module.rules \
+ $(TARGET_DIR)/etc/udev/rules.d/66-add-sg-module.rules
$(INSTALL) -m 0755 -D $(PETITBOOT_PKGDIR)/S15pb-discover \
$(TARGET_DIR)/etc/init.d/S15pb-discover
$(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/petitboot-console-ui.rules \
--
2.39.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [Buildroot] [PATCH v2 1/5] package/petitboot: fix HOST_PROG_SHUTDOWN value
2023-09-15 15:58 ` [Buildroot] [PATCH v2 1/5] package/petitboot: fix HOST_PROG_SHUTDOWN value Reza Arbab
@ 2023-09-17 18:09 ` Arnout Vandecappelle via buildroot
0 siblings, 0 replies; 16+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2023-09-17 18:09 UTC (permalink / raw)
To: Reza Arbab, buildroot; +Cc: Laurent Vivier, Joel Stanley
On 15/09/2023 17:58, Reza Arbab wrote:
> HOST_PROG_SHUTDOWN currently references a file that doesn't exist. Fix
> by setting it to /usr/libexec/petitboot/bb-kexec-reboot, which this
> package already installs but doesn't use.
>
> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Applied to master, thanks.
Regards,
Arnout
> ---
> package/petitboot/petitboot.mk | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/package/petitboot/petitboot.mk b/package/petitboot/petitboot.mk
> index 8b4c14207ec4..8d220f88f45a 100644
> --- a/package/petitboot/petitboot.mk
> +++ b/package/petitboot/petitboot.mk
> @@ -21,7 +21,7 @@ PETITBOOT_CONF_OPTS = \
> --without-twin-x11 \
> $(if $(BR2_PACKAGE_BUSYBOX),--enable-busybox,--disable-busybox) \
> HOST_PROG_KEXEC=/usr/sbin/kexec \
> - HOST_PROG_SHUTDOWN=/usr/sbin/kexec-restart
> + HOST_PROG_SHUTDOWN=/usr/libexec/petitboot/bb-kexec-reboot
>
> # HPA and Busybox tftp are supported. HPA tftp is part of Buildroot's tftpd
> # package.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Buildroot] [PATCH v2 2/5] package/petitboot: run pb-console at boot
2023-09-15 15:58 ` [Buildroot] [PATCH v2 2/5] package/petitboot: run pb-console at boot Reza Arbab
@ 2023-09-17 18:44 ` Arnout Vandecappelle via buildroot
2023-09-19 15:57 ` Reza Arbab
2023-09-18 6:46 ` Joel Stanley
2023-09-18 7:13 ` Laurent Vivier
2 siblings, 1 reply; 16+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2023-09-17 18:44 UTC (permalink / raw)
To: Reza Arbab, buildroot; +Cc: Laurent Vivier, Joel Stanley
On 15/09/2023 17:58, Reza Arbab wrote:
> Install a udev rule to run the petitboot UI on commonly-known consoles
> instead of getty. To prevent the kernel's console output from trampling
> the UI, also add a sysctl file to reduce the kernel log levels to
> KERN_ALERT.
>
> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
> ---
> v2:
> * Add ttyGF* to list of commonly-known consoles.
> * Don't select BR2_TARGET_GENERIC_GETTY by default.
>
> package/petitboot/petitboot-console-ui.rules | 5 +++++
> package/petitboot/petitboot.mk | 4 ++++
> package/petitboot/sysctl.conf | 1 +
> system/Config.in | 2 +-
> 4 files changed, 11 insertions(+), 1 deletion(-)
> create mode 100644 package/petitboot/petitboot-console-ui.rules
> create mode 100644 package/petitboot/sysctl.conf
>
> diff --git a/package/petitboot/petitboot-console-ui.rules b/package/petitboot/petitboot-console-ui.rules
> new file mode 100644
> index 000000000000..e5c188387bc5
> --- /dev/null
> +++ b/package/petitboot/petitboot-console-ui.rules
> @@ -0,0 +1,5 @@
> +# spawn a petitboot UI on common user-visible interface devices
> +SUBSYSTEM=="tty", KERNEL=="hvc*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
> +SUBSYSTEM=="tty", KERNEL=="tty0", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
> +SUBSYSTEM=="tty", KERNEL=="ttyGF*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
> +SUBSYSTEM=="tty", KERNEL=="ttyS*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
In general, it's quite likely that there are some serial ports where some
device is connected rather that a console (e.g. GPS, Bluetooth, cell modem,
...). So starting pb-console on "anything that looks ike a serial port" is a bad
idea.
In Buildroot, we by default assume that the console is on /dev/console - which
is why that is the default for BR2_TARGET_GENERIC_GETTY_PORT. If it's needed to
run pb-console on a different port or ports than the default /dev/console, then
that's a system-specific configuration.
I see no way we can have this generic assumption of "all ttys need pb-console"
in Buildroot.
It _does_ make sense, however, to put pb-console on /dev/console. However,
wouldn't it make more sense to do that in inittab instead of with a udev rule -
like the getty line?
BTW, I don't understand why you even have a KERNEL filter. Anything that is a
tty could be the console, no?
> diff --git a/package/petitboot/petitboot.mk b/package/petitboot/petitboot.mk
> index 8d220f88f45a..556d41230237 100644
> --- a/package/petitboot/petitboot.mk
> +++ b/package/petitboot/petitboot.mk
> @@ -55,6 +55,10 @@ define PETITBOOT_POST_INSTALL
> $(TARGET_DIR)/etc/petitboot/boot.d/90-sort-dtb
> $(INSTALL) -m 0755 -D $(PETITBOOT_PKGDIR)/S15pb-discover \
> $(TARGET_DIR)/etc/init.d/S15pb-discover
> + $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/petitboot-console-ui.rules \
> + $(TARGET_DIR)/etc/udev/rules.d/petitboot-console-ui.rules
> + $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/sysctl.conf \
> + $(TARGET_DIR)/etc/sysctl.d/petitboot.conf
> mkdir -p $(TARGET_DIR)/usr/share/udhcpc/default.script.d/
> ln -sf /usr/sbin/pb-udhcpc \
> $(TARGET_DIR)/usr/share/udhcpc/default.script.d/
> diff --git a/package/petitboot/sysctl.conf b/package/petitboot/sysctl.conf
> new file mode 100644
> index 000000000000..02ab8e3275b5
> --- /dev/null
> +++ b/package/petitboot/sysctl.conf
> @@ -0,0 +1 @@
> +kernel.printk = 1 1 1 1
I'm not sure how useful this is... There is still output from the init scripts
coming on the console, so why block the kernel output but not those? In
addition, by the time we get to S10udev (or definitely by the time we get to the
inittab stuff), most kernel output has already passed.
> diff --git a/system/Config.in b/system/Config.in
> index 24798dc06803..9587dd9ce4db 100644
> --- a/system/Config.in
> +++ b/system/Config.in
> @@ -375,7 +375,7 @@ config BR2_SYSTEM_BIN_SH
>
> menuconfig BR2_TARGET_GENERIC_GETTY
> bool "Run a getty (login prompt) after boot"
> - default y
> + default y if !BR2_PACKAGE_PETITBOOT
Ugh, this is super ugly to have to do something petitboot-specific in the
system menu. But I don't readily know a better way to do this.
Regards,
Arnout
>
> if BR2_TARGET_GENERIC_GETTY
> config BR2_TARGET_GENERIC_GETTY_PORT
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Buildroot] [PATCH v2 4/5] package/petitboot: enable discovery of software RAID devices
2023-09-15 15:58 ` [Buildroot] [PATCH v2 4/5] package/petitboot: enable discovery of software RAID devices Reza Arbab
@ 2023-09-17 18:58 ` Arnout Vandecappelle via buildroot
2023-09-18 6:43 ` Joel Stanley
1 sibling, 0 replies; 16+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2023-09-17 18:58 UTC (permalink / raw)
To: Reza Arbab, buildroot; +Cc: Laurent Vivier, Joel Stanley
On 15/09/2023 17:58, Reza Arbab wrote:
> Petitboot can support filesystems on software RAID arrays. If mdadm is
> selected, install the associated udev rules to assemble the device.
Wow, this looks again like something very specific and way outside what we
normally do in Buildroot. If it's appropriate to do this, I think it makes a lot
more sense to have this as part of petitboot itself.
So I suggest to send these udev rules to petitboot upstream instead, and
install them as part of the package installation.
Regards,
Arnout
>
> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> ---
> package/petitboot/63-md-raid-arrays.rules | 41 ++++++++++++++
> package/petitboot/65-md-incremental.rules | 69 +++++++++++++++++++++++
> package/petitboot/petitboot.mk | 10 ++++
> 3 files changed, 120 insertions(+)
> create mode 100644 package/petitboot/63-md-raid-arrays.rules
> create mode 100644 package/petitboot/65-md-incremental.rules
>
> diff --git a/package/petitboot/63-md-raid-arrays.rules b/package/petitboot/63-md-raid-arrays.rules
> new file mode 100644
> index 000000000000..92aec36e69d4
> --- /dev/null
> +++ b/package/petitboot/63-md-raid-arrays.rules
> @@ -0,0 +1,41 @@
> +# do not edit this file, it will be overwritten on update
> +
> +SUBSYSTEM!="block", GOTO="md_end"
> +
> +# handle md arrays
> +ACTION!="add|change", GOTO="md_end"
> +KERNEL!="md*", GOTO="md_end"
> +
> +# partitions have no md/{array_state,metadata_version}, but should not
> +# for that reason be ignored.
> +ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"
> +
> +# container devices have a metadata version of e.g. 'external:ddf' and
> +# never leave state 'inactive'
> +ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
> +TEST!="md/array_state", ENV{SYSTEMD_READY}="0", GOTO="md_end"
> +ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0", GOTO="md_end"
> +LABEL="md_ignore_state"
> +
> +IMPORT{program}="/sbin/mdadm --detail --export $devnode"
> +ENV{DEVTYPE}=="disk", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}", OPTIONS+="string_escape=replace"
> +ENV{DEVTYPE}=="disk", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}"
> +ENV{DEVTYPE}=="disk", ENV{MD_DEVNAME}=="?*", SYMLINK+="md/$env{MD_DEVNAME}"
> +ENV{DEVTYPE}=="partition", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}-part%n", OPTIONS+="string_escape=replace"
> +ENV{DEVTYPE}=="partition", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}-part%n"
> +ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[^0-9]", SYMLINK+="md/$env{MD_DEVNAME}%n"
> +ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[0-9]", SYMLINK+="md/$env{MD_DEVNAME}p%n"
> +
> +IMPORT{builtin}="blkid"
> +OPTIONS+="link_priority=100"
> +OPTIONS+="watch"
> +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
> +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
> +
> +ENV{MD_LEVEL}=="raid[1-9]*", ENV{SYSTEMD_WANTS}+="mdmonitor.service"
> +
> +# Tell systemd to run mdmon for our container, if we need it.
> +ENV{MD_LEVEL}=="raid[1-9]*", ENV{MD_CONTAINER}=="?*", PROGRAM="/usr/bin/readlink $env{MD_CONTAINER}", ENV{MD_MON_THIS}="%c"
> +ENV{MD_MON_THIS}=="?*", PROGRAM="/usr/bin/basename $env{MD_MON_THIS}", ENV{SYSTEMD_WANTS}+="mdmon@%c.service"
> +
> +LABEL="md_end"
> diff --git a/package/petitboot/65-md-incremental.rules b/package/petitboot/65-md-incremental.rules
> new file mode 100644
> index 000000000000..153d12fe6f7e
> --- /dev/null
> +++ b/package/petitboot/65-md-incremental.rules
> @@ -0,0 +1,69 @@
> +# This file causes block devices with Linux RAID (mdadm) signatures to
> +# automatically cause mdadm to be run.
> +# See udev(8) for syntax
> +
> +# Don't process any events if anaconda is running as anaconda brings up
> +# raid devices manually
> +ENV{ANACONDA}=="?*", GOTO="md_end"
> +
> +# Also don't process disks that are slated to be a multipath device
> +ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="md_end"
> +
> +# We process add events on block devices (since they are ready as soon as
> +# they are added to the system), but we must process change events as well
> +# on any dm devices (like LUKS partitions or LVM logical volumes) and on
> +# md devices because both of these first get added, then get brought live
> +# and trigger a change event. The reason we don't process change events
> +# on bare hard disks is because if you stop all arrays on a disk, then
> +# run fdisk on the disk to change the partitions, when fdisk exits it
> +# triggers a change event, and we want to wait until all the fdisks on
> +# all member disks are done before we do anything. Unfortunately, we have
> +# no way of knowing that, so we just have to let those arrays be brought
> +# up manually after fdisk has been run on all of the disks.
> +
> +# First, process all add events (md and dm devices will not really do
> +# anything here, just regular disks, and this also won't get any imsm
> +# array members either)
> +SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_FS_TYPE}=="linux_raid_member", \
> + RUN+="/sbin/mdadm -I --export $env{DEVNAME}"
> +
> +# Next, check to make sure the BIOS raid stuff wasn't turned off via cmdline
> +IMPORT{cmdline}="noiswmd"
> +IMPORT{cmdline}="nodmraid"
> +ENV{noiswmd}=="?*", GOTO="md_imsm_inc_end"
> +ENV{nodmraid}=="?*", GOTO="md_imsm_inc_end"
> +SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="isw_raid_member", \
> + RUN+="/sbin/mdadm -I $env{DEVNAME}"
> +LABEL="md_imsm_inc_end"
> +
> +SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}=="?*", \
> + RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
> +SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}!="?*", \
> + RUN+="/sbin/mdadm -If $name"
> +
> +# Next make sure that this isn't a dm device we should skip for some reason
> +ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_change_end"
> +ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="dm_change_end"
> +ENV{DM_SUSPENDED}=="1", GOTO="dm_change_end"
> +KERNEL=="dm-*", SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="linux_raid_member", \
> + ACTION=="change", RUN+="/sbin/mdadm -I $env{DEVNAME}"
> +LABEL="dm_change_end"
> +
> +# Finally catch any nested md raid arrays. If we brought up an md raid
> +# array that's part of another md raid array, it won't be ready to be used
> +# until the change event that occurs when it becomes live
> +KERNEL=="md*", SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="linux_raid_member", \
> + ACTION=="change", RUN+="/sbin/mdadm -I $env{DEVNAME}"
> +
> +# In case the initramfs only started some of the arrays in our container,
> +# run incremental assembly on the container itself. Note: we ran mdadm
> +# on the container in 64-md-raid.rules, and that's how the MD_LEVEL
> +# environment variable is already set. If that disappears from the other
> +# file, we will need to add this line into the middle of the next rule:
> +# IMPORT{program}="/sbin/mdadm -D --export $tempnode", \
> +
> +SUBSYSTEM=="block", ACTION=="add|change", KERNEL=="md*", \
> + ENV{MD_LEVEL}=="container", RUN+="/sbin/mdadm -I $env{DEVNAME}"
> +
> +
> +LABEL="md_end"
> diff --git a/package/petitboot/petitboot.mk b/package/petitboot/petitboot.mk
> index 9326738aa038..596e801b781c 100644
> --- a/package/petitboot/petitboot.mk
> +++ b/package/petitboot/petitboot.mk
> @@ -46,6 +46,16 @@ else
> PETITBOOT_CONF_OPTS += --without-fdt
> endif
>
> +ifeq ($(BR2_PACKAGE_MDADM),y)
> +define PETITBOOT_POST_INSTALL_MDADM
> + $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/63-md-raid-arrays.rules \
> + $(TARGET_DIR)/etc/udev/rules.d/63-md-raid-arrays.rules
> + $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/65-md-incremental.rules \
> + $(TARGET_DIR)/etc/udev/rules.d/65-md-incremental.rules
> +endef
> +PETITBOOT_POST_INSTALL_TARGET_HOOKS += PETITBOOT_POST_INSTALL_MDADM
> +endif
> +
> define PETITBOOT_POST_INSTALL
> $(INSTALL) -D -m 0755 $(@D)/utils/bb-kexec-reboot \
> $(TARGET_DIR)/usr/libexec/petitboot/bb-kexec-reboot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Buildroot] [PATCH v2 5/5] package/petitboot: enable discovery of SCSI devices
2023-09-15 15:58 ` [Buildroot] [PATCH v2 5/5] package/petitboot: enable discovery of SCSI devices Reza Arbab
@ 2023-09-17 19:01 ` Arnout Vandecappelle via buildroot
2023-09-18 6:43 ` Joel Stanley
1 sibling, 0 replies; 16+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2023-09-17 19:01 UTC (permalink / raw)
To: Reza Arbab, buildroot; +Cc: Laurent Vivier, Joel Stanley
On 15/09/2023 17:58, Reza Arbab wrote:
> It's likely that the "sg" kernel driver needed to scan SCSI devices is a
> module. Install a udev rule to load it automatically when devices are
> present.
This is completely independent of petitboot. If the system is likely to have
SCSI devices and scsi generic is built as a module, it's up to the user to make
sure that module is loaded.
Regards,
Arnout
>
> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> ---
> package/petitboot/66-add-sg-module.rules | 2 ++
> package/petitboot/petitboot.mk | 2 ++
> 2 files changed, 4 insertions(+)
> create mode 100644 package/petitboot/66-add-sg-module.rules
>
> diff --git a/package/petitboot/66-add-sg-module.rules b/package/petitboot/66-add-sg-module.rules
> new file mode 100644
> index 000000000000..ae18d28c570e
> --- /dev/null
> +++ b/package/petitboot/66-add-sg-module.rules
> @@ -0,0 +1,2 @@
> +# load modules to scsi disks, if they aren't in kernel
> +SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe sg"
> diff --git a/package/petitboot/petitboot.mk b/package/petitboot/petitboot.mk
> index 596e801b781c..590b58e9c71a 100644
> --- a/package/petitboot/petitboot.mk
> +++ b/package/petitboot/petitboot.mk
> @@ -63,6 +63,8 @@ define PETITBOOT_POST_INSTALL
> $(TARGET_DIR)/etc/petitboot/boot.d/01-create-default-dtb
> $(INSTALL) -D -m 0755 $(@D)/utils/hooks/90-sort-dtb \
> $(TARGET_DIR)/etc/petitboot/boot.d/90-sort-dtb
> + $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/66-add-sg-module.rules \
> + $(TARGET_DIR)/etc/udev/rules.d/66-add-sg-module.rules
> $(INSTALL) -m 0755 -D $(PETITBOOT_PKGDIR)/S15pb-discover \
> $(TARGET_DIR)/etc/init.d/S15pb-discover
> $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/petitboot-console-ui.rules \
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Buildroot] [PATCH v2 5/5] package/petitboot: enable discovery of SCSI devices
2023-09-15 15:58 ` [Buildroot] [PATCH v2 5/5] package/petitboot: enable discovery of SCSI devices Reza Arbab
2023-09-17 19:01 ` Arnout Vandecappelle via buildroot
@ 2023-09-18 6:43 ` Joel Stanley
1 sibling, 0 replies; 16+ messages in thread
From: Joel Stanley @ 2023-09-18 6:43 UTC (permalink / raw)
To: Reza Arbab; +Cc: Laurent Vivier, buildroot
On Fri, 15 Sept 2023 at 15:58, Reza Arbab <arbab@linux.ibm.com> wrote:
>
> It's likely that the "sg" kernel driver needed to scan SCSI devices is a
> module. Install a udev rule to load it automatically when devices are
> present.
>
> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Joel Stanley <joel@jms.id.au>
> ---
> package/petitboot/66-add-sg-module.rules | 2 ++
> package/petitboot/petitboot.mk | 2 ++
> 2 files changed, 4 insertions(+)
> create mode 100644 package/petitboot/66-add-sg-module.rules
>
> diff --git a/package/petitboot/66-add-sg-module.rules b/package/petitboot/66-add-sg-module.rules
> new file mode 100644
> index 000000000000..ae18d28c570e
> --- /dev/null
> +++ b/package/petitboot/66-add-sg-module.rules
> @@ -0,0 +1,2 @@
> +# load modules to scsi disks, if they aren't in kernel
> +SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe sg"
> diff --git a/package/petitboot/petitboot.mk b/package/petitboot/petitboot.mk
> index 596e801b781c..590b58e9c71a 100644
> --- a/package/petitboot/petitboot.mk
> +++ b/package/petitboot/petitboot.mk
> @@ -63,6 +63,8 @@ define PETITBOOT_POST_INSTALL
> $(TARGET_DIR)/etc/petitboot/boot.d/01-create-default-dtb
> $(INSTALL) -D -m 0755 $(@D)/utils/hooks/90-sort-dtb \
> $(TARGET_DIR)/etc/petitboot/boot.d/90-sort-dtb
> + $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/66-add-sg-module.rules \
> + $(TARGET_DIR)/etc/udev/rules.d/66-add-sg-module.rules
> $(INSTALL) -m 0755 -D $(PETITBOOT_PKGDIR)/S15pb-discover \
> $(TARGET_DIR)/etc/init.d/S15pb-discover
> $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/petitboot-console-ui.rules \
> --
> 2.39.3
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Buildroot] [PATCH v2 4/5] package/petitboot: enable discovery of software RAID devices
2023-09-15 15:58 ` [Buildroot] [PATCH v2 4/5] package/petitboot: enable discovery of software RAID devices Reza Arbab
2023-09-17 18:58 ` Arnout Vandecappelle via buildroot
@ 2023-09-18 6:43 ` Joel Stanley
1 sibling, 0 replies; 16+ messages in thread
From: Joel Stanley @ 2023-09-18 6:43 UTC (permalink / raw)
To: Reza Arbab; +Cc: Laurent Vivier, buildroot
On Fri, 15 Sept 2023 at 15:58, Reza Arbab <arbab@linux.ibm.com> wrote:
>
> Petitboot can support filesystems on software RAID arrays. If mdadm is
> selected, install the associated udev rules to assemble the device.
>
> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Joel Stanley <joel@jms.id.au>
> ---
> package/petitboot/63-md-raid-arrays.rules | 41 ++++++++++++++
> package/petitboot/65-md-incremental.rules | 69 +++++++++++++++++++++++
> package/petitboot/petitboot.mk | 10 ++++
> 3 files changed, 120 insertions(+)
> create mode 100644 package/petitboot/63-md-raid-arrays.rules
> create mode 100644 package/petitboot/65-md-incremental.rules
>
> diff --git a/package/petitboot/63-md-raid-arrays.rules b/package/petitboot/63-md-raid-arrays.rules
> new file mode 100644
> index 000000000000..92aec36e69d4
> --- /dev/null
> +++ b/package/petitboot/63-md-raid-arrays.rules
> @@ -0,0 +1,41 @@
> +# do not edit this file, it will be overwritten on update
> +
> +SUBSYSTEM!="block", GOTO="md_end"
> +
> +# handle md arrays
> +ACTION!="add|change", GOTO="md_end"
> +KERNEL!="md*", GOTO="md_end"
> +
> +# partitions have no md/{array_state,metadata_version}, but should not
> +# for that reason be ignored.
> +ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"
> +
> +# container devices have a metadata version of e.g. 'external:ddf' and
> +# never leave state 'inactive'
> +ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
> +TEST!="md/array_state", ENV{SYSTEMD_READY}="0", GOTO="md_end"
> +ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0", GOTO="md_end"
> +LABEL="md_ignore_state"
> +
> +IMPORT{program}="/sbin/mdadm --detail --export $devnode"
> +ENV{DEVTYPE}=="disk", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}", OPTIONS+="string_escape=replace"
> +ENV{DEVTYPE}=="disk", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}"
> +ENV{DEVTYPE}=="disk", ENV{MD_DEVNAME}=="?*", SYMLINK+="md/$env{MD_DEVNAME}"
> +ENV{DEVTYPE}=="partition", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}-part%n", OPTIONS+="string_escape=replace"
> +ENV{DEVTYPE}=="partition", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}-part%n"
> +ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[^0-9]", SYMLINK+="md/$env{MD_DEVNAME}%n"
> +ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[0-9]", SYMLINK+="md/$env{MD_DEVNAME}p%n"
> +
> +IMPORT{builtin}="blkid"
> +OPTIONS+="link_priority=100"
> +OPTIONS+="watch"
> +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
> +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
> +
> +ENV{MD_LEVEL}=="raid[1-9]*", ENV{SYSTEMD_WANTS}+="mdmonitor.service"
> +
> +# Tell systemd to run mdmon for our container, if we need it.
> +ENV{MD_LEVEL}=="raid[1-9]*", ENV{MD_CONTAINER}=="?*", PROGRAM="/usr/bin/readlink $env{MD_CONTAINER}", ENV{MD_MON_THIS}="%c"
> +ENV{MD_MON_THIS}=="?*", PROGRAM="/usr/bin/basename $env{MD_MON_THIS}", ENV{SYSTEMD_WANTS}+="mdmon@%c.service"
> +
> +LABEL="md_end"
> diff --git a/package/petitboot/65-md-incremental.rules b/package/petitboot/65-md-incremental.rules
> new file mode 100644
> index 000000000000..153d12fe6f7e
> --- /dev/null
> +++ b/package/petitboot/65-md-incremental.rules
> @@ -0,0 +1,69 @@
> +# This file causes block devices with Linux RAID (mdadm) signatures to
> +# automatically cause mdadm to be run.
> +# See udev(8) for syntax
> +
> +# Don't process any events if anaconda is running as anaconda brings up
> +# raid devices manually
> +ENV{ANACONDA}=="?*", GOTO="md_end"
> +
> +# Also don't process disks that are slated to be a multipath device
> +ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="md_end"
> +
> +# We process add events on block devices (since they are ready as soon as
> +# they are added to the system), but we must process change events as well
> +# on any dm devices (like LUKS partitions or LVM logical volumes) and on
> +# md devices because both of these first get added, then get brought live
> +# and trigger a change event. The reason we don't process change events
> +# on bare hard disks is because if you stop all arrays on a disk, then
> +# run fdisk on the disk to change the partitions, when fdisk exits it
> +# triggers a change event, and we want to wait until all the fdisks on
> +# all member disks are done before we do anything. Unfortunately, we have
> +# no way of knowing that, so we just have to let those arrays be brought
> +# up manually after fdisk has been run on all of the disks.
> +
> +# First, process all add events (md and dm devices will not really do
> +# anything here, just regular disks, and this also won't get any imsm
> +# array members either)
> +SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_FS_TYPE}=="linux_raid_member", \
> + RUN+="/sbin/mdadm -I --export $env{DEVNAME}"
> +
> +# Next, check to make sure the BIOS raid stuff wasn't turned off via cmdline
> +IMPORT{cmdline}="noiswmd"
> +IMPORT{cmdline}="nodmraid"
> +ENV{noiswmd}=="?*", GOTO="md_imsm_inc_end"
> +ENV{nodmraid}=="?*", GOTO="md_imsm_inc_end"
> +SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="isw_raid_member", \
> + RUN+="/sbin/mdadm -I $env{DEVNAME}"
> +LABEL="md_imsm_inc_end"
> +
> +SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}=="?*", \
> + RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
> +SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}!="?*", \
> + RUN+="/sbin/mdadm -If $name"
> +
> +# Next make sure that this isn't a dm device we should skip for some reason
> +ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_change_end"
> +ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="dm_change_end"
> +ENV{DM_SUSPENDED}=="1", GOTO="dm_change_end"
> +KERNEL=="dm-*", SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="linux_raid_member", \
> + ACTION=="change", RUN+="/sbin/mdadm -I $env{DEVNAME}"
> +LABEL="dm_change_end"
> +
> +# Finally catch any nested md raid arrays. If we brought up an md raid
> +# array that's part of another md raid array, it won't be ready to be used
> +# until the change event that occurs when it becomes live
> +KERNEL=="md*", SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="linux_raid_member", \
> + ACTION=="change", RUN+="/sbin/mdadm -I $env{DEVNAME}"
> +
> +# In case the initramfs only started some of the arrays in our container,
> +# run incremental assembly on the container itself. Note: we ran mdadm
> +# on the container in 64-md-raid.rules, and that's how the MD_LEVEL
> +# environment variable is already set. If that disappears from the other
> +# file, we will need to add this line into the middle of the next rule:
> +# IMPORT{program}="/sbin/mdadm -D --export $tempnode", \
> +
> +SUBSYSTEM=="block", ACTION=="add|change", KERNEL=="md*", \
> + ENV{MD_LEVEL}=="container", RUN+="/sbin/mdadm -I $env{DEVNAME}"
> +
> +
> +LABEL="md_end"
> diff --git a/package/petitboot/petitboot.mk b/package/petitboot/petitboot.mk
> index 9326738aa038..596e801b781c 100644
> --- a/package/petitboot/petitboot.mk
> +++ b/package/petitboot/petitboot.mk
> @@ -46,6 +46,16 @@ else
> PETITBOOT_CONF_OPTS += --without-fdt
> endif
>
> +ifeq ($(BR2_PACKAGE_MDADM),y)
> +define PETITBOOT_POST_INSTALL_MDADM
> + $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/63-md-raid-arrays.rules \
> + $(TARGET_DIR)/etc/udev/rules.d/63-md-raid-arrays.rules
> + $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/65-md-incremental.rules \
> + $(TARGET_DIR)/etc/udev/rules.d/65-md-incremental.rules
> +endef
> +PETITBOOT_POST_INSTALL_TARGET_HOOKS += PETITBOOT_POST_INSTALL_MDADM
> +endif
> +
> define PETITBOOT_POST_INSTALL
> $(INSTALL) -D -m 0755 $(@D)/utils/bb-kexec-reboot \
> $(TARGET_DIR)/usr/libexec/petitboot/bb-kexec-reboot
> --
> 2.39.3
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Buildroot] [PATCH v2 3/5] package/petitboot: poll removable devices
2023-09-15 15:58 ` [Buildroot] [PATCH v2 3/5] package/petitboot: poll removable devices Reza Arbab
@ 2023-09-18 6:45 ` Joel Stanley
0 siblings, 0 replies; 16+ messages in thread
From: Joel Stanley @ 2023-09-18 6:45 UTC (permalink / raw)
To: Reza Arbab; +Cc: Laurent Vivier, buildroot
On Fri, 15 Sept 2023 at 15:58, Reza Arbab <arbab@linux.ibm.com> wrote:
>
> Add a udev rule to enable notification of media change events on
> removable devices, so petitboot can dynamically adapt to them.
>
> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Joel Stanley <joel@jms.id.au>
> ---
> package/petitboot/petitboot.mk | 2 ++
> package/petitboot/removable-event-poll.rules | 3 +++
> 2 files changed, 5 insertions(+)
> create mode 100644 package/petitboot/removable-event-poll.rules
>
> diff --git a/package/petitboot/petitboot.mk b/package/petitboot/petitboot.mk
> index 556d41230237..9326738aa038 100644
> --- a/package/petitboot/petitboot.mk
> +++ b/package/petitboot/petitboot.mk
> @@ -57,6 +57,8 @@ define PETITBOOT_POST_INSTALL
> $(TARGET_DIR)/etc/init.d/S15pb-discover
> $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/petitboot-console-ui.rules \
> $(TARGET_DIR)/etc/udev/rules.d/petitboot-console-ui.rules
> + $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/removable-event-poll.rules \
> + $(TARGET_DIR)/etc/udev/rules.d/removable-event-poll.rules
> $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/sysctl.conf \
> $(TARGET_DIR)/etc/sysctl.d/petitboot.conf
> mkdir -p $(TARGET_DIR)/usr/share/udhcpc/default.script.d/
> diff --git a/package/petitboot/removable-event-poll.rules b/package/petitboot/removable-event-poll.rules
> new file mode 100644
> index 000000000000..57bb74d3c00c
> --- /dev/null
> +++ b/package/petitboot/removable-event-poll.rules
> @@ -0,0 +1,3 @@
> +# petitboot needs notification for media change events on removable devices,
> +# which we only get if we've set the poll_msecs sysfs attribute.
> +ACTION!="remove", ATTR{removable}=="1", ATTR{events_poll_msecs}="2000"
> --
> 2.39.3
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Buildroot] [PATCH v2 2/5] package/petitboot: run pb-console at boot
2023-09-15 15:58 ` [Buildroot] [PATCH v2 2/5] package/petitboot: run pb-console at boot Reza Arbab
2023-09-17 18:44 ` Arnout Vandecappelle via buildroot
@ 2023-09-18 6:46 ` Joel Stanley
2023-09-18 7:13 ` Laurent Vivier
2 siblings, 0 replies; 16+ messages in thread
From: Joel Stanley @ 2023-09-18 6:46 UTC (permalink / raw)
To: Reza Arbab; +Cc: Laurent Vivier, buildroot
On Fri, 15 Sept 2023 at 15:58, Reza Arbab <arbab@linux.ibm.com> wrote:
>
> Install a udev rule to run the petitboot UI on commonly-known consoles
> instead of getty. To prevent the kernel's console output from trampling
> the UI, also add a sysctl file to reduce the kernel log levels to
> KERN_ALERT.
>
> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
> ---
> v2:
> * Add ttyGF* to list of commonly-known consoles.
> * Don't select BR2_TARGET_GENERIC_GETTY by default.
>
> package/petitboot/petitboot-console-ui.rules | 5 +++++
> package/petitboot/petitboot.mk | 4 ++++
> package/petitboot/sysctl.conf | 1 +
> system/Config.in | 2 +-
> 4 files changed, 11 insertions(+), 1 deletion(-)
> create mode 100644 package/petitboot/petitboot-console-ui.rules
> create mode 100644 package/petitboot/sysctl.conf
>
> diff --git a/package/petitboot/petitboot-console-ui.rules b/package/petitboot/petitboot-console-ui.rules
> new file mode 100644
> index 000000000000..e5c188387bc5
> --- /dev/null
> +++ b/package/petitboot/petitboot-console-ui.rules
> @@ -0,0 +1,5 @@
> +# spawn a petitboot UI on common user-visible interface devices
> +SUBSYSTEM=="tty", KERNEL=="hvc*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
> +SUBSYSTEM=="tty", KERNEL=="tty0", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
> +SUBSYSTEM=="tty", KERNEL=="ttyGF*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
> +SUBSYSTEM=="tty", KERNEL=="ttyS*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
> diff --git a/package/petitboot/petitboot.mk b/package/petitboot/petitboot.mk
> index 8d220f88f45a..556d41230237 100644
> --- a/package/petitboot/petitboot.mk
> +++ b/package/petitboot/petitboot.mk
> @@ -55,6 +55,10 @@ define PETITBOOT_POST_INSTALL
> $(TARGET_DIR)/etc/petitboot/boot.d/90-sort-dtb
> $(INSTALL) -m 0755 -D $(PETITBOOT_PKGDIR)/S15pb-discover \
> $(TARGET_DIR)/etc/init.d/S15pb-discover
> + $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/petitboot-console-ui.rules \
> + $(TARGET_DIR)/etc/udev/rules.d/petitboot-console-ui.rules
> + $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/sysctl.conf \
> + $(TARGET_DIR)/etc/sysctl.d/petitboot.conf
> mkdir -p $(TARGET_DIR)/usr/share/udhcpc/default.script.d/
> ln -sf /usr/sbin/pb-udhcpc \
> $(TARGET_DIR)/usr/share/udhcpc/default.script.d/
> diff --git a/package/petitboot/sysctl.conf b/package/petitboot/sysctl.conf
> new file mode 100644
> index 000000000000..02ab8e3275b5
> --- /dev/null
> +++ b/package/petitboot/sysctl.conf
> @@ -0,0 +1 @@
> +kernel.printk = 1 1 1 1
> diff --git a/system/Config.in b/system/Config.in
> index 24798dc06803..9587dd9ce4db 100644
> --- a/system/Config.in
> +++ b/system/Config.in
> @@ -375,7 +375,7 @@ config BR2_SYSTEM_BIN_SH
>
> menuconfig BR2_TARGET_GENERIC_GETTY
> bool "Run a getty (login prompt) after boot"
> - default y
> + default y if !BR2_PACKAGE_PETITBOOT
>
> if BR2_TARGET_GENERIC_GETTY
> config BR2_TARGET_GENERIC_GETTY_PORT
> --
> 2.39.3
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Buildroot] [PATCH v2 2/5] package/petitboot: run pb-console at boot
2023-09-15 15:58 ` [Buildroot] [PATCH v2 2/5] package/petitboot: run pb-console at boot Reza Arbab
2023-09-17 18:44 ` Arnout Vandecappelle via buildroot
2023-09-18 6:46 ` Joel Stanley
@ 2023-09-18 7:13 ` Laurent Vivier
2 siblings, 0 replies; 16+ messages in thread
From: Laurent Vivier @ 2023-09-18 7:13 UTC (permalink / raw)
To: Reza Arbab, buildroot; +Cc: Joel Stanley
Le 15/09/2023 à 17:58, Reza Arbab a écrit :
> Install a udev rule to run the petitboot UI on commonly-known consoles
> instead of getty. To prevent the kernel's console output from trampling
> the UI, also add a sysctl file to reduce the kernel log levels to
> KERN_ALERT.
>
> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
> ---
> v2:
> * Add ttyGF* to list of commonly-known consoles.
> * Don't select BR2_TARGET_GENERIC_GETTY by default.
>
> package/petitboot/petitboot-console-ui.rules | 5 +++++
> package/petitboot/petitboot.mk | 4 ++++
> package/petitboot/sysctl.conf | 1 +
> system/Config.in | 2 +-
> 4 files changed, 11 insertions(+), 1 deletion(-)
> create mode 100644 package/petitboot/petitboot-console-ui.rules
> create mode 100644 package/petitboot/sysctl.conf
>
> diff --git a/package/petitboot/petitboot-console-ui.rules b/package/petitboot/petitboot-console-ui.rules
> new file mode 100644
> index 000000000000..e5c188387bc5
> --- /dev/null
> +++ b/package/petitboot/petitboot-console-ui.rules
> @@ -0,0 +1,5 @@
> +# spawn a petitboot UI on common user-visible interface devices
> +SUBSYSTEM=="tty", KERNEL=="hvc*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
> +SUBSYSTEM=="tty", KERNEL=="tty0", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
> +SUBSYSTEM=="tty", KERNEL=="ttyGF*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
> +SUBSYSTEM=="tty", KERNEL=="ttyS*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
> diff --git a/package/petitboot/petitboot.mk b/package/petitboot/petitboot.mk
> index 8d220f88f45a..556d41230237 100644
> --- a/package/petitboot/petitboot.mk
> +++ b/package/petitboot/petitboot.mk
> @@ -55,6 +55,10 @@ define PETITBOOT_POST_INSTALL
> $(TARGET_DIR)/etc/petitboot/boot.d/90-sort-dtb
> $(INSTALL) -m 0755 -D $(PETITBOOT_PKGDIR)/S15pb-discover \
> $(TARGET_DIR)/etc/init.d/S15pb-discover
> + $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/petitboot-console-ui.rules \
> + $(TARGET_DIR)/etc/udev/rules.d/petitboot-console-ui.rules
> + $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/sysctl.conf \
> + $(TARGET_DIR)/etc/sysctl.d/petitboot.conf
> mkdir -p $(TARGET_DIR)/usr/share/udhcpc/default.script.d/
> ln -sf /usr/sbin/pb-udhcpc \
> $(TARGET_DIR)/usr/share/udhcpc/default.script.d/
> diff --git a/package/petitboot/sysctl.conf b/package/petitboot/sysctl.conf
> new file mode 100644
> index 000000000000..02ab8e3275b5
> --- /dev/null
> +++ b/package/petitboot/sysctl.conf
> @@ -0,0 +1 @@
> +kernel.printk = 1 1 1 1
> diff --git a/system/Config.in b/system/Config.in
> index 24798dc06803..9587dd9ce4db 100644
> --- a/system/Config.in
> +++ b/system/Config.in
> @@ -375,7 +375,7 @@ config BR2_SYSTEM_BIN_SH
>
> menuconfig BR2_TARGET_GENERIC_GETTY
> bool "Run a getty (login prompt) after boot"
> - default y
> + default y if !BR2_PACKAGE_PETITBOOT
>
> if BR2_TARGET_GENERIC_GETTY
> config BR2_TARGET_GENERIC_GETTY_PORT
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Buildroot] [PATCH v2 2/5] package/petitboot: run pb-console at boot
2023-09-17 18:44 ` Arnout Vandecappelle via buildroot
@ 2023-09-19 15:57 ` Reza Arbab
0 siblings, 0 replies; 16+ messages in thread
From: Reza Arbab @ 2023-09-19 15:57 UTC (permalink / raw)
To: Arnout Vandecappelle; +Cc: Joel Stanley, Laurent Vivier, buildroot
On Sun, Sep 17, 2023 at 08:44:00PM +0200, Arnout Vandecappelle wrote:
>>--- /dev/null
>>+++ b/package/petitboot/petitboot-console-ui.rules
>>@@ -0,0 +1,5 @@
>>+# spawn a petitboot UI on common user-visible interface devices
>>+SUBSYSTEM=="tty", KERNEL=="hvc*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
>>+SUBSYSTEM=="tty", KERNEL=="tty0", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
>>+SUBSYSTEM=="tty", KERNEL=="ttyGF*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
>>+SUBSYSTEM=="tty", KERNEL=="ttyS*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name linux"
>
> In general, it's quite likely that there are some serial ports where
>some device is connected rather that a console (e.g. GPS, Bluetooth,
>cell modem, ...). So starting pb-console on "anything that looks ike a
>serial port" is a bad idea.
>
> In Buildroot, we by default assume that the console is on
>/dev/console - which is why that is the default for
>BR2_TARGET_GENERIC_GETTY_PORT. If it's needed to run pb-console on a
>different port or ports than the default /dev/console, then that's a
>system-specific configuration.
>
> I see no way we can have this generic assumption of "all ttys need
>pb-console" in Buildroot.
>
> It _does_ make sense, however, to put pb-console on /dev/console.
Fair point. The intention is just to replace the login prompt with a
petitboot menu, so if buildroot only assumes /dev/console for getty by
default, then this should too. As you say, anything more can be
system-specific.
>However, wouldn't it make more sense to do that in inittab instead of
>with a udev rule - like the getty line?
This part I'm not sure about. In the petitboot docs it does say "it is
useful to have this called by udev", but not why that way specifically.
http://open-power.github.io/petitboot/dev/linux-image.html
> BTW, I don't understand why you even have a KERNEL filter. Anything
>that is a tty could be the console, no?
The filters are very broad, but I guess still an attempt to limit things
to the enumerated "common user-visible interface devices" instead of
being totally open-ended.
>>--- /dev/null
>>+++ b/package/petitboot/sysctl.conf
>>@@ -0,0 +1 @@
>>+kernel.printk = 1 1 1 1
>
> I'm not sure how useful this is... There is still output from the
>init scripts coming on the console, so why block the kernel output but
>not those? In addition, by the time we get to S10udev (or definitely
>by the time we get to the inittab stuff), most kernel output has
>already passed.
Boot output has passed, but pb-discover is in the background populating
the boot menu with bootable images via disk and network, and I think
there can be enough kernel noise at runtime to motivate minimizing it.
Thanks for the review. I'll reevaluate what changes are appropriate to
carry in buildroot vs elsewhere.
--
Reza Arbab
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2023-09-19 15:57 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-15 15:58 [Buildroot] [PATCH v2 0/5] package/petitboot: misc enhancement Reza Arbab
2023-09-15 15:58 ` [Buildroot] [PATCH v2 1/5] package/petitboot: fix HOST_PROG_SHUTDOWN value Reza Arbab
2023-09-17 18:09 ` Arnout Vandecappelle via buildroot
2023-09-15 15:58 ` [Buildroot] [PATCH v2 2/5] package/petitboot: run pb-console at boot Reza Arbab
2023-09-17 18:44 ` Arnout Vandecappelle via buildroot
2023-09-19 15:57 ` Reza Arbab
2023-09-18 6:46 ` Joel Stanley
2023-09-18 7:13 ` Laurent Vivier
2023-09-15 15:58 ` [Buildroot] [PATCH v2 3/5] package/petitboot: poll removable devices Reza Arbab
2023-09-18 6:45 ` Joel Stanley
2023-09-15 15:58 ` [Buildroot] [PATCH v2 4/5] package/petitboot: enable discovery of software RAID devices Reza Arbab
2023-09-17 18:58 ` Arnout Vandecappelle via buildroot
2023-09-18 6:43 ` Joel Stanley
2023-09-15 15:58 ` [Buildroot] [PATCH v2 5/5] package/petitboot: enable discovery of SCSI devices Reza Arbab
2023-09-17 19:01 ` Arnout Vandecappelle via buildroot
2023-09-18 6:43 ` Joel Stanley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox