| 7 | | {{{ |
| 8 | | $ mkdir -p debirf/root |
| 9 | | $ cd debirf |
| 10 | | $ /usr/sbin/debootstrap --exclude=aptitude etch ./root http://ftp.debian.org/debian |
| 11 | | $ cd root |
| 12 | | $ chroot . |
| 13 | | chroot$ echo debirf > /etc/hostname |
| 14 | | chroot$ apt-get update |
| 15 | | chroot$ echo 'do_initrd = Yes' >> /etc/kernel-img.conf |
| 16 | | (modify /etc/kernel-img.conf to not do symlinks?) |
| 17 | | chroot$ apt-get install linux-image-2.6-486 |
| | 7 | The benefit of the this patched kernel method, though, is that it's "stupid simple". The initrd is nothing more than a cpio gzip'd (initramfs) of the desired filesystem, with a couple of simple tweaks. The initial executed script just /sbin/init. We feel that this is really how it should be. No crazy init gymnastics to get a root filesystem mounted. The initrd ''is'' the root filesystem. |
| 37 | | clean etc/mtab |
| 38 | | {{{ |
| 39 | | > etc/mtab |
| 40 | | }}} |
| 41 | | |
| 42 | | edit etc/fstab: |
| 43 | | {{{ |
| 44 | | proc /proc proc defaults 0 0 |
| 45 | | dev /dev tmpfs size=10M,mode=0755 0 0 #necessary? |
| 46 | | }}} |
| 47 | | |
| 48 | | link sbin/init to init: |
| 49 | | {{{ |
| 50 | | ln -s sbin/init init |
| 51 | | }}} |
| 52 | | |
| 53 | | archive/gzip filesystem: |
| 54 | | {{{ |
| 55 | | find * | cpio -H newc --create | gzip > ../debirf.cgz |
| 56 | | }}} |
| 57 | | |
| 58 | | ...not quite working. get mount errors about /dev... |
| 59 | | |
| 60 | | == tweaked initramfs method == |
| 61 | | |
| 62 | | add debirf script to scripts/debirf (either directly or through mkinitramfs): |
| 63 | | {{{ |
| 64 | | # debirf.top |
| 65 | | cat scripts/debirf <<EOF |
| 66 | | mountroot() { |
| 67 | | rootmnt="/" |
| 68 | | } |
| 69 | | }}} |
| 70 | | |
| 71 | | make bin/run-init: |
| 72 | | {{{ |
| 73 | | #!/bin/sh |
| 74 | | if [ "$1" != "/" ] ; then |
| 75 | | exec /usr/lib/klibc/bin/run-init "$@" |
| 76 | | else |
| 77 | | MOUNT_POINT="$1" |
| 78 | | INIT="$2" |
| 79 | | shift 2 |
| 80 | | exec "$INIT" "$@" |
| 81 | | fi |
| 82 | | }}} |
| 83 | | {{{ |
| 84 | | chmod a+x bin/run-init |
| 85 | | }}} |
| 86 | | |
| 87 | | archive/gzip filesystem and append to initramfs: |
| 88 | | {{{ |
| 89 | | mv ../{initrd-img-*,debirf.cgz} |
| 90 | | find * | cpio -H newc --create | gzip >> ../debirf.cgz |
| 91 | | }}} |
| 92 | | |
| 93 | | give the following boot parameter: |
| 94 | | {{{ |
| 95 | | boot=debirf |
| 96 | | }}} |
| 97 | | |
| 98 | | == things to do: == |
| 99 | | |
| 100 | | * [wiki:debirf/bootlogs] |
| 102 | | |
| 103 | | == potentially useful commands: == |
| 104 | | |
| 105 | | {{{ |
| 106 | | dpkg-query -W --showformat='${Priority}: ${Package}\n' | grep ^required |
| 107 | | }}} |
| 108 | | |
| 109 | | == notes == |
| 110 | | |
| 111 | | at the moment, our naive approach is failing with |
| 112 | | {{{ |
| 113 | | No filesystem could mount root, tried: ext2 cramfs |
| 114 | | Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0) |
| 115 | | }}} |
| 116 | | |
| 117 | | and the main difference between debirf and RIP is that RIP says |
| 118 | | {{{ |
| 119 | | Overmounted tmpfs |
| 120 | | }}} |
| 121 | | just before |
| 122 | | {{{ |
| 123 | | Freeing initrd memory |
| 124 | | }}} |
| 125 | | |
| 126 | | This seems to be from a [http://www.tux.org/pub/people/kent-robotti/looplinux/rip/inittmpfs-2.6.14.diff.gz kernel patch] that Kent Robotti is using. Can we get this to work without patching the kernel? Can we avoid the attempted mount? |
| 127 | | |
| 128 | | 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. |
| 129 | | |
| 130 | | 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? |
| 131 | | |
| 132 | | {{{ |
| 133 | | mkinitramfs -o ../debirf.cgz -r root |
| 134 | | zcat /special-boot/debirf/debirf.cgz | cpio --quiet --extract |
| 135 | | }}} |