Bug#1019743: u-boot-menu: u-boot-update should read kernel parameters from /etc/kernel/cmdline
Le 21/09/2022 à 01:08, Vagrant Cascadian a écrit : On 2022-09-20, Arnaud Ferraris wrote: From 03db7668f3c371a5a2d564ca14c9e671c6a754b3 Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Tue, 14 Sep 2021 20:36:54 +0200 Subject: [PATCH] u-boot-update: honor /etc/kernel/cmdline Does anything else use /etc/kernel/cmdline? Is it documented somewhere? systemd-boot uses this file, see the kernel-install manpage: https://www.freedesktop.org/software/systemd/man/kernel-install.html I don't know of any other user currently, but I didn't dig in too deep. It seems a bit inconsistent with the rest of u-boot-menu configuration... I recall patches to support files in a .d directory... is that still in progress? It is, waiting on an answer from Jonas on #1012333 regarding your proposal. Cheers, Arnaud All that aside, the patch seems fine to me to implement the requested behavior (although has a little extraneous whitespace removal), if that behavior is deemed desirable. :) diff --git a/u-boot-update b/u-boot-update index 69da211..41fd0de 100755 --- a/u-boot-update +++ b/u-boot-update @@ -90,12 +90,21 @@ U_BOOT_DEFAULT="${U_BOOT_DEFAULT:-l0}" U_BOOT_ENTRIES="${U_BOOT_ENTRIES:-all}" U_BOOT_TIMEOUT="${U_BOOT_TIMEOUT:-50}" U_BOOT_MENU_LABEL="${U_BOOT_MENU_LABEL:-${PRETTY_NAME:-Debian GNU/Linux kernel}}" -U_BOOT_PARAMETERS="${U_BOOT_PARAMETERS:-ro quiet}" U_BOOT_FDT_DIR="${U_BOOT_FDT_DIR:-/usr/lib/linux-image-}" U_BOOT_FDT_OVERLAYS="${U_BOOT_FDT_OVERLAYS:-}" U_BOOT_FDT_OVERLAYS_DIR="${U_BOOT_FDT_OVERLAYS_DIR:-/boot/dtbo}" U_BOOT_INITRD="${U_BOOT_INITRD:-initrd.img}" +if [ -z "${U_BOOT_PARAMETERS}" ] && [ -f /etc/kernel/cmdline ] +then + U_BOOT_PARAMETERS="$(cat /etc/kernel/cmdline | sed -e 's/root=[^[:space:]]*//' -e 's/^[[:space:]]*//')" + if [ -z "${U_BOOT_ROOT}" ] + then + U_BOOT_ROOT="$(cat /etc/kernel/cmdline | sed -re 's/.*(root=[^[:space:]]*).*/\1/')" + fi +fi +U_BOOT_PARAMETERS="${U_BOOT_PARAMETERS:-ro quiet}" + # Find parameter for root from fstab if [ -z "${U_BOOT_ROOT}" ] then @@ -267,4 +276,3 @@ done _NUMBER="" Update "${_U_BOOT_DIRECTORY}/extlinux.conf" "${_CONFIG}" - diff --git a/u-boot-update.8 b/u-boot-update.8 index dfc3cd7..6536c6e 100644 --- a/u-boot-update.8 +++ b/u-boot-update.8 @@ -78,9 +78,10 @@ Otherwise, it defaults to 'Debian GNU/Linux, kernel'. .IP "U_BOOT_PARAMETERS=""\fBro quiet\fR""" 4 This variable specifies additional boot parameters that are appended to each kernel entry. -Value is an arbitrary string, -default is 'ro quiet' -(except for recovery entries, where quiet is avoided). +Value is an arbitrary string, default is the content +of /etc/kernel/cmdline, or 'ro quiet' +(except for recovery entries, where quiet is avoided) if +this file is not present or empty. .IP "U_BOOT_ROOT=""\fBroot\fR=\fIDEVICE\fR""" 4 This variable specifies the root partition. -- 2.35.1 live well, vagrant
Bug#1019743: u-boot-menu: u-boot-update should read kernel parameters from /etc/kernel/cmdline
On 2022-09-20, Arnaud Ferraris wrote: > From 03db7668f3c371a5a2d564ca14c9e671c6a754b3 Mon Sep 17 00:00:00 2001 > From: Arnaud Ferraris > Date: Tue, 14 Sep 2021 20:36:54 +0200 > Subject: [PATCH] u-boot-update: honor /etc/kernel/cmdline Does anything else use /etc/kernel/cmdline? Is it documented somewhere? It seems a bit inconsistent with the rest of u-boot-menu configuration... I recall patches to support files in a .d directory... is that still in progress? All that aside, the patch seems fine to me to implement the requested behavior (although has a little extraneous whitespace removal), if that behavior is deemed desirable. :) > diff --git a/u-boot-update b/u-boot-update > index 69da211..41fd0de 100755 > --- a/u-boot-update > +++ b/u-boot-update > @@ -90,12 +90,21 @@ U_BOOT_DEFAULT="${U_BOOT_DEFAULT:-l0}" > U_BOOT_ENTRIES="${U_BOOT_ENTRIES:-all}" > U_BOOT_TIMEOUT="${U_BOOT_TIMEOUT:-50}" > U_BOOT_MENU_LABEL="${U_BOOT_MENU_LABEL:-${PRETTY_NAME:-Debian GNU/Linux > kernel}}" > -U_BOOT_PARAMETERS="${U_BOOT_PARAMETERS:-ro quiet}" > U_BOOT_FDT_DIR="${U_BOOT_FDT_DIR:-/usr/lib/linux-image-}" > U_BOOT_FDT_OVERLAYS="${U_BOOT_FDT_OVERLAYS:-}" > U_BOOT_FDT_OVERLAYS_DIR="${U_BOOT_FDT_OVERLAYS_DIR:-/boot/dtbo}" > U_BOOT_INITRD="${U_BOOT_INITRD:-initrd.img}" > > +if [ -z "${U_BOOT_PARAMETERS}" ] && [ -f /etc/kernel/cmdline ] > +then > + U_BOOT_PARAMETERS="$(cat /etc/kernel/cmdline | sed -e > 's/root=[^[:space:]]*//' -e 's/^[[:space:]]*//')" > + if [ -z "${U_BOOT_ROOT}" ] > + then > + U_BOOT_ROOT="$(cat /etc/kernel/cmdline | sed -re > 's/.*(root=[^[:space:]]*).*/\1/')" > + fi > +fi > +U_BOOT_PARAMETERS="${U_BOOT_PARAMETERS:-ro quiet}" > + > # Find parameter for root from fstab > if [ -z "${U_BOOT_ROOT}" ] > then > @@ -267,4 +276,3 @@ done > _NUMBER="" > > Update "${_U_BOOT_DIRECTORY}/extlinux.conf" "${_CONFIG}" > - > diff --git a/u-boot-update.8 b/u-boot-update.8 > index dfc3cd7..6536c6e 100644 > --- a/u-boot-update.8 > +++ b/u-boot-update.8 > @@ -78,9 +78,10 @@ Otherwise, it defaults to 'Debian GNU/Linux, kernel'. > .IP "U_BOOT_PARAMETERS=""\fBro quiet\fR""" 4 > This variable specifies additional boot parameters > that are appended to each kernel entry. > -Value is an arbitrary string, > -default is 'ro quiet' > -(except for recovery entries, where quiet is avoided). > +Value is an arbitrary string, default is the content > +of /etc/kernel/cmdline, or 'ro quiet' > +(except for recovery entries, where quiet is avoided) if > +this file is not present or empty. > > .IP "U_BOOT_ROOT=""\fBroot\fR=\fIDEVICE\fR""" 4 > This variable specifies the root partition. > -- > 2.35.1 live well, vagrant signature.asc Description: PGP signature
Bug#1019743: u-boot-menu: u-boot-update should read kernel parameters from /etc/kernel/cmdline
Hi Arnaud, > That sounds like an interesting thing to have indeed, I actually > started > working on this a while ago but didn't have the time/incentive to > push > it further. > > Attaching the (draft) patch I came up with in case it can help moving > forward. Thanks for the patch, I cleaned it up a little and pushed it to https://salsa.debian.org/debian/u-boot-menu/-/merge_requests/9 Let's hope for some feedback there. Cheers! Chris
Bug#1019743: u-boot-menu: u-boot-update should read kernel parameters from /etc/kernel/cmdline
On Tue, 20 Sep 2022 16:28:38 +0200 Arnaud Ferraris wrote: Hi, That sounds like an interesting thing to have indeed, I actually started working on this a while ago but didn't have the time/incentive to push it further. Attaching the (draft) patch I came up with in case it can help moving forward. Hmm, since this patch is about 1 year old, attaching the rebased version so it applies seamlessly on current master. Cheers, Arnaud Cheers, ArnaudFrom 03db7668f3c371a5a2d564ca14c9e671c6a754b3 Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Tue, 14 Sep 2021 20:36:54 +0200 Subject: [PATCH] u-boot-update: honor /etc/kernel/cmdline --- u-boot-update | 12 ++-- u-boot-update.8 | 7 --- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/u-boot-update b/u-boot-update index 69da211..41fd0de 100755 --- a/u-boot-update +++ b/u-boot-update @@ -90,12 +90,21 @@ U_BOOT_DEFAULT="${U_BOOT_DEFAULT:-l0}" U_BOOT_ENTRIES="${U_BOOT_ENTRIES:-all}" U_BOOT_TIMEOUT="${U_BOOT_TIMEOUT:-50}" U_BOOT_MENU_LABEL="${U_BOOT_MENU_LABEL:-${PRETTY_NAME:-Debian GNU/Linux kernel}}" -U_BOOT_PARAMETERS="${U_BOOT_PARAMETERS:-ro quiet}" U_BOOT_FDT_DIR="${U_BOOT_FDT_DIR:-/usr/lib/linux-image-}" U_BOOT_FDT_OVERLAYS="${U_BOOT_FDT_OVERLAYS:-}" U_BOOT_FDT_OVERLAYS_DIR="${U_BOOT_FDT_OVERLAYS_DIR:-/boot/dtbo}" U_BOOT_INITRD="${U_BOOT_INITRD:-initrd.img}" +if [ -z "${U_BOOT_PARAMETERS}" ] && [ -f /etc/kernel/cmdline ] +then + U_BOOT_PARAMETERS="$(cat /etc/kernel/cmdline | sed -e 's/root=[^[:space:]]*//' -e 's/^[[:space:]]*//')" + if [ -z "${U_BOOT_ROOT}" ] + then + U_BOOT_ROOT="$(cat /etc/kernel/cmdline | sed -re 's/.*(root=[^[:space:]]*).*/\1/')" + fi +fi +U_BOOT_PARAMETERS="${U_BOOT_PARAMETERS:-ro quiet}" + # Find parameter for root from fstab if [ -z "${U_BOOT_ROOT}" ] then @@ -267,4 +276,3 @@ done _NUMBER="" Update "${_U_BOOT_DIRECTORY}/extlinux.conf" "${_CONFIG}" - diff --git a/u-boot-update.8 b/u-boot-update.8 index dfc3cd7..6536c6e 100644 --- a/u-boot-update.8 +++ b/u-boot-update.8 @@ -78,9 +78,10 @@ Otherwise, it defaults to 'Debian GNU/Linux, kernel'. .IP "U_BOOT_PARAMETERS=""\fBro quiet\fR""" 4 This variable specifies additional boot parameters that are appended to each kernel entry. -Value is an arbitrary string, -default is 'ro quiet' -(except for recovery entries, where quiet is avoided). +Value is an arbitrary string, default is the content +of /etc/kernel/cmdline, or 'ro quiet' +(except for recovery entries, where quiet is avoided) if +this file is not present or empty. .IP "U_BOOT_ROOT=""\fBroot\fR=\fIDEVICE\fR""" 4 This variable specifies the root partition. -- 2.35.1
Bug#1019743: u-boot-menu: u-boot-update should read kernel parameters from /etc/kernel/cmdline
Hi, That sounds like an interesting thing to have indeed, I actually started working on this a while ago but didn't have the time/incentive to push it further. Attaching the (draft) patch I came up with in case it can help moving forward. Cheers, ArnaudFrom 067706bcd903e17534f789b37976a4aa9267ede2 Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Tue, 14 Sep 2021 20:36:54 +0200 Subject: [PATCH] u-boot-update: honor /etc/kernel/cmdline --- u-boot-update | 12 ++-- u-boot-update.8 | 7 --- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/u-boot-update b/u-boot-update index da92918..6f74965 100755 --- a/u-boot-update +++ b/u-boot-update @@ -90,9 +90,18 @@ U_BOOT_DEFAULT="${U_BOOT_DEFAULT:-l0}" U_BOOT_ENTRIES="${U_BOOT_ENTRIES:-all}" U_BOOT_TIMEOUT="${U_BOOT_TIMEOUT:-50}" U_BOOT_MENU_LABEL="${U_BOOT_MENU_LABEL:-${PRETTY_NAME:-Debian GNU/Linux kernel}}" -U_BOOT_PARAMETERS="${U_BOOT_PARAMETERS:-ro quiet}" U_BOOT_FDT_DIR="${U_BOOT_FDT_DIR:-/usr/lib/linux-image-}" +if [ -z "${U_BOOT_PARAMETERS}" ] && [ -f /etc/kernel/cmdline ] +then + U_BOOT_PARAMETERS="$(cat /etc/kernel/cmdline | sed -e 's/root=[^[:space:]]*//' -e 's/^[[:space:]]*//')" + if [ -z "${U_BOOT_ROOT}" ] + then + U_BOOT_ROOT="$(cat /etc/kernel/cmdline | sed -re 's/.*(root=[^[:space:]]*).*/\1/')" + fi +fi +U_BOOT_PARAMETERS="${U_BOOT_PARAMETERS:-ro quiet}" + # Find parameter for root from fstab if [ -z "${U_BOOT_ROOT}" ] then @@ -230,4 +239,3 @@ done _NUMBER="" Update "${_U_BOOT_DIRECTORY}/extlinux.conf" "${_CONFIG}" - diff --git a/u-boot-update.8 b/u-boot-update.8 index 38f533b..66af9d1 100644 --- a/u-boot-update.8 +++ b/u-boot-update.8 @@ -78,9 +78,10 @@ Otherwise, it defaults to 'Debian GNU/Linux, kernel'. .IP "U_BOOT_PARAMETERS=""\fBro quiet\fR""" 4 This variable specifies additional boot parameters that are appended to each kernel entry. -Value is an arbitrary string, -default is 'ro quiet' -(except for recovery entries, where quiet is avoided). +Value is an arbitrary string, default is the content +of /etc/kernel/cmdline, or 'ro quiet' +(except for recovery entries, where quiet is avoided) if +this file is not present or empty. .IP "U_BOOT_ROOT=""\fBroot\fR=\fIDEVICE\fR""" 4 This variable specifies the root partition. -- 2.35.1
Bug#1019743: u-boot-menu: u-boot-update should read kernel parameters from /etc/kernel/cmdline
Source: u-boot-menu Version: 4.1.0 Severity: wishlist Dear Maintainer, u-boot-update should read the kernel cmline parameters from /etc/kernel/cmdline when updating the extlinux configuration. -- System Information: Debian Release: bookworm/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 5.19.0-1-amd64 (SMP w/8 CPU threads; PREEMPT) Kernel taint flags: TAINT_WARN Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled