[Q] Simple script please... - General Questions and Answers

I am trying to create my own flashable icon pack based on flahable zip for Galaxy Y...
But I wonder if the written command line to mount /data, /sdcard and /system on updater-script is for all device?
mount("rfs", "EMMC", "/dev/block/stl9", "/system");
mount("rfs", "EMMC", "/dev/block/stl9", "/system");
mount("rfs", "EMMC", "/dev/block/stl2", "/data");
mount("rfs", "EMMC", "/dev/block/stl11", "/data");
mount("rfs", "EMMC", "/dev/block/mmcblk0p2", "/sd-ext");
So, I have to checked on other flashable zip (flashable SuperSU) that I have used if it's the same, but I found:
mount /system
mount /data
mount -o rw,remount /system
mount -o rw,remount /system /system
mount -o rw,remount /
mount -o rw,remount / /
...so how can I really mount (in read/write) /data, /sdcard and /sysem in writing in <name>.sh
TIA!

The flashable SuperSU uses a different approach, a shell script to flash packages.
However, for most of the flashable zips, people use the first method i.e updater script method
include a busybox command in a sbin folder,
Now mount /system using
run_program("/sbin/busybox", "mount", "-o", "remount,rw", "/system");
and mount /data and /sdcard similarly
Hope it helps

Related

[DEV Q] updater-script and edify

can someone smarter than me help me or point me in the right direction to convert my updater-scripts to edify. i think im sort of getting it but i want to make sure because i'm not a programmer. for instance, is the update-binary file required or just updater-script? also, the code posted below, it what i've come up with for flashing my themes, is it correct? and will it work with the new recoveries?
Code:
ui_print("Preparing system for istallation...");
ui_print("Wiping Cache / Dalvik...");
delete_recursive("/cache");
delete_recursive("/data/dalvik-cache");
ui_print("Installing Project_Bliss HD...");
show_progress(0.100000, 60);
package_extract_dir("system", "/system");
show_progress(1.000000, 0);
i am unsure whether or not i will have to mount the specific partitions for data and cache for this to work. i can always leave that part out but the less the person flashing needs to do the better. if i do have to mount in the script will the code below work for just a simple theme flash.
Code:
ui_print("Preparing system for installation...");
run_program("/sbin/mount", "/dev/block/mtdblock4", "/system");
ui_print("Installing Project_Bliss HD...");
show_progress(0.100000, 60);
package_extract_dir("system", "/system");
show_progress(1.000000, 0);
Anyone?
10 char
No one? Hmmmm?
I'm also interested in the same topic..
trying to build rom with dsixida kitchen and converting it from update to updater scripts remove all ui_print functions...
If I add them manually then clockwork refuses to boot that image...
Ditto... same issue about the ui_print... don't get it, because after the update-script gets created to the updater-script/update-binary cant be changed.
try this
show_progress(0.500000, 20);
run_program("/sbin/mount", "/system");
package_extract_dir("system", "/system");
unmount("/system");
show_progress(0.500000, 30);
ui_print("All done!");

[DEV DISCUSSION] Install method for users on BML OR MTD!

