Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
alpine
alpine-conf
Commits
a231e298
Commit
a231e298
authored
Oct 23, 2014
by
Kaarle Ritvanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update-kernel: script for kernel and firware update
parent
34325b35
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
1 deletion
+92
-1
Makefile
Makefile
+2
-1
update-kernel.in
update-kernel.in
+90
-0
No files found.
Makefile
View file @
a231e298
...
@@ -25,7 +25,8 @@ SBIN_FILES := lbu\
...
@@ -25,7 +25,8 @@ SBIN_FILES := lbu\
setup-timezone
\
setup-timezone
\
setup-xen-dom0
\
setup-xen-dom0
\
setup-xorg-base
\
setup-xorg-base
\
update-conf
update-conf
\
update-kernel
BIN_FILES
:=
uniso
BIN_FILES
:=
uniso
...
...
update-kernel.in
0 → 100644
View file @
a231e298
#!/bin/sh -e
# update-kernel
#
# Kernel and firmware update script for Alpine installations set up
# with setup-bootable
#
# Copyright (c) 2014 Timo Teräs
# Copyright (c) 2014 Kaarle Ritvanen
TMPDIR
=
SIGNALS
=
"HUP INT TERM"
SCRIPT
=
update-kernel
VIRTUAL
=
.tmp-
$SCRIPT
while
read
MOUNT
;
do
set
--
$MOUNT
[
$2
=
/.modloop
]
||
continue
DESTDIR
=
$(
dirname
$(
losetup
$1
|
cut
-d
" "
-f
3
))
MNTDIR
=
$(
dirname
$DESTDIR
)
break
done
< /proc/mounts
if
[
-z
"
$MNTDIR
"
]
;
then
echo
"Module loopback device not mounted"
>
&2
exit
1
fi
remount
()
{
mount
$1
-o
remount
$MNTDIR
}
ignore_sigs
()
{
trap
""
$SIGNALS
}
clean_up
()
{
set
+e
ignore_sigs
apk del
$VIRTUAL
rm
-fr
$TMPDIR
}
trap
clean_up EXIT
$SIGNALS
apk add
-U
--virtual
$VIRTUAL
mkinitfs squashfs-tools
.
/etc/mkinitfs/mkinitfs.conf
ARCH
=
$(
apk
--print-arch
)
FLAVOR
=
$(
uname
-r
|
cut
-d
-
-f
3-
)
TMPDIR
=
$(
mktemp
-dt
$SCRIPT
.XXXXXX
)
ROOT
=
$TMPDIR
/root
apk add
--arch
$ARCH
--root
$ROOT
--keys-dir
/etc/apk/keys
\
--repositories
/etc/apk/repositories
\
--initdb
-U
alpine-base dahdi-linux linux-
$FLAVOR
linux-firmware
KVER
=
$(
ls
$ROOT
/lib/modules
)
depmod
-b
$ROOT
$KVER
STAGING
=
$TMPDIR
/boot
MODLOOP
=
$TMPDIR
/modloop
MODIMG
=
$FLAVOR
.modloop.squashfs
mkdir
$MODLOOP
$STAGING
cp
-a
$ROOT
/lib/modules
$MODLOOP
cp
-a
$ROOT
/lib/firmware
$MODLOOP
/modules
mksquashfs
$MODLOOP
$STAGING
/
$MODIMG
-comp
xz
mkinitfs
-F
"
$features
squashfs"
-b
$ROOT
-o
$STAGING
/
$FLAVOR
.gz
$KVER
cp
$ROOT
/boot/vmlinuz-
$FLAVOR
$STAGING
/
$FLAVOR
ignore_sigs
remount
-w
rm
-f
$DESTDIR
/
$MODIMG
mv
$STAGING
/
*
$DESTDIR
set
+e
sync
remount
-r
exit
0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment