maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Alternatives (https://talk.maemo.org/forumdisplay.php?f=36)
-   -   [Announce] N9 Multiboot - Harmattan, Nemo & Nitdroid (https://talk.maemo.org/showthread.php?t=83189)

Hurrian 2012-12-04 12:35

Re: [Announce] N9 Multiboot - Harmattan, Nemo & Nitdroid
 
Quote:

Originally Posted by juiceme (Post 1301266)
Some thoughts;
  • Does the partition name have to be "var", or will something in the system break if I change it to something else entirely. Just a cosmetic thing but if it is to be holding boot related stuff rather than /var/ then it might be nice to call it something else... forex. "rescue"

Not necessarily, however for naming's sake (the partition name is set in the MTD partition table), let's make the UBIFS partition use "var" as the name.

(NOTE: ubi.mtd kernel parameter sets the mtd device to pass to ubiattach; it must always be "var". ubi0:$x (where $x is the UBIFS label) can be anything. However, again, for naming's sake, let's keep it names var.)

Quote:

Originally Posted by juiceme (Post 1301266)
  • I am still thinking about which is the best launching order for the rest of the system... whether to use Harmattan/Nitdroid kernel as the first stage boot and then kexec other images from that, or have own small subsytem like the MOSLO booter kernel+initramfs which then would kexec further images if needed.

The MOSLO booter is practically the same thing as a Harmattan-NITDroid kernel+utilites in /var.

OH, and this will not use an initramfs! It's not a ramdisk, the first kernel will boot into a barebones complete system on /var, then kexec into a new system!

It would make very little difference either way, as both first-stage kernels would have their own root filesystem (ubi0:var), and kexec a second-stage kernel (Harmattan PR1.3, NITDroid or Nemo) into their respective root filesystem.

Quote:

Originally Posted by juiceme (Post 1301266)
  • The mtd4 partition is indeed a nice place to set up stuff, I thought of maybe putting all the kernels and initramfs/initrd's there. It would be easy to load them up from there, each with tailored command line to set up the rest of the system.
    Having full debian environment there is also a nice idea, currently I use a loop-mounted HARM-CHOM image which is 2G of size but a lot smaller filesystem is OK

It could be mounted to /boot for convenience's sake.
A reference entry is already provided in /etc/fstab, however it is not mounted by default at boot.

You will need to call ubiattach and mount by yourself (or add the needed lines in /etc/init/mount-home.conf)

https://goput.it/j3i.png

juiceme 2012-12-13 09:53

Re: [Announce] N9 Multiboot - Harmattan, Nemo & Nitdroid
 
(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 :mad: )

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. :D

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.

juiceme 2013-01-01 18:35

Re: [Announce] N9 Multiboot - Harmattan, Nemo & Nitdroid
 
Holidays are a really good time for some serious hacking :D

Now I can announce that I have a working multiboot toolkit that can be used to load any suitable OS to N9 device using a graphical touch selection menus.

The work is based on patched Nemo kernel which is used to boot up a minimal system which will be used to select the next-level OS and load it up. With this system, we are no longer limited to tripleboot but indeed can create even quadboot and up :D

The patching is needed to override the default command line that NOLO forces on the booting kernel.

Happy new year to all TMO'ers :)

farfary 2013-01-01 19:28

Re: [Announce] N9 Multiboot - Harmattan, Nemo & Nitdroid
 
Quote:

Originally Posted by juiceme (Post 1309791)
Holidays are a really good time for some serious hacking :D

Now I can announce that I have a working multiboot toolkit that can be used to load any suitable OS to N9 device using a graphical touch selection menus.

The work is based on patched Nemo kernel which is used to boot up a minimal system which will be used to select the next-level OS and load it up. With this system, we are no longer limited to tripleboot but indeed can create even quadboot and up :D

The patching is needed to override the default command line that NOLO forces on the booting kernel.

Happy new year to all TMO'ers :)

WooW :D Very Thank Bro , Happy New Year too

Akkumaru 2013-01-01 19:35

Re: [Announce] N9 Multiboot - Harmattan, Nemo & Nitdroid
 
Hope whatever juiceme is up to will be released soon!

AMD 2013-01-01 19:36

Re: [Announce] N9 Multiboot - Harmattan, Nemo & Nitdroid
 
Quote:

Originally Posted by Akkumaru (Post 1309812)
Hope whatever juiceme is up to will be released soon!

This is such a great community ;)

Sazpaimon 2013-01-01 20:42

Re: [Announce] N9 Multiboot - Harmattan, Nemo & Nitdroid
 
Quote:

Originally Posted by juiceme (Post 1309791)
Holidays are a really good time for some serious hacking :D

Now I can announce that I have a working multiboot toolkit that can be used to load any suitable OS to N9 device using a graphical touch selection menus.

The work is based on patched Nemo kernel which is used to boot up a minimal system which will be used to select the next-level OS and load it up. With this system, we are no longer limited to tripleboot but indeed can create even quadboot and up :D

The patching is needed to override the default command line that NOLO forces on the booting kernel.

Happy new year to all TMO'ers :)

There have been some semi-successful efforts in the past from Android users on getting a Kexec module running. Theoretically, if we can compile this module for the Harmattan kernel, we could possiby boot any kernel with any arbitrary command line arguments from the default Harmattan kernel at the preinit stage. That way, no flashing would be required. I'll try looking into it.

juiceme 2013-01-01 22:31

Re: [Announce] N9 Multiboot - Harmattan, Nemo & Nitdroid
 
Quote:

Originally Posted by Sazpaimon (Post 1309830)
There have been some semi-successful efforts in the past from Android users on getting a Kexec module running. Theoretically, if we can compile this module for the Harmattan kernel, we could possiby boot any kernel with any arbitrary command line arguments from the default Harmattan kernel at the preinit stage. That way, no flashing would be required. I'll try looking into it.

That was my original idea, but it seems not to be easy to do. I experimented quite a lot with the vanilla Nokia kernel, both to use kexec as module and as compiled-in feature but the results were not very good. With the Nemo kernel it is lot easier.

With this method I am using, all you need is to flash the first stage kernel just once, and any of the second-stage kernels can be booted from a directory in the filesystem.

You can have multiple kernels running on the same filesystem, just by starting them with a different command line; for example I have both the nitdroid kernel (running the normal way of chrooting it to /home/nitdroid/) and an own flavour of openmode Nokia kernel, either one can be launched from a file on the FS.

Also, as the selection is done before booting the final kernel I can rearrange partittions as I like, mounting for example Nemo partition as root and launching the Nemo kernel.

Nothing would prevent me running Debian, for example using my Harm-Chom-install image, mounting it as root and starting a kernel of my desire on it. (I could do that, but there is no point really as of course it would not use the phone functionality)

Sazpaimon 2013-01-01 22:55

Re: [Announce] N9 Multiboot - Harmattan, Nemo & Nitdroid
 
Quote:

Originally Posted by juiceme (Post 1309857)
That was my original idea, but it seems not to be easy to do. I experimented quite a lot with the vanilla Nokia kernel, both to use kexec as module and as compiled-in feature but the results were not very good. With the Nemo kernel it is lot easier.

With this method I am using, all you need is to flash the first stage kernel just once, and any of the second-stage kernels can be booted from a directory in the filesystem.

You can have multiple kernels running on the same filesystem, just by starting them with a different command line; for example I have both the nitdroid kernel (running the normal way of chrooting it to /home/nitdroid/) and an own flavour of openmode Nokia kernel, either one can be launched from a file on the FS.

Also, as the selection is done before booting the final kernel I can rearrange partittions as I like, mounting for example Nemo partition as root and launching the Nemo kernel.

Nothing would prevent me running Debian, for example using my Harm-Chom-install image, mounting it as root and starting a kernel of my desire on it. (I could do that, but there is no point really as of course it would not use the phone functionality)

Out of curiosity have you looked into booting nemo via a chroot ala nitdroid? I briefly tried to get it to work that way, but at the time I was trying to make a single kernel that booted both Nitdroid and Nemo, but ran into some issues and lost interest. Your way of actually separating the kernels is a lot better, and I think not having to sacrifice a partition on the EMMC would be a better solution to running Nemo. You could basically add something like a real_root argument to the kernel command line, and the preinit script could take that and use it to determine where to chroot before running init.

Akkumaru 2013-01-02 04:18

Re: [Announce] N9 Multiboot - Harmattan, Nemo & Nitdroid
 
Quote:

Originally Posted by juiceme (Post 1309857)
That was my original idea, but it seems not to be easy to do. I experimented quite a lot with the vanilla Nokia kernel, both to use kexec as module and as compiled-in feature but the results were not very good. With the Nemo kernel it is lot easier.

By nemo kernel you mean the harmattan update kernel right? Isn't it still incomplete? I guess it should be complete for stability reasons and for 'new people' to use.


All times are GMT. The time now is 16:54.

vBulletin® Version 3.8.8