diff options
author | Timo Teräs <timo.teras@iki.fi> | 2016-11-09 16:10:17 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2016-11-09 16:15:26 +0200 |
commit | d4f2c7028722b705a423527450f8f7c11658041a (patch) | |
tree | aeaf0bddbf3000fdf8094813fc1cc7cfa5c862e1 | |
parent | 75f069b7c15fa5ed222f5c892bf1085bc2d9be14 (diff) | |
download | alpine-conf-d4f2c7028722b705a423527450f8f7c11658041a.tar.bz2 alpine-conf-d4f2c7028722b705a423527450f8f7c11658041a.tar.xz |
update-kernel: add --media option
To create boot media, otherwise it is assumed to be updating
live system and /boot is mounted.
-rw-r--r-- | update-kernel.in | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/update-kernel.in b/update-kernel.in index d3959f8..981156c 100644 --- a/update-kernel.in +++ b/update-kernel.in @@ -18,6 +18,7 @@ SUPERUSER= ARCH= BUILDDIR= FLAVOR= +MEDIA= MNTDIR= PACKAGES= MKINITFS_ARGS= @@ -47,6 +48,7 @@ usage() { -p|--package <package> Additional module or firmware package -v|--verbose Verbose output -K|--hostkeys Include host keys in initramfs + -M|--media Boot media directory layout --repositories-file <f> apk repositories file __EOF__ @@ -54,8 +56,9 @@ usage() { } QUIET_OPT="--quiet" -OPTS=$(getopt -l arch:,build-dir:,flavor:,feature:,help,package:,verbose,hostkeys,repositories-file: \ - -n $SCRIPT -o a:b:f:F:hp:vK -- "$@") || usage 1 +OPTS=$(getopt -l arch:,build-dir:,flavor:,feature:,help,package:,verbose,hostkeys,media,repositories-file: \ + -n $SCRIPT -o a:b:f:F:hp:vKM -- "$@") || usage 1 + eval set -- "$OPTS" while :; do case "$1" in @@ -89,6 +92,9 @@ while :; do -K|--hostkeys) MKINITFS_ARGS="$MKINITFS_ARGS -K" ;; + -M|--media) + MEDIA=yes + ;; --repositories-file) shift REPOSITORIES_FILE=$1 @@ -235,9 +241,8 @@ depmod -b $ROOT "$KVER" STAGING=$TMPDIR/boot MODLOOP=$TMPDIR/modloop MODIMG=modloop-$FLAVOR -DTB_STAGING=$TMPDIR/dtbs -mkdir $DTB_STAGING $MODLOOP $STAGING +mkdir $MODLOOP $STAGING cp -a $ROOT/lib/modules $MODLOOP mkdir -p $MODLOOP/modules/firmware find $ROOT/lib/modules -type f -name "*.ko" | xargs modinfo -F firmware | sort -u | while read FW; do @@ -260,13 +265,15 @@ if [ "$MNTDIR" ]; then remount -w fi -mv $STAGING/* "$DESTDIR" +mkdir -p "$DESTDIR"/${MEDIA:+boot/} +mv $STAGING/* "$DESTDIR"/${MEDIA:+boot/} if [ -d "$DTBDIR" ]; then _opwd=$PWD - case "$FLAVOR" in - rpi*) _dtb="$DESTDIR" ;; - *) _dtb="$DESTDIR/dtbs" ;; + case "$MEDIA,$FLAVOR" in + yes,rpi*) _dtb="$DESTDIR/" ;; + yes,*) _dtb="$DESTDIR/boot/dtbs" ;; + *,*) _dtb="$DESTDIR/dtbs" ;; esac mkdir -p "$_dtb" _dtb=$(realpath "$_dtb") |