| Version 13 (modified by jrollins, 6 years ago) (diff) |
|---|
debirf
The goal of this project is to create a RIP-style kernel and initramfs that leaves the user in a functional debian system.
creating root:
$ mkdir -p debirf/root
$ cd debirf
$ /usr/sbin/debootstrap --exclude=aptitude etch ./root http://ftp.debian.org/debian
$ cd root
$ chroot .
chroot$ echo debirf > /etc/hostname
chroot$ apt-get update
chroot$ echo 'do_initrd = Yes' >> /etc/kernel-img.conf
(modify /etc/kernel-img.conf to not do symlinks?)
chroot$ apt-get install linux-image-2.6-486
* should be able to remove locales
$ find /usr/share/locale -maxdepth 1 -mindepth 1 -type d ! -iname 'en*' -exec rm -rf '{}' \;
chroot$ apt-cache clean
chroot$ rm /var/cache/apt/*.bin
chroot$ rm -rf /var/lib/apt/lists/*
chroot$ mkdir /var/lib/apt/lists/partial
chroot$ exit
extract kernel and initramfs:
mv boot/vmlinuz-* ../ mv boot/initrd.img-* ../
stupid simple method
clean etc/mtab
> etc/mtab
edit etc/fstab:
proc /proc proc defaults 0 0 dev /dev tmpfs size=10M,mode=0755 0 0 #necessary?
link sbin/init to init:
ln -s sbin/init init
archive/gzip filesystem:
find * | cpio -H newc --create | gzip > ../debirf.cgz
...not quite working. get mount errors about /dev...
tweaked initramfs method
add debirf script to scripts/debirf (either directly or through mkinitramfs):
# debirf.top
cat scripts/debirf <<EOF
mountroot() {
rootmnt="/"
}
make bin/run-init:
#!/bin/sh if [ "$1" != "/" ] ; then exec /usr/lib/klibc/bin/run-init "$@" else MOUNT_POINT="$1" INIT="$2" shift 2 exec "$INIT" "$@" fi
chmod a+x bin/run-init
archive/gzip filesystem and append to initramfs:
mv ../{initrd-img-*,debirf.cgz}
find * | cpio -H newc --create | gzip >> ../debirf.cgz
give the following boot parameter:
boot=debirf
things to do:
potentially useful commands:
dpkg-query -W --showformat='${Priority}: ${Package}\n' | grep ^required
notes
at the moment, our naive approach is failing with
No filesystem could mount root, tried: ext2 cramfs Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
and the main difference between debirf and RIP is that RIP says
Overmounted tmpfs
just before
Freeing initrd memory
This seems to be from a kernel patch that Kent Robotti is using. Can we get this to work without patching the kernel? Can we avoid the attempted mount?
the kernel patch is not sufficient. I tried patching the stock debian kernel so that it "overmounted tmpfs", and the boot still fails with the same error message.
We're booting with the same kernel parameters, so what does the RIP kernel do that the stock debian one does not at boot time? Could we stuff the filesystem we want into a standard debian initramfs instead and loopmount it or something?
mkinitramfs -o ../debirf.cgz -r root zcat /special-boot/debirf/debirf.cgz | cpio --quiet --extract

