Jump to content

Samsung Exynos 4

From postmarketOS Wiki
Element logo Exynos 4 Mainlining Community on Matrix.
GitLab logo Exynos 4 Mainlining Group in GitLab.

The Exynos 4 family of chips consists of the Exynos 4210 released in 2011 as well as the Exynos 4412 released in 2012, alongside with its dual-core variant - the Exynos 4212. The Exynos 4415 was released two years later in 2014.

The Exynos 4210, 4212 and 4412 are relatively well supported in mainline, and share a fair bit of code. Support for the Exynos 4415, however, was dropped as there were no devices in mainline that used it. In postmarketOS, the mainline kernel is packaged as linux-postmarketos-exynos4.

Please join the matrix room for Exynos 4 related discussions: https://matrix.to/#/#exynos4xxx-mainline:matrix.org

Devices

Exynos 4210

Samsung Exynos 4210
Exynos 4210
Exynos 4210
Manufacturer Samsung
Name Exynos 4210
Architecture armv7
CPU 2x ARM Cortex A9 @ 1.4GHz
GPU ARM Mali-400MP4
Year 2011
Process 45nm
Mainline yes
Community Page
A link to a git{hub,lab} organisation/repo where development happens.
https://gitlab.com/exynos4-mainline
Components
CPU
SMP (bring up secondary CPU cores), CPU frequency scaling, CPUidle
Works
UART
Works
Storage
eMMC, SD cards, UFS, ...
Works
USB
Works
Display
Works
GPU
Works
Pinctrl
Works
I²C
Works
Audio
Untested
Video
Hardware-accelerated video de/encoding
Untested
Thermal
Works
Camera
Untested
Device Codename Category
Samsung Galaxy Note samsung-q1
Samsung Galaxy S II samsung-i9100 testing

Exynos 4212

Samsung Exynos 4212
Exynos 4212 on the board of the Samsung Galaxy Tab 3 8.0
Exynos 4212 on the board of the Samsung Galaxy Tab 3 8.0
Manufacturer Samsung
Name Exynos 4212
Architecture armv7
CPU 2x ARM Cortex A9 @ 1.4GHz
GPU ARM Mali-400 GPU
Year 2012
Process 32nm
Mainline yes
Community Page
A link to a git{hub,lab} organisation/repo where development happens.
https://gitlab.com/exynos4-mainline
Components
CPU
SMP (bring up secondary CPU cores), CPU frequency scaling, CPUidle
Works
UART
Works
Storage
eMMC, SD cards, UFS, ...
Works
USB
Works
Display
Works
GPU
Works
Pinctrl
Works
I²C
Works
Audio
Works
Video
Hardware-accelerated video de/encoding
Untested
Thermal
Works
Camera
Untested
Suspend
Works
Device Codename Category
Samsung Galaxy Tab 3 8.0 samsung-lt01 testing

Exynos 4412

Samsung Exynos 4412
Exynos 4412 from a development board
Exynos 4412 from a development board
Manufacturer Samsung
Name Exynos 4412
Architecture armv7
CPU 4x ARM Cortex A9 @ 1.4GHz
GPU ARM Mali-400 GPU
Year 2012
Process 32nm
Mainline yes
Community Page
A link to a git{hub,lab} organisation/repo where development happens.
https://gitlab.com/exynos4-mainline
Components
CPU
SMP (bring up secondary CPU cores), CPU frequency scaling, CPUidle
Works
UART
Works
Storage
eMMC, SD cards, UFS, ...
Works
USB
Works
Display
Works
GPU
Works
Pinctrl
Works
I²C
Works
Audio
Works
Video
Hardware-accelerated video de/encoding
Untested
Thermal
Works
Camera
Partial
Suspend
Works
Device Codename Category
General Mobile E-Tab 4 (2012) gm-mehmet
ODROID U2 odroid-u2 testing
Samsung Galaxy Camera samsung-gd1
Samsung Galaxy Camera 2 samsung-sf2wifi
Samsung Galaxy Note 10.1 WiFi/3G samsung-p4note testing
Samsung Galaxy Note 8.0 samsung-kona testing
Samsung Galaxy Note II samsung-t03g testing
Samsung Galaxy Note II LTE samsung-t0lte testing
Samsung Galaxy S III samsung-m0 community
Samsung Galaxy S III LTE samsung-m3 testing