So... I know Random started something like this... and to be quite honest... This idea stemmed from the post.
What i have in mind, is an installer that can differentiate between BML and MTD... Making it TONS easier on the end user.
The idea is that it checks for config values in the build.prop (that are present for devs that have their ROMs on Rom Manager), and then if the installer already has the last previous version of a specific dev's ROM on the phone, it goes on to update... If the value is NOT present in the build.prop, it goes on to backup the phone, and then find which partition type the current system is on, to install a fresh system on that partition.
here's the code... make what you want, and all comments are welcomed... i just can't get this routine to work... and now i'm reaching out to the community for help... as i feel this would be beneficial to all, since we're making the jump from one partition map to another... which is a HUGE deal for people who are skeptical of doing so... let me know what you think.
This is as basic of code as i could break it down to... Let me know if it's not simplified enough.
Code:
ifelse(
getprop("ro.modversion") == "Legendary_rc_2.2",
(
ui_print("Currently running Legendary 2.2 | No changes until 2.3!");
),
(
ui_print("Backing up data...");
ifelse(
mount("yaffs2", "MTD", "system", "/system") == "system",
(
ui_print("Formatting Filesystem... (YAFFS2)");
),
(
ui_print("Formatting Filesystem... (EXT4)");
)
);
ui_print("Mounting file system...");
ui_print("Extracting ROM...");
ui_print("Restoring data");
ifelse(
mount("yaffs2", "MTD", "system", "/system") == "system",
(
ui_print("More YAFFS2 Stuff");
),
(
ui_print("--");
)
);
)
);
ui_print("Extracting Kernel...");
ifelse(
mount("yaffs2", "MTD", "system", "/system") == "system",
(
ui_print("Install MTD Kernel");
),
(
ui_print("Install BML Kernel");
)
);
ifelse(
mount("EXT4", "BML", "system", "/system") == "system",
(
ui_print("You're still using an EXT4 (BML) partition...");
),
(
ui_print("If not, Notify users that they're YAFFS2 (which at this point ODIN would be the only other option.) ");
)
);
Well lets do this. What is the order of each line, that your seeing in your head.
Example: 1. Check in build.prop for ("ro.modversion") == "Legendary_rc_2.2
2. If on earlier version update to 2.2
3.etc etc
Know I know you laid it out but just write what needs to be done exactly in order. Then we can figure out how to do it in updater-script and simplify it if needed. I can help figure out atleast bits and pieces and I am sure others will be in for figuring out parts. Also I don't see anything about installing MTD or BML recovery. Well we should also give an option to upgrade to MTD if your on BML.
Edit: I ran the script and it didn't check build.prop for the ro.modversion??
It would be <=Legendary 2.2
Sent from my SPH-D700 using XDA App
marcusant said:
It would be <=Legendary 2.2
Sent from my SPH-D700 using XDA App
Click to expand...
Click to collapse
I checked my build.prop and it was Legendary_rc_2.2 ??
The_Legendary said:
I checked my build.prop and it was Legendary_rc_2.2 ??
Click to expand...
Click to collapse
No... the code for less than
Sent from my SPH-D700 using XDA App
marcusant said:
No... the code for less than
Sent from my SPH-D700 using XDA App
Click to expand...
Click to collapse
Ohhh duhhh I need sleep :\
hoffman1984 said:
[...]here's the code... make what you want, and all comments are welcomed... i just can't get this routine to work... and now i'm reaching out to the community for help... as i feel this would be beneficial to all, since we're making the jump from one partition map to another... which is a HUGE deal for people who are skeptical of doing so... let me know what you think. [...]
Click to expand...
Click to collapse
I've gotten the code to run. The updater binary I'm using is looking for 3 arguments in the mount command instead of 4. Apparently, at least for my binary, it should look like:
mount("MTD", "system", "/system")
This lets the script run, so I wrote the following as a test:
Code:
ifelse(
# read the mount
mount("MTD", "system", "/system") == "system",
(
# Success
ui_print("Successfully Mounted!");
),
(
# Fail
ui_print("Mount Failed!");
)
);
A simple script to test the function... but unfortunately it reports "Mount Failed!" whether I ask for MTD or BML. That's as far as my brain is going right now.
UPDATE: So, apparently Samurai Kernel has already done this. I haven't checked if it works but it's here on pastebin.
hey hoffman i know you sent me a PM, was actually working on this alongside you except my approach is different in that i only check against mount-ability once and store a propfile with the relevant details. It's safer because you don't have to keep track of the mounts. here's the relevant code, it's two parts.
The beauty about this way of doing it is that we can handle EXT4, RFS, and MTD/YAFFS2 automatically.
pmfs.sh
establishes a property listing of partition map / file system details in a file /tmp/pmfs.
Code:
#!/sbin/sh
# 2012-01-01 SENSEISIMPLE
BB="/sbin/busybox"
MOUNT="$BB mount"
UMOUNT="$BB umount"
pmfs="/tmp/pmfs"
$BB rm -f $pmfs
$BB rm -f /sdcard/.PARTMAPFS.prop
$UMOUNT /system
if $MOUNT -t ext4 /dev/block/stl9 /system &> /dev/null; then echo -e "syspm=bml\nsysfs=ext4\nsyspmfs=bmlext4" >> "$pmfs"; fi
$UMOUNT /system
if $MOUNT -t rfs /dev/block/stl9 /system &> /dev/null; then echo -e "syspm=bml\nsysfs=rfs\nsyspmfs=bmlrfs" >> "$pmfs"; fi
$UMOUNT /system
if $MOUNT -t yaffs2 /dev/block/mtdblock2 /system &> /dev/null; then echo -e "syspm=mtd\nsysfs=yaffs2\nsyspmfs=mtdyaffs2" >> "$pmfs"; fi
$UMOUNT /system
$UMOUNT /data
if $MOUNT -t ext4 /dev/block/stl10 /data &> /dev/null; then echo -e "datpm=bml\ndatfs=ext4\ndatpmfs=bmlext4" >> "$pmfs"; fi
$UMOUNT /data
if $MOUNT -t rfs /dev/block/stl10 /data &> /dev/null; then echo -e "datpm=bml\ndatfs=rfs\ndatpmfs=bmlrfs" >> "$pmfs"; fi
$UMOUNT /data
if $MOUNT -t yaffs2 /dev/block/mtdblock3 /data &> /dev/null; then echo -e "datpm=mtd\ndatfs=yaffs2\ndatpmfs=mtdyaffs2" >> "$pmfs"; fi
$UMOUNT /data
$UMOUNT /cache
if $MOUNT -t ext4 /dev/block/stl11 /cache &> /dev/null; then echo -e "cacpm=bml\ncacfs=ext4\ncacpmfs=bmlext4" >> "$pmfs"; fi
$UMOUNT /cache
if $MOUNT -t rfs /dev/block/stl11 /cache &> /dev/null; then echo -e "cacpm=bml\ncacfs=rfs\ncacpmfs=bmlrfs" >> "$pmfs"; fi
$UMOUNT /cache
if $MOUNT -t yaffs2 /dev/block/mtdblock4 /cache &> /dev/null; then echo -e "cacpm=mtd\ncacfs=yaffs2\ncacpmfs=mtdyaffs2" >> "$pmfs"; fi
$UMOUNT /cache
the generated file looks like this:
/tmp/pmfs (example of a consistent BML/EXT4 setup, but it could be a mix of bml: ext4/rfs. Alternately mtd: yaffs2)
Code:
syspm=bml
sysfs=ext4
syspmfs=bmlext4
datpm=bml
datfs=ext4
datpmfs=bmlext4
cacpm=bml
cacfs=ext4
cacpmfs=bmlext4
the xxxpmfs= entry is a shortcut for when you need to test the combination i.e. bmlrfs or bmlext4 instead of having to invoke 4 separate file_getprops
the updaterscript looks something like this
updater-script
Code:
package_extract_dir("tools/univ", "/tmp/tools");
set_perm_recursive(0, 0, 0777, 0777, "/tmp/tools");
run_program("/tmp/tools/pmfs.sh");
#ENSURE FILESYSTEM CONSISTENCY (i.e. make sure we don't have a mix of RFS and EXT4 partitions - have all of the same FS on partitions
ifelse(
file_getprop("/tmp/pmfs", "sysfs") == "ext4" && file_getprop("/tmp/pmfs", "datfs") == "ext4" && file_getprop("/tmp/pmfs", "cacfs") == "ext4" ||
file_getprop("/tmp/pmfs", "sysfs") == "yaffs2" && file_getprop("/tmp/pmfs", "datfs") == "yaffs2" && file_getprop("/tmp/pmfs", "cacfs") == "yaffs2" ||
file_getprop("/tmp/pmfs", "sysfs") == "rfs" && file_getprop("/tmp/pmfs", "datfs") == "rfs" && file_getprop("/tmp/pmfs", "cacfs") == "rfs",
(
ui_print("PASSED CONSISTENCY CHECK");sleep(1);
),
(
ui_print("ERROR: INCONSISTENT FILESYSTEMS");
#NEED TO REFORMAT ALL (CLEAN WIPE)
abort();
)
);
#FORMAT SYSTEM (based on what is already there) - CHECK FILE SYSTEM ext4 || rfs || yaffs2
ifelse( file_getprop("/tmp/pmfs","sysfs") == "yaffs2",
(
#format MTD/YAFFS2
format("yaffs2", "MTD", "system");
format("yaffs2", "MTD", "cache");
)
);
ifelse( file_getprop("/tmp/pmfs","sysfs") == "ext4",
(
#format ext4
run_program("/tmp/tools/fsck.ext4", "-fy", "/dev/block/stl9");
run_program("/tmp/tools/mkfs.ext4", "-O", "^ext_attr,^has_journal,^huge_file", "-L", "SYSTEM", "-b", "4096", "-m", "0", "-F", "/dev/block/stl9");
run_program("/tmp/tools/fsck.ext4", "-fy", "/dev/block/stl11");
run_program("/tmp/tools/mkfs.ext4", "-O", "^ext_attr,^has_journal,^huge_file", "-L", "SYSTEM", "-b", "4096", "-m", "0", "-F", "/dev/block/stl11");
run_program("/tmp/tools/ext4convert");
)
);
ifelse( file_getprop("/tmp/pmfs","sysfs") == "rfs",
(
#format RFS
run_program("/sbin/dd", "if=/dev/zero", "of=/dev/block/stl9", "bs=4096");
run_program("/tmp/tools/fat.format", "-F", "32", "-S", "4096", "-s", "1", "/dev/block/stl9");
run_program("/sbin/dd", "if=/dev/zero", "of=/dev/block/stl11", "bs=4096");
run_program("/tmp/tools/fat.format", "-F", "32", "-S", "4096", "-s", "1", "/dev/block/stl11");
)
);
#INSTALL KERNEL (CHECK PARTITION MAP - BML || MTD
ifelse( file_getprop("/tmp/pmfs", "syspm") == "mtd",
(
#INSTALL MTD KERNEL IMGS
assert(run_program("/tmp/tools/erase_image", "boot")); set_progress(0.270000);
assert(
package_extract_file("kernel/boot.img", "/tmp/boot.img"),
write_raw_image("/tmp/boot.img", "boot"),
run_program("/tmp/tools/bml_over_mtd.sh", "boot", "72", "reservoir", "4012", "/tmp/boot.img"),
delete("/tmp/boot.img")
);
assert(run_program("/tmp/tools/erase_image", "recovery"));
assert(
package_extract_file("kernel/recovery.bin", "/tmp/recovery.img"),
run_program("/tmp/tools/bml_over_mtd.sh", "recovery", "102", "reservoir", "4012", "/tmp/recovery.img"),
delete("/tmp/recovery.img")
);
),
(
#INSTALL BML KERNEL
package_extract_file("kernel/zImage", "/tmp/zImage");
run_program("/tmp/tools/bmlwrite", "/tmp/zImage", "/dev/block/bml7");
delete("/tmp/zImage");
)
);
That is a functional example of usage right out of SleeperROM, my tools get unpacked and called from /tmp/tools , and my kernel images are kept together in the rom package
Hey Simple first I gotta say good idea with generating the pmfs instead of invoking four different getprops
but one question how do I use this to generate the pmfs file
#!/sbin/sh
# 2012-01-01 SENSEISIMPLE
BB="/sbin/busybox"
MOUNT="$BB mount"
UMOUNT="$BB umount"
pmfs="/tmp/pmfs"
$BB rm -f $pmfs
$BB rm -f /sdcard/.PARTMAPFS.prop
$UMOUNT /system
if $MOUNT -t ext4 /dev/block/stl9 /system &> /dev/null; then echo -e "syspm=bml\nsysfs=ext4\nsyspmfs=bmlext4" >> "$pmfs"; fi
$UMOUNT /system
if $MOUNT -t rfs /dev/block/stl9 /system &> /dev/null; then echo -e "syspm=bml\nsysfs=rfs\nsyspmfs=bmlrfs" >> "$pmfs"; fi
$UMOUNT /system
if $MOUNT -t yaffs2 /dev/block/mtdblock2 /system &> /dev/null; then echo -e "syspm=mtd\nsysfs=yaffs2\nsyspmfs=mtdyaffs2" >> "$pmfs"; fi
$UMOUNT /system
$UMOUNT /data
if $MOUNT -t ext4 /dev/block/stl10 /data &> /dev/null; then echo -e "datpm=bml\ndatfs=ext4\ndatpmfs=bmlext4" >> "$pmfs"; fi
$UMOUNT /data
if $MOUNT -t rfs /dev/block/stl10 /data &> /dev/null; then echo -e "datpm=bml\ndatfs=rfs\ndatpmfs=bmlrfs" >> "$pmfs"; fi
$UMOUNT /data
if $MOUNT -t yaffs2 /dev/block/mtdblock3 /data &> /dev/null; then echo -e "datpm=mtd\ndatfs=yaffs2\ndatpmfs=mtdyaffs2" >> "$pmfs"; fi
$UMOUNT /data
$UMOUNT /cache
if $MOUNT -t ext4 /dev/block/stl11 /cache &> /dev/null; then echo -e "cacpm=bml\ncacfs=ext4\ncacpmfs=bmlext4" >> "$pmfs"; fi
$UMOUNT /cache
if $MOUNT -t rfs /dev/block/stl11 /cache &> /dev/null; then echo -e "cacpm=bml\ncacfs=rfs\ncacpmfs=bmlrfs" >> "$pmfs"; fi
$UMOUNT /cache
if $MOUNT -t yaffs2 /dev/block/mtdblock4 /cache &> /dev/null; then echo -e "cacpm=mtd\ncacfs=yaffs2\ncacpmfs=mtdyaffs2" >> "$pmfs"; fi
$UMOUNT /cache
Click to expand...
Click to collapse
I just read what earthbound wrote up and I wrote up something similar, well without all the samurai stuff lol, but how do we make it so it checks for ro.modversion, if it finds a previous version, it goes to install an update that is included in the installer?? What would be the lines for this??
The_Legendary said:
Hey Simple first I gotta say good idea with generating the pmfs instead of invoking four different getprops
but one question how do I use this to generate the pmfs file
Click to expand...
Click to collapse
the script generates it, it writes the details to temporary file /tmp/pmfs as soon as it runs, so you're ready to access it
SenseiSimple said:
the script generates it, it writes the details to temporary file /tmp/pmfs as soon as it runs, so you're ready to access it
Click to expand...
Click to collapse
OK so it's already in the updater-script, sweet man if all of us help each other we should have this working just fine in no time.
EDIT: Hey man I tried running the script and I keep getting Status 6 installion aborted??
EDIT2: Well there is a extra line on line 48 that was causing the status 6. But now when I run I get status 7 and file_getprop: failed to stat "/tmp/pmfs" : No such file or directory
So this isn't making the pmfs file.
marcusant said:
It would be <=Legendary 2.2
Sent from my SPH-D700 using XDA App
Click to expand...
Click to collapse
It's actually looking for the exact value, so == is what i need. Not <=
IF the value IS EQUAL to Legendary_rc_2.2, then go onto update, ELSE backup and install.
SenseiSimple said:
hey hoffman i know you sent me a PM, was actually working on this alongside you except my approach is different in that i only check against mount-ability once and store a propfile with the relevant details. It's safer because you don't have to keep track of the mounts. here's the relevant code, it's two parts.
The beauty about this way of doing it is that we can handle EXT4, RFS, and MTD/YAFFS2 automatically.
pmfs.sh
establishes a property listing of partition map / file system details in a file /tmp/pmfs.
Code:
#!/sbin/sh
# 2012-01-01 SENSEISIMPLE
BB="/sbin/busybox"
MOUNT="$BB mount"
UMOUNT="$BB umount"
pmfs="/tmp/pmfs"
$BB rm -f $pmfs
$BB rm -f /sdcard/.PARTMAPFS.prop
$UMOUNT /system
if $MOUNT -t ext4 /dev/block/stl9 /system &> /dev/null; then echo -e "syspm=bml\nsysfs=ext4\nsyspmfs=bmlext4" >> "$pmfs"; fi
$UMOUNT /system
if $MOUNT -t rfs /dev/block/stl9 /system &> /dev/null; then echo -e "syspm=bml\nsysfs=rfs\nsyspmfs=bmlrfs" >> "$pmfs"; fi
$UMOUNT /system
if $MOUNT -t yaffs2 /dev/block/mtdblock2 /system &> /dev/null; then echo -e "syspm=mtd\nsysfs=yaffs2\nsyspmfs=mtdyaffs2" >> "$pmfs"; fi
$UMOUNT /system
$UMOUNT /data
if $MOUNT -t ext4 /dev/block/stl10 /data &> /dev/null; then echo -e "datpm=bml\ndatfs=ext4\ndatpmfs=bmlext4" >> "$pmfs"; fi
$UMOUNT /data
if $MOUNT -t rfs /dev/block/stl10 /data &> /dev/null; then echo -e "datpm=bml\ndatfs=rfs\ndatpmfs=bmlrfs" >> "$pmfs"; fi
$UMOUNT /data
if $MOUNT -t yaffs2 /dev/block/mtdblock3 /data &> /dev/null; then echo -e "datpm=mtd\ndatfs=yaffs2\ndatpmfs=mtdyaffs2" >> "$pmfs"; fi
$UMOUNT /data
$UMOUNT /cache
if $MOUNT -t ext4 /dev/block/stl11 /cache &> /dev/null; then echo -e "cacpm=bml\ncacfs=ext4\ncacpmfs=bmlext4" >> "$pmfs"; fi
$UMOUNT /cache
if $MOUNT -t rfs /dev/block/stl11 /cache &> /dev/null; then echo -e "cacpm=bml\ncacfs=rfs\ncacpmfs=bmlrfs" >> "$pmfs"; fi
$UMOUNT /cache
if $MOUNT -t yaffs2 /dev/block/mtdblock4 /cache &> /dev/null; then echo -e "cacpm=mtd\ncacfs=yaffs2\ncacpmfs=mtdyaffs2" >> "$pmfs"; fi
$UMOUNT /cache
the generated file looks like this:
/tmp/pmfs (example of a consistent BML/EXT4 setup, but it could be a mix of bml: ext4/rfs. Alternately mtd: yaffs2)
Code:
syspm=bml
sysfs=ext4
syspmfs=bmlext4
datpm=bml
datfs=ext4
datpmfs=bmlext4
cacpm=bml
cacfs=ext4
cacpmfs=bmlext4
the xxxpmfs= entry is a shortcut for when you need to test the combination i.e. bmlrfs or bmlext4 instead of having to invoke 4 separate file_getprops
the updaterscript looks something like this
updater-script
Code:
package_extract_dir("tools/univ", "/tmp/tools");
set_perm_recursive(0, 0, 0777, 0777, "/tmp/tools");
run_program("/tmp/tools/pmfs.sh");
#ENSURE FILESYSTEM CONSISTENCY (i.e. make sure we don't have a mix of RFS and EXT4 partitions - have all of the same FS on partitions
ifelse(
file_getprop("/tmp/pmfs", "sysfs") == "ext4" && file_getprop("/tmp/pmfs", "datfs") == "ext4" && file_getprop("/tmp/pmfs", "cacfs") == "ext4" ||
file_getprop("/tmp/pmfs", "sysfs") == "yaffs2" && file_getprop("/tmp/pmfs", "datfs") == "yaffs2" && file_getprop("/tmp/pmfs", "cacfs") == "yaffs2" ||
file_getprop("/tmp/pmfs", "sysfs") == "rfs" && file_getprop("/tmp/pmfs", "datfs") == "rfs" && file_getprop("/tmp/pmfs", "cacfs") == "rfs",
(
ui_print("PASSED CONSISTENCY CHECK");sleep(1);
),
(
ui_print("ERROR: INCONSISTENT FILESYSTEMS");
#NEED TO REFORMAT ALL (CLEAN WIPE)
abort();
)
);
#FORMAT SYSTEM (based on what is already there) - CHECK FILE SYSTEM ext4 || rfs || yaffs2
ifelse( file_getprop("/tmp/pmfs","sysfs") == "yaffs2",
(
#format MTD/YAFFS2
format("yaffs2", "MTD", "system");
format("yaffs2", "MTD", "cache");
)
);
ifelse( file_getprop("/tmp/pmfs","sysfs") == "ext4",
(
#format ext4
run_program("/tmp/tools/fsck.ext4", "-fy", "/dev/block/stl9");
run_program("/tmp/tools/mkfs.ext4", "-O", "^ext_attr,^has_journal,^huge_file", "-L", "SYSTEM", "-b", "4096", "-m", "0", "-F", "/dev/block/stl9");
run_program("/tmp/tools/fsck.ext4", "-fy", "/dev/block/stl11");
run_program("/tmp/tools/mkfs.ext4", "-O", "^ext_attr,^has_journal,^huge_file", "-L", "SYSTEM", "-b", "4096", "-m", "0", "-F", "/dev/block/stl11");
run_program("/tmp/tools/ext4convert");
)
);
ifelse( file_getprop("/tmp/pmfs","sysfs") == "rfs",
(
#format RFS
run_program("/sbin/dd", "if=/dev/zero", "of=/dev/block/stl9", "bs=4096");
run_program("/tmp/tools/fat.format", "-F", "32", "-S", "4096", "-s", "1", "/dev/block/stl9");
run_program("/sbin/dd", "if=/dev/zero", "of=/dev/block/stl11", "bs=4096");
run_program("/tmp/tools/fat.format", "-F", "32", "-S", "4096", "-s", "1", "/dev/block/stl11");
)
);
#INSTALL KERNEL (CHECK PARTITION MAP - BML || MTD
ifelse( file_getprop("/tmp/pmfs", "syspm") == "mtd",
(
#INSTALL MTD KERNEL IMGS
assert(run_program("/tmp/tools/erase_image", "boot")); set_progress(0.270000);
assert(
package_extract_file("kernel/boot.img", "/tmp/boot.img"),
write_raw_image("/tmp/boot.img", "boot"),
run_program("/tmp/tools/bml_over_mtd.sh", "boot", "72", "reservoir", "4012", "/tmp/boot.img"),
delete("/tmp/boot.img")
);
assert(run_program("/tmp/tools/erase_image", "recovery"));
assert(
package_extract_file("kernel/recovery.bin", "/tmp/recovery.img"),
run_program("/tmp/tools/bml_over_mtd.sh", "recovery", "102", "reservoir", "4012", "/tmp/recovery.img"),
delete("/tmp/recovery.img")
);
),
(
#INSTALL BML KERNEL
package_extract_file("kernel/zImage", "/tmp/zImage");
run_program("/tmp/tools/bmlwrite", "/tmp/zImage", "/dev/block/bml7");
delete("/tmp/zImage");
)
);
That is a functional example of usage right out of SleeperROM, my tools get unpacked and called from /tmp/tools , and my kernel images are kept together in the rom package
Click to expand...
Click to collapse
See the thing here is that i didn't really care to check for RFS, as both EXT4 and RFS are both on BML partition maps.
Just figured it'd be a simpler process to check for YAFFS (MTD) and if true, do YAFFS installation... If false, then it must be a BML mapping. So install EXT4 (which would convert RFS to EXT4 anyway).
I haven't gotten as far as to start playing with shell, though... But this does look promising.
RandomKing said:
I've gotten the code to run. The updater binary I'm using is looking for 3 arguments in the mount command instead of 4. Apparently, at least for my binary, it should look like:
mount("MTD", "system", "/system")
This lets the script run, so I wrote the following as a test:
Code:
ifelse(
# read the mount
mount("MTD", "system", "/system") == "system",
(
# Success
ui_print("Successfully Mounted!");
),
(
# Fail
ui_print("Mount Failed!");
)
);
A simple script to test the function... but unfortunately it reports "Mount Failed!" whether I ask for MTD or BML. That's as far as my brain is going right now.
UPDATE: So, apparently Samurai Kernel has already done this. I haven't checked if it works but it's here on pastebin.
Click to expand...
Click to collapse
I wrote earthbounds script for him... He made some minor changes, as i forgot to unixify the script before sending. So he had some left over carriage returns.
I can get the ui_prints to work... ALL FINE.
The problem i've been having is that once i start plugging in all my install scripting, it looks like it's going through the motions... then i get stuck on the Samsung screen after the install completes.
BOOOOOOOH!
The_Legendary said:
OK so it's already in the updater-script, sweet man if all of us help each other we should have this working just fine in no time.
EDIT: Hey man I tried running the script and I keep getting Status 6 installion aborted??
EDIT2: Well there is a extra line on line 48 that was causing the status 6. But now when I run I get status 7 and file_getprop: failed to stat "/tmp/pmfs" : No such file or directory
So this isn't making the pmfs file.
Click to expand...
Click to collapse
status 6 might be some carriage returns in the scripting. If you're using notepad++ go to view -> show symbol -> show end of line
Ditch the CR's and keep your LF's.
hoffman1984 said:
status 6 might be some carriage returns in the scripting. If you're using notepad++ go to view -> show symbol -> show end of line
Ditch the CR's and keep your LF's.
Click to expand...
Click to collapse
I def already did that, it was that extra line. But the partition check is working but the install fails.. is that what you are saying??
Wow, that was the first time I have actually looked at script code for android.
Even though I started as a programmer, I was very surprised at how well I could follow the flow of the commands
Good luck with the project!
This Epic post as brought to you via Tapatalk
The_Legendary said:
I def already did that, it was that extra line. But the partition check is working but the install fails.. is that what you are saying??
Click to expand...
Click to collapse
My installation never failed... The script went through the motions... It took the time it would take to format, extract, etc... Told me the installation was complete. Then when i went to turn the phone on... SAMMY SCREEN!
Not sure why or how this happened... But i'm leaning toward either edify not liking nested ifelse statments, or the kernel i was using (tried a few different ones) didn't like installation on the nested ifelse...
Either way, i think it has something to do with the nested ifelse statments, so might have to resort to doing an installation on the shell side? just a thought... and has to be possible. Let's keep this thread rolling though, so as not to die. There's alot of good that could come out of all this if we work together.
happy evenings! =)
hoffman1984 said:
My installation never failed... The script went through the motions... It took the time it would take to format, extract, etc... Told me the installation was complete. Then when i went to turn the phone on... SAMMY SCREEN!
Not sure why or how this happened... But i'm leaning toward either edify not liking nested ifelse statments, or the kernel i was using (tried a few different ones) didn't like installation on the nested ifelse...
Either way, i think it has something to do with the nested ifelse statments, so might have to resort to doing an installation on the shell side? just a thought... and has to be possible. Let's keep this thread rolling though, so as not to die. There's alot of good that could come out of all this if we work together.
happy evenings! =)
Click to expand...
Click to collapse
Yeah I know I get the Sammy screen everytime, I have been developing a rom and I really wanna incorporate this. SO COME ON PEOPLE DON'T LET THIS DIE!!!

[Q] [Upadate Script] What's difference?

What is difference between these mount script
run_program("/sbin/busybox", "mount", "/system");
&
mount("ext4", "EMMC", "/dev/block/mmcblk0p3", "/system");
someone please explain in brief..
ekhasti said:
What is difference between these mount script
run_program("/sbin/busybox", "mount", "/system");
&
mount("ext4", "EMMC", "/dev/block/mmcblk0p3", "/system");
someone please explain in brief..
Click to expand...
Click to collapse
in second one, mounting is done without any external app or function. all system functions present in your rom mount the systen. in first you need busybox to mount system.
amit34521 said:
in second one, mounting is done without any external app or function. all system functions present in your rom mount the systen. in first you need busybox to mount system.
Click to expand...
Click to collapse
What mean by "mmcblk0p3"
Some place I see mmcblk0p4 or 2...
What's it??
Can you elaborate this please..
mount("ext4", "EMMC", "/dev/block/mmcblk0p3", "/system");
ekhasti said:
Can you elaborate this please..
mount("ext4", "EMMC", "/dev/block/mmcblk0p3", "/system");
Click to expand...
Click to collapse
mmcblk are different mount points for system, data and all. ext4 means type of partition.
amit34521 said:
mmcblk are different mount points for system, data and all. ext4 means type of partition.
Click to expand...
Click to collapse
How we know which mount point for which folder..
i.e. mmcblk0p3 for system...
if I want to mount data or any other root folder then??
sorry for bothering but want to know
I guess for data its stl11. Different devices have different mount points.
Sent from my GT-S6102 using xda app-developers app
ekhasti said:
How we know which mount point for which folder..
i.e. mmcblk0p3 for system...
if I want to mount data or any other root folder then??
sorry for bothering but want to know
Click to expand...
Click to collapse
Download terminal emulator app from play store or using adb shell type in the commands :
Code:
su
cat /proc/partitions
cat /proc/ext4
ls /dev/block
and try to analyze the output. Probably you will get your answer.

[Q] CWM Updater-Script question

It appears that the Shields "system" partition is located at the block device "mmcblk0p4" and is a EXT4 Filesystem. Knowing what very little I do know about the updater-script shell script that runs when flashing a ROM in CWM, I am under the impression that I could mount the "system" partition as follows:
format("ext4", "EMMC", "/dev/block/mmcblk0p4", "/system");
and mount it with the following:
mount("ext4", "EMMC", "/dev/block/mmcblk0p4", "/system");
Is that correct? Also, agrabren's Tweaker ROM updater-script was designed for system images, but even so, it seemed to follow a different syntax, as in:
mount("ext4", "EMMC", "/dev/block/platform/sdhci-tegra.3/by-name/APP", "/system");
if my code above was to be applied to the way he extracted the images to the corresponding block device.
Anyways, please if anybody knows, please tell me if any of those are correct, and if so, which one. I intend to make a CWM flashable ZIP of a 4.3 equivalent of my minisculeShield Nandroid backup, but need to figure this out before the ZIP will even work. Thanks
The only mount syntax that I found working on a Shield Tablet is ::
mount("ext4", "EMMC", "/dev/block/platform/sdhci-tegra.3/by-name/APP", "/system");

[GUIDE][DEV] How to convert NAND ROM to SD-EXT ROM for MultiBootloader

