View Single Post
Community Council | Posts: 4,920 | Thanked: 12,867 times | Joined on May 2012 @ Southerrn Finland
#42
(This turned out to be rather a long rant, but please bear with me, there are some important observations embedded in this posting...)

I have had some advances and some backsteps now when I am trying to create a kexec based boot loader.

For some time I tried to implement it so that the first-stage kernel would be the normal Harmattan/Nitdroid kernel, and the optional Nemo stage would be loaded with kexec on selection.
As kexec is not enabled in the PR1.3 Nitdroid image, I wnted to get the sources for that to build it myself. Only answer I got from e-yes was that kexec is broken and cannot be made to work on the kernel (and I got no source to try it myself )

Well, as obviously kexec works with MOSLO kernel I decided to try it with the standard PR1.3 kernel (kernel_2.6.32-20121301+0m8.tar)
myself and see if it works.
At least with this e-yes was correct, I did not manage to get kexec to boot another image reliably. I did not furter debug it but one option still would be to fix that and continue with the original idea.

Oh, and I found out something I did not know before, fyi;
When I tried booting into a freshly compiled kernel image, I thought, why bother flashing it, I will just load it up with flasher to see if it works correctly.
Turns out Harmattan will not boot up correctly if it has not been booted from actual flash chip. I wasted days on debugging this, every time I booted, the device would rise correctly to preinit phase, and then *BOOM*
Only when I checked logs for nth time I got a hunch this has something to do with kernel boot parameters.
When booting external kernel, there is an item "bootreason=usb", and when booting from chip it is "bootreason=pwr_key"

Nitdroid does not care about this, it will boot to ICS whichever way but Harmattan throws up and plays DEAD if the reason is usb.

OK, I have now confirmed this by managing to boot correctly to Harmattan from MOSLO kernel via kexec when I replaced the bootreason tag on kernel command line. You live, You learn.

So, now as I have method to boot Harmattan from MOSLO, I decided to do it the correct way: Create a first-stage boot from modified MOSLO booter, which will then kexec either Harmattan/Nitdroid or Nemo, based on selection.

But how to get the first stage to boot so that root device is ubi0:var ?
What I have learned is that when the system boots, whatever the boot reason, usb/flash, the kernel command line is always set so that the first items are "init=/sbin/preinit root=/dev/mmcblk0p2"
I have found no way of easily changing that to something like "init=/init root=/dev/ubi0:var", for example.
I have not tried to recompile kernel to force it to ignore that part yet.
However, what mystifies me is how is it possible that when I load up the MOSLO kernel & initramfs, then what happens is the kernel mounts the initramfs as root and executes /init from there, even as the commandline still reads "init=/sbin/preinit root=/dev/mmcblk0p2" ??

So, I wanted to try to flash the MOSLO kernel permanently to the device, but it seems that it is impossible to flash the initramfs part.
I tried several ways to flash it:

sudo flasher -a firmware.bin -k zImage-moslo -n initrd-moslo.new --flash-only=kernel,initfs -f -R
sudo flasher -a firmware.bin -k zImage-moslo -n initrd-moslo.new --flash-only=initfs -f -R

but no way, it seems that only the kernel got flashed, it is impossible to flash initramfs on the device. (maybe there is no place it could be flashed to...?)

My experiments continue, though.
 

The Following 3 Users Say Thank You to juiceme For This Useful Post: