summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-10-29 08:29:03 +0200
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-10-29 10:15:57 +0200
commit78c5156f511776403e6be73c9c4baf157690f91d (patch)
treeb651149f63e2943818cf7e62f58c35c21679f182
parentef798bbd1a77991aebb105402b7989509c32f40f (diff)
downloadalpine-conf-78c5156f511776403e6be73c9c4baf157690f91d.zip
update-kernel: direct installation with kernel build system
-rw-r--r--update-kernel.in28
1 files changed, 22 insertions, 6 deletions
diff --git a/update-kernel.in b/update-kernel.in
index 35a9375..74dbe75 100644
--- a/update-kernel.in
+++ b/update-kernel.in
@@ -12,6 +12,7 @@
SCRIPT=update-kernel
VIRTUAL=.tmp-$SCRIPT
+BUILDDIR=
FLAVOR=
MNTDIR=
PACKAGES=
@@ -19,10 +20,14 @@ SIGNALS="HUP INT TERM"
TMPDIR=
features=
-OPTS=$(getopt -l flavor:,feature:,package: -n $SCRIPT -o f:F:p: -- "$@")
+OPTS=$(getopt -l build-dir:,flavor:,feature:,package: -n $SCRIPT -o b:f:F:p: \
+ -- "$@")
eval set -- "$OPTS"
while :; do
case "$1" in
+ -b|--build-dir)
+ BUILDDIR=$2
+ ;;
-f|--flavor)
FLAVOR=$2
;;
@@ -47,6 +52,9 @@ error() {
exit 1
}
+[ "$BUILDDIR" -a "$FLAVOR" ] && \
+ error "Cannot specify both build directory and flavor"
+
if [ -z "$DESTDIR" ]; then
[ "$FLAVOR" ] && error "Cannot specify flavor when updating the current kernel"
@@ -94,6 +102,7 @@ fi
TMPDIR=$(mktemp -dt $SCRIPT.XXXXXX)
ROOT=$TMPDIR/root
+BOOT=$ROOT/boot
_apk() {
local cmd=$1
@@ -113,10 +122,17 @@ extra_pkgs() {
fi
}
-add_pkgs -U --initdb alpine-base "linux-$FLAVOR" linux-firmware $PACKAGES
-if [ -z "$PACKAGES" ]; then
- extra_pkgs "dahdi-linux-$FLAVOR" dahdi-linux
- extra_pkgs "xtables-addons-$FLAVOR"
+add_pkgs -U --initdb alpine-base $PACKAGES
+if [ "$BUILDDIR" ]; then
+ mkdir -p "$BOOT"
+ make -C "$BUILDDIR" firmware_install install modules_install \
+ INSTALL_MOD_PATH="$ROOT" INSTALL_PATH="$BOOT"
+else
+ add_pkgs "linux-$FLAVOR" linux-firmware
+ if [ -z "$PACKAGES" ]; then
+ extra_pkgs "dahdi-linux-$FLAVOR" dahdi-linux
+ extra_pkgs "xtables-addons-$FLAVOR"
+ fi
fi
@@ -137,7 +153,7 @@ mksquashfs "$MODLOOP" "$STAGING/$MODIMG" -comp xz
mkinitfs -q -b "$ROOT" -F "$features base squashfs" -o "$STAGING/$FLAVOR.gz" \
"$KVER"
-cp "$ROOT/boot/vmlinuz$KVER_FLAVOR" "$STAGING/$FLAVOR"
+cp "$BOOT/vmlinuz$KVER_FLAVOR" "$STAGING/$FLAVOR"
if [ "$MNTDIR" ]; then