add documentation and infrastructure for booting with MultiROM

This commit is contained in:
William Castro 2014-05-12 13:42:06 -07:00
parent 1d176175ab
commit 677742a30e
3 changed files with 103 additions and 5 deletions

View file

@ -33,6 +33,29 @@ first.
6: Profit
## Booting with MultiROM
You will need to follow the guide at http://forum.xda-developers.com/showthread.php?t=2457063 first.
1: The initcpio hooks have been modified to support this, so if you were using the old ones, you have to replace them with the new. You currently can't boot the same installation via both fastboot and MultiROM.
2: Boot the Nexus into Android recovery mode. Make sure /data is mounted. /data/media/0/multirom cannot be seen from normal Android.
3: Create a ROM folder for ArchLinuxARM.
adb shell mkdir /data/media/0/multirom/roms/ArchLinuxARM
4: Push the included rom_info.txt file. (it's a plaintext config file documented at https://github.com/Tasssadar/multirom/wiki/Add-support-for-new-ROM-type)
adb push rom_info.txt /data/media/0/multirom/roms/ArchLinuxARM/
5: Move your root image to /data/media/0/multirom/roms/ArchLinuxARM/root.img
6: Make sure you have the kernel and ramdisk in /data/media/0/multirom/roms/ArchLinuxARM/boot/vmlinuz and /data/media/0/multirom/roms/ArchLinuxARM/boot/initrd.img.
6a: Mount the image, and copy them (with the same name) to /boot/ in it.
## To get WiFi Working
A normal Nexus 7 Flo boot will call /system/bin/conn_init which does a whole

View file

@ -1,13 +1,43 @@
#!/usr/bin/ash
# You can set these variables manually inside their respective functions if
# you do not wish to boot using MultiROM:
#
# To boot using a loop-mounted image stored in /data as the root FS:
# loop=/path/to/arch.img
# loopfstype=ext4
#
# To boot using a bind-mounted subdirectory of /data as the root FS:
# rootsubdir=/local/arch
#
# loop= and rootsubdir= are relative to /data on Android, not /.
run_hook () {
mount_handler="img_mount_handler"
if [ -z "$rootsubdir" ]; then
if [ -z "$loop" ]; then
error "no loop= or rootsubdir= provided on cmdline"
return 1
else
msg "root is an image at: $loop"
mount_handler="img_mount_handler"
fi
else
msg "root is a subdirectory at: $rootsubdir"
mount_handler="dir_mount_handler"
fi
}
img_mount_handler() {
mkdir /data
mount -t ext4 /dev/mmcblk0p30 /data
mkdir /host
mount -t $rootfstype $root /host
mknod /dev/loop256 b 7 256
losetup /dev/loop256 /data/arch.img
mount -t ext4 -o rw,noatime /dev/loop256 /new_root
losetup /dev/loop256 /host/$loop
mount -t $loopfstype -o rw,noatime /dev/loop256 /new_root
}
dir_mount_handler() {
mkdir /host
mount -t $rootfstype $root /host
mount --bind /host/$rootsubdir /new_root
}

45
rom_info.txt Normal file
View file

@ -0,0 +1,45 @@
# This file contains info about ROMs capabilites and boot process.
# It should be placed in ROM's folder (eg. /media/multirom/roms/*rom_name*)
# and must be named "rom_info.txt".
# Make sure you got the syntax correct, as the parser is probably pretty
# dumb. Lines with comments must start with #. Beware the whitespaces.
# If you need to use " character in string, just use it, no need to escape it
# MultiROM searches for first and last " on the line.
# These comments should not be deleted.
# So far, the only supported ROM type for these files is kexec-based linux
type="kexec"
# Paths to root of the ROM.
# Both image and folder can be specified at one time, MultiROM will use
# the one which it can find. If both are present, folder is used.
# Must _not_ contain spaces.
# Path is from root of the root partition, but you will usually want
# to use following alias:
# - %m - ROM's folder (eg. /media/multirom/roms/*rom_name*)
root_dir="%m/root"
root_img="%m/root.img"
root_img_fs="ext4"
# Path to kernel and initrd. Kernel path _must_ be specified.
# Paths are relative to the folder in which is this file
# Those can be outside the root folder/image, or use %r if it is in there:
# kernel_path="%r/boot/vmlinuz"
# If ROM is in images, it will mount the image and load it from there.
# You can use * _at the end of the filename_ as wildcard character.
kernel_path="%r/boot/vmlinuz"
initrd_path="%r/boot/initrd.img"
# Set up the cmdline
# img_cmdline and dir_cmdline are appended to base_cmdline.
# Several aliases are used:
# - %b - base command line from bootloader. You want this as first thing in cmdline.
# - %d - root device. is either "UUID=..." (USB drive) or "/dev/mmcblk0p9" or "/dev/mmcblk0p10"
# - %r - root fs type
# - %s - root directory, from root of the root device
# - %i - root image, from root of the root device
# - %f - fs of the root image
base_cmdline="%b root=%d rootfstype=%r rw console=tty0 rootflags=defaults,noatime,nodiratime"
img_cmdline="loop=%i loopfstype=%f"
dir_cmdline="rootsubdir=%s"