[Replicant] the minimal effort needed for a minimal change in initramfs?

Denis 'GNUtoo' Carikli GNUtoo at no-log.org
Mon Oct 26 22:52:28 UTC 2015


On Sat, 24 Oct 2015 19:24:57 +0200
user468362 at 0w.se wrote:

> Hello,
Hi,

> I did my best to find a relevant information but to no avail,
> hope somebody here has the knowledge to answer the following.
> 
> Is there a way to tweak the contents of the initramfs without
> literally rebuilding everything?
If you just want to add some files that either don't need to be
compiled, or that are already compiled, it's possible, yes.

> Is there any easier way? None of the many descriptions and
> "repack"-tools which I could locate on the net correspond to the
> structure of boot.img.
The FSO/SHR and Replicant/Paul Kocialkowski projects ported some Android
specific tools to GNU/Linux, such as:
* ADB
* fastboot
* mkbootimg
In that same repository, someone also wrote an unpacking tool:
* unbootimg

This repository was here: git://git.freesmartphone.org/utilities.git
I'm not sure if the address is still valid or up to date, it could have
been kept with the development happening elsewhere.
android/image-utils is what you are looking for.
android/adb might also be interesting.

HOWTO:
------
I took the galaxy S3 here:
> $ unbootimg -i boot.img 
> total image size:   4554752
> kernel size:        4149320
> kernel load addr:   0x40008000
> ramdisk size:       399660
> ramdisk load addr:  0x41000000
> 2nd boot size:      0
> 2nd boot load addr: 0x40f00000
> kernel tags addr:   0x40000100
> page size:          2048
> board:              `'
> cmdline:            `console=ttySAC2,115200'
> id:                 158f22fb8f8702be37a59fa5b3c3743c80a4b80000
Here you should write down the following parameters values to compare
it with the repacked image:
-> kernel load addr, it probably has to match
-> ramdisk load addr, it probably has to match
-> I'm not sure what "2nd boot load addr" is for, the recovery?
-> kernel tags addr, probably "atags"? not sure if it has to match.
-> page size, it has to match.
-> cmdline, if you intend to modify it, start by testing with the
   previously working one.

To help:
-> To compile the linux kenrel, you only need a simple ARM toolchain,
   it doesn't even need to be libc-enabled(like glibc).
-> If you build the kernel, you could add ttyprintk if it's not already
   there, combined with ramconsole, that could help you debug your
   initramfs userspace issues.
   That way you can print inside the kernel dmesg trough ttyprintk, and
   at next reboot you can get the previous dmesg trough ramconsole.

Else serial is more convenient for debugging, but then you need to build
the serial cable.

Denis.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osuosl.org/pipermail/replicant/attachments/20151026/2785026e/attachment.asc>


More information about the Replicant mailing list