You are not logged in.
Pages: 1
I know this has sort of been asked before, but I'm still a little lost and am hoping this great community can help me. I have a flash drive and I would like to keep the whole thing as one FAT32 partition. I'm hoping to achieve something Wubi-like and have an image file on the drive act as Arch's root file system. I don't think I'll have any trouble installing Arch onto a loopback device; from what I understand, I can just mount the image and install a base system with 'pacman -r /mnt/my-loopback-mount-point base'. The hard part is getting the installation to boot.
I understand that the initramfs is what's responsible for getting the root FS ready to use, so I imagine some tweaks will have to be made there. I read over mkinitcpio but I can't figure out how I'd go about getting it configured to generate an initramfs that would mount the image file (let's say it's at /arch/rootfs.img on the flash drive) as a loopback device and set it up as the root FS. Any pointers?
Last edited by nonoitall (2010-04-20 03:22:00)
Offline
The boot process happens this way :
- kernel is loaded
- kernel loads initramfs
- initramfs calls its own init script (/init by default) to mount the new root fs and switch to it
- the final rootfs is loaded and its own init script is loaded (/etc/inittab? not sure anymore which is used on arch)
It's the third step that's important for you. You should tweak /init to mount your loopback device and switch_root to it. I don't know of any tool to automate that. I never didi that sort of thing on an Arch-based system, so sorry if some details aren't pefectly right. But the main idea is there, you should find anything you need with our friend google.
This could help you : http://jootamam.net/howto-initramfs-image.htm
Have fun
V=RI sweet V=RI
Offline
I recently did something like this.
I just changed (quick and dirty) "/lib/initcpio/init_functions".
In the end of default_mount_handler() the root partition gets mounted, so changing the line:
mount ${fstype:+-t ${fstype}} -o ${rwopt}${rootflags:+,${rootflags}} "${root}" "$1"
in something like this:
mkdir /usb
mount ${fstype:+-t ${fstype}} -o ${rwopt}${rootflags:+,${rootflags}} "${root}" /usb
mount /usb/arch/rootfs.img "$1" -o loop
Now you can install a bootloader on your stick (syslinux or grub). In the kernel command line, your root-device has to be your flash drive (perhaps with UUID http://wiki.archlinux.org/index.php/UUID#by-uuid).
Please make sure you don't update accidentally initscripts - this will undo your changes.
Run "mkinitcpio -p kernel26" in the end to create the image and copy the image (maybe /boot/kernel26.img) to a location on your flash drive where your bootloader can find it.
There should really be some better methods, but this was the only one I found.
Offline
You're advice has got me on the right track, jurkan. I am able to boot from the loopback device now. However, the root is getting mounted read-only and I'm not sure why. I specified rw in the mount options for the root FS image in default_mount_handler() and inside the root FS's /etc/fstab. (BTW, how exactly is the root's entry in /etc/fstab supposed to look? I used /dev/loop0 as the device, but am not sure if that was right.)
EDIT: Scratch that - it works now! Silly Arch decided to put ro as the default option in GRUB's menu.lst. All is working beautifully now!
Last edited by nonoitall (2010-04-20 22:32:29)
Offline
Perhaps you should use "/usb/arch/rootfs.img" as device and "loop" as mount option in fstab, but I'm not sure though. The only one I know is that it also works without that entry ;-)
Offline
Pages: 1