[Q] Unpacking otter2 CyanogenMod initramfs

spudowiar

Senior Member
Dec 7, 2013
132
142
0
spudowiar.me
I'm trying a project on a Kindle Fire that I cannot afford to brick. To make it work I need to extract the initramfs. It seems that the format of the boot.img of custom ROMs for the device is not the same as mkbootimg images (and the stock image) :confused: It says
Code:
File boot.img not a plain boot image, seeking for embedded image ... not found.
with the CyanogenMod image but with the stock boot.img it works.. How can I get the initramfs from the boot.img?
 

stunts513

Senior Member
Feb 8, 2013
2,238
635
0
New Braunfels, TX
You have to kill the non standard header with "dd if=boot.img of=boot2.img skip=1024” then run it on the boot2.img, I think that was the right skip count for the cm version, though this is pointless because if you recompile it then it is not going to work when you flash it, it will probably kick into fastboot or recovery with the kernel like that.

Sent from my Amazon Kindle Fire HD using Tapatalk
 

spudowiar

Senior Member
Dec 7, 2013
132
142
0
spudowiar.me
You have to kill the non standard header with "dd if=boot.img of=boot2.img skip=1024” then run it on the boot2.img, I think that was the right skip count for the cm version, though this is pointless because if you recompile it then it is not going to work when you flash it, it will probably kick into fastboot or recovery with the kernel like that.

Sent from my Amazon Kindle Fire HD using Tapatalk
Thanks, will try it once back in Linux.

It is not pointless because I need to get the initramfs. I want to try something: I'm gonna boot CM without flashing! (or fail badly :()
 

spudowiar

Senior Member
Dec 7, 2013
132
142
0
spudowiar.me
chroot

How do you boot cm without flashing it? Otg?

Sent from my Amazon Kindle Fire HD using Tapatalk
It worked on my Debian system with Android-x86:
Code:
chroot /android /init
Basically I extract the initramfs ;), build the system folder (by reading the updater-script manually - done) and mount the initramfs in /android, the system in /android/system, the data in /android/data, the cache in /android/cache, start the chroot...

CM!!!
 

stunts513

Senior Member
Feb 8, 2013
2,238
635
0
New Braunfels, TX
Interesting, is this like kexec? Or more like a ROM slot?or simply a virtual environment? Sorry for all the questions but this has peaked my curiosity a bit.

Sent from my Amazon Kindle Fire HD using Tapatalk
 

spudowiar

Senior Member
Dec 7, 2013
132
142
0
spudowiar.me
chroot

Interesting, is this like kexec? Or more like a ROM slot?or simply a virtual environment? Sorry for all the questions but this has peaked my curiosity a bit.

Sent from my Amazon Kindle Fire HD using Tapatalk
No, keep on being curious! :D

Basically a chroot (change root) is a way of making a process think that the root location is different. When you boot Android your initramfs is in /. We want a new one in /android but Android wants it to be /. We use a chroot so it thinks /android is /. Then init is happy and runs! kexec would require flashing a kernel and it is native and not a VM. What is a ROM slot?

Anyway, here is another example of a chroot (using VNC rather than native display and for desktop ARM Linux)
http://androlinux.com/

Remember, chroot is:
  • Native and fast
  • Just a way of tricking userspace programs

It is not:
  • Virtualization
  • A way of executing kernels
 

spudowiar

Senior Member
Dec 7, 2013
132
142
0
spudowiar.me
By the way, sorry for the delays - am working on a private project ;)

Anyway, if I get somewhere I will start up a DevDB project. When I tried with the Amazon OS initramfs it just crashed - as expected. But now we should have CM initramfs...

This should hopefully ease people into the world of Cyanogen. I could write an app to safely install CM (chroot method) and when they are happy, it can flash it over (and keep their data).
 

stunts513

Senior Member
Feb 8, 2013
2,238
635
0
New Braunfels, TX
OK I knew what chroot did but I didn't think of using it in that context before. That's pretty cool. Only times I ever really have to use chroot is when I mess up my grub config and have to chroot among other things into my own partition to update-grub. Also interesting that kexec involves kernel flashing, I thought it was just a kernel module that was loaded up from the modules folder(or whatever it was named I'm half asleep right now).

Sent from my Amazon Kindle Fire HD using Tapatalk
 

spudowiar

Senior Member
Dec 7, 2013
132
142
0
spudowiar.me
OK I knew what chroot did but I didn't think of using it in that context before. That's pretty cool. Only times I ever really have to use chroot is when I mess up my grub config and have to chroot among other things into my own partition to update-grub. Also interesting that kexec involves kernel flashing, I thought it was just a kernel module that was loaded up from the modules folder(or whatever it was named I'm half asleep right now).

Sent from my Amazon Kindle Fire HD using Tapatalk
It needs kernel flashing because the kernel isn't set up for modules :(

This will mean that CM modules won't work either when in chroot (same kernel)

Anyway, I'm "new" and must wait 5 minutes between each post :crying:
 

spudowiar

Senior Member
Dec 7, 2013
132
142
0
spudowiar.me
You have to kill the non standard header with "dd if=boot.img of=boot2.img skip=1024” then run it on the boot2.img, I think that was the right skip count for the cm version, though this is pointless because if you recompile it then it is not going to work when you flash it, it will probably kick into fastboot or recovery with the kernel like that.

Sent from my Amazon Kindle Fire HD using Tapatalk
Not the right skip :(
Code:
%Premature end-of-file saving zImage.
 

spudowiar

Senior Member
Dec 7, 2013
132
142
0
spudowiar.me
It doesn't go black, it actually turns off!
I give up for now

Code:
<4>[ 1171.575317] Welcome
<6>[ 1188.026672] request_suspend_state: wakeup (3->0) at 1188017547609 (2014-04-10 13:32:06.608901123 UTC)
<6>[ 1188.073394] ***************************************************
<6>[ 1188.073394] ******************  Panel of LG  ******************
<6>[ 1188.073425] ***************************************************
<6>[ 1188.077606] bq27541 1-0055: Screen off drainage: -3 % over 813945 msecs
<6>[ 1188.077606] DSSCOMP: dsscomp_late_resume
<4>[ 1188.126373] ilitek_i2c_late_resume
<3>[ 1188.242858] omap_timer omap_timer.10: omap2_dm_timer_set_src: clk_set_parent() to sys_ck FAILED
<3>[ 1191.694305] init: untracked pid 357 exited
<3>[ 1191.694366] init: untracked pid 372 exited
<3>[ 1191.694427] init: untracked pid 418 exited
<3>[ 1191.695648] init: untracked pid 527 exited
<3>[ 1191.696563] init: untracked pid 1837 exited
<3>[ 1191.701385] init: untracked pid 347 exited
<3>[ 1191.718139] init: untracked pid 881 exited
<3>[ 1191.724578] init: untracked pid 267 exited
<3>[ 1191.727783] init: untracked pid 335 exited
<3>[ 1191.728210] init: untracked pid 182 exited
<3>[ 1191.730285] init: untracked pid 256 exited
<3>[ 1191.734802] init: untracked pid 808 exited
<3>[ 1191.737548] init: untracked pid 281 exited
<3>[ 1191.740173] init: untracked pid 795 exited
<3>[ 1191.742828] init: untracked pid 322 exited
<3>[ 1191.750823] init: untracked pid 697 exited
<3>[ 1191.757995] init: untracked pid 391 exited
<3>[ 1191.758056] init: untracked pid 473 exited
<3>[ 1191.764221] init: untracked pid 447 exited
<3>[ 1191.764923] init: untracked pid 432 exited
<3>[ 1191.770507] init: untracked pid 577 exited
<3>[ 1191.774261] init: untracked pid 1698 exited
<3>[ 1191.777740] init: untracked pid 460 exited
<3>[ 1191.781341] init: untracked pid 1595 exited
<3>[ 1191.784088] init: untracked pid 588 exited
<3>[ 1191.785797] init: untracked pid 1488 exited
<3>[ 1191.791168] init: untracked pid 674 exited
<3>[ 1191.794555] init: untracked pid 754 exited
<3>[ 1191.797088] init: untracked pid 1310 exited
<3>[ 1191.803131] init: untracked pid 833 exited
<3>[ 1191.809692] init: untracked pid 979 exited
<3>[ 1191.823486] init: untracked pid 1095 exited
<3>[ 1191.825775] init: untracked pid 1251 exited
<3>[ 1191.828369] init: untracked pid 1638 exited
<3>[ 1191.832824] init: untracked pid 2090 exited
<3>[ 1191.836303] init: untracked pid 2114 exited
<3>[ 1191.839080] init: untracked pid 1921 exited
<3>[ 1191.842285] init: untracked pid 1820 exited
<3>[ 1191.849182] init: untracked pid 1651 exited
<3>[ 1191.853942] init: untracked pid 1749 exited
<3>[ 1191.854492] init: untracked pid 2056 exited
<3>[ 1191.857666] init: untracked pid 2402 exited
<3>[ 1191.861816] init: untracked pid 2492 exited
<3>[ 1191.864776] init: untracked pid 1792 exited
<6>[ 1194.908813] mtp_release
<6>[ 1195.877410] alarm_release: clear alarm, pending 0
<6>[ 1195.877441] alarm_release: clear alarm, pending 0
<6>[ 1195.877441] alarm_release: clear alarm, pending 0
<6>[ 1195.877441] alarm_release: clear alarm, pending 0
<3>[ 1232.477325] init: could not import file '/init.omap4blazeboard.rc' from '/init.rc'
<3>[ 1232.477752] init: could not import file '/init.carrier.rc' from '/init.rc'
<3>[ 1232.479125] init: do_chown: Could not access /selinux/booleans
<3>[ 1232.479187] init: do_chown: Could not access /sys/fs/selinux/booleans
<3>[ 1232.611175] init: cannot open '/initlogo.rle'
<3>[ 1232.631896] init: cannot find '/system/bin/auditd', disabling 'auditd'
<3>[ 1232.632446] init: cannot find '/system/bin/rild', disabling 'ril-daemon'
<6>[ 1232.635894] adb_release
<6>[ 1232.636199] adb_open
<6>[ 1232.647277] adb_release
<6>[ 1232.647460] adb_open
<3>[ 1232.650787] init: untracked pid 2624 exited
<3>[ 1232.697387] init: untracked pid 2637 exited
<3>[ 1233.638092] init: untracked pid 1972 exited
<3>[ 1237.851593] init: untracked pid 2643 exited
<3>[ 1237.854003] init: untracked pid 2996 exited
<3>[ 1237.868988] init: untracked pid 3000 exited
<3>[ 1242.880950] init: untracked pid 3005 exited
<3>[ 1242.885925] init: untracked pid 3014 exited
<3>[ 1244.220550] init: untracked pid 3017 exited
<3>[ 1244.236663] init: untracked pid 2999 exited
<3>[ 1244.236907] init: untracked pid 2622 exited
<3>[ 1244.244384] init: untracked pid 3018 exited
<6>[ 1244.244659] request_suspend_state: wakeup (0->0) at 1244235565188 (2014-04-10 13:33:02.826918702 UTC)
<3>[ 1244.246551] init: untracked pid 2619 exited
<3>[ 1244.251922] init: untracked pid 2636 exited
<3>[ 1247.270416] init: untracked pid 3378 exited
<6>[ 1247.806610] request_suspend_state: wakeup (0->0) at 1247797515872 (2014-04-10 13:33:06.388869386 UTC)
<3>[ 1247.808471] init: untracked pid 3044 exited
<3>[ 1247.822265] init: untracked pid 3374 exited
<3>[ 1247.837799] init: untracked pid 3377 exited
<3>[ 1252.850189] init: critical process 'servicemanager' exited 4 times in 4 minutes; rebooting into recovery mode
<6>[ 1252.900482] SysRq : Emergency Remount R/O
 
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone