maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Jolla1 & TOH (https://talk.maemo.org/forumdisplay.php?f=56)
-   -   [HOWTO] Comprehensive Firmware Flashing Guide for Jolla (https://talk.maemo.org/showthread.php?t=91885)

Raim 2014-01-05 15:44

Re: [HOWTO] Comprehensive Firmware Flashing Guide for Jolla
 
Quote:

Originally Posted by javispedro (Post 1399535)
The stock kernel image, cmdline and initramfs are stored in /boot/boot.img (this is in mkbootimg format). There are several (Android) programs around to "unmkbootimg" this and get the raw kernel images et all.

I dared to unlock my bootloader again by restoring my saved mmcblk0p17. To verify that it works, I tried to boot the unmodified /boot/boot.img image by copying it over to my computer and then issue a fastboot sequence. However, that does not seem to work for me. The phone resets and I see the charging screen only.

However, the boot-telnet-initrd.img provided by djselbeck works fine.

What is going on here? Isn't the original image supposed to work over fastboot?

Raim 2014-01-05 15:53

Re: [HOWTO] Comprehensive Firmware Flashing Guide for Jolla
 
Quote:

Originally Posted by Raim (Post 1404014)
The phone resets and I see the charging screen only.

And right after I posted this I found out that it actually did work – I just wasn't aware of it. :-)

When the charging screen comes up, I need to press the power button long enough once to actually boot up the system.

nieldk 2014-01-06 19:35

Re: [HOWTO] Comprehensive Firmware Flashing Guide for Jolla
 
Though having an overview of the partition layout on Jolla device will help. So, I compiled parted for Sailfish (it is on my openrepos)

Code:

┌(nemo@localhost)─(✗)─(08:31 PMMon Jan 06)
└─(/)─(46 files, 164Kb)─> sudo parted
GNU Parted 3.1
Using /dev/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                               
Model: MMC MAG2GC (sd/mmc)
Disk /dev/mmcblk0: 15.6GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start  End    Size    File system    Name        Flags
 1      17.4kB  4194kB  4177kB                  emgdload
 2      33.6MB  67.1MB  33.6MB                  QOTP
 3      67.1MB  71.3MB  4194kB                  Qfa
 4      71.3MB  75.5MB  4194kB                  Qcfg
 5      75.5MB  79.7MB  4194kB                  Qdlog
 6      79.7MB  81.8MB  2097kB                  Qvariables
 7      81.8MB  83.9MB  2097kB                  Qlogfilter
 8      101MB  105MB  4194kB                  fsg
 9      134MB  185MB  50.3MB  ext4            Qglog
10      185MB  189MB  4194kB                  modemst1
11      189MB  193MB  4194kB                  modemst2
12      193MB  195MB  2097kB                  sbl1
13      195MB  197MB  2097kB                  sbl2
14      197MB  199MB  2097kB                  sbl3
15      199MB  201MB  2097kB                  tz
16      201MB  203MB  2097kB                  rpm
17      203MB  206MB  2097kB                  aboot
18      206MB  273MB  67.1MB  fat16          modem
19      273MB  281MB  8389kB  ext4            drm
20      281MB  294MB  12.6MB                  boot
21      294MB  306MB  12.6MB                  recovery
22      306MB  315MB  8389kB                  pad1
23      315MB  323MB  8389kB                  misc
24      323MB  856MB  533MB  linux-swap(v1)  swap
25      856MB  864MB  8389kB  ext4            persist
26      864MB  864MB  8192B                  ssd
27      864MB  872MB  8389kB                  security
28      872MB  15.6GB  14.8GB                  sailfish

(parted)


joerg_rw 2014-01-06 19:54

Re: [HOWTO] Comprehensive Firmware Flashing Guide for Jolla
 
scary:
* lots of gibberish
* "drm"
* "security"
* why does this need to get done by a community member (kudos nieldk!)? Basically doing RE. Shouldn't such elementary fundamental stuff - including proper comments on purpose of each partition - be in the "Jolla 101" wikipage published by Jolla even before 1st device shipped? Dang, where's that URL to this wikipage? I seem to have lost it...¡

juiceme 2014-01-06 20:07

Re: [HOWTO] Comprehensive Firmware Flashing Guide for Jolla
 
Quote:

Originally Posted by joerg_rw (Post 1404350)
scary:
* lots of gibberish
* "drm"
* "security"
* why does this need to get done by a community member (kudos nieldk!)? Basically doing RE. Shouldn't such elementary fundamental stuff - including proper comments on purpose of each partition - be in the "Jolla 101" wikipage published by Jolla even before 1st device shipped? Dang, where's that URL to this wikipage? I seem to have lost it...¡

That crap is due to the Qualcomm chipset. The thing is built so that it needs all that hooba to boot up & work. Sad really :(

nieldk 2014-01-06 20:14

Re: [HOWTO] Comprehensive Firmware Flashing Guide for Jolla
 
My next try :
Like, I believe Joerg_rw also found, is the 'secret mode' when pressing vol-up on power-on.
I believe this may be an entrance to a quick-recovery.

What I want to try (once I get around to buying a 16G SDcard)
This requires an unlocked bootloader.

insert 16Gb SD card
fastboot -i 0x2931 boot boot-telnet-initrd.img
telnet 192.168.42.17
dd if=/dev/mmcblk0 of=/dev/mmcblk1

power off
power-on - holding vol-up

And see if this will start a flash from SD card, now containing a proper partition layout, like the device.
Possibly, if it work, it is also doable to just create the partition layout on the SD card, and dd mmcblk0p17 to mmcblk1p17

juiceme 2014-01-06 20:21

Re: [HOWTO] Comprehensive Firmware Flashing Guide for Jolla
 
What I was thinking the other day was a bit of similar thing that you have in mind;

I suppose it's possible to create a recovery kernel that actually swaps the mmcblk0 and mmcblk1 devices in the device so that if you have a copy of the filesystem on your external SD card you caould run the device fully on that.

Raim 2014-01-06 20:29

Re: [HOWTO] Comprehensive Firmware Flashing Guide for Jolla
 
I took an image of the entire /dev/mmcblk0 from the "fastboot rescue mode". This way I can view the partition layout with parted or gdisk on my computer without risking any damage by accidental modifications.

Not sure if there is anything useful in this, at least some of these have names that may reveal their function. I guess all those "Q*" partitions are something internal from Qualcomm and probably uninteresting. The bootloader chain would be "rpm" -> "sbl1" -> "sbl2" -> "sbl3" -> "aboot" according to some sources on other Qualcomm-based Android phones that turned up on a quick web search (sbl = secondary bootloader).

"persist" is mounted on /persist and appears to contain WLAN driver configuration, including MAC addresses. "drm" is mounted on /drm and it's currently empty despite the standard lost+found directory. No idea about "security" and some of the others, though.

I don't think these partitions are scary, this is just the way it is set up by Qualcomm as vendor. In defense of Jolla, what would be the purpose of documenting this publicly? I would even expect that the documentation provided by Qualcomm is under a NDA…

Raim 2014-01-06 20:43

Re: [HOWTO] Comprehensive Firmware Flashing Guide for Jolla
 
Quote:

Originally Posted by juiceme (Post 1404358)
I suppose it's possible to create a recovery kernel that actually swaps the mmcblk0 and mmcblk1 devices in the device so that if you have a copy of the filesystem on your external SD card you caould run the device fully on that.

If you want to experiment with a different OS, you could just boot from fastboot with "root=/dev/mmcblk1pX" as kernel argument and run from the SD card.

For a clone of the "sailfish" partition, it would probably be a good idea to change the partition UUID to something different and change /etc/fstab accordingly to avoid mounting home or swap from the internal storage. Probably needs some more changes in /lib/systemd/system/*.mount for things like /firmware or /var/systemlog.

shmerl 2014-01-07 07:18

Re: [HOWTO] Comprehensive Firmware Flashing Guide for Jolla
 
That list of partitions aren't necessarily all used (like drm and etc.), but are probably required for Qualcomm SoCs. Pretty weird layout if you ask me. Jolla should document that stuff in some hardware docs section. That would be community friendly. Unless Qualcomm forbids them to do it. No idea.


All times are GMT. The time now is 15:00.

vBulletin® Version 3.8.8