How to convert NAND ROM to SD-EXT ROM for MultiBootloader​
Code:
After following this guide, your ROM can be use with [URL="http://forum.xda-developers.com/nokia-x2/development/sbl-multibootloader-v1-00-04-10-2015-t3217360"]MultiBootloader[/URL]
THIS GUIDE IS NOT FOR NOOBs
Requirements
Knowledge about Android Image Kitchen
Notepad ++
A nand ROM extracted
Instructions
Delete the RED COLOR
Add the BLUE COLOR
Step 1: Modifying boot.img (FOR STOCK KERNEL ONLY) - Check post #2 to download the modified boot image, you don't need to edit it yourself.
Use Android Image Kitchen's unpackimg command to unpack the boot.img file from the ROM your want to port.
Go to Android Image Kitchen\ramdisk folder, edit these files:
fstab.qcom
Change like this:
Code:
# Android fstab file.
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
#TODO: Add 'check' as fs_mgr_flags with data partition.
# Currently we dont have e2fsck compiled. So fs check would failed.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
[COLOR="Red"]/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,barrier=1 wait
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard wait,check,encryptable=footer[/COLOR]
[COLOR="Blue"]/dev/block/platform/msm_sdcc.1/by-name/userdata /nanddata ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard wait,check,encryptable=footer[/COLOR]
/devices/msm_sdcc.2/mmc_host /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=sdcard:auto
#/dev/block/mmcblk0p11 /system ext4 ro,barrier=1 wait
#/dev/block/mmcblk0p12 /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc wait,check,encryptable=footer
init.rc
- Find this event:
Code:
on fs
- Change like this:
Code:
on fs
# mount mtd partitions
# Mount /system rw first to give the filesystem a chance to save a checkpoint
[COLOR="Red"]mount yaffs2 [email protected] /system
mount yaffs2 [email protected] /system ro remount
mount yaffs2 [email protected] /data nosuid nodev[/COLOR]
[COLOR="Blue"] mount ext4 /dev/block/mmcblk1p2 /system
mount ext4 /dev/block/mmcblk1p2 /system ro remount
mount ext4 /dev/block/mmcblk1p3 /data nosuid nodev[/COLOR]
mount yaffs2 [email protected] /cache nosuid nodev
[COLOR="Blue"]#mount nand data for sharing data/app
mkdir /nanddate 0771 system system
mount yaffs2 [email protected] /nanddata nosuid nodev
# mount sdcard
wait /dev/block/mmcblk1p1
wait /dev/block/mmcblk1p1
mount vfat /dev/block/mmcblk1p1 /storage/sdcard1[/COLOR]
​
init.target.rc
- Find this event:
Code:
on fs
- Change like this:
Code:
on fs
mount_all fstab.qcom
# Keeping following partitions outside fstab file. As user may not have
# these partition flashed on the device. Failure to mount any partition in fstab file
# results in failure to launch late-start class.
wait /dev/block/platform/msm_sdcc.1/by-name/cache
mount ext4 /dev/block/platform/msm_sdcc.1/by-name/cache /cache nosuid nodev barrier=1
wait /dev/block/platform/msm_sdcc.1/by-name/persist
mount ext4 /dev/block/platform/msm_sdcc.1/by-name/persist /persist nosuid nodev barrier=1
wait /dev/block/platform/msm_sdcc.1/by-name/modem
mount vfat /dev/block/platform/msm_sdcc.1/by-name/modem /firmware ro shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337
[COLOR="Red"] wait /dev/block/platform/msm_sdcc.1/by-name/custom
mount ext4 /dev/block/platform/msm_sdcc.1/by-name/custom /custom nosuid nodev barrier=1 ro[/COLOR]
[COLOR="Blue"] wait /dev/block/mmcblk1p4
mount ext4 /dev/block/mmcblk1p4 /custom nosuid nodev barrier=1 ro[/COLOR]
​
Repack boot.img and copy to the ROM folder.
Step 2: Modifying updater-script
Open ROM-name\META-INF\com\google\android\updater-script
Find:
Code:
mount("ext4", "EMMC", "/dev/block/mmcblk0p19", "/system");
or
Code:
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");
Add these lines above it:
Code:
[COLOR="blue"]ui_print(" Mounting Partitions ");
mount("ext4", "MMC", "/dev/block/mmcblk1p2", "/system-ext");
mount("ext4", "MMC", "/dev/block/mmcblk1p4", "/custom-ext");
mount("ext4", "EMMC", "/dev/block/mmcblk0p20", "/cache");
mount("ext4", "MMC", "/dev/block/mmcblk1p3", "/data-ext");
ui_print(" Formatting Partitions ");
delete_recursive("/system-ext");
delete_recursive("/custom-ext");
delete_recursive("/cache");
delete_recursive("/data/dalvik-cache");
delete_recursive("/data-ext");[/COLOR]
Find this line:
Code:
package_extract_file("boot.img", "/tmp/boot.img");
Change like this:
Code:
[INDENT][COLOR="Red"]package_extract_file("boot.img", "/tmp/boot.img");
run_program("/system/xbin/busybox", "dd", "if=/tmp/boot.img", "of=/dev/block/mmcblk0p10");
delete("/tmp/boot.img");[/COLOR][COLOR="Blue"]
package_extract_file("boot.img", "/emmc/kernels/[I]your_rom_name[/I].img");[/COLOR][/INDENT]
Find and change all /system/ to /system-EXT/
Find and change all /custom/ to /custom-EXT/
Save.
Step 3: Create the ZIP
Make sure you have copy the modified boot.img to the ROM folder
Select all the files and folders in the ROM folder (custom, system, META-INF, boot.img,etc..)
Compress into ZIP file.
Done.
<EDITTING>
I have modifed the boot.img to boot into sdext ROM:
For stock based ROM: stock_ext.img - thanks to @symbuzzer for adding some features and fixing the ril & sdcard bugs
modified_stock_insecure-kernel.img - (Maybe I've made some mistake in this file. I don't recommend to use this, it can cause some bugs with sdcard0. Better modify it yourself.)
For CM11 based ROM: ext_cm11.img
Great ! Im waiting for this
Bro how can intsall the rom
I m try but couldn't with me
Plz help ??
@SonnySimon this method doesnt work on Stock Kernel/Rom. I will attach stock kernel on XDA today. You can compare mine with yours and update this post. Thanks
symbuzzer said:
@SonnySimon this method doesnt work on Stock Kernel/Rom. I will attach stock kernel on XDA today. You can compare mine with yours and update this post. Thanks
Click to expand...
Click to collapse
It works. I tried and it boots successfully into ext stock ROM but have some bugs with ril and sdcard.
SonnySimon said:
It works. I tried and it boots successfully into ext stock ROM but have some bugs with ril and sdcard.
Click to expand...
Click to collapse
I meant yours have bugs Thanks anyway
[HOW TO] BOOT FROM SD CARD [SUCCESSFULLY] on QMobile Z8 with BRICKED/DEAD eMMC
SimonVN said:
How to convert NAND ROM to SD-EXT ROM for MultiBootloader
Click to expand...
Click to collapse
I have been successfully able to boot from SD card on QMobile Z8 by partitioning SD card on a Ubuntu machine using 'parted' and 'fdisk' commands, replicating eMMC partition table and then flashing factory firmware images to these newly created partitions using 'dd' command. Then I modified "fstab.qcom" & "init.tegra.rc" files in kernel (boot.img) and "recovery.fstab" and "uneventd.rc" files in twrp recovery to initiate mounting and booting from sd card instead of internal memory. It was successful after some experiments. Details can be found here:
https://forum.xda-developers.com/android/help/how-to-boot-sd-card-qmobile-z8-bricked-t3712171
But I have still a few queries to be answered. Please have a look. Any help, comments, information or suggestions will be appreciated.

Categories

Resources