Commit 78c5156f authored by Kaarle Ritvanen's avatar Kaarle Ritvanen
Browse files

update-kernel: direct installation with kernel build system

parent ef798bbd
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
SCRIPT=update-kernel SCRIPT=update-kernel
VIRTUAL=.tmp-$SCRIPT VIRTUAL=.tmp-$SCRIPT
BUILDDIR=
FLAVOR= FLAVOR=
MNTDIR= MNTDIR=
PACKAGES= PACKAGES=
...@@ -19,10 +20,14 @@ SIGNALS="HUP INT TERM" ...@@ -19,10 +20,14 @@ SIGNALS="HUP INT TERM"
TMPDIR= TMPDIR=
features= 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" eval set -- "$OPTS"
while :; do while :; do
case "$1" in case "$1" in
-b|--build-dir)
BUILDDIR=$2
;;
-f|--flavor) -f|--flavor)
FLAVOR=$2 FLAVOR=$2
;; ;;
...@@ -47,6 +52,9 @@ error() { ...@@ -47,6 +52,9 @@ error() {
exit 1 exit 1
} }
[ "$BUILDDIR" -a "$FLAVOR" ] && \
error "Cannot specify both build directory and flavor"
if [ -z "$DESTDIR" ]; then if [ -z "$DESTDIR" ]; then
[ "$FLAVOR" ] && error "Cannot specify flavor when updating the current kernel" [ "$FLAVOR" ] && error "Cannot specify flavor when updating the current kernel"
...@@ -94,6 +102,7 @@ fi ...@@ -94,6 +102,7 @@ fi
TMPDIR=$(mktemp -dt $SCRIPT.XXXXXX) TMPDIR=$(mktemp -dt $SCRIPT.XXXXXX)
ROOT=$TMPDIR/root ROOT=$TMPDIR/root
BOOT=$ROOT/boot
_apk() { _apk() {
local cmd=$1 local cmd=$1
...@@ -113,10 +122,17 @@ extra_pkgs() { ...@@ -113,10 +122,17 @@ extra_pkgs() {
fi fi
} }
add_pkgs -U --initdb alpine-base "linux-$FLAVOR" linux-firmware $PACKAGES add_pkgs -U --initdb alpine-base $PACKAGES
if [ -z "$PACKAGES" ]; then 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 "dahdi-linux-$FLAVOR" dahdi-linux
extra_pkgs "xtables-addons-$FLAVOR" extra_pkgs "xtables-addons-$FLAVOR"
fi
fi fi
...@@ -137,7 +153,7 @@ mksquashfs "$MODLOOP" "$STAGING/$MODIMG" -comp xz ...@@ -137,7 +153,7 @@ mksquashfs "$MODLOOP" "$STAGING/$MODIMG" -comp xz
mkinitfs -q -b "$ROOT" -F "$features base squashfs" -o "$STAGING/$FLAVOR.gz" \ mkinitfs -q -b "$ROOT" -F "$features base squashfs" -o "$STAGING/$FLAVOR.gz" \
"$KVER" "$KVER"
cp "$ROOT/boot/vmlinuz$KVER_FLAVOR" "$STAGING/$FLAVOR" cp "$BOOT/vmlinuz$KVER_FLAVOR" "$STAGING/$FLAVOR"
if [ "$MNTDIR" ]; then if [ "$MNTDIR" ]; then
......
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