[REF] Howto port NAND to NativeSD | Step-by-Step - HD2 Android SD Development

HOWTO port NAND ROM to NATIVESD
STEP-BY-STEP​
This method based on SecureCRT with my modifications and comments[/COLOR]
Click to expand...
Click to collapse
HD Video GUIDE
Click to expand...
Click to collapse
PC Requiments:
PC with installed MS Windows XP/Vista/Se7en and VirtualMachine with Linux based OS (I'm used Ubuntu 11.10 OEM at VMware 8)
Installed Nottepad++
Mobile Requiments:
NAND ROM ported to HTC LEO HD2 (In my example, I used NexusHD2-Gingerbread V3.2a (GWK74)(Android 2.3.7)[tytung_r13] this rom is based)
Blank template file BareBoneCM7_NativeSD_installer_Diff_Nand.zip
Some NativeSD ROM with compatible kernel files what you want to use in your NativeSD port (In my example, I used HyperDroid-CM7-v6.0.1_NativeSD e.g. my port is CM7 based so I used powerful GB kernel files fro this rom)
Step1. Prepare port files
Create any folder on your PC (example: C:\myport\) and extract in the blank template file
You should have this:
C:\myport\kernel\boot\place kernel + nand ramdisk here
C:\myport\kernel\bootsd\place kernel + sd-ext ramdisk here
C:\myport\kernel\checksys.sh
C:\myport\kernel\mkbootimg
C:\myport\kernel\mkbootimg
C:\myport\META-INF\com\google\android\aroma\ etc... etc... etc...
C:\myport\META-INF\com\google\android\aroma-config
C:\myport\META-INF\com\google\android\update-binary
C:\myport\META-INF\com\google\android\update-binary-installer
C:\myport\META-INF\com\google\android\updater-script
C:\myport\sdcard\NativeSD\clrcad.exe
C:\myport\sdcard\NativeSD\haret.exe
C:\myport\sdcard\NativeSD\startup.txt
C:\myport\system\place the rom system folder contents in here
C:\myport\install.sh
Click to expand...
Click to collapse
Delete 3 blanked information files:
This files is only for you know where need to put kernel files and system folder of base
C:\myport\kernel\boot\place kernel + nand ramdisk here
C:\myport\kernel\bootsd\place kernel + sd-ext ramdisk here
C:\myport\system\place the rom system folder contents in here
Click to expand...
Click to collapse
Extract /system folder from (NAND ROM) in C:\myport\:
You should have this:
C:\myport\system\app\ ... include files, folders & subfolders
C:\myport\system\bin\ ... include files, folders & subfolders
C:\myport\system\etc\ ... include files, folders & subfolders
C:\myport\system\fonts\ ... include files, folders & subfolders
C:\myport\system\framework\ ... include files, folders & subfolders
C:\myport\system\lib\ ... include files, folders & subfolders
C:\myport\system\media\ ... include files, folders & subfolders
C:\myport\system\tts\ ... include files, folders & subfolders
C:\myport\system\usr\ ... include files, folders & subfolders
C:\myport\system\vendor\ ... include files, folders & subfolders
C:\myport\system\xbin\ ... include files, folders & subfolders
C:\myport\system\build.prop
Click to expand...
Click to collapse
Delete all kernel module files:
This step req. because, In my example, I used kernel files from HyperDroid-CM7-v6.0.1_NativeSD
C:\myport\system\lib\modules\alsa-mix-htc-leo.ko
C:\myport\system\lib\modules\alsa-pcm-htc-leo.ko
C:\myport\system\lib\modules\bcm4329.ko
C:\myport\system\lib\modules\cifs.ko
C:\myport\system\lib\modules\fuse.ko
C:\myport\system\lib\modules\kineto_gan.ko
C:\myport\system\lib\modules\msm_rmnet.ko
C:\myport\system\lib\modules\tun.ko
Click to expand...
Click to collapse
P.S. Your module files may be diffirents, just delete it all
C:\myport\system\lib\modules\ no one files exist
Click to expand...
Click to collapse
Extract zImage file from HyperDroid-CM7-v6.0.1_NativeSD rom in two folders:
Duplicate it for boot as NAND and boot as SD
C:\myport\kernel\boot\zImage
C:\myport\kernel\bootsd\zImage
Click to expand...
Click to collapse
Extract module files (.ko)
From: HyperDroid-CM7-v6.0.1_NativeSD modules folder:
HyperDroid-CM7-v6.0.1_NativeSD.zip\system\lib\modules\
Click to expand...
Click to collapse
To: C:\myport\system\lib\modules\
Click to expand...
Click to collapse
It should be like this:
C:\myport\system\lib\modules\bcm4329.ko
C:\myport\system\lib\modules\cifs.ko
C:\myport\system\lib\modules\fuse.ko
C:\myport\system\lib\modules\kineto_gan.ko
C:\myport\system\lib\modules\msm_rmnet.ko
C:\myport\system\lib\modules\reiserfs.ko
C:\myport\system\lib\modules\tun.ko
C:\myport\system\lib\modules\zram.ko
Click to expand...
Click to collapse
Extract initrd.gz from HyperDroid-CM7-v6.0.1_NativeSD (smaller file ~143 Kb):
From: HyperDroid-CM7-v6.0.1_NativeSD.zip\kernel\boot\initrd.gz
To: C:\myport\kernel\boot\initrd.gz
Click to expand...
Click to collapse
Extract initrd.gz from HyperDroid-CM7-v6.0.1_NativeSD (bigger file ~893 Kb):
From: HyperDroid-CM7-v6.0.1_NativeSD.zip\kernel\bootsd\initrd.gz
To: C:\myport\kernel\bootsd\initrd.gz
Click to expand...
Click to collapse
Step2. [Windows] Change port name & port folder name
Open in Nottepad++ file C:\myport\install.sh
Find ths string:
# Set the ROM name
ROM_NAME=EXAMPLE
Click to expand...
Click to collapse
And chenge (red selected: EXAMPLE) to your likly port name:
# Set the ROM name
ROM_NAME=NexusCM7
Click to expand...
Click to collapse
P.S. This is example. Do not use spaces!!
Remeber this name, save changes and exit Nottepad++

Step3. [Linux] Change port name & port folder name
I'm used Ubuntu Linux v11.10 OEM & WinHHTP FileServer to exchange files from my Windows to Linux (at VMware)
Copy your initrd.gz (bigger file) to your Linux
From: C:\myport\kernel\bootsd\initrd.gz
To: \username\home\myport\initrd.gz
Click to expand...
Click to collapse
Where \username\home\ is your own home folder in Linux, and \myport\ is temprary folder to this step. Create it if don't exists
Execute Linux terminal application (window based) by Ctrl+Alt+T
It is should by like this:
[email protected]:~$ _
Click to expand...
Click to collapse
Now you must be in your home folder, but you can check it by command:
[email protected]:~$ ls ./
Click to expand...
Click to collapse
If you see root folder or some other forlder, not [email protected]:~$ you can change it by this command:
[email protected]:~$ cd /username/home
Click to expand...
Click to collapse
Now create temporary work folder, if it wasn't exist by command:
[email protected]:~$ mkdir myport
Click to expand...
Click to collapse
Copy to /username/home/myport/ your initrd.gz (bigger file) as you want
I'm used WinHTTP FileServer for this
Create in your work folder new folder named as "works"
It is should be like this:
/c1cl0n/home/myport/work/
Click to expand...
Click to collapse
Now extract your initrd.gz file to change init file for your port
[email protected]:~/myport$ cp ./initrd.gz ./work
[email protected]:~/myport$ cd ./work
[email protected]:~/myport/work$ gunzip initrd.gz
[email protected]:~/myport/work$ cpio -i < initrd
3261 Blocks
Click to expand...
Click to collapse
Done! Now in /username/home/myport/work/ folder you must have this files and folders:
/bin /data /dev /proc /sbin /system
default.prop init init.android init.htcleo.rc init.htcleo.usb.rc init.rc initrd.gz
logo.rle ueventd.htcleo.rc ueventd.rc
Click to expand...
Click to collapse
Done! initrd.gz now is extracted
Now moveing init file to /username/home/myport/ folder and changing permissions to it (to do it editable)
[email protected]:~/myport/work$ cp ./init ../
[email protected]:~/myport/work$ chmod 777 ../init
Click to expand...
Click to collapse
Now you must edit this file to change a name of your port, what you did in Nottepad++ with install.sh file
Run GEdit and open /username/home/myport/init file
Find this string:
rom_name="NexusHD2"
Click to expand...
Click to collapse
and change it to your name, what you did in Nottepad++ with install.sh file
rom_name="NexusCM7"
Click to expand...
Click to collapse
Save all changes and exit GEdit
Return to terminal window
Now you must replace this file to older and repack initrd.gz
Deleting old file:
[email protected]:~/myport/work$ rm -rf ./init
Click to expand...
Click to collapse
Deleting old initrd.gz it is very important becase we will save all changes in old initrd.gz file in /username/home/myport/initrd.gz
[email protected]:~/myport/work$ rm -rf initrd
Click to expand...
Click to collapse
Putnig new init file in our work folder:
P.S. No req. original permission to it!
[email protected]:~/myport/work$ cp ../initrd ./
Click to expand...
Click to collapse
Repacking your old initrd.gz
[email protected]:~/myport/work$ find . | cpio -o -H newc | gzip > ../initrd.gz
3261 Blocks
Click to expand...
Click to collapse
Done! In the Linux our work is finished
Upload/Copy your changed /username/home/myport/initrd.gz file to your Windows
And trash files and folders of this step:
[email protected]:~/myport/work$ cd ../..
[email protected]:~$ chmod 777 ./myport
Click to expand...
Click to collapse
If Linux talks about permissions, like Access Denied!, change your username to root by command:
[email protected]:~$ sudo su
[email protected]:~$ _
[email protected]:~$ rm -rf ./myport
Click to expand...
Click to collapse
This step is done! Turn off Linux (if you are used it on VirtualMachine and return to Windows

Step4. Replace changed initrd.gz
Put your changed (in Linux OS) initrd.gz file to C:\myport\kernel\bootsd\initrd.gz
Done!
Step5. Change updater-script
Run Nottepad++ and open for edit a file C:\myport\META-INF\com\google\android\updater-script
Find this lines:
run_program("/tmp/install.sh");
if file_getprop("/tmp/nfo.prop","NativeSD") == "true"
then
Click to expand...
Click to collapse
In new tab of Nottepad++ open for edit updater-script file of ported NAND rom:
In my example it is NexusHD2-Gingerbread_V3.2a_NAND_(Android-2.3.7).zip\META-INF\com\google\android\updater-script
Copy into the buffer all text from line:
symlink("busybox", "/system/xbin/[", "/system/xbin/[[",
"/system/xbin/arp", "/system/xbin/ash", "/system/xbin/awk",
"/system/xbin/basename", "/system/xbin/bbconfig", "/system/xbin/brctl",
Click to expand...
Click to collapse
To:
set_perm(0, 0, 06755, "/system/xbin/busybox");
set_perm(0, 0, 06755, "/system/xbin/su");
Click to expand...
Click to collapse
It is must be like this:
symlink("busybox", "/system/xbin/[", "/system/xbin/[[",
"/system/xbin/arp", "/system/xbin/ash", "/system/xbin/awk",
"/system/xbin/basename", "/system/xbin/bbconfig", "/system/xbin/brctl",
"/system/xbin/bunzip2", "/system/xbin/bzcat", "/system/xbin/bzip2",
"/system/xbin/cal", "/system/xbin/cat", "/system/xbin/catv",
"/system/xbin/chgrp", "/system/xbin/chmod", "/system/xbin/chown",
"/system/xbin/chroot", "/system/xbin/cksum", "/system/xbin/clear",
"/system/xbin/cmp", "/system/xbin/cp", "/system/xbin/cpio",
"/system/xbin/cut", "/system/xbin/date", "/system/xbin/dc",
.........
.........
.........
.........
.........
set_perm(0, 0, 06755, "/system/xbin/hcitool");
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/tcpdump");
set_perm(0, 0, 06755, "/system/xbin/busybox");
set_perm(0, 0, 06755, "/system/xbin/su");
Click to expand...
Click to collapse
Goto first tab of Nottepad++ (it is tab with ported updater-script) and paste coped data after red marked "then "
It is must be like this:
if file_getprop("/tmp/nfo.prop","NativeSD") == "true"
then
symlink("busybox", "/system/xbin/[", "/system/xbin/[[",
"/system/xbin/arp", "/system/xbin/ash", "/system/xbin/awk",
"/system/xbin/basename", "/system/xbin/bbconfig", "/system/xbin/brctl",
"/system/xbin/bunzip2", "/system/xbin/bzcat", "/system/xbin/bzip2",
"/system/xbin/cal", "/system/xbin/cat", "/system/xbin/catv",
"/system/xbin/chgrp", "/system/xbin/chmod", "/system/xbin/chown",
"/system/xbin/chroot", "/system/xbin/cksum", "/system/xbin/clear",
..........
..........
..........
..........
set_perm(0, 0, 06755, "/system/xbin/procrank");
set_perm(0, 0, 06755, "/system/xbin/tcpdump");
set_perm(0, 0, 06755, "/system/xbin/busybox");
set_perm(0, 0, 06755, "/system/xbin/su");
symlink("/system/xbin/su", "/system/bin/su");
package_extract_dir("kernel/bootsd", "/boot");
package_extract_dir("kernel/bootsd", "/boot_dir");
package_extract_dir("sdcard", "/sdcard");
package_extract_dir("system", "/system");
else
ui_print("can't find ext4 partition on your SDcard");
ui_print("install failed");
endif;
endif;
##
# ROM SYMLINKS AND PERMISSONS
##
Click to expand...
Click to collapse
Save all changes and close both tabs
Done! updater-script is ready to use
Step6. Prepare AROMA script
Run Nottepad++ (if it is was closed be step5) and open for edit C:\myport\META-INF\com\google\android\aroma-config file
Now change default strings to your likely port name, author, build date etc.
Find this:
ini_set("rom_name", "EXAMPLE");
ini_set("rom_version", "v2");
ini_set("rom_author", "DEVELOPER");
ini_set("rom_device", "HTC HD2");
ini_set("rom_date", "TODAY");
Click to expand...
Click to collapse
Change to this:
ini_set("rom_name", "NexusCM7");
ini_set("rom_version", "v2");
ini_set("rom_author", "YourNickName");
ini_set("rom_device", "HTC HD2");
ini_set("rom_date", "CurrentDate");
Click to expand...
Click to collapse
Save all changes and exit from Nottepad++
Done! Aroma config file is ready to use
This 3 steps is done!
Now yo can create zip archive with your folders & subfolders:
\kernel\
\META-INF\
\sdcard\
\system\
\install.sh
Click to expand...
Click to collapse
and install it via 4EXT Recovery for NativeSD port

Step7. (Optional) Sign created NativeSD zip-archive
This step is optional and I don't know about request of it. I'm just signed my port in UpdatezipCreator
Thats all pplz
My thanks to all who helped me with this, to all xda developers who made this possible and [email protected] who I forgot to thanks
Regard, c1cl0n

u did great help here man thx

seaman2k said:
u did great help here man thx
Click to expand...
Click to collapse
Thanks, hope my work will help other beginners to learn better the NativeSD technology and make our HD2 more greater and useble
If this guide is too hard and not intuitive, tomorrow I can record all steps to video
In fact, everything just seems complicated, yet you can not tell the exact purpose of each file future NativeSD port

Get permission before publishing
Advice: before publishing any ROM that you port to NativeSD, check with the original ROM developer and get their permission. See Forum Rule 12
12. Using the work of others.
If you are developing something that is based on the work of another Member, you MUST first seek their permission, and you must give credit to the member whose work you used.
Click to expand...
Click to collapse
Cheers
Tom

All links removed
Sorry

c1cl0n said:
All links removed
Sorry
Click to expand...
Click to collapse
Would this be better / of additional benefit as a wiki, would allow people to tidy it up a bit, and add in other variations (using the dxixda kitchen on windows, or editing initrd.gz on device (move initrd.gz to /INITRD/ ; make a folder /INITRD/work/ ; cd to /INITRD/work ; then run #gunzip -c ../initrd.gz | cpio -i)?
Would also allow us to have all the NativeSD guides in one place (porting, installation, WP7 installation etc.)

HypoTurtle said:
Would this be better / of additional benefit as a wiki, would allow people to tidy it up a bit, and add in other variations (using the kitchen on windows, editing initrd.gz on device (need to confirm if can be done properly)?
Would also allow us to have all the NativeSD guides in one place (porting, installation, WP7 installation etc.)
Click to expand...
Click to collapse
i used above steps on ubuntu and i can say it help me too much and i success to convert and modded nand rom to nativesd rom with all update i needed for me ..yes the guide is very good with the video i think it will be excellent

thanks. looks perfect and very easy to reproduce by starters.
I will add a link to my thread
Sent from my NexusHD2 using xda premium

as I understand, it is not possible to use nativesd script with sense3.5 roms?

dimdimdim said:
as I understand, it is not possible to use nativesd script with sense3.5 roms?
Click to expand...
Click to collapse
it working boot now
under more dev & fix

You manage to make it boot!? That's great news!

boxmax said:
it working boot now
under more dev & fix
Click to expand...
Click to collapse
OMG, Box, you are here with us again or this is a dream only!!!?

dimdimdim said:
OMG, Box, you are here with us again or this is a dream only!!!?
Click to expand...
Click to collapse
glad to see you dimdimdim & datagr :good:
i edited initrd.gz for "Sense" now working Native SD but with old kernel Ty14 ... market & download FAST no more lag for market ...
i try again for kernel marc .... need some magic

datagr said:
You manage to make it boot!? That's great news!
Click to expand...
Click to collapse
What did I say, boxmax would get it working
Sent from my GT-I9100 using Tapatalk 2

boxmax said:
glad to see you dimdimdim & datagr :good:
i edited initrd.gz for "Sense" now working Native SD but with old kernel Ty14 ... market & download FAST no more lag for market ...
i try again for kernel marc .... need some magic
Click to expand...
Click to collapse
yes, it's worth it. as marc 's kernel made real miracle with sense builds - energy's one has no more limits in usage even taking into consideration ramless of hd2 for that kind of roms. that would be great to beat the result with boxmax's nativesd sense35:good:

Hi
thank you very much
I successfully converted my ROM from NAND to NativeSD
All is boooting and working OK
Just a weird thing : system and data seem to be 200Mo of size, whereas my ext4 partition is 4Gb
any idea ?...

Hi denseye
I'm very glad to see your success
I'm hope this step-by-step guide will help to other beginners

Related

D4 Update Zip Maker v1.2r1 - Make update.zip with some clicks!

Well, I was seeing that some times people just don't like to manually make scripts, so I had the iniciative to make this software, and after weeks of no sleep, here you go.. I hope you guys like it!
Features:
Installable, now you can choose any folder on PC for building zip! Removed since 1.2
Easily build update scripts for Edify script (Used by most of ClockWorkMod Recovery's)
Configuration for compression
MD5 Calculation for Created Zips
Read from file
Hotkeys
Smart functions (like automatic placeholders for empty system folders only)
Non-repeatable options prompt (for example, formatting data twice)
Device selection (we'll need devices plugins )
Manual edition
Default symlinks for toolbox and busybox
Easy use for starting users
More!...
Simple instructions
Please report bugs, and remember that you need to have java installed for run this, and if you're on windows vista/7, run as administrator
This is a little video when I was building last options, now it's more complete and fast
Cheers,
D4.
10.03.2012 - 1.2r1
Fixed a LOT of bugs
Non installable again
Added EVO 3D prebuilt
Revamped logo, and Customizable themes on options
15.08.2011 - 1.01r2
Fixed this bug, thanks to darkstep for reporting
Improved zip method
13.08.2011 - 1.01r1
Now installable!
Output folder now it's on installation folder
Selection of external folder
Read script from zip
Added more hotkeys
Custom zip comment
Fixed bugs
08.08.2011 - 1.0r2
Implemented location of working directory (now you can work out of update folder)
Fixed bugs
07.08.2011 - 1.0r1
Initial Release.
sweet tool thanks
Excellent job!!!. This app is excellent, now evertbody can make custom zips.
Simple instructions for everybody to build zips:
Our work Folder will be called /update by default, and Update zip maker will create this folder on startup (you can change working folder). Also Update Zip Maker zip this folder when you press "Build package". *NEW* Now you can change working folder!
Copy files to be modded on selected place (for example, if I want to mod /system/build.prop, I'd put build.prop inside /update/system/ folder, which will create Update Zip Maker software) //also something interesting, If you press "Extract system" button, Update Zip Maker will create /system folder, inside /update, and the same for data
Mount our filesystem (for build.prop case, then we need to mount system)
OPTIONAL: Add some notification to user, like "installing build.prop"
Extract files (for build.prop case pressing Extract system)
Set permissions(for build.prop case 0 0 0 644)
Push zip to phone, install and enjoy!
This program is the bestI think this will be usefull for all devices who use ClockWorkMod Recovery so it will be greate to have teseter's with difrend device
btw D4 you are rocking exelent work
EDIT: hey is there any option that you add permissions for framework, bin, xbin, system?
i think when you press Set permissions it pups up like it is but there would be extra space that you just chose perms like for framework
Code:
(0, 0, 0755, 0644, "/system/framework");
this is just my proposal
Eyama said:
This program is the bestI think this will be usefull for all devices who use ClockWorkMod Recovery so it will be greate to have teseter's with difrend device
btw D4 you are rocking exelent work
EDIT: hey is there any option that you add permissions for framework, bin, xbin, system?
i think when you press Set permissions it pups up like it is but there would be extra space that you just chose perms like for framework
Code:
(0, 0, 0755, 0644, "/system/framework");
this is just my proposal
Click to expand...
Click to collapse
for folders like framework you can use "set permissions recursively"
btw, guys, could you press "sumbit to portal", on the top of first post, so everybody can see this please?
Edit, new version it's up, enjoy!
This program like a charm ^^ ,very simple and useful
thanks alot D4 )
This program doesn't create "update-binary", it is a bug or it is volontary ?
EDIT : My mistake ! I didn't use this software correctly... Sorry It work like a charm
Very good job ! Great app
New version it's up!, now installable!, enjoy new features!.
excellent job D4
you're the man this is wery good
First Thanks for Great tool.It's small and easy.
I make an update.zip to install an application.Here is the script:
mount("yaffs2", "MTD", "userdata", "/data");
ui_print("Coping app");
package_extract_dir("data", "/data");
set_perm_recursive(0, 0, 0755, 0644, "/data/app");
Problem is when i open the application it Force close.
Please Help me.
nishan432 said:
First Thanks for Great tool.It's small and easy.
I make an update.zip to install an application.Here is the script:
mount("yaffs2", "MTD", "userdata", "/data");
ui_print("Coping app");
package_extract_dir("data", "/data");
set_perm_recursive(0, 0, 0755, 0644, "/data/app");
Problem is when i open the application it Force close.
Please Help me.
Click to expand...
Click to collapse
Are you sure problem isnt with the app?
also try
set_perm(0, 0 , 755, 644, "/data/app/yourapp.apk")
set_perm_recursive it's for whole folders!
why do i keep getting this message
i set my working folder inside the folder is system/etc/init.d/ and the script i wanna run,i have tryid everything
darkstep said:
why do i keep getting this message
i set my working folder inside the folder is system/etc/init.d/ and the script i wanna run,i have tryid everything
Click to expand...
Click to collapse
Working folder it's main folder, that means /somefolder, you're trying to use /somefolder/system/etc/init.d, then you just need to use main folder, that means, working folder it's where you can see "META-INF", "system", "data", etc...
omg not working for me im not that big of a newbie
darkstep said:
omg not working for me im not that big of a newbie
Click to expand...
Click to collapse
I don't understand you, can you tell me all steps you followed?, also did you run as admin?
edit: and btw, we still don't have your device prebuilt (htc wildfire), can you test with u20?.
i will make a video and post it on youtube later
here is the video,not that great quality,i was in a hurry
Do I need net framework to run this? I'm on XP SP3 and when I try to run nothing happens. Tried opening as admin, no dice.

[1/12/12][WIP][NativeSD] Ramdisk Patcher ; beta1

[Disclamer: Use the following at your own risk, I take no responsibility for the unrecoverable loss of any data as a direct consequence of using anything attached]
The following patcher(s) will modify the nand ramdisk for various functions, primarily enabling NativeSD support:​--------------------------------------------------------------------
#1 NativeSD SD ramdisk to NativeSD nand ramdisk patch
#2 NAND (Non NativeSD) to NativeSD patch
#3 Boot.img (/also clk) patcher
#4 other devices ???
#5 FAQ
---------------------------------------------------------------------​
NativeSD SD ramdisk to NativeSD NAND ramdisk
Things resolved by using nand ramdisk over sd ramdisk
Bluetooth issues
Changing rom name to whatever you want prior to install i.e for testing purposes (just need to change rom_name in install.sh and the one in the ramdisk will mirror it)
...
...
Instructions.
Removed the old zips, have attached just one, should run on linux, on device and during installation, needs a install.sh file with at least ROM_NAME=rom_name in it, and a copy of the nand ramdisk to be added into NativeSD folder or copied to /tmp (i.e during ROM _installation ) and to execute nativesd.sh (a copy of which is currently attached as well as being in the zip). Should work with nilfs2 and ext4 and should allow for easy adjustments and modifications to be made to the mount commands carried out in init.rc and/or mountfs.sh
Add a copy of nativesd.sh.txt saved as nativesd.sh to the downloaded and unzipped NativeSD folder and add to rom zip.
During ROM installation the NativeSD folder needs to be emptied to /tmp along with a nand ramdisk and /tmp/nativesd.sh needs to be run.
package_extract_dir("NativeSD", "/tmp");
set_perm(0, 0, 0777, "/tmp/nativesd.sh");
run_program("/tmp/nativesd.sh");​and either send nand ramdisk to /tmp/ or add a copy to the NativeSD folder before installation.
The set up at the moment will leave the default NativeSD in tact and add two others, just rename them (or edit nativesd.sh to do so).
If using nilfs2 again two addition ramdisks will be added, the two created ones which will boot to nilfs2 and the original which won't boot as it's set to ext4, you may also need to edit install.sh (or mount_NativeSD.sh) so that it reads "mount auto" or "mount nilfs2" rather than "mount ext4".
Legacy Instructions:
Code:
NANDtoNativeSD.zip (will add another version)
[INDENT]This is a CWM(/recovery) zip, instructions are similar to Combi:
need to change install.sh to have the right rom_name at the top, and add the nand ramdisk to the NativeSD folder and install via recovery[/INDENT]
Combi
[INDENT]The zips marked ext4 and nilfs2 should make both sc and v versions and should work during installation and from running build (although that may need one line change). They should create initrd-nilfs-sc.gz and initrd-nilfs-v.gz or initrd-ext4-sc.gz and initrd-ext4-v.gz accordingly and thus can't be booted from until you rename them to initrd.gz.
[B]During ROM installation:[/B]
[INDENT]Copy the nand ramdisk (it should be ~200kb) into the NativeSD folder and copy NativeSD into the ROM zip
Edit the updater script by adding:
[B]package_extract_dir("NativeSD", "/tmp");
set_perm(0, 0, 0777, "/tmp/nativesd.sh");
run_program("/tmp/nativesd.sh");[/B][/INDENT]
before [B]package_extract_dir("system", "/system");[/B]
no other change needed so this should be universal
[B]During running ROM:[/B]
[INDENT]Copy NativeSD folder to sdcard, copy in nand ramdisk and create a text file called [B]install.sh[/B] with the words [B]ROM_NAME=writeROMname[/B] writing the rom name after =.
Open terminal cd into NativeSD folder and run script:
[B]su
chmod 777 nativesd.sh
./nativesd.sh[/B][/INDENT]
Let me know if there is a problem as I might need to change a few lines to get it to run on device - This is completely untested
(will also run on linux after a few minor changes i.e changing sbin to bin on first line and removing/changing the [B]cp initrd*.gz /boot*[/B] lines, will properly comment this in next version if/when the current ones need fixing
[/INDENT]
Modifying during Installation
[INDENT]1. Download the attached NativeSD.zip or NativeSD-sc.zip and have original NativeSD-ROM.zip to be modified
2. Unzip it and open nativesd.sh
3. Add the romname to the start of the script (the same romname that's in install.sh)
3. Add the NativeSD folder to a current NativeSD-ROM.zip
4. Edit the updater-script, by changing the following:
[B]ui_print("@ Installing System");
package_extract_dir("kernel/bootsd", "/boot");
package_extract_dir("kernel/kernel", "/boot");
package_extract_dir("kernel/bootsd", "/boot_dir");
package_extract_dir("kernel/kernel", "/boot_dir");
package_extract_dir("sdcard", "/sdcard");
package_extract_dir("system", "/system");[/B]
to
[B]ui_print("@ Installing System");
package_extract_dir("kernel/boot", "/boot");
package_extract_dir("kernel/kernel", "/boot");
package_extract_dir("kernel/kernel", "/boot_dir");
package_extract_dir("NativeSD", "/tmp");
set_perm(0, 0, 0777, "/tmp/nativesd.sh");
run_program("/tmp/nativesd.sh");
package_extract_dir("sdcard", "/sdcard");
package_extract_dir("system", "/system");[/B]
[I][SIZE="1"](this will vary slightly by rom)[/SIZE][/I]
5. Copy rom to sdcard and install via recovery[/INDENT]
Modifying during running NativeSD ROM
[INDENT]1. Download nativesd.sh.txt and nativeSDv1.1 attached
2. Obtain nand ramdisk from the NativeSD-ROM.zip (kernel/boot/initrd.gz for example)
3. Unzip NativeSDv1.1.zip
4. Rename nativesd.sh.txt to nativesd.sh and copy over the one in the NativeSD folder
5. Copy the nand ramdisk (initrd.gz) into the NativeSD folder
6. Copy NativeSD folder to device for example to /sdcard/Downloads/
7. Open terminal and run the following
[B]su
cd /sdcard/Downloads/NativeSD
ROM_NAME=AddRomNameHere
chmod 777 nativesd.sh
./nativesd.sh
exit
exit[/B]
This should modify the ramdisk and copy it to /sdcard/NativeSD and will leave the one in the romfolder as is, if it works great if not, replace the initrd.gz in /sdcard/NativeSD with the one in /sdcard/NativeSD/ROMNAME/
[/INDENT]
(If using nilfs2, you will also need to look in install.sh and change ext4 to auto)
Details
Confirmed working:
Booting to ext4
Booting to nilfs2 (using nilfs2 zips)
Untested:
Modifying from running build
Tested Working ROMs:
NexusHD2-ICS
PACman
MIUIJB
PA-HD2
sundawg
CM9ite 1.1 (QMA version won't work)
Versions
Releases with v will be based on marco.palumbi's method - adding mounts to init.rc
Releases with sc will be based on securecrt's method - using an additional script
Changelog -beta 1
nilfs2 and ext4 tested with same rom, nativesd.sh file removed from zip (as the other files with remain unchanged for the time being)
-------------------------------------
-nilfs-ext4-sc-v
Stripped down andcombined to the one zip
-------------------------------------
-ext4(4) and -nilfs2(4)
sc fixed
-------------------------------------
-ext4(3) and -nilfs2(3)
Bug fixes
-------------------------------------
-ext4(2) and -nilfs2(2)
Fix initrd.gz names with ext4 version,
tmp file copied into NativeSD (hopefully) for debugging purposes
------------------------------------
-ext4 and -nilfs2 versions
Seperate zips for the two file systems for now
Hopefully removed the need to have to manually change the rom_name by reading from install.sh (confirmed)
Completely untested
-------------------------------------
sc1.2
Should now be fixed and work with ext4 (and nilfs2 after removing some lines)
--------------------------------------
sc1.1
Tidy up and fixing issue reported here
--------------------------------------
v1.1
Tidy up
--------------------------------------
sc1 (NativeSD-sc1) :
Based on securecrt's code
EXT4 support
--------------------------------------
v1 (NativeSD.zip) :
Based on marco.palumbi's code
EXT4 and (untested) basic NILFS2 support​
Credits: securecrt, Xylograph, marco.palumbi, ph03n!x, Kokotas,
Testers: Robbie P and jerrysue (for testing the alpha builds)
NAND (Non NativeSD) to NativeSD patch
Have attempted with BBCM7 (as I thought the updater script would be simple) but to no avail.
Also attempted with (the now pulled) SlimICS
Theoretically should just require: adding:
package_extract_file("kernel/install.sh", "/tmp/install.sh");
set_perm(0,0, 0777, "/tmp/install.sh");
run_program("/tmp/install.sh");
if file_getprop("/tmp/nfo.prop","NativeSD") == "true"
then
ui_print("@ Installing System");
package_extract_dir("kernel/bootsd", "/boot");
package_extract_dir("kernel/kernel", "/boot");
package_extract_dir("kernel/bootsd", "/boot_dir");
package_extract_dir("kernel/kernel", "/boot_dir");
package_extract_dir("NativeSD", "/tmp");
set_perm(0, 0, 0777, "/tmp/nativesd.sh");
run_program("/tmp/nativesd.sh");
package_extract_dir("sdcard", "/sdcard");
package_extract_dir("system", "/system");
to the start and adding the below to the end
endif;
delete("/tmp");
unmount("/ext4p");
unmount("/system");
unmount("/data");
modifying according to ROM, removing any yaffs/format references, and adding in a NativeSD folder (#1) and an install.sh​
Boot.img (/also clk) patcher
Once NAND is done should be able to integrate mkbootimg scripts and allow flash boot and sboot
Other devices ???
Anyone willing to try let me know.
FAQ
Fixes Required:
NILFS2
NILFS2 support is currently attempted to be implemented by the following code:
Mount_Type=`mount | grep "nilfs2" | cut -d ' ' -f 5`
if [ "$Mount_Type" == "nilfs2" ]
then
sed -i 's/auto/nilfs2/1
/(NativeSD)/a \mkdir /nilfs\
mount nilfs2 /dev/block/mmcblk0p2 /nilfs' ns/init.rc
else
sed -i 's/auto/ext4/1' ns/init.rc (or ns/mountfs.sh with sc)
Have tried various combinations and added in other lines, to no avail.
Running mount | grep "nilfs2" | cut -d ' ' -f 3 on a running nilfs2 rom will return:
nilfs2
nilfs2
nilfs2
(there might be a fourth (can't recall), due to system, data and NativeSD being mounted as nilfs2)
Is there something I've overlooked? (Have tried with busybox mount | busybox grep | busybox cut)
Or can anyone see the mistake, it runs fine but $Mount_Type wont be reported as nilfs2.
I will post a workaround for nilfs2 but would rather have it integrated.
Edit not the workaround I was thinking of but if using nilfs2 changing == to != should make it work. doesn't seem to runon android
Current workaround is to remove the lines posted above leaving just:
sed -i 's/auto/nilfs2/1
/(NativeSD)/a \mkdir /nilfs\
mount nilfs2 /dev/block/mmcblk0p2 /nilfs' ns/init.rc (or ns/mountfs.sh if using sc)
​
Remove the need for changing ROM_NAME in nativesd.sh
I must be doing something wrong here.
Tried securecrt's zip on mokee and nilfs, reboot after htc screen.
Tred v zip on qsea v2 and ext4, reboot after htc screen.
Tried v zip on nexusHD2 ics and ext4 and it worked.
Tried v zip on pacman and ext4 and reboot.
It seems i am having trouble editing updater script when the rom has separate folders for initrd.gz and zImage. Each time the nand ramdisk appears in folders but is not edited.
Can you post your working edited updater script for pacman rom so that i can see where i have gone wrong.
Robbie P said:
I must be doing something wrong here.
Tried securecrt's zip on mokee and nilfs, reboot after htc screen.
Tred v zip on qsea v2 and ext4, reboot after htc screen.
Tried v zip on nexusHD2 ics and ext4 and it worked.
Tried v zip on pacman and ext4 and reboot.
It seems i am having trouble editing updater script when the rom has separate folders for initrd.gz and zImage. Each time the nand ramdisk appears in folders but is not edited.
Can you post your working edited updater script for pacman rom so that i can see where i have gone wrong.
Click to expand...
Click to collapse
PAC changes with full script attached:
ui_print("@ Installing System");
package_extract_dir("kernel/boot", "/boot");
package_extract_dir("kernel/kernel", "/boot");
package_extract_dir("kernel/kernel", "/boot_dir");
package_extract_dir("NativeSD", "/tmp");
set_perm(0, 0, 0777, "/tmp/nativesd.sh");
run_program("/tmp/nativesd.sh");
package_extract_dir("sdcard", "/sdcard");
package_extract_dir("system", "/system");
as far as I recall I used the attached v1 so should be no problems there, just make sure to change rom_name.
Have tried modifying nand updater-scripts (BBCM7 and SlimICS) but not working at the moment.
Will also post modified scripts to change the ramdisk from a running build (which datagr shouldn't have any problems incoporating into his app).
In terms of nilfs2, have you tried that with v1? Will have a look through sc to see if it's running correctly
In your instructions first post, the code is inserted after "package_extract_dir("system","/system");"
But the working script has it before this. That seems to be where it went wrong for me, because now pacman 1.1 on v with ext4 boots Edit; track forwards/backwards now working too.
The instructions worked for NexusHD2 ics 2.7 though, with the initrd.gz and zImage in the same folder.
Tried nativesdsc1.1 on nilfs with != on pac1.1 -stuck on magldr gogogo. Native sd folder initrd.gz 915.1Mb, NativeSD/PAC folder initrd.gz 168.3Mb
BTW i didn't see a nilfs2 file in sc1.1, does this matter.
BTW2 i have got a working rom on nilfs, but installed it via diff files on post3 fs superthread
Robbie P said:
Tried nativesdsc1.1 on nilfs with != on pac1.1 -stuck on magldr gogogo. Native sd folder initrd.gz 915.1Mb, NativeSD/PAC folder initrd.gz 168.3Mb
BTW i didn't see a nilfs2 file in sc1.1, does this matter.
BTW2 i have got a working rom on nilfs, but installed it via diff files on post3 fs superthread
Click to expand...
Click to collapse
No I incorporated nilfs2 into the nativesd script as it's only two lines. It seems != doesn't work on android, another workaround then that should work is to remove the lines
Mount_Type=`mount | grep "nilfs2" | cut -d ' ' -f 5`
if [ "$Mount_Type" == "nilfs2" ]
then
else
sed -i 's/auto/ext4/1' ns/init.rc altogether
And haven't tested sc at all yet, have been trying to made a text driven script for the on device one.
If your getting that with sc then the script isn't running at all, there'll be a mistake somewhere
Edit. fixed now (sc1 was more right than 1.1)
Just tried sc1.2 on pac1.1 nilfs changed ROM_NAME in install.sh and nativesd.sh and auto in install.sh-hangs on white htc screen
tried deleting everything in between # changing auto to ext4 or nilfs2 and # fixing permissions (and auto to nilfs2 in install.sh), and it hangs on black htc screen.
Edit; just found out i had wrong kernel in my zip.....
Did these two tests again-both times hangs on black htc screen. have attached DMESGs. (i had edited updater-script for these, did not mention this above).
tried pacman 1.1te with v1.1 on ext4 -working
will post initrd.gz on pacman thread
Robbie P said:
Just tried sc1.2 on pac1.1 nilfs changed ROM_NAME in install.sh and nativesd.sh and auto in install.sh-hangs on white htc screen
tried deleting everything in between # changing auto to ext4 or nilfs2 and # fixing permissions (and auto to nilfs2 in install.sh), and it hangs on black htc screen.
Edit; just found out i had wrong kernel in my zip.....
Did these two tests again-both times hangs on black htc screen. have attached DMESGs. (i had edited updater-script for these, did not mention this above).
Click to expand...
Click to collapse
Between # changing auto to ext4 or nilfs2 and # fixing permissions in v you need to leave
sed -i 's/auto/nilfs2/1
/(NativeSD)/a \mkdir /nilfs\
mount nilfs2 /dev/block/mmcblk0p2 /nilfs' ns/init.rc (or ns/mountfs.sh with sc).
Still hanging on htc screen m8.
Will give v1.1 a go.
Edit; Tried v1.1 on pac1.1te on nilfs using working ext4 build as it seemed like it might work-hangs on boot.
Edited as post above (already auto in install.sh), aroma says installed ok, but it took a few seconds. no initrd.gz created.
Just tried cmtight beta v1.0 with nativesd-ext4(2) and it boots with normal initrd.gz
it also boots with v initrd.gz
But with sc initrd.gz it just hangs on htc screen
tmp folder created in NativeSD/CMTight folder, but is empty (on pc)
There seems to be a problem with bt on this ROM, doesn't want to send sound, but skipping tracks works (on v). Saw a post in the nand thread about bt not working.
Will try again with sundawg's cm7 but no luck so far.
Robbie P said:
Just tried cmtight beta v1.0 with nativesd-ext4(2) and it boots with normal initrd.gz
it also boots with v initrd.gz
But with sc initrd.gz it just hangs on htc screen
tmp folder created in NativeSD/CMTight folder, but is empty (on pc)
There seems to be a problem with bt on this ROM, doesn't want to send sound, but skipping tracks works (on v). Saw a post in the nand thread about bt not working.
Will try again with sundawg's cm7 but no luck so far.
Click to expand...
Click to collapse
Thanks, again for testing these, have pulled and readded those zips, the tmp folder should copy now and have changed the sc side based on marco's suggestions (thought I'd already done that).
Should have my phone at the very least in a condition where I can install zips, so will get some testing done myself soon enough.
(Have posted ramdisk for Sundawg-CM7 in the other thead if you haven't seen it, will add another in a few mins)
tried latest on miuijb
tmp folder is full
normal initrd boots
v initrd reboots almost immediately
sc initrd reboots almost immediately
Do you need me to post anything as i am off to bed soon.
Robbie P said:
tried latest on miuijb
tmp folder is full
normal initrd boots
v initrd reboots almost immediately
sc initrd reboots almost immediately
Do you need me to post anything as i am off to bed soon.
Click to expand...
Click to collapse
The init.rc's if you wouldn't mind (off soon myself) and is there a rom_name.txt?
Edit: The init.rc's should be in NativeSD/tmp/ns2 (and ns3) if the folders copied correctly, I take it that there are no folders in tmp then.
Edit. Opened those ramdisks and they just have bin folders (and mountfs.sh with sc); did you remember to add the nand ramdisk to the NativeSD folder in the zip?
That explains why you can't find any init.rc files
couldn't find init.rc, found initrcmod, renamed it to .txt
Edit; doh! they are in these, sorry. Night
ooh, just tried to DL from market using cmtight and initrd-ext4-v.gz from before, and can't DL (error 101). It works ok using normal initrd.gz. No bootloop though, as gtbluesky got in nativesd thread.
Also perhaps miuijb was not best choice for last test, as got the same results as gtbluesky.
---------- Post added at 02:27 PM ---------- Previous post was at 02:12 PM ----------
HypoTurtle said:
did you remember to add the nand ramdisk to the NativeSD folder in the zip?
That explains why you can't find any init.rc files
Click to expand...
Click to collapse
Sorry m8, just checked and no ramdisk.

[Q] Include user app into flasheable ROM zip.

Hello guys! Hope you can help me with this.
I want to include some apps in my rom, but this app CANT be in the normal /system/app I want that they install as usar app every time i flash. It upose -i read it- that i should create a folder called "data" in the Root of my ROM. So i will have 3 folders: /META-INF/ /system/ and /data/
Along with this i have to edit with notepad++ the updater-script in the directory META-INF\com\google\android and add just below the line package_extract_dir("system", "/system"); the following:
format("yaffs2", "MTD", "userdata");
mount("yaffs2", "MTD", "userdata", "/data");
package_extract_dir("data", "/data");
set_perm(1000, 1000, 0771, "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
And save the file. So i just have to put the .apk files in the /data/ and they will appear like *****in' magic every time i flash... But no, is not working .
Where is the error or what is the right wat to do it? Thanks
And yeah, english is not my native language
mauriciognr said:
Hello guys! Hope you can help me with this.
I want to include some apps in my rom, but this app CANT be in the normal /system/app I want that they install as usar app every time i flash. It upose -i read it- that i should create a folder called "data" in the Root of my ROM. So i will have 3 folders: /META-INF/ /system/ and /data/
Along with this i have to edit with notepad++ the updater-script in the directory META-INF\com\google\android and add just below the line package_extract_dir("system", "/system"); the following:
format("yaffs2", "MTD", "userdata");
mount("yaffs2", "MTD", "userdata", "/data");
package_extract_dir("data", "/data");
set_perm(1000, 1000, 0771, "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
And save the file. So i just have to put the .apk files in the /data/ and they will appear like *****in' magic every time i flash... But no, is not working .
Where is the error or what is the right wat to do it? Thanks
And yeah, english is not my native language
Click to expand...
Click to collapse
If you want the app to be a system app, have you tried extracting the library files in the .apk? Open the .apk using WinRAR (an .apk is real
y like a .zip file) and open the folder 'lib' (if there is one). The folder within should be called something like 'armv7a' or 'armv6'. If your device is an ARMv6 device (search it up) the app may be incompatible with your device if there is no matching 'armv6' folder. If there is, open the folder and extract the .so file(s) and put them under /system/lib/ on your device, either with a root file browser, or with a .zip via CWM, Anyways, what app are you trying to install
?
Codename13 said:
If you want the app to be a system app, have you tried extracting the library files in the .apk? Open the .apk using WinRAR (an .apk is real
y like a .zip file) and open the folder 'lib' (if there is one). The folder within should be called something like 'armv7a' or 'armv6'. If your device is an ARMv6 device (search it up) the app may be incompatible with your device if there is no matching 'armv6' folder. If there is, open the folder and extract the .so file(s) and put them under /system/lib/ on your device, either with a root file browser, or with a .zip via CWM, Anyways, what app are you trying to install
?
Click to expand...
Click to collapse
Thanks for reply, but I already know that and already did it. Due to my phone have REALLY little rom memory. So my dream was to allow some apps to be instaled along with the rom.zip but as a user app. Im sick and tired already have almost a week like 6 hours day making my mod of a rom and now that is ready and sexy i cant "transfer the data folder from de rom.zip to data. Thanks for replay.
Have you looked into dsixda's kitchen? It will load your ROM and add in the bits needed to do what you want. The only downside is it isn't really updated anymore. You could also find a mod that flashes user apps in your phone's respective forum, then open it up and look at the updater-script.
Sent from a Toasted Devil
netwokz said:
Have you looked into dsixda's kitchen? It will load your ROM and add in the bits needed to do what you want. The only downside is it isn't really updated anymore. You could also find a mod that flashes user apps in your phone's respective forum, then open it up and look at the updater-script.
Click to expand...
Click to collapse
Now here I am with identical problem. In my case,
A. There is no forum with other mods for the TV Stick I am coding.
B. Dxixda's Kitchen chocked up with the AMLOGIC Kernel and refused to help further.
So here's my problem that, I have been breaking my head on this for a week now.
I have a TV Stick with android ICS 4.0.4, and has "yafss2" format. I have attached the mountpoint info, partition info and my updater script.
I am trying to mount the /Data Partition so that I can copy a test APK to /Data/App folder for now. Eventually I need to copy other stuff like app data to /data/data.
Although edify script requires the format
mount(type, device, mountpoint);
I need to do
mount("yafss2","MTD", "/dev/block/mtdblock7", "/data");
for some reason, otherwise the AMLOGIC Recovery gives error of missing parameter.
Anyway, even after following that format, its not working.
The subsequent "package_extract_dir" operation is not successful and I can see the files are not getting copied.
I'd dearly appreciate any pointers and advice.
may be you should set the permission on the /data instead of on the /system/app in you updater script.
hope this can help....
tepar said:
may be you should set the permission on the /data instead of on the /system/app in you updater script.
hope this can help....
Click to expand...
Click to collapse
I should have commented out that statement. I realized it after I posted. No it doesn't really matter anyway. The files didn't get copied to there's no permissions to set.

[Guide][For Beginners] How to make flashable zips of anything.

Disclaimer
I will not be responsible if you screw up with your device.
Do make a Nandroid backup first.
Before we start
Downloads
WinRAR
Notepad++
Template Zip
Lets get started
I have provided you with the template zip inside which by making changes we can create our flashable zips. All necessary files are inside Template zip
Open up the template zip. There you will see two folders "META-INF" and "system". [In "META-INF" all the coding stuff resides and in "system" all your apps and media files resides.]
META-INF
In META-INF have one folder "com" and three files [We don't have to edit these three files]
Now open "com" folder and inside it open "google" folder then "android" folder.
Now inside "android" folder you will see two files "update-binary" [We don't have to edit this file, leave it as it is.] and "updater-script"[It is the file which is used to tell custom recovery what to do with the flashable zip ].
We have to edit "updater-script" file by using notepad++. [Scroll below to see how to edit updater-script]
System Folder
It is the folder where all of your apks, zips, libs reside.
Inside System Folder make folders as following:
If you want to flash an app and make it system app create "app" folder and if not a system app make "priv-app" folder. You can also make "lib" folder along with "app" folder if your apps uses libs.
If you want to flash a bootanimation or ringtones etc make "media" folder.
If you want to flash something else ask it below.
How to edit "updater-script"?​
What is updater-script?
updater-script is a file written in edify script language which instructs the recovery to perform certain tasks.
updater-script is located in /META-INF/com/google/android/updater-script in flashable zip
Some basic rules:
Every statement must end with a semicolon (; )
Comments must start with #
Strings must be delimited by double quotes (” “)
Commands
Now i will try to explain commands used in updater-script in very easy language or noob language.
Code:
format("yaffs2", "MTD", "system", "/system");
The above command is used to format the specified partition
Syntax explanation:
format - The main command to direct the recovery to format using the following parameters
"yaffs2" - Filesystem type used in the device
"MTD" - Type of the partition used in the file system
"system" - Name of the partition to be formatted
"/system" - Location of the partition to be formatted
======================================================================================================
Code:
ui_print("Format Completed");
The above command directs the recovery to display the following text enclosed in double quotes in the user interface (display).
After successful formatting it displays "Format Completed" in the device screen.
======================================================================================================
Code:
mount("yaffs2", "MTD", "system", "/system");
The mount command directs the recovery to mount the following file system and the following partition
The text syntax is same as format command as instead of formatting it mounts.
======================================================================================================
Code:
package_extract_dir("system", "/system");
This command searches for the directory (folder) named "system" in the root of the zip file and copies all the content of the "system" folder from the zip file into the "/system" partition which is already mounted by the previous mount command ie it copies all the folder items inside system folder like apps, media etc as explained above.
======================================================================================================
Code:
package_extract_file("autoroot.sh", "/tmp/autoroot.sh");
This command searches for the file named "autoroot.sh" in the root of the zip file and copies the file to "/tmp" folder and names it as "autoroot.sh" (here it does not change the name)
======================================================================================================
Code:
symlink("mksh", "/system/bin/sh");
The above command creates a symlink.
What is symlink?
Symlink is nothing but shortcuts, for example if a file is required in two different places instead of copy pasting the file in two different locations, the file is copied to one of the two locations and in the other location a shortcut to the file(symlink) is created. The source and the symlink can have different names (actually this is the prime use of symlinks).
Let me explain it in a noob friendly manner.
Take the above symlink, it creates a shortcut(symlink) for the command "mksh" and places it in the path of the operating system. The shortcut(symlink) directs to the file "/system/bin/sh" , so whenever the os gets a request to execute the "mksh" command, the actual
binary that gets excuted will be "/system/bin/sh" .
Creating symlinks saves a lot of space because instead of copying the whole file and placing it in requiered places we are just creating shortcuts which directs to the source file which can be placed anywhere in the file system (generally placed in the path of the os).
======================================================================================================
Code:
set_perm_recursive(0, 0, 0755, 0644, "/system");
The above command is used to set permission recursively for the files and folders present inside a folder (in this case for "/system" folder).
Explanation of syntax:
0 - uid - It defines that the following permission is set for the user id 0 .
0 - gid - It defines that the following permission is set for the group id 0 .
0775 - Dirmode - It defines that 0775 permission to set to directories contained within the specified directory.
0644 - Filemode - t defines that 0644 permission to set to files contained within the specified directory.
"/system" - Target directory to set the above mentioned permissions.
======================================================================================================
Code:
set_perm(0, 3003, 06755, "/system/bin/ip");
The above command is used to set permission for a individual file (in this case for "/system/bin/ip" file).
syntax explanation:
0 - uid - It defines that the following permission is set for the user id 0 .
3003 - gid - It defines that the following permission is set for the group id 3003 .
06775 - It defines that 06775 permission to set to the specific file.
"/system/bin/ip" - Target file to set the above mentioned permissions.
Other Permission commands:
Use to push new files to /data partition and /system partition.
ui_print(“Setting permissions…”);
set_perm_recursive(1000, 1000, 0771, 0644, “/data/app”);
set_perm_recursive(0, 0, 0755, 0644, “/system”);
set_perm_recursive(0, 0, 0777, 0777, “/system/etc/init.d”);
set_perm_recursive(0, 2000, 0755, 0755, “/system/bin”);
set_perm(0, 3003, 06755, “/system/bin/ip”);
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_recursive(1002, 1002, 0755, 0440, “/system/etc/bluetooth”);
set_perm(0, 0, 0755, “/system/etc/bluetooth”);
set_perm(1000, 1000, 0640, “/system/etc/bluetooth/auto_pair_devlist.conf”);
set_perm(1002, 1002, 0440, “/system/etc/dbus.conf”);
set_perm(1014, 2000, 0550, “/system/etc/dhcpcd/dhcpcd-run-hooks”);
set_perm(0, 2000, 0550, “/system/etc/init.goldfish.sh”);
set_perm_recursive(0, 0, 0755, 0555, “/system/etc/ppp”);
set_perm_recursive(0, 2000, 0755, 0644, “/system/vendor”);
set_perm_recursive(0, 2000, 0755, 0644, “/system/vendor/etc”);
set_perm(0, 2000, 0755, “/system/vendor/lib”);
set_perm(0, 2000, 0755, “/system/vendor/lib/hw”);
set_perm_recursive(0, 2000, 0755, 0755, “/system/xbin”);
set_perm(0, 0, 06755, “/system/xbin/su”);
set_perm(0, 1000, 0755, “/system/xbin/busybox”);
======================================================================================================
Code:
unmount("/system");
This command just unmount the system.
======================================================================================================
iflesh Command:
Code:
Ifelse(condition),(do_this),(else_do_this);
Example:
Code:
ifelse mount("yaffs2", "MTD", "system", "/system") == "system", ui_print("Mounted!"), ui_print("Mount Failed!");
Ifelse command can be explained simply as asking the system to do something based on the result of a condition.
From example:
The ifelse command would attempt to mount the MTD partition named "system" to "/system".
If the mounting process succeeds (the condition), the script will display "Mounted!", else it will display "Mount Failed!"
======================================================================================================
Code:
abort()
It just abort's the script execution.
Note: It is usually paired with some other command for example the getprop command or with ifelse. Independently specifying abort() in the updater-script will kill the script abruptly right there so use this command carefully.
======================================================================================================
Code:
show_progress(fraction,duration)
Code:
show_progress(0.2,5);
fraction = a fraction of the bar (more on that in a moment)
duration = seconds
The "seconds" part just means how long the progress bar should take to fill up to the new level. It will not delay your script in any way: it will only take this much time if something else in the script is also taking that much time.
For example, if you run this snippet, you can watch the progress bar partially fill up pieces at a time. Each piece will take 5 seconds to fill, then pause for 2 seconds before the next piece starts (sleep command is for 7, so after the progress bar is done its 5 seconds of movement, there are 2 seconds of sleep left until the next command)
======================================================================================================
ALWAYS LEAVE TWO BLANK LINE AT THE END OF THE update-script (if the code contains 50 lines then 52 lines should be visible in the notepad++ including two blank line after the end of the script)
======================================================================================================
HOPE I HELPED YOU GUYS..... IF I MISS SOMETHING PLEASE LET ME KNOW.... AND DON'T FORGET TO PRESS THANKS....:good:
For More Info visit: http://forum.xda-developers.com/wiki/Edify_script_language
Reserved
Reserved
Excellent guide!!, thanks , it will help me a lot.
xxkirianxx said:
Excellent guide!!, thanks , it will help me a lot.
Click to expand...
Click to collapse
Its good that it helped you!!!
If I want to remove system folder and data folder so is it possible without any wrong effects
Sent from my Symphony V80 using XDA-Developers mobile app
lkdevil said:
If I want to remove system folder and data folder so is it possible without any wrong effects
Sent from my Symphony V80 using XDA-Developers mobile app
Click to expand...
Click to collapse
Whole system folder or a folder inside /system
META-INF Folder
hi. @TheRoyalSeeker
we only edit what in "updater-script" ( to make it flashable via recovery )
now my question is :
1. is (update-binary) always suitable for all android platform - KK, LP, even MM ?
2. or is it (update-binary) always suitable for any devices ?
if no.. so..
I believe I can make "META-INF" Folder or "updater-script" by myself, but for "CERT.RSA" , "CERT.SF" , "MANIFEST.MF" and "update-binary" could you tell me how or from where can I take or pull those file ?
I'm stuck on those 4 files
if yes.. so..
I dont really bother anymore, I just download any "template.zip" which is containing those files, and only editing "updater-script"
thank you very much for your reply. I'm kindly appreciate anyhelp.
maz izaackovich said:
hi. @TheRoyalSeeker
we only edit what in "updater-script" ( to make it flashable via recovery )
now my question is :
1. is (update-binary) always suitable for all android platform - KK, LP, even MM ?
2. or is it (update-binary) always suitable for any devices ?
if no.. so..
I believe I can make "META-INF" Folder or "updater-script" by myself, but for "CERT.RSA" , "CERT.SF" , "MANIFEST.MF" and "update-binary" could you tell me how or from where can I take or pull those file ?
I'm stuck on those 4 files
if yes.. so..
I dont really bother anymore, I just download any "template.zip" which is containing those files, and only editing "updater-script"
thank you very much for your reply. I'm kindly appreciate anyhelp.
Click to expand...
Click to collapse
"update-binary" is pretty much universal and the only problem that might occur is with x86 devices.
For extracting "update-binary" and other files you can use your ROM's zip.
Use template zip, i don't think any problem will occur.
TheRoyalSeeker said:
Disclaimer
For More Info visit: http://forum.xda-developers.com/wiki/Edify_script_language
Click to expand...
Click to collapse
bundle of thanks brother i really really appricate your hard work, today XDA successfull coz XDA have your kind of peoples
brother its help me alot,
i want to know something , i extracted the lollipop rom , the format it system,img,ext4 ........now i change the some permissions
now i want to again repack the rom so how can i repack it? pack in img,ext4
and 2nd Q is that,
i create a zip file , from stock system,img,ext4 and after create with meta folder, during installation in end its says , end with error 7 etc
after i reboot so it take 5 minuts and after BB is unknown with null imei, why?
Mr Hassan said:
bundle of thanks brother i really really appricate your hard work, today XDA successfull coz XDA have your kind of peoples
brother its help me alot,
i want to know something , i extracted the lollipop rom , the format it system,img,ext4 ........now i change the some permissions
now i want to again repack the rom so how can i repack it? pack in img,ext4
and 2nd Q is that,
i create a zip file , from stock system,img,ext4 and after create with meta folder, during installation in end its says , end with error 7 etc
after i reboot so it take 5 minuts and after BB is unknown with null imei, why?
Click to expand...
Click to collapse
Sorry, but I don't know how to repack system.img.ext4, i have never made a rom before or edited yet, so i will be unable to help about that.
Error 7 generally occurs due to some wrong scripting in updater-script or by using incompatible update-binary.
You can share your updater-script here, so i can check it.
TheRoyalSeeker said:
Sorry, but I don't know how to repack system.img.ext4, i have never made a rom before or edited yet, so i will be unable to help about that.
Error 7 generally occurs due to some wrong scripting in updater-script or by using incompatible update-binary.
You can share your updater-script here, so i can check it.
Click to expand...
Click to collapse
thanks for reply, check it
Mr Hassan said:
thanks for reply, check it
Click to expand...
Click to collapse
Sorry for replying too late, I have been too much busy lately and that's why I haven't been using XDA since last 20 days.
I am sure you might have fixed the problem by yourself as it has been many days since you posted the above post.
Again just want to apologise for not being able to reply.
TheRoyalSeeker said:
Sorry for replying too late, I have been too much busy lately and that's why I haven't been using XDA since last 20 days.
I am sure you might have fixed the problem by yourself as it has been many days since you posted the above post.
Again just want to apologise for not being able to reply.
Click to expand...
Click to collapse
thanks for again your reply ,
now i,m in next step, kindly if you have time so please visit and share your experience
https://forum.xda-developers.com/android/help/repack-img-giving-error-odin-invalid-t3577719

[Q][GAPPS] How to include GAPPS in ROM?

Hello community!
I was wondering if anybody can help me integrate GAPPS in a ROM.
Some ROMS have them inbuilt and don't require a seperate GAPPS installation.
So yeah, is it possible and if yes, what is the procedure?
Device is Note 8 (N950F).
ROM I'm working on currently is stock based but debloated.
Thanks in advance!
SaadatM said:
Hello community!
I was wondering if anybody can help me integrate GAPPS in a ROM.
Some ROMS have them inbuilt and don't require a seperate GAPPS installation.
So yeah, is it possible and if yes, what is the procedure?
Device is Note 8 (N950F).
ROM I'm working on currently is stock based but debloated.
Thanks in advance!
Click to expand...
Click to collapse
Hi ....
first flash gapps after flashing your stock debloated rom and after booting find what apps and files are added by using sort options according to time desending in any file manager like mix and include those files in the same folders in your stock rom........Thats it......
Note: You dont have to update your update-script afterwards.....
Hope this helps
Add this code in the end of your updater script and rename your gapps file to gapps and place it inside your meta-inf folder
Code:
ui_print("Installing GAPPS...");
package_extract_dir("META-INF/gapps", "/tmp/install/bin/gapps");
run_program("/sbin/busybox", "unzip", "/tmp/install/bin/gapps/gapps.zip", "META-INF/com/google/android/*", "-d", "/tmp/install/bin/gapps");
run_program("/sbin/busybox", "sh", "/tmp/install/bin/gapps/META-INF/com/google/android/update-binary", "dummy", "1", "/tmp/install/bin/gapps/gapps.zip");
Trex2017 said:
Add this code in the end of your updater script and rename your gapps file to gapps and place it inside your meta-inf folder
Code:
ui_print("Installing GAPPS...");
package_extract_dir("META-INF/gapps", "/tmp/install/bin/gapps");
run_program("/sbin/busybox", "unzip", "/tmp/install/bin/gapps/gapps.zip", "META-INF/com/google/android/*", "-d", "/tmp/install/bin/gapps");
run_program("/sbin/busybox", "sh", "/tmp/install/bin/gapps/META-INF/com/google/android/update-binary", "dummy", "1", "/tmp/install/bin/gapps/gapps.zip");
Click to expand...
Click to collapse
Thanks, exactly what I was looking for!
Trex2017 said:
Add this code in the end of your updater script and rename your gapps file to gapps and place it inside your meta-inf folder
Code:
ui_print("Installing GAPPS...");
package_extract_dir("META-INF/gapps", "/tmp/install/bin/gapps");
run_program("/sbin/busybox", "unzip", "/tmp/install/bin/gapps/gapps.zip", "META-INF/com/google/android/*", "-d", "/tmp/install/bin/gapps");
run_program("/sbin/busybox", "sh", "/tmp/install/bin/gapps/META-INF/com/google/android/update-binary", "dummy", "1", "/tmp/install/bin/gapps/gapps.zip");
Click to expand...
Click to collapse
Hi, I would like to ask putting gapps-config in the same meta-inf folder will work or not??
MrMoon said:
Hi, I would like to ask putting gapps-config in the same meta-inf folder will work or not??
Click to expand...
Click to collapse
yes , but you have to grep and change all paths to the cnfg file i other files
Can you tell me how you add play store in ROM while editing. I want to do this all step in Android Oreo 8.1 Please help me.
Zip file is corrupt error pops up when I try flashing.
Didn't work
Little more help, please.
Trex2017 said:
Add this code in the end of your updater script and rename your gapps file to gapps and place it inside your meta-inf folder
Code:
ui_print("Installing GAPPS...");
package_extract_dir("META-INF/gapps", "/tmp/install/bin/gapps");
run_program("/sbin/busybox", "unzip", "/tmp/install/bin/gapps/gapps.zip", "META-INF/com/google/android/*", "-d", "/tmp/install/bin/gapps");
run_program("/sbin/busybox", "sh", "/tmp/install/bin/gapps/META-INF/com/google/android/update-binary", "dummy", "1", "/tmp/install/bin/gapps/gapps.zip");
Click to expand...
Click to collapse
hey there pal, I have unpacked the whole ROM package and then I've replaced all the stock apks with the google ones. But once I repack and I install the zip, Android Setup crashes.
I'm on Android 11. Any help?
I would really appreciate it.

Categories

Resources