[alpha] Android 13 -> LineageOS 20 for Odroid C4 with mainline kernel 6.1

Post Reply
User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

[alpha] Android 13 -> LineageOS 20 for Odroid C4 with mainline kernel 6.1

Post by joerg »

I have ported to LineageOS 20.
-With security patches of Nov-5 2023.
OTA (20231121):
https://drive.google.com/file/d/1btEo-G ... sp=sharing
Image (20231121) to flash to emmc:
https://drive.google.com/file/d/1bUIyiU ... sp=sharing

[edid]
(20231121)
-fixed volume control. There are still no buttons in navigation bar. But from settings menu volume is adjustable and with input keyevent 24/25
-fixed GNSS wrong speed calculation

[edid]
(20230521)
Same functionality as before, but more:
-Backlight pwm working
-4G USB Modem in Hilink mode working, switch with usb_modeswitch

[edit]
-Kernel 6.1.1

[edit]
-new partition layout, no super partition anymore...
-various wifi dongles
-overlays i2c0, i2c1, gt911

I would appreciate if someone try it and give feedback!

What's new?
-Gnss support
-Devicetree overlays with spi and pwm

At init process of Android the userdata partition will resize to maximum free space. On my 16GB emmc I have >12GB free space.

Works:
- audio over hdmi, over s/pdif, over usb, over bluetooth
- gpiomem and wiringPi
- logo is shown, but only for some seconds
- wifi dongle rtl8192eu based
- rooting with Magisk, but version 26.x
- Gapps to flash with Magisk
- Wifi dongles rtl8811au, rtl8821au, rtl8188eu, rtl8821cu, rtl8xxxu

Doesn't work, or wip:
- onewire

A lot of things are not tested:
- google apps
- video
- etc
.
Screenshot_20230129-145448.png
Screenshot_20230129-145448.png (102.55 KiB) Viewed 6637 times
Last edited by joerg on Wed Nov 22, 2023 2:03 am, edited 13 times in total.
These users thanked the author joerg for the post (total 5):
odroid (Tue Jan 17, 2023 9:24 am) • voodik (Thu Jan 19, 2023 7:33 pm) • istanbulls (Tue Mar 14, 2023 1:10 am) • rooted (Sat Mar 18, 2023 8:52 pm) • letolkki (Wed Jul 19, 2023 4:30 am)

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: First impression of Android 13 with mainline kernel 5.15

Post by joerg »

HowTo Section

Install to emmc card (only!):
Be sure which device is your emmc card!

Code: Select all

#dd if=Android13-20230129-odroidc4.img of=/dev/sdX bs=1M
#sync
Or use other flashing tool.

Install Magisk:
https://github.com/topjohnwu/Magisk/rel ... -v24.3.apk

Code: Select all

adb shell
#su
#dd if=/dev/block/by-name/boot of=boot.img 
//In Magisk Manager use patch file method...
#dd if=magisk_patched-24300_xxxx.img of=/dev/block/by-name/boot
#reboot
Devicetree overlays:
For now only 7 devicetree overlays are ready to use:
spi0 pwm_ab pwm_cd pwm_ef i2c0 i2c1 gt911
To enable or disable an overlay, command fw_setenv is used, and fw_printenv to read.

Code: Select all

odroidc4:/ $ su
odroidc4:/ # fw_printenv overlays                                                                                     
overlays=spi0 pwm_cd
odroidc4:/ # fw_setenv overlays "spi0 pwm_ab" 
After setting this, odroid c4 needs a reboot, so that u-boot applies the overlays during boot.
Don't try other than this 7 overlays, it can result in a boot loop. If so, only at interrupted u-boot command line the env variable overlays can be restored.

Gnss:
The driver is based on Gnss V2.1 GnssTemplate source code, but is developed further to have it bug free, to have GnssSvInfo and to have support for GPS, GLONASS, GALILEO and BEIDOU. But only tested from my side is GPS and multimode with GPS and GLONASS.
So far it can in single satellite mode only GPS with messages GPRMC, GPGGA, etc, and in multi satellite mode with messages GNRMC, GNGGA, etc. two satellite systems. My ublox m8 mouse can do that.
As serial port is configured /dev/ttyACM. The driver scans ttyACM0 ...9 to find a ublox GPS mouse.
If someone needs to define another serial port the prop debug.location.fixedlocation.devname must be set. The driver takes this port now and does not anymore scan for an ublox device.

Code: Select all

//enable ttyUSB0
$ adb shell setprop debug.location.fixedlocation.devname /dev/ttyUSB0
//disable
adb shell setprop debug.location.fixedlocation.devname \"\"
The default port is set in prop vendor.ser.gnss-uart

Code: Select all

adb shell getprop vendor.ser.gnss-uart
/dev/ttyACM
If there are problems with the driver, a lot of debug messages can be enabled with setting log.tag.android.hardware.gnss@2.1-service.usbserial

Code: Select all

//debug messages
adb shell setprop log.tag.android.hardware.gnss@2.1-service.usbserial VERBOSE
//no debug messages
adb shell setprop log.tag.android.hardware.gnss@2.1-service.usbserial WARN
Gapps:
Here can be downloaded working Gapps for Android 13, flash-able with Magisk.
https://sourceforge.net/projects/magisk ... A/24.2.23/
Copy to C4 and select Module in Magisk and install from memory...
About a hour after registering, account can be added! Registering at: https://www.google.com/android/uncertified/
Use core version, other versions are too big.

Backlight:
-Set pwm_cd in overlays. Backlight pwm will be at pin 11 of 40p header.
-To enable the lights driver, set at adb shell fw_printenv extrabootargs "backlight_pwm=yes" . Must be root, do adb root before adb shell.

4G Modem:
-On ext partition is a config file for switching modem with usb_modeswitch:
/ext/etc/usb_modeswitch.conf

Code: Select all

#Huawei 

DefaultVendor= 0x12d1
DefaultProduct= 0x1f01

TargetVendor=0x12d1
TargetProductList="14db,14dc"
HuaweiNewMode=1

MessageEndPoint = "0x01"
MessageContent="55534243000000000000000000000011060000000000000000000000000000"
NoDriverLoading=1
-Ext partition is free to use and rw. Will not be updated by ota update.


Wifi dongles:
-edit init.ext.rc on ext partition with nano as su:

Code: Select all

#add init rules here
#on boot

on early-boot
  exec -- /system/bin/insmod /vendor/lib/modules/rtl8xxxu.ko
#  exec -- /system/bin/insmod /vendor/lib/modules/8821cu.ko
#  exec -- /system/bin/insmod /vendor/lib/modules/8821au.ko
#  exec -- /system/bin/insmod /vendor/lib/modules/8188eu.ko
These modules are not in the modules.load list, so the system doesn't load them automatically. I made it this way, because with automatically loading, the module cfg80211 loads to early and blocks all loop devices for >60 seconds.

Mount smb share to accessible directory
-edit init.ext.rc on ext partition with nano as su:

Code: Select all

#add init rules here
# on boot

on property:sys.boot_completed=1
    wait /storage/emulated/0/Android 20
    setprop storage_done 1

on property:storage_done=1
    mkdir /storage/emulated/0/my_folder 0770 media_rw media_rw
    start mount_folder

service mount_folder /system/bin/mount -t smb3 -o username=my_user,password=my_passw,gid=1023,uid=1023,file_mode=0777,dir_mode=0777,iocharset=utf8 //my_ip/my_share /storage/emulated/0/my_folder
    class main
    disabled
    oneshot
Last edited by joerg on Sun Oct 22, 2023 7:45 pm, edited 11 times in total.
These users thanked the author joerg for the post:
istanbulls (Tue Mar 14, 2023 1:10 am)

User avatar
odroid
Site Admin
Posts: 41864
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3433 times
Been thanked: 1920 times
Contact:

Re: First impression of Android 13 with mainline kernel 5.15

Post by odroid »

Nice to meet UpsideDownCake on a modern Kernel 5.15 :D

User avatar
rooted
Posts: 10485
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 816 times
Been thanked: 695 times
Contact:

Re: First impression of Android 13 with mainline kernel 5.15

Post by rooted »

Your work never ceases to amaze me.

User avatar
voodik
Posts: 2627
Joined: Sat Dec 07, 2013 2:36 am
languages_spoken: armenian, english, russian
Location: Armenia
Has thanked: 109 times
Been thanked: 786 times
Contact:

Re: First impression of Android 13 with mainline kernel 5.15

Post by voodik »

Great!
Can i know which mali, gralloc and hwcomposer modules you use ?
Buy me a beer ;)
https://www.paypal.me/voodikjan
BTC: 377wXjEr3QsDDzRqfMco3a41wicrsv3Sfs
--------------------------------------------------------
dump logs
(dmesg; logcat -d; lsusb) | curl -F 'f:1=<-' ix.io
--------------------------------------------------------
ADB enhanced PuTTY :!:
https://github.com/voodik/puttyadb/releases

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: First impression of Android 13 with mainline kernel 5.15

Post by joerg »

Hello voodik, I used the configuration from https://source.android.com/docs/setup/c ... m3l_boards, specially from VIM3L as this board has the same cpu architecture meson-sm1.
BTW. a lot is not working yet. I am searching for USB Bluetooth solution. Android 13 has now Gabeldorsche as Bluetooth stack and it lacks of well documentation...
More things are not working:
MTP device, USB configuration wrong
HDMI-CEC, does bootloop when is included in image.
HDMI or S/PDIF audio does not work, but USB audio yes

I was wondering that the graphics stack is working out of the box:
Gralloc is delivered with the yukawa device repo: device/amlogic/yukawa/hal/gralloc.
Midgard Mali is from kernel source: drivers/gpu/arm/midgard
Kernel sources are cloned from: git clone https://android.googlesource.com/kernel/hikey-linaro -b android-amlogic-bmeson-5.15 with the meson_defconfig and the meson-sm1-odroid-c4.dtb.
Hwcomposer is delivered with android sources in: external/drm_hwcomposer and added as hwcomposer.drm_meson
These users thanked the author joerg for the post:
odroid (Fri Jan 20, 2023 9:32 am)

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: First impression of Android 13 with mainline kernel 5.15

Post by joerg »

I made a step forward with Bluetooth. I copied the firmware of my Asus dongle, rtl8761 based, to wrong folder. Now I can enable the Bluetooth and I can find my JBL headphones, can pair, but no sound. :(
And I have this: servicemanager: Could not find android.hardware.bluetooth.IBluetoothHci/default in the VINTF manifest.. I tried already to add it to manifest.xml...

[edit]
It works! I had to pair the JBL LIVE460NC with headphone symbol, not the JBL LIVE460NC-LE LowEnergy!

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: First impression of Android 13 with mainline kernel 5.15

Post by joerg »

Now the MTP file access over the otg port is working. :)
It was a wrong symlink in the Android sources in system/core/rootdir/init.usb.configfs.rc
Must be:
symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
But was:
symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1
As the old form is not any more present in modern kernel. There is missing f_mtd.c and config CONFIG_USB_CONFIGFS_F_MTP
I also changed the vid pid to Nexus/Pixel. After reboot my LinuxMint didn't mount the odroid-c4 and I had to change the udev rules in 51-android.rules for it to:

Code: Select all

ATTR{idProduct}=="4ee1", ENV{adb_adbfast}="yes", SYMLINK+="libmtp-%k"
ATTR{idProduct}=="4ee2", ENV{adb_adbfast}="yes", SYMLINK+="libmtp-%k"
I have searched too much time for all this. :(
Now I would like to make some install makefile to generate the GPT partition table, flash the meson mainline u-boot and all the other images as boot.img, super.img etc directly to emmc.

User avatar
voodik
Posts: 2627
Joined: Sat Dec 07, 2013 2:36 am
languages_spoken: armenian, english, russian
Location: Armenia
Has thanked: 109 times
Been thanked: 786 times
Contact:

Re: First impression of Android 13 with mainline kernel 5.15

Post by voodik »

joerg wrote:
Sun Jan 22, 2023 12:59 am
Now the MTP file access over the otg port is working. :)
It was a wrong symlink in the Android sources in system/core/rootdir/init.usb.configfs.rc
Must be:
symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
But was:
symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1
As the old form is not any more present in modern kernel. There is missing f_mtd.c and config CONFIG_USB_CONFIGFS_F_MTP
I also changed the vid pid to Nexus/Pixel. After reboot my LinuxMint didn't mount the odroid-c4 and I had to change the udev rules in 51-android.rules for it to:

Code: Select all

ATTR{idProduct}=="4ee1", ENV{adb_adbfast}="yes", SYMLINK+="libmtp-%k"
ATTR{idProduct}=="4ee2", ENV{adb_adbfast}="yes", SYMLINK+="libmtp-%k"
I have searched too much time for all this. :(
Now I would like to make some install makefile to generate the GPT partition table, flash the meson mainline u-boot and all the other images as boot.img, super.img etc directly to emmc.
What about video hw decode/encode ?
I working on almost same for N2, but for now just hdmi output is working ))) no audio, no decoders etc)
n2-5.10.png
n2-5.10.png (73.85 KiB) Viewed 6819 times
Buy me a beer ;)
https://www.paypal.me/voodikjan
BTC: 377wXjEr3QsDDzRqfMco3a41wicrsv3Sfs
--------------------------------------------------------
dump logs
(dmesg; logcat -d; lsusb) | curl -F 'f:1=<-' ix.io
--------------------------------------------------------
ADB enhanced PuTTY :!:
https://github.com/voodik/puttyadb/releases

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: First impression of Android 13 with mainline kernel 5.15

Post by joerg »

As always I appreciate your work.
I never came in touch with video hw decode/encode. Pls tell me what and how I need to test for it?

User avatar
voodik
Posts: 2627
Joined: Sat Dec 07, 2013 2:36 am
languages_spoken: armenian, english, russian
Location: Armenia
Has thanked: 109 times
Been thanked: 786 times
Contact:

Re: First impression of Android 13 with mainline kernel 5.15

Post by voodik »

joerg wrote:
Sun Jan 22, 2023 7:51 am
As always I appreciate your work.
I never came in touch with video hw decode/encode. Pls tell me what and how I need to test for it?
Nothing))
Only software decoders/encoders are listed ;)
https://android.googlesource.com/device ... codecs.xml
Buy me a beer ;)
https://www.paypal.me/voodikjan
BTC: 377wXjEr3QsDDzRqfMco3a41wicrsv3Sfs
--------------------------------------------------------
dump logs
(dmesg; logcat -d; lsusb) | curl -F 'f:1=<-' ix.io
--------------------------------------------------------
ADB enhanced PuTTY :!:
https://github.com/voodik/puttyadb/releases

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: First impression of Android 13 with mainline kernel 5.15

Post by joerg »

I found the right setting for getting hdmi audio working! :)
Mixer paths have been wrong, must be (mixer_paths_hdmi_only.xml):

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1"?>
<mixer>
	<!-- FIXME: This should be moved to the appropriate path -->

	<!-- Enable HDMITX Control from TDM A -->
	<ctl name="TOHDMITX Switch" value="1" />
	<ctl name="TOHDMITX I2S SRC" value="I2S B" />

	<!-- PCM0 to TDMB -->
	<ctl name="TDMOUT_B SRC SEL" value="IN 0" />
	<ctl name="FRDDR_A SINK 1 SEL" value="OUT 1" />
	<ctl name="FRDDR_A SRC 1 EN Switch" value="1" />
</mixer>
ctl name="FRDDR_A SINK 1 SEL" value="OUT 1" and ctl name="TOHDMITX I2S SRC" value="I2S B" did the trick.

Now I am searching solution for S/PDIF out. I need it for my All-In-One PC in living room connected to the Onkyo amplifier.
These users thanked the author joerg for the post:
odroid (Mon Jan 23, 2023 11:36 am)

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: First impression of Android 13 with mainline kernel 5.15

Post by joerg »

Sound over S/PDIF also working!
I had to patch the device tree to add spdifout node and add this line to mixer paths xml:

Code: Select all

	<ctl name="FRDDR_A SINK 3 SEL" value="OUT 3" />
	<ctl name="FRDDR_A SRC 3 EN Switch" value="1" />
This results in sound output at both hdmi and s/pdif connector.

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: First impression of Android 13 with mainline kernel 5.15

Post by joerg »

Now I managed also making wiringPi working and using with my app. :)
The libraries can't longer be on vendor partition at /vendor/lib64. They must be on system partition and library name must be added to public.libraries.txt also on system partition.

BTW. I was not yet able to make a functional install script.
The manual installation process is somehow complicated:
-Flash mainline u-boot to emmc.
-Boot up Odroid C4 to fastboot.
-Command fastboot oem format to make the GPT partition table and the 10 partitions.
-For partitions boot, super, cache, recovery, dtbo, userdata, odm command fastboot flash ....
-Primary GPT header resides at the same address range as u-boot. Need to remove the emmc and flash u-boot again.
-Now primary GPT isn't there anymore. U-boot is patched to accept the backup GPT header. :D
-Put emmc again and boot up Android.

My script should do this all, but in the way not to use u-boot with fastboot to make and flash the partitions. Ready to put the emmc to the C4 to boot up.
I can make the partitions and write the images to a loop device. But when I try to flash the emmc with this created whole image and flash afterwards u-boot, u-boot boots up, but the kernel is not found.
If I flash u-boot before to the loop device and flash all to emmc, it does not boot up u-boot.
These users thanked the author joerg for the post:
odroid (Wed Jan 25, 2023 9:37 am)

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: First impression of Android 13 with mainline kernel 5.15

Post by joerg »

I make progress with my script to flash whole Android image included u-boot to emmc. But I need to figure out, how to resize the userdata partition at first start.
I have some options: Use u-boot, use recovery or use Android init process.
Once I am ready with it, I would like to publish the image, so others could give it a try.
What would be the best and free file host service for this about 1GB image?

User avatar
rooted
Posts: 10485
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 816 times
Been thanked: 695 times
Contact:

Re: First impression of Android 13 with mainline kernel 5.15

Post by rooted »

@mdrjr will provide you with the necessary storage I bet, or even Hardkernel
These users thanked the author rooted for the post:
joerg (Sun Jan 29, 2023 6:18 am)

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: First impression of Android 13 with mainline kernel 5.15

Post by joerg »

I have ready a first image that can be flashed to emmc. If someone like to try it out, stay tuned. Need to upload it to a file host service...

User avatar
voodik
Posts: 2627
Joined: Sat Dec 07, 2013 2:36 am
languages_spoken: armenian, english, russian
Location: Armenia
Has thanked: 109 times
Been thanked: 786 times
Contact:

Re: First impression of Android 13 with mainline kernel 5.15

Post by voodik »

joerg wrote:
Sun Jan 29, 2023 10:30 pm
I have ready a first image that can be flashed to emmc. If someone like to try it out, stay tuned. Need to upload it to a file host service...
Google drive?))
Buy me a beer ;)
https://www.paypal.me/voodikjan
BTC: 377wXjEr3QsDDzRqfMco3a41wicrsv3Sfs
--------------------------------------------------------
dump logs
(dmesg; logcat -d; lsusb) | curl -F 'f:1=<-' ix.io
--------------------------------------------------------
ADB enhanced PuTTY :!:
https://github.com/voodik/puttyadb/releases

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 for Odroid C4 with mainline kernel 5.15

Post by joerg »

Dropbox, pls see first post.

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 for Odroid C4 with mainline kernel 5.15

Post by joerg »

I have already integrated the driver for VU7 touch devices dwav-usb-mt and it is running ok with my VU7+ with pid 0705. But I have also one with pid 0703. I guess it's an older one. The behavior of this is not ok. I just don't know if it is defective or does it need another driver or another setting in driver code?
@odroid, do you know?

User avatar
odroid
Site Admin
Posts: 41864
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3433 times
Been thanked: 1920 times
Contact:

Re: [alpha] Android 13 for Odroid C4 with mainline kernel 5.15

Post by odroid »

I've never seen 0703.
According to our wiki pages https://wiki.odroid.com/accessory/displ ... /vu_series

Code: Select all

ODROID-Vu5 : 16B4:0704 (obsolete)
ODROID-Vu5A : 16B4:0705
ODROID-Vu7: 0EEF:0005 (obsolete)
ODROID-Vu7+: 16B4:0705 (obsolete)
ODROID-Vu7A+: 16B4:0705
ODROID-Vu8 : 18D1:4E12 (obsolete)
Therefore, I believe you can forget about 0703. ;)

User avatar
voodik
Posts: 2627
Joined: Sat Dec 07, 2013 2:36 am
languages_spoken: armenian, english, russian
Location: Armenia
Has thanked: 109 times
Been thanked: 786 times
Contact:

Re: [alpha] Android 13 for Odroid C4 with mainline kernel 5.15

Post by voodik »

@joerg

:D :D funny hacks you made with u-boot and gpt)) respect !
As can i understand you modify gpt cmd and "gpt write mmc ${mmcdev} ${partitions}" doesn't write (at least GPT header) to not overwrite u-boot ?

Just for info, if you flash u-boot into emmc hardware partition (mmcblk1boot0) you can have working GPT ;)
Buy me a beer ;)
https://www.paypal.me/voodikjan
BTC: 377wXjEr3QsDDzRqfMco3a41wicrsv3Sfs
--------------------------------------------------------
dump logs
(dmesg; logcat -d; lsusb) | curl -F 'f:1=<-' ix.io
--------------------------------------------------------
ADB enhanced PuTTY :!:
https://github.com/voodik/puttyadb/releases

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 for Odroid C4 with mainline kernel 5.15

Post by joerg »

@voodik
I use the mainline meson u-boot and create bin and flash it as it is described there. I use:

Code: Select all

DEV=/dev/sdh
./build-fip.sh odroid-c4 ../u-boot-amlogic/u-boot.bin ../fip_out
dd if=../fip_out/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
dd if=../fip_out/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
But I found also one mistake in my partition table, already some days ago. I had only 1M offset for first partition, but u-boot bin is 1.7M. This way I destroyed also the first partition logo, flashing u-boot. Now I use 2M offset and everything is well. No need to change something as it works now. ;)

User avatar
voodik
Posts: 2627
Joined: Sat Dec 07, 2013 2:36 am
languages_spoken: armenian, english, russian
Location: Armenia
Has thanked: 109 times
Been thanked: 786 times
Contact:

Re: [alpha] Android 13 for Odroid C4 with mainline kernel 5.15

Post by voodik »

joerg wrote:
Thu Feb 02, 2023 7:18 pm
@voodik
I use the mainline meson u-boot and create bin and flash it as it is described there. I use:

Code: Select all

DEV=/dev/sdh
./build-fip.sh odroid-c4 ../u-boot-amlogic/u-boot.bin ../fip_out
dd if=../fip_out/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
dd if=../fip_out/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
But I found also one mistake in my partition table, already some days ago. I had only 1M offset for first partition, but u-boot bin is 1.7M. This way I destroyed also the first partition logo, flashing u-boot. Now I use 2M offset and everything is well. No need to change something as it works now. ;)
So you don't made gpt hacks ? Can you show me a branch of u-boot you used ?) I'm working with mainline u-boot on last three days, and finding solution to keep both u-boot and GPT.
Genuine u-boot gpt write command writes GPT header at offset 512 so overwrites u-boot. On your image you don't keep partition table, instead bind partitions via kernel cmdline.
So i want understand is it made by you or i missing some branches ?))

P.S.
We are just doing almost similar work, so i just want to share with you some solutions I made.
Also investigating your work to get other view(maybe better) to same solutions )))

P.S.P.S
Today after lot of debugging found
set in kernel config
CONFIG_REGULATOR_GPIO=y
to fix sd-card port ))
These users thanked the author voodik for the post:
joerg (Thu Feb 02, 2023 9:55 pm)
Buy me a beer ;)
https://www.paypal.me/voodikjan
BTC: 377wXjEr3QsDDzRqfMco3a41wicrsv3Sfs
--------------------------------------------------------
dump logs
(dmesg; logcat -d; lsusb) | curl -F 'f:1=<-' ix.io
--------------------------------------------------------
ADB enhanced PuTTY :!:
https://github.com/voodik/puttyadb/releases

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 for Odroid C4 with mainline kernel 5.15

Post by joerg »

Yes I made some hacks!
Mainly that u-boot not fails at verify GPT primary header and for fastboot oem format that u-boot does not write GPT primary header.
Branch is: u-boot-amlogic https://source.denx.de/u-boot/custodian ... logic.git
disk/part_efi.c#write_gpt_table:

Code: Select all

#if !(CONFIG_IS_ENABLED(GPT_ONLY_BACKUP_HEADER))
	/* Write the First GPT to the block right after the Legacy MBR */
	if (blk_dwrite(dev_desc, 1, 1, gpt_h) != 1)
		goto err;

	if (blk_dwrite(dev_desc, le64_to_cpu(gpt_h->partition_entry_lba),
		       pte_blk_cnt, gpt_e) != pte_blk_cnt)
		goto err;
#endif
disk/part_efi.c#gpt_verify_headers:

Code: Select all

#if !(CONFIG_IS_ENABLED(GPT_ONLY_BACKUP_HEADER))
	if (is_gpt_valid(dev_desc,
			 GPT_PRIMARY_PARTITION_TABLE_LBA,
			 gpt_head, gpt_pte) != 1) {
		log_debug("Invalid GPT\n");
		return -1;
	}
#endif
And I made one more config at disk/Kconfig:

Code: Select all

config GPT_ONLY_BACKUP_HEADER
       bool "Enable support of broken primary header"
       depends on EFI_PARTITION
       default n
CONFIG_REGULATOR_GPIO=y
Interesting, I will try that.
These users thanked the author joerg for the post:
voodik (Thu Feb 02, 2023 10:36 pm)

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 for Odroid C4 with mainline kernel 5.15

Post by joerg »

PS. I added this to bootargs in include/configs/meson64_android.h:

Code: Select all

"setenv bootargs \"$bootargs blkdevparts=mmcblk1:2m@2m(logo),512k(misc),8m(dtbo),512k(vbmeta),32m(boot),48m(recovery),256M(cache),1792m(super),64m(odm),-(userdata) \";"\

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 for Odroid C4 with mainline kernel 5.15

Post by joerg »

I am working all the past time on a working GNSS V2.1 solution as the old GPS version V1.0 legacy is not compatible anymore with Android 13. Now I am pleased to say it's working. I need to add some serial line tty testing and more sat systems as only GPS to say it's complete. A view days more and I will upload a new version. :)
These users thanked the author joerg for the post:
odroid (Wed Feb 08, 2023 9:19 am)

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 for Odroid C4 with mainline kernel 5.15

Post by joerg »

Step forward. :)
GPS (1-32, 36 and 49 are SBAS)
Gnss1.png
Gnss1.png (83.59 KiB) Viewed 6373 times
GLONASS (65-88)
Gnss2.png
Gnss2.png (83.32 KiB) Viewed 6373 times
I don't have gps mouse that works with Galileo or Beidou. Can't test them... :(
These users thanked the author joerg for the post:
odroid (Fri Feb 10, 2023 9:18 am)

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 for Odroid C4 with mainline kernel 5.15

Post by joerg »

A new release is online.
Added Gnss usb serial support and devicetree overlays with spi and pwm.

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 for Odroid C4 with mainline kernel 5.15

Post by joerg »

Added a solution for Gapps, please see second post.
These users thanked the author joerg for the post:
odroid (Mon Feb 20, 2023 9:46 am)

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 for Odroid C4 with mainline kernel 5.15

Post by joerg »

Here I write down my steps, how I made lights driver working on Android13/LineageOS20:

system/core/rootdir/init.rc

Code: Select all

    #chown root radio /proc/cmdline
device/hardkernel/odroidc4/init.odroidc4.rc

Code: Select all

on post-fs
...
    # pwm
    chown system system /sys/class/pwm/pwmchip2/export
    chmod 0220 /sys/class/pwm/pwmchip2/export
    chown system system /sys/class/pwm/pwmchip2/unexport
    chmod 0220 /sys/class/pwm/pwmchip2/unexport
    chown system system /sys/class/pwm/pwmchip4/export
    chmod 0220 /sys/class/pwm/pwmchip4/export
    chown system system /sys/class/pwm/pwmchip4/unexport
    chmod 0220 /sys/class/pwm/pwmchip4/unexport
    
    chown system system /proc/cmdline
Lights driver can't read cmdline and can't write to export, if not system:system.

device/hardkernel/odroidc4/ueventd.rc

Code: Select all

#pwm
/sys/devices/platform/soc/ffd00000.bus/ffd1a000.pwm/pwm/pwmchip2 pwm1/enable 0660 system system
/sys/devices/platform/soc/ffd00000.bus/ffd1a000.pwm/pwm/pwmchip2 pwm1/period 0660 system system
/sys/devices/platform/soc/ffd00000.bus/ffd1a000.pwm/pwm/pwmchip2 pwm1/duty_cycle 0660 system system
/sys/devices/platform/soc/ffd00000.bus/ffd1a000.pwm/pwm/pwmchip2 pwm1/polarity 0660 system system
These nodes only exists after lights driver has written 1 to pwmchip export. Can't be changed from init.rc, needs uevent rules.

hardware/.../lights/lights.c

Code: Select all

void init_globals(void)
{
...
    if (enable) {
        fd = open(backlight_export, O_WRONLY);
        if (fd > 0) {
            ret = write(fd, "1", 1);
            close(fd);
        }
        usleep(500*1000ul);
After export it is needed a usleep, to wait that the udev rules take place. Without usleep, the commands afterward don't work because of wrong permission and pwm never becomes enabled.

@voodik: This is for C4, please check if this helps to make lights driver functional on your build for N2.

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 -> LineageOS 20 for Odroid C4 with mainline kernel 5.15

Post by joerg »

I have uploaded the LineageOS 20 port to Dropbox!
These users thanked the author joerg for the post:
rooted (Sat Mar 18, 2023 8:52 pm)

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 -> LineageOS 20 for Odroid C4 with mainline kernel 5.15

Post by joerg »

screen.png
screen.png (54 KiB) Viewed 5854 times
These users thanked the author joerg for the post:
rooted (Sat Mar 18, 2023 8:52 pm)

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 -> LineageOS 20 for Odroid C4 with mainline kernel 6.1

Post by joerg »

Uploaded new version with kernel 6.1.1
Patched everything I patched also vor 5.15:
-gpiomem for WiringPi
-dwav_usb_mt for touchdisplay VU7+
-overlays pwm_ab, pwm_cd, pwm_ef, spi0
-s/pdif audio output on J7
These users thanked the author joerg for the post:
odroid (Mon Mar 20, 2023 9:22 am)

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 -> LineageOS 20 for Odroid C4 with mainline kernel 6.1

Post by joerg »

I have bought this touchscreen and have too much trouble with it: https://de.aliexpress.com/item/40003814 ... pt=glo2deu
The resolution is 1920x1080 at 7". It's looking nice BUT:

-no edid data
I found the right modeline setting and created a edid bin file for it and installed all edid files on the boot.img ramdisk. With kernel parameter drm_kms_helper.edid_firmware=edid/1920x1080.bin it's doing. Without, it starts up with 1024x600. I tried also on the windows laptop my wife, there it starts up with 640x480 and can't be changed!

-usb subsystem dies when connect usb touch screen!
All usb devices are dead after plug in the cable!
I tried to power it up with the second usb plug, which is only for power. Plug in after C4 has booted up, the same, usb devices are died.
Then I tried to disable auto suspend with

Code: Select all

on init
    write /sys/bus/usb/devices/usb1/power/autosuspend_delay_ms -1
    write /sys/bus/usb/devices/usb2/power/autosuspend_delay_ms -1
But no luck.
I thought it's the mainline kernel. I tied with LineageOS 18 kernel 4.9, the same happens.
This happens when I plug in the touch screen cable:

Code: Select all

[   69.072220] <6>[   69.072220@0] usb 1-1.3: new high-speed USB device number 5 using xhci-hcd
[   69.251198] <6>[   69.251198@0] hub 1-1.3:1.0: USB hub found
[   69.253076] <6>[   69.253076@0] hub 1-1.3:1.0: 4 ports detected
[   69.560208] <6>[   69.560208@0] usb 1-1.3.1: new full-speed USB device number 6 using xhci-hcd
[   76.824483] <4>[   76.824483@3] xhci-hcd xhci-hcd.0.auto: xHCI host not responding to stop endpoint command.
[   76.824490] <4>[   76.824490@3] xhci-hcd xhci-hcd.0.auto: Assuming host is dying, halting host.
[   76.843176] <4>[   76.843176@3] xhci-hcd xhci-hcd.0.auto: Host not halted after 16000 microseconds.
[   76.843186] <4>[   76.843186@3] xhci-hcd xhci-hcd.0.auto: Non-responsive xHCI host is not halting.
[   76.843188] <4>[   76.843188@3] xhci-hcd xhci-hcd.0.auto: Completing active URBs anyway.
[   76.843282] <3>[   76.843282@3] xhci-hcd xhci-hcd.0.auto: HC died; cleaning up
[   76.843351] <6>[   76.843351@3] usb 1-1: USB disconnect, device number 2
[   76.843359] <6>[   76.843359@3] usb 1-1.2: USB disconnect, device number 3
[   76.843400] <3>[   76.843400@0] usb 1-1.3.1: Unsupported device
[   76.843549] <6>[   76.843549@3] usb 2-1: USB disconnect, device number 2
[   76.850445] <3>[   76.850445@0] usb 1-1.3.1: Unsupported device
[   76.873775] <6>[   76.873775@3] usb 1-1.3: USB disconnect, device number 5
[   76.873787] <6>[   76.873787@3] usb 1-1.3.1: USB disconnect, device number 6
[   76.875307] <6>[   76.875307@3] usb 1-1.4: USB disconnect, device number 4
I tried also to connect it to the otg port, but also no success.

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 -> LineageOS 20 for Odroid C4 with mainline kernel 6.1

Post by joerg »

I opened a case now on Aliexpress to get my money back. I found also that the top glas cover is installed misaligned to the lcd sreen. It is hanging down on right side nearly 1 mm. If you see the top status bar of Android and the right side is covered half then it is an annoying view. The seller is making big discussion, but I bought with 'free return' option. Let's see how it goes on. As other solution I bought from chalc-elec now a touch panel with black frame to install it on my years old 1280x800 7 inch lcd.
With the touch screen from AliExpress I found that it works on M1, but not on C4 and not on N2. On C4 I tried with mainline and with stock kernel, on N2 with stock kernel. It seems that this touch device breaks usb sub system on Amlogic platform soc.

User avatar
rooted
Posts: 10485
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 816 times
Been thanked: 695 times
Contact:

Re: [alpha] Android 13 -> LineageOS 20 for Odroid C4 with mainline kernel 6.1

Post by rooted »

I've had good luck with AliExpress but never ran into an issue quite as complex for a return, they may argue it "technically" works.

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 -> LineageOS 20 for Odroid C4 with mainline kernel 6.1

Post by joerg »

They accepted and sent a free of costs DHL label. :D
These users thanked the author joerg for the post:
istanbulls (Sat Mar 25, 2023 9:37 pm)

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 -> LineageOS 20 for Odroid C4 with mainline kernel 6.1

Post by joerg »

I just made the driver for Wifi module 5BK (8821cu) working (bluetooth + wifi).
But to upload a new installable image I need some time. I changed the partition layout totally, away from super.img to classic system, vendor, odm... partitions. This way it is simply easier to add or change files directly with adb shell, no need to deal with super, overlayfs etc.
I hope this way I can also make update packages.
These users thanked the author joerg for the post:
odroid (Mon May 08, 2023 9:17 am)

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 -> LineageOS 20 for Odroid C4 with mainline kernel 6.1

Post by joerg »

New image uploaded...
What's new?
-new partition layout, no super partition anymore, ext partition r/w to have persistant init.rc, uevent.rc
-various realtek wifi dongles
-overlays i2c0, i2c1, gt911 (i2c touchscreen)
These users thanked the author joerg for the post:
odroid (Mon May 22, 2023 10:50 am)

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 -> LineageOS 20 for Odroid C4 with mainline kernel 6.1

Post by joerg »

I have added some more description into post2: How to add a smb share to accessible folder. I figured out that need to wait until the OS has created the virtual folder /storage/emulated/0. After this a mount can be done from init.ext.rc.

letolkki
Posts: 13
Joined: Wed Jun 08, 2016 12:05 am
languages_spoken: english
ODROIDs: xu4,c4,n2
Has thanked: 1 time
Been thanked: 0
Contact:

Re: [alpha] Android 13 -> LineageOS 20 for Odroid C4 with mainline kernel 6.1

Post by letolkki »

I tried out your build. works great. Can you give me some insight on how/ steps taken to make a selfinstall image (i have the <update.zip> built for sideload but get assert errors)?

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 -> LineageOS 20 for Odroid C4 with mainline kernel 6.1

Post by joerg »

Oh thank you for trying muy build. There is no selfinstall image. The image I provide has already the gpt partition. Just need to copy to emmc and at first boot the userdata partition will be resized.
I will publish an update.zip by time to flash by adb sideload. But there is no for now.
There is some small bug in the gnss driver. If you need navigation, please tell me.

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 -> LineageOS 20 for Odroid C4 with mainline kernel 6.1

Post by joerg »

Just compiled new and uploaded with security patches of Nov-05. Please see first post.
These users thanked the author joerg for the post:
odroid (Tue Nov 21, 2023 9:20 am)

User avatar
joerg
Posts: 1957
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 200 times
Been thanked: 431 times
Contact:

Re: [alpha] Android 13 -> LineageOS 20 for Odroid C4 with mainline kernel 6.1

Post by joerg »

I have uploaded another new version. Fixed the volume control. Now it can be adjusted from settings menu, before it was fixed volume.
These users thanked the author joerg for the post:
odroid (Wed Nov 22, 2023 9:23 am)

Post Reply

Return to “Android”

Who is online

Users browsing this forum: No registered users and 1 guest