diff options
author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2021-09-27 17:13:13 +0200 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2021-09-27 17:13:38 +0200 |
commit | 41141d9d39d3aaeea6e97f21608f0323ce792494 (patch) | |
tree | a6fd7e0815c71005ccb6549ed3e4dc1e4a37c2c3 /core/install_jni_libs.mk | |
parent | 6b520e17e5ee4f4663e7fa452af7a6808e3858df (diff) | |
download | build_make-41141d9d39d3aaeea6e97f21608f0323ce792494.tar.gz build_make-41141d9d39d3aaeea6e97f21608f0323ce792494.tar.bz2 build_make-41141d9d39d3aaeea6e97f21608f0323ce792494.zip |
Build separate recovery kernel image
Even if we use the highest compression ratio support for the
recovery and the kernel image as on the Galaxy SIII (GT-I9300)
and Galaxy SIII 4G (GT-I9305), the recovery partition is 8MiB
and without removing options that are not used in the recovery
(like the WiFi, netfilter, etc) we still don't fit in the 8MiB.
With a specific defconfig we however can manage to make it fit
but we don't have a lot of margin as we get the following
warning while building Replicant images:
WARNING: +out/target/product/i9300/recovery.img
approaching size limit (8370176 now; limit 8388608)
Having the smallest kenrel image and initramfs image in
the recovery bootimage has been chosen here as we cannot
simply fit a recovery initramfs in the RECOVERY
partition without any kernel because even if Android 11
supports that, if have a bootimage without any kernel or
bootloader code instead, rebooting to recovery or booting
to recovery does result in the device booting directly to
the dowload mode and we have a screen with the following:
[Android logo]
Downloading....
Do not rurn off target !!
and then there is no other way to make the device boot to
the BOOT partition other than flashing code (like a
recovery) to the RECOVERY partition in order to make it
reboot to the normal BOOT partition.
And here, even 'heimdall close-pc-screen' doesn't change
the boot mode.
While writing some code code reboot the device to the BOOT
partition is trivial to do[1], the result is not totally
transparent as pressing the power up, menu and power button
don't result in the device booting to the RECOVERY.
In addition it would probably complexify a lot the
installation instructions because, when the recovery
initramfs is on a separate partition, the kenrel still
depends on the init daemon that is inside the SYSTEM
partition to be able to boot the recovery.
And Installing big images (like system.img) with heimdall
is not very reliable on the Exynos devices that are
supported by Replicant.
So we are left with two possibilities: we can either:
- Write a tiny bootloader that would be installed in
the RECOVERY bootimage instead of the kernel, and that
would retrieve the kernel from the BOOT bootimage, and
boot the kernel with the recovery initramfs.
- Shrink as much as possible the kernel image used for the
recovery and the recovery initramfs.
Doing the former would require to write code to retrieve
data from eMMC partitions (and probably support all eMMC
standards as we don't have a list of possible eMMCs and
that some could come from reparations having been made),
parse the bootimages, and write code to retrieve the boot
arguments, because we can't tell the kernel to load a
recovery image from a partition as the kernel doesn't
have support for that yet. As we also need a bootimage
in the RECOVERY partition, we would also probably need
tricks to add a compressed squashfs that would be treated
as block device.
If we manage to do that we would still need to modify a
bit the installation instructions, and this would break
the many unofficial tutorials (often in local languages)
that are not made by Replicant.
As for the later it might increase too much the maintenance
work if the kernel keeps growing and that we spend lot of
time tuning the defconfig to make it fit, but for now
shrinking the kernel and initramfs works, so we could write
or adapt a bootloader later if the maintenance of the
recovery defconfig turns out to takes too much time.
[1]https://git.replicant.us/contrib/GNUtoo/tools/s-boot_usb_exploit/tree/shellcode/reboot.c
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Diffstat (limited to 'core/install_jni_libs.mk')
0 files changed, 0 insertions, 0 deletions