summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV.Krishn <vkrishn@insteps.net>2025-01-14 15:48:37 +0000
committerV.Krishn <vkrishn@insteps.net>2025-01-14 15:48:37 +0000
commit964646a0dd02ab151759925d0324a100dd807260 (patch)
tree088cfebdf3218e2e5cf7266d40916f9a9ff7d3be
parent326ab867bbf3d94e3009cd90a26ebe0f78a4f41a (diff)
downloadaportsbag-964646a0dd02ab151759925d0324a100dd807260.tar.bz2
main/openrc: add, firmware copying onto overlayfs
-rw-r--r--[-rwxr-xr-x]openrc/modloop.initd19
-rw-r--r--openrc/modloop.initd.readme18
2 files changed, 34 insertions, 3 deletions
diff --git a/openrc/modloop.initd b/openrc/modloop.initd
index 41f8462..014f89c 100755..100644
--- a/openrc/modloop.initd
+++ b/openrc/modloop.initd
@@ -114,11 +114,13 @@ start() {
fi
#use overlayfs if available and configured
+ local isOverlay=0
if grep -q -w "overlay$" /proc/filesystems && [ ! -z ${unionfs_size+x} ]; then
ewarn "Use of unionfs_size is deprecated use overlay_size instead"
overlay_size="$unionfs_size"
fi
if grep -q -w "overlay$" /proc/filesystems && [ -n "$overlay_size" ]; then
+ isOverlay=1
ebegin "OverlayFS detected, mounting modloop rw"
[ "$overlay_size" != 0 ] && mount_ops="-o size=$overlay_size"
mkdir -p /.modoverlayfs /lib/modules
@@ -133,10 +135,20 @@ start() {
# copy firmware if there are any
if [ -d $alpine_mnt/firmware ]; then
- ebegin "Copying firmware from $alpine_mnt/firmware"
- cp -R -a $alpine_mnt/firmware /lib/
- eend $?
+ if [ 'x1' = "x$isOverlay" ]; then
+ ebegin "Copying firmware from $alpine_mnt/firmware to overlay"
+ cp -R -a $alpine_mnt/firmware /lib/modules/
+ sleep 2
+ rmdir /lib/firmware 2>/dev/null \
+ && ln -s /lib/modules/firmware /lib/
+ eend $?
+ else
+ # ebegin "Copying firmware from $alpine_mnt/firmware"
+ cp -R -a $alpine_mnt/firmware /lib/
+ # eend $?
+ fi
elif [ -d /lib/modules/firmware ]; then
+ # ebegin "Linking firmware"
rmdir /lib/firmware 2>/dev/null \
&& ln -s /lib/modules/firmware /lib/
fi
@@ -154,3 +166,4 @@ stop() {
eend $ret || return 1
}
+
diff --git a/openrc/modloop.initd.readme b/openrc/modloop.initd.readme
new file mode 100644
index 0000000..05909d6
--- /dev/null
+++ b/openrc/modloop.initd.readme
@@ -0,0 +1,18 @@
+
+
+Tue 14 Jan 2025 09:14:48 PM EST
+
+modloop initd scripts allows firmwares to be loaded from boot medias' /firmware directory.
+This is helpful, but that means having to know all the firmwares for the given device and
+ copying onto /firmware folder. This can be improved if a script can figure all the needed
+ ones and create/print a list.
+
+Feature asked below modifies the exiting modloop overlay functionalities and copys' /firmware
+ onto it. Now, I only need to have other needed firmwares in /firmware directory.
+
+I am not aware if modloop overlay is meant for to be used in some other way, having
+ it documented would be nice.
+
+Hope this explains the need. The idea is some-what implemented in POC scripts
+ (find attached below)
+