Commit 29c9030d authored by Natanael Copa's avatar Natanael Copa
Browse files

mk*: build and include modloop

try also mount modloop during boot and run a second pass hardware
detect.
parent ebfe2cf1
......@@ -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
......
......@@ -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 \
......
#!/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
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