Lowlevel Architecture of Sailfish OS
So I got my tablet by now, but as I have quite some experience with the more lowlevel stuff (everything from kernel to userland) I wondered if I could setup my own system and install the required stuff myself and on top of that, add Sailfish OS.
I am quite used to the command line as one would guess so I'm already familiar with some Sailfish OS/Mer specific things (at least after I fixed my phone last year, after breaking it myself; hint: installing openrc on the phone is a bad idea) and used the recovery mode a few times by now.
Something I did not understand yet is, where is the recovery located?
I mean, usually you have the BIOS loading your bootloader, loading your kernel, mounting your root, running /sbin/init
, starting services (e.g. GUI).
So where in this chain would the recovery mode be?
And when I accidentally ran rm -rf /
(didn't do that), would I still be able to access recovery mode?
Furthermore, on my tablet I have partitions 1-15, the first one and the last five I think are being used, somewhere the factory reset image resides, one of them seems to be LVM (having home and sailfishos (root)) and some other stuff.
What are all of these partitions for? Is there any documentation for that?
If I manage to actually install a working system onto the tablet, which is not Mer, would I be able to compile ssu
and similar tools myself and pull the packages in question (silica, store, android runtime, ….) onto the device again?
As @MartinK commented, there is one partition containing the images for the root and home LV's and that these are most probably used to restore the partitions in case of a factory reset.
Now the question is only what invokes the recovery? If it is, as suggested, the initrd/kernel, where are these?
The rootfs' boot contains the following files:
- droidboot.img
- efilinux-user.efi
- esp.img
- hybris-boot.img
- hybris-recovery.img
- partition.tbl
I tried to edit /sbin/init
.
Turns out it isn't even used (goddamnit, who did that?!).
Also here some more information:
/proc/1/cmdline
: /lib/systemd/systemd --unit=default.target
/proc/cmdline
: loglevel=0 no_console_suspend=1 androidboot.bootmedia=sdcard androidboot.hardware=anzhen4_mrd8_w watchdog.watchdog_thresh=60 androidboot.spid=0000:0000:0000:0007:0000:0007 androidboot.serialno=Baytrail7AE04761 oops=panic panic=40 vmalloc=172M slub_max_order=2 vga=current i915.modeset=1 drm.vblankoffdelay=1 acpi_backlight=vendor zram.num_devices=4 reset=os_initialted wakeup=no_applicable powerdown=no_applicable androidboot.mode=main
I just found out that you actually can access the BIOS using F2 when an OTG keyboard is attached, this will make 'research' a lot easier.
Edit: The Installation
Formatting
So, I did it the easy way:
- Recovery Mode
- resize LVs (delete home, resize root)
- format root (ext4)
Installation
- extract Gentoo tarball
- follow handbook (skip kernel stuff)
- copy over old kernel modules
- create file
/lib/systemd/systemd
- contains shebang
- contains
exec /sbin/init
Problems
Not Booting
The tablet does not boot under any circumstances.
Well, it tried but fails and falls back to Recovery.
Kernel Modules
When in Recovery I tried to load the wifi module:
insmod /lib/modules/3.10.20/cfg80211.ko
I get
insmod: ERROR: could not insert module /lib/modules/3.10.20/cfg80211.ko: Required key not available
Which is related to module signing.
Conclusions
- Modules have to be, or at least are, signed.
/sbin/init
is unused and getting init to work is hard, when not setting up the kernel.
15? Seriously?
hoschi ( 2016-04-23 22:28:47 +0200 )edit@hoschi yep. That was exactly what I thought. Most of them aren't even mountable.
benaryorg ( 2016-04-23 23:04:07 +0200 )edit@hoschi The whole system is just a lot of crap that shouldn't be there. I mean, / should consist of ~ 10 folders and no files. Now look at their root. Full of .rc files I mean what the hell?!
That's why I want to install something different (Gentoo) onto the tablet.
benaryorg ( 2016-04-23 23:05:29 +0200 )editThat's probably some hardware adaptation fallout - the Jolla phone also has a boatload of partitions, apparently because of Qualcomm in that case.
MartinK ( 2016-04-24 14:54:33 +0200 )editI know about the Qualcomm stuff, but an Intel Atom.? Isn't that the same used in notebooks?
benaryorg ( 2016-04-24 14:57:17 +0200 )edit