summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-01-02 12:04:35 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-01-02 12:04:35 +0000
commit29c9030dcdc8a309f606fb816779353a87395604 (patch)
treeb30374d94a0604e9ae5f3158065be2f3c7990b23
parentebfe2cf1a71bddfa2f4d61b47a933ca5cd27f267 (diff)
downloadabuild-29c9030dcdc8a309f606fb816779353a87395604.tar.gz
abuild-29c9030dcdc8a309f606fb816779353a87395604.tar.bz2
abuild-29c9030dcdc8a309f606fb816779353a87395604.tar.xz
abuild-29c9030dcdc8a309f606fb816779353a87395604.zip
mk*: build and include modloop
try also mount modloop during boot and run a second pass hardware detect.
-rw-r--r--mkinitram40
-rw-r--r--mkiso21
-rw-r--r--mkmodloop39
3 files changed, 84 insertions, 16 deletions
diff --git a/mkinitram b/mkinitram
index 5f2b802..5f95d5a 100644
--- a/mkinitram
+++ b/mkinitram
@@ -9,7 +9,18 @@ die() {
exit 1
}
-APKS=tmp/apks
+unapk() {
+ local dest="$1"
+ shift
+ while [ $# -gt 0 ]; do
+ tar -C "$dest" -zxf "$1"
+ shift
+ done
+ rm -f "$dest/.PKGINFO"
+}
+
+
+APKS=../aports/core/*/
image=$PWD/image
dest=$PWD/test.gz
@@ -25,7 +36,7 @@ fi
if [ ! -d /lib/modules/$kernel ]; then
die "modules dir /lib/modules/$kernel was not found"
fi
-msg "Using kernel $kernel"
+msg "mkinitram Using kernel $kernel"
# create empty image dir
@@ -33,11 +44,11 @@ rm -rf "$image"
mkdir -p "$image/dev" "$image/etc/rcS.d"
# unpack busybox and deps
-tar -C $image -zxf $APKS/uclibc-[0-9]*.apk
-tar -C $image -zxf $APKS/busybox-[0-9]*.apk
-tar -C $image -zxf $APKS/alpine-baselayout-[0-9]*.apk
-tar -C $image -zxf $APKS/apk-tools-[0-9]*.apk
-rm -f $image/.PKGINFO
+unapk $image $APKS/uclibc-[0-9]*.apk \
+ $APKS/busybox-[0-9]*.apk \
+ $APKS/alpine-baselayout-[0-9]*.apk \
+ $APKS/apk-tools-[0-9]*.apk
+
ln -sf /bin/busybox $image/init
# create misc devs and enable boot scripts
@@ -45,24 +56,29 @@ mknod $image/dev/null c 2 2
ln -s ../init.d/mdev $image/etc/rcS.d/S10mdev
ln -s ../init.d/hwdrivers $image/etc/rcS.d/S30hwdrivers
ln -s ../init.d/modutils $image/etc/rcS.d/S40modutils
+ln -s ../init.d/modloop $image/etc/rcS.d/S50modloop
+ln -s ../init.d/hwdrivers $image/etc/rcS.d/S60hwdrivers
+
+mkdir $image/.modloop
# load those extra drivers
-for i in ide-cd usb-storage ide-disk; do
+for i in ide-cd usb-storage ide-disk loop; do
echo $i >> $image/etc/modules
done
# copy kernel modules
kmods=$image/lib/modules/$kernel
-mkdir -p $kmods/kernel/drivers
+mkdir -p $kmods/kernel/drivers $kmods/kernel/fs
-for i in ata block ide ieee1394 scsi cdrom usb message; do
+for i in ata block ide scsi cdrom usb message; do
cp -LpR /lib/modules/$kernel/kernel/drivers/$i $kmods/kernel/drivers/
done
-for i in fs lib; do
- cp -LpR /lib/modules/$kernel/kernel/$i $kmods/kernel/
+for i in isofs vfat nls ext2 cramfs '*.ko'; do
+ cp -LpR /lib/modules/$kernel/kernel/fs/$i $kmods/kernel/fs/
done
+cp -LpR /lib/modules/$kernel/kernel/lib $kmods/kernel/
depmod $kernel -b $image
diff --git a/mkiso b/mkiso
index af55146..9cad45c 100644
--- a/mkiso
+++ b/mkiso
@@ -4,6 +4,16 @@ tmp=$PWD/tmp
aports=$PWD/../aports
target=alpine-test.iso
+unapk() {
+ local dest="$1"
+ shift
+ while [ $# -gt 0 ]; do
+ tar -C "$dest" -zxf "$1"
+ shift
+ done
+ rm -f "$dest/.PKGINFO"
+}
+
rm -r $tmp
mkdir -p $tmp/apks $tmp/isolinux
cp /usr/share/syslinux/isolinux.* $tmp/isolinux
@@ -14,17 +24,20 @@ default test
label test
kernel /boot/vmlinuz
- append initrd=/test.gz init=/sbin/init quiet
+ append initrd=/test.gz init=/sbin/init quiet alpine_dev=cdrom
EOF
-cp $aports/core/*/*.apk $tmp/apks
-tar -C $tmp -zxf $aports/core/linux-grsec/linux-grsec-[0-9]*.apk
-rm -f $tmp/.PKGINFO
+#cp $aports/core/*/*.apk $tmp/apks
+
+unapk $tmp $aports/core/linux-grsec/linux-grsec-[0-9]*.apk
sh mkinitram
+sh mkmodloop
cp test.gz $tmp/
+mkdir -p $tmp/boot/
+cp modloop.cmg $tmp/boot/
genisoimage -o $target -l -J -R \
-b isolinux/isolinux.bin \
diff --git a/mkmodloop b/mkmodloop
new file mode 100644
index 0000000..a3723cc
--- /dev/null
+++ b/mkmodloop
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+msg() {
+ echo "==>" $@
+}
+
+die() {
+ echo $@
+ exit 1
+}
+
+image=$PWD/modloop
+dest=$PWD/modloop.cmg
+init=init
+
+
+kernel=$1
+# if no kernel specified, then guess...
+if [ -z "$kernel" ]; then
+ kernel=$(ls /lib/modules 2>/dev/null | tail -n 1)
+fi
+
+if [ ! -d /lib/modules/$kernel ]; then
+ die "modules dir /lib/modules/$kernel was not found"
+fi
+msg "Using kernel $kernel"
+
+
+rm -rf "$image"
+mkdir -p "$image/lib/modules" "$image/lib"
+
+cp -alf /lib/firmware $image/lib/
+cp -alf /lib/modules/$kernel $image/lib/modules/
+
+depmod -b "$image" $kernel
+
+rm -f $image/lib/modules/$kernel/source $image/lib/modules/$kernel/build
+
+mkcramfs $image $dest