New MultiROM installer ROM format
This commit is contained in:
		
							
								
								
									
										41
									
								
								installer/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								installer/README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,41 @@
 | 
			
		||||
# MultiROM reference installer
 | 
			
		||||
This is a reference installer file structure.
 | 
			
		||||
It should be used only for Linux
 | 
			
		||||
based ROMs, where classic update.zip format is unsuitable.
 | 
			
		||||
 | 
			
		||||
## Installation file
 | 
			
		||||
The installation file itself is a ZIP archive, renamed to `*.mrom` so that
 | 
			
		||||
recovery can know what is just ZIP archive and what is MultiROM
 | 
			
		||||
installer
 | 
			
		||||
file.
 | 
			
		||||
I recommend not to use compression when making this ZIP, the installation
 | 
			
		||||
will be faster and the ROM is already compressed in .tar.gz files.
 | 
			
		||||
 | 
			
		||||
### Content
 | 
			
		||||
* **manifest.txt** - File with info for the recovery. Read the comments in that
 | 
			
		||||
                     file to know more.
 | 
			
		||||
 | 
			
		||||
* **rom** - Folder with tar.gz archives containing each of the ROM base folders
 | 
			
		||||
            (e.g. `root.tar.gz`, `system.tar.gz`, ...). These can be split to
 | 
			
		||||
            multiple files (and should be, if the file is bigger than ~800 MB).
 | 
			
		||||
            Pattern is name_XX.tar.gz, so for example `root_00.tar.gz` and
 | 
			
		||||
            `root_01.tar.gz`. Numbering __must__ start at 00!
 | 
			
		||||
            Command `tar --numeric-owner --overwrite -xf` is used to extract
 | 
			
		||||
            these tar files.
 | 
			
		||||
 | 
			
		||||
* **root_dir** - Content of this folder will be copied to root of the ROM
 | 
			
		||||
                 folder - `/sdcard/multirom/roms/*rom_name*`. It can contain
 | 
			
		||||
                 `rom_info.txt` if it's Linux ROM or the `boot` folder and/or
 | 
			
		||||
                 `boot.img` if it's Android-based ROM.
 | 
			
		||||
 | 
			
		||||
* **pre_install, post_install** - Sh scripts in these folders will be ran
 | 
			
		||||
                before/after the installation. They must return success return
 | 
			
		||||
                code else the installation is aborted. Path to root
 | 
			
		||||
                folder/folder where images are mounted is
 | 
			
		||||
                passed as argument to this script, script can then cd to one of
 | 
			
		||||
                the base folders and do whatever it wants to. Scripts are ran
 | 
			
		||||
                in alphabetical order (use numbers, `01_script.sh`, `02_script.sh`).
 | 
			
		||||
                **All** files from both directories are extracted to `/tmp/script/`,
 | 
			
		||||
                which means you can put e.g. binary blobs in there and copy them
 | 
			
		||||
                to proper place in the sh scripts or pack some binaries needed
 | 
			
		||||
                by the scripts (e.g. gnutar, remember to set chmod before running them).
 | 
			
		||||
							
								
								
									
										57
									
								
								installer/manifest.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								installer/manifest.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,57 @@
 | 
			
		||||
# This file contains info for recovery installation process
 | 
			
		||||
# Should be placed in root of installation zip file and must be
 | 
			
		||||
# named "manifest.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.
 | 
			
		||||
 | 
			
		||||
# Manifest version
 | 
			
		||||
manifest_ver="1"
 | 
			
		||||
 | 
			
		||||
# Min MultiROM version
 | 
			
		||||
min_mrom_ver="5"
 | 
			
		||||
 | 
			
		||||
# Supported devices codenames. These are checked against
 | 
			
		||||
# ro.product.device property
 | 
			
		||||
devices="grouper tilapia"
 | 
			
		||||
 | 
			
		||||
# ROM name. If not specified, name of the installation file is used,
 | 
			
		||||
# which is recommmended. Don't use spaces.
 | 
			
		||||
#rom_name="Generic_ROM"
 | 
			
		||||
 | 
			
		||||
# Installation text, it is displayed in recovery during installation.
 | 
			
		||||
# Use \n to make newlines
 | 
			
		||||
install_text="Generic ROM 1.2.3.4\nWelcome to Generic ROM!\n\n This installation process may take a while"
 | 
			
		||||
 | 
			
		||||
# Available install locations, "1" means it can be installed to that location
 | 
			
		||||
# You usually want all of these
 | 
			
		||||
# loc_internal - Internal memory
 | 
			
		||||
# loc_usb_dir - USB drive with extX filesystem
 | 
			
		||||
# loc_usb_img - USB drive with FAT32/NTFS filesystem, so ext4 images are used
 | 
			
		||||
loc_internal="1"
 | 
			
		||||
loc_usb_dir="1"
 | 
			
		||||
loc_usb_img="1"
 | 
			
		||||
 | 
			
		||||
# ROM base folders - the ones in root of ROM folder.
 | 
			
		||||
# There can only be maximum of 5 base folders!
 | 
			
		||||
# If USB drive w/ FAT32/NTFS image is used, each of these is separate image.
 | 
			
		||||
# If this is a Linux ROM, you usually want just "root". If it is Android-based,
 | 
			
		||||
# you probably want "cache", "system" and "data"
 | 
			
		||||
# Example: base_folders="data system cache"
 | 
			
		||||
base_folders="root"
 | 
			
		||||
 | 
			
		||||
# Image sizes for FAT32/NTFS USB drives. Sizes are in MB.
 | 
			
		||||
# Can be ommited if ROM does not support images. Max size for FAT32 is 4096.
 | 
			
		||||
# Syntax: base_folder_name:MIN:DEFAULT another_base_folder_name:MIN:DEFAULT ...
 | 
			
		||||
# Example: img_sizes="root:1000:1500"
 | 
			
		||||
#          img_sizes="data:50:1024 system:450:640 cache:50:450"
 | 
			
		||||
img_sizes="root:1000:1500"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										0
									
								
								installer/post_install/.placeforscripts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								installer/post_install/.placeforscripts
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								installer/pre_install/.placeforscripts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								installer/pre_install/.placeforscripts
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										
											BIN
										
									
								
								installer/rom/root.tar.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								installer/rom/root.tar.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -1,5 +1,6 @@
 | 
			
		||||
# This file contains info about ROMs capabilites and boot process.
 | 
			
		||||
# It should be placed in ROM's folder.
 | 
			
		||||
# 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
 | 
			
		||||
@@ -17,8 +18,8 @@ type="kexec"
 | 
			
		||||
# to use following alias:
 | 
			
		||||
# - %m - ROM's folder (eg. /media/multirom/roms/*rom_name*)
 | 
			
		||||
root_dir="%m/root"
 | 
			
		||||
root_img=""
 | 
			
		||||
root_img_fs=""
 | 
			
		||||
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
 | 
			
		||||
@@ -26,8 +27,8 @@ root_img_fs=""
 | 
			
		||||
# 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/zImage"
 | 
			
		||||
initrd_path="%r/boot/initrd.img-ubuntu"
 | 
			
		||||
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.
 | 
			
		||||
@@ -38,6 +39,6 @@ initrd_path="%r/boot/initrd.img-ubuntu"
 | 
			
		||||
#  - %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 fbcon=rotate:1 access=m2 splash rootflags=defaults,noatime,nodiratime quiet"
 | 
			
		||||
base_cmdline="%b root=%d rootfstype=%r rw console=tty0 access=m2 quiet splash rootflags=defaults,noatime,nodiratime"
 | 
			
		||||
img_cmdline="loop=%i loopfstype=%f"
 | 
			
		||||
dir_cmdline="rootsubdir=%s"
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -1,38 +0,0 @@
 | 
			
		||||
assert(getprop("ro.product.device") == "grouper" || getprop("ro.build.product") == "grouper" ||
 | 
			
		||||
       getprop("ro.product.device") == "tilapia" || getprop("ro.build.product") == "tilapia");
 | 
			
		||||
 | 
			
		||||
ui_print("Plasma active testing zip");
 | 
			
		||||
show_progress(1.00000, 10);
 | 
			
		||||
 | 
			
		||||
