[TESTING NEEDED][MODS]3.0.x - initrd.gz made on the fly. f2fs/ext4 MULTIBOOT

Search This thread

HypoTurtle

Senior Member
May 5, 2011
1,991
1,277
Was working with RobbieP on this (as I can't test on device) - essentially aroma config for 3.0.x kernel with initrd.gz made on the fly.
Initrd mods carried out include applying: data on ext, nativesd, directsd(w/ ext4 or f2fs) to nand initrd.gz.

Decided to come at this from a different direction (after managing to botch together a device to test on) - as I can't get the aroma prop files to play nice.
So lets start with the minor modifications needed by in the ROM

Updater script modifications (based on SlimKat - but should be universal'ish'):
Code:
...
...
...
###############
# Cleaning up #
###############

set_progress(0.95);
delete_recursive("/tmp/*");
if file_getprop("/tmp/aroma/mods.prop", "selected.4") == "2" then 
  ui_print("@  Cleaning up...");
  ui_print("  Unmounting...");
  unmount("/boot");
  unmount("/boot_dir");
  unmount("/system");
  unmount("/data");
  unmount("/DirectSD");
  unmount("/DirectSystem");
  unmount("/NativeSD");
  ui_print("  Done."); 
else
  package_extract_file("kernel/initrd.gz[COLOR="red"](NAND initrd)[/COLOR]", "/boot_dir/initrd.gz");
  package_extract_file("kernel/zImage", "/boot_dir/zImage");
endif;
set_progress(1.0);
ui_print("@  Installation Complete");
Edit. Going to need: delete_recursive("/tmp/*"); outside of the if;endif;
And also /boot_dir won't be made if using NAND/DataOnExt; will need to rework this and #2 to extract to /tmp after it's wiped.
And change every reference to an initrd.gz other than the NAND one to the NAND one (just to avoid confusion)
Which obviously requires an additional group in mods in aroma-config:
Code:
...
...
...
 #-- Group 3
    "Wipe","",2,
      "Wipe Dalvik-Cache",
        "Select it to wipe Dalvik-Cache.",        	1,
      "Wipe Data/Factory Reset",
        "Select it to wipe data/factory reset.",  	0,
      "No Wipe",
        "Select it to keep everything.",          	0,

		
 #-- Group 4
    "Installing a second zip","",2,
      "Installing a second zip",
        "Select it if you are installing a second zip - NativeSD/DirectSD or gapps for example",        	1,
      "Not installing a second zip",
        "Select it if installing to NAND only",  	0
			
);
...
...
Additionally the set_build_prop_*.sh's should be replaced (or redirected in updater script) by the following:
Set_Build_Prop.sh
Code:
#!/sbin/sh
# Append " [$install_type] and [$ROM_NAME]" to the ROM name for HD2
# Modify /system/build.prop and append "[] hooks" to the end of the line of ro.build.display.id
# Created by hypoturtle
ROM_NAME=`cat '/tmp/aroma/ROM_NAME.prop' | sed 's/ROM_NAME=//g'`
install_type=` cat '/tmp/aroma/installtype.prop' | sed 's/selected.1=//g' `
type=(NAND DataOnExt NativeSD DirectSD)
install=${type[$install_type-1]}
output=`grep -i "^ro\.build\.display\.id.*\[${install}\]$" /system/build.prop`
if [ -z "$output" ]; then
  sed -i '/ro\.build\.display\.id/s/$/ \['${ROM_NAME}'] ['${install}'\]/' /system/build.prop
fi

And modify DirectSD_mounter.sh so that if it doesn't mount p3 as ext4 it tries with f2fs
Code:
#!/sbin/sh
#
# DirectSD SD-EXT Mounter v1.0
# Author: tytung - xda-developers

if [ ! -d "/DirectSystem" ]; then
	mkdir "/DirectSystem"
fi

if [ ! -d "/DirectData" ]; then
	mkdir "/DirectData"
fi

if [ -f "/tmp/mount.prop" ]; then
	rm "/tmp/mount.prop"
fi

# Mount the SD-EXT partition
mounted=`mount | grep '/dev/block/mmcblk0p2 on /DirectSystem'`
if [ "$mounted" = "" ]; then
	 mount -t ext4 /dev/block/mmcblk0p2 /DirectSystem
fi

# Mount the SD-EXT partition
mounted=`mount | grep '/dev/block/mmcblk0p3 on /DirectData'`
if [ "$mounted" = "" ]; then
	 mount -t ext4 /dev/block/mmcblk0p3 /DirectData
fi

# Mount F2FS partition
mounted=`mount | grep '/dev/block/mmcblk0p3 on /DirectData'`
   if [ "$mounted" = "" ]; then
	 mount -t f2fs /dev/block/mmcblk0p3 /DirectData
   fi

mounted=`mount | grep '/dev/block/mmcblk0p3 on /DirectData'`
# `echo $?` will return 0 if mount is executed successfully
if [ `echo $?` = 0 ]; then
	echo 'status=mounted' > "/tmp/mount.prop"
#else
	# redirect mount failed messages to aroma-config
fi
And that's it on this side. Now read #2

legacy:

Managed to fix the nativesd.sh - it was riddled with errors:
Code:
#!/sbin/sh

export ROM_NAME=` cat 'ROM_NAME.prop' | sed 's/ROM_NAME=//g' `
export install_type=` cat 'installtype.prop' | sed 's/selected.1=//g' `
export bootloader=` cat 'nfo.prop' | sed 's/bootloader=//g' `

cd /tmp/aroma
mkdir /tmp/aroma/work
cp initrd.gz initrd-test.gz
cd /tmp/aroma/work

# unzipping nand kernel and applying modifications
gzip -d -c ../initrd-test.gz | cpio -i -d
mkdir bin
cd ..
cp busybox work/bin/busybox
cp e2fsck work/bin/e2fsck
chmod 0777 work/bin/busybox
chmod 0777 work/bin/e2fsck

if [ "${install_type}" -gt 2 ]; then
		sed -i '/[email protected]/s/^/#/' work/ueventd.htcleo.rc
		sed -i '/mount yaffs2/s/^/#/
		s/#    #/# /g' work/init.rc
		sed -i 's/auto/ext4/g' work/mountfs${install_type}.sh
		
fi
if [ "${install_type}" -gt 1 ]; then
	sed -i '/on fs/ a exec /mountfs'${install_type}'.sh' work2/init.rc
	cp mountfs${install_type}.sh work/mountfs${install_type}.sh
        sed -i "s/rOm/$ROM_NAME/g" work/mountfs${install_type}.sh
	chmod 0777 work/mountfs${install_type}.sh
	chmod 0750 work/init.rc
	chmod 0644 work/ueventd.htcleo.rc
fi
# making new ramdisk and copying to sd card
cd work2
find .| cpio -o -H newc | gzip -9 > ../initrd-done.gz
cd ..

if [ "${bootloader}" != "cLK" ]; then
	cat initrd-done.gz >> 6MB
	cp 6MB initrd6MB.gz
else
	cp done2/initrd-done.gz /tmp/initrd.gz
fi

chmod 0777 initrd.gz
if [ "${install_type}" -lt 3 ]; then
	cp initrd6MB.gz tmp/initrd.gz
else
	cp initrd6MB.gz boot/initrd.gz
	cp initrd6MB.gz boot_dir/initrd.gz
fi


# Copying tmp and open ramdisk folders to sdcard (NativeSD folder)

mkdir -p boot/tmp

Also this way if you want to add another way of booting all you need to do is create a mountfs.sh file and edit aroma-config.

aroma-config
Code:
### LICENSE:
#
# Copyright (C) 2011-2012 Ahmad Amarullah ( http://amarullz.com/ )
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
### FILE INFO:
#
# AROMA Installer from NexusHD2 tytung was modded by
# macs18max to include haret detection (hacked way) and 
# clk nativesd sboot2. If using this please credit macs18max
#
###


##
# Forcing Device Pixelate Size
#  defaut: floor( min( width, height ) / 160 )
#
ini_set("dp","3"); #-- HDPI ( 480x800 / WVGA )


##
# Initializing Rom Information
##
ini_set("rom_name",             "ChauTien Slimroms 4.4.2");
ini_set("rom_version",          "Build 4");
ini_set("rom_author",           "Chau Truong Thinh");
ini_set("rom_device",           "HTC HD2");
ini_set("rom_date",             "APR. 01, 2014");


##
# Show Simple Splash
# splash( 	2000,	"slim");


##
# Set Small Font to Support all fonts
#
fontresload( "0", "ttf/Roboto-Regular.ttf;ttf/DroidSansArabic.ttf;ttf/DroidSansFallback.ttf;", "12" ); #-- Use sets of font (Font Family)


##
# Set Language & Font Family
#
loadlang("langs/en.lang");
fontresload( "0", "ttf/Roboto-Regular.ttf", "12" ); #-- "0" = Small Font
fontresload( "1", "ttf/Roboto-Regular.ttf", "18" ); #-- "1" = Big Font


###################################################################################################################
#
# STEP 1 - SELECT THEME
#
theme("ics");


###################################################################################################################
#
# STEP 2 - SHOW ROM INFORMATION
#

# Extract ROM_NAME.prop to /tmp/aroma/ROM_NAME.prop
ziptotmp("kernel/ROM_NAME.prop", "ROM_NAME.prop");
ziptotmp("kernel/initrd.gz", "initrd.gz");
ziptotmp("kernel/busybox", "busybox");
ziptotmp("kernel/e2fsck", "e2fsck");
ziptotmp("kernel/zImage", "zImage");
ziptotmp("kernel/mkbootimg", "mkbootimg");
ziptotmp("kernel/mkbootimg.sh", "mkbootimg.sh");
ziptotmp("kernel/mountfs2.sh", "mountfs2.sh");
ziptotmp("kernel/mountfs3.sh", "mountfs3.sh");
ziptotmp("kernel/mountfs4.sh", "mountfs4.sh");
ziptotmp("kernel/mountfs5.sh", "mountfs5.sh");
ziptotmp("kernel/6MB", "6MB");
zipexec("kernel/checksys.sh");
setvar("bootloader", file_getprop("/tmp/nfo.prop", "bootloader"));

viewbox(
  #-- Title
    "Welcome!",

  #-- Text
    "You are about to install the below ROM for <b>"+ini_get("rom_device")+"</b>.\n\n"+

    "  ROM Name\t: <b><#selectbg_g>"+ini_get("rom_name")+"</#></b>\n"+
    "  Version\t: <b><#selectbg_g>"+ini_get("rom_version")+"</#></b>\n"+
    "  Author\t: <b><#selectbg_g>"+ini_get("rom_author")+"</#></b>\n"+
    "  Update\t: <b><#selectbg_g>"+ini_get("rom_date")+"</#></b>\n\n\n"+

    "Bootloader\t: "+getvar("bootloader")+"\n\n"+

    "System NAND\t: "+getdisksize("/system","m")+" MB\n"+
    "\t Free\t: "+    getdiskfree("/system","m")+" MB\n\n"+

    "Data   NAND\t: "+getdisksize("/data","m")+" MB\n"+
    "\t Free\t: "+    getdiskfree("/data","m")+" MB\n\n"+

    "SD Card Size\t: "+getdisksize("/sdcard","m")+" MB\n"+
    "\t Free\t: "+     getdiskfree("/sdcard","m")+" MB\n\n"+

    " SD-EXT Size\t: "+getdisksize("/sd-ext","m")+" MB\n"+
    "\t Free\t: "+     getdiskfree("/sd-ext","m")+" MB\n\n"+
	
	"SD-EXT2 Size\t: "+getdisksize("/sd-ext2","m")+" MB\n"+
    "\t Free\t: "+     getdiskfree("/sd-ext2","m")+" MB\n\n\n"+

    "Press Next to Continue the Installation...",

  #-- Icon
    "icons/welcome"
);


###################################################################################################################
#
# STEP 3 - SHOW SELECTBOX - Install Type
#
selectbox(
  #-- Title
    "Install Type",

  #-- Sub Title
    "Please Select the install type:",

  #-- Icon
    "icons/apps",

  #-- Will be saved in /tmp/aroma/installtype.prop
    "installtype.prop",
 
  #-- Group 1
    "Install Location", "", 2,                                                    #-- Group 1. key = "selected.1"

    "NAND",
      "[email protected], [email protected], [email protected]\nFor T-Mobile USA HD2 (LEO 1024)",    0, #-- selected.1 = 1

    "NAND with DataOnEXT",
      "[email protected], [email protected], [email protected]\nFor EU/International HD2 (LEO 512)", 0, #-- selected.1 = 2

    "NativeSD (Everything on the SD card)",
      "[email protected], [email protected], [email protected]\nFor high speed read/write SD Card", 0,  #-- selected.1 = 3
	  
	"DirectSD (Everything on the SD card)",
      "[email protected], [email protected], [email protected]\nFor high speed read/write SD Card", 1,  #-- selected.1 = 4
	"DirectSD (Everything on the SD card)",
      "[email protected], [email protected], [email protected]\nFor high speed read/write SD Card", 0  #-- selected.1 = 5
);

if (prop("installtype.prop", "selected.1") == "1" || 
    prop("installtype.prop", "selected.1") == "2") then
  writetmpfile("kernel.prop", "NAND=yes");
  zipexec("kernel/nativesd.sh");
else
  writetmpfile("kernel.prop", "NAND=no");
endif;

##############################
# Mount the SD-EXT partition #
##############################

if (prop("installtype.prop", "selected.1") == "2" ||
    prop("installtype.prop", "selected.1") == "3") then

  pleasewait("Mounting the SD-EXT Partition...");
  zipexec("kernel/SD-EXT_mounter.sh");
  setvar("mount_result", getvar("exec_buffer"));
  zipexec("kernel/nativesd.sh");

  if file_getprop("/tmp/mount.prop", "status") != "mounted" then

    #######################
    # No SD-EXT Partition #
    #######################

    # Set Next Text to 'Exit'
    ini_set("text_next", "Exit");

    textbox(
      "Mounting SD-EXT failed!",
      "Please create an EXT4 partition (mmcblk0p2) on the SD Card first.",
      "icons/alert",
      "Error messages:\n\n"+getvar("mount_result")
    );

    #-- Back to Menu
    back("1");

  endif;

endif;

if (prop("installtype.prop", "selected.1") == "4" ||
    prop("installtype.prop", "selected.1") == "5") then

  pleasewait("Mounting the SD-EXT Partition...");
  zipexec("kernel/DirectSD_mounter.sh");
  setvar("mount_result", getvar("exec_buffer"));
  zipexec("kernel/nativesd.sh");

  if file_getprop("/tmp/mount.prop", "status") != "mounted" then

    #######################
    # No SD-EXT Partition #
    #######################

    # Set Next Text to 'Exit'
    ini_set("text_next", "Exit");

    textbox(
      "Mounting SD-EXT failed!",
      "Please create an EXT4 partition (mmcblk0p2) on the SD Card first.",
      "icons/alert",
      "Error messages:\n\n"+getvar("mount_result")
    );

    #-- Back to Menu
    back("1");

  endif;

endif;

# Swap partition activation - run the check for sdcard swap partition
pleasewait("Checking SDCard for Swap Partition.");
zipexec("mods/swap-partition-activator/install/checkforswap.sh");
###################################################################################################################
#
# STEP 4 - SHOW SELECTBOX - ROM Mods
#
selectbox(
  #-- Title
    "ROM Mods",
  
  #-- Sub Title
    "Please Select the ROM Mods:",
  
  #-- Icon
    "icons/personalize",
  
  #-- Will be saved in /tmp/aroma/mods.prop
    "mods.prop",
 
  #-- Group 1
    "Default Connection Type","",2,
      "RMNET Connection",
        "Please Choose RMNET for MAGLDR bootloader.",	iif((file_getprop("/tmp/nfo.prop", "bootloader") == "MAGLDR"), 1, 0),
      "PPP Connection",
        "All bootloaders support PPP.",           	iif((file_getprop("/tmp/nfo.prop", "bootloader") == "MAGLDR"), 0, 1),

		
  # Group 2
  "Activate RAM Pages Swapping","",2,
    "Yes",
    "You must have a pre-made swap partition on your SDcard!",  iif((file_getprop("/tmp/checkforswap.prop", "swap.present") == "yes"), 1, 0),
    "No",
    "Swapping will be deactivated.\n\n", iif((file_getprop("/tmp/checkforswap.prop", "swap.present") == "no"), 1, 0),
 
 
 #-- Group 3
    "Wipe","",2,
      "Wipe Dalvik-Cache",
        "Select it to wipe Dalvik-Cache.",        	1,
      "Wipe Data/Factory Reset",
        "Select it to wipe data/factory reset.",  	0,
      "No Wipe",
        "Select it to keep everything.",          	0

);

####################
# Installation Ready
####################
ini_set("text_next", "Install Now");
viewbox(
	"Installation Ready",
	"The wizard is ready to begin installation.\n\n"+
	"Press <b>Install Now</b> to begin the installation.\n\n"+
	"If you want to review or change any of your installation settings, press <b>Back</b> or Press Menu Key -> Quit Installation to exit the wizard.",
	"@install"
);


#####################
# Start Install
#####################
ini_set("text_next", "Finish");
install(
	"Installing",
	"<b>"+ini_get("rom_name")+"</b> is being installed.\n\n"+
	"Please wait while installation wizard installs <b>"+ini_get("rom_name")+
	"</b>. This may take several minutes.",
	"@install",
	"The installation wizard has successfully installed <b>"+ini_get("rom_name")
);


# Set Next Text fo Exit
ini_set("text_next", "Exit");

viewbox(
  "Installation Completed",
  "<#080>Congratulation</#>\n\n"+
  "Please press Exit and Reboot your HD2",
  "icons/info"
);

Detailed rundown of process.
Aroma config copies all pertinent files to /aroma config.
Choices are made by user in aroma installer, specified mount script is run and nativesd.sh is executed as long as an install type is chosen.
Nativesd.sh reads the install type and bootloader and modifies the nand ramdisk accordingly, mkbootimg.sh is run if using clk.
Updater-script then runs - it has been stripped down so all it should do is the copying of all the other ROM stuff from the zip (system, sdcard, etc.), runs a script to copy initrd and zImage to /boot (if using magldr). Should theoretically be able to strip updater-script down further...

Attached is the modification for SlimKat - (all credits to ROM dev.)
kernel folder fully replaces the one in the ROM zip. META-INF and system are merged.
All essentially untested - will post the recovery needed for f2fs install in due course.

Edit. new zip - moved around a few things.

Edit. modified nativesd.sh on the assumption that the aroma folder can only be written to be aroma.
Code:
#!/bin/sh

export ROM_NAME=` cat 'ROM_NAME.prop' | sed 's/ROM_NAME=//g' `
export install_type=` cat 'installtype.prop' | sed 's/selected.1=//g' `
export bootloader=` cat 'nfo.prop' | sed 's/bootloader=//g' `

cp /tmp/aroma/zImage /tmp/zImage
mkdir -p /tmp/work/ing
cp /tmp/aroma/initrd.gz /tmp/initrd-test.gz
cd /tmp/work/ing
# unzipping nand kernel
gzip -d -c ../initrd-test.gz | cpio -i -d
mkdir bin
cd ..
cp /tmp/aroma/busybox ing/bin/busybox
cp /tmp/aroma/e2fsck ing/bin/e2fsck
chmod 0777 ing/bin/busybox
chmod 0777 ing/bin/e2fsck
# Modifying ramdisk to not use yaffs, and use sd partitions instead.
if [ "${install_type}" -gt 2 ]; then
		sed -i '/[email protected]/s/^/#/' ing/ueventd.htcleo.rc
		sed -i '/mount yaffs2/s/^/#/
		s/#    #/# /g' ing/init.rc
		sed -i "s/rOm/$ROM_NAME/g" ing/mountfs${install_type}.sh
		sed -i 's/auto/ext4/g' ing/mountfs${install_type}.sh
fi
# Checking if anything other than nand is to be installed
if [ "${install_type}" -gt 1 ]; then
	sed -i '/on fs/ a exec /mountfs'${install_type}'.sh' ing/init.rc
	cp /tmp/aroma/mountfs${install_type}.sh ing/mountfs${install_type}.sh
	sed -i "s/rOm/$ROM_NAME/g" ing/mountfs${install_type}.sh
	chmod 0777 ing/mountfs${install_type}.sh
	chmod 0750 ing/init.rc
	chmod 0644 ing/ueventd.htcleo.rc
fi
# Building new ramdisk
cd ing
find .| cpio -o -H newc | gzip -9 > ../initrd-done.gz
cd ..
# Checking bootloader
if [ "${bootloader}" != "cLK" ]; then
	cp /tmp/aroma/6MB /tmp/work/6MB
	cat initrd-done.gz >> 6MB
	cp 6MB initrd6MB.gz
else
	cp initrd-done.gz /tmp/initrd.gz
	cp /tmp/aroma/mkbootimg /tmp/mkbootimg
	cp /tmp/aroma/mkbootimg.sh /tmp/mkbootimg.sh
	chmod 0755 /tmp/mkbootimg
	chmod 0755 /tmp/mkbootimg.sh
	exec /tmp/mkbootimg.sh
fi
#Checking if nand install
if [ "${install_type}" -lt 3 ]; then
	cp initrd6MB.gz tmp/initrd.gz
