Hello everybody .. Hiw i can unpack lollipop system.dat file??
@Skin1980
@S3V3N
Akhayev said:
@Skin1980
Click to expand...
Click to collapse
system.dat? Explain better pls
Skin1980 said:
system.dat? Explain better pls
Click to expand...
Click to collapse
I am sorry .. I downloaded cm12 that based on lollipop and when i opened the rom theres a file named system.new.dat and all the apps inside this file and i wants to port some apps from this file but i cant open it cos its .dat file
Akhayev said:
I am sorry .. I downloaded cm12 that based on lollipop and when i opened the rom theres a file named system.new.dat and all the apps inside this file and i wants to port some apps from this file but i cant open it cos its .dat file
Click to expand...
Click to collapse
try to mount it
Skin1980 said:
try to mount it
Click to expand...
Click to collapse
7zip cannot extract a system.new.dat file and DAEMON tools cannot mount it. I'm hoping ROM devs release their ROMs with the standard format but if they don't, I'm sure someone from the community will easily find a way to extract them.
CM12 system.new.dat apps
Hi,
I had downloaded CM12 just now. There are no apks but only 1-img and 1-dat files in which "system.new.dat" file contains the stuff. Please provide a way to extract apks from system.new.dat file.
Unpack
Anyone figure how to do this?
I would like to know this as well.
I don't know for stock, I'm searching how to do it, but for cm12, you can compile from source directly, there is a thread in development section.
I'm stuck too.
Habaddon said:
I don't know for stock, I'm searching how to do it, but for cm12, you can compile from source directly, there is a thread in development section.
Click to expand...
Click to collapse
This is a chicken and egg problem for me. I want to build a ROM but first want to extract the device firmware for my ROM. (I don't have access to the Nexus 4 phone to install a ROM on and then extract the firmware.)
I've been Googling for a solution without luck.
Followed a clue. I uncommented a debug print statement in simg2img. No luck.
Code:
$ file system.new.dat
system.new.dat: Linux rev 1.0 ext4 filesystem data, UUID=57f8f4bc-abf4-655f-bf67-946fc0f9f25b (extents) (large files)
$ simg2img.py system.new.dat system.new.raw
424620032
'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Not a compressed ext4 file!!
Any ideas?
Yeah, I tried that too, it doesn't work. I ask a dev, in fact, it is simple. All you need to do is mount the img.
mkdir system
sudo mount system.img system
Click to expand...
Click to collapse
Still stuck
Habaddon said:
Yeah, I tried that too, it doesn't work. I ask a dev, in fact, it is simple. All you need to do is mount the img.
Click to expand...
Click to collapse
I'm still confused.
I suspect that the system.new.dat is not a simple image file and is most probably signed in some way. I don't know why the file command says that it is an ext4 filesystem while simg2img.py, with the debug statement which prints the first bytes uncommented, prints only nulls.
BTW, I asked my relative who owns the device to try flashing this ROM and it didn't work because of a known problem whereby rooting was lost. He will try a new ROM.
Plan B will be to pull the firmware via adb but I'm certainly curious about the new Lollipop way of packaging the ROM.
Code:
$ ls -l cm-12-20141123-UNOFFICIAL-mako.zip
-rw-r--r-- 1 zippy zippy 238444354 Dec 6 08:20 cm-12-20141123-UNOFFICIAL-mako.zip
$ unzip cm-12-20141123-UNOFFICIAL-mako.zip
Archive: cm-12-20141123-UNOFFICIAL-mako.zip
signed by SignApk
extracting: system.patch.dat
inflating: META-INF/com/android/metadata
inflating: META-INF/com/google/android/update-binary
inflating: META-INF/com/google/android/updater-script
inflating: META-INF/org/cyanogenmod/releasekey
inflating: boot.img
inflating: file_contexts
inflating: [COLOR="Red"]system.new.dat[/COLOR]
inflating: system.transfer.list
inflating: system/bin/backuptool.functions
inflating: system/bin/backuptool.sh
inflating: system/bin/otasigcheck.sh
inflating: META-INF/com/android/otacert
inflating: META-INF/MANIFEST.MF
inflating: META-INF/CERT.SF
inflating: META-INF/CERT.RSA
$ ls -l system.new.dat
-rw-rw-r-- 1 zippy zippy 424620032 Feb 29 2008 system.new.dat
$ file system.new.dat
system.new.dat: Linux rev 1.0 ext4 filesystem data, UUID=57f8f4bc-abf4-655f-bf67-946fc0f9f25b (extents) (large files)
$ rm -rf # remove the extracted system directory from above
$ mkdir system
$ sudo mount system.new.dat system
[sudo] password for zippy:
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
$ dmesg | tail -2
[89035.798766] loop: module loaded
[89035.906824] EXT4-fs (loop0): bad geometry: block count 215040 exceeds size of device (103667 blocks)
I wonder why nobody put up a way to modify this?
I kept looking for the solution from the day lollipop releases, but without any success.
:crying:
Investigating ...
I know more now.
Below is the update-script which calls functions in the update-binary. I highlighted the code in question. This is obviously not a simple filesystem in the system.new.dat. I've hacked at it with ext4.fsck and resize2fs with no luck.
Code:
assert(getprop("ro.product.device") == "mako" || getprop("ro.build.product") == "mako" || abort("This package is for device: mako; this device is " + getprop("ro.product.device") + "."););
ifelse(is_mounted("/system"), unmount("/system"));
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system", "");
package_extract_file("system/bin/backuptool.sh", "/tmp/backuptool.sh");
package_extract_file("system/bin/backuptool.functions", "/tmp/backuptool.functions");
set_metadata("/tmp/backuptool.sh", "uid", 0, "gid", 0, "mode", 0755);
set_metadata("/tmp/backuptool.functions", "uid", 0, "gid", 0, "mode", 0644);
run_program("/tmp/backuptool.sh", "backup");
unmount("/system");
if is_mounted("/data") then
package_extract_file("system/bin/otasigcheck.sh", "/tmp/otasigcheck.sh");
package_extract_file("META-INF/org/cyanogenmod/releasekey", "/tmp/releasekey");
set_metadata("/tmp/otasigcheck.sh", "uid", 0, "gid", 0, "mode", 0755);
run_program("/tmp/otasigcheck.sh") != "31744" || abort("Can't install this package on top of incompatible data. Please try another package or run a factory reset");
else
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/userdata", "/data", "");
package_extract_file("system/bin/otasigcheck.sh", "/tmp/otasigcheck.sh");
package_extract_file("META-INF/org/cyanogenmod/releasekey", "/tmp/releasekey");
set_metadata("/tmp/otasigcheck.sh", "uid", 0, "gid", 0, "mode", 0755);
run_program("/tmp/otasigcheck.sh") != "31744" || abort("Can't install this package on top of incompatible data. Please try another package or run a factory reset");
unmount("/data");
endif;
show_progress(0.750000, 0);
[COLOR="red"]block_image_update("/dev/block/platform/msm_sdcc.1/by-name/system", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat");[/COLOR]
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system", "");
delete("/system/bin/otasigcheck.sh");
unmount("/system");
show_progress(0.020000, 10);
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system", "");
package_extract_file("system/bin/backuptool.sh", "/tmp/backuptool.sh");
package_extract_file("system/bin/backuptool.functions", "/tmp/backuptool.functions");
set_metadata("/tmp/backuptool.sh", "uid", 0, "gid", 0, "mode", 0755);
set_metadata("/tmp/backuptool.functions", "uid", 0, "gid", 0, "mode", 0644);
run_program("/tmp/backuptool.sh", "restore");
delete("/system/bin/backuptool.sh");
delete("/system/bin/backuptool.functions");
unmount("/system");
show_progress(0.050000, 5);
package_extract_file("boot.img", "/dev/block/platform/msm_sdcc.1/by-name/boot");
show_progress(0.200000, 10);
Next, one can look in the source code and try to figure out what it is doing.
Or maybe the next step is to see if there is a host build (i.e. Ubuntu, Fedora, etc) of the binary-update which can be run from the command line into a file which can be mounted.
I'm sure that there is an easy way but finding it is difficult!
Ext2Explorer, Diskinternals Linux Reader can mount, read and extract those system images. But I m not sure if they are fully compatible because in both of these apps which I tried priv-app and some other folders are shown empty. I don't know if normaly there are files in these folders or not.
I've been struggling with these system.new.dat block images since lollipop came out since I need to convert roms to flash onto F2FS system partitions. I searched high and low for a way to mount that image outside of twrp with no luck. So I just used twrp instead... Luckily I've an extra device at my disposal atm. These are the steps I take:
Clean flash a lollipop rom that has a system.new.dat image in twrp.
Reboot system.
When device finishes booting use hardware power button to power down without messing with the rom itself yet so it stays fresh. (It's ok to confirm power down on touch screen.)
In twrp make a backup of only the system partition.
Boot back to system and use the method you prefer to move the file system.ext4.win from /TWRP/BACKUPS/-ur-device-serial/-ur-backup-date on to your pc and rename it system.tar so you can unpack it. (Of course make sure you have the proper decompression tools, which every OS usually does now.)
Now you have the complete fresh contents of /system as you would in a traditional rom zip. You can now do with that as you please. :silly:
Well googling i found this solution http://forum.xda-developers.com/nexus-7/general/guide-unpack-dat-t2970707 @adomol:
I've been struggling with these system.new.dat block images since lollipop came out. I searched high and low for a way to mount that image outside of twrp with no luck. So I just used twrp instead... These are the steps I take:
1.Clean flash a lollipop rom that has a system.new.dat image in twrp.
2.Reboot system.
3.When device finishes booting use hardware power button to power down without messing with the rom itself yet so it stays fresh. (It's ok to confirm power down on touch screen.)
4.In twrp make a backup of only the system partition.
5.Boot back to system and use the method you prefer to move the file system.ext4.win from:
/TWRP/BACKUPS/-ur-device-serial/-ur-backup-date
to your pc and rename it system.tar so you can unpack it. (Of course make sure you have the proper decompression tools, which every OS usually does now.)
Now you have the complete fresh contents of /system as you would in a traditional rom zip. You can do with that as you please, or just throw it into a rom kitchen.
all credits to @adomol
adomol said:
I've been struggling with these system.new.dat block images since lollipop came out since I need to convert roms to flash onto F2FS system partitions. I searched high and low for a way to mount that image outside of twrp with no luck. So I just used twrp instead... Luckily I've an extra device at my disposal atm. These are the steps I take:
Clean flash a lollipop rom that has a system.new.dat image in twrp.
Reboot system.
When device finishes booting use hardware power button to power down without messing with the rom itself yet so it stays fresh. (It's ok to confirm power down on touch screen.)
In twrp make a backup of only the system partition.
Boot back to system and use the method you prefer to move the file system.ext4.win from /TWRP/BACKUPS/-ur-device-serial/-ur-backup-date on to your pc and rename it system.tar so you can unpack it. (Of course make sure you have the proper decompression tools, which every OS usually does now.)
Now you have the complete fresh contents of /system as you would in a traditional rom zip. You can now do with that as you please. :silly:
Click to expand...
Click to collapse
-droidberg- said:
Well googling i found this solution http://forum.xda-developers.com/nexus-7/general/guide-unpack-dat-t2970707 @adomol:
I've been struggling with these system.new.dat block images since lollipop came out. I searched high and low for a way to mount that image outside of twrp with no luck. So I just used twrp instead... These are the steps I take:
1.Clean flash a lollipop rom that has a system.new.dat image in twrp.
2.Reboot system.
3.When device finishes booting use hardware power button to power down without messing with the rom itself yet so it stays fresh. (It's ok to confirm power down on touch screen.)
4.In twrp make a backup of only the system partition.
5.Boot back to system and use the method you prefer to move the file system.ext4.win from:
/TWRP/BACKUPS/-ur-device-serial/-ur-backup-date
to your pc and rename it system.tar so you can unpack it. (Of course make sure you have the proper decompression tools, which every OS usually does now.)
Now you have the complete fresh contents of /system as you would in a traditional rom zip. You can do with that as you please, or just throw it into a rom kitchen.
all credits to @adomol
Click to expand...
Click to collapse
But this won't work when trying to port because you need to swap kernel's (for going between same-device, different-carrier)
Related
Does anyone have a update.zip with update-binary and updater-script, that installs apks into data/app? I cannot for the life of me make a working update.zip that installs apks into data/app folder. please help : (
no one knows? can anyone help:??
anyone help please?
please try to search for information yourself before you post here. a simple google search brought me to this thread @modaco : http://android.modaco.com/content/t.../writing-to-data-with-a-flashable-update-zip/
during recovery not all partitions are mounted and obviously /data/ is not! try to mount it in recovery (the "partitions" thingy in the menu or via adb) before you try to flash the update.zip. it's possible to do that out of the update script but i leave it to you to find out how
jodue said:
please try to search for information yourself before you post here. a simple google search brought me to this thread @modaco : http://android.modaco.com/content/t.../writing-to-data-with-a-flashable-update-zip/
during recovery not all partitions are mounted and obviously /data/ is not! try to mount it in recovery (the "partitions" thingy in the menu or via adb) before you try to flash the update.zip. it's possible to do that out of the update script but i leave it to you to find out how
Click to expand...
Click to collapse
I appreciate your reply. I spent countless hours trying to figure out the update.zip data mounting. I have tried "adb remount /data" command but I always get
remount failed: no such file or directory. I would love to mount data in the updater-script. I do not use update-script as that does not seem to work on my galaxy s. maybe I am doing it wrong, but I tried to make a update-script and it doesn't work.
I dont even have partitions menu in adb ;O
han.azuki said:
I appreciate your reply. I spent countless hours trying to figure out the update.zip data mounting. I have tried "adb remount /data" command but I always get
remount failed: no such file or directory.
Click to expand...
Click to collapse
you can
1) in the recovery: partitions menu->mount /data
OR
2) adb shell and then "mount -t rfs /dev/block/mmcblk0p2 /data"
i don't know about the updater script but http://forum.xda-developers.com/showthread.php?t=641223 should help you start. beware, the partitions are different on the sgs!
good luck!
jonidroid said:
I dont even have partitions menu in adb ;O
Click to expand...
Click to collapse
ups. i have overlooked your post.
the "partitions menu" option is only available in the clockwork recovery (but not int the stock one)...
is there a difference between updater-script and update-script? Thank you so much for the replies.
mount("MTD", "data", "/data");
package_extract_dir("data", "/data");
set_perm(1000, 1000, 0771, "/data/app");
unmount("/data");
i tried that and it doesn't work
even the delete_recursive("/data/app"); doesn't work
Just been given the tip that the userdata mount isnt necessarily called data.
From terminal/adb shell "cat /proc/mtd" and you should see what the correct name is. On my g1 it's "userdata"
About to try and sort the script for my update now - will let you know how it goes.
han.azuki said:
mount("MTD", "data", "/data");
package_extract_dir("data", "/data");
set_perm(1000, 1000, 0771, "/data/app");
unmount("/data");
i tried that and it doesn't work
even the delete_recursive("/data/app"); doesn't work
Click to expand...
Click to collapse
You can't you need to use clockworkmod for that.
I have managed to flash to /data/ on my G1 with the following...
mount("MTD", "userdata", "/data");
package_extract_dir("data", "/data");
unmount("/data");
Dual-boot Powered by U-boot and Custom Kernel on Galaxy Nexus.
Everyone can look at my github for details.
https://github.com/dlhxr
The uboot-tuna repository is for u-boot and the 2nd-kernel-for-galaxy-nexus is for kernel modification.
Edit: I forked the fancykernel repository and change the ramdisk to support image boot in branch fancykernel-ramdisk-imageboot. You can easily use that repository to build an image boot supported kernel.
Instructions are in the post #2, #3 and #4.
The first post is for introduction and some pre-built binaries.
There are pre-built u-boot for dual-boot, tri-boot, quad-boot and quad-recovery-boot!!!
You can find how I modify the u-boot in the branches of uboot-tuna repository.
Dual Boot
View attachment GN_U-Boot_Kernel.zip
* Normal Boot -> No keys are pressed, cyan LED ->Find kernel in /data/media/boot/1st.img
* Recovery Boot -> Volume Up key pressed, green LED -> Go to recovery
* Custom Boot -> Volume Down key pressed, blue LED ->Find kernel in /data/media/boot/2nd.img
!!!It will replace your kernel. Remember to copy your boot.img to /data/media/boot/1st.img first!!!
Tri Boot
View attachment GN_U-Boot_Triboot_Kernel.zip
* First Boot -> No keys are pressed, cyan LED ->Find kernel in /data/media/boot/1st.img
* Third Boot -> Volume Up key pressed, green LED -> Find kernel in /data/media/boot/3rd.img
* Second Boot -> Volume Down key pressed, blue LED ->Find kernel in /data/media/boot/2nd.img
!!!It will replace your kernel. Remember to copy your boot.img to /data/media/boot/1st.img first!!!
Quad Boot Thank Zittoro to remind me about pessing both keys!
View attachment GN_U-Boot_QuadBoot_Kernel.zip
* First Boot -> No keys are pressed, cyan LED ->Find kernel in /data/media/boot/1st.img
* Third Boot -> Volume Up key pressed, green LED -> Find kernel in /data/media/boot/3rd.img
* Second Boot -> Volume Down key pressed, blue LED ->Find kernel in /data/media/boot/2nd.img
* Recovery Boot -> Volume Up and Down keys pressed, yellow LED ->Go to recovery
Quad Boot with Recovery Image Boot
View attachment GN_U-Boot_QuadBoot_Recovery_Kernel.zip
* First Boot -> No keys are pressed, cyan LED ->Find kernel in /data/media/boot/1st.img
* Third Boot -> Volume Up key pressed, green LED -> Find kernel in /data/media/boot/3rd.img
* Second Boot -> Volume Down key pressed, blue LED ->Find kernel in /data/media/boot/2nd.img
* Recovery Boot -> Volume Up and Down keys pressed, yellow LED ->Find recovery image in /data/media/boot/recovery.img. You can put either CWM recovery or TWRP recovery image there.
!!!It will replace your kernel. Remember to copy your boot.img to /data/media/boot/1st.img first!!!
If you want to bulid your own u-boot from source, you can look into post #2.
Three ways to modify the 2nd kernel fully working now!
1. Image Boot Recommanded!
Partition relation for the 2nd kernel.
Code:
system /rdata/media/rom/system.img
data /rdata/media/rom/data.img
cache /rdata/media/rom/cache.img
See post #3 part I
2. Image Folder Mix Boot
Partition relation for the 2nd kernel
Code:
system /rdata/media/2nd/system.img
data /rdata/media/2nd/data
cache /rdata/media/2nd/cache
See post #3 part II
3. Folder Cache Boot
Partition relation for the 2nd kernel.
Code:
system /dev/block/platform/omap/omap_hsmmc.0/by-name/cache
data /rdata/media/2nd/data
cache /rdata/media/2nd/cache
See post #3 part III.
Acknowledgement
twistedumbrella for doing these thing together and his help.
sp3dev for his port of u-boot to galaxy nexus and his help to modify u-boot source.
Jijonhyuni for firstly putting his dual boot kernel on xda.
crayon for his busybox mount way to support HTC DHD multiboot, which inspired me a lot!
Most Frequently Asked Questions Updated on April 18th.
Q: Some of the 4.1 kernels seem not work, right?
A: The init binary in the ramdisk is not compatible. Replace the init in /ramdisk/ by this one.View attachment init.7z
(Don't forget to extract the init in the init.7z first.)
Q: Some kernel has serious color problem, the screen showing a green color?
A: Unpack the kernel and repack it with the cmdline adding "mms_ts.panel_id=18". And I made an easy linux script for this.View attachment Fix_Color.7z:laugh: and an android arm script and binary for people's computer not available.View attachment fix_color_arm.7z I use SManager to execute the script.
Edit: Someone reported his panel_id is not 18, but 162. If 18 doesn't work with your device, try 162.
Q: When I am using the image boot way to dual boot, the zip file seems not being flashed?
A: The TWRP seems not compatible with image boot flashing script and please use CWM recovery instead.
Step 1: How to Modify the U-boot Source
Since developer sp3dev on xda ported u-boot for galaxy nexus, we have the opportunity to exploit it and realize dual-boot on our device. Feel free to email me ([email protected]) or pm me on xda.
Modify the U-boot
Notice: This step can be skipped using my pre-built u-boot.
View attachment GN_U-Boot_Kernel.zip
* Normal Boot -> No keys are pressed, cyan LED ->Find kernel in /data/media/boot/1st.img
* Recovery Boot -> Volume Up key pressed, green LED -> Go to recovery
* Custom Boot -> Volume Down key pressed, blue LED ->Find kernel in /data/media/boot/2nd.img
!!!It will replace your kernel. Remember to copy your boot.img to /data/media/boot/1st.img first!!!
Another pre-built u-boot by me for tri-boot!!!
View attachment GN_U-Boot_Triboot_Kernel.zip
* First Boot -> No keys are pressed, cyan LED ->Find kernel in /data/media/boot/1st.img
* Third Boot -> Volume Up key pressed, green LED -> Find kernel in /data/media/boot/3rd.img
* Second Boot -> Volume Down key pressed, blue LED ->Find kernel in /data/media/boot/2nd.img
!!!It will replace your kernel. Remember to copy your boot.img to /data/media/boot/1st.img first!!!
The pre-compiled version sp3dev provides can only boot one kernel when using android 4.2 system as the main system because sdcard simulation method changed in 4.2 system. The sdcard path is /data/media/0, not /data/media. Sp3dev made the volume down button function to boot from /data/media and it cannot find the kernel we put in sdcard. So I managed to correct the path, successfully boot different kernel on device.
Edit: I change the kernel path to /data/media/boot to make sure the kernel won't be wiped by cwm recovery!
With the help of sp3dev, I successfully change the location of the custom boot kernel to /data/media/boot/2nd.img and the normal boot kernel to /data/media/boot/1st.img.
Firstly, I downloaded the source file of u-boot (https://github.com/Ksys-labs/uboot-tuna) and ARM cross-compiler codesourcery 2010q1-188 version. Exact them to the folder you like.
Change some configuration in /u-boot-source/include/configs/omap4_tuna.h.
Find the following lines.
Code:
"kernel_name=/boot/vmlinux.uimg\0" \
"script_img/boot/vmlinux.scr.uimg\0" \
Change to
Code:
"kernel_name=/meida/boot/1st.img\0" \
"script_img/media/boot/1st.scr.uimg\0" \
And find
Code:
"boot_system=echo Booting SYSTEM; "\
Change one of the lines below it from
Code:
"setenv kernel_part 0xa; " \
to
Code:
"setenv kernel_part 0xc; " \
This one changes the normal boot kernel location and kernel file name to /data/media/boot/1st.img
Now we correct the location for custom boot kernel location. Find the following lines.
Code:
"boot_custom_emmc=echo Booting custom image; " \
"tuna_set_led 4; " \
"setenv loadaddr 0x81f00000; " \
"setenv script_img media/boot/vmlinux.scr.uimg; " \
"setenv kernel_name media/boot/vmlinux.uimg; " \
"setenv script_part 0xc; " \
"setenv kernel_part 0xc; " \
"setenv rootpart 0xc; " \
"setenv devnum 0; " \
"setenv devtype mmc; " \
"setenv bootargs " \
"${dev_extras} root=/dev/${devname}${rootpart} rootwait ro ;"\
"run load_boot_script; " \
"run custom_boot\0" \
Change to
Code:
"boot_custom_emmc=echo Booting custom image; " \
"tuna_set_led 4; " \
"setenv loadaddr 0x81f00000; " \
"setenv script_img /media/boot/2nd.scr.uimg; " \
"setenv kernel_name /media/boot/2nd.img; " \
"setenv script_part 0xc; " \
"setenv kernel_part 0xc; " \
"setenv rootpart 0xc; " \
"setenv devnum 0; " \
"setenv devtype mmc; " \
"setenv bootargs " ANDROID_CMDLINE " ;"\
"run load_boot_script; " \
"run custom_boot\0" \
Save the file and recompile the u-boot using the following script. (Go to source folder first.)
Code:
export PATH=/home/hoary/codesourcery/bin:$PATH
#Note: You should change the path to your codesourcery compiler location.
export ARCH=arm
export CROSS_COMPILE=arm-none-eabi-
make clean
make distclean
make omap4_tuna_config
make -j8 omap4_tuna
And you can find u-boot.bin in your source folder.
Find pre-compiled mkbootimg to make u-boot.bin a flashable img in CWM recovery.
View attachment mkboot-script.zip
Code:
mkbootimg --kernel u-boot.bin --ramdisk /dev/null -o u-boot.aimg
And copy your current kernel (boot.img) to /data/media/boot/1st.img. Using CWM flashable zip or fastboot to flash u-boot to boot partition.
Code:
CWM zip updater-script
package_extract_file("u-boot.aimg", "/dev/block/platform/omap/omap_hsmmc.0/by-name/boot");
Fastboot
fastboot flash boot u-boot.aimg
Step 2: How to Modify the Kernel
There are three ways to modify the kernel.
First one is called image boot, which means we can boot just from images on our device, like system.img, data.img, cache.img.
Second one is called image folder mix boot, which means we can boot from system.img and /data/media/2nd/data, /data/media/2nd/cache folders.
Third one is called folder cache boot, which means we boot from cache partition (mmcblk0p11) and /data/media/2nd/data, /data/media/2nd/cache folders.
I recommand the image boot, because it won't have the possiblity to influence our real system.
Let's begin.
Part I: Image Boot --Booting from images.
See details in https://github.com/dlhxr/2nd-kernel-for-galaxy-nexus/tree/image_boot
An image boot kernel based on learnkernel 6.2 for 4.2
View attachment 2nd_image_boot.7z
This one is color-fixed.
View attachment 2nd_image_boot_color_fixed.7z
Partition relation in the kernel
Code:
system /rdata/media/rom/system.img
data /rdata/media/rom/data.img
cache /rdata/media/rom/cache.img
rdata is the original data partition /dev/block/platform/omap/omap_hsmmc.0/by-name/userdata and I mount it to /rdata instead of /data.
Modify your own kernel
After some study in xda developer Jijonhyuni’s dual boot kernel and a Chinese DHD Multi-boot thread, I managed to change the partition relation in the kernel. There are two files needing to be modified and one file need to be added.
But firstly we should unpack a compiled boot.img for the modification. Using unpackbootimg.
(
One script modified by me. View attachment mkboot-script.zip
See details in extract.sh and pack_boot.sh
Remember to use chmod command to make files in tools folder executable.
Code:
chmod +x ./tools/mkbootimg ./tools/mkbootfs ./tools/unpackbootimg
)
Code:
unpackbootimg –i boot.img
You can get five files.
Code:
boot.img-base
boot.img-cmdline
boot.img-pagesize
boot.img-ramdisk.gz
boot.img-zImage
Unpack the boot.img-ramdisk.gz using
Code:
mkdir ramdisk
cd ramdisk
gzip -dc ../boot.img-ramdisk.gz | cpio –i
OK, let's add a busybox binary.
View attachment busybox.zip
Unzip it and copy busybox to /ramdisk/sbin/busybox.
Then modify two files in ramdisk folder, init.tuna.rc and fstab.tuna.
Find fstab.tuna and modify the system, cache and data mounting line. (Don't forget to delete the check parameter in the data mounting line!)
Code:
[COLOR="Red"]#[/COLOR]/dev/block/platform/omap/omap_hsmmc.0/by-name/system /system ext4 ro wait
/dev/block/platform/omap/omap_hsmmc.0/by-name/efs /factory ext4 ro wait
[COLOR="Red"]#[/COLOR]/dev/block/platform/omap/omap_hsmmc.0/by-name/cache /cache ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check
/dev/block/platform/omap/omap_hsmmc.0/by-name/userdata [COLOR="Red"]/rdata[/COLOR] ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic [COLOR="Red"]wait,encryptable[/COLOR]=/dev/block/platform/omap/omap_hsmmc.0/by-name/metadata
Then find init.tuna.rc.
The on fs part. Change it to this.
Code:
on fs
mkdir /factory 0775 radio radio
mkdir /rdata 0771 system system
mount_all /fstab.tuna
exec /sbin/busybox mount -t ext4 -o ro /rdata/media/rom/system.img /system
exec /sbin/busybox mount -t ext4 -o noatime,nosuid,nodev,nomblk_io_submit,errors=panic,rw /rdata/media/rom/data.img /data
exec /sbin/busybox mount -t ext4 -o noatime,nosuid,nodev,nomblk_io_submit,errors=panic,rw /rdata/media/rom/cache.img /cache
setprop ro.crypto.fuse_sdcard true
Modifications are done and we need to repack the kernel using following command.
Code:
mkbootfs ramdisk | gzip > ramdisk-new.gz
mkbootimg --cmdline "no_console_suspend=1 console=null " --base 0x10000000 --pagesize 2048 --kernel boot.img-zImage --ramdisk ramdisk-new.gz -o 2nd.img
The parameters like cmdline, base and pagesize can be found in the exact files boot.img-base, boot.img-cmdline, boot.img-pagesize.
If you have a serious color problem using this kernel, you need to add "mms_ts.panel_id=18" to cmdline parameter when repacking the kernel.
Put it in /data/media/boot/2nd.img.
Make some img files by dd command in Ubuntu or other linux system.
Code:
dd if=/dev/zero bs=1M count=500 >> 500.img
And then use mke2fs format the image to ext4 file system.
Code:
mke2fs –T ext4 500.img
Rename them and put them into /data/media/rom/xxx.img
View attachment IMGs.zip Images from 50M to 800M pre-made by me.
Part II: Image Folder Mix Boot --Booting from image and folders.
See details in https://github.com/dlhxr/2nd-kernel-for-galaxy-nexus/tree/image_folder_boot
An Image folder boot kernel based on learnkernel 6.2 for 4.2
View attachment 2nd_image_folder_boot.7z
Partition relation in the kernel
Code:
system /rdata/media/2nd/system.img
data /rdata/media/2nd/data
cache /rdata/media/2nd/cache
rdata is the original data partition /dev/block/platform/omap/omap_hsmmc.0/by-name/userdata and I mount it to /rdata instead of /data.
Modify your own kernel
Firstly, unpack the boot.img using the method in the second post.
Find fstab.tuna and modify the system, cache and data mounting line. (Don't forget to delete the check parameter in the data mounting line!)
Code:
[COLOR="Red"]#[/COLOR]/dev/block/platform/omap/omap_hsmmc.0/by-name/system /system ext4 ro wait
/dev/block/platform/omap/omap_hsmmc.0/by-name/efs /factory ext4 ro wait
[COLOR="Red"]#[/COLOR]/dev/block/platform/omap/omap_hsmmc.0/by-name/cache /cache ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check
/dev/block/platform/omap/omap_hsmmc.0/by-name/userdata [COLOR="Red"]/rdata [/COLOR] ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic [COLOR="Red"]wait,encryptable[/COLOR]=/dev/block/platform/omap/omap_hsmmc.0/by-name/metadata
Then find init.tuna.rc.
The on fs part. Change it to this.
Code:
on fs
mkdir /factory 0775 radio radio
mkdir /rdata 0771 system system
mount_all /fstab.tuna
exec /sbin/busybox mount -t ext4 -o ro /rdata/media/2nd/system.img /system
mkdir /rdata/media/2nd
mkdir /rdata/media/2nd/data 0775 system system
mkdir /rdata/media/2nd/cache 0775 system cache
exec /sbin/busybox mount --bind /rdata/media/2nd/data /data
exec /sbin/busybox mount --bind /rdata/media/2nd/cache /cache
setprop ro.crypto.fuse_sdcard true
Thirdly, put busybox binary into /ramdisk/sbin/busybox
At last repack the boot.img.
You can find how to make images in Part I: Image Boot.
Part III: Folder Cache Boot
See details in https://github.com/dlhxr/2nd-kernel-for-galaxy-nexus/tree/folder_boot
I call this way to modify the kernel ----Folder Boot.
here is one folder boot kernel packed by me based on leankernel 6.2
View attachment 2nd_folder_boot.7z
The partition relation in the 2nd kernel is
Code:
system /dev/block/platform/omap/omap_hsmmc.0/by-name/cache
data /rdata/media/2nd/data
cache /rdata/media/2nd/cache
rdata is the original data partition /dev/block/platform/omap/omap_hsmmc.0/by-name/userdata and I mount it to /rdata instead of /data.
There are two files needing to be modified and one file need to be added.
Unpack the boot.img.
Firstly, let's add a busybox binary.
View attachment busybox.zip
Unzip it and copy busybox to /ramdisk/sbin/busybox.
Then modify two files in ramdisk folder, init.tuna.rc and fstab.tuna
fstab.tuna
Change like this
Code:
/dev/block/platform/omap/omap_hsmmc.0/by-name/[B][COLOR="Red"]cache[/COLOR][/B] /system ext4 ro wait
/dev/block/platform/omap/omap_hsmmc.0/by-name/efs /factory ext4 ro wait
[B][COLOR="Red"]#[/COLOR][/B]/dev/block/platform/omap/omap_hsmmc.0/by-name/cache /cache ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check
/dev/block/platform/omap/omap_hsmmc.0/by-name/userdata /[B][COLOR="Red"]rdata[/COLOR][/B] ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check,encryptable=/dev/block/platform/omap/omap_hsmmc.0/by-name/metadata
Init.tuna.rc
Find on fs and change like this
on fs
Code:
mkdir /factory 0775 radio radio
[B][COLOR="Red"]mkdir /rdata 0771 system system[/COLOR][/B]
mount_all /fstab.tuna
[B][COLOR="Red"]mkdir /rdata/media/2nd
mkdir /rdata/media/2nd/data 0775 system system
mkdir /rdata/media/2nd/cache 0775 system cache
exec /sbin/busybox mount --bind /rdata/media/2nd/data /data
exec /sbin/busybox mount --bind /rdata/media/2nd/cache /cache[/COLOR][/B]
setprop ro.crypto.fuse_sdcard true
Then find # virtual sdcard daemon running as media_rw (1023)
Change from
Code:
service sdcard /system/bin/sdcard /data/media /mnt/shell/emulated 1023 1023
to
Code:
service sdcard /system/bin/sdcard[B][COLOR="Red"] /rdata/media[/COLOR][/B] /mnt/shell/emulated 1023 1023
Repack the 2nd.img and put it in /data/media/boot/2nd.img.
Step 3: How to Modify the updater-script in the Flashable Zip Installer.
Part I: Image Boot
Firstly, add following lines below the first line. assert(getprop("ro.product.device") == "maguro" || getprop("ro.build.product") == "maguro");
Code:
unmount("system");
unmount("data");
unmount("cache");
run_program("/sbin/mkdir", "/rdata");
run_program("/sbin/mount", "-t", "ext4", "/dev/block/platform/omap/omap_hsmmc.0/by-name/userdata", "/rdata");
Replace the following line
Code:
mount("ext4", "EMMC", "/dev/block/platform/omap/omap_hsmmc.0/by-name/system", "/system");
by
Code:
run_program("/sbin/losetup", "/dev/block/loop1", "/rdata/media/rom/system.img");
run_program("/sbin/mount", "-t", "ext4", "/dev/block/loop1", "/system");
Replace the following lines
Code:
format("ext4", "EMMC", "/dev/block/platform/omap/omap_hsmmc.0/by-name/system", "0", "/system");
mount("ext4", "EMMC", "/dev/block/platform/omap/omap_hsmmc.0/by-name/system", "/system");
by
Code:
run_program("/sbin/losetup", "/dev/block/loop1", "/rdata/media/rom/system.img");
run_program("/sbin/mke2fs", "-T", "ext4", "/dev/block/loop1");
run_program("/sbin/mount", "-t", "ext4", "/dev/block/loop1", "/system");
Replace the following line
Code:
mount("ext4", "EMMC", "/dev/block/platform/omap/omap_hsmmc.0/by-name/userdata", "/data");
by
Code:
run_program("/sbin/losetup", "/dev/block/loop2", "/realdata/media/rom/data.img");
run_program("/sbin/mount", "-t", "ext4", "/dev/block/loop2", "/data");
Replace the following line (not include the lines you add at first.)
Code:
unmount("data");
by
Code:
run_program("/sbin/umount", "-d", "/data");
Replace the following line (not include the lines you add at first.)
Code:
unmount("system");
by
Code:
run_program("/sbin/umount", "-d", "/system");
Delete the following line
Code:
package_extract_file("boot.img", "/dev/block/platform/omap/omap_hsmmc.0/by-name/boot");
Add the following line in the end
Code:
run_program("/sbin/umount", "/rdata");
Part II: Image Folder Mix Boot
Firstly, add following lines below the first line. assert(getprop("ro.product.device") == "maguro" || getprop("ro.build.product") == "maguro");
Code:
unmount("system");
unmount("data");
unmount("cache");
run_program("/sbin/mkdir", "/realdata");
run_program("/sbin/mount", "-t", "ext4", "/dev/block/platform/omap/omap_hsmmc.0/by-name/userdata", "/rdata");
Replace the following line
Code:
mount("ext4", "EMMC", "/dev/block/platform/omap/omap_hsmmc.0/by-name/system", "/system");
by
Code:
run_program("/sbin/losetup", "/dev/block/loop1", "/rdata/media/2nd/system.img");
run_program("/sbin/mount", "-t", "ext4", "/dev/block/loop1", "/system");
Replace the following lines
Code:
format("ext4", "EMMC", "/dev/block/platform/omap/omap_hsmmc.0/by-name/system", "0", "/system");
mount("ext4", "EMMC", "/dev/block/platform/omap/omap_hsmmc.0/by-name/system", "/system");
by
Code:
run_program("/sbin/losetup", "/dev/block/loop1", "/rdata/media/2nd/system.img");
run_program("/sbin/mke2fs", "-T", "ext4", "/dev/block/loop1");
run_program("/sbin/mount", "-t", "ext4", "/dev/block/loop1", "/system");
Delete the following line
Code:
mount("ext4", "EMMC", "/dev/block/platform/omap/omap_hsmmc.0/by-name/userdata", "/data");
Delete the following line (not include the lines you add at first.)
Code:
unmount("data");
Replace the following line (not include the lines you add at first.)
Code:
unmount("system");
by
Code:
run_program("/sbin/umount", "-d", "/system");
Delete the following line
Code:
package_extract_file("boot.img", "/dev/block/platform/omap/omap_hsmmc.0/by-name/boot");
Add the following line in the end
Code:
run_program("/sbin/umount", "/rdata");
Modify the orginal line related to data partition. For example.
Replace the following line
Code:
package_extract_dir("data", "/data");
by
Code:
package_extract_dir("data", "/rdata/media/2nd/data");
Part III: Folder Cache Boot
Modify the updater-script to mount /dev/block/platform/omap/omap_hsmmc.0/by-name/cache to /system.
And rember to wipe your cache in CWM recovery, before apply the zip file.
You can also use twistedumbrella's app Dual-Boot Builder to install the system as folder cache boot system.
http://forum.xda-developers.com/showthread.php?t=2192064
Delete the following line in updater-script
Code:
format("ext4", "EMMC", "/dev/block/platform/omap/omap_hsmmc.0/by-name/system", "0", "/system");
Delete the following line in updater-script
Code:
package_extract_file("boot.img", "/dev/block/platform/omap/omap_hsmmc.0/by-name/boot");
Replace the following line in updater-script
Code:
mount("ext4", "EMMC", "/dev/block/platform/omap/omap_hsmmc.0/by-name/system", "/system");
by
Code:
mount("ext4", "EMMC", "/dev/block/platform/omap/omap_hsmmc.0/by-name/cache", "/system");
And replace the package extract for data like this.
Code:
package_extract_dir("data", "/data");
To
Code:
package_extract_dir("data", "/data/media/2nd/data");
Re: [KERNEL] [U-boot]Dual-boot Powered by U-boot and Custom Kernel [24/03]
So if I follow, this is doing the same thing the current dual boot kernels do but needs two kernels?
keep trying... true multi boot will be awesome
In theory this is the u-boot kernel with both the first and second kernel for running two 4.2 ROMs. I haven't tested it, but it should fix the issues with the second kernel by fixing the fstab and then symlinking the directories instead of all that realdata stuff that didn't match up to anything
twistedumbrella said:
In theory this is the u-boot kernel with both the first and second kernel for running two 4.2 ROMs. I haven't tested it, but it should fix the issues with the second kernel by fixing the fstab and then symlinking the directories instead of all that realdata stuff that didn't match up to anything
Click to expand...
Click to collapse
Thank you so much.
But i tested it and something was wrong.
The screen said Cannot mount filesystem on /dev/block/platform/omap/omap_hsmmc.0/by-name/system at /data/media/2nd/system.
And other stuffs...
I see in your fstab.tuna.
Code:
/dev/block/platform/omap/omap_hsmmc.0/by-name/system /data/media/2nd/system ext4 noatime,ro wait
/dev/block/platform/omap/omap_hsmmc.0/by-name/efs /factory ext4 ro wait
/dev/block/platform/omap/omap_hsmmc.0/by-name/cache /data/media/2nd/cache ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic,noauto_da_alloc,data=writeback wait,check
/dev/block/platform/omap/omap_hsmmc.0/by-name/userdata /data/media/2nd/data ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic,noauto_da_alloc,data=writeback wait,check,encryptable=/dev/block/platform/omap/omap_hsmmc.0/by-name/metadata
The second parameter is the mount point, right?
/data/media/2nd/system seems not work.....
dlhxr said:
Thank you so much.
But i tested it and something was wrong.
The screen said Cannot mount filesystem on /dev/block/platform/omap/omap_hsmmc.0/by-name/system at /data/media/2nd/system.
And other stuffs...
I see in your fstab.tuna.
Code:
/dev/block/platform/omap/omap_hsmmc.0/by-name/system /data/media/2nd/system ext4 noatime,ro wait
/dev/block/platform/omap/omap_hsmmc.0/by-name/efs /factory ext4 ro wait
/dev/block/platform/omap/omap_hsmmc.0/by-name/cache /data/media/2nd/cache ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic,noauto_da_alloc,data=writeback wait,check
/dev/block/platform/omap/omap_hsmmc.0/by-name/userdata /data/media/2nd/data ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic,noauto_da_alloc,data=writeback wait,check,encryptable=/dev/block/platform/omap/omap_hsmmc.0/by-name/metadata
The second parameter is the mount point, right?
/data/media/2nd/system seems not work.....
Click to expand...
Click to collapse
# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
It's not working because you can't really mount something to data without mounting data first and you are trying to have a second data folder inside the first. Basically, the way you are trying to do it won't work.
twistedumbrella said:
# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
It's not working because you can't really mount something to data without mounting data first and you are trying to have a second data folder inside the first. Basically, the way you are trying to do it won't work.
Click to expand...
Click to collapse
So it is the end?
/data/2nd/system is even not a mount point, but why you write it in fstab.tuna?
How did the dual-boot work deal with the first-mount stuff?
dlhxr said:
So it is the end?
/data/2nd/system is even not a mount point, but why you write it in fstab.tuna?
How did the dual-boot work deal with the first-mount stuff?
Click to expand...
Click to collapse
dlhxr said:
Since I don’t want the 2nd system to have any influence on the 1st system, I choose to put 2nd system into data partition. The partition relation in the 2nd kernel is
Code:
[B][I][U][SIZE="3"]system /data/media/2nd/system[/SIZE][/U][/I][/B]
data /data/media/2nd/data
cache /data/media/2nd/cache
Click to expand...
Click to collapse
/dev/block/platform/omap/omap_hsmmc.0/by-name/system /data/media/2nd/system ext4 noatime,ro wait
I have it that way because you said that was where you were trying to mount...
If this one doesn't work, then you need to restructure the directories to have your "fake" folder as a top-level directory like /udata
twistedumbrella said:
/dev/block/platform/omap/omap_hsmmc.0/by-name/system /data/media/2nd/system ext4 noatime,ro wait
I have it that way because you said that was where you were trying to mount...
If this one doesn't work, then you need to restructure the directories to have your "fake" folder as a top-level directory like /udata
Click to expand...
Click to collapse
ah, I didn't explain myself well....
What I want is to mount /mmcblk0p12(realdata)/media/2nd/system to /system.....etc.
dlhxr said:
ah, I didn't explain myself well....
What I want is to mount /mmcblk0p12(realdata)/media/2nd/system to /system.....etc.
Click to expand...
Click to collapse
mmcblk0p12 mounts as /data in the first ROM correct? So in the second ROM, you are mounting a subdirectory of /data, otherwise you just overwrite the first ROMs data. Maybe it's better to leave you to it.
twistedumbrella said:
mmcblk0p12 mounts as /data in the first ROM correct? So in the second ROM, you are mounting a subdirectory of /data, otherwise you just overwrite the first ROMs data. Maybe it's better to leave you to it.
Click to expand...
Click to collapse
When I boot into the second rom kernel, I need to firstly mount mmcblk0p12 to /realdata and then mount its subdirectory to /data.
When I am in second rom, it would not influence the first rom because I even didn't load the first rom....
twistedumbrella said:
mmcblk0p12 mounts as /data in the first ROM correct? So in the second ROM, you are mounting a subdirectory of /data, otherwise you just overwrite the first ROMs data. Maybe it's better to leave you to it.
Click to expand...
Click to collapse
I made it work and updated my second post in this thread.
But in the second system there's no root access and I can't see what's in data and what's in cache in root explorer....
Don't know what's wrong.
dlhxr said:
I made it work and updated my second post in this thread.
But in the second system there's no root access and I can't see what's in data and what's in cache in root explorer....
Don't know what's wrong.
Click to expand...
Click to collapse
Try this one. I know what's in it and I can explain it if it works, but I don't have a setup to test it on.
twistedumbrella said:
Try this one. I know what's in it and I can explain it if it works, but I don't have a setup to test it on.
Click to expand...
Click to collapse
It doesn't work showing system not mounted (can't find /system/xxxxxx)
I unpacked your kernel and I think we should remove the check part during mounting realdata in fstab.tuna because it uses e2fsck in the system partition to check whether the partition mounted right or not, which lead to an error.
After I changed this, the system boots! But still no root access.....
Maybe my updater-script modification is not right?
At last, great work! Thanks a lot!
dlhxr said:
It doesn't work showing system not mounted (can't find /system/xxxxxx)
I unpacked your kernel and I think we should remove the check part during mounting realdata in fstab.tuna because it uses e2fsck in the system partition to check whether the partition mounted right or not, which lead to an error.
After I changed this, the system boots! But still no root access.....
Maybe my updater-script modification is not right?
At last, great work! Thanks a lot!
Click to expand...
Click to collapse
https://github.com/ThePlayground/uboot-tuna
dlhxr said:
Another u-boot searching another location for kernel by me.
View attachment 1834529
* Normal Boot -> no keys are pressed, cyan LED ->Find kernel in /data/media/boot/1st.img
* Recovery Boot -> Volume Up key pressed, green LED -> Go to recovery
* Custom Boot -> Volume Down key pressed, blue LED ->Find kernel in /data/media/boot/2nd.img
Note: It will replace your kernel. Remember to copy your boot.img to /data/media/boot/1st.img first!
Click to expand...
Click to collapse
Classy... but I have one better for ya:
http://forum.xda-developers.com/showthread.php?t=2009485
twistedumbrella said:
https://github.com/ThePlayground/uboot-tuna
Click to expand...
Click to collapse
it is very interesting...
I followed your git and made the same change (init.rc, init.tuna.rc, fstab.tuna) for leankernel 6.2 and it didn't work...
It is stuck in the u-boot bootimg 2nd kernel on the screen...
Some of my recent development work has involved frequent changes between stock ROMs and custom ROMs on a Droid Razr M, and I quickly grew weary of dealing with RSD Lite and Windows. So I put together a procedure for converting the .xml.zip ROM into an "update.zip" which is flashable via TWRP.
1) Download the .xml.zip file. I used VZW_XT907_4.1.1-9.8.1Q-27-2-4_1FF.xml.zip from here.
2) Unzip the file into a temporary directory.
3) Extract the system.img sparse ext4 filesystem using simg2img from AOSP (or simg2img.py). Note that the Motorola images have an extra header which needs to be removed with "dd":
Code:
dd if=system.img of=simg bs=131072 skip=1
simg2img simg raw.img
sudo mount -o loop raw.img /mnt
If all goes well, you should see the /system contents under /mnt:
Code:
$ ls -l /mnt
total 72
drwxr-xr-x 2 root root 12288 Oct 21 2012 app/
drwxr-xr-x 2 root 2000 8192 Oct 21 2012 bin/
-rw-r--r-- 1 root root 7562 Oct 21 2012 build.prop
drwxr-xr-x 16 root root 4096 Oct 21 2012 etc/
drwxr-xr-x 2 root root 4096 Oct 21 2012 fonts/
drwxr-xr-x 2 root root 4096 Oct 21 2012 framework/
drwxr-xr-x 9 root root 12288 Oct 21 2012 lib/
drwxr-xr-x 4 root root 4096 Oct 21 2012 media/
drwxr-xr-x 3 root root 4096 Oct 21 2012 tts/
drwxr-xr-x 8 root root 4096 Oct 21 2012 usr/
drwxr-xr-x 5 root 2000 4096 Oct 21 2012 vendor/
drwxr-xr-x 2 root 2000 4096 Oct 21 2012 xbin/
4) Make a new directory for your update.zip contents.
A minimal update.zip contains the system/ partition contents, plus three files:
boot.img - kernel image
META-INF/com/google/android/update-binary - I copied this from a CM 10.1 zip
META-INF/com/google/android/updater-script - see below
Copy boot.img (from the .xml.zip file) and update-binary (from another ROM) into the appropriate locations.
5) Create a new updater-script. A bare bones script for XT907 looks like:
Code:
assert(getprop("ro.product.device") == "xt907" || getprop("ro.product.device") == "scorpion_mini");
format("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "0", "/system");
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");
package_extract_dir("system", "/system");
[i][file permissions - see below][/i]
package_extract_file("boot.img", "/dev/block/platform/msm_sdcc.1/by-name/boot");
unmount("/system");
6) Fill in the file permissions section.
To generate the file permission commands, I wrote a perl script "dumpperms.pl" which traverses the loopback-mounted /system partition and prints a "set_perm" or "symlink" command for each entry that requires it. This looks something like:
Code:
$ dumpperms.pl /mnt
set_perm_recursive(0, 0, 0755, 0644, "/system");
set_perm(0, 2000, 0755, "/system/bin");
set_perm(0, 2000, 0755, "/system/bin/ATFWD-daemon");
set_perm(0, 2000, 0755, "/system/bin/RescueServer");
set_perm(0, 2000, 0755, "/system/bin/RescueStarter");
[...]
set_perm(1002, 1002, 0440, "/system/etc/bluetooth/network.conf");
set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
symlink("/data/misc/audio/wcd9310_anc.bin", "/system/etc/firmware/wcd9310/wcd9310_anc.bin");
symlink("/data/misc/audio/mbhc.bin", "/system/etc/firmware/wcd9310/wcd9310_mbhc.bin");
[...]
The output from this script should be pasted into the permissions section of updater-script.
7) Create the new update.zip file. boot.img, system/, and META-INF/ should be at the top level:
Code:
$ ls
boot.img META-INF/ system/
$ rm -f /tmp/update.zip ; zip -r /tmp/update.zip .
zip warning: name not matched: system/lib/modules/wlan.ko
zip warning: name not matched: system/vendor/firmware
zip warning: name not matched: system/etc/firmware/wcd9310/wcd9310_anc.bin
zip warning: name not matched: system/etc/firmware/wcd9310/wcd9310_mbhc.bin
zip warning: name not matched: system/etc/firmware/wlan/prima/WCNSS_qcom_wlan_nv.bin
zip warning: name not matched: system/etc/firmware/wlan/prima/WCNSS_qcom_cfg.ini
adding: boot.img (deflated 49%)
adding: system/ (stored 0%)
adding: system/media/ (stored 0%)
adding: system/media/KnowYourDevice/ (stored 0%)
[...]
The file should now be ready for flashing / sideloading. The provided template does not clear /data or /cache, so that can be done by hand or added to the updater-script.
Modem update from CWM simply doesn't work!
I tried already everything! Result is: Script runs without error but no change, the baseband version is still the old.
My last update script (no errors, but doesn't work) is following:
Code:
assert(getprop("ro.product.device") == "serranolte" || getprop("ro.build.product") == "serranolte" ||
getprop("ro.product.device") == "serranoltexx" || getprop("ro.build.product") == "serranoltexx" ||
getprop("ro.product.device") == "i9195" || getprop("ro.build.product") == "i9195" ||
getprop("ro.product.device") == "GT-I9195" || getprop("ro.build.product") == "GT-I9195");
ui_print("------------------------------------------------------");
ui_print("I9195 modem update by LackoGyerek");
show_progress(0.150000, 0);
package_extract_dir("tools", "/tmp");
set_perm(0, 0, 0777, "/tmp/busybox");
run_program("/tmp/busybox", "mkfs.vfat", "/dev/block/platform/msm_sdcc.1/by-name/modem");
run_program("/tmp/busybox", "mkdir", "-p", "/tmp/modem");
run_program("/tmp/busybox", "mount", "-w", "-t", "auto", "/dev/block/platform/msm_sdcc.1/by-name/modem", "/tmp/modem");
package_extract_dir("modem", "/tmp/modem");
set_perm_recursive(0, 1000, 0771, 0771, "/tmp/modem/image");
run_program("/tmp/busybox", "umount", "/tmp/modem");
ui_print("Installation complete!");
show_progress(1.000000, 0);
ui_print("------------------------------------------------------");
The update package above uses the unpacked NON-HLOS.bin content. Can be easily unpacked with DiskInternals Linux Reader tool.
Already tried with/without formatting of modem partition.
Also tried the edify command
Code:
package_extract_file("NON-HLOS.bin", "/dev/block/platform/msm_sdcc.1/by-name/modem");
Method below was checked too:
Code:
busybox dd if=./NON-HLOS.bin of=/dev/block/platform/msm_sdcc.1/by-name/modem
Result of dd command:
Code:
97923+1 records in
97923+1 records out
50136832 bytes (47.8MB) copied, 6.765573 seconds, 7.1MB/s
And finally this method:
Code:
package_extract_dir("modem","/tmp");
write_raw_image("/tmp/NON-HLOS.bin", "/dev/block/platform/msm_sdcc.1/by-name/modem");
delete("/tmp/NON-HLOS.bin");
All above with the same result: No error during flash, but baseband version not changed.
Any idea, how to update modem via recovery?
If you check the contents of the flashed NON-HLOS.bin you should find that it has indeed been changed.
The version listed in about device doesn't update unless you flash with Odin twice
Whosat said:
If you check the contents of the flashed NON-HLOS.bin you should find that it has indeed been changed.
The version listed in about device doesn't update unless you flash with Odin twice
Click to expand...
Click to collapse
Trust me, I checked it!
Followíng command used to check:
Code:
busybox dd if=/dev/block/platform/msm_sdcc.1/by-name/modem | strings | grep "I9195"
The above always returned the old baseband version string.
And yes, the Odin solution works also for me but I'm searching for a CWM flash solution. No luck yet...
News: I've found this XDA thread, where user says:
The only Write operation permitted on a flash memory device is to
change a bit from a one to a zero. If the reverse operation is needed, then
the block must be erased (to reset all bits to the one state).
Click to expand...
Click to collapse
Maybe this is the solution. Before flashing modem, the whole modem partition must be erased.
Guys, it's really interesting. It seems, that modem partition on our device is write protected. We simply can't erase/format it or write anything to it from recovery (or we don't know the correct way).
I did the following: Went to TWRP recovery, which has built in command line terminal. My goal was to format modem partition. Normally this can be done using following command:
Code:
busybox mkfs.vfat -v /dev/block/platform/msm_sdcc.1/by-name/modem
Cmd executed successfully, but modem partition was NOT formatted.
After restart of phone I checked the mobile data functionality, everything worked and still works without problem.
This is the script form a GT-I9500 CWM-flashable modem.
Code:
ui_print("----Samsung Galaxy S4----");
ui_print("-----GT-I9500-ONLY-----");
ui_print("-----Android 4.2.2------");
ui_print("------STOCK Modem-----");
ui_print("-created-by-DjeMBeY-XDA-");
show_progress(0.150000, 0);
assert(package_extract_file("Djembey/modem.bin", "/tmp/modem.bin"),
write_raw_image("/tmp/modem.bin", "/dev/block/mmcblk0p13"),
delete("/tmp/modem.bin"));
ui_print("Installation complete!");
show_progress(1.000000, 0);
Seems like it uses write_raw_image straight to the partition.
Whosat said:
This is the script form a GT-I9500 CWM-flashable modem.
Code:
ui_print("----Samsung Galaxy S4----");
ui_print("-----GT-I9500-ONLY-----");
ui_print("-----Android 4.2.2------");
ui_print("------STOCK Modem-----");
ui_print("-created-by-DjeMBeY-XDA-");
show_progress(0.150000, 0);
assert(package_extract_file("Djembey/modem.bin", "/tmp/modem.bin"),
write_raw_image("/tmp/modem.bin", "/dev/block/mmcblk0p13"),
delete("/tmp/modem.bin"));
ui_print("Installation complete!");
show_progress(1.000000, 0);
Seems like it uses write_raw_image straight to the partition.
Click to expand...
Click to collapse
Yes, I saw that. Already tried but as the other methods: Script executes successfully, but modem is not updated.
You can also try if you want, here is my example.
The script in my package is following:
Code:
package_extract_dir("modem","/tmp");
[B]write_raw_image[/B]("/tmp/NON-HLOS.bin", "/dev/block/platform/msm_sdcc.1/by-name/modem");
delete("/tmp/NON-HLOS.bin");
Note: assert() command is not necessary.
Hi.
This is my first time working with ROMs, wanted to see if I could unpack and repack them and have them work, so I would know if my later changes cause problems. I've noticed if I unzip a ROM, then zip it again, without any changes made, I get this error within a few seconds of starting the flash. If I don't unpack and repack the zip, it flashes fine.
I use the Android Kitchen, to unpack/repack, and signed the zip. Anyone know what's going on?
Did a full wipe with TWRP before flash attempt.
Code:
Starting ADB Sideload feature...
Target: google/occam/mako:5.1.1/LMy48M/2167285:user/release-keys
detected filesystem ext4 for /dev/block/platform/msm_sdcc.1/by-name/system
Patching system image unconditionally...
E1001: Failed to update system image.
Updater process ended with ERROR: 7
Thank you,
Josh
Edit your updater-script
find this line
Code:
.... package_extract_file("system.transfer.list"), "system.new.dat.br", "system.patch.dat") ||
abort("E1001: Failed to update system image.");
change to :
Code:
.... package_extract_file("system.transfer.list"), "system.new.dat.br", "system.patch.dat");
Just replace " ||" with ";" and delete line abort("blablabla"):
adislice said:
find this line
Code:
.... package_extract_file("system.transfer.list"), "system.new.dat.br", "system.patch.dat") ||
abort("E1001: Failed to update system image.");
change to :
Code:
.... package_extract_file("system.transfer.list"), "system.new.dat.br", "system.patch.dat");
Just replace " ||" with ";" and delete line abort("blablabla"):
Click to expand...
Click to collapse
hey man when i deleted that line my phone booted in fastboot mode
I solved this by installing the latest version of TWRP and Oxygen OS.
Can anyone please help me correct error 7 with the following updater-script
The error i get is :
Installing zip file '/external_sd/lineage-15.1
20180524-UNOFFICIAL-Ocm.zip
Checking for Digest file...
Target: htc/ocmdtwl_01405/htc_ocmdtwl:8.0.0/OPR6.
170623.013/1010171.4:user/release-keys
detected filesystem ext4 for /dev/block/bootdevice/
by-name/system
Patching system image unconditionally...
E1001: Failed to update system image.
Updater process ended with ERROR: 7
Error installing zip file '/external_sd/lineage-15.
-20180524-UNOFFICIAL-ROm,zip'
Updating partition details...
... done
assert(getprop("ro.product.device") == "htc_ocm" || getprop("ro.build.product") == "htc_ocm" ||
getprop("ro.product.device") == "htc_ocndugl" || getprop("ro.build.product") == "htc_ocndugl" ||
getprop("ro.product.device") == "htc_ocmdtwl" || getprop("ro.build.product") == "htc_ocmdtwl" ||
getprop("ro.product.device") == "ocm" || getprop("ro.build.product") == "ocm" || abort("E3004: This package is for device: htc_ocm,htc_ocndugl,htc_ocmdtwl,ocm; this device is " + getprop("ro.product.device") + ".");
ui_print("Target: htc/ocmdtwl_01405/htc_ocmdtwl:8.0.0/OPR6.170623.013/1010171.4:user/release-keys");
ifelse(is_mounted("/system"), unmount("/system"));
package_extract_dir("install", "/tmp/install");
set_metadata_recursive("/tmp/install", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644);
set_metadata_recursive("/tmp/install/bin", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0755);
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "backup");
unmount("/system");
show_progress(0.650000, 0);
ui_print("Patching system image unconditionally...");
block_image_update("/dev/block/bootdevice/by-name/system", package_extract_file("system.transfer.list"), "system.new.dat.br", "system.patch.dat") ||
abort("E1001: Failed to update system image.");
show_progress(0.100000, 0);
ui_print("Patching vendor image unconditionally...");
block_image_update("/dev/block/bootdevice/by-name/vendor", package_extract_file("vendor.transfer.list"), "vendor.new.dat.br", "vendor.patch.dat") ||
abort("E2001: Failed to update vendor image.");
show_progress(0.020000, 10);
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "restore");
unmount("/system");
show_progress(0.050000, 5);
package_extract_file("boot.img", "/dev/block/bootdevice/by-name/boot");
show_progress(0.200000, 10);
if (getprop("ro.boot.mid") == "2Q4D20000" || getprop("ro.boot.mid") == "2Q4D10000") then
ui_print("This is a DS device - renaming radio props");
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
rename("/vendor/lib64/libril-qc-ltedirectdisc.so", "/system/vendor/lib64/libril-qc-ltedirectdisc.so");
rename("/vendor/lib64/libril-qc-qmi-1.so", "/system/vendor/lib64/libril-qc-qmi-1.so");
rename("/vendor/lib64/libril-qc-radioconfig.so", "/system/vendor/lib64/libril-qc-radioconfig.so");
rename("/vendor/lib64/libril-qcril-hook-oem.so", "/system/vendor/lib64/libril-qcril-hook-oem.so");
unmount("/system");
endif;
set_progress(1.000000);
Any help is appreciated :s
Try using sideload insted of sd
i had the same error and i could do nothing...then I thought my sd maybe giving the error so i tried the sideload mode and believe me..........it worked
option 2:-if u have backed up your rom (or by anyhow if you can) try flashing another (in my case...an older) version of twrp. it also worked for me. would be glad if this helps you.
---------- Post added at 11:30 PM ---------- Previous post was at 11:05 PM ----------
[/COLOR]
SL.Pirate said:
i had the same error and i could do nothing...then I thought my sd maybe giving the error so i tried the sideload mode and believe......me it worked
but...at the moment i am having another problem...i'd appreciate if someone could help. the rom has been installed correctly (I guess) but...when it reboots,it says encryption unsuccessful. ther'es a key sayng reset phone but nothing happens after pressing it.i tried wiping all the partitions and reinstalling the rom and no use.
Click to expand...
Click to collapse
Solved...had some matters with the data partition.
SL.Pirate said:
Solved...had some matters with the data partition.
Click to expand...
Click to collapse
Such as?
I'm stuck at the same place as you were...
For the posterity :
in TWRP go to advanced > terminal, then create /cache/recovery with
mkdir /cache/recovery
solved the problem for me
Source : https://android.stackexchange.com/q...ineage-16-samsung-galaxy-note-2-gt-n7100-t03g
6mon said:
Such as?
I'm stuck at the same place as you were...
Click to expand...
Click to collapse
it said 'ENCRYPTION UNSUCCESSFULL'
if the samething happens to you....go to twrp,select wipe,advanced wipe and select (only) the data partition. then you gotta select repair or change file system select change file system and then select the correct format for the partition.(in and most of the cases...it is the EXT4 format.go ahead and reboot your device.this should probably work.If not...try other formats also from bottom to to. (HINT:-see what other partitions are formatted to).This should probably work if thats the case.
worked for me .thanks alot
It works!
6mon said:
For the posterity :
in TWRP go to advanced > terminal, then create /cache/recovery with
mkdir /cache/recovery
solved the problem for me
Source : https://android.stackexchange.com/q...ineage-16-samsung-galaxy-note-2-gt-n7100-t03g
Click to expand...
Click to collapse
Thank you so much! Before doing this, my Lenovo Vibe K5 Plus (A6020) wasn't able to install any ROM, but it's over! Now I can install custom ROMs with no flaws :good:
Worked for me as well and much easier than editing the update script. Thanks a lot!
If youre still getting error 7 e1001 then try this.
Boot twrp
Tap advanced tab
Tap file manager/explorer
Tap on /system
Tap + icon on the folder in bottom right corner to modify
Tap chmod 755 to enable r/w for system part.
Try to install again.
That is what worked for me
6mon said:
For the posterity :
in TWRP go to advanced > terminal, then create /cache/recovery with
mkdir /cache/recovery
solved the problem for me
Source : https://android.stackexchange.com/q...ineage-16-samsung-galaxy-note-2-gt-n7100-t03g
Click to expand...
Click to collapse
did the trick for me. Whoever has Error 7 / Error 1001 issues, try this first cant hurt!
6mon said:
For the posterity :
in TWRP go to advanced > terminal, then create /cache/recovery with
mkdir /cache/recovery
solved the problem for me
Source : https://android.stackexchange.com/q...ineage-16-samsung-galaxy-note-2-gt-n7100-t03g
Click to expand...
Click to collapse
Posterity works!!! I found your post by googling and it solved my issue, thanks again!
I have the same issue on S4 mini, but /cache/recovery/ dir is present.
Hello
I am having this issue installing /e/ os on samsung J5 J500F.
I tried making directory /cache/recovery and addind read and write rights to /system but it did not work.
I also tried different version of the os and build as well as different version of TWRP.
I tried removing the assert line in the updater script but the zip file generated then in refused by twrp, It gets me the error "invalid zip file format".
I tried making the zip file with winrar or 7zip using either relatie paths or absolute path, but i still get the same error.
Would someone have an idea ?
Thanks !
Sometimes it is caused due to corrupted file. While transferring file through MTP it is likely to corrupt large files. I had the same problem. Then I tried copying file while in TWRP (sure it is also MTP) and it worked.
HatMan22 said:
Sometimes it is caused due to corrupted file. While transferring file through MTP it is likely to corrupt large files. I had the same problem. Then I tried copying file while in TWRP (sure it is also MTP) and it worked.
Click to expand...
Click to collapse
Hello, thank you very much for your advice, I copied all files through TWRP, so it is probably coming from something else.
I tried downloading the file and and also flashing some other builds or different versions but I still get "failed to update system image error"
Gabriel-Roger said:
Hello, thank you very much for your advice, I copied all files through TWRP, so it is probably coming from something else.
I tried downloading the file and and also flashing some other builds or different versions but I still get "failed to update system image error"
Click to expand...
Click to collapse
Do you have latest TWRP installed? Old TWRP may also cause this issue.