ui_print("Extracting scripts...");
 | 
			
		||||
run_program("/sbin/busybox", "mount", "/data");
 | 
			
		||||
 | 
			
		||||
package_extract_dir("scripts", "/tmp/");
 | 
			
		||||
 | 
			
		||||
set_perm(0, 0, 0777, "/tmp/extract.sh");
 | 
			
		||||
set_perm(0, 0, 0777, "/tmp/check.sh");
 | 
			
		||||
set_perm(0, 0, 0777, "/tmp/gnutar");
 | 
			
		||||
 | 
			
		||||
ui_print("Checking MultiROM version...");
 | 
			
		||||
ifelse(run_program("/tmp/check.sh") != 0,
 | 
			
		||||
(
 | 
			
		||||
    ui_print("** Your MultiROM version too low for this ZIP file");
 | 
			
		||||
    ui_print("** or unable to find MultiROM binary.");
 | 
			
		||||
    abort();
 | 
			
		||||
),"");
 | 
			
		||||
 | 
			
		||||
ui_print("Exracting archive to tmp...");
 | 
			
		||||
package_extract_dir("rom", "/tmp/rom/");
 | 
			
		||||
 | 
			
		||||
ui_print("Extracting archive to ROM folder (will take a while)...");
 | 
			
		||||
ifelse(run_program("/tmp/extract.sh") != 0,
 | 
			
		||||
(
 | 
			
		||||
    ui_print("** Failed to exract archive. Probably not enough space in /data");
 | 
			
		||||
    abort();
 | 
			
		||||
),"");
 | 
			
		||||
 | 
			
		||||
delete("/tmp/extract.sh");
 | 
			
		||||
delete("/tmp/check.sh");
 | 
			
		||||
delete("/tmp/gnutar");
 | 
			
		||||
delete_recursive("/tmp/rom");
 | 
			
		||||
ui_print("Installation complete!");
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							@@ -1,28 +0,0 @@
 | 
			
		||||
#!/sbin/sh
 | 
			
		||||
MIN_VER="5"
 | 
			
		||||
 | 
			
		||||
path=""
 | 
			
		||||
if [ -e "/data/media/multirom/multirom" ] ; then
 | 
			
		||||
    path="/data/media/multirom/multirom"
 | 
			
		||||
elif [ -e "/data/media/0/multirom/multirom" ] ; then
 | 
			
		||||
    path="/data/media/0/multirom/multirom"
 | 
			
		||||
else
 | 
			
		||||
    echo "Failed to find multirom binary!" 1>&2
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
echo "Checking MultiROM version..."
 | 
			
		||||
 | 
			
		||||
res=$($path -v)
 | 
			
		||||
if [ "$?" -ne "0" ] ; then 
 | 
			
		||||
    echo "Failed to execute MultiROM binary!" 1>&2
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
echo "Got version $res"
 | 
			
		||||
 | 
			
		||||
if [ "$res" -lt "$MIN_VER" ] ; then
 | 
			
		||||
    echo "Your MultiROM version ($res) is too low, version $MIN_VER is required!" 1>&2
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
@@ -1,20 +0,0 @@
 | 
			
		||||
#!/sbin/sh
 | 
			
		||||
ROM_NAME="reference"
 | 
			
		||||
 | 
			
		||||
path=""
 | 
			
		||||
if [ -d "/data/media/multirom/roms" ] ; then
 | 
			
		||||
    path="/data/media/multirom/roms/$ROM_NAME"
 | 
			
		||||
elif [ -d "/data/media/0/multirom/roms" ] ; then
 | 
			
		||||
    path="/data/media/0/multirom/roms/$ROM_NAME"
 | 
			
		||||
else
 | 
			
		||||
    echo "Failed to find multirom folder!"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
mkdir "$path"
 | 
			
		||||
mkdir "$path/root"
 | 
			
		||||
cp /tmp/rom/rom_info.txt "$path/rom_info.txt"
 | 
			
		||||
 | 
			
		||||
echo "Extracting tar..."
 | 
			
		||||
/tmp/gnutar --numeric-owner -C "$path/root" -xf /tmp/rom/root.tar.gz
 | 
			
		||||
exit $?
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user