else
	cp initrd6MB.gz boot/initrd.gz
	cp initrd6MB.gz boot_dir/initrd.gz
	cp /tmp/zImage boot/zImage
	cp /tmp/zImage boot_dir/zImage
fi
# Copying tmp and open ramdisk folders to sdcard (NativeSD folder)
mkdir -p boot/tmp
cp -r /tmp/* /boot/tmp/

Edit - f2fs arm binaries (v.1.2) I build are found here => http://ubuntuone.com/3EuJUW5lV9MMj1WJzhzFYo for those that know what to do with them. New zip added.
 
Last edited:

HypoTurtle

Senior Member
May 5, 2011
1,991
1,277
Attached is a zip that should do all the rest.
It needs to be flashed directly following a ROM with the modifications in #1
It makes us of /system/build.prop and /boot_dir, as well as /boot (and sboot if clk booting Native/DirectSD).

Contents of nativesd.sh if you're curious (was contemplating whether to make this (or a derivative thereof) into a binary and bundle it with a recovery):
Code:
#!/sbin/sh

## Bootloader check (copy of checksys.sh)
echo "bootloader=MAGLDR" > /tmp/nfo.prop

output=`grep -i "clk" /proc/cmdline`
if [ -n "$output" ]; then
	echo "bootloader=cLK" > /tmp/nfo.prop
fi

[COLOR="Red"]###Should remove this haret stuff and treat it as if it's magldr...[/COLOR] 
output=`grep -i "haret" /proc/cmdline`
if [ -n "$output" ]; then
	echo "bootloader=HaRet" > /tmp/nfo.prop
fi

## Exporting variables
ROM_NAME=` cat /system/build.prop | grep ro.build.display.id | awk '{print $(NF-1)}' | sed 's/\(\[\|\]\)//g' `
type=` cat /system/build.prop | grep ro.build.display.id | awk '{print $(NF)}' | sed 's/\(\[\|\]\)//g' `
bootloader=` cat '/tmp/nfo.prop' | sed 's/bootloader=//g' `

## Ending if bootloader is haret
if $bootloader='HaRet' then
echo 'This does not currently work with HaRet (for now)'
exit 0
fi

## Changing install_type to numbered value
if $type='NAND' then
	install_type='1'
fi
if $type='DataOnExt' then
	install_type='2'
fi
if $type='NativeSD' then
	install_type='3'
fi
if $type='DirectSD' then
	install_type='4'
fi

## Copying zImage from /boot_dir if one wasn't added to zip 
if [ ! -f "/tmp/zImage" ]; then        
  cp /boot_dir/zImage/ /tmp/zImage
fi
if [ ! -f "/tmp/zImage" ]; then        
  cp /boot_dir/initrd.gz/ /tmp/initrd.gz
fi

## Checking if zImage is for 3.0.x
if [ "md5sum /tmp/zImage | cut -d ' ' -f '1'" != "1cb7bcf80845f0178b99f7b9a5f80669" ]
then 
rm /tmp/6MB
fi

## Setting up working directory
cp /tmp/initrd.gz /tmp/initrd-$ROM_NAME.gz
mkdir -p /tmp/work
cd /tmp/work

## Unzipping nand kernel
gzip -d -c ../initrd-$ROM_NAME.gz | cpio -i -d
mkdir bin
cp /tmp/busybox bin/busybox
cp /tmp/e2fsck bin/e2fsck
cp /tmp/mountfs-${install}.sh mountfs-${install}.sh
chmod 0777 mountfs${install}.sh
chmod 0777 bin/busybox
chmod 0777 bin/e2fsck

## Modifying ramdisk to not use yaffs, and use sd partitions instead.
if [ "${install_type}" -gt 2 ]; then
		sed -i '/[email protected]/s/^/#/' ueventd.htcleo.rc
		sed -i '/mount yaffs2/s/^/#/
		s/#    #/# /g' init.rc
		sed -i "s/rOm/$ROM_NAME/g" mountfs-${install}.sh
fi

## Checking if anything other than nand is to be installed
if [ "${install_type}" -gt 1 ]; then
	sed -i '/on fs/ a exec /mountfs-'${install}'.sh' init.rc
	sed -i "s/rOm/$ROM_NAME/g" mountfs-${install}.sh
	chmod 0750 init.rc
	chmod 0644 ueventd.htcleo.rc
fi

# Building new ramdisk
find .| cpio -o -H newc | gzip -9 > ../initrd-done.gz
cd ..

# Checking bootloader
if [ "${bootloader}" != "cLK" ]; then
	cat initrd-done.gz >> 6MB
	cp 6MB /boot/initrd.gz
	cp /tmp/zImage /boot/zImage
	#Checking if nand install
		if [ "${install_type}" -gt 2 ]; then
			cp 6MB /boot_dir/initrd.gz
			cp /tmp/zImage /boot_dir/zImage
		fi
else     
	cp initrd-done.gz /tmp/initrd.gz
	chmod 0755 /tmp/mkbootimg
	chmod 0755 /tmp/mkbootimg.sh
        exec /tmp/mkbootimg.sh
		if [ "${install_type}" -lt 3 ]; then
		    flash_image boot /tmp/boot.img else
	            flash_image sboot /tmp/boot.img 
	        fi		
fi

cp /tmp/initrd-$ROM_NAME.gz /tmp/initrd.gz
rm -r /tmp/work/*
There are likely some issues. Feel free to report back.

A few things (more of use for devs I suppose): adding an initrd.gz or zImage into the zip will overwrite the one used by the previously installed ROM.

Also the only way I could come up for checking if the kernel is 3.0.x or not (and thus need the 6MB magldr offset) is using md5sum, obviously this means that this md5sum check will need to be changed for every kernel (I suppose unless there's isn't any other option I could make a whitelisted md5sum file for 3.0.x kernels and/or have devs post md5sums with there kernels).

As it is the zip attached should work with all 2.x kernels and the kernel with md5sum of 1cb7bcf80845f0178b99f7b9a5f80669.

(NB. Device died again before testing - could anyone post/PM the outcome of md5sum for any file i.e. 'md5sum /system/build.prop' - as I'm not sure if just the md5sum is outputted of if the filename is as well.)

For the moment this should work as is with cLK/magldr for DirectSD and NativeSD (need to fix for NAND/DataOnExt).
If you want use NAND/DataOnExt then add the NAND initrd.gz from desired ROM into the install folder of the zip.
NB NAND install on magldr will need a boot partion of 7.5MB (8 to be safe) - when the script is fixed that is.


Legacy
Updater-script
Code:
###
#
# AROMA Installer
#   (C) 2011-2012 by Ahmad Amarullah
#       amarullz - xda-developers
#
###
#
# AROMA Installer Script for 
#   (C) 2012-2013 by tytung - xda-developers (tytung @ gmail.com)
#     
###

ui_print("------------------------------------------------");
ui_print("                                              ");
ui_print("                                              ");
ui_print("------------------------------------------------");

################
# NAND Install #
################

if file_getprop("/tmp/aroma/installtype.prop", "selected.1") == "1" then

  ui_print("@  Installing to NAND...");
  ui_print("  Mounting NAND partitions...");

  
  format("yaffs2", "MTD", "system");

  mount("yaffs2", "MTD", "system", "/system");
  mount("yaffs2", "MTD", "userdata", "/data");

  # Wipe Dalvik-Cache
  if file_getprop("/tmp/aroma/mods.prop", "selected.4") == "1" then
    delete_recursive("/data/dalvik-cache");
    ui_print("  Dalvik-Cache wiped.");
  endif;

  # Wipe Data/Factory Reset
  if file_getprop("/tmp/aroma/mods.prop", "selected.4") == "2" then
    unmount("/data");
    format("yaffs2", "MTD", "userdata");
    mount("yaffs2", "MTD", "userdata", "/data");
    delete_recursive("/sdcard/.android_secure");
    ui_print("  Data wiped.");
  endif;

  show_progress(0.9, 1400);
  ui_print("  Copying files...");
  package_extract_dir("system", "/system");
  package_extract_dir("data", "/data");
  package_extract_dir("mods/nand", "/sdcard");
  show_progress(0.1, 5);

endif;

#####################
# DataOnEXT Install #
#####################

if file_getprop("/tmp/aroma/installtype.prop", "selected.1") == "2" then

  ui_print("@  Installing to NAND and SD-EXT...");
  ui_print("  Mounting NAND and SD-EXT partitions...");

  package_extract_file("kernel/mount_DataOnEXT.sh", "/tmp/mount_DataOnEXT.sh");
  set_perm(0, 0, 0777, "/tmp/mount_DataOnEXT.sh");
  run_program("/tmp/mount_DataOnEXT.sh");

  if file_getprop("/tmp/nfo.prop", "DataOnEXT") == "true" then

    format("yaffs2", "MTD", "system");  
	
    mount("yaffs2", "MTD", "system", "/system");

    # Wipe Dalvik-Cache
    if file_getprop("/tmp/aroma/mods.prop", "selected.4") == "1" then
      delete_recursive("/data/dalvik-cache");
      ui_print("  Dalvik-Cache wiped.");
    endif;

    # Wipe Data/Factory Reset
    if file_getprop("/tmp/aroma/mods.prop", "selected.4") == "2" then
      delete_recursive("/data");
      delete_recursive("/sdcard/.android_secure");
      ui_print("  Data wiped.");
    endif;

    show_progress(0.9, 1400);
    ui_print("  Copying files...");
    package_extract_dir("system", "/system");
    package_extract_dir("data", "/data");  
    package_extract_dir("mods/data2ext", "/sdcard");
    show_progress(0.1, 5);

    # Append " [DataOnEXT]" to the ROM name
    package_extract_file("mods/set_build_prop_DataOnEXT.sh", "/tmp/set_build_prop_DataOnEXT.sh");
    set_perm(0, 0, 0777, "/tmp/set_build_prop_DataOnEXT.sh");
    run_program("/tmp/set_build_prop_DataOnEXT.sh");

  endif;

endif;

#####################################
# NAND MAGLDR or cLK Kernel install #
#####################################

if file_getprop("/tmp/aroma/kernel.prop", "NAND") == "yes" then

  # check bootloader
  package_extract_file("kernel/checksys.sh", "/tmp/checksys.sh");
  set_perm(0, 0, 755, "/tmp/checksys.sh");
  run_program("/tmp/checksys.sh");

  if file_getprop("/tmp/nfo.prop", "bootloader") == "cLK" then

    ui_print("@  cLK Bootloader found.");
    ui_print("  Flashing cLK kernel...");

	# not mounted but just in case :)
    unmount("/boot");
	

    assert(
      package_extract_file("kernel/zImage", "/tmp/zImage"),
      package_extract_file("kernel/mkbootimg", "/tmp/mkbootimg"),
      package_extract_file("kernel/mkbootimg.sh", "/tmp/mkbootimg.sh"));
    set_perm(0, 0, 0755, "/tmp/mkbootimg");
    set_perm(0, 0, 0755, "/tmp/mkbootimg.sh");
    assert(
      run_program("/tmp/mkbootimg.sh"),
      write_raw_image("/tmp/boot.img", "boot"),
      delete("/tmp/boot.img"));

  else

    ui_print("@  MAGLDR Bootloader found.");
    ui_print("  Flashing MAGLDR kernel...");

	# prepare boot partition
    format("yaffs2", "MTD", "boot");
    mount("yaffs2", "MTD", "boot", "/boot");
	
    
    package_extract_file("kernel/zImage", "/boot/zImage");

  endif;

endif;

####################
# NativeSD Install #
####################

if file_getprop("/tmp/aroma/installtype.prop", "selected.1") == "3" then

  ui_print("@  Installing to SD-EXT (NativeSD)...");
  ui_print("  Checking & Mounting SD-EXT Partition...");

  package_extract_file("kernel/mount_NativeSD.sh", "/tmp/mount_NativeSD.sh");
  set_perm(0, 0, 0777, "/tmp/mount_NativeSD.sh");
  run_program("/tmp/mount_NativeSD.sh");

  if file_getprop("/tmp/nfo.prop", "NativeSD") == "true" then

    # Wipe Dalvik-Cache
    if file_getprop("/tmp/aroma/mods.prop", "selected.4") == "1" then
      delete_recursive("/data/dalvik-cache");
      ui_print("  Dalvik-Cache wiped.");
    endif; # Wipe Dalvik-Cache

    # Wipe Data/Factory Reset
    if file_getprop("/tmp/aroma/mods.prop", "selected.4") == "2" then
      delete_recursive("/data");
      ui_print("  Data wiped.");
    endif; # Wipe Data/Factory Reset

    show_progress(0.9, 1400);
    ui_print("  Copying files...");
    package_extract_file("kernel/zImage", "/boot/zImage");
    package_extract_file("kernel/zImage", "/boot_dir/zImage");
    package_extract_dir("sdcard", "/sdcard");
    package_extract_dir("mods/nativesd", "/sdcard");

    package_extract_dir("system", "/system");
    package_extract_dir("data", "/data");   
    package_extract_file("mods/app/NativeSDBoot.apk", "/system/app/NativeSDBoot.apk");
    show_progress(0.1, 5);

    # Append " [NativeSD]" to the ROM name
    package_extract_file("mods/set_build_prop_NativeSD.sh", "/tmp/set_build_prop_NativeSD.sh");
    set_perm(0, 0, 0777, "/tmp/set_build_prop_NativeSD.sh");
    run_program("/tmp/set_build_prop_NativeSD.sh");
	
  endif;

endif;


####################
# DirectSD Install #
####################

if file_getprop("/tmp/aroma/installtype.prop", "selected.1") == "4" || file_getprop("/tmp/aroma/installtype.prop", "selected.1") == "5" then

  ui_print("@  Installing to SD-EXT (DirectSD)...");
  ui_print("  Checking & Mounting SD-EXT Partition...");

  package_extract_file("kernel/mount_DirectSD.sh", "/tmp/mount_DirectSD.sh");
  set_perm(0, 0, 0777, "/tmp/mount_DirectSD.sh");
  run_program("/tmp/mount_DirectSD.sh");

  if file_getprop("/tmp/nfo.prop", "DirectSD") == "true" then

    # Wipe Dalvik-Cache
    if file_getprop("/tmp/aroma/mods.prop", "selected.4") == "1" then
      delete_recursive("/data/dalvik-cache");
      ui_print("  Dalvik-Cache wiped.");
    endif; # Wipe Dalvik-Cache

    # Wipe Data/Factory Reset
    if file_getprop("/tmp/aroma/mods.prop", "selected.4") == "2" then
      delete_recursive("/data");
      ui_print("  Data wiped.");
    endif; # Wipe Data/Factory Reset

    show_progress(0.9, 1400);
    ui_print("  Copying files...");
    package_extract_file("kernel/zImage", "/boot/zImage");
    package_extract_file("kernel/zImage", "/boot_dir/zImage");
    package_extract_dir("sdcard", "/sdcard");
    package_extract_dir("mods/DirectSD", "/sdcard");

    package_extract_dir("system", "/system");
    package_extract_dir("data", "/data");   
    package_extract_file("mods/app/DirectSDBoot.apk", "/system/app/DirectSDBoot.apk");
    show_progress(0.1, 5);

    # Append " [DirectSD]" to the ROM name
    package_extract_file("mods/set_build_prop_DirectSD.sh", "/tmp/set_build_prop_DirectSD.sh");
    set_perm(0, 0, 0777, "/tmp/set_build_prop_DirectSD.sh");
    run_program("/tmp/set_build_prop_DirectSD.sh");
	
  endif;

endif;


########################
# Connection Selection #
########################
set_progress(0.65);
if file_getprop("/tmp/aroma/mods.prop", "selected.1") == "1" then
    delete("/system/ppp");
    delete("/system/default.prop");
    delete("/system/etc/init.d/97ppp");
    ui_print("@  RMNET installed.");
endif;

if file_getprop("/tmp/aroma/mods.prop", "selected.1") == "2" then

  package_extract_dir("mods/clk-ppp-patch", "/system");
  ui_print("@  PPP installed.");

endif;


######################
# Softkeys Selection #
######################

ui_print("@  Setting Softkeys...");
if file_getprop("/tmp/aroma/mods.prop", "selected.2") == "1" then

  package_extract_file("mods/enable_softkeys.sh", "/tmp/enable_softkeys.sh");
  set_perm(0, 0, 755, "/tmp/enable_softkeys.sh");
  run_program("/tmp/enable_softkeys.sh");
  ui_print("  Softkeys enabled.");

endif;

if file_getprop("/tmp/aroma/mods.prop", "selected.2") == "2" then

  package_extract_file("mods/disable_softkeys.sh", "/tmp/disable_softkeys.sh");
  set_perm(0, 0, 755, "/tmp/disable_softkeys.sh");
  run_program("/tmp/disable_softkeys.sh");
  ui_print("  Softkeys disabled.");

endif;


########################
# SWAPPING Selection #
########################
if file_getprop("/tmp/aroma/mods.prop","selected.3") == "1"  then
ui_print("@  Configuring Ram Pages Swapping...");
		
package_extract_file("mods/swap-partition-activator/install/installswap.sh", "/tmp/installswap.sh");
set_perm(0, 0, 0777, "/tmp/installswap.sh");
run_program("/tmp/installswap.sh");


		if ( file_getprop("/tmp/hardswap.prop", "swap.present") == "yes"  )
		then
			if ( file_getprop("/tmp/hardswap.prop", "swap.formatted") == "yes"  ) then
ui_print("  Swap partition formatted.");
			else
ui_print("  Error: Can't format existing swap partition!");
				abort("  Aborting...");
			endif;

		else
ui_print("  Error: No swap partition found on SDcard!");
			abort("  Aborting...");
		endif;


		# We're ready for the startup script to do ./swapon

		package_extract_dir("mods/swap-partition-activator/etc", "/system/etc");
		set_perm(0, 0, 0755, "/system/etc/init.d/99swap");
ui_print("  Swap-on script copied to /etc/init.d.");

endif; 


if file_getprop("/tmp/aroma/mods.prop", "selected.3") == "2" then
ui_print("  Removing swap...");
		delete("/system/etc/init.d/99swap");
ui_print("  Swap startup script deleted.");
endif; 

###################
# Data apps check #
###################
set_progress(0.85);
package_extract_file("mods/check_data_apps.sh", "/tmp/check_data_apps.sh");
set_perm(0, 0, 0777, "/tmp/check_data_apps.sh");
run_program("/tmp/check_data_apps.sh");

################################
# ROM Symlinks and Permissions #
################################

ui_print("@  Setting symlinks and permissions...");
ui_print("  Setting symlinks...");

symlink("../xbin/su", "/system/bin/su");
symlink("Roboto-Bold.ttf", "/system/fonts/DroidSans-Bold.ttf");
symlink("Roboto-Regular.ttf", "/system/fonts/DroidSans.ttf");
symlink("busybox", "/system/xbin/[", "/system/xbin/[[",
        "/system/xbin/adjtimex", "/system/xbin/arp", "/system/xbin/ash",
        "/system/xbin/awk", "/system/xbin/base64", "/system/xbin/basename",
        "/system/xbin/bbconfig", "/system/xbin/blkid", "/system/xbin/blockdev",
        "/system/xbin/brctl", "/system/xbin/bunzip2", "/system/xbin/bzcat",
        "/system/xbin/bzip2", "/system/xbin/cal", "/system/xbin/cat",
        "/system/xbin/catv", "/system/xbin/chattr", "/system/xbin/chgrp",
        "/system/xbin/chmod", "/system/xbin/chown", "/system/xbin/chroot",
        "/system/xbin/clear", "/system/xbin/cmp", "/system/xbin/comm",
        "/system/xbin/cp", "/system/xbin/cpio", "/system/xbin/crond",
        "/system/xbin/crontab", "/system/xbin/cut", "/system/xbin/date",
        "/system/xbin/dc", "/system/xbin/dd", "/system/xbin/depmod",
        "/system/xbin/devmem", "/system/xbin/df", "/system/xbin/diff",
        "/system/xbin/dirname", "/system/xbin/dmesg", "/system/xbin/dnsd",
        "/system/xbin/dos2unix", "/system/xbin/du", "/system/xbin/echo",
        "/system/xbin/ed", "/system/xbin/egrep", "/system/xbin/env",
        "/system/xbin/expand", "/system/xbin/expr", "/system/xbin/false",
        "/system/xbin/fbsplash", "/system/xbin/fdisk", "/system/xbin/fgrep",
        "/system/xbin/find", "/system/xbin/flash_lock",
        "/system/xbin/flash_unlock", "/system/xbin/flashcp",
        "/system/xbin/flock", "/system/xbin/fold", "/system/xbin/free",
        "/system/xbin/freeramdisk", "/system/xbin/fstrim", "/system/xbin/fsync",
        "/system/xbin/ftpget", "/system/xbin/ftpput", "/system/xbin/fuser",
        "/system/xbin/getopt", "/system/xbin/grep", "/system/xbin/groups",
        "/system/xbin/gunzip", "/system/xbin/gzip", "/system/xbin/halt",
        "/system/xbin/head", "/system/xbin/hexdump", "/system/xbin/id",
        "/system/xbin/ifconfig", "/system/xbin/inetd", "/system/xbin/insmod",
        "/system/xbin/install", "/system/xbin/ionice", "/system/xbin/iostat",
        "/system/xbin/ip", "/system/xbin/kill", "/system/xbin/killall",
        "/system/xbin/killall5", "/system/xbin/less", "/system/xbin/ln",
        "/system/xbin/losetup", "/system/xbin/ls", "/system/xbin/lsattr",
        "/system/xbin/lsmod", "/system/xbin/lsusb", "/system/xbin/lzcat",
        "/system/xbin/lzma", "/system/xbin/lzop", "/system/xbin/lzopcat",
        "/system/xbin/man", "/system/xbin/md5sum", "/system/xbin/mesg",
        "/system/xbin/mkdir", "/system/xbin/mke2fs", "/system/xbin/mkfifo",
        "/system/xbin/mkfs.ext2", "/system/xbin/mkfs.vfat",
        "/system/xbin/mknod", "/system/xbin/mkswap", "/system/xbin/mktemp",
        "/system/xbin/modinfo", "/system/xbin/modprobe", "/system/xbin/more",
        "/system/xbin/mount", "/system/xbin/mountpoint", "/system/xbin/mpstat",
        "/system/xbin/mv", "/system/xbin/nanddump", "/system/xbin/nandwrite",
        "/system/xbin/nbd-client", "/system/xbin/netstat", "/system/xbin/nice",
        "/system/xbin/nohup", "/system/xbin/nslookup", "/system/xbin/ntpd",
        "/system/xbin/od", "/system/xbin/patch", "/system/xbin/pgrep",
        "/system/xbin/pidof", "/system/xbin/ping", "/system/xbin/pipe_progress",
        "/system/xbin/pkill", "/system/xbin/pmap", "/system/xbin/poweroff",
        "/system/xbin/printenv", "/system/xbin/printf", "/system/xbin/ps",
        "/system/xbin/pstree", "/system/xbin/pwd", "/system/xbin/pwdx",
        "/system/xbin/rdev", "/system/xbin/readlink", "/system/xbin/realpath",
        "/system/xbin/renice", "/system/xbin/reset", "/system/xbin/resize",
        "/system/xbin/rev", "/system/xbin/rm", "/system/xbin/rmdir",
        "/system/xbin/rmmod", "/system/xbin/route", "/system/xbin/run-parts",
        "/system/xbin/rx", "/system/xbin/sed", "/system/xbin/seq",
        "/system/xbin/setconsole", "/system/xbin/setserial",
        "/system/xbin/setsid", "/system/xbin/sh", "/system/xbin/sha1sum",
        "/system/xbin/sha256sum", "/system/xbin/sha3sum",
        "/system/xbin/sha512sum", "/system/xbin/sleep", "/system/xbin/sort",
        "/system/xbin/split", "/system/xbin/stat", "/system/xbin/strings",
        "/system/xbin/stty", "/system/xbin/sum", "/system/xbin/swapoff",
        "/system/xbin/swapon", "/system/xbin/sync", "/system/xbin/sysctl",
        "/system/xbin/tac", "/system/xbin/tail", "/system/xbin/tar",
        "/system/xbin/taskset", "/system/xbin/tee", "/system/xbin/telnet",
        "/system/xbin/telnetd", "/system/xbin/test", "/system/xbin/tftp",
        "/system/xbin/tftpd", "/system/xbin/time", "/system/xbin/timeout",
        "/system/xbin/top", "/system/xbin/touch", "/system/xbin/tr",
        "/system/xbin/traceroute", "/system/xbin/true", "/system/xbin/ttysize",
        "/system/xbin/tune2fs", "/system/xbin/umount", "/system/xbin/uname",
        "/system/xbin/uncompress", "/system/xbin/unexpand", "/system/xbin/uniq",
        "/system/xbin/unix2dos", "/system/xbin/unlzma", "/system/xbin/unlzop",
        "/system/xbin/unxz", "/system/xbin/unzip", "/system/xbin/uptime",
        "/system/xbin/usleep", "/system/xbin/uudecode", "/system/xbin/uuencode",
        "/system/xbin/vi", "/system/xbin/watch", "/system/xbin/wc",
        "/system/xbin/wget", "/system/xbin/which", "/system/xbin/whoami",
        "/system/xbin/xargs", "/system/xbin/xz", "/system/xbin/xzcat",
        "/system/xbin/yes",
        "/system/xbin/zcat");
symlink("libGLESv2.so", "/system/lib/libGLESv3.so");
symlink("mksh", "/system/bin/sh");
symlink("toolbox", "/system/bin/cat", "/system/bin/chcon",
        "/system/bin/chmod", "/system/bin/chown", "/system/bin/clear",
        "/system/bin/cmp", "/system/bin/cp", "/system/bin/date",
        "/system/bin/dd", "/system/bin/df", "/system/bin/dmesg",
        "/system/bin/du", "/system/bin/getenforce", "/system/bin/getevent",
        "/system/bin/getprop", "/system/bin/getsebool", "/system/bin/grep",
        "/system/bin/hd", "/system/bin/id", "/system/bin/ifconfig",
        "/system/bin/iftop", "/system/bin/insmod", "/system/bin/ioctl",
        "/system/bin/ionice", "/system/bin/kill", "/system/bin/ln",
        "/system/bin/load_policy", "/system/bin/log", "/system/bin/ls",
        "/system/bin/lsmod", "/system/bin/lsof", "/system/bin/md5",
        "/system/bin/mkdir", "/system/bin/mkswap", "/system/bin/mount",
        "/system/bin/mv", "/system/bin/nandread", "/system/bin/netstat",
        "/system/bin/newfs_msdos", "/system/bin/notify", "/system/bin/printenv",
        "/system/bin/ps", "/system/bin/r", "/system/bin/readlink",
        "/system/bin/renice", "/system/bin/restorecon", "/system/bin/rm",
        "/system/bin/rmdir", "/system/bin/rmmod", "/system/bin/route",
        "/system/bin/runcon", "/system/bin/schedtop", "/system/bin/sendevent",
        "/system/bin/setconsole", "/system/bin/setenforce",
        "/system/bin/setprop", "/system/bin/setsebool", "/system/bin/sleep",
        "/system/bin/smd", "/system/bin/start", "/system/bin/stop",
        "/system/bin/swapoff", "/system/bin/swapon", "/system/bin/sync",
        "/system/bin/top", "/system/bin/touch", "/system/bin/umount",
        "/system/bin/uptime", "/system/bin/vmstat", "/system/bin/watchprops",
        "/system/bin/wipe");
ui_print("  Setting permissions...");
set_perm_recursive(0, 0, 0755, 0644, "/system");
set_perm_recursive(0, 0, 0755, 0755, "/system/addon.d");
set_perm_recursive(0, 2000, 0755, 0755, "/system/bin");
set_perm(0, 3003, 02750, "/system/bin/netcfg");
set_perm(0, 0, 0755, "/system/bin/ping");
set_perm(0, 2000, 0750, "/system/bin/run-as");
set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
set_perm_recursive(0, 2000, 0755, 0755, "/system/etc/init.d");
set_perm(0, 0, 0755, "/system/etc/init.d");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor");
set_perm(0, 0, 0644, "/system/vendor/etc/audio_effects.conf");
set_perm_recursive(0, 0, 0755, 0644, "/system/vendor/firmware");
set_perm(0, 2000, 0755, "/system/vendor/firmware");
set_perm(0, 0, 0644, "/system/vendor/lib/libbt-vendor.so");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
set_perm(0, 0, 06755, "/system/xbin/librank");
set_perm(0, 0, 06755, "/system/xbin/procmem");
set_perm(0, 0, 06755, "/system/xbin/procrank");
set_perm(0, 0, 06755, "/system/xbin/su");
symlink("/system/vendor/firmware/fw_bcm4329.bin", "/system/etc/firmware/fw_bcm4329.bin");
symlink("/system/vendor/firmware/fw_bcm4329_apsta.bin", "/system/etc/firmware/fw_bcm4329_apsta.bin");
set_perm_recursive(0, 1001, 0755, 0775, "/system/etc/ppp");
set_perm(0, 0, 04755, "/system/bin/pppd");
set_perm(0, 3003, 02750, "/system/bin/netcfg");
set_perm(0, 3004, 02755, "/system/bin/ping");
set_perm(0, 2000, 06750, "/system/bin/run-as");
set_perm(1002, 1002, 0440, "/system/etc/dbus.conf");
set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor");
set_perm(0, 2000, 0755, "/system/vendor/lib");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
ui_print("  Symlinks and permissions done.");


###############
# Cleaning up #
###############

set_progress(0.95);
ui_print("@  Cleaning up...");
delete("/tmp");
ui_print("  Unmounting...");
unmount("/boot");
unmount("/system");
unmount("/data");
unmount("/DirectSD");
ui_print("  Done.");

set_progress(1.0);
ui_print("@  Installation Complete");[/hide]
mountfs2.sh
Code:
#!/bin/busybox sh

# wait for 2nd partition ready
    wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2

# check the ext4 fs
/bin/e2fsck -p /dev/block/mmcblk0p2 > /e2fsck.log

# mount the 1st (NativeSD) SD-EXT partition
/bin/busybox mkdir -p /NativeSD
/bin/busybox mount -t auto -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /NativeSD

# mount the system data app dir
/bin/busybox mount --bind /NativeSD/rOm/data   /data


# cleanup
# delete /bin to free ram
/bin/busybox rm -rf /bin[/hide]
mountfs5.sh
Code:
#!/bin/busybox sh

# wait for 2nd partition ready
wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3

# check the ext4 fs
/bin/e2fsck -p /dev/block/mmcblk0p2 > /e2fsck.log

# mount the 1st (NativeSD) SD-EXT partition
/bin/busybox mkdir -p /DirectSystem
/bin/busybox mkdir -p /DirectData
/bin/busybox mount -t auto -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /DirectSystem
/bin/busybox mount -t f2fs -o noatime,nodiratime,nosuid,nodev,discard /dev/block/mmcblk0p3 /DirectData

# mount the system data app dir
/bin/busybox mount --bind /DirectSystem/rOm/system /system
/bin/busybox mount --bind /DirectData/rOm/data   /data


# cleanup
# delete /bin to free ram
/bin/busybox rm -rf /bin
[/hide]
 

Attachments

  • NativeSD_patch.zip
    3.9 MB · Views: 49
Last edited:

hitman1376

Senior Member
Jan 7, 2013
667
431
23
zanjan
Great ...

Updater-script
Code:
###
#
# AROMA Installer
#   (C) 2011-2012 by Ahmad Amarullah
#       amarullz - xda-developers
#
###
#
# AROMA Installer Script for 
#   (C) 2012-2013 by tytung - xda-developers (tytung @ gmail.com)
#     
###

ui_print("------------------------------------------------");
ui_print("                                              ");
ui_print("                                              ");
ui_print("------------------------------------------------");

am("/tmp/check_data_apps.sh");

################################
# ROM Symlinks and Permissions #
################################

ui_print("@  Setting symlinks and permissions...");
ui_print("  Setting symlinks...");

symlink("../xbin/su", "/system/bin/su");
symlink("Roboto-Bold.ttf", "/system/fonts/DroidSans-Bold.ttf");
symlink("Roboto-Regular.ttf", "/system/fonts/DroidSans.ttf");
symlink("busybox", "/system/xbin/[", "/system/xbin/[[",
        "/system/xbin/adjtimex", "/system/xbin/arp", "/system/xbin/ash",
        "/system/xbin/awk", "/system/xbin/base64", "/system/xbin/basename",
        "/system/xbin/bbconfig", "/system/xbin/blkid", "/system/xbin/blockdev",
        "/system/xbin/brctl", "/system/xbin/bunzip2", "/system/xbin/bzcat",
        "/system/xbin/bzip2", "/system/xbin/cal", "/system/xbin/cat",
        "/system/xbin/catv", "/system/xbin/chattr", "/system/xbin/chgrp",
        "/system/xbin/chmod", "/system/xbin/chown", "/system/xbin/chroot",
        "/system/xbin/clear", "/system/xbin/cmp", "/system/xbin/comm",
        "/system/xbin/cp", "/system/xbin/cpio", "/system/xbin/crond",
        "/system/xbin/crontab", "/system/xbin/cut", "/system/xbin/date",
        "/system/xbin/dc", "/system/xbin/dd", "/system/xbin/depmod",
        "/system/xbin/devmem", "/system/xbin/df", "/system/xbin/diff",
        "/system/xbin/dirname", "/system/xbin/dmesg", "/system/xbin/dnsd",
        "/system/xbin/dos2unix", "/system/xbin/du", "/system/xbin/echo",
        "/system/xbin/ed", "/system/xbin/egrep", "/system/xbin/env",
        "/system/xbin/expand", "/system/xbin/expr", "/system/xbin/false",
        "/system/xbin/fbsplash", "/system/xbin/fdisk", "/system/xbin/fgrep",
        "/system/xbin/find", "/system/xbin/flash_lock",
        "/system/xbin/flash_unlock", "/system/xbin/flashcp",
        "/system/xbin/flock", "/system/xbin/fold", "/system/xbin/free",
        "/system/xbin/freeramdisk", "/system/xbin/fstrim", "/system/xbin/fsync",
        "/system/xbin/ftpget", "/system/xbin/ftpput", "/system/xbin/fuser",
        "/system/xbin/getopt", "/system/xbin/grep", "/system/xbin/groups",
        "/system/xbin/gunzip", "/system/xbin/gzip", "/system/xbin/halt",
        "/system/xbin/head", "/system/xbin/hexdump", "/system/xbin/id",
        "/system/xbin/ifconfig", "/system/xbin/inetd", "/system/xbin/insmod",
        "/system/xbin/install", "/system/xbin/ionice", "/system/xbin/iostat",
        "/system/xbin/ip", "/system/xbin/kill", "/system/xbin/killall",
        "/system/xbin/killall5", "/system/xbin/less", "/system/xbin/ln",
        "/system/xbin/losetup", "/system/xbin/ls", "/system/xbin/lsattr",
        "/system/xbin/lsmod", "/system/xbin/lsusb", "/system/xbin/lzcat",
        "/system/xbin/lzma", "/system/xbin/lzop", "/system/xbin/lzopcat",
        "/system/xbin/man", "/system/xbin/md5sum", "/system/xbin/mesg",
        "/system/xbin/mkdir", "/system/xbin/mke2fs", "/system/xbin/mkfifo",
        "/system/xbin/mkfs.ext2", "/system/xbin/mkfs.vfat",
        "/system/xbin/mknod", "/system/xbin/mkswap", "/system/xbin/mktemp",
        "/system/xbin/modinfo", "/system/xbin/modprobe", "/system/xbin/more",
        "/system/xbin/mount", "/system/xbin/mountpoint", "/system/xbin/mpstat",
        "/system/xbin/mv", "/system/xbin/nanddump", "/system/xbin/nandwrite",
        "/system/xbin/nbd-client", "/system/xbin/netstat", "/system/xbin/nice",
        "/system/xbin/nohup", "/system/xbin/nslookup", "/system/xbin/ntpd",
        "/system/xbin/od", "/system/xbin/patch", "/system/xbin/pgrep",
        "/system/xbin/pidof", "/system/xbin/ping", "/system/xbin/pipe_progress",
        "/system/xbin/pkill", "/system/xbin/pmap", "/system/xbin/poweroff",
        "/system/xbin/printenv", "/system/xbin/printf", "/system/xbin/ps",
        "/system/xbin/pstree", "/system/xbin/pwd", "/system/xbin/pwdx",
        "/system/xbin/rdev", "/system/xbin/readlink", "/system/xbin/realpath",
        "/system/xbin/renice", "/system/xbin/reset", "/system/xbin/resize",
        "/system/xbin/rev", "/system/xbin/rm", "/system/xbin/rmdir",
        "/system/xbin/rmmod", "/system/xbin/route", "/system/xbin/run-parts",
        "/system/xbin/rx", "/system/xbin/sed", "/system/xbin/seq",
        "/system/xbin/setconsole", "/system/xbin/setserial",
        "/system/xbin/setsid", "/system/xbin/sh", "/system/xbin/sha1sum",
        "/system/xbin/sha256sum", "/system/xbin/sha3sum",
        "/system/xbin/sha512sum", "/system/xbin/sleep", "/system/xbin/sort",
        "/system/xbin/split", "/system/xbin/stat", "/system/xbin/strings",
        "/system/xbin/stty", "/system/xbin/sum", "/system/xbin/swapoff",
        "/system/xbin/swapon", "/system/xbin/sync", "/system/xbin/sysctl",
        "/system/xbin/tac", "/system/xbin/tail", "/system/xbin/tar",
        "/system/xbin/taskset", "/system/xbin/tee", "/system/xbin/telnet",
        "/system/xbin/telnetd", "/system/xbin/test", "/system/xbin/tftp",
        "/system/xbin/tftpd", "/system/xbin/time", "/system/xbin/timeout",
        "/system/xbin/top", "/system/xbin/touch", "/system/xbin/tr",
        "/system/xbin/traceroute", "/system/xbin/true", "/system/xbin/ttysize",
        "/system/xbin/tune2fs", "/system/xbin/umount", "/system/xbin/uname",
        "/system/xbin/uncompress", "/system/xbin/unexpand", "/system/xbin/uniq",
        "/system/xbin/unix2dos", "/system/xbin/unlzma", "/system/xbin/unlzop",
        "/system/xbin/unxz", "/system/xbin/unzip", "/system/xbin/uptime",
        "/system/xbin/usleep", "/system/xbin/uudecode", "/system/xbin/uuencode",
        "/system/xbin/vi", "/system/xbin/watch", "/system/xbin/wc",
        "/system/xbin/wget", "/system/xbin/which", "/system/xbin/whoami",
        "/system/xbin/xargs", "/system/xbin/xz", "/system/xbin/xzcat",
        "/system/xbin/yes",
        "/system/xbin/zcat");
symlink("libGLESv2.so", "/system/lib/libGLESv3.so");
symlink("mksh", "/system/bin/sh");
symlink("toolbox", "/system/bin/cat", "/system/bin/chcon",
        "/system/bin/chmod", "/system/bin/chown", "/system/bin/clear",
        "/system/bin/cmp", "/system/bin/cp", "/system/bin/date",
        "/system/bin/dd", "/system/bin/df", "/system/bin/dmesg",
        "/system/bin/du", "/system/bin/getenforce", "/system/bin/getevent",
        "/system/bin/getprop", "/system/bin/getsebool", "/system/bin/grep",
        "/system/bin/hd", "/system/bin/id", "/system/bin/ifconfig",
        "/system/bin/iftop", "/system/bin/insmod", "/system/bin/ioctl",
        "/system/bin/ionice", "/system/bin/kill", "/system/bin/ln",
        "/system/bin/load_policy", "/system/bin/log", "/system/bin/ls",
        "/system/bin/lsmod", "/system/bin/lsof", "/system/bin/md5",
        "/system/bin/mkdir", "/system/bin/mkswap", "/system/bin/mount",
        "/system/bin/mv", "/system/bin/nandread", "/system/bin/netstat",
        "/system/bin/newfs_msdos", "/system/bin/notify", "/system/bin/printenv",
        "/system/bin/ps", "/system/bin/r", "/system/bin/readlink",
        "/system/bin/renice", "/system/bin/restorecon", "/system/bin/rm",
        "/system/bin/rmdir", "/system/bin/rmmod", "/system/bin/route",
        "/system/bin/runcon", "/system/bin/schedtop", "/system/bin/sendevent",
        "/system/bin/setconsole", "/system/bin/setenforce",
        "/system/bin/setprop", "/system/bin/setsebool", "/system/bin/sleep",
        "/system/bin/smd", "/system/bin/start", "/system/bin/stop",
        "/system/bin/swapoff", "/system/bin/swapon", "/system/bin/sync",
        "/system/bin/top", "/system/bin/touch", "/system/bin/umount",
        "/system/bin/uptime", "/system/bin/vmstat", "/system/bin/watchprops",
        "/system/bin/wipe");
ui_print("  Setting permissions...");
set_perm_recursive(0, 0, 0755, 0644, "/system");
set_perm_recursive(0, 0, 0755, 0755, "/system/addon.d");
set_perm_recursive(0, 2000, 0755, 0755, "/system/bin");
set_perm(0, 3003, 02750, "/system/bin/netcfg");
set_perm(0, 0, 0755, "/system/bin/ping");
set_perm(0, 2000, 0750, "/system/bin/run-as");
set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
set_perm_recursive(0, 2000, 0755, 0755, "/system/etc/init.d");
set_perm(0, 0, 0755, "/system/etc/init.d");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor");
set_perm(0, 0, 0644, "/system/vendor/etc/audio_effects.conf");
set_perm_recursive(0, 0, 0755, 0644, "/system/vendor/firmware");
set_perm(0, 2000, 0755, "/system/vendor/firmware");
set_perm(0, 0, 0644, "/system/vendor/lib/libbt-vendor.so");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
set_perm(0, 0, 06755, "/system/xbin/librank");
set_perm(0, 0, 06755, "/system/xbin/procmem");
set_perm(0, 0, 06755, "/system/xbin/procrank");
set_perm(0, 0, 06755, "/system/xbin/su");
symlink("/system/vendor/firmware/fw_bcm4329.bin", "/system/etc/firmware/fw_bcm4329.bin");
symlink("/system/vendor/firmware/fw_bcm4329_apsta.bin", "/system/etc/firmware/fw_bcm4329_apsta.bin");
set_perm_recursive(0, 1001, 0755, 0775, "/system/etc/ppp");
set_perm(0, 0, 04755, "/system/bin/pppd");
set_perm(0, 3003, 02750, "/system/bin/netcfg");
set_perm(0, 3004, 02755, "/system/bin/ping");
set_perm(0, 2000, 06750, "/system/bin/run-as");
set_perm(1002, 1002, 0440, "/system/etc/dbus.conf");
set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor");
set_perm(0, 2000, 0755, "/system/vendor/lib");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
ui_print("  Symlinks and permissions done.");


###############
# Cleaning up #
###############

set_progress(0.95);
ui_print("@  Cleaning up...");
delete("/tmp");
ui_print("  Unmounting...");
unmount("/boot");
unmount("/system");
unmount("/data");
unmount("/DirectSD");
ui_print("  Done.");

set_progress(1.0);
ui_print("@  Installation Complete");[/hide]
mountfs2.sh
Code:
#!/bin/busybox sh

# wait for 2nd partition ready
    wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2

# check the ext4 fs
/bin/e2fsck -p /dev/block/mmcblk0p2 > /e2fsck.log

# mount the 1st (NativeSD) SD-EXT partition
/bin/busybox mkdir -p /NativeSD
/bin/busybox mount -t auto -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /NativeSD

# mount the system data app dir
/bin/busybox mount --bind /NativeSD/rOm/data   /data


# cleanup
# delete /bin to free ram
/bin/busybox rm -rf /bin[/hide]
mountfs5.sh
Code:
#!/bin/busybox sh

# wait for 2nd partition ready
wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3

# check the ext4 fs
/bin/e2fsck -p /dev/block/mmcblk0p2 > /e2fsck.log

# mount the 1st (NativeSD) SD-EXT partition
/bin/busybox mkdir -p /DirectSystem
/bin/busybox mkdir -p /DirectData
/bin/busybox mount -t auto -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /DirectSystem
/bin/busybox mount -t f2fs -o noatime,nodiratime,nosuid,nodev,discard /dev/block/mmcblk0p3 /DirectData

# mount the system data app dir
/bin/busybox mount --bind /DirectSystem/rOm/system /system
/bin/busybox mount --bind /DirectData/rOm/data   /data


# cleanup
# delete /bin to free ram
/bin/busybox rm -rf /bin
[/hide]


Was working with RobbieP on this (as I can't test on device) - essentially aroma config for 3.0.x kernel with initrd.gz made on the fly.
Initrd mods carried out include applying: data on ext, nativesd, directsd(w/ ext4 or f2fs) to nand initrd.gz.
ROM_NAME applied from ROM_NAME.prop
6MB offset applied if bootloader is magldr

Managed to fix the nativesd.sh - it was riddled with errors:
Code:
#!/bin/sh

export ROM_NAME=` cat 'ROM_NAME.prop' | sed 's/ROM_NAME=//g' `
export install_type=` cat 'installtype.prop' | sed 's/selected.1=//g' `
export bootloader=` cat 'nfo.prop' | sed 's/bootloader=//g' `

cd /tmp/aroma
mkdir /tmp/aroma/work
cp initrd.gz initrd-test.gz
cd /tmp/aroma/work

# unzipping nand kernel and applying modifications
gzip -d -c ../initrd-test.gz | cpio -i -d
mkdir bin
cd ..
cp busybox work/bin/busybox
cp e2fsck work/bin/e2fsck
chmod 0777 work/bin/busybox
chmod 0777 work/bin/e2fsck

if [ "${install_type}" -gt 2 ]; then
		sed -i '/[email protected]/s/^/#/' work/ueventd.htcleo.rc
		sed -i '/mount yaffs2/s/^/#/
		s/#    #/# /g' work/init.rc
		sed -i "s/rOm/$ROM_NAME/g" work/mountfs${install_type}.sh
		sed -i 's/auto/ext4/g' work/mountfs${install_type}.sh
		
fi
if [ "${install_type}" -gt 1 ]; then
	sed -i '/on fs/ a exec /mountfs'${install_type}'.sh' work2/init.rc
	cp mountfs${install_type}.sh work/mountfs${install_type}.sh
	chmod 0777 work/mountfs${install_type}.sh
	chmod 0750 work/init.rc
	chmod 0644 work/ueventd.htcleo.rc
fi
# making new ramdisk and copying to sd card
cd work2
find .| cpio -o -H newc | gzip -9 > ../initrd-done.gz
cd ..

if [ "${bootloader}" != "cLK" ]; then
	cat initrd-done.gz >> 6MB
	cp 6MB initrd6MB.gz
else
	cp done2/initrd-done.gz /tmp/initrd.gz
fi

chmod 0777 initrd.gz
if [ "${install_type}" -lt 3 ]; then
	cp initrd6MB.gz tmp/initrd.gz
else
	cp initrd6MB.gz boot/initrd.gz
	cp initrd6MB.gz boot_dir/initrd.gz
fi


# Copying tmp and open ramdisk folders to sdcard (NativeSD folder)

mkdir -p boot/tmp

Also this way if you want to add another way of booting all you need to do is create a mountfs.sh file and edit aroma-config.

aroma-config
Code:
### LICENSE:
#
# Copyright (C) 2011-2012 Ahmad Amarullah ( http://amarullz.com/ )
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
### FILE INFO:
#
# AROMA Installer from  was modded by
# macs18max to include haret detection (hacked way) and 
# clk nativesd sboot2. If using this please credit macs18max
#
###


##
# Forcing Device Pixelate Size
#  defaut: floor( min( width, height ) / 160 )
#
ini_set("dp","3"); #-- HDPI ( 480x800 / WVGA )


##
# Initializing Rom Information
##
ini_set("rom_name",             "");
ini_set("rom_version",          "");
ini_set("rom_author",           "");
ini_set("rom_device",           "");
ini_set("rom_date",             "");


##
# Show Simple Splash
# splash( 	2000,	"slim");


##
# Set Small Font to Support all fonts
#
fontresload( "0", "ttf/Roboto-Regular.ttf;ttf/DroidSansArabic.ttf;ttf/DroidSansFallback.ttf;", "12" ); #-- Use sets of font (Font Family)


##
# Set Language & Font Family
#
loadlang("langs/en.lang");
fontresload( "0", "ttf/Roboto-Regular.ttf", "12" ); #-- "0" = Small Font
fontresload( "1", "ttf/Roboto-Regular.ttf", "18" ); #-- "1" = Big Font


###################################################################################################################
#
# STEP 1 - SELECT THEME
#
theme("ics");


###################################################################################################################
#
# STEP 2 - SHOW ROM INFORMATION
#

# Extract ROM_NAME.prop to /tmp/aroma/ROM_NAME.prop
ziptotmp("kernel/ROM_NAME.prop", "ROM_NAME.prop");
ziptotmp("kernel/initrd.gz", "initrd.gz");
ziptotmp("kernel/busybox", "busybox");
ziptotmp("kernel/e2fsck", "e2fsck");
ziptotmp("kernel/mountfs2.sh", "mountfs2.sh");
ziptotmp("kernel/mountfs3.sh", "mountfs3.sh");
ziptotmp("kernel/mountfs4.sh", "mountfs4.sh");
ziptotmp("kernel/mountfs5.sh", "mountfs5.sh");
# [B]ADD NEW MOUNTFS HERE[/B]
ziptotmp("kernel/6MB", "6MB");
zipexec("kernel/checksys.sh");
setvar("bootloader", file_getprop("/tmp/nfo.prop", "bootloader"));

viewbox(
  #-- Title
    "Welcome!",

  #-- Text
    "You are about to install the below ROM for <b>"+ini_get("rom_device")+"</b>.\n\n"+

    "  ROM Name\t: <b><#selectbg_g>"+ini_get("rom_name")+"</#></b>\n"+
    "  Version\t: <b><#selectbg_g>"+ini_get("rom_version")+"</#></b>\n"+
    "  Author\t: <b><#selectbg_g>"+ini_get("rom_author")+"</#></b>\n"+
    "  Update\t: <b><#selectbg_g>"+ini_get("rom_date")+"</#></b>\n\n\n"+

    "Bootloader\t: "+getvar("bootloader")+"\n\n"+

    "System NAND\t: "+getdisksize("/system","m")+" MB\n"+
    "\t Free\t: "+    getdiskfree("/system","m")+" MB\n\n"+

    "Data   NAND\t: "+getdisksize("/data","m")+" MB\n"+
    "\t Free\t: "+    getdiskfree("/data","m")+" MB\n\n"+

    "SD Card Size\t: "+getdisksize("/sdcard","m")+" MB\n"+
    "\t Free\t: "+     getdiskfree("/sdcard","m")+" MB\n\n"+

    " SD-EXT Size\t: "+getdisksize("/sd-ext","m")+" MB\n"+
    "\t Free\t: "+     getdiskfree("/sd-ext","m")+" MB\n\n"+
	
	"SD-EXT2 Size\t: "+getdisksize("/sd-ext2","m")+" MB\n"+
    "\t Free\t: "+     getdiskfree("/sd-ext2","m")+" MB\n\n\n"+

    "Press Next to Continue the Installation...",

  #-- Icon
    "icons/welcome"
);


###################################################################################################################
#
# STEP 3 - SHOW SELECTBOX - Install Type
#
selectbox(
  #-- Title
    "Install Type",

  #-- Sub Title
    "Please Select the install type:",

  #-- Icon
    "icons/apps",

  #-- Will be saved in /tmp/aroma/installtype.prop
    "installtype.prop",
 
  #-- Group 1
    "Install Location", "", 2,                                                    #-- Group 1. key = "selected.1"

    "NAND",
      "[email protected], [email protected], [email protected]\nFor T-Mobile USA HD2 (LEO 1024)",    0, #-- selected.1 = 1

    "NAND with DataOnEXT",
      "[email protected], [email protected], [email protected]\nFor EU/International HD2 (LEO 512)", 0, #-- selected.1 = 2

    "NativeSD (Everything on the SD card)",
      "[email protected], [email protected], [email protected]\nFor high speed read/write SD Card", 0,  #-- selected.1 = 3
	  
	"DirectSD (Everything on the SD card)",
      "[email protected], [email protected], [email protected]\nFor high speed read/write SD Card", 1  #-- selected.1 = 4
	
	"DirectSD (Everything on the SD card)",
      "[email protected], [email protected], [email protected]\nFor high speed read/write SD Card", 1  #-- selected.1 = 5

# [B]ADD NEW MOUNTFS DETAILS HERE[/B]

);

if (prop("installtype.prop", "selected.1") == "1" || prop("installtype.prop", "selected.1") == "2") then
  writetmpfile("kernel.prop", "NAND=yes");
else
  writetmpfile("kernel.prop", "NAND=no");
endif;

##############################
# Mount the SD-EXT partition #
##############################

if (prop("installtype.prop", "selected.1") == "2" ||
    prop("installtype.prop", "selected.1") == "3") then

   pleasewait("Mounting the SD-EXT Partition...");
   zipexec("kernel/SD-EXT_mounter.sh");
   setvar("mount_result", getvar("exec_buffer"));

  if file_getprop("/tmp/mount.prop", "status") != "mounted" then

    #######################
    # No SD-EXT Partition #
    #######################

    # Set Next Text to 'Exit'
    ini_set("text_next", "Exit");

    textbox(
      "Mounting SD-EXT failed!",
      "Please create an EXT4 partition (mmcblk0p2) on the SD Card first.",
      "icons/alert",
      "Error messages:\n\n"+getvar("mount_result")
    );

    #-- Back to Menu
    back("1");

  endif;

endif;

if prop("installtype.prop", "selected.1") == "4" ||
   prop("installtype.prop", "selected.1") == "5" then

  pleasewait("Mounting the SD-EXT Partition...");
  zipexec("kernel/DirectSD_mounter.sh");
  setvar("mount_result", getvar("exec_buffer"));

  if file_getprop("/tmp/mount.prop", "status") != "mounted" then

    #######################
    # No SD-EXT Partition #
    #######################

    # Set Next Text to 'Exit'
    ini_set("text_next", "Exit");

    textbox(
      "Mounting SD-EXT failed!",
      "Please create an EXT4 partition (mmcblk0p2) on the SD Card first.",
      "icons/alert",
      "Error messages:\n\n"+getvar("mount_result")
    );

    #-- Back to Menu
    back("1");

  endif;

endif;

if prop("installtype.prop", "selected.1") != ""
zipexec("kernel/nativesd.sh");
endif;

# Swap partition activation - run the check for sdcard swap partition
pleasewait("Checking SDCard for Swap Partition.");
zipexec("mods/swap-partition-activator/install/checkforswap.sh");
###################################################################################################################
#
# STEP 4 - SHOW SELECTBOX - ROM Mods
#
selectbox(
  #-- Title
    "ROM Mods",
  
  #-- Sub Title
    "Please Select the ROM Mods:",
  
  #-- Icon
    "icons/personalize",
  
  #-- Will be saved in /tmp/aroma/mods.prop
    "mods.prop",
 
  #-- Group 1
    "Default Connection Type","",2,
      "RMNET Connection",
        "Please Choose RMNET for MAGLDR bootloader.",	iif((file_getprop("/tmp/nfo.prop", "bootloader") == "MAGLDR"), 1, 0),
      "PPP Connection",
        "All bootloaders support PPP.",           	iif((file_getprop("/tmp/nfo.prop", "bootloader") == "MAGLDR"), 0, 1),


 #-- Group 2
    "Softkeys (Navbar)","",2,
      "Enable softkeys",
        "Select it to enable softkeys.",          1,
      "Disable softkeys",
        "Select it to disable softkeys.",         0,

		
 #-- Group 3
  "Activate RAM Pages Swapping","",2,
    "Yes",
    "You must have a pre-made swap partition on your SDcard!",  iif((file_getprop("/tmp/checkforswap.prop", "swap.present") == "yes"), 1, 0),
    "No",
    "Swapping will be deactivated.\n\n", iif((file_getprop("/tmp/checkforswap.prop", "swap.present") == "no"), 1, 0),
	

 #-- Group 4
    "Wipe","",2,
      "Wipe Dalvik-Cache",
        "Select it to wipe Dalvik-Cache.",        	1,
      "Wipe Data/Factory Reset",
        "Select it to wipe data/factory reset.",  	0,
      "No Wipe",
        "Select it to keep everything.",          	0

);

####################
# Installation Ready
####################
ini_set("text_next", "Install Now");
viewbox(
	"Installation Ready",
	"The wizard is ready to begin installation.\n\n"+
	"Press <b>Install Now</b> to begin the installation.\n\n"+
	"If you want to review or change any of your installation settings, press <b>Back</b> or Press Menu Key -> Quit Installation to exit the wizard.",
	"@install"
);


#####################
# Start Install
#####################
ini_set("text_next", "Finish");
install(
	"Installing",
	"<b>"+ini_get("rom_name")+"</b> is being installed.\n\n"+
	"Please wait while installation wizard installs <b>"+ini_get("rom_name")+
	"</b>. This may take several minutes.",
	"@install",
	"The installation wizard has successfully installed <b>"+ini_get("rom_name")
);


# Set Next Text fo Exit
ini_set("text_next", "Exit");

viewbox(
  "Installation Completed",
  "<#080>Congratulation</#>\n\n"+
  "Please press Exit and Reboot your HD2",
  "icons/info"
);
Really Great ... Thanks Man ... Just Works Perfect ... Can I use some of your Ideas for M7 development ? ... Thanks In Advance ...


With Best Wishes
Hitman1376​
 

HypoTurtle

Senior Member
May 5, 2011
1,991
1,277
Really Great ... Thanks Man ... Just Works Perfect ... Can I use some of your Ideas for M7 development ? ... Thanks In Advance ...

With Best Wishes
Hitman1376​

Feel free.
What works exactly - all I know is that aroma-config runs without reporting an error and that nativesd.sh runs properly in ubuntu.


I'll post the whole bundle patch that RobbieP has been trying, so anyone can try it an report any errors.

The bundle includes:
TWRP recovery (with f2fs enabled by kokotas)
walter79's 3.0.x-pmem-marc1706 kernel with f2fs patches added
modified updater-script and aroma config
nativesd and mountfs files.
 
  • Like
Reactions: hitman1376

Robbie P

Senior Member
Feb 8, 2011
5,116
4,016
London
If i choose DirectSDwith/dataonext4 or DirectSDwith/dataonF2FS, i get the screen saying "Mounting SD-EXT failed-please create an EXT4 partition (mmcblk0p2) on the SD Card first"

Also the ROM_NAME.prop wrongly says "ROM_NAME=ChauTien_CM11_V1", it should be "ROM_NAME=ChauTien-Slimroms-Build4", beware if you are testing not to overwrite that ROM if you already have it installed.

F2FS works good on our HD2 from earlier tests. The kernel doesn't seem to like my uhs1 card. Have attached a couple of androbench tests on fat32 and f2fs partitions. Also some speed tests below.
MB/s Write Read
FAT32 6.1 10.18
6.37 10.47
6.26 9.47
EXT4 2.48 9.00
2.39 10.28
2.10 9.32
F2FS 6.01 10.84
4.75 9.30
6.34 7.27
This is on an 8Gb sandisk class4 (i think, the number has worn away;))

I hope people can take a look at the scripts HypoTurtle has posted, to see any mistakes. I don't think any or all of the ziptotmps at the start of aroma-config are working since /tmp folder does not show them in recovery terminal after running aroma.
 

Attachments

  • Screenshot_2014-03-30-14-48-30.png
    Screenshot_2014-03-30-14-48-30.png
    100 KB · Views: 90
  • Screenshot_2014-03-30-14-48-51.png
    Screenshot_2014-03-30-14-48-51.png
    99.4 KB · Views: 67
  • Like
Reactions: HypoTurtle

HypoTurtle

Senior Member
May 5, 2011
1,991
1,277
If i choose DirectSDwith/dataonext4 or DirectSDwith/dataonF2FS, i get the screen saying "Mounting SD-EXT failed-please create an EXT4 partition (mmcblk0p2) on the SD Card first"

Also the ROM_NAME.prop wrongly says "ROM_NAME=ChauTien_CM11_V1", it should be "ROM_NAME=ChauTien-Slimroms-Build4", beware if you are testing not to overwrite that ROM if you already have it installed.

F2FS works good on our HD2 from earlier tests. The kernel doesn't seem to like my uhs1 card. Have attached a couple of androbench tests on fat32 and f2fs partitions. Also some speed tests below.
MB/s Write Read
FAT32 6.1 10.18
6.37 10.47
6.26 9.47
EXT4 2.48 9.00
2.39 10.28
2.10 9.32
F2FS 6.01 10.84
4.75 9.30
6.34 7.27
This is on an 8Gb sandisk class4 (i think, the number has worn away;))
I hope people can take a look at the scripts HypoTurtle has posted, to see any mistakes. I don't think any or all of the ziptotmps at the start of aroma-config are working since /tmp folder does not show them in recovery terminal after running aroma.

Thanks, RobbieP that pretty much sums up where we are.
Can you post the f2fs recovery that you are using (just in case I post the wrong one); also can you post the result of 'cat /tmp/mount.prop'

That's my bad with ROM_NAME, was working with CM11 and SlimKK, the wrong ROM_NAME.prop slipped in there. Other than overwritting ChauTien_CM11_V1 (if this thing actually ran), the ROM should still run fine as this ROM_NAME is called everywhere it needs to be i.e during install and with mountfs.sh scripts.

Reupping with a rom_name.prop for slimkat
 

HypoTurtle

Senior Member
May 5, 2011
1,991
1,277
Okay issue seems to be that the mounter scripts either aren't called properly or simply don't run...

From - aroma-config for DataOnExt and NativeSD
Code:
if (prop("installtype.prop", "selected.1") == "2" ||
    prop("installtype.prop", "selected.1") == "3") then

  pleasewait("Mounting the SD-EXT Partition...");
  zipexec("kernel/SD-EXT_mounter.sh");
  setvar("mount_result", getvar("exec_buffer"));
  zipexec("kernel/nativesd.sh");

  if file_getprop("/tmp/mount.prop", "status") != "mounted" then

    #######################
    # No SD-EXT Partition #
    #######################

    # Set Next Text to 'Exit'
    ini_set("text_next", "Exit");

    textbox(
      "Mounting SD-EXT failed!",
      "Please create an EXT4 partition (mmcblk0p2) on the SD Card first.",
      "icons/alert",
      "Error messages:\n\n"+getvar("mount_result")
    );

    #-- Back to Menu
    back("1");

  endif;

endif;
SD-EXT_mounter.sh is called
[code#!/sbin/sh
#
# NativeSD SD-EXT Mounter v1.0
# Author: tytung - xda-developers

if [ ! -d "/NativeSD" ]; then
mkdir "/NativeSD"
fi

if [ -f "/tmp/mount.prop" ]; then
rm "/tmp/mount.prop"
fi

# Mount the SD-EXT partition
mounted=`mount | grep '/dev/block/mmcblk0p2 on /NativeSD'`
if [ "$mounted" = "" ]; then
#mount -t ext4 /dev/block/mmcblk0p2 /NativeSD
mount -t auto /dev/block/mmcblk0p2 /NativeSD
fi

# `echo $?` will return 0 if mount is executed successfully
if [ `echo $?` = 0 ]; then
echo 'status=mounted' > "/tmp/mount.prop"
#else
# redirect mount failed messages to aroma-config
fi

exit 0][/code]

If DirectSD is selected DirectSD_mounter.sh is run
Code:
if (prop("installtype.prop", "selected.1") == "4" ||
    prop("installtype.prop", "selected.1") == "5") then

  pleasewait("Mounting the SD-EXT Partition...");
  zipexec("kernel/DirectSD_mounter.sh");
  setvar("mount_result", getvar("exec_buffer"));
  zipexec("kernel/nativesd.sh");

  if file_getprop("/tmp/mount.prop", "status") != "mounted" then

    #######################
    # No SD-EXT Partition #
    #######################

    # Set Next Text to 'Exit'
    ini_set("text_next", "Exit");

    textbox(
      "Mounting SD-EXT failed!",
      "Please create an EXT4 partition (mmcblk0p2) on the SD Card first.",
      "icons/alert",
      "Error messages:\n\n"+getvar("mount_result")
    );

    #-- Back to Menu
    back("1");

  endif;

endif;
DirectSD_mounter.sh
Code:
#!/sbin/sh
#
# DirectSD SD-EXT Mounter v1.0
# Author: tytung - xda-developers

if [ ! -d "/DirectSystem" ]; then
	mkdir "/DirectSystem"
fi

if [ ! -d "/DirectData" ]; then
	mkdir "/DirectData"
fi

if [ -f "/tmp/mount.prop" ]; then
	rm "/tmp/mount.prop"
fi

# Mount the SD-EXT partition
mounted=`mount | grep '/dev/block/mmcblk0p2 on /DirectSystem'`
if [ "$mounted" = "" ]; then
	 mount -t auto /dev/block/mmcblk0p2 /DirectSystem
fi

# Mount the SD-EXT partition
mounted=`mount | grep '/dev/block/mmcblk0p3 on /DirectData'`
if [ "$mounted" = "" ]; then
	 mount -t auto /dev/block/mmcblk0p3 /DirectData
fi

# `echo $?` will return 0 if mount is executed successfully
if [ `echo $?` = 0 ]; then
	echo 'status=mounted' > "/tmp/mount.prop"
#else
	# redirect mount failed messages to aroma-config
fi

exit 0

Something in the above seems to be acting up.

For reference the exec_buffer variable is blank...
 
Last edited:

Robbie P

Senior Member
Feb 8, 2011
5,116
4,016
London
I just tried NativeSD install, no errors were reported, but the files were not installed. it did say that installation was successful, and the "save log" button appeared, so i saved it.
Code:
AROMA INSTALLER version 2.56
  (c) 2012 by amarullz xda-developers

ROM Name    : ChauTien Slimroms 4.4.2
ROM Version : Build 4
ROM Author  : Chau Truong Thinh
Device      : HTC HD2
Start at    : Mon Jan 27 20:28:18 2014


    line 13 col 1: syntax error, unexpected BAD, expecting IF or STRING or '!' or '('
    1 parse errors


Installer Error (Status 6)


End at : Mon Jan 27 20:28:18 2014
I can't find which file has BAD in line 13 col 1
Unless it is a notepad++ file extension problem
 

HypoTurtle

Senior Member
May 5, 2011
1,991
1,277
In updater-script - line 138:
Code:
	package_extract_file("kernel/cpboot.sh", "/tmp/cpboot.sh");
    set_perm(0, 0, 755, "/tmp/cpboot.sh");
    run_program("/tmp/cpboot.sh"[B])[/B]);
seems to be an extra ) , can you also add the tmp folder to see that everything else is working as it should.
 

Robbie P

Senior Member
Feb 8, 2011
5,116
4,016
London
did that at 138, still get the no-files-installed "successful" nativeSD installation
https://www.dropbox.com/s/pzlsv4h8a6exwec/tmp (3).zip
have attached install log, looks the same.

Edit; here is /tmp for choosing directSD, 2xEXT4 partitions https://www.dropbox.com/s/cjw6l4a4gwr7fsp/tmp6.zip

Edit2; here is /tmp for choosing directSD, 2xEXT4 partitions after reformatting both ext4 partitions using minitool AND 4ext sd recovery (Xylograph mod) then installing using same recovery. Same result "Mounting SD-EXT failed!....." https://www.dropbox.com/s/w7azkyey8fcape6/tmp7.zip
 
Last edited:
  • Like
Reactions: HypoTurtle

Robbie P

Senior Member
Feb 8, 2011
5,116
4,016
London
Thanks, RobbieP that pretty much sums up where we are.
Can you post the f2fs recovery that you are using..
Enormous thanks to @kokotas for compiling SD version of 2.7.0.0 twrp with f2fs support. kokotas does not own a HD2 anymore, but has done this over and above the huge contributions already made for our HD2, very much appreciated:good:
I have been using this for the past couple of weeks. There are some issues with the 3.0 kernel which it uses, such as not powering off fully (need to press reset button), but we need the 3.0 kernel to use f2fs. Please post any other bugs you may find.
To make a f2fs partition, it is necessary to format the third partition to eg FAT32 first. Then using recovery's terminal emulator;
(select the / folder)
type "mkfs.f2fs /dev/block/mmcblk0p3" (without the "", space before first / and it is a zero before p3)
Have attached original from kokotas, and one with 6mb zeros added to initrd.gz for magldr users, HypoTurtle tweaked the initrd.gz in the magldr version iirc.
Note that since it is a 3.0 kernel, it won't boot using HaRET. Untested on cLK.

Huge thanks again to kokotas and HypoTurtle, even though they no longer own HD2s, they are still willing to support it. RESPECT:D
Thanks also to marc1706, securecrt, walter79, gilbert32, tytung and others i might have missed.
I do hope we can get these scripts working, Devs will be able to release a rom with the nand initrd.gz and aroma will do all the rest, sounds great.:fingers-crossed:
 

Attachments

  • HD2_SD_TWRP_2.7.0.0_f2fs_for_magldr(extract_to_sdcard).zip
    6.9 MB · Views: 22
  • HD2_SD_TWRP_2.7.0.0_f2fs(extract_to_sdcard).zip
    6.9 MB · Views: 28
Last edited:

HypoTurtle

Senior Member
May 5, 2011
1,991
1,277
Enormous thanks to @kokotas for compiling SD version of 2.7.0.0 twrp with f2fs support. kokotas does not own a HD2 anymore, but has done this over and above the huge contributions already made for our HD2, very much appreciated:good:
I have been using this for the past couple of weeks. There are some issues with the 3.0 kernel which it uses, such as not powering off fully (need to press reset button), but we need the 3.0 kernel to use f2fs. Please post any other bugs you may find.
To make a f2fs partition, it is necessary to format the third partition to eg FAT32 first. Then using recovery's terminal emulator;
(select the / folder)
type "mkfs.f2fs /dev/block/mmcblk0p3" (without the "", space before first / and it is a zero before p3)
Have attached original from kokotas, and one with 6mb zeros added to initrd.gz for magldr users, HypoTurtle tweaked the initrd.gz in the magldr version iirc.
Note that since it is a 3.0 kernel, it won't boot using HaRET. Untested on cLK.

Huge thanks again to kokotas and HypoTurtle, even though they no longer own HD2s, they are still willing to support it. RESPECT:D
Thanks also to marc1706, securecrt, walter79, gilbert32, tytung and others i might have missed.
I do hope we can get these scripts working, Devs will be able to release a rom with the nand initrd.gz and aroma will do all the rest, sounds great.:fingers-crossed:

Not sure that I did anything kernel/initrd wise for the kernel other than apply the f2fs patches and compile. (not sure if I used securecrt or walter79's git for the kernel so credits to them)

I'm actually thinking that with a little tweaking I should be able to reduce the updater-script down to just copying over the system files, which should make the whole system easily adaptable for all devices (unless I'm barking completely up the wrong tree)
 

Robbie P

Senior Member
Feb 8, 2011
5,116
4,016
London
Not sure that I did anything kernel/initrd wise for the kernel other than apply the f2fs patches and compile. (not sure if I used securecrt or walter79's git for the kernel so credits to them)

I'm actually thinking that with a little tweaking I should be able to reduce the updater-script down to just copying over the system files, which should make the whole system easily adaptable for all devices (unless I'm barking completely up the wrong tree)
Better that than
dog_chasing_tail_md.gif

;):D
 

Robbie P

Senior Member
Feb 8, 2011
5,116
4,016
London
And modify DirectSD_mounter.sh so that if it doesn't mount p3 as ext4 it tries with f2fs
Code:
#!/sbin/sh
#
# DirectSD SD-EXT Mounter v1.0
# Author: tytung - xda-developers

if [ ! -d "/DirectSystem" ]; then
	mkdir "/DirectSystem"
fi

if [ ! -d "/DirectData" ]; then
	mkdir "/DirectData"
fi

if [ -f "/tmp/mount.prop" ]; then
	rm "/tmp/mount.prop"
fi

# Mount the SD-EXT partition
mounted=`mount | grep '/dev/block/mmcblk0p2 on /DirectSystem'`
if [ "$mounted" = "" ]; then
	 mount -t ext4 /dev/block/mmcblk0p2 /DirectSystem
fi

# Mount the SD-EXT partition
mounted=`mount | grep '/dev/block/mmcblk0p3 on /DirectData'`
if [ "$mounted" = "" ]; then
	 mount -t ext4 /dev/block/mmcblk0p3 /DirectData
fi
# Mount F2FS partition
mounted=`mount | grep '/dev/block/mmcblk0p3 on /DirectData'`
   if [ "$mounted" = "" ]; then
	 mount -t f2fs /dev/block/mmcblk0p3 /DirectData
   fi

# `echo $?` will return 0 if mount is executed successfully
if [ `echo $?` = 0 ]; then
	echo 'status=mounted' > "/tmp/mount.prop"
#else
	# redirect mount failed messages to aroma-config
fi

exit 0
And that's it on this side. Now read #2
looking at that code, if p3 was f2fs, then the first mount attempt would be with type ext4, which would give an "invalid argument" error (since is f2fs), it would then mount to f2fs. But the error should show up with echo $?, so status would not be =mounted.
would it be better to leave as -t auto? I know it works when installing, can't remember if it works from initrd.gz.
 

HypoTurtle

Senior Member
May 5, 2011
1,991
1,277
looking at that code, if p3 was f2fs, then the first mount attempt would be with type ext4, which would give an "invalid argument" error (since is f2fs), it would then mount to f2fs. But the error should show up with echo $?, so status would not be =mounted.
would it be better to leave as -t auto? I know it works when installing, can't remember if it works from initrd.gz.

Was compiling a unified script (combining the nativesd stuff along with the mounter scripts etc.) and noticed that - I think that adding another
mounted=`mount | grep '/dev/block/mmcblk0p3 on /DirectData'` just before the $? check would solve it. $? is just the last issued command - I have checked and that would work fine.

I am hazarding a guess that one of the reasons things weren't working earlier was the use of auto (feel free to tell me otherwise - while in aroma installing any rom try and mount p3 as auto and see what it reports (checking with mount and df)), one of the other things I slipped up on (due to testing on linux) was that I was using #!bin/sh in places where I should have been using #sbin/sh.

Also of note I have forgotten a few -'s in the zip on #2 ; will reup with new stuff tomorrow.
 

Robbie P

Senior Member
Feb 8, 2011
5,116
4,016
London
In recovery i did;
mkdir /sdcard/f2fs
mount -t auto /dev/block/mmcblk0p3 /sdcard/f2fs
i get
mount
...
/dev/block/mmcblk0p3 on /sdcard/f2fs type f2fs (rw,relatime,background_gc_on,active_logs=6)

df
...
/dev/block/mmcblk0p3 1k-blocks 1670144 used 182804 available 1465836 11% /sdcard/f2fs

Looking at;
## Copying zImage from /boot_dir if one wasn't added to zip
if [ ! -f "/tmp/zImage" ]; then
cp /boot_dir/zImage/ /tmp/zImage
fi
if [ ! -f "/tmp/zImage" ]; then
cp /boot_dir/initrd.gz/ /tmp/initrd.gz
fi
The second one should be initrd.gz:), and if (NativeSD or) DirectSD install then it won't find either in boot-dir, should look in /sdcard/NativeSD folder (but it won't be nand initrd.gz since is already edited for *SD install), needs to save to same as well.

I tried the patch zip with the s-edits and swapping initrd.gz for zImage as above and including nand ramdisk in zip with directSD install, and it seems to run too quick for unpacking & repacking ramdisk. It is done almost immediately. recovery log not saved for some reason.
 
  • Like
Reactions: HypoTurtle

HypoTurtle

Senior Member
May 5, 2011
1,991
1,277
In recovery i did;
mkdir /sdcard/f2fs
mount -t auto /dev/block/mmcblk0p3 /sdcard/f2fs
i get
mount
...
/dev/block/mmcblk0p3 on /sdcard/f2fs type f2fs (rw,relatime,background_gc_on,active_logs=6)

df
...
/dev/block/mmcblk0p3 1k-blocks 1670144 used 182804 available 1465836 11% /sdcard/f2fs

Looking at;

The second one should be initrd.gz:), and if (NativeSD or) DirectSD install then it won't find either in boot-dir, should look in /sdcard/NativeSD folder (but it won't be nand initrd.gz since is already edited for *SD install), needs to save to same as well.

I tried the patch zip with the s-edits and swapping initrd.gz for zImage as above and including nand ramdisk in zip with directSD install, and it seems to run too quick for unpacking & repacking ramdisk. It is done almost immediately. recovery log not saved for some reason.


Good catch with the typo... the patch installs will be very fast, it would be unnoticable. Will go back to using auto then (at least with the mounter).

A few things I think you misunderstood - the patch zip (#2) is to be run directly after a modified rom zip that 1 has ROM_NAME and install-type added to build.prop and that things aren't unmounted. /boot_dir is where the /sdcard/NativeSD/$ROM_NAME folder is mounted to. (will need to recheck: /sdcard/NativeSD is /boot and /sdcard/NativeSD/$ROM_NAME is /boot_dir or vice versa)
Thus the second zip needs/uses ROM_NAME and desired install type from /system/build.prop (as described above) and we need /boot and /boot_dir to remain mounted as they were by the ROM_zip itself. (This also sorts some potential issue where the ROM_NAME defined in initrd.gz is different from the name of the folder in NativeSD folder).

Easiest way to check if it's working as it should is having an adb shell running during install ... running mount after running the ROM.zip to check what is still mounted, and after running the patcher zip check the work folder to see if things run properly (busybox added to bin, mountfs-$install_type.sh added etc.)

Here is the combined scripts I was working on (1st draft).
Code:
#!/sbin/sh

## Bootloader check (copy of checksys.sh)
echo "bootloader=MAGLDR" > /tmp/nfo.prop

output=`grep -i "clk" /proc/cmdline`
if [ -n "$output" ]; then
	echo "bootloader=cLK" > /tmp/nfo.prop
fi

install_type=` cat '/tmp/aroma/installtype.prop' | sed 's/selected.1=//g' `
type=(NAND DataOnExt NativeSD DirectSD)
install=${type[$install_type-1]}
ROM_NAME=`cat '/tmp/aroma/ROM_NAME.prop' | sed 's/ROM_NAME=//g'`

if [ -f "/tmp/mount.prop" ]; then
	rm "/tmp/mount.prop"
fi

if [ ${install} = 'NativeSD' || ${type} = 'DataOnExt' ]; then 
	if [ ! -d "/NativeSD" ]; then
		mkdir "/NativeSD"
	fi

# Mount the SD-EXT partition
	mounted=`mount | grep '/dev/block/mmcblk0p2 on /NativeSD'`
	if [ "$mounted" = "" ]; then
		mount -t ext4 /dev/block/mmcblk0p2 /NativeSD
	fi

	# `echo $?` will return 0 if mount is executed successfully
	if [ `echo $?` = 0 ]; then
		echo 'status=mounted' > "/tmp/mount.prop"
	#else
	# redirect mount failed messages to aroma-config
	fi
	### mount_NativeSD
	STATUS=`cat '/tmp/mount.prop' | sed 's/status=//g'`
	if [ "$STATUS" = "mounted" ]; then
		if [ ${install} = 'NativeSD' ]; then
	
			mkdir -p /NativeSD/$ROM_NAME/system
			mkdir -p /NativeSD/$ROM_NAME/data
		
			mount --bind /NativeSD/$ROM_NAME/system /system
			mount --bind /NativeSD/$ROM_NAME/data   /data
	
			mkdir -p /sdcard/NativeSD/$ROM_NAME
			mkdir -p /boot
			mkdir -p /boot_dir

			mount --bind /sdcard/NativeSD/$ROM_NAME /boot
			mount --bind /sdcard/NativeSD           /boot_dir

			# delete the old system
			rm -rf /system/*

			echo "NativeSD=true" >> /tmp/nfo.prop

		else

			mkdir -p /NativeSD/$ROM_NAME/data
			mount --bind /NativeSD/$ROM_NAME/data /data
			echo "DataOnEXT=true" >> /tmp/nfo.prop
		fi
	else
		# no SD-EXT partition found	
		echo "NativeSD=false" >> /tmp/nfo.prop	
	fi
fi
if [ ${install} = 'DirectSD' ]; then
	if [ ! -d "/DirectSystem" ]; then
		mkdir "/DirectSystem"
	fi

	if [ ! -d "/DirectData" ]; then
		mkdir "/DirectData"
	fi

	# Mount the SD-EXT partition
	mounted=`mount | grep '/dev/block/mmcblk0p2 on /DirectSystem'`
	if [ "$mounted" = "" ]; then
		 mount -t ext4 /dev/block/mmcblk0p2 /DirectSystem
	fi

	# Mount the second SD-EXT partition
	mounted=`mount | grep '/dev/block/mmcblk0p3 on /DirectData'`
	if [ "$mounted" = "" ]; then
		 mount -t ext4 /dev/block/mmcblk0p3 /DirectData
	fi

	# Mount F2FS partition
	mounted=`mount | grep '/dev/block/mmcblk0p3 on /DirectData'`
   	if [ "$mounted" = "" ]; then
		 mount -t f2fs /dev/block/mmcblk0p3 /DirectData
   	fi

	# `echo $?` will return 0 if mount is executed successfully
	mounted=`mount | grep '/dev/block/mmcblk0p3 on /DirectData'`
	if [ `echo $?` = 0 ]; then
		echo 'status=mounted' > "/tmp/mount.prop"
	#else
	# redirect mount failed messages to aroma-config	
	fi
	##mount_DirectSD.sh
	STATUS=`cat '/tmp/mount.prop' | sed 's/status=//g'`
	if [ "$STATUS" = "mounted" ]; then

		mkdir -p /DirectSystem/$ROM_NAME/system
		mkdir -p /DirectData/$ROM_NAME/data

		mount --bind /DirectSystem/$ROM_NAME/system /system
		mount --bind /DirectData/$ROM_NAME/data   /data
	
		mkdir -p /sdcard/NativeSD/$ROM_NAME
		mkdir -p /boot
		mkdir -p /boot_dir

		mount --bind /sdcard/NativeSD/$ROM_NAME /boot
		mount --bind /sdcard/NativeSD           /boot_dir
	

		echo "DirectSD=true" >> /tmp/nfo.prop

	else

		# no SD-EXT partition found	
		echo "DirectSD=false" >> /tmp/nfo.prop

	fi
fi

# Changing install_type to numbered value
if $install='NAND'; then
	install_type='1'
fi
if $install='DataOnExt'; then
	install_type='2'
fi
if $install='NativeSD'; then
	install_type='3'
fi
if $install='DirectSD'; then
	install_type='4'
fi

DataOnExtmount="#!/bin/busybox sh

# wait for 2nd partition ready
    wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2

# check the ext4 fs
/bin/e2fsck -p /dev/block/mmcblk0p2 > /e2fsck.log

# mount the 1st (NativeSD) SD-EXT partition
/bin/busybox mkdir -p /NativeSD
/bin/busybox mount -t auto -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /NativeSD

# mount the system data app dir
/bin/busybox mount --bind /NativeSD/rOm/data   /data


# cleanup
# delete /bin to free ram
/bin/busybox rm -rf /bin
"
NativeSDmount="#!/bin/busybox sh

# wait for 2nd partition ready
    wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2

# check the ext4 fs
/bin/e2fsck -p /dev/block/mmcblk0p2 > /e2fsck.log

# mount the 1st (NativeSD) SD-EXT partition
/bin/busybox mkdir -p /NativeSD
/bin/busybox mount -t auto -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /NativeSD

# mount the system data app dir
/bin/busybox mount --bind /NativeSD/rOm/system /system
/bin/busybox mount --bind /NativeSD/rOm/data   /data


# cleanup
# delete /bin to free ram
/bin/busybox rm -rf /bin
"
direct=`mount | grep mmcblk0p3 | grep ext4`
if [ -n "$direct" ]; then
DirectSDmount="#!/bin/busybox sh

# wait for 2nd partition ready
wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3

# check the ext4 fs
/bin/e2fsck -p /dev/block/mmcblk0p2 > /e2fsck.log

# mount the 1st (NativeSD) SD-EXT partition
/bin/busybox mkdir -p /DirectSystem
/bin/busybox mkdir -p /DirectData
/bin/busybox mount -t ext4 -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /DirectSystem
/bin/busybox mount -t ext4 -o noatime,nodiratime,nosuid,nodev,discard /dev/block/mmcblk0p3 /DirectData

# mount the system data app dir
/bin/busybox mount --bind /DirectSystem/rOm/system /system
/bin/busybox mount --bind /DirectData/rOm/data   /data


# cleanup
# delete /bin to free ram
/bin/busybox rm -rf /bin
"
else
DirectSDmount="#!/bin/busybox sh

# wait for 2nd partition ready
wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
	wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3
	wait /dev/block/mmcblk0p3

# check the ext4 fs
/bin/e2fsck -p /dev/block/mmcblk0p2 > /e2fsck.log

# mount the 1st (NativeSD) SD-EXT partition
/bin/busybox mkdir -p /DirectSystem
/bin/busybox mkdir -p /DirectData
/bin/busybox mount -t ext4 -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /DirectSystem
/bin/busybox mount -t f2fs -o noatime,nodiratime,nosuid,nodev,discard /dev/block/mmcblk0p3 /DirectData

# mount the system data app dir
/bin/busybox mount --bind /DirectSystem/rOm/system /system
/bin/busybox mount --bind /DirectData/rOm/data   /data


# cleanup
# delete /bin to free ram
/bin/busybox rm -rf /bin
"
fi
## Setting up working directory
cp /tmp/initrd.gz /tmp/initrd-$ROM_NAME.gz
mkdir -p /tmp/work
cd /tmp/work

## Unzipping nand kernel
gzip -d -c ../initrd-$ROM_NAME.gz | cpio -i -d
mkdir bin
cp /tmp/busybox bin/busybox
cp /tmp/e2fsck bin/e2fsck
cat ${type}mount > mountfs-${type}.sh
cp /tmp/mountfs-${install}.sh mountfs-${install}.sh
chmod 0777 mountfs-${install}.sh
chmod 0777 bin/busybox
chmod 0777 bin/e2fsck

## Modifying ramdisk to not use yaffs, and use sd partitions instead.
if [ "${install_type}" -gt 2 ]; then
		sed -i '/[email protected]/s/^/#/' ueventd.htcleo.rc
		sed -i '/mount yaffs2/s/^/#/
		s/#    #/# /g' init.rc
		sed -i "s/rOm/$ROM_NAME/g" mountfs-${install}.sh
fi

## Checking if anything other than nand is to be installed
if [ "${install_type}" -gt 1 ]; then
	sed -i '/on fs/ a exec /mountfs-'${install}'.sh' init.rc
	sed -i "s/rOm/$ROM_NAME/g" mountfs-${install}.sh
	chmod 0750 init.rc
	chmod 0644 ueventd.htcleo.rc
fi

# Building new ramdisk
find .| cpio -o -H newc | gzip -9 > ../initrd-done.gz
cd ..

# Checking bootloader
if [ "${bootloader}" != "cLK" ]; then
	cat initrd-done.gz >> 6MB
	cp 6MB /boot/initrd.gz
	cp /tmp/zImage /boot/zImage
	#Checking if nand install
		if [ "${install_type}" -gt 2 ]; then
			cp 6MB /boot_dir/initrd.gz
			cp /tmp/zImage /boot_dir/zImage
		fi
else     
	cp initrd-done.gz /tmp/initrd.gz
	chmod 0755 /tmp/mkbootimg
	chmod 0755 /tmp/mkbootimg.sh
        exec /tmp/mkbootimg.sh
		if [ "${install_type}" -lt 3 ]; then
		    flash_image boot /tmp/boot.img else
	            flash_image sboot /tmp/boot.img 
	        fi		
fi

cp /tmp/initrd-$ROM_NAME.gz /tmp/initrd.gz
 
Last edited:
  • Like
Reactions: Robbie P

Robbie P

Senior Member
Feb 8, 2011
5,116
4,016
London
yeah i misunderstood earlier:eek:
i did the edits in post#1 to chautien cyanogen v2 including changing to auto
it seemed to install to f2fs p3 ok
then flashed #2 with edits from earlier. it booted ok but p3 /data did not show up.
So i put f2fs kernel in NativeSD and added 6mb to initrd.gz manually, booted but still no /data.
Will try to put f2fs kernel in #2 and also try putting nand ramdisk in there after.

Would checking the size of the kernel be a good indication of whether it is a 3.0.x kernel? afaik 3.0 ones are >3mb and 2.6.x are <3mb
 

HypoTurtle

Senior Member
May 5, 2011
1,991
1,277
yeah i misunderstood earlier:eek:
i did the edits in post#1 to chautien cyanogen v2 including changing to auto
it seemed to install to f2fs p3 ok
then flashed #2 with edits from earlier. it booted ok but p3 /data did not show up.
So i put f2fs kernel in NativeSD and added 6mb to initrd.gz manually, booted but still no /data.
Will try to put f2fs kernel in #2 and also try putting nand ramdisk in there after.

Would checking the size of the kernel be a good indication of whether it is a 3.0.x kernel? afaik 3.0 ones are >3mb and 2.6.x are <3mb

Regarding 3.0.x kernel if you see the way I tried to add the check for 3.0.x kernel which wouldn''t work as is (needs cut -d ' ' -f '1'); if the check isn't passed then the 6MB file is removed meaning that later on when initrd-done is cat'ed >> 6MB it makes a new file called 6MB rather than adding on to the end of a preexisting one (that's the theory anyway).

For now I would just remove the md5sum lines from it. For the kernel change using #2 I need to add the lines for copying the modules across (system folder in zip copied to /system).

Are you sure it booted without /data not being mounted at all with direct p3 is mounted to /DirectData and /DirectData/$ROM_NAME/data is mounted as /data. Just to check that it is the ramdisk built by the patcher that is running just check the root directory / and see if there is a mountfs-DirectSD.sh file - there should be. If there is check it and see if rOm has been changed (although if system is mounted I can't see why data's wouldn't have).

Also I noticed a few errors (using $type instead of $install and some -'s for some of the mountfs references) in the last script posted, not sure if I pulled those errors across from the zip posted on 2 will check tomorrow.

Just taking a glance at the long script posted and /boot_dir is /sdcard/NativeSD and /boot is the ROM folder which makes sense. Not sure if using /boot is better or worse as /boot isn't a folder for clk users (afaik); need a workaround for clk anyway (I think) and need to bundle in unmkbootimg stuff.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 7
    Was working with RobbieP on this (as I can't test on device) - essentially aroma config for 3.0.x kernel with initrd.gz made on the fly.
    Initrd mods carried out include applying: data on ext, nativesd, directsd(w/ ext4 or f2fs) to nand initrd.gz.

    Decided to come at this from a different direction (after managing to botch together a device to test on) - as I can't get the aroma prop files to play nice.
    So lets start with the minor modifications needed by in the ROM

    Updater script modifications (based on SlimKat - but should be universal'ish'):
    Code:
    ...
    ...
    ...
    ###############
    # Cleaning up #
    ###############
    
    set_progress(0.95);
    delete_recursive("/tmp/*");
    if file_getprop("/tmp/aroma/mods.prop", "selected.4") == "2" then 
      ui_print("@  Cleaning up...");
      ui_print("  Unmounting...");
      unmount("/boot");
      unmount("/boot_dir");
      unmount("/system");
      unmount("/data");
      unmount("/DirectSD");
      unmount("/DirectSystem");
      unmount("/NativeSD");
      ui_print("  Done."); 
    else
      package_extract_file("kernel/initrd.gz[COLOR="red"](NAND initrd)[/COLOR]", "/boot_dir/initrd.gz");
      package_extract_file("kernel/zImage", "/boot_dir/zImage");
    endif;
    set_progress(1.0);
    ui_print("@  Installation Complete");
    Edit. Going to need: delete_recursive("/tmp/*"); outside of the if;endif;
    And also /boot_dir won't be made if using NAND/DataOnExt; will need to rework this and #2 to extract to /tmp after it's wiped.
    And change every reference to an initrd.gz other than the NAND one to the NAND one (just to avoid confusion)
    Which obviously requires an additional group in mods in aroma-config:
    Code:
    ...
    ...
    ...
     #-- Group 3
        "Wipe","",2,
          "Wipe Dalvik-Cache",
            "Select it to wipe Dalvik-Cache.",        	1,
          "Wipe Data/Factory Reset",
            "Select it to wipe data/factory reset.",  	0,
          "No Wipe",
            "Select it to keep everything.",          	0,
    
    		
     #-- Group 4
        "Installing a second zip","",2,
          "Installing a second zip",
            "Select it if you are installing a second zip - NativeSD/DirectSD or gapps for example",        	1,
          "Not installing a second zip",
            "Select it if installing to NAND only",  	0
    			
    );
    ...
    ...
    Additionally the set_build_prop_*.sh's should be replaced (or redirected in updater script) by the following:
    Set_Build_Prop.sh
    Code:
    #!/sbin/sh
    # Append " [$install_type] and [$ROM_NAME]" to the ROM name for HD2
    # Modify /system/build.prop and append "[] hooks" to the end of the line of ro.build.display.id
    # Created by hypoturtle
    ROM_NAME=`cat '/tmp/aroma/ROM_NAME.prop' | sed 's/ROM_NAME=//g'`
    install_type=` cat '/tmp/aroma/installtype.prop' | sed 's/selected.1=//g' `
    type=(NAND DataOnExt NativeSD DirectSD)
    install=${type[$install_type-1]}
    output=`grep -i "^ro\.build\.display\.id.*\[${install}\]$" /system/build.prop`
    if [ -z "$output" ]; then
      sed -i '/ro\.build\.display\.id/s/$/ \['${ROM_NAME}'] ['${install}'\]/' /system/build.prop
    fi

    And modify DirectSD_mounter.sh so that if it doesn't mount p3 as ext4 it tries with f2fs
    Code:
    #!/sbin/sh
    #
    # DirectSD SD-EXT Mounter v1.0
    # Author: tytung - xda-developers
    
    if [ ! -d "/DirectSystem" ]; then
    	mkdir "/DirectSystem"
    fi
    
    if [ ! -d "/DirectData" ]; then
    	mkdir "/DirectData"
    fi
    
    if [ -f "/tmp/mount.prop" ]; then
    	rm "/tmp/mount.prop"
    fi
    
    # Mount the SD-EXT partition
    mounted=`mount | grep '/dev/block/mmcblk0p2 on /DirectSystem'`
    if [ "$mounted" = "" ]; then
    	 mount -t ext4 /dev/block/mmcblk0p2 /DirectSystem
    fi
    
    # Mount the SD-EXT partition
    mounted=`mount | grep '/dev/block/mmcblk0p3 on /DirectData'`
    if [ "$mounted" = "" ]; then
    	 mount -t ext4 /dev/block/mmcblk0p3 /DirectData
    fi
    
    # Mount F2FS partition
    mounted=`mount | grep '/dev/block/mmcblk0p3 on /DirectData'`
       if [ "$mounted" = "" ]; then
    	 mount -t f2fs /dev/block/mmcblk0p3 /DirectData
       fi
    
    mounted=`mount | grep '/dev/block/mmcblk0p3 on /DirectData'`
    # `echo $?` will return 0 if mount is executed successfully
    if [ `echo $?` = 0 ]; then
    	echo 'status=mounted' > "/tmp/mount.prop"
    #else
    	# redirect mount failed messages to aroma-config
    fi
    And that's it on this side. Now read #2

    legacy:

    Managed to fix the nativesd.sh - it was riddled with errors:
    Code:
    #!/sbin/sh
    
    export ROM_NAME=` cat 'ROM_NAME.prop' | sed 's/ROM_NAME=//g' `
    export install_type=` cat 'installtype.prop' | sed 's/selected.1=//g' `
    export bootloader=` cat 'nfo.prop' | sed 's/bootloader=//g' `
    
    cd /tmp/aroma
    mkdir /tmp/aroma/work
    cp initrd.gz initrd-test.gz
    cd /tmp/aroma/work
    
    # unzipping nand kernel and applying modifications
    gzip -d -c ../initrd-test.gz | cpio -i -d
    mkdir bin
    cd ..
    cp busybox work/bin/busybox
    cp e2fsck work/bin/e2fsck
    chmod 0777 work/bin/busybox
    chmod 0777 work/bin/e2fsck
    
    if [ "${install_type}" -gt 2 ]; then
    		sed -i '/[email protected]/s/^/#/' work/ueventd.htcleo.rc
    		sed -i '/mount yaffs2/s/^/#/
    		s/#    #/# /g' work/init.rc
    		sed -i 's/auto/ext4/g' work/mountfs${install_type}.sh
    		
    fi
    if [ "${install_type}" -gt 1 ]; then
    	sed -i '/on fs/ a exec /mountfs'${install_type}'.sh' work2/init.rc
    	cp mountfs${install_type}.sh work/mountfs${install_type}.sh
            sed -i "s/rOm/$ROM_NAME/g" work/mountfs${install_type}.sh
    	chmod 0777 work/mountfs${install_type}.sh
    	chmod 0750 work/init.rc
    	chmod 0644 work/ueventd.htcleo.rc
    fi
    # making new ramdisk and copying to sd card
    cd work2
    find .| cpio -o -H newc | gzip -9 > ../initrd-done.gz
    cd ..
    
    if [ "${bootloader}" != "cLK" ]; then
    	cat initrd-done.gz >> 6MB
    	cp 6MB initrd6MB.gz
    else
    	cp done2/initrd-done.gz /tmp/initrd.gz
    fi
    
    chmod 0777 initrd.gz
    if [ "${install_type}" -lt 3 ]; then
    	cp initrd6MB.gz tmp/initrd.gz
    else
    	cp initrd6MB.gz boot/initrd.gz
    	cp initrd6MB.gz boot_dir/initrd.gz
    fi
    
    
    # Copying tmp and open ramdisk folders to sdcard (NativeSD folder)
    
    mkdir -p boot/tmp

    Also this way if you want to add another way of booting all you need to do is create a mountfs.sh file and edit aroma-config.

    aroma-config
    Code:
    ### LICENSE:
    #
    # Copyright (C) 2011-2012 Ahmad Amarullah ( http://amarullz.com/ )
    #
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #      http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    #
    ### FILE INFO:
    #
    # AROMA Installer from NexusHD2 tytung was modded by
    # macs18max to include haret detection (hacked way) and 
    # clk nativesd sboot2. If using this please credit macs18max
    #
    ###
    
    
    ##
    # Forcing Device Pixelate Size
    #  defaut: floor( min( width, height ) / 160 )
    #
    ini_set("dp","3"); #-- HDPI ( 480x800 / WVGA )
    
    
    ##
    # Initializing Rom Information
    ##
    ini_set("rom_name",             "ChauTien Slimroms 4.4.2");
    ini_set("rom_version",          "Build 4");
    ini_set("rom_author",           "Chau Truong Thinh");
    ini_set("rom_device",           "HTC HD2");
    ini_set("rom_date",             "APR. 01, 2014");
    
    
    ##
    # Show Simple Splash
    # splash( 	2000,	"slim");
    
    
    ##
    # Set Small Font to Support all fonts
    #
    fontresload( "0", "ttf/Roboto-Regular.ttf;ttf/DroidSansArabic.ttf;ttf/DroidSansFallback.ttf;", "12" ); #-- Use sets of font (Font Family)
    
    
    ##
    # Set Language & Font Family
    #
    loadlang("langs/en.lang");
    fontresload( "0", "ttf/Roboto-Regular.ttf", "12" ); #-- "0" = Small Font
    fontresload( "1", "ttf/Roboto-Regular.ttf", "18" ); #-- "1" = Big Font
    
    
    ###################################################################################################################
    #
    # STEP 1 - SELECT THEME
    #
    theme("ics");
    
    
    ###################################################################################################################
    #
    # STEP 2 - SHOW ROM INFORMATION
    #
    
    # Extract ROM_NAME.prop to /tmp/aroma/ROM_NAME.prop
    ziptotmp("kernel/ROM_NAME.prop", "ROM_NAME.prop");
    ziptotmp("kernel/initrd.gz", "initrd.gz");
    ziptotmp("kernel/busybox", "busybox");
    ziptotmp("kernel/e2fsck", "e2fsck");
    ziptotmp("kernel/zImage", "zImage");
    ziptotmp("kernel/mkbootimg", "mkbootimg");
    ziptotmp("kernel/mkbootimg.sh", "mkbootimg.sh");
    ziptotmp("kernel/mountfs2.sh", "mountfs2.sh");
    ziptotmp("kernel/mountfs3.sh", "mountfs3.sh");
    ziptotmp("kernel/mountfs4.sh", "mountfs4.sh");
    ziptotmp("kernel/mountfs5.sh", "mountfs5.sh");
    ziptotmp("kernel/6MB", "6MB");
    zipexec("kernel/checksys.sh");
    setvar("bootloader", file_getprop("/tmp/nfo.prop", "bootloader"));
    
    viewbox(
      #-- Title
        "Welcome!",
    
      #-- Text
        "You are about to install the below ROM for <b>"+ini_get("rom_device")+"</b>.\n\n"+
    
        "  ROM Name\t: <b><#selectbg_g>"+ini_get("rom_name")+"</#></b>\n"+
        "  Version\t: <b><#selectbg_g>"+ini_get("rom_version")+"</#></b>\n"+
        "  Author\t: <b><#selectbg_g>"+ini_get("rom_author")+"</#></b>\n"+
        "  Update\t: <b><#selectbg_g>"+ini_get("rom_date")+"</#></b>\n\n\n"+
    
        "Bootloader\t: "+getvar("bootloader")+"\n\n"+
    
        "System NAND\t: "+getdisksize("/system","m")+" MB\n"+
        "\t Free\t: "+    getdiskfree("/system","m")+" MB\n\n"+
    
        "Data   NAND\t: "+getdisksize("/data","m")+" MB\n"+
        "\t Free\t: "+    getdiskfree("/data","m")+" MB\n\n"+
    
        "SD Card Size\t: "+getdisksize("/sdcard","m")+" MB\n"+
        "\t Free\t: "+     getdiskfree("/sdcard","m")+" MB\n\n"+
    
        " SD-EXT Size\t: "+getdisksize("/sd-ext","m")+" MB\n"+
        "\t Free\t: "+     getdiskfree("/sd-ext","m")+" MB\n\n"+
    	
    	"SD-EXT2 Size\t: "+getdisksize("/sd-ext2","m")+" MB\n"+
        "\t Free\t: "+     getdiskfree("/sd-ext2","m")+" MB\n\n\n"+
    
        "Press Next to Continue the Installation...",
    
      #-- Icon
        "icons/welcome"
    );
    
    
    ###################################################################################################################
    #
    # STEP 3 - SHOW SELECTBOX - Install Type
    #
    selectbox(
      #-- Title
        "Install Type",
    
      #-- Sub Title
        "Please Select the install type:",
    
      #-- Icon
        "icons/apps",
    
      #-- Will be saved in /tmp/aroma/installtype.prop
        "installtype.prop",
     
      #-- Group 1
        "Install Location", "", 2,                                                    #-- Group 1. key = "selected.1"
    
        "NAND",
          "[email protected], [email protected], [email protected]\nFor T-Mobile USA HD2 (LEO 1024)",    0, #-- selected.1 = 1
    
        "NAND with DataOnEXT",
          "[email protected], [email protected], [email protected]\nFor EU/International HD2 (LEO 512)", 0, #-- selected.1 = 2
    
        "NativeSD (Everything on the SD card)",
          "[email protected], [email protected], [email protected]\nFor high speed read/write SD Card", 0,  #-- selected.1 = 3
    	  
    	"DirectSD (Everything on the SD card)",
          "[email protected], [email protected], [email protected]\nFor high speed read/write SD Card", 1,  #-- selected.1 = 4
    	"DirectSD (Everything on the SD card)",
          "[email protected], [email protected], [email protected]\nFor high speed read/write SD Card", 0  #-- selected.1 = 5
    );
    
    if (prop("installtype.prop", "selected.1") == "1" || 
        prop("installtype.prop", "selected.1") == "2") then
      writetmpfile("kernel.prop", "NAND=yes");
      zipexec("kernel/nativesd.sh");
    else
      writetmpfile("kernel.prop", "NAND=no");
    endif;
    
    ##############################
    # Mount the SD-EXT partition #
    ##############################
    
    if (prop("installtype.prop", "selected.1") == "2" ||
        prop("installtype.prop", "selected.1") == "3") then
    
      pleasewait("Mounting the SD-EXT Partition...");
      zipexec("kernel/SD-EXT_mounter.sh");
      setvar("mount_result", getvar("exec_buffer"));
      zipexec("kernel/nativesd.sh");
    
      if file_getprop("/tmp/mount.prop", "status") != "mounted" then
    
        #######################
        # No SD-EXT Partition #
        #######################
    
        # Set Next Text to 'Exit'
        ini_set("text_next", "Exit");
    
        textbox(
          "Mounting SD-EXT failed!",
          "Please create an EXT4 partition (mmcblk0p2) on the SD Card first.",
          "icons/alert",
          "Error messages:\n\n"+getvar("mount_result")
        );
    
        #-- Back to Menu
        back("1");
    
      endif;
    
    endif;
    
    if (prop("installtype.prop", "selected.1") == "4" ||
        prop("installtype.prop", "selected.1") == "5") then
    
      pleasewait("Mounting the SD-EXT Partition...");
      zipexec("kernel/DirectSD_mounter.sh");
      setvar("mount_result", getvar("exec_buffer"));
      zipexec("kernel/nativesd.sh");
    
      if file_getprop("/tmp/mount.prop", "status") != "mounted" then
    
        #######################
        # No SD-EXT Partition #
        #######################
    
        # Set Next Text to 'Exit'
        ini_set("text_next", "Exit");
    
        textbox(
          "Mounting SD-EXT failed!",
          "Please create an EXT4 partition (mmcblk0p2) on the SD Card first.",
          "icons/alert",
          "Error messages:\n\n"+getvar("mount_result")
        );
    
        #-- Back to Menu
        back("1");
    
      endif;
    
    endif;
    
    # Swap partition activation - run the check for sdcard swap partition
    pleasewait("Checking SDCard for Swap Partition.");
    zipexec("mods/swap-partition-activator/install/checkforswap.sh");
    ###################################################################################################################
    #
    # STEP 4 - SHOW SELECTBOX - ROM Mods
    #
    selectbox(
      #-- Title
        "ROM Mods",
      
      #-- Sub Title
        "Please Select the ROM Mods:",
      
      #-- Icon
        "icons/personalize",
      
      #-- Will be saved in /tmp/aroma/mods.prop
        "mods.prop",
     
      #-- Group 1
        "Default Connection Type","",2,
          "RMNET Connection",
            "Please Choose RMNET for MAGLDR bootloader.",	iif((file_getprop("/tmp/nfo.prop", "bootloader") == "MAGLDR"), 1, 0),
          "PPP Connection",
            "All bootloaders support PPP.",           	iif((file_getprop("/tmp/nfo.prop", "bootloader") == "MAGLDR"), 0, 1),
    
    		
      # Group 2
      "Activate RAM Pages Swapping","",2,
        "Yes",
        "You must have a pre-made swap partition on your SDcard!",  iif((file_getprop("/tmp/checkforswap.prop", "swap.present") == "yes"), 1, 0),
        "No",
        "Swapping will be deactivated.\n\n", iif((file_getprop("/tmp/checkforswap.prop", "swap.present") == "no"), 1, 0),
     
     
     #-- Group 3
        "Wipe","",2,
          "Wipe Dalvik-Cache",
            "Select it to wipe Dalvik-Cache.",        	1,
          "Wipe Data/Factory Reset",
            "Select it to wipe data/factory reset.",  	0,
          "No Wipe",
            "Select it to keep everything.",          	0
    
    );
    
    ####################
    # Installation Ready
    ####################
    ini_set("text_next", "Install Now");
    viewbox(
    	"Installation Ready",
    	"The wizard is ready to begin installation.\n\n"+
    	"Press <b>Install Now</b> to begin the installation.\n\n"+
    	"If you want to review or change any of your installation settings, press <b>Back</b> or Press Menu Key -> Quit Installation to exit the wizard.",
    	"@install"
    );
    
    
    #####################
    # Start Install
    #####################
    ini_set("text_next", "Finish");
    install(
    	"Installing",
    	"<b>"+ini_get("rom_name")+"</b> is being installed.\n\n"+
    	"Please wait while installation wizard installs <b>"+ini_get("rom_name")+
    	"</b>. This may take several minutes.",
    	"@install",
    	"The installation wizard has successfully installed <b>"+ini_get("rom_name")
    );
    
    
    # Set Next Text fo Exit
    ini_set("text_next", "Exit");
    
    viewbox(
      "Installation Completed",
      "<#080>Congratulation</#>\n\n"+
      "Please press Exit and Reboot your HD2",
      "icons/info"
    );

    Detailed rundown of process.
    Aroma config copies all pertinent files to /aroma config.
    Choices are made by user in aroma installer, specified mount script is run and nativesd.sh is executed as long as an install type is chosen.
    Nativesd.sh reads the install type and bootloader and modifies the nand ramdisk accordingly, mkbootimg.sh is run if using clk.
    Updater-script then runs - it has been stripped down so all it should do is the copying of all the other ROM stuff from the zip (system, sdcard, etc.), runs a script to copy initrd and zImage to /boot (if using magldr). Should theoretically be able to strip updater-script down further...

    Attached is the modification for SlimKat - (all credits to ROM dev.)
    kernel folder fully replaces the one in the ROM zip. META-INF and system are merged.
    All essentially untested - will post the recovery needed for f2fs install in due course.

    Edit. new zip - moved around a few things.

    Edit. modified nativesd.sh on the assumption that the aroma folder can only be written to be aroma.
    Code:
    #!/bin/sh
    
    export ROM_NAME=` cat 'ROM_NAME.prop' | sed 's/ROM_NAME=//g' `
    export install_type=` cat 'installtype.prop' | sed 's/selected.1=//g' `
    export bootloader=` cat 'nfo.prop' | sed 's/bootloader=//g' `
    
    cp /tmp/aroma/zImage /tmp/zImage
    mkdir -p /tmp/work/ing
    cp /tmp/aroma/initrd.gz /tmp/initrd-test.gz
    cd /tmp/work/ing
    # unzipping nand kernel
    gzip -d -c ../initrd-test.gz | cpio -i -d
    mkdir bin
    cd ..
    cp /tmp/aroma/busybox ing/bin/busybox
    cp /tmp/aroma/e2fsck ing/bin/e2fsck
    chmod 0777 ing/bin/busybox
    chmod 0777 ing/bin/e2fsck
    # Modifying ramdisk to not use yaffs, and use sd partitions instead.
    if [ "${install_type}" -gt 2 ]; then
    		sed -i '/[email protected]/s/^/#/' ing/ueventd.htcleo.rc
    		sed -i '/mount yaffs2/s/^/#/
    		s/#    #/# /g' ing/init.rc
    		sed -i "s/rOm/$ROM_NAME/g" ing/mountfs${install_type}.sh
    		sed -i 's/auto/ext4/g' ing/mountfs${install_type}.sh
    fi
    # Checking if anything other than nand is to be installed
    if [ "${install_type}" -gt 1 ]; then
    	sed -i '/on fs/ a exec /mountfs'${install_type}'.sh' ing/init.rc
    	cp /tmp/aroma/mountfs${install_type}.sh ing/mountfs${install_type}.sh
    	sed -i "s/rOm/$ROM_NAME/g" ing/mountfs${install_type}.sh
    	chmod 0777 ing/mountfs${install_type}.sh
    	chmod 0750 ing/init.rc
    	chmod 0644 ing/ueventd.htcleo.rc
    fi
    # Building new ramdisk
    cd ing
    find .| cpio -o -H newc | gzip -9 > ../initrd-done.gz
    cd ..
    # Checking bootloader
    if [ "${bootloader}" != "cLK" ]; then
    	cp /tmp/aroma/6MB /tmp/work/6MB
    	cat initrd-done.gz >> 6MB
    	cp 6MB initrd6MB.gz
    else
    	cp initrd-done.gz /tmp/initrd.gz
    	cp /tmp/aroma/mkbootimg /tmp/mkbootimg
    	cp /tmp/aroma/mkbootimg.sh /tmp/mkbootimg.sh
    	chmod 0755 /tmp/mkbootimg
    	chmod 0755 /tmp/mkbootimg.sh
    	exec /tmp/mkbootimg.sh
    fi
    #Checking if nand install
    if [ "${install_type}" -lt 3 ]; then
    	cp initrd6MB.gz tmp/initrd.gz
    else
    	cp initrd6MB.gz boot/initrd.gz
    	cp initrd6MB.gz boot_dir/initrd.gz
    	cp /tmp/zImage boot/zImage
    	cp /tmp/zImage boot_dir/zImage
    fi
    # Copying tmp and open ramdisk folders to sdcard (NativeSD folder)
    mkdir -p boot/tmp
    cp -r /tmp/* /boot/tmp/

    Edit - f2fs arm binaries (v.1.2) I build are found here => http://ubuntuone.com/3EuJUW5lV9MMj1WJzhzFYo for those that know what to do with them. New zip added.
    5
    Attached is a zip that should do all the rest.
    It needs to be flashed directly following a ROM with the modifications in #1
    It makes us of /system/build.prop and /boot_dir, as well as /boot (and sboot if clk booting Native/DirectSD).

    Contents of nativesd.sh if you're curious (was contemplating whether to make this (or a derivative thereof) into a binary and bundle it with a recovery):
    Code:
    #!/sbin/sh
    
    ## Bootloader check (copy of checksys.sh)
    echo "bootloader=MAGLDR" > /tmp/nfo.prop
    
    output=`grep -i "clk" /proc/cmdline`
    if [ -n "$output" ]; then
    	echo "bootloader=cLK" > /tmp/nfo.prop
    fi
    
    [COLOR="Red"]###Should remove this haret stuff and treat it as if it's magldr...[/COLOR] 
    output=`grep -i "haret" /proc/cmdline`
    if [ -n "$output" ]; then
    	echo "bootloader=HaRet" > /tmp/nfo.prop
    fi
    
    ## Exporting variables
    ROM_NAME=` cat /system/build.prop | grep ro.build.display.id | awk '{print $(NF-1)}' | sed 's/\(\[\|\]\)//g' `
    type=` cat /system/build.prop | grep ro.build.display.id | awk '{print $(NF)}' | sed 's/\(\[\|\]\)//g' `
    bootloader=` cat '/tmp/nfo.prop' | sed 's/bootloader=//g' `
    
    ## Ending if bootloader is haret
    if $bootloader='HaRet' then
    echo 'This does not currently work with HaRet (for now)'
    exit 0
    fi
    
    ## Changing install_type to numbered value
    if $type='NAND' then
    	install_type='1'
    fi
    if $type='DataOnExt' then
    	install_type='2'
    fi
    if $type='NativeSD' then
    	install_type='3'
    fi
    if $type='DirectSD' then
    	install_type='4'
    fi
    
    ## Copying zImage from /boot_dir if one wasn't added to zip 
    if [ ! -f "/tmp/zImage" ]; then        
      cp /boot_dir/zImage/ /tmp/zImage
    fi
    if [ ! -f "/tmp/zImage" ]; then        
      cp /boot_dir/initrd.gz/ /tmp/initrd.gz
    fi
    
    ## Checking if zImage is for 3.0.x
    if [ "md5sum /tmp/zImage | cut -d ' ' -f '1'" != "1cb7bcf80845f0178b99f7b9a5f80669" ]
    then 
    rm /tmp/6MB
    fi
    
    ## Setting up working directory
    cp /tmp/initrd.gz /tmp/initrd-$ROM_NAME.gz
    mkdir -p /tmp/work
    cd /tmp/work
    
    ## Unzipping nand kernel
    gzip -d -c ../initrd-$ROM_NAME.gz | cpio -i -d
    mkdir bin
    cp /tmp/busybox bin/busybox
    cp /tmp/e2fsck bin/e2fsck
    cp /tmp/mountfs-${install}.sh mountfs-${install}.sh
    chmod 0777 mountfs${install}.sh
    chmod 0777 bin/busybox
    chmod 0777 bin/e2fsck
    
    ## Modifying ramdisk to not use yaffs, and use sd partitions instead.
    if [ "${install_type}" -gt 2 ]; then
    		sed -i '/[email protected]/s/^/#/' ueventd.htcleo.rc
    		sed -i '/mount yaffs2/s/^/#/
    		s/#    #/# /g' init.rc
    		sed -i "s/rOm/$ROM_NAME/g" mountfs-${install}.sh
    fi
    
    ## Checking if anything other than nand is to be installed
    if [ "${install_type}" -gt 1 ]; then
    	sed -i '/on fs/ a exec /mountfs-'${install}'.sh' init.rc
    	sed -i "s/rOm/$ROM_NAME/g" mountfs-${install}.sh
    	chmod 0750 init.rc
    	chmod 0644 ueventd.htcleo.rc
    fi
    
    # Building new ramdisk
    find .| cpio -o -H newc | gzip -9 > ../initrd-done.gz
    cd ..
    
    # Checking bootloader
    if [ "${bootloader}" != "cLK" ]; then
    	cat initrd-done.gz >> 6MB
    	cp 6MB /boot/initrd.gz
    	cp /tmp/zImage /boot/zImage
    	#Checking if nand install
    		if [ "${install_type}" -gt 2 ]; then
    			cp 6MB /boot_dir/initrd.gz
    			cp /tmp/zImage /boot_dir/zImage
    		fi
    else     
    	cp initrd-done.gz /tmp/initrd.gz
    	chmod 0755 /tmp/mkbootimg
    	chmod 0755 /tmp/mkbootimg.sh
            exec /tmp/mkbootimg.sh
    		if [ "${install_type}" -lt 3 ]; then
    		    flash_image boot /tmp/boot.img else
    	            flash_image sboot /tmp/boot.img 
    	        fi		
    fi
    
    cp /tmp/initrd-$ROM_NAME.gz /tmp/initrd.gz
    rm -r /tmp/work/*
    There are likely some issues. Feel free to report back.

    A few things (more of use for devs I suppose): adding an initrd.gz or zImage into the zip will overwrite the one used by the previously installed ROM.

    Also the only way I could come up for checking if the kernel is 3.0.x or not (and thus need the 6MB magldr offset) is using md5sum, obviously this means that this md5sum check will need to be changed for every kernel (I suppose unless there's isn't any other option I could make a whitelisted md5sum file for 3.0.x kernels and/or have devs post md5sums with there kernels).

    As it is the zip attached should work with all 2.x kernels and the kernel with md5sum of 1cb7bcf80845f0178b99f7b9a5f80669.

    (NB. Device died again before testing - could anyone post/PM the outcome of md5sum for any file i.e. 'md5sum /system/build.prop' - as I'm not sure if just the md5sum is outputted of if the filename is as well.)

    For the moment this should work as is with cLK/magldr for DirectSD and NativeSD (need to fix for NAND/DataOnExt).
    If you want use NAND/DataOnExt then add the NAND initrd.gz from desired ROM into the install folder of the zip.
    NB NAND install on magldr will need a boot partion of 7.5MB (8 to be safe) - when the script is fixed that is.


    Legacy
    Updater-script
    Code:
    ###
    #
    # AROMA Installer
    #   (C) 2011-2012 by Ahmad Amarullah
    #       amarullz - xda-developers
    #
    ###
    #
    # AROMA Installer Script for 
    #   (C) 2012-2013 by tytung - xda-developers (tytung @ gmail.com)
    #     
    ###
    
    ui_print("------------------------------------------------");
    ui_print("                                              ");
    ui_print("                                              ");
    ui_print("------------------------------------------------");
    
    ################
    # NAND Install #
    ################
    
    if file_getprop("/tmp/aroma/installtype.prop", "selected.1") == "1" then
    
      ui_print("@  Installing to NAND...");
      ui_print("  Mounting NAND partitions...");
    
      
      format("yaffs2", "MTD", "system");
    
      mount("yaffs2", "MTD", "system", "/system");
      mount("yaffs2", "MTD", "userdata", "/data");
    
      # Wipe Dalvik-Cache
      if file_getprop("/tmp/aroma/mods.prop", "selected.4") == "1" then
        delete_recursive("/data/dalvik-cache");
        ui_print("  Dalvik-Cache wiped.");
      endif;
    
      # Wipe Data/Factory Reset
      if file_getprop("/tmp/aroma/mods.prop", "selected.4") == "2" then
        unmount("/data");
        format("yaffs2", "MTD", "userdata");
        mount("yaffs2", "MTD", "userdata", "/data");
        delete_recursive("/sdcard/.android_secure");
        ui_print("  Data wiped.");
      endif;
    
      show_progress(0.9, 1400);
      ui_print("  Copying files...");
      package_extract_dir("system", "/system");
      package_extract_dir("data", "/data");
      package_extract_dir("mods/nand", "/sdcard");
      show_progress(0.1, 5);
    
    endif;
    
    #####################
    # DataOnEXT Install #
    #####################
    
    if file_getprop("/tmp/aroma/installtype.prop", "selected.1") == "2" then
    
      ui_print("@  Installing to NAND and SD-EXT...");
      ui_print("  Mounting NAND and SD-EXT partitions...");
    
      package_extract_file("kernel/mount_DataOnEXT.sh", "/tmp/mount_DataOnEXT.sh");
      set_perm(0, 0, 0777, "/tmp/mount_DataOnEXT.sh");
      run_program("/tmp/mount_DataOnEXT.sh");
    
      if file_getprop("/tmp/nfo.prop", "DataOnEXT") == "true" then
    
        format("yaffs2", "MTD", "system");  
    	
        mount("yaffs2", "MTD", "system", "/system");
    
        # Wipe Dalvik-Cache
        if file_getprop("/tmp/aroma/mods.prop", "selected.4") == "1" then
          delete_recursive("/data/dalvik-cache");
          ui_print("  Dalvik-Cache wiped.");
        endif;
    
        # Wipe Data/Factory Reset
        if file_getprop("/tmp/aroma/mods.prop", "selected.4") == "2" then
          delete_recursive("/data");
          delete_recursive("/sdcard/.android_secure");
          ui_print("  Data wiped.");
        endif;
    
        show_progress(0.9, 1400);
        ui_print("  Copying files...");
        package_extract_dir("system", "/system");
        package_extract_dir("data", "/data");  
        package_extract_dir("mods/data2ext", "/sdcard");
        show_progress(0.1, 5);
    
        # Append " [DataOnEXT]" to the ROM name
        package_extract_file("mods/set_build_prop_DataOnEXT.sh", "/tmp/set_build_prop_DataOnEXT.sh");
        set_perm(0, 0, 0777, "/tmp/set_build_prop_DataOnEXT.sh");
        run_program("/tmp/set_build_prop_DataOnEXT.sh");
    
      endif;
    
    endif;
    
    #####################################
    # NAND MAGLDR or cLK Kernel install #
    #####################################
    
    if file_getprop("/tmp/aroma/kernel.prop", "NAND") == "yes" then
    
      # check bootloader
      package_extract_file("kernel/checksys.sh", "/tmp/checksys.sh");
      set_perm(0, 0, 755, "/tmp/checksys.sh");
      run_program("/tmp/checksys.sh");
    
      if file_getprop("/tmp/nfo.prop", "bootloader") == "cLK" then
    
        ui_print("@  cLK Bootloader found.");
        ui_print("  Flashing cLK kernel...");
    
    	# not mounted but just in case :)
        unmount("/boot");
    	
    
        assert(
          package_extract_file("kernel/zImage", "/tmp/zImage"),
          package_extract_file("kernel/mkbootimg", "/tmp/mkbootimg"),
          package_extract_file("kernel/mkbootimg.sh", "/tmp/mkbootimg.sh"));
        set_perm(0, 0, 0755, "/tmp/mkbootimg");
        set_perm(0, 0, 0755, "/tmp/mkbootimg.sh");
        assert(
          run_program("/tmp/mkbootimg.sh"),
          write_raw_image("/tmp/boot.img", "boot"),
          delete("/tmp/boot.img"));
    
      else
    
        ui_print("@  MAGLDR Bootloader found.");
        ui_print("  Flashing MAGLDR kernel...");
    
    	# prepare boot partition
        format("yaffs2", "MTD", "boot");
        mount("yaffs2", "MTD", "boot", "/boot");
    	
        
        package_extract_file("kernel/zImage", "/boot/zImage");
    
      endif;
    
    endif;
    
    ####################
    # NativeSD Install #
    ####################
    
    if file_getprop("/tmp/aroma/installtype.prop", "selected.1") == "3" then
    
      ui_print("@  Installing to SD-EXT (NativeSD)...");
      ui_print("  Checking & Mounting SD-EXT Partition...");
    
      package_extract_file("kernel/mount_NativeSD.sh", "/tmp/mount_NativeSD.sh");
      set_perm(0, 0, 0777, "/tmp/mount_NativeSD.sh");
      run_program("/tmp/mount_NativeSD.sh");
    
      if file_getprop("/tmp/nfo.prop", "NativeSD") == "true" then
    
        # Wipe Dalvik-Cache
        if file_getprop("/tmp/aroma/mods.prop", "selected.4") == "1" then
          delete_recursive("/data/dalvik-cache");
          ui_print("  Dalvik-Cache wiped.");
        endif; # Wipe Dalvik-Cache
    
        # Wipe Data/Factory Reset
        if file_getprop("/tmp/aroma/mods.prop", "selected.4") == "2" then
          delete_recursive("/data");
          ui_print("  Data wiped.");
        endif; # Wipe Data/Factory Reset
    
        show_progress(0.9, 1400);
        ui_print("  Copying files...");
        package_extract_file("kernel/zImage", "/boot/zImage");
        package_extract_file("kernel/zImage", "/boot_dir/zImage");
        package_extract_dir("sdcard", "/sdcard");
        package_extract_dir("mods/nativesd", "/sdcard");
    
        package_extract_dir("system", "/system");
        package_extract_dir("data", "/data");   
        package_extract_file("mods/app/NativeSDBoot.apk", "/system/app/NativeSDBoot.apk");
        show_progress(0.1, 5);
    
        # Append " [NativeSD]" to the ROM name
        package_extract_file("mods/set_build_prop_NativeSD.sh", "/tmp/set_build_prop_NativeSD.sh");
        set_perm(0, 0, 0777, "/tmp/set_build_prop_NativeSD.sh");
        run_program("/tmp/set_build_prop_NativeSD.sh");
    	
      endif;
    
    endif;
    
    
    ####################
    # DirectSD Install #
    ####################
    
    if file_getprop("/tmp/aroma/installtype.prop", "selected.1") == "4" || file_getprop("/tmp/aroma/installtype.prop", "selected.1") == "5" then
    
      ui_print("@  Installing to SD-EXT (DirectSD)...");
      ui_print("  Checking & Mounting SD-EXT Partition...");
    
      package_extract_file("kernel/mount_DirectSD.sh", "/tmp/mount_DirectSD.sh");
      set_perm(0, 0, 0777, "/tmp/mount_DirectSD.sh");
      run_program("/tmp/mount_DirectSD.sh");
    
      if file_getprop("/tmp/nfo.prop", "DirectSD") == "true" then
    
        # Wipe Dalvik-Cache
        if file_getprop("/tmp/aroma/mods.prop", "selected.4") == "1" then
          delete_recursive("/data/dalvik-cache");
          ui_print("  Dalvik-Cache wiped.");
        endif; # Wipe Dalvik-Cache
    
        # Wipe Data/Factory Reset
        if file_getprop("/tmp/aroma/mods.prop", "selected.4") == "2" then
          delete_recursive("/data");
          ui_print("  Data wiped.");
        endif; # Wipe Data/Factory Reset
    
        show_progress(0.9, 1400);
        ui_print("  Copying files...");
        package_extract_file("kernel/zImage", "/boot/zImage");
        package_extract_file("kernel/zImage", "/boot_dir/zImage");
        package_extract_dir("sdcard", "/sdcard");
        package_extract_dir("mods/DirectSD", "/sdcard");
    
        package_extract_dir("system", "/system");
        package_extract_dir("data", "/data");   
        package_extract_file("mods/app/DirectSDBoot.apk", "/system/app/DirectSDBoot.apk");
        show_progress(0.1, 5);
    
        # Append " [DirectSD]" to the ROM name
        package_extract_file("mods/set_build_prop_DirectSD.sh", "/tmp/set_build_prop_DirectSD.sh");
        set_perm(0, 0, 0777, "/tmp/set_build_prop_DirectSD.sh");
        run_program("/tmp/set_build_prop_DirectSD.sh");
    	
      endif;
    
    endif;
    
    
    ########################
    # Connection Selection #
    ########################
    set_progress(0.65);
    if file_getprop("/tmp/aroma/mods.prop", "selected.1") == "1" then
        delete("/system/ppp");
        delete("/system/default.prop");
        delete("/system/etc/init.d/97ppp");
        ui_print("@  RMNET installed.");
    endif;
    
    if file_getprop("/tmp/aroma/mods.prop", "selected.1") == "2" then
    
      package_extract_dir("mods/clk-ppp-patch", "/system");
      ui_print("@  PPP installed.");
    
    endif;
    
    
    ######################
    # Softkeys Selection #
    ######################
    
    ui_print("@  Setting Softkeys...");
    if file_getprop("/tmp/aroma/mods.prop", "selected.2") == "1" then
    
      package_extract_file("mods/enable_softkeys.sh", "/tmp/enable_softkeys.sh");
      set_perm(0, 0, 755, "/tmp/enable_softkeys.sh");
      run_program("/tmp/enable_softkeys.sh");
      ui_print("  Softkeys enabled.");
    
    endif;
    
    if file_getprop("/tmp/aroma/mods.prop", "selected.2") == "2" then
    
      package_extract_file("mods/disable_softkeys.sh", "/tmp/disable_softkeys.sh");
      set_perm(0, 0, 755, "/tmp/disable_softkeys.sh");
      run_program("/tmp/disable_softkeys.sh");
      ui_print("  Softkeys disabled.");
    
    endif;
    
    
    ########################
    # SWAPPING Selection #
    ########################
    if file_getprop("/tmp/aroma/mods.prop","selected.3") == "1"  then
    ui_print("@  Configuring Ram Pages Swapping...");
    		
    package_extract_file("mods/swap-partition-activator/install/installswap.sh", "/tmp/installswap.sh");
    set_perm(0, 0, 0777, "/tmp/installswap.sh");
    run_program("/tmp/installswap.sh");
    
    
    		if ( file_getprop("/tmp/hardswap.prop", "swap.present") == "yes"  )
    		then
    			if ( file_getprop("/tmp/hardswap.prop", "swap.formatted") == "yes"  ) then
    ui_print("  Swap partition formatted.");
    			else
    ui_print("  Error: Can't format existing swap partition!");
    				abort("  Aborting...");
    			endif;
    
    		else
    ui_print("  Error: No swap partition found on SDcard!");
    			abort("  Aborting...");
    		endif;
    
    
    		# We're ready for the startup script to do ./swapon
    
    		package_extract_dir("mods/swap-partition-activator/etc", "/system/etc");
    		set_perm(0, 0, 0755, "/system/etc/init.d/99swap");
    ui_print("  Swap-on script copied to /etc/init.d.");
    
    endif; 
    
    
    if file_getprop("/tmp/aroma/mods.prop", "selected.3") == "2" then
    ui_print("  Removing swap...");
    		delete("/system/etc/init.d/99swap");
    ui_print("  Swap startup script deleted.");
    endif; 
    
    ###################
    # Data apps check #
    ###################
    set_progress(0.85);
    package_extract_file("mods/check_data_apps.sh", "/tmp/check_data_apps.sh");
    set_perm(0, 0, 0777, "/tmp/check_data_apps.sh");
    run_program("/tmp/check_data_apps.sh");
    
    ################################
    # ROM Symlinks and Permissions #
    ################################
    
    ui_print("@  Setting symlinks and permissions...");
    ui_print("  Setting symlinks...");
    
    symlink("../xbin/su", "/system/bin/su");
    symlink("Roboto-Bold.ttf", "/system/fonts/DroidSans-Bold.ttf");
    symlink("Roboto-Regular.ttf", "/system/fonts/DroidSans.ttf");
    symlink("busybox", "/system/xbin/[", "/system/xbin/[[",
            "/system/xbin/adjtimex", "/system/xbin/arp", "/system/xbin/ash",
            "/system/xbin/awk", "/system/xbin/base64", "/system/xbin/basename",
            "/system/xbin/bbconfig", "/system/xbin/blkid", "/system/xbin/blockdev",
            "/system/xbin/brctl", "/system/xbin/bunzip2", "/system/xbin/bzcat",
            "/system/xbin/bzip2", "/system/xbin/cal", "/system/xbin/cat",
            "/system/xbin/catv", "/system/xbin/chattr", "/system/xbin/chgrp",
            "/system/xbin/chmod", "/system/xbin/chown", "/system/xbin/chroot",
            "/system/xbin/clear", "/system/xbin/cmp", "/system/xbin/comm",
            "/system/xbin/cp", "/system/xbin/cpio", "/system/xbin/crond",
            "/system/xbin/crontab", "/system/xbin/cut", "/system/xbin/date",
            "/system/xbin/dc", "/system/xbin/dd", "/system/xbin/depmod",
            "/system/xbin/devmem", "/system/xbin/df", "/system/xbin/diff",
            "/system/xbin/dirname", "/system/xbin/dmesg", "/system/xbin/dnsd",
            "/system/xbin/dos2unix", "/system/xbin/du", "/system/xbin/echo",
            "/system/xbin/ed", "/system/xbin/egrep", "/system/xbin/env",
            "/system/xbin/expand", "/system/xbin/expr", "/system/xbin/false",
            "/system/xbin/fbsplash", "/system/xbin/fdisk", "/system/xbin/fgrep",
            "/system/xbin/find", "/system/xbin/flash_lock",
            "/system/xbin/flash_unlock", "/system/xbin/flashcp",
            "/system/xbin/flock", "/system/xbin/fold", "/system/xbin/free",
            "/system/xbin/freeramdisk", "/system/xbin/fstrim", "/system/xbin/fsync",
            "/system/xbin/ftpget", "/system/xbin/ftpput", "/system/xbin/fuser",
            "/system/xbin/getopt", "/system/xbin/grep", "/system/xbin/groups",
            "/system/xbin/gunzip", "/system/xbin/gzip", "/system/xbin/halt",
            "/system/xbin/head", "/system/xbin/hexdump", "/system/xbin/id",
            "/system/xbin/ifconfig", "/system/xbin/inetd", "/system/xbin/insmod",
            "/system/xbin/install", "/system/xbin/ionice", "/system/xbin/iostat",
            "/system/xbin/ip", "/system/xbin/kill", "/system/xbin/killall",
            "/system/xbin/killall5", "/system/xbin/less", "/system/xbin/ln",
            "/system/xbin/losetup", "/system/xbin/ls", "/system/xbin/lsattr",
            "/system/xbin/lsmod", "/system/xbin/lsusb", "/system/xbin/lzcat",
            "/system/xbin/lzma", "/system/xbin/lzop", "/system/xbin/lzopcat",
            "/system/xbin/man", "/system/xbin/md5sum", "/system/xbin/mesg",
            "/system/xbin/mkdir", "/system/xbin/mke2fs", "/system/xbin/mkfifo",
            "/system/xbin/mkfs.ext2", "/system/xbin/mkfs.vfat",
            "/system/xbin/mknod", "/system/xbin/mkswap", "/system/xbin/mktemp",
            "/system/xbin/modinfo", "/system/xbin/modprobe", "/system/xbin/more",
            "/system/xbin/mount", "/system/xbin/mountpoint", "/system/xbin/mpstat",
            "/system/xbin/mv", "/system/xbin/nanddump", "/system/xbin/nandwrite",
            "/system/xbin/nbd-client", "/system/xbin/netstat", "/system/xbin/nice",
            "/system/xbin/nohup", "/system/xbin/nslookup", "/system/xbin/ntpd",
            "/system/xbin/od", "/system/xbin/patch", "/system/xbin/pgrep",
            "/system/xbin/pidof", "/system/xbin/ping", "/system/xbin/pipe_progress",
            "/system/xbin/pkill", "/system/xbin/pmap", "/system/xbin/poweroff",
            "/system/xbin/printenv", "/system/xbin/printf", "/system/xbin/ps",
            "/system/xbin/pstree", "/system/xbin/pwd", "/system/xbin/pwdx",
            "/system/xbin/rdev", "/system/xbin/readlink", "/system/xbin/realpath",
            "/system/xbin/renice", "/system/xbin/reset", "/system/xbin/resize",
            "/system/xbin/rev", "/system/xbin/rm", "/system/xbin/rmdir",
            "/system/xbin/rmmod", "/system/xbin/route", "/system/xbin/run-parts",
            "/system/xbin/rx", "/system/xbin/sed", "/system/xbin/seq",
            "/system/xbin/setconsole", "/system/xbin/setserial",
            "/system/xbin/setsid", "/system/xbin/sh", "/system/xbin/sha1sum",
            "/system/xbin/sha256sum", "/system/xbin/sha3sum",
            "/system/xbin/sha512sum", "/system/xbin/sleep", "/system/xbin/sort",
            "/system/xbin/split", "/system/xbin/stat", "/system/xbin/strings",
            "/system/xbin/stty", "/system/xbin/sum", "/system/xbin/swapoff",
            "/system/xbin/swapon", "/system/xbin/sync", "/system/xbin/sysctl",
            "/system/xbin/tac", "/system/xbin/tail", "/system/xbin/tar",
            "/system/xbin/taskset", "/system/xbin/tee", "/system/xbin/telnet",
            "/system/xbin/telnetd", "/system/xbin/test", "/system/xbin/tftp",
            "/system/xbin/tftpd", "/system/xbin/time", "/system/xbin/timeout",
            "/system/xbin/top", "/system/xbin/touch", "/system/xbin/tr",
            "/system/xbin/traceroute", "/system/xbin/true", "/system/xbin/ttysize",
            "/system/xbin/tune2fs", "/system/xbin/umount", "/system/xbin/uname",
            "/system/xbin/uncompress", "/system/xbin/unexpand", "/system/xbin/uniq",
            "/system/xbin/unix2dos", "/system/xbin/unlzma", "/system/xbin/unlzop",
            "/system/xbin/unxz", "/system/xbin/unzip", "/system/xbin/uptime",
            "/system/xbin/usleep", "/system/xbin/uudecode", "/system/xbin/uuencode",
            "/system/xbin/vi", "/system/xbin/watch", "/system/xbin/wc",
            "/system/xbin/wget", "/system/xbin/which", "/system/xbin/whoami",
            "/system/xbin/xargs", "/system/xbin/xz", "/system/xbin/xzcat",
            "/system/xbin/yes",
            "/system/xbin/zcat");
    symlink("libGLESv2.so", "/system/lib/libGLESv3.so");
    symlink("mksh", "/system/bin/sh");
    symlink("toolbox", "/system/bin/cat", "/system/bin/chcon",
            "/system/bin/chmod", "/system/bin/chown", "/system/bin/clear",
            "/system/bin/cmp", "/system/bin/cp", "/system/bin/date",
            "/system/bin/dd", "/system/bin/df", "/system/bin/dmesg",
            "/system/bin/du", "/system/bin/getenforce", "/system/bin/getevent",
            "/system/bin/getprop", "/system/bin/getsebool", "/system/bin/grep",
            "/system/bin/hd", "/system/bin/id", "/system/bin/ifconfig",
            "/system/bin/iftop", "/system/bin/insmod", "/system/bin/ioctl",
            "/system/bin/ionice", "/system/bin/kill", "/system/bin/ln",
            "/system/bin/load_policy", "/system/bin/log", "/system/bin/ls",
            "/system/bin/lsmod", "/system/bin/lsof", "/system/bin/md5",
            "/system/bin/mkdir", "/system/bin/mkswap", "/system/bin/mount",
            "/system/bin/mv", "/system/bin/nandread", "/system/bin/netstat",
            "/system/bin/newfs_msdos", "/system/bin/notify", "/system/bin/printenv",
            "/system/bin/ps", "/system/bin/r", "/system/bin/readlink",
            "/system/bin/renice", "/system/bin/restorecon", "/system/bin/rm",
            "/system/bin/rmdir", "/system/bin/rmmod", "/system/bin/route",
            "/system/bin/runcon", "/system/bin/schedtop", "/system/bin/sendevent",
            "/system/bin/setconsole", "/system/bin/setenforce",
            "/system/bin/setprop", "/system/bin/setsebool", "/system/bin/sleep",
            "/system/bin/smd", "/system/bin/start", "/system/bin/stop",
            "/system/bin/swapoff", "/system/bin/swapon", "/system/bin/sync",
            "/system/bin/top", "/system/bin/touch", "/system/bin/umount",
            "/system/bin/uptime", "/system/bin/vmstat", "/system/bin/watchprops",
            "/system/bin/wipe");
    ui_print("  Setting permissions...");
    set_perm_recursive(0, 0, 0755, 0644, "/system");
    set_perm_recursive(0, 0, 0755, 0755, "/system/addon.d");
    set_perm_recursive(0, 2000, 0755, 0755, "/system/bin");
    set_perm(0, 3003, 02750, "/system/bin/netcfg");
    set_perm(0, 0, 0755, "/system/bin/ping");
    set_perm(0, 2000, 0750, "/system/bin/run-as");
    set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
    set_perm_recursive(0, 2000, 0755, 0755, "/system/etc/init.d");
    set_perm(0, 0, 0755, "/system/etc/init.d");
    set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor");
    set_perm(0, 0, 0644, "/system/vendor/etc/audio_effects.conf");
    set_perm_recursive(0, 0, 0755, 0644, "/system/vendor/firmware");
    set_perm(0, 2000, 0755, "/system/vendor/firmware");
    set_perm(0, 0, 0644, "/system/vendor/lib/libbt-vendor.so");
    set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
    set_perm(0, 0, 06755, "/system/xbin/librank");
    set_perm(0, 0, 06755, "/system/xbin/procmem");
    set_perm(0, 0, 06755, "/system/xbin/procrank");
    set_perm(0, 0, 06755, "/system/xbin/su");
    symlink("/system/vendor/firmware/fw_bcm4329.bin", "/system/etc/firmware/fw_bcm4329.bin");
    symlink("/system/vendor/firmware/fw_bcm4329_apsta.bin", "/system/etc/firmware/fw_bcm4329_apsta.bin");
    set_perm_recursive(0, 1001, 0755, 0775, "/system/etc/ppp");
    set_perm(0, 0, 04755, "/system/bin/pppd");
    set_perm(0, 3003, 02750, "/system/bin/netcfg");
    set_perm(0, 3004, 02755, "/system/bin/ping");
    set_perm(0, 2000, 06750, "/system/bin/run-as");
    set_perm(1002, 1002, 0440, "/system/etc/dbus.conf");
    set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
    set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor");
    set_perm(0, 2000, 0755, "/system/vendor/lib");
    set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
    ui_print("  Symlinks and permissions done.");
    
    
    ###############
    # Cleaning up #
    ###############
    
    set_progress(0.95);
    ui_print("@  Cleaning up...");
    delete("/tmp");
    ui_print("  Unmounting...");
    unmount("/boot");
    unmount("/system");
    unmount("/data");
    unmount("/DirectSD");
    ui_print("  Done.");
    
    set_progress(1.0);
    ui_print("@  Installation Complete");[/hide]
    mountfs2.sh
    Code:
    #!/bin/busybox sh
    
    # wait for 2nd partition ready
        wait /dev/block/mmcblk0p2
    	wait /dev/block/mmcblk0p2
    	wait /dev/block/mmcblk0p2
    	wait /dev/block/mmcblk0p2
    
    # check the ext4 fs
    /bin/e2fsck -p /dev/block/mmcblk0p2 > /e2fsck.log
    
    # mount the 1st (NativeSD) SD-EXT partition
    /bin/busybox mkdir -p /NativeSD
    /bin/busybox mount -t auto -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /NativeSD
    
    # mount the system data app dir
    /bin/busybox mount --bind /NativeSD/rOm/data   /data
    
    
    # cleanup
    # delete /bin to free ram
    /bin/busybox rm -rf /bin[/hide]
    mountfs5.sh
    Code:
    #!/bin/busybox sh
    
    # wait for 2nd partition ready
    wait /dev/block/mmcblk0p2
    	wait /dev/block/mmcblk0p2
    	wait /dev/block/mmcblk0p2
    	wait /dev/block/mmcblk0p2
    wait /dev/block/mmcblk0p3
    	wait /dev/block/mmcblk0p3
    	wait /dev/block/mmcblk0p3
    	wait /dev/block/mmcblk0p3
    	wait /dev/block/mmcblk0p3
    	wait /dev/block/mmcblk0p3
    
    # check the ext4 fs
    /bin/e2fsck -p /dev/block/mmcblk0p2 > /e2fsck.log
    
    # mount the 1st (NativeSD) SD-EXT partition
    /bin/busybox mkdir -p /DirectSystem
    /bin/busybox mkdir -p /DirectData
    /bin/busybox mount -t auto -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /DirectSystem
    /bin/busybox mount -t f2fs -o noatime,nodiratime,nosuid,nodev,discard /dev/block/mmcblk0p3 /DirectData
    
    # mount the system data app dir
    /bin/busybox mount --bind /DirectSystem/rOm/system /system
    /bin/busybox mount --bind /DirectData/rOm/data   /data
    
    
    # cleanup
    # delete /bin to free ram
    /bin/busybox rm -rf /bin
    [/hide]
    2
    @HypoTurtle I was just thinking, are commands "dd" and "cat" supported by our recovery. Or do we have to provide some files you get them working? Sorry I'm total noob when it comes to Linux commands

    Yea recovery is similar to a rooted rom and for the commands they use a combination of toolbox and/or busybox, dd to make the 6MB and cat to add to it works just fine. Here you can see what options are available, without needing to add any other binaries. There may be some variation depending on the toolbox/busybox compiled with the recovery I suppose, but cat and dd should be fine (as long as you don't let it default).

    ooh, i managed to mount an ext4 loop to nand using munjeni's post linked above
    Using tytung's kitkat v4.6 NativeSD, nothing android on nand. The fortest partition is 10mb.
    system.ext4 on nand?
    system.f2fs on nand?:D
    I probably need to push the files from rom.zip on pc.
    just need to edit updater script and use the patcher to edit init.rc and see if it boots:fingers-crossed:, but i am out of time tonight i think:crying:

    My approach to the ext4 looping that I added to the script (I know the installation itself wasn't working, but the looping was), was to format to ext2 and then add a journal to it. I wouldn't be 100% sure with f2fs being used with system due to permissions/security etc especially with KK, and given that it;s far from being a 3.10 kernel, perhaps if someone could try and add the f2fs patches to one of the latest kernels that might prove better that the one I compiled.
    1
    Really Great ... Thanks Man ... Just Works Perfect ... Can I use some of your Ideas for M7 development ? ... Thanks In Advance ...

    With Best Wishes
    Hitman1376​

    Feel free.
    What works exactly - all I know is that aroma-config runs without reporting an error and that nativesd.sh runs properly in ubuntu.


    I'll post the whole bundle patch that RobbieP has been trying, so anyone can try it an report any errors.

    The bundle includes:
    TWRP recovery (with f2fs enabled by kokotas)
    walter79's 3.0.x-pmem-marc1706 kernel with f2fs patches added
    modified updater-script and aroma config
    nativesd and mountfs files.
    1
    I couldn't get it to wipe, flash-erase didn't work,so skipped it thinking dd zeros would do the job. Will try again tomorrow, thanks.
    Edit; I did try "mount ext4 /dev/block/loop6 /system rw" instead of "mount -t ext4 /dev/block/loop6 /system" in init.rc but same. Was thinking to put mount stuff in an init.*.rc file and import it at the start of init.rc

    Edit; It seems that after the partition is unmounted, you can't mount it again. The only way to get it to mount again is to reformat to ext4 first. This occurs after umount and after a reboot. Can't see any way around that. It was worth trying though, even without an ftl.
    I did find ubifs http://en.wikipedia.org/wiki/UBIFS and http://www.linux-mtd.infradead.org/doc/ubifs.html which might be interesting.
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone