Commit d4f2c702 authored by Timo Teräs's avatar Timo Teräs

update-kernel: add --media option

To create boot media, otherwise it is assumed to be updating
live system and /boot is mounted.
parent 75f069b7
...@@ -18,6 +18,7 @@ SUPERUSER= ...@@ -18,6 +18,7 @@ SUPERUSER=
ARCH= ARCH=
BUILDDIR= BUILDDIR=
FLAVOR= FLAVOR=
MEDIA=
MNTDIR= MNTDIR=
PACKAGES= PACKAGES=
MKINITFS_ARGS= MKINITFS_ARGS=
...@@ -47,6 +48,7 @@ usage() { ...@@ -47,6 +48,7 @@ usage() {
-p|--package <package> Additional module or firmware package -p|--package <package> Additional module or firmware package
-v|--verbose Verbose output -v|--verbose Verbose output
-K|--hostkeys Include host keys in initramfs -K|--hostkeys Include host keys in initramfs
-M|--media Boot media directory layout
--repositories-file <f> apk repositories file --repositories-file <f> apk repositories file
__EOF__ __EOF__
...@@ -54,8 +56,9 @@ usage() { ...@@ -54,8 +56,9 @@ usage() {
} }
QUIET_OPT="--quiet" QUIET_OPT="--quiet"
OPTS=$(getopt -l arch:,build-dir:,flavor:,feature:,help,package:,verbose,hostkeys,repositories-file: \ OPTS=$(getopt -l arch:,build-dir:,flavor:,feature:,help,package:,verbose,hostkeys,media,repositories-file: \
-n $SCRIPT -o a:b:f:F:hp:vK -- "$@") || usage 1 -n $SCRIPT -o a:b:f:F:hp:vKM -- "$@") || usage 1
eval set -- "$OPTS" eval set -- "$OPTS"
while :; do while :; do
case "$1" in case "$1" in
...@@ -89,6 +92,9 @@ while :; do ...@@ -89,6 +92,9 @@ while :; do
-K|--hostkeys) -K|--hostkeys)
MKINITFS_ARGS="$MKINITFS_ARGS -K" MKINITFS_ARGS="$MKINITFS_ARGS -K"
;; ;;
-M|--media)
MEDIA=yes
;;
--repositories-file) --repositories-file)
shift shift
REPOSITORIES_FILE=$1 REPOSITORIES_FILE=$1
...@@ -235,9 +241,8 @@ depmod -b $ROOT "$KVER" ...@@ -235,9 +241,8 @@ depmod -b $ROOT "$KVER"
STAGING=$TMPDIR/boot STAGING=$TMPDIR/boot
MODLOOP=$TMPDIR/modloop MODLOOP=$TMPDIR/modloop
MODIMG=modloop-$FLAVOR MODIMG=modloop-$FLAVOR
DTB_STAGING=$TMPDIR/dtbs
mkdir $DTB_STAGING $MODLOOP $STAGING mkdir $MODLOOP $STAGING
cp -a $ROOT/lib/modules $MODLOOP cp -a $ROOT/lib/modules $MODLOOP
mkdir -p $MODLOOP/modules/firmware mkdir -p $MODLOOP/modules/firmware
find $ROOT/lib/modules -type f -name "*.ko" | xargs modinfo -F firmware | sort -u | while read FW; do 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 ...@@ -260,13 +265,15 @@ if [ "$MNTDIR" ]; then
remount -w remount -w
fi fi
mv $STAGING/* "$DESTDIR" mkdir -p "$DESTDIR"/${MEDIA:+boot/}
mv $STAGING/* "$DESTDIR"/${MEDIA:+boot/}
if [ -d "$DTBDIR" ]; then if [ -d "$DTBDIR" ]; then
_opwd=$PWD _opwd=$PWD
case "$FLAVOR" in case "$MEDIA,$FLAVOR" in
rpi*) _dtb="$DESTDIR" ;; yes,rpi*) _dtb="$DESTDIR/" ;;
*) _dtb="$DESTDIR/dtbs" ;; yes,*) _dtb="$DESTDIR/boot/dtbs" ;;
*,*) _dtb="$DESTDIR/dtbs" ;;
esac esac
mkdir -p "$_dtb" mkdir -p "$_dtb"
_dtb=$(realpath "$_dtb") _dtb=$(realpath "$_dtb")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment