• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root Custom rom & updater-scipt troubleshooting

For custom rom & updater-script troubleshooting only.

I started this thread so we can put our heads together to get a working updater-script so we can flash our roms.

I cooked a rom in the kitchen and others have also, but with no working updater-script, we cant flash correctly in cwm recovery.

I put together a different updater-script that flashes my rom with some permissions issues... Keyboard keeps crashing & root apps request perm every time they are opened.

I defined the Spirit in the edify_defs folder of kitchen, with the following...

Name this file: l1m
HTML:
# LG Spirit 4G MS870 Metro PCS

change_mnt=yes

param1=ext4
param2=EMMC

param1_sdcard=vfat

sys_mnt=\/dev\/block\/platform\/msm_sdcc.1\/by-name\/system
data_mnt=\/dev\/block\/platform\/msm_sdcc.1\/by-name\/userdata
cache_mnt=\/dev\/block\/platform\/msm_sdcc.1\/by-name\/cache
sdcard_mnt=\/dev\/block\/mmcblk0p1
boot_mnt=\/dev\/block\/platform\/msm_sdcc.1\/by-name\/boot
I used the recovery_mmc.fstab to retrieve the mounts above, which looks like so...

HTML:
# mount point    fstype        device            [device2]

/boot        emmc        /dev/block/platform/msm_sdcc.1/by-name/boot
/cache        ext4        /dev/block/platform/msm_sdcc.1/by-name/cache
/data        ext4        /dev/block/platform/msm_sdcc.1/by-name/userdata
/misc        emmc        /dev/block/platform/msm_sdcc.1/by-name/misc
/recovery    emmc        /dev/block/platform/msm_sdcc.1/by-name/recovery
/sdcard        vfat        /dev/block/mmcblk1p1    /dev/block/mmcblk1
/system        ext4        /dev/block/platform/msm_sdcc.1/by-name/system
For sdcard_mnt I used the recovery.fstab

This is the updater-script I put together...

HTML:
show_progress(0.1, 0);
ui_print("");
ui_print("    Beginning Installation");
ui_print("");

ui_print("Mounting");
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/data", "/data");
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/cache", "/cache");
show_progress(0.1, 10);

ui_print("Formatting System & Cache");
delete_recursive("/system");
delete_recursive("/system");
delete_recursive("/cache");
delete_recursive("/cache");
delete_recursive("/data/dalvik-cache");
delete_recursive("/data/dalvik-cache");
show_progress(0.2, 0);

ui_print("Installing System & Data");
package_extract_dir("system", "/system");
show_progress(0.2, 10);
package_extract_dir("data", "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");

ui_print("Applying Symlinks");
symlink("toolbox", "/system/bin/ls");
symlink("toolbox", "/system/bin/mv");
symlink("toolbox", "/system/bin/sleep");
symlink("toolbox", "/system/bin/setprop");
symlink("toolbox", "/system/bin/chmod");
symlink("toolbox", "/system/bin/rmdir");
symlink("toolbox", "/system/bin/notify");
symlink("toolbox", "/system/bin/sendevent");
symlink("toolbox", "/system/bin/printenv");
symlink("toolbox", "/system/bin/ionice");
symlink("toolbox", "/system/bin/iftop");
symlink("toolbox", "/system/bin/schedtop");
symlink("toolbox", "/system/bin/uptime");
symlink("toolbox", "/system/bin/kill");
symlink("toolbox", "/system/bin/setconsole");
symlink("toolbox", "/system/bin/date");
symlink("toolbox", "/system/bin/renice");
symlink("toolbox", "/system/bin/ps");
symlink("toolbox", "/system/bin/smd");
symlink("toolbox", "/system/bin/touch");
symlink("toolbox", "/system/bin/cat");
symlink("toolbox", "/system/bin/rmmod");
symlink("toolbox", "/system/bin/getprop");
symlink("toolbox", "/system/bin/dmesg");
symlink("toolbox", "/system/bin/getevent");
symlink("toolbox", "/system/bin/cmp");
symlink("toolbox", "/system/bin/umount");
symlink("toolbox", "/system/bin/chown");
symlink("toolbox", "/system/bin/wipe");
symlink("toolbox", "/system/bin/route");
symlink("toolbox", "/system/bin/start");
symlink("toolbox", "/system/bin/rm");
symlink("toolbox", "/system/bin/stop");
symlink("toolbox", "/system/bin/nandread");
symlink("toolbox", "/system/bin/top");
symlink("toolbox", "/system/bin/lsmod");
symlink("toolbox", "/system/bin/dd");
symlink("toolbox", "/system/bin/watchprops");
symlink("mksh", "/system/bin/sh");
symlink("toolbox", "/system/bin/df");
symlink("toolbox", "/system/bin/sync");
symlink("toolbox", "/system/bin/id");
symlink("toolbox", "/system/bin/newfs_msdos");
symlink("toolbox", "/system/bin/ioctl");
symlink("toolbox", "/system/bin/hd");
symlink("toolbox", "/system/bin/mount");
symlink("toolbox", "/system/bin/log");
symlink("toolbox", "/system/bin/reboot");
symlink("toolbox", "/system/bin/insmod");
symlink("toolbox", "/system/bin/vmstat");
symlink("toolbox", "/system/bin/lsof");
symlink("toolbox", "/system/bin/netstat");
symlink("toolbox", "/system/bin/ln");
symlink("toolbox", "/system/bin/mkdir");
symlink("toolbox", "/system/bin/ifconfig");
show_progress(0.3, 0);

ui_print("Writing Permissions");
set_perm_recursive(0, 0, 0755, 0644, "/system");
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_pairing.conf");
set_perm(3002, 3002, 0444, "/system/etc/bluetooth/blacklist.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, 0755, "/system/vendor/bin");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor/etc");
set_perm(0, 2000, 0755, "/system/vendor/lib");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
set_perm(0, 0, 06755, "/system/xbin/su");
symlink("/system/xbin/su", "/system/bin/su");
set_perm(0, 1000, 0755, "/system/xbin/busybox");
symlink("/system/xbin/busybox", "/system/bin/busybox");
run_program("/system/xbin/busybox", "--install", "-s", "/system/xbin");
show_progress(0.3, 10);

ui_print("Unmounting System, Data, & Cache");
unmount("/cache");
unmount("/system");
unmount("/data");
show_progress(0.4, 0);

ui_print("============================");
ui_print("");
ui_print("    Your Rom Info Here");
ui_print("");
ui_print("   Installation Complete");
ui_print("");
ui_print("    Reboot System Now");
ui_print("");
ui_print("============================");
If anyone has some useful insight or wants to add to this, please do share.

Thanks
 
  • Like
Reactions: Mikito1976
GameTheory,

Thank you for creating this thread, my base rom is also very close to be finished, it installs fine without error step by step, but it doesn't come back to the CWM after install finishes

Below is my Updater-Script for sharing, I copied many parts from LG Motion's

The differences from yours and mine are,,
1) It actually formats system folder. As long as you have all the files it's okay to format
2) I added additional symlinks and permissions (brought from Motion)
3) It installs stock Boot and Recovery


