[30 OCT 2012][DEV] NativeSD Rom Boot Script for HD2

Search This thread

securecrt

Senior Member
Aug 4, 2010
763
2,762
Shanghai
This is an idea to make the HD2 faster and fancy, I worked with Xylograph to make it more usable and easy to implement by common users.

Index


  • Post 1 Introduction
  • Post 2 ROMs, Scripts, Installer template for Devs by Xylograph
  • Post 3 Q&A

Introduction
We have SD ROMs for very long time, but I think most of the people should agree with me that the SD ROMs are slower than NAND ROMs. because the SD ROMs use system.ext4 and data.ext4 files to store all the ROM contant on the FAT partition, the IO access is the bottleneck.
My Class10 SD card has 10MB/s R/W speed, but the NAND flash R/W speed is only about 4MB/s. so if we can directly install the ROMs to SDCARD and boot from SDCARD we will get lots of benifits:​

  1. Faster Read/Write speed than NAND ROMs
  2. Bigger data partition for user space (depends on how big the ext4 partition on SDCARD)
  3. Install servel ROMs at the same time. and each ROM share the same space
  4. Muilt-boot support, easy to switch between the ROMs been installed.

The NativeSD Rom is a new kind of ROM it needs an ext4 partition on your SDCARD.

This thread will tell you how to install a ROM to SDCARD and give some script templates for ROM Devs to make the ROM installer which can support install the ROM to NAND flash or SD/EXT4.

Install the ROM to SD/EXT4 will not effact the ROM(WM or Android) on NAND flash, NativeSD should support run from MAGLDR CLK or WM6.5(need test).

Important Notes:
Backup all the SDCARD content to PC before you create the ext4 partition on SDCARD.


Change Log:


05-09-2012 @2nd Post [05-09-2012] NativeSD Dual Installer v2 [nand/sdext][wip]
10-09-2012 Add NativeSD CM7 script template
13-09-2012 nativeSDMultiBoot Version4 Credits to datagr
20-09-2012 nativeSDMultiBoot Version5 Credits to datagr
26-09-2012 nativeSDMultiBoot Version6 Credits to datagr
30-10-2012 nativeSDMultiBoot Version9 Credits to datagr
30-10-2012 New initrd mod for NativeSD Credits to marco.palumbi
 
Last edited:

Xylograph

Senior Member
Sep 2, 2009
1,825
7,708
[05-09-2012] NativeSD Dual Installer v2 [nand/sdext][wip]



2it2dk0.jpg


NativeSD Dual Installer v2


Keep in mind that this is a work in progress featuring a possibility to run a full nand rom on a SD-EXT partition..

Please check my current AOKP & PA jellybean ROMS or CM9ight ICS ROM for some 'NativeSD functionality' in action




Features:

  • Compatible with every bootloader and stock OS
  • Recovery package for users without Android on nand

Pre-Installation Requirements and recommendations:

  • HTC HD2 Phone
  • Sdcard with enough free space (performance may differ based on the quality of your card)
  • 4EXT Recovery (Highly recommended)
  • Primary Fat32 partition and Primary EXT4 partition

Downloads : (Please do not mirror stuff)
  • Download 4EXT Recovery from here.
    Pick the SD version if you would like to boot 4EXT Recovery from SD (unpack to your sdcard)
    Pick the NAND version if you would like to flash the 4EXT Recovery on your NAND (flashable via recovery)
    Users with non-working hardware keys can try the various touch recoveries I've ported , though I highly recommend 4EXT recovery..
  • Dual_Installer_v2_example.zip (only for advanced users, unpack the contents to your computer)

Contents :

4EXTRecoverySD for users with no or a different recovery on nand:

Code:
- Contains 4EXT Recovery ported for SD users.
- Unpack to the root of your sdcard
- Set your SD Boot to the Recovery folder or use clcad/haret to boot

4EXTRecoveryNAND for users who would like this recovery on nand:

Code:
- Contains 4EXT Recovery for android NAND users
- Flash it using DAF.exe (Magldr) cLK users can flash it using the HD2 toolkit

Dual Installer example Package (advanced users) :

Code:
- Contains an example (not flashable!) of how I use this for my roms.
- You can check all the stuff, folder structure and scripts.
- I've tried to make the updater-script and aroma-config 'easy to read'
- Placeholders with text on what to put where when porting stuff to NativeSD.

Installation Steps & Instructions:

Sdcard for NativeSD:

Code:
1. First make sure you have at least 1 Fat32 partition and 1 EXT4 partition on your sdcard
2. If you don't have these partitions ?? [B]backup your sdcard[/B][COLOR="Red"][B] , because everything will be wiped from your sdcard when you create partitions and format them ![/B][/COLOR]
3a Use the [URL="http://goo.im/devs/Xylograph/Various/Recoveries"]provided 4EXT recovery (NAND or SD version)[/URL] to create the partitions and format them.
3b If you rather use a computer for creating and formatting partitions keep in mind that both partitions [B]must[/B] be primary partitions (not logical)
4. The recommended size of your EXT4 partition is depending on how many roms and apps you are going to install.. 512M is the minimal size..
5. Restore/move the sdcard contents back to the Fat32 partition
6. (WP7 users) make sure the EXT4 partition is located @ /dev/block/mmcblk0p2
   To check this mount your sd-ext partition in 4EXT recovery and use adb shell or QtADB shell and type [B]df[/B] 
7. Your sdcard is now ready for NativeSD usage..

NativeSD Installation for Magldr NAND Android & WP7 users :

Code:
1. WP7 and SD users set your SD BOOT directory to the 'Recovery' folder by choosing '10.services' , '1. Bootsettings' , 3. AD SD Dir in the Magldr menu.
2. Boot into (NAND or SD) 4EXT recovery.
3. Flash the ROM.zip package and follow instructions
4. Set your SD BOOT directory to the 'NativeSD' folder after flashing the ROM (see step 1)
5. Boot into the ROM and have fun..

NativeSD Installation for cLK NAND Android users : (thanks clio94)

Code:
1. Copy the [URL="http://www.mediafire.com/?nhyausx0p5whu"]flash_bootv2.zip[/URL] to your sdcard.
2. Boot into cLK and make a sboot partition.Be aware that only clk from kokotas allows to make a sboot partition directly from device
3. Boot into recovery (4EXT recovery = recommended) and install rom by choosing sd-ext method
4. After installation finishes,dont reboot, but install flash_sbootv2.zip and then reboot to cLK
5. In cLK choose to boot from sboot and wait for the ROM to boot.
6. If you are stuck on the boot animation,try to wipe your ext partition and install the ROM again.

NativeSD Installation for Windows Mobile and other OS users :

Code:
1. Boot into recovery by executing the usual clcad and haret stuff inside the Recovery folder.
2. Flash the ROM.zip package and follow instructions
3. Reboot and boot the ROM by executing the usual clcad and haret stuff inside the NativeSD folder.

RMNET or PPP ??? summary :
Code:
- as of dual installer v2 you can choose your data connection during ROM installation
- For Magldr users I recommend using the RMNET connection
- For all other users I recommend using the PPP connection (default)
- PPP connection should work for all users !

Switch between different NativeSD ROMS ?
Code:
- If you want to use a previously installed/other NativeSD ROM ?
- Copy the contents of that roms folder found inside the NativeSD folder to the root of the NativeSD folder (overwriting the kernel+ramdisk)
- Boot to sd and that ROM will boot !
- Repeat the above steps when you want to switch again
- In the future we want to make the above steps easier and possible with either a 'gscript' or an 'android app'

Previous Roms (Examples) featuring NativeSD and Dual Installer :

Code:
- [URL="http://d-h.st/pFR"]PA_v1.992se_dual_installer_v2.zip[/URL]  -  [B][URL="http://tinyw.in/Xhft"]mirror[/URL][/B] (Flash via recovery) - md5: ce2138748c6b2cbc62848272acf92600
- [URL="http://d-h.st/p33"]AOKP_N2408se_dual_installer.zip (Magldr only!)[/URL]  -  [B][URL="http://tinyw.in/clMS"]mirror[/URL][/B] (Flash via recovery) - md5: 6a116ad3eebb0f92729af6954f0a9217

*** all flashing is at your own risk ! Always make backups in recovery and/or titanium backup ! ***

*** This is a NativeSD thread ! Please, Keep this thread NativeSD related and report issues with roms in the rom thread !!! ***

Thanks & Credits to : securecrt, Phoenix, clio94, LNE team and everybody I forgot !
 
Last edited:

securecrt

Senior Member
Aug 4, 2010
763
2,762
Shanghai
Q&A

  • How is the NativeSD ROM work?
To boot the Android from SD card, the old SD ROMs mount the system.ext4 and data.ext4 before the init(rename to init.android) thread is start. I changed the initrd.gz to make it mount the ext4 partition before the android init.android start. here is the main code for the init script
Code:
echo "mount system and data partition on sdcard"
# change the rom_name TO PA MIUI CM7 will support 
# to boot other system on SD/EXT4
# the system layout :
#  /NativeSD/NexusHD2/
#                    /system
#                    /data
#           /PA/
#              /system
#              /data
#           /MIUI/
#                /system
#                /data
#           /app
#  the app dir is shared for all ROMs
#

# set the name of the rom to boot
rom_name="PA"

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

# mount the system data app dir
mount --bind /NativeSD/$rom_name/system /system
mount --bind /NativeSD/$rom_name/data   /data
# create app data/app dir
mkdir -p /NativeSD/app
mkdir -p /data/app
mount --bind /NativeSD/app /data/app

So for the ROM Devs should create new initrd.gz which is different with the NAND version, use different rom_name distinguish with others the whole templete is in 2nd post by Xylograph​

  • How is the multi-boot works on NativeSD ROM?
Set the SD boot dir /sdcard/NativeSD in Magldr or CLK,the dir structure is

/sdcard/NativeSD/NexusHD2/zImage
/sdcard/NativeSD/NexusHD2/initrd.gz
/sdcard/NativeSD/PA/zImage
/sdcard/NativeSD/PA/initrd.gz
/sdcard/NativeSD/zImage
/sdcard/NativeSD/initrd.gz​

The Magldr& CLK always read the /sdcard/NativeSD/zImage /sdcard/NativeSD/initrd.gz files to boot, so if you want to switch from PA to NexusHD2 just only need to copy the zImage & initrd.gz to the up layer dir, use the NativeSD ROM switch app made by datagr​

  • How to convert the NAND ROM to NativeSD ROM?
HOWTO port NAND ROM to NATIVESD STEP-BY-STEP Credits to c1cl0n
This is for Devs and advanced users only. For example if we got the NAND version of the NexusHD2 extract the zip file and replace 2 files and add 1 file will finish the convert.

/kernel/boot/initrd.gz
the initrd.gz is similar with the SD ROMs but need to change the init script to mount the ext4 partition

/META-INF/com/google/android/updater-script
the updater-script is used for CWM to execute the install process; execute install.sh before copy the system content to the ext4, here is the sample code
Code:
package_extract_file("install.sh", "/tmp/install.sh");

set_perm(0,0, 0777, "/tmp/install.sh");

run_program("/tmp/install.sh");
show_progress(0.8, 80);

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

then 

package_extract_dir("kernel/boot", "/boot");
package_extract_dir("kernel/boot", "/boot_dir");
package_extract_dir("system", "/system");
......

else
ui_print("can't find ext4 partition on your SDcard");
ui_print("install failed");
endif;

/install.sh
Code:
#!/sbin/sh

# Set the ROM name 
ROM_NAME=NexusHD2
export ROM_NAME

mmcblk0p2=`ls /dev/block/mmcblk0p2`

# Mount the ext4 partition
if [ $mmcblk0p2 == "/dev/block/mmcblk0p2" ]
then

	mkdir -p /ext4p
	mkdir -p /sdcard/NativeSD/$ROM_NAME
	mkdir -p /boot /boot_dir
	
	mount -t ext4 /dev/block/mmcblk0p2 /ext4p
	mkdir -p /ext4p/$ROM_NAME/system /ext4p/$ROM_NAME/data

	mount --bind /ext4p/$ROM_NAME/system /system
	mount --bind /ext4p/$ROM_NAME/data /data
	
	mount --bind /sdcard/NativeSD/$ROM_NAME /boot
	mount --bind /sdcard/NativeSD	/boot_dir
#delete the old system
	rm -rf /system/*

#clean the dalvik-cache	
	rm  -rf /data/dalvik-cache/*

#all the dir has ready write some info for updater-script
	echo "NativeSD=true" >> /tmp/nfo.prop
else

#no ext4 partition found	
	echo "NativeSD=false" >> /tmp/nfo.prop
fi





  • How to make ext4 partition on my SDCARD?
http://xdaforums.com/showthread.php?p=31414628#post31414628
 
Last edited:

Xylograph

Senior Member
Sep 2, 2009
1,825
7,708
You just posted it, but I have a couple of questions - what is it really? How SD builds will be faster because of that? What can we expect? How will it work? Any details?

Securecrt will explain everything.. give the man some time to create the first post..

Expect the same/similar or even better performance compared to android on NAND with a descent SD card.

I will post an example ROM which I am working on so people can check it out @ 2nd post when I am done with it..
 

wis1152

Senior Member
Jun 8, 2011
2,729
2,644
47
luton uk
media.xda-developers.com
[coming soon] ...

This is an idea to make the HD2 more faster, I worked with Xylograph to make it more usable and easy to implement by common users.







Securecrt will explain everything.. give the man some time to create the first post..

Expect the same/similar or even better performance compared to android on NAND with a descent SD card.

I will post an example ROM which I am working on so people can check it out @ 2nd post when I am done with it..

Looking forward to trying this:)

Sent from my GT-I9100 using Tapatalk 2
 
  • Like
Reactions: Dala11

jjblaster3

Inactive Recognized Developer
Jan 4, 2009
853
87
hi..
my phone's hardware button (green button) is not working.. so i can not make any changes to magldr..
currently, my boot folder is set to ICS..

I was just wondering if its possible to edit the initrd.gz as mentioned in post 3 in such a way that it would reflect my folder (ICS) instead of NativeSD?

should i just replace all places which have NativeSD with my folder that is ICS? or is it just some specific places?
 

securecrt

Senior Member
Aug 4, 2010
763
2,762
Shanghai
hi..
my phone's hardware button (green button) is not working.. so i can not make any changes to magldr..
currently, my boot folder is set to ICS..

I was just wondering if its possible to edit the initrd.gz as mentioned in post 3 in such a way that it would reflect my folder (ICS) instead of NativeSD?

should i just replace all places which have NativeSD with my folder that is ICS? or is it just some specific places?

I did not consider this case... let me think how to solve it.
 
  • Like
Reactions: ThdDude

Xylograph

Senior Member
Sep 2, 2009
1,825
7,708
ext4 partition can be made from windows using minitool partition wizard home edition http://www.partitionwizard.com/download.html
I assume FAT32 partition should be first and ext4 partition second.

Yes sir, or use recovery for partitioning your sdcard.. I recommend 4EXT recovery for the job.




What size partition should I create?
I usually use partitions of 1 or 2 GB on 16 or 32 GB cards

Depends on how many roms you are going to install...

I think 2 GB is a nice start.. especially when apps will be shared in future updates you won't have to install all apps over and over again.
 

HypoTurtle

Senior Member
May 5, 2011
1,970
1,257
Great work guys, have installed on a class 6, speed seems fine (personally I haven't found there to be any noticeable lag with SD builds).
Have just run some benchmarks; would attach if i could find a screenshot button. And will see how it performs for a day or two and report back before messing with it.

Just a suggestion, but with future builds are you considering adding an option to choose which ext to install to? So that you can have multiple sd-ext builds and/or a NAND build with a sd-ext and a separate sdext rom.

Likin' the installer as well, haven't used aroma too often, but you've customised this one and made it your own.

Nice Work.


Can't find screenshot, so. Using a class 6 card in:
Code:
System Test = 3398 ; SD card read/write = 13.6/8.0 MB/s
PassMark Performance = 816 ; Internal Storage read/write = 14.7/13.1 MB/s External Storage r/w = 15.1/8.27 MB/s
AnTuTu = 2741 (typical SDROM score) SD card r/w = 9.7/7.4 MB/s
 

jjblaster3

Inactive Recognized Developer
Jan 4, 2009
853
87
So besides changing the folder are you actually able to enter recovery without a working green key?

You'll need that 2

well to b honest when i read on the first post that wm6.5 users and magldr users using wp7 in nand are also to be supported in the future, i never considered that recovery was a must.. guess i was wrong :(
 

Top Liked Posts

  • There are no posts matching your filters.
  • 174
    This is an idea to make the HD2 faster and fancy, I worked with Xylograph to make it more usable and easy to implement by common users.

    Index


    • Post 1 Introduction
    • Post 2 ROMs, Scripts, Installer template for Devs by Xylograph
    • Post 3 Q&A

    Introduction
    We have SD ROMs for very long time, but I think most of the people should agree with me that the SD ROMs are slower than NAND ROMs. because the SD ROMs use system.ext4 and data.ext4 files to store all the ROM contant on the FAT partition, the IO access is the bottleneck.
    My Class10 SD card has 10MB/s R/W speed, but the NAND flash R/W speed is only about 4MB/s. so if we can directly install the ROMs to SDCARD and boot from SDCARD we will get lots of benifits:​

    1. Faster Read/Write speed than NAND ROMs
    2. Bigger data partition for user space (depends on how big the ext4 partition on SDCARD)
    3. Install servel ROMs at the same time. and each ROM share the same space
    4. Muilt-boot support, easy to switch between the ROMs been installed.

    The NativeSD Rom is a new kind of ROM it needs an ext4 partition on your SDCARD.

    This thread will tell you how to install a ROM to SDCARD and give some script templates for ROM Devs to make the ROM installer which can support install the ROM to NAND flash or SD/EXT4.

    Install the ROM to SD/EXT4 will not effact the ROM(WM or Android) on NAND flash, NativeSD should support run from MAGLDR CLK or WM6.5(need test).

    Important Notes:
    Backup all the SDCARD content to PC before you create the ext4 partition on SDCARD.


    Change Log:


    05-09-2012 @2nd Post [05-09-2012] NativeSD Dual Installer v2 [nand/sdext][wip]
    10-09-2012 Add NativeSD CM7 script template
    13-09-2012 nativeSDMultiBoot Version4 Credits to datagr
    20-09-2012 nativeSDMultiBoot Version5 Credits to datagr
    26-09-2012 nativeSDMultiBoot Version6 Credits to datagr
    30-10-2012 nativeSDMultiBoot Version9 Credits to datagr
    30-10-2012 New initrd mod for NativeSD Credits to marco.palumbi
    133
    [05-09-2012] NativeSD Dual Installer v2 [nand/sdext][wip]



    2it2dk0.jpg


    NativeSD Dual Installer v2


    Keep in mind that this is a work in progress featuring a possibility to run a full nand rom on a SD-EXT partition..

    Please check my current AOKP & PA jellybean ROMS or CM9ight ICS ROM for some 'NativeSD functionality' in action




    Features:

    • Compatible with every bootloader and stock OS
    • Recovery package for users without Android on nand

    Pre-Installation Requirements and recommendations:

    • HTC HD2 Phone
    • Sdcard with enough free space (performance may differ based on the quality of your card)
    • 4EXT Recovery (Highly recommended)
    • Primary Fat32 partition and Primary EXT4 partition

    Downloads : (Please do not mirror stuff)
    • Download 4EXT Recovery from here.
      Pick the SD version if you would like to boot 4EXT Recovery from SD (unpack to your sdcard)
      Pick the NAND version if you would like to flash the 4EXT Recovery on your NAND (flashable via recovery)
      Users with non-working hardware keys can try the various touch recoveries I've ported , though I highly recommend 4EXT recovery..
    • Dual_Installer_v2_example.zip (only for advanced users, unpack the contents to your computer)

    Contents :

    4EXTRecoverySD for users with no or a different recovery on nand:

    Code:
    - Contains 4EXT Recovery ported for SD users.
    - Unpack to the root of your sdcard
    - Set your SD Boot to the Recovery folder or use clcad/haret to boot

    4EXTRecoveryNAND for users who would like this recovery on nand:

    Code:
    - Contains 4EXT Recovery for android NAND users
    - Flash it using DAF.exe (Magldr) cLK users can flash it using the HD2 toolkit

    Dual Installer example Package (advanced users) :

    Code:
    - Contains an example (not flashable!) of how I use this for my roms.
    - You can check all the stuff, folder structure and scripts.
    - I've tried to make the updater-script and aroma-config 'easy to read'
    - Placeholders with text on what to put where when porting stuff to NativeSD.

    Installation Steps & Instructions:

    Sdcard for NativeSD:

    Code:
    1. First make sure you have at least 1 Fat32 partition and 1 EXT4 partition on your sdcard
    2. If you don't have these partitions ?? [B]backup your sdcard[/B][COLOR="Red"][B] , because everything will be wiped from your sdcard when you create partitions and format them ![/B][/COLOR]
    3a Use the [URL="http://goo.im/devs/Xylograph/Various/Recoveries"]provided 4EXT recovery (NAND or SD version)[/URL] to create the partitions and format them.
    3b If you rather use a computer for creating and formatting partitions keep in mind that both partitions [B]must[/B] be primary partitions (not logical)
    4. The recommended size of your EXT4 partition is depending on how many roms and apps you are going to install.. 512M is the minimal size..
    5. Restore/move the sdcard contents back to the Fat32 partition
    6. (WP7 users) make sure the EXT4 partition is located @ /dev/block/mmcblk0p2
       To check this mount your sd-ext partition in 4EXT recovery and use adb shell or QtADB shell and type [B]df[/B] 
    7. Your sdcard is now ready for NativeSD usage..

    NativeSD Installation for Magldr NAND Android & WP7 users :

    Code:
    1. WP7 and SD users set your SD BOOT directory to the 'Recovery' folder by choosing '10.services' , '1. Bootsettings' , 3. AD SD Dir in the Magldr menu.
    2. Boot into (NAND or SD) 4EXT recovery.
    3. Flash the ROM.zip package and follow instructions
    4. Set your SD BOOT directory to the 'NativeSD' folder after flashing the ROM (see step 1)
    5. Boot into the ROM and have fun..

    NativeSD Installation for cLK NAND Android users : (thanks clio94)

    Code:
    1. Copy the [URL="http://www.mediafire.com/?nhyausx0p5whu"]flash_bootv2.zip[/URL] to your sdcard.
    2. Boot into cLK and make a sboot partition.Be aware that only clk from kokotas allows to make a sboot partition directly from device
    3. Boot into recovery (4EXT recovery = recommended) and install rom by choosing sd-ext method
    4. After installation finishes,dont reboot, but install flash_sbootv2.zip and then reboot to cLK
    5. In cLK choose to boot from sboot and wait for the ROM to boot.
    6. If you are stuck on the boot animation,try to wipe your ext partition and install the ROM again.

    NativeSD Installation for Windows Mobile and other OS users :

    Code:
    1. Boot into recovery by executing the usual clcad and haret stuff inside the Recovery folder.
    2. Flash the ROM.zip package and follow instructions
    3. Reboot and boot the ROM by executing the usual clcad and haret stuff inside the NativeSD folder.

    RMNET or PPP ??? summary :
    Code:
    - as of dual installer v2 you can choose your data connection during ROM installation
    - For Magldr users I recommend using the RMNET connection
    - For all other users I recommend using the PPP connection (default)
    - PPP connection should work for all users !

    Switch between different NativeSD ROMS ?
    Code:
    - If you want to use a previously installed/other NativeSD ROM ?
    - Copy the contents of that roms folder found inside the NativeSD folder to the root of the NativeSD folder (overwriting the kernel+ramdisk)
    - Boot to sd and that ROM will boot !
    - Repeat the above steps when you want to switch again
    - In the future we want to make the above steps easier and possible with either a 'gscript' or an 'android app'

    Previous Roms (Examples) featuring NativeSD and Dual Installer :

    Code:
    - [URL="http://d-h.st/pFR"]PA_v1.992se_dual_installer_v2.zip[/URL]  -  [B][URL="http://tinyw.in/Xhft"]mirror[/URL][/B] (Flash via recovery) - md5: ce2138748c6b2cbc62848272acf92600
    - [URL="http://d-h.st/p33"]AOKP_N2408se_dual_installer.zip (Magldr only!)[/URL]  -  [B][URL="http://tinyw.in/clMS"]mirror[/URL][/B] (Flash via recovery) - md5: 6a116ad3eebb0f92729af6954f0a9217

    *** all flashing is at your own risk ! Always make backups in recovery and/or titanium backup ! ***

    *** This is a NativeSD thread ! Please, Keep this thread NativeSD related and report issues with roms in the rom thread !!! ***

    Thanks & Credits to : securecrt, Phoenix, clio94, LNE team and everybody I forgot !
    68
    Q&A

    • How is the NativeSD ROM work?
    To boot the Android from SD card, the old SD ROMs mount the system.ext4 and data.ext4 before the init(rename to init.android) thread is start. I changed the initrd.gz to make it mount the ext4 partition before the android init.android start. here is the main code for the init script
    Code:
    echo "mount system and data partition on sdcard"
    # change the rom_name TO PA MIUI CM7 will support 
    # to boot other system on SD/EXT4
    # the system layout :
    #  /NativeSD/NexusHD2/
    #                    /system
    #                    /data
    #           /PA/
    #              /system
    #              /data
    #           /MIUI/
    #                /system
    #                /data
    #           /app
    #  the app dir is shared for all ROMs
    #
    
    # set the name of the rom to boot
    rom_name="PA"
    
    # mount the 1st (NativeSD) SD-EXT partition
    mkdir -p /NativeSD
    mount -t ext4  -o rw,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /NativeSD
    
    # mount the system data app dir
    mount --bind /NativeSD/$rom_name/system /system
    mount --bind /NativeSD/$rom_name/data   /data
    # create app data/app dir
    mkdir -p /NativeSD/app
    mkdir -p /data/app
    mount --bind /NativeSD/app /data/app

    So for the ROM Devs should create new initrd.gz which is different with the NAND version, use different rom_name distinguish with others the whole templete is in 2nd post by Xylograph​

    • How is the multi-boot works on NativeSD ROM?
    Set the SD boot dir /sdcard/NativeSD in Magldr or CLK,the dir structure is

    /sdcard/NativeSD/NexusHD2/zImage
    /sdcard/NativeSD/NexusHD2/initrd.gz
    /sdcard/NativeSD/PA/zImage
    /sdcard/NativeSD/PA/initrd.gz
    /sdcard/NativeSD/zImage
    /sdcard/NativeSD/initrd.gz​

    The Magldr& CLK always read the /sdcard/NativeSD/zImage /sdcard/NativeSD/initrd.gz files to boot, so if you want to switch from PA to NexusHD2 just only need to copy the zImage & initrd.gz to the up layer dir, use the NativeSD ROM switch app made by datagr​

    • How to convert the NAND ROM to NativeSD ROM?
    HOWTO port NAND ROM to NATIVESD STEP-BY-STEP Credits to c1cl0n
    This is for Devs and advanced users only. For example if we got the NAND version of the NexusHD2 extract the zip file and replace 2 files and add 1 file will finish the convert.

    /kernel/boot/initrd.gz
    the initrd.gz is similar with the SD ROMs but need to change the init script to mount the ext4 partition

    /META-INF/com/google/android/updater-script
    the updater-script is used for CWM to execute the install process; execute install.sh before copy the system content to the ext4, here is the sample code
    Code:
    package_extract_file("install.sh", "/tmp/install.sh");
    
    set_perm(0,0, 0777, "/tmp/install.sh");
    
    run_program("/tmp/install.sh");
    show_progress(0.8, 80);
    
    if file_getprop("/tmp/nfo.prop","NativeSD") == "true" 
    
    then 
    
    package_extract_dir("kernel/boot", "/boot");
    package_extract_dir("kernel/boot", "/boot_dir");
    package_extract_dir("system", "/system");
    ......
    
    else
    ui_print("can't find ext4 partition on your SDcard");
    ui_print("install failed");
    endif;

    /install.sh
    Code:
    #!/sbin/sh
    
    # Set the ROM name 
    ROM_NAME=NexusHD2
    export ROM_NAME
    
    mmcblk0p2=`ls /dev/block/mmcblk0p2`
    
    # Mount the ext4 partition
    if [ $mmcblk0p2 == "/dev/block/mmcblk0p2" ]
    then
    
    	mkdir -p /ext4p
    	mkdir -p /sdcard/NativeSD/$ROM_NAME
    	mkdir -p /boot /boot_dir
    	
    	mount -t ext4 /dev/block/mmcblk0p2 /ext4p
    	mkdir -p /ext4p/$ROM_NAME/system /ext4p/$ROM_NAME/data
    
    	mount --bind /ext4p/$ROM_NAME/system /system
    	mount --bind /ext4p/$ROM_NAME/data /data
    	
    	mount --bind /sdcard/NativeSD/$ROM_NAME /boot
    	mount --bind /sdcard/NativeSD	/boot_dir
    #delete the old system
    	rm -rf /system/*
    
    #clean the dalvik-cache	
    	rm  -rf /data/dalvik-cache/*
    
    #all the dir has ready write some info for updater-script
    	echo "NativeSD=true" >> /tmp/nfo.prop
    else
    
    #no ext4 partition found	
    	echo "NativeSD=false" >> /tmp/nfo.prop
    fi





    • How to make ext4 partition on my SDCARD?
    http://xdaforums.com/showthread.php?p=31414628#post31414628
    62
    nativeSDMultiBoot Version 10

    Hello all,

    Here is the latest version 10 of the app.

    Change log :
    ----------------------------------------------------------------------------------------------------------------------------------------

    Version 10 :
    Fixed : Small aesthetic changes
    Added : Website button
    Added : Backup nativeSD rom
    Added : Restore nativeSD rom

    To backup a rom, click [Backup rom] then click a rom that you wish to backup.
    The app will create sdcard/RomBackups/toEXT4/rom_name/rom_name.ext4.tar
    and sdcard/romBackups/toSD/rom_name.ext4.tar files.
    These are your backup that you can save them anywhere before you do any tests. :)

    To restore a backed up rom, click [Backup rom] then click [Restore].
    You will see that the app is switched in [RESTORE MODE].
    In [RESTORE MODE] click a rom that you see in the list.
    (Note that you must NOT change anything in sdcard/RomBackups folder.
    If you changed anything from there then you must put the files and folders as they were,
    before you enter again in the app and restore or backup any rom.)

    PLEASE READ THIS :
    You must NOT touch the app while backup or restore operations.
    It will be unresponsive during the operations
    (You can use a debugger to see what is the app compressing or decompressing).


    Enjoy the app and please hit the thanks button (yes, it's still free!) :)

    ----------------------------------------------------------------------------------------------------------------------------------------

    Version 9 :
    Changed : no need the rom_name.txt method anymore. (requested by Tytung)
    Added : Thanks to the guidance from securecrt now the app is getting the name through linux shell command.
    Changed : colored text to [Switch rom] section. Blue color means the current running rom.
    Added: Tabs in switch and delete sections for bigger buttons and more beautiful interface.
    Changed : improved performance of the app (I hope it's ok now Szczepanik :) )

    ----------------------------------------------------------------------------------------------------------------------------------------

    Version 8 :
    Fixed : [Delete rom] section that was messed up from a bug that I found and now it is ok.
    Added : colored text to [Switch rom] section. Cyan color means the current running rom(or the latest clicked rom).
    Added : rom name in the [Tools] section so you will know in which rom the changes will be applied.

    ----------------------------------------------------------------------------------------------------------------------------------------

    Version 7 :
    App supports switching and deleting up to 18 nativeSD roms.
    App will read from /proc/self/mountinfo the rom name and compare it with the rom_name.txt
    that is automatically created in sdcard/nativeSD folder.
    If the name matches, then it will enable the [Delete] and [Tools] buttons.
    If not it will hide those 2 buttons to avoid any mistakes.
    Also some small bugs have been fixed from previous versions.

    ----------------------------------------------------------------------------------------------------------------------------------------

    Version 6 :
    Added : fix permissions in nativeSD roms
    Added : clear Dalvik cache in nativeSD roms
    Added : kernel update(*) for nativeSD ONLY roms (thank you master Tytung for the guidance)

    (*) How to update kernel :
    1) Download the zip file of the kernel (tytung 3.5 and securecrt 24Sep2012 kernels work perfect)
    2) Rename it to [update.zip] and put it in the sdcard/nativeSD folder
    3) Run the nativeSDmultiboot app and click [Switch] -> click your current running rom -> [Back] -> [Tools] -> [Update kernel]
    4) Reboot IMMEDIATELY! (this is really important to avoid any force closes...)

    ----------------------------------------------------------------------------------------------------------------------------------------

    Version 5 :
    Now CLK users can use this app to switch roms! (You must put [mkbootimg.sh] and [mkbootimg]
    from [flash_sboot_v2.zip] inside the folder sdcard/nativeSD/)
    The interface has been changed also.

    ----------------------------------------------------------------------------------------------------------------------------------------

    Version 4 :
    On first enter please click on the rom that you are running now! THIS IS VERY IMPORTANT!
    It will create a rom_name.txt inside the nativeSD folder with the name that you are running (thanks for idea securecrt).
    I have also added the delete function with confirmation message (requested by Xylograph).
    It will hide the rom that you are currently running to avoid any mistakes (requested by securecrt).



    P.S. All fellows developers are free to include it in your nativeSD roms. :)
    58
    Hello all,

    Please download version 10 with latest updates. :)

    Here is the link :

    http://xdaforums.com/showpost.php?p=33815218&postcount=1392