Exynos 4415

Samsung Exynos 4415
File:Exynos-4415.jpg
Manufacturer Samsung
Name Exynos 4415
Architecture armv7
CPU 4x ARM Cortex A9 @ 1.5GHz
GPU ARM Mali-400 GPU
Year 2014
Process 28nm
Mainline no
Community Page
A link to a git{hub,lab} organisation/repo where development happens.
https://gitlab.com/exynos4-mainline
Components
CPU
SMP (bring up secondary CPU cores), CPU frequency scaling, CPUidle
Untested
UART
Untested
Storage
eMMC, SD cards, UFS, ...
Untested
USB
Untested
Display
Untested
GPU
Untested
Pinctrl
Untested
I²C
Untested
Audio
Untested
Video
Hardware-accelerated video de/encoding
Untested
Thermal
Untested
Camera
Untested
Suspend
Untested

No results

USB OTG

As of kernel 6.10.0, USB OTG should work on devices that have it enabled (currently that's the Galaxy S III, Note II and the Galaxy Tab 3 8.0). The only caveat is that occasionally, peripheral mode may no longer work after plugging in an OTG cable until the system is restarted.

Progress on fixing these issues is being tracked in exynos4-mainline/linux#11.

Hardware video decoding (MFC)

The Exynos 4 has a built-in hardware video decoding/encoding block called MFC v5. It has a mainline driver, which uses the v4l2m2m API (see Hardware video acceleration for more information). The firmware is packaged as linux-firmware-s5p-mfc.

However, it does not currently work, throwing errors about unsupported formats. Help in figuring this out would be appreciated. If you're feeling adventurous, feel free to investigate - the module is enabled in the v6.10 kernel.

Camera

pmaports!5888 introduced changes on the kernel config side to allow for using the cameras; there is a pending Megapixels MR adding support for the SIII/Note 2's cameras to libmegapixels. There was some earlier work in pmaports!2248 to add camera support for the Galaxy S2.

The drivers for the sensors are rather quirky, and the FIMC driver may need changes too; this is yet to be investigated.

Booting Exynos 4412 with u-boot

Thanks to the work by Forkbomb (Simon Shields) there exists a u-boot fork based on 2020.01 with good support for most 4412 based devices: u-boot/midas-2020.01. The Exynos4-mainline team are currently trying to improve Exynos support in mainline u-boot, and add support for the Exynos 4 devices.

U-boot can either be chainloaded, i.e. packaged into a boot.img and flashed instead of a kernel and booted by S-Boot, or be used as primary bootloader where it replaces S-Boot. Using it as a primary bootloader should not be possible, as secure boot normally requires all bootloader stages to be signed, but luckily for us there exists a signed bl1 blob from exynos4412-odroid-x u-boot sources that does not verify the signature of the next stage. This bl1 can then load an unsigned u-boot-spl, a bl2 built from u-boot sources, which then loads u-boot. The device packages in pmaports do not yet use u-boot, but pmaports branches for anyone that wants to try it out are available in exynos4-mainline/u-boot: chainloaded u-boot and primary u-boot. With the chainloaded branch you can flash the kernel as usual (u-boot is put into the boot.img instead of linux), while for primary branch only sdcard installations are supported. For primary mode is it also important that the partition type is set to msdos (set deviceinfo_partition_type="msdos"), as the partition table header is otherwise partly overwritten by bl1. When using u-boot as primary bootloader, we first have to tell the device to load the bootloader from the sdcard instead of the internal eMMC. This can be done by booting Linux normally, without u-boot, and then installing mmc-utils and running:

sudo mmc bootpart enable 0 1 /dev/mmcblk0

To undo the change, and restore to internal storage boot, run instead:

sudo mmc bootpart enable 1 1 /dev/mmcblk0

Booting mainline linux with this u-boot fork works very well.

Booting downstream android with u-boot

Note Booting downstram android does not work yet, this section is written for research purposes

Being able to dualboot mainline linux with stock android or some custom ROM would be nice. U-boot can provide a boot menu to make this possible, but unfortunately the display is not supported in the u-boot fork. What we can do is add another entry to the extlinux.conf for booting android, and then just switching between them by changing the "default" entry, or by choosing at boot with a serial debugging cable.

To boot android we need the compressed kernel image (called something like image.gz or vmlinuz), and the initramfs (called something like initramfs or ramdisk.img). These can be extracted with unpackbootimg from the boot.img you want to boot. Put the kernel and initramfs in /boot/ named vmlinuz-android and initramfs-android and update /boot/extlinux/extlinux.conf to contain something like:

timeout 1
default android
menu title boot prev kernel

label postmarketOS
	kernel /vmlinuz
	fdt /exynos4412-i9300.dtb
	initrd /initramfs
	append pmos_boot_uuid=c425cba7-0bd2-94s2-9c95-f07jh5dd295 pmos_root_uuid=c3a715e6-56ba-46e2-a1d7-bbkrs328c0a5 pmos_rootfsopts=defaults

label android
	kernel /vmlinuz-android
	initrd /initramfs-android
	append sec_debug.level=0 sec_watchdog.sec_pet=5 androidboot.debug_level=0x4f4c sec_log=0x100000@0x46000000 s3cfb.bootloaderfb=0x5ec00000 lcdtype=96 consoleblank=0 lpcharge=0 lpj=3981312 vmalloc=144m oops=panic pmic_info=65 cordon=a21042541f4lk65g33t06cc193e4fcf1 connie=GT-I9300_OPEN_EUR_0e36bf82456d0a463l483uy3462f6690 androidboot.emmc_checksum=3 androidboot.odin_download=1 androidboot.bootloader=I9300XXUGND5 androidboot.serialno=32336t64k12560bd snd_soc_core.pmdown_time=1000

which will then boot android by default. You will need to update the dtb name and append fields to match your device.

Error when booting downstream android with u-boot

Kernel panics early, only way to get any info about the issue is to enable earlycon and CONFIG_DEBUG_LL in the android kernel.

Then we see error:

[ ... ]
<6>SELinux:  Initializing.
<7>SELinux:  Starting in permissive mode
<6>Mount-cache hash table entries: 512
<6>Initializing cgroup subsys debug
<6>Initializing cgroup subsys cpuacct
<6>Initializing cgroup subsys freezer
<6>CPU: Testing write buffer coherency: ok
<1>Unhandled fault: imprecise external abort (0x406) at 0x09038230
<0>Internal error: : 406 [#1] PREEMPT SMP
<d>Modules linked in:
CPU: 0    Not tainted  (3.0.101-lineage-g3fa9cae25b47-dirty #5)
PC is at kernel_thread_helper+0x0/0x10
LR is at kernel_thread_helper+0x0/0x10
pc : [<c004f8d0>]    lr : [<c004f8d0>]    psr: 00000093
sp : eb047ff8  ip : 00000000  fp : 00000000
r10: 00000000  r9 : 00000000  r8 : 00000000
r7 : 00000013  r6 : c00a3e48  r5 : c00c544c  r4 : 00000000
r3 : 00000000  r2 : 00000000  r1 : 00000000  r0 : 00000000
Flags: nzcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 10c5387d  Table: 4000404a  DAC: 00000015

while what we should get is:

[ ... ]
<6>CPU: Testing write buffer coherency: ok
<6>notifier_call_chain : NOTIFY BAD tick_notify
<6>notifier_call_chain : NOTIFY BAD tick_notify
<6>hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 counters available
<6>L310 cache controller enabled
<6>l2x0: 16 ways, CACHE_ID 0x4100c4c8, AUX_CTRL 0x7e470001, Cache size: 1048576 B
[ ... ]

The error comes at end of start_kernel of init/main.c in linux, from a schedule() call. Error is somehow related to CONFIG_DM_PMIC_MAX77693 in u-boot, disabling it gets us longer, but kernel then runs into display and usb errors, and reboots.

See also