oranav / i9300_emmc_toolbox

Samsung Galaxy S3 GT-I9300 eMMC toolbox
GNU General Public License v3.0
98 stars 17 forks source link

Towards a 100% libre bootloader for Exynos4412 based Galaxy S3 and Note II devices #16

Open herbsmn opened 5 years ago

herbsmn commented 5 years ago

Hello Galaxy S3 hackers,

The GT-I9300 eMMC toolbox is an excellent hack, but it likely would have never been needed had there been a way, years ago, to compile and flash a fully working bootloader to the eMMC that respects the four software freedoms. The fact is though, that wasn't an option previously, so the eMMC toolbox was very much needed and I very much appreciate @oranav providing us all with this great piece of code. As it turns out, some recent work by Samsung, LineageOS, and Replicant has turned the dream of a libre bootloader into a potential reality. You can read about some of this work here: https://blog.forkwhiletrue.me/posts/u-boot-on-galaxy-s3/ and here: https://blog.forkwhiletrue.me/posts/an-almost-fully-libre-galaxy-s3/

If you'd rather jump right into the code, @fourkbomb's downstream u-boot git repo can be found here: https://github.com/fourkbomb/u-boot

Samsung's recently upstreamed u-boot git repo for a dev board that is fairly similar to the S3 and N2 can be found here: https://gitlab.denx.de/u-boot/u-boot/blob/master/arch/arm/dts/exynos4412-trats2.dts

We have progressed to the point where we can boot u-boot with only one 8KB proprietary binary is left: https://github.com/fourkbomb/u-boot/blob/midas-2019.04/p4412_s_fwbl1.bin

One of the exciting things about this is that we can currently boot these devices without running the proprietary TrustZone blobs and can instead run Android without TrustZone or one of the free software TrustZone alternatives. Additionally, we can now run other GNU+Linux distributions with an upstreamed kernel on these devices with relative ease.

At Replicant, we have been researching how to replace this last remaining BL1 proprietary blob with libre code. Some of @GNUtoo's notes related to this are here: https://redmine.replicant.us/projects/replicant/wiki/Exynos4Bootrom

Within the last couple of weeks we found what looks to be a free software implimentation of the Exynos4412 BL1 code here: https://github.com/xboot/xboot/tree/master/src/arch/arm32/mach-exynos4412 We have yet to be able to get it to boot, but have opened a ticket and are talking with the author of the code here: https://github.com/xboot/xboot/issues/21

Much of the Exynos based S3 and N2 kernel is now in upstream, but this last proprietary bootloader blob is preventing us from being able to upstream all of our patches in u-boot and the kernel. Some of the issues and potential solutions are outlined here: https://redmine.replicant.us/projects/replicant/wiki/Upstream#PATCH-ARM-decompressor-Flush-tlb-before-swiching-domain-0-to-client-mode

If anyone is interested in joining us as we try to liberate this last remaining blob, please be in touch.