DO NOT USE BELOW SCRIPT
VERY HIGH CHANCE OF BRICKING YOUR PHONE
THIS IS TO SHARE INFORMATION ONLY
show_progress(0.1, 0);
ui_print("");
ui_print("LG-MS870 Spirit");
ui_print("Base Rom Beta");
ui_print("Zipaligned, Deodexed, Debloated");
ui_print("Contributed by Bard @ Android Forum");
ui_print("");
ui_print("1. Format System & Cache");
format("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system");
format("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/cache");
ui_print("2. Mount System & Cache");
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/cache", "/cache");
package_extract_dir("system", "/system");
ui_print("3. Symlinks");
symlink("toolbox", "/system/bin/cat");
symlink("toolbox", "/system/bin/chmod");
symlink("toolbox", "/system/bin/chown");
symlink("toolbox", "/system/bin/cmp");
symlink("toolbox", "/system/bin/date");
symlink("toolbox", "/system/bin/dd");
symlink("toolbox", "/system/bin/df");
symlink("toolbox", "/system/bin/dmesg");
symlink("toolbox", "/system/bin/getevent");
symlink("toolbox", "/system/bin/getprop");
symlink("toolbox", "/system/bin/hd");
symlink("toolbox", "/system/bin/id");
symlink("toolbox", "/system/bin/ifconfig");
symlink("toolbox", "/system/bin/iftop");
symlink("toolbox", "/system/bin/insmod");
symlink("toolbox", "/system/bin/ioctl");
symlink("toolbox", "/system/bin/ionice");
symlink("toolbox", "/system/bin/kill");
symlink("toolbox", "/system/bin/ln");
symlink("toolbox", "/system/bin/log");
symlink("toolbox", "/system/bin/ls");
symlink("toolbox", "/system/bin/lsmod");
symlink("toolbox", "/system/bin/lsof");
symlink("toolbox", "/system/bin/mkdir");
symlink("toolbox", "/system/bin/mount");
symlink("toolbox", "/system/bin/mv");
symlink("toolbox", "/system/bin/nandread");
symlink("toolbox", "/system/bin/netstat");
symlink("toolbox", "/system/bin/newfs_msdos");
symlink("toolbox", "/system/bin/notify");
symlink("toolbox", "/system/bin/printenv");
symlink("toolbox", "/system/bin/ps");
symlink("toolbox", "/system/bin/reboot");
symlink("toolbox", "/system/bin/renice");
symlink("toolbox", "/system/bin/rm");
symlink("toolbox", "/system/bin/rmdir");
symlink("toolbox", "/system/bin/rmmod");
symlink("toolbox", "/system/bin/route");
symlink("toolbox", "/system/bin/schedtop");
symlink("toolbox", "/system/bin/sendevent");
symlink("toolbox", "/system/bin/setconsole");
symlink("toolbox", "/system/bin/setprop");
symlink("mksh", "/system/bin/sh");
symlink("toolbox", "/system/bin/sleep");
symlink("toolbox", "/system/bin/smd");
symlink("toolbox", "/system/bin/start");
symlink("toolbox", "/system/bin/stop");
symlink("toolbox", "/system/bin/sync");
symlink("toolbox", "/system/bin/top");
symlink("toolbox", "/system/bin/touch");
symlink("toolbox", "/system/bin/umount");
symlink("toolbox", "/system/bin/uptime");
symlink("toolbox", "/system/bin/vmstat");
symlink("toolbox", "/system/bin/watchprops");
symlink("toolbox", "/system/bin/wipe");
symlink("/firmware/image/dsps.b00", "/system/etc/firmware/dsps.b00");
symlink("/firmware/image/dsps.b01", "/system/etc/firmware/dsps.b01");
symlink("/firmware/image/dsps.b02", "/system/etc/firmware/dsps.b02");
symlink("/firmware/image/dsps.b03", "/system/etc/firmware/dsps.b03");
symlink("/firmware/image/dsps.b04", "/system/etc/firmware/dsps.b04");
symlink("/firmware/image/dsps.b05", "/system/etc/firmware/dsps.b05");
symlink("/firmware/image/dsps.mdt", "/system/etc/firmware/dsps.mdt");
symlink("/firmware/image/modem.b00", "/system/etc/firmware/modem.b00");
symlink("/firmware/image/modem.b01", "/system/etc/firmware/modem.b01");
symlink("/firmware/image/modem.b02", "/system/etc/firmware/modem.b02");
symlink("/firmware/image/modem.b03", "/system/etc/firmware/modem.b03");
symlink("/firmware/image/modem.b04", "/system/etc/firmware/modem.b04");
symlink("/firmware/image/modem.b06", "/system/etc/firmware/modem.b06");
symlink("/firmware/image/modem.b07", "/system/etc/firmware/modem.b07");
symlink("/firmware/image/modem.b07", "/system/etc/firmware/modem.b08");
symlink("/firmware/image/modem.b07", "/system/etc/firmware/modem.b09");
symlink("/firmware/image/modem.b07", "/system/etc/firmware/modem.b10");
symlink("/firmware/image/modem.mdt", "/system/etc/firmware/modem.mdt");
symlink("/firmware/image/modem_fw.b00", "/system/etc/firmware/modem_fw.b00");
symlink("/firmware/image/modem_fw.b01", "/system/etc/firmware/modem_fw.b01");
symlink("/firmware/image/modem_fw.b02", "/system/etc/firmware/modem_fw.b02");
symlink("/firmware/image/modem_fw.b03", "/system/etc/firmware/modem_fw.b03");
symlink("/firmware/image/modem_fw.b04", "/system/etc/firmware/modem_fw.b04");
symlink("/firmware/image/modem_fw.b05", "/system/etc/firmware/modem_fw.b05");
symlink("/firmware/image/modem_fw.b06", "/system/etc/firmware/modem_fw.b06");
symlink("/firmware/image/modem_fw.b07", "/system/etc/firmware/modem_fw.b07");
symlink("/firmware/image/modem_fw.b08", "/system/etc/firmware/modem_fw.b08");
symlink("/firmware/image/modem_fw.b09", "/system/etc/firmware/modem_fw.b09");
symlink("/firmware/image/modem_fw.b10", "/system/etc/firmware/modem_fw.b10");
symlink("/firmware/image/modem_fw.b11", "/system/etc/firmware/modem_fw.b11");
symlink("/firmware/image/modem_fw.b12", "/system/etc/firmware/modem_fw.b12");
symlink("/firmware/image/modem_fw.b13", "/system/etc/firmware/modem_fw.b13");
symlink("/firmware/image/modem_fw.b14", "/system/etc/firmware/modem_fw.b14");
symlink("/firmware/image/modem_fw.b21", "/system/etc/firmware/modem_fw.b21");
symlink("/firmware/image/modem_fw.b22", "/system/etc/firmware/modem_fw.b22");
symlink("/firmware/image/modem_fw.b23", "/system/etc/firmware/modem_fw.b23");
symlink("/firmware/image/modem_fw.b25", "/system/etc/firmware/modem_fw.b25");
symlink("/firmware/image/modem_fw.b26", "/system/etc/firmware/modem_fw.b26");
symlink("/firmware/image/modem_fw.b29", "/system/etc/firmware/modem_fw.b29");
symlink("/firmware/image/modem_fw.fli", "/system/etc/firmware/modem_fw.fli");
symlink("/firmware/image/modem_fw.mdt", "/system/etc/firmware/modem_fw.mdt");
symlink("/firmware/image/q6.b00", "/system/etc/firmware/q6.b00");
symlink("/firmware/image/q6.b01", "/system/etc/firmware/q6.b01");
symlink("/firmware/image/q6.b03", "/system/etc/firmware/q6.b03");
symlink("/firmware/image/q6.b04", "/system/etc/firmware/q6.b04");
symlink("/firmware/image/q6.b05", "/system/etc/firmware/q6.b05");
symlink("/firmware/image/q6.b06", "/system/etc/firmware/q6.b06");
symlink("/firmware/image/q6.mdt", "/system/etc/firmware/q6.mdt");
symlink("/firmware/image/tzapps.b00", "/system/etc/firmware/tzapps.b00");
symlink("/firmware/image/tzapps.b01", "/system/etc/firmware/tzapps.b01");
symlink("/firmware/image/tzapps.b02", "/system/etc/firmware/tzapps.b02");
symlink("/firmware/image/tzapps.b03", "/system/etc/firmware/tzapps.b03");
symlink("/firmware/image/tzapps.mdt", "/system/etc/firmware/tzapps.mdt");
symlink("/firmware/image/wcnss.b00", "/system/etc/firmware/wcnss.b00");
symlink("/firmware/image/wcnss.b01", "/system/etc/firmware/wcnss.b01");
symlink("/firmware/image/wcnss.b02", "/system/etc/firmware/wcnss.b02");
symlink("/firmware/image/wcnss.b04", "/system/etc/firmware/wcnss.b04");
symlink("/firmware/image/wcnss.mdt", "/system/etc/firmware/wcnss.mdt");
ui_print("4. Permissions");
set_perm_recursive(0, 0, 0755, 0644, "/system");
set_perm_recursive(0, 2000, 0755, 0755, "/system/bin");
set_perm(0, 0, 0644, "/system/build.prop");
set_perm(0, 0, 0644, "/system/usbautorun.iso");
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_pairing.conf");
set_perm(3002, 3002, 0444, "/system/etc/bluetooth/blacklist.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(0, 0, 0644, "/system/etc/init.lge_dut.bt.sh");
set_perm(0, 0, 0644, "/system/etc/init.qcom.bt.sh");
set_perm(0, 0, 0644, "/system/etc/init.qcom.coex.sh");
set_perm(0, 0, 0644, "/system/etc/init.qcom.fm.sh");
set_perm(0, 1000, 0755, "/system/etc/init.qcom.ftm_module_out.sh");
set_perm(0, 1000, 0755, "/system/etc/init.qcom.ftm_module.sh");
set_perm(0, 0, 0644, "/system/etc/init.qcom.mdm_links.sh");
set_perm(0, 0, 0644, "/system/etc/init.qcom.modem_links.sh");
set_perm(0, 0, 0644, "/system/etc/init.qcom.post_boot.sh");
set_perm(0, 1000, 0755, "/system/etc/init.qcom.sdio.sh");
set_perm(0, 0, 0644, "/system/etc/init.qcom.wifi.sh");
set_perm(0, 0, 0644, "/system/etc/init.wlan-on-off.sh");
set_perm(0, 0, 0644, "/system/etc/logging_android_apart.sh");
set_perm(0, 0, 0644, "/system/etc/logging_android.sh");
set_perm(0, 0, 0644, "/system/etc/logging_kernel_apart.sh");
set_perm(0, 0, 0644, "/system/etc/logging_kernel.sh");
set_perm(0, 0, 0644, "/system/etc/logging_prepare.sh");
set_perm(0, 0, 0644, "/system/etc/save_kernel_log.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, 0755, "/system/vendor/bin");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor/etc");
set_perm_recursive(0, 0, 0755, 0644, "/system/vendor/firmware");
set_perm(0, 2000, 0755, "/system/vendor/firmware");
set_perm(0, 2000, 0755, "/system/vendor/lib");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
set_perm(0, 0, 06755, "/system/xbin/su");
symlink("/system/xbin/su", "/system/bin/su");
set_perm(0, 1000, 0755, "/system/xbin/busybox");
symlink("/system/xbin/busybox", "/system/bin/busybox");
run_program("/system/xbin/busybox", "--install", "-s", "/system/xbin");
show_progress(0.1, 10);
show_progress(0.2, 0);
ui_print("5. Install Stock Kernel & Recovery");
package_extract_file("boot.img", "/dev/block/platform/msm_sdcc.1/by-name/boot");
package_extract_file("recovery.img", "/dev/block/platform/msm_sdcc.1/by-name/recovery");
show_progress(0.2, 10);
ui_print("6. Unmount System & Chache");
unmount("/system");
unmount("/cache");
ui_print("7. Finished. Please enjoy");
 
  • Like
Reactions: Mikito1976
Upvote 0
My script also formats, just with a different method (delete_recursive). My rom boots with my script and runs. I'm just having permissions issues which cause keyboard to crash and root apps to ask for perms every time they are opened.

I've been looking at other scripts from other LG phones that use EMMC, and I will be using some stuff from those and your script to add to mine. I'll try things out and report back, unless it works out, then I'll post the rom.

About a week ago when I started making the script, I was either bricking or getting status 0. It's finally nice to have a booting rom and not brick anymore. :D
 
Upvote 0
My script also formats, just with a different method (delete_recursive). My rom boots with my script and runs. I'm just having permissions issues which cause keyboard to crash and root apps to ask for perms every time they are opened.

I've been looking at other scripts from other LG phones that use EMMC, and I will be using some stuff from those and your script to add to mine. I'll try things out and report back, unless it works out, then I'll post the rom.

About a week ago when I started making the script, I was either bricking or getting status 0. It's finally nice to have a booting rom and not brick anymore. :D

Nice ot seems like yours is closer than mine feel free to take codes from mine, hope we have working updater-script soon :)
 
Upvote 0
@Bard

So I went from a running booting rom to bricking.

What I did differently...

I added the firmware symlinks from your script to mine. Those were the only changes I did that caused me to brick. No problem, I can remove them, and boot again.

By the way...
Some of your firmware symlinks did not match (below). I fixed before using them, but bricked anyway. It seems like the firmware symlinks are causing bricks so I will no longer include firmware links in the script.

HTML:
symlink("/firmware/image/modem.b07", "/system/etc/firmware/modem.b08");
symlink("/firmware/image/modem.b07", "/system/etc/firmware/modem.b09");
symlink("/firmware/image/modem.b07", "/system/etc/firmware/modem.b10");
 
Upvote 0
Im not a guru or anything...but I think download mode is only for flashing official firmware to fix bricks and ish like that
That is correct. Download mode is only for official LG firmware.

Though I know little, I know what CWM is for. LGs download mode supposedly lets you easily flash to the device. It was just a suggestion as it seems like your having a problem with Clockworkmod.
No one is having a problem with CWM... The problem is the updater-script which tells cwm how to flash the rom.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones