[Arm-netbook] pivot_rooting to Debian (was Re: Repartitioning the internal flash)
Luke Kenneth Casson Leighton
luke.leighton at googlemail.com
Fri Mar 5 12:15:31 GMT 2010
On Fri, Mar 5, 2010 at 1:34 AM, Oliver Kiddle <okiddle at yahoo.co.uk> wrote:
> Luke Kenneth Casson Leighton wrote:
>> the other alternative to consider is creating a ram disk, putting a
>> tiny rootfs environment in it and then pivot_rooting into it.
>
> What about pivot_rooting onto the SD card?
absolutely brilliant idea. why didn't i think of that weeks ago?? :)
> It'd potentially allow a choice between MOS and Debian by simply
> removing/inserting the SD card on boot. My only other use for the SD card
> slot is likely to be viewing photos from my camera so I'd just have to
> put up with doing that from MOS.
or get a USB-based sd-card reader.
> Getting a working ext4 filesystem isn't easy. First, I built the latest
> e2fsprogs. After using mkfs.ext4 on /dev/mmcblk1p1, mount returns EINVAL.
wtf??? ok - remember that frans i believe it was pointed out that
ext4 is ext2/ext3 backwards-compatible, so you shouuuuld... *shrug*
> Finally I got something to mount by creating my filesystem with:
> dd if=/dev/mmcblk0p3 of=/dev/mmcblk1p1
wtf??! oh dear :)
> I've tested the pivot_root concept using VirtualBox on my PC with a
> Fedora install on a second disc (using febootstrap). I'm using the
> following init script partly taken from the pivot_root man page:
>
> #!/bin/sh
> if [ $$ -eq 1 ]; then
> # use /dev/mmcblk1p1
> if /bin/mount -t ext3 /dev/hdb1 /mnt && [ -x /mnt/sbin/init ]; then
> cd /mnt
> pivot_root . old_root
> exec chroot . sh -c 'umount /old_root; exec /sbin/init' \
> < dev/console > dev/console 2>&1
> fi
> fi
> exec /sbin/init.orig "$@"
>
> This works. Only thing is that on boot I'm getting a prompt about whether
> I really want to run e2fsck on a mounted filesystem (root).
mmm, typically you're supposed to mount the root filesystem
read-only, and then, after it's been double-checked, one of the init
scripts somewhere goes and remounts it as read-write (reading
/etc/fstab i believe)
so, make this:
if /bin/mount -t ext3 /dev/hdb1 /mnt && [ -x /mnt/sbin/init ]; then
into this:
if /bin/mount -o ro -t ext3 /dev/hdb1 /mnt && [ -x /mnt/sbin/init ]; then
... just out of curiosity, why is that /dev/hdb1 rather than /dev/mmcblk1p1 ?
> Before I stick this on my netbook, does anyone have any suggestions for
> improvements or foresee any problems?
whatever you do, as long as you DO NOT touch the first partition on
the NAND flash, such that u-boot is untouched, you can pretty much do
whatever you like, and you'll still be able to recover to "known good"
state.
> Can I perhaps check something in
> /sys before trying the mount or will that not be there yet.
if it's not there, then mount it (-t sysfs).
> Should I do anything for /dev?
noo idea :)
More information about the Arm-netbook
mailing list