hey, A couple of projects we're working on at work require some tweaking of u-boot settings. These requirements can be summed up by:
A) Maintain the console= setting, and ideally all userargs (the cmdline args after "--") after install. This seems like standard Debian functionality that exists on other architectures, but is currently missing on flash-kernel platforms. B) The ability to let a package change settings in the u-boot environment. We have a case where a u-boot envvar setting needs to differ depending on whether or not certain software will be used (their u-boot has special code that reconfigures the hardware depending on the setting of this variable). The systems we're dealing with use a boot.scr script generated by flash-kernel. So, we figure we could solve both by letting packages drop in u-boot code snippets that will be prepended to the boot.scr. To do this, we propose a scheme similar to initramfs-tools where packages can drop snippets in a path under /usr/share (solving B), and users can add their own new setings or override the /usr/share versions by dropping snippets under /etc. With this scheme in place, flash-kernel-installer could be extended to drop in a file in /etc that does a 'setenv bootargs $userargs' to solve (A). Comments? diff -urpN flash-kernel-3.17.orig/debian/dirs flash-kernel-3.17/debian/dirs --- flash-kernel-3.17.orig/debian/dirs 2012-03-31 00:48:17.000000000 -0600 +++ flash-kernel-3.17/debian/dirs 2014-05-21 14:15:37.775191416 -0600 @@ -1 +1,3 @@ usr/sbin +etc/flash-kernel/ubootenv.d +usr/share/flash-kernel/ubootenv.d diff -urpN flash-kernel-3.17.orig/debian/flash-kernel-installer.postinst flash-kernel-3.17/debian/flash-kernel-installer.postinst --- flash-kernel-3.17.orig/debian/flash-kernel-installer.postinst 2014-02-28 20:20:00.000000000 -0700 +++ flash-kernel-3.17/debian/flash-kernel-installer.postinst 2014-05-21 14:55:40.397881137 -0600 @@ -100,6 +100,10 @@ fi trap - EXIT HUP INT QUIT TERM mv /target/tmp/flash-kernel.$$ /target/usr/sbin/flash-kernel +user_params="$(echo $(user-params))" +echo "setenv bootargs '$user_params'" > \ + /target/etc/flash-kernel/ubootenv.d/00bootargs + # We need the udev /dev which has the MTD devices mount -o bind /dev /target/dev if ! in-target flash-kernel; then diff -urpN flash-kernel-3.17.orig/functions flash-kernel-3.17/functions --- flash-kernel-3.17.orig/functions 2014-04-11 09:50:32.000000000 -0600 +++ flash-kernel-3.17/functions 2014-05-21 14:17:19.616268524 -0600 @@ -215,6 +215,19 @@ gen_kernel() { } >"$output" } +gen_ubootenv() { + ENVSTUBDIRS="/etc/flash-kernel/ubootenv.d /usr/share/flash-kernel/ubootenv.d" + ENVSTUBS="$(find $ENVSTUBDIRS -type f -regex '.*/[0-9a-zA-Z_-]+' -printf '%f\n' | LC_ALL=C sort -u)" + for file in $ENVSTUBS; do + for dir in $ENVSTUBDIRS; do + if [ -f $dir/$file ]; then + cat $dir/$file + break + fi + done + done +} + append_dtb() { local kernel="$1" local dtb="$2" @@ -623,7 +636,9 @@ case "$method" in fi if [ -n "$boot_script_path" ]; then boot_script_path="$boot_mnt_dir/$boot_script_path" - boot_script="$BOOTSCRIPTS_DIR/$usname" + boot_script="$tmpdir/bootscript" + gen_ubootenv > "$boot_script" + cat "$BOOTSCRIPTS_DIR/$usname" >> "$boot_script" mkimage_script "$usaddr" "boot script" "$boot_script" \ "$tmpdir/boot.scr" boot_script="$tmpdir/boot.scr" -- To UNSUBSCRIBE, email to debian-arm-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20140521205940.GB30318@fluid.dannf