On 2022-09-20, Arnaud Ferraris wrote:
> From 03db7668f3c371a5a2d564ca14c9e671c6a754b3 Mon Sep 17 00:00:00 2001
> From: Arnaud Ferraris <arnaud.ferra...@collabora.com>
> 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

Attachment: signature.asc
Description: PGP signature

Reply via email to