VIM3/VIM3L AOSP Android 14.0 Upside Down Cake

After compilation, the final prompt indicates whether it is successful or failed. If it is successful, it can be ignored

@xiong.zhang When I try to burn the artifacts, Error occurs:
In debug serial:

U-Boot 2024.01-rc1-18687-g1aa26a76a4e7 (Feb 15 2024 - 18:39:08 +0100) khadas-vim3

Model: Khadas VIM3
SoC:   Amlogic Meson G12B (A311D) Revision 29:b (10:2)
DRAM:  2 GiB
Core:  410 devices, 36 uclasses, devicetree: separate
MMC:   sd@ffe03000: 0, sd@ffe05000: 1, mmc@ffe07000: 2
Loading Environment from MMC... MMC Device -1 not found
*** Warning - No MMC card found, using default environment

In:    usbkbd,serial
Out:   vidconsole,serial
Err:   vidconsole,serial
Net:   eth0: ethernet@ff3f0000
Hit any key to stop autoboot:  0 
Fastboot forced by usb rom boot
Running Fastboot...
crq->brequest:0x0
** Bad device specification mmc bootloader_a **
** Bad device specification mmc bootloader_a **
Couldn't find partition mmc bootloader_a
Starting download of 1280880 bytes
.........
downloading of 1280880 bytes finished
Flashing Raw Image
........ wrote 1281024 bytes to 'bootloader'
** Bad device specification mmc bootenv_a **
** Bad device specification mmc bootenv_a **
Couldn't find partition mmc bootenv_a
Erasing blocks 0 to 3072 due to alignment
........ erased 1572864 bytes from 'bootenv'
Writing GPT: success!
resetting ...
bl31 reboot reason: 0xd
bl31 reboot reason: 0x0
system cmd  1.
G12B:BL:6e7c85:2a3b91;FEAT:E0F83180:402000;POC:D;RCY:0;USB:0;

In fastboot burn:

$ bash flash.sh
Firmware Version :
ROM: 3.2 Stage: 0.0
Need Password: 0 Password OK: 1
Writing u-boot_kvim3_ab.bin at 0xfffa0000...
[DONE]
Running at 0xfffa0000...
[DONE]
AMLC dataSize=16384, offset=65536, seq=0...
[DONE]
AMLC dataSize=49152, offset=393216, seq=1...
[DONE]
AMLC dataSize=16384, offset=229376, seq=2...
[DONE]
AMLC dataSize=49152, offset=245760, seq=3...
[DONE]
AMLC dataSize=16384, offset=65536, seq=4...
[DONE]
AMLC dataSize=49152, offset=393216, seq=5...
[DONE]
AMLC dataSize=16384, offset=229376, seq=6...
[DONE]
AMLC dataSize=49152, offset=245760, seq=7...
[DONE]
AMLC dataSize=49152, offset=294912, seq=8...
[DONE]
AMLC dataSize=16384, offset=65536, seq=9...
[DONE]
AMLC dataSize=1198960, offset=81920, seq=10...
[DONE]
[BL2 END]
< waiting for any device >
Sending 'bootloader' (1250 KB)                     OKAY [  0.073s]
Writing 'bootloader'                               OKAY [  0.077s]
Finished. Total time: 0.444s
Erasing 'bootenv'                                  OKAY [  0.019s]
Finished. Total time: 0.061s
OKAY [  0.012s]
Finished. Total time: 0.012s
Rebooting into bootloader                          OKAY [  0.004s]
Finished. Total time: 0.054s
< waiting for any device >

The flash.sh:

$ cat flash.sh 
#! /bin/bash


# For vim3
export BOOTLOADER_NAME=u-boot_kvim3_ab.bin

boot-g12.py ${BOOTLOADER_NAME}

fastboot flash bootloader ${BOOTLOADER_NAME}

fastboot erase bootenv && fastboot oem format && fastboot reboot bootloader

fastboot devices

fastboot flash boot_a boot.img && fastboot flash boot_b boot.img && fastboot flash super super.img && fastboot flash userdata userdata.img && fastboot flash dtbo_a dtbo-unsigned.img && fastboot flash dtbo_b dtbo-unsigned.img && fastboot erase misc && fastboot erase frp && fastboot format metadata && fastboot flash vbmeta_a vbmeta.img && fastboot flash vbmeta_b vbmeta.img && fastboot reboot

How to resolve it?

I already have chmod +x /usr/bin/fastboot

But the fastboot is:
$ file /usr/bin/fastboot
/usr/bin/fastboot: symbolic link to …/lib/android-sdk/platform-tools/fastboot

Should the +s flag apply to the real fastboot instead of symbol link file?

Note that after executing the above command, you need to press the R (Reset) button

@xiong.zhang When I try to repo init kernel code, it hints:

$ ~/bin/repo  init -u https://gitlab.baylibre.com/baylibre/amlogic/atv/aosp/kernel/manifest.git -b yukawa-android-14-6.1
Downloading Repo source from https://mirrors.tuna.tsinghua.edu.cn/git/git-repo
remote: Enumerating objects: 9000, done.
remote: Counting objects: 100% (5143/5143), done.
remote: Compressing objects: 100% (2601/2601), done.
remote: Total 9000 (delta 4920), reused 2542 (delta 2542), pack-reused 3857
Receiving objects: 100% (9000/9000), 3.18 MiB | 1.78 MiB/s, done.
Resolving deltas: 100% (6190/6190), done.

... A new version of repo (2.48) is available.
... You should upgrade soon:
    cp /home/XXXX/android/khadas-aosp-14_kernel/.repo/repo/repo /home/XXXX/bin/repo


manifests:
fatal: couldn't find remote ref refs/heads/yukawa-android-14-6.1
manifests: sleeping 4.0 seconds before retrying
fatal: cannot obtain manifest https://gitlab.baylibre.com/baylibre/amlogic/atv/aosp/kernel/manifest.git
================================================================================
Repo command failed: UpdateManifestError
        Unable to sync manifest default.xml

How can I resolve this issue?

mkdir ~/src/khadas-kernel/ && cd $_
repo init -u BayLibre / amlogic / Android TV / aosp / kernel / manifest · GitLab -b yukawa-android-14-6.1
repo sync

@xiong.zhang Now I want to add modify the kernel menuconfig, I just added following lines to enable the serial in common/arch/arm64/configs/amlogic_gki.fragment:

CONFIG_USB_SERIAL=y
CONFIG_USB_SERIAL_GENERIC=y
CONFIG_USB_SERIAL_OPTION=y
CONFIG_USB_SERIAL_PL2303=y
CONFIG_USB_SERIAL_FTDI_SIO=y
CONFIG_USB_SERIAL_CH341=y

#CONFIG_USB_ACM=y

But build failed:

ERROR: Unable to find drivers/usb/serial/ftdi_sio.ko in any of the following directories:
  bazel-out/k8-fastbuild/bin/yukawa-device/yukawa/staging/lib/modules/6.1.25-android14-11-maybe-dirty/kernel
Unable to find drivers/usb/serial/usbserial.ko in any of the following directories:
  bazel-out/k8-fastbuild/bin/yukawa-device/yukawa/staging/lib/modules/6.1.25-android14-11-maybe-dirty/kernel
Target //yukawa-device:yukawa_dist failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /home/XXX/android/khadas-aosp-14_kernel/yukawa-device/BUILD.bazel:262:17 Middleman _middlemen/yukawa-device_Syukawa_Udist-runfiles failed: (Exit 1): bash failed: error executing KernelBuild command (from target //yukawa-device:yukawa) /bin/bash -c ... (remaining 1 argument skipped)

How can I enable them correctly, include the USB_ACM ?

The serial port you compiled by default can be used

This AOSP is only for trial use, and many of these compilations may not be effective and usable. Please be aware

@xiong.zhang
The problem now is that I cannot build the kernel module or make some driver built-in after changing the fragment file( common/arch/arm64/configs/amlogic_gki.fragment :), you can check the compiling log in the previous post, can you help to tell me how to make these driver building without error, or how to enable them correctly?

@xiong.zhang Now I can build the kernel module, but it hints the modules should be copied:

ERROR: The following kernel modules are built but not copied. Add these lines to the module_outs attribute of @//yukawa-device:yukawa:
    "drivers/usb/serial/option.ko",
    "drivers/usb/serial/usb_wwan.ko",
    "drivers/usb/serial/ch341.ko",
    "drivers/usb/serial/pl2303.ko",
Alternatively, install buildozer and execute:
  $ buildozer 'add module_outs drivers/usb/serial/option.ko
drivers/usb/serial/usb_wwan.ko
drivers/usb/serial/ch341.ko
drivers/usb/serial/pl2303.ko' @//yukawa-device:yukawa
See https://github.com/bazelbuild/buildtools/blob/master/buildozer/README.md for reference
Target //yukawa-device:yukawa_dist failed to build
Use --verbose_failures to see the command lines of failed build steps.

Any tips to resolve it?

@xiong.zhang How can I remount the vendor partition and system partition to read write (rw) mode so I can copy file into it?

Also, how can I enlarge the vendor partition?

$ adb remount
Device must be bootloader unlocked