Building Android for VIM3 according to directions

@RDFTKV
I officially withdraw my newbie status and move firmly into the beginner plus category.
I have worked out all the packages needed to repo sync and compile under Ubuntu 20.04 and have a compile operation of the VIM3 Android 11 AOSP going right now :slight_smile:

Now all I have to work out when its done is how to flash it to the VIM3 :slight_smile:

1 Like

Ubuntu 20.04 prep steps: I had an abundance of issues until I did sudo for almost everything.

Sudo apt update
sudo apt upgrade
sudo apt install openssh-server screen python git openjdk-8-jdk android-tools-adb bc bison
build-essential curl flex g+±multilib gcc-multilib gnupg gperf imagemagick lib32ncurses-dev
lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev
libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc yasm zip zlib1g-dev
libtinfo5 libncurses5

sudo snap install git-repo
sudo wget ‘https://storage.googleapis.com/git-repo-downloads/repo’ -P /usr/local/sbin/
sudo chmod +x /usr/local/sbin/repo
sudo apt install git-lfs
sudo git config --global user.email “youremail@domain.com”
sudo git config --global user.name “Your Name”

  • Prerequisites done - now to sync repo

mkdir -p “workspace name of your choice”
cd “whatever named folder you did above”
sudo repo init -u platform/manifest - Git at Google -b master
sudo repo sync -j3

Android Build Env instructions : (no sudo on these steps)

. ./build/envsetup.sh
lunch yukawa-userdebug
make TARGET_USE_TABLET_LAUNCHER=true TARGET_VIM3=true TARGET_KERNEL_USE=5.4 -j3

Notes:
I only use -j3 as my cpu is a four core i5 desktop CPU and I want to keep one core free.
If your CPU has more cores or HT by all means increase -jxx to suit. On my i9 at work I would do -j18
I suggest more than 16gb ram, I had 16 and it was complaining but I had some spare 4gb sticks so I expanded to 24Gb if you have a bunch more threads to process with you may need more than that.

build completed successfully (05:17:36 (hh:mm:ss))

I have also found that the flashing instructions on the BayLibre Github page do not work under Ubuntu 20.04 unless you do a sudo -s first

2 Likes

@goenjoy
Can you (or anyone else) help me with a few things please:

  1. in building the AOSP do I need to build the kernel separately?
    I ask this one because it appears as I follow the directions I repo sync -> Build AOSP -> Flash Android Boot-loader-> Flash Android Images -> Build Kernel Source -> rebuild and flash your board…???

It seams strange to me that I have to build the kernel and flash it in AFTER the other steps??
it seems like I should build the kernel before the flash, not after and then flash again??

  1. The toolchains outlined in the instructions @ Install Extra Toolchains For The Amlogic Platform | Khadas Documentation
    Are these required for the Android 11 AOSP ?

  2. in building the kernel I am running into errors:
    ale@ShopUB20:~/workspace-andy11/hikey-linaro$ export PATH=workspace-andy11/prebuilts/clang/host/linux-x86/clang-r399163b/bin:$PATH
    dale@ShopUB20:~/workspace-andy11/hikey-linaro$ export PATH=workspace-andy11/prebuilts/gas/linux-x86:$PATH
    dale@ShopUB20:~/workspace-andy11/hikey-linaro$ export PATH=workspace-andy11/prebuilts/misc/linux-x86/lz4:$PATH
    dale@ShopUB20:~/workspace-andy11/hikey-linaro$ export ARCH=arm64
    dale@ShopUB20:~/workspace-andy11/hikey-linaro$ export CROSS_COMPILE=aarch64-linux-gnu-
    dale@ShopUB20:~/workspace-andy11/hikey-linaro$ export LLVM=1
    dale@ShopUB20:~/workspace-andy11/hikey-linaro$ sudo make meson_defconfig


*** Can’t find default configuration “arch/x86/configs/meson_defconfig”!


make[1]: *** [scripts/kconfig/Makefile:90: meson_defconfig] Error 1
make: *** [Makefile:591: meson_defconfig] Error 2
dale@ShopUB20:~/workspace-andy11/hikey-linaro$

I tried to flash the android image into the VIM3 and ran into a non bootable device.

Thanx

@jasonl Please help with this compilation error.

1 Like

In most cases you shouldn’t need to compile the kernel separately, although this does seem to be the case of android R (11.x) the practice of pre building the kernel image, at least from what I’ve seen. If the rom you are building is pie based and the rom isn’t able to compile properly, you might be missing a prerequisite for building the kernel.

@JustSumDad for android 11 aosp ,
1 : building the AOSP do not need to build the kernel separately ,under device/amlogic/yukawa-kernel directory has kernel image
2 : no need to install toolchains outlined in the instructions
3 : export AOSP_TOPDIR=/home/lxx/Downloads/android_pie/vim3l
export PATH=${AOSP_TOPDIR}/prebuilts/clang/host/linux-x86/clang-r399163b/bin:$PATH
export PATH=${AOSP_TOPDIR}/prebuilts/gas/linux-x86:$PATH
export PATH=${AOSP_TOPDIR}/prebuilts/misc/linux-x86/lz4:$PATH
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
export LLVM=1
make meson_defconfig
make DTC_FLAGS="-@" -j10
these is my kernel build steps ,you can reference
only according to the docs Khadas_VIM3 · Wiki · BayLibre / amlogic / Android TV / aosp / device / amlogic / yukawa · GitLab

2 Likes

The link you have provided for reference is the one I am following. I the only error I can decern is the setting of the variable APSP_TOPDIR=
I believe I should use:
export AOSP_TOPDIR=workspace-andy11

but it still did not work:

dale@ShopUB20:~$ export AOSP_TOPDIR=workspace-andy11
dale@ShopUB20:~$ cd ${AOSP_TOPDIR}
dale@ShopUB20:~/workspace-andy11$ export PATH=${AOSP_TOPDIR}/prebuilts/clang/host/linux-x86/clang-r399163b/bin:$PATH
dale@ShopUB20:~/workspace-andy11$ export PATH=${AOSP_TOPDIR}/prebuilts/gas/linux-x86:$PATH
dale@ShopUB20:~/workspace-andy11$ export PATH=${AOSP_TOPDIR}/prebuilts/misc/linux-x86/lz4:$PATH
dale@ShopUB20:~/workspace-andy11$ export ARCH=arm64
dale@ShopUB20:~/workspace-andy11$ export CROSS_COMPILE=aarch64-linux-gnu-
dale@ShopUB20:~/workspace-andy11$ export LLVM=1
dale@ShopUB20:~/workspace-andy11$ cd hikey-linaro
dale@ShopUB20:~/workspace-andy11/hikey-linaro$ make meson_defconfig
mkdir: cannot create directory ‘.tmp_2347’: Permission denied
mkdir: cannot create directory ‘.tmp_2349’: Permission denied
mkdir: cannot create directory ‘.tmp_2351’: Permission denied
mkdir: cannot create directory ‘.tmp_2353’: Permission denied
mkdir: cannot create directory ‘.tmp_2355’: Permission denied
mkdir: cannot create directory ‘.tmp_2357’: Permission denied
mkdir: cannot create directory ‘.tmp_2359’: Permission denied
HOSTCC scripts/basic/fixdep
/bin/sh: 1: clang: not found
make[1]: *** [scripts/Makefile.host:107: scripts/basic/fixdep] Error 127
make: *** [Makefile:524: scripts_basic] Error 2
dale@ShopUB20:~/workspace-andy11/hikey-linaro$ sudo make meson_defconfig


*** Can’t find default configuration “arch/x86/configs/meson_defconfig”!


make[1]: *** [scripts/kconfig/Makefile:90: meson_defconfig] Error 1
make: *** [Makefile:591: meson_defconfig] Error 2

cd ${AOSP_TOPDIR}
git clone platform/prebuilts/gas/linux-x86 - Git at Google prebuilts/gas/linux-x86 according to link above
have you done it ?

yes, I am following the guide very carefully, I think both the things you just asked are in the cut paste above. Or maybe I am not recognizing them correctly?

I have deleted my “workspace-andy11” folder as a friend told me that problems happen with folder and computer names with a dash in them. I am starting from scratch with “aosp” as my folder name now.
I will follow every step very carefully following the 5.4 make.
I will test boot after first flash before the separate kernel build stages that appear not needed.

@jasonl

if I want to recompile from scratch all I should have to do is remove the “out” folder right?
sudo rm -r -f out

is this correct?

also, I have been having a lot of issues with each step so I have been sudo a lot.
Today in an effort to get around all the problems I have started from scratch but running in a sudo -s environment, not done yet but so far seems ok.

is this the correct way to do this?

Thanx

no need to remove out if you only to build 5.4 kernel ,i found that you build kernel not under kernel source ? did you download kernel source ?

I am uncertain what your saying here…

I thought you said I did not need to build the kernel separately?

I am building from this line that appears to build kernel as well as all images:

make TARGET_USE_TABLET_LAUNCHER=true TARGET_VIM3=true TARGET_KERNEL_USE=5.4 -j20

do I need to download and build the kernel separately??

I have now gone thru the steps maybe twenty times, loaded fresh ubuntu at least a dozen times.
I can go thru the steps with ZERO errors! Total apparent success!
Even the image flashing steps go thru!

Sadly I do not get a boot-able device out of it tho :frowning:

The only thing that I have not been able to get to work is the separate and I think supposedly not needed kernel build steps, they error out no matter what I do!!!
This last time I ran the entire process end to end on a fresh loaded ubuntu 20.04 system under a sudo -i environment to ensure there was no way some folder permission or other thing was holding me back. Same as before tho, every step zero errors EXCEPT the separate kernel build steps… That I think are not needed unless you want to change kernel version…

root@ub20usb:~/aosp# cd hikey-linaro
root@ub20usb:~/aosp/hikey-linaro# make meson_defconfig
HOSTCC scripts/basic/fixdep
/bin/sh: 1: clang: not found
make[1]: *** [scripts/Makefile.host:107: scripts/basic/fixdep] Error 127
make: *** [Makefile:524: scripts_basic] Error 2
root@ub20usb:~/aosp/hikey-linaro#

I gotta take a break. I dont want to get frustrated and throw this thing at something hard :frowning:

1 Like

I don’t think the kernel is the issue. but just to confirm, when you try to boot the device with the newly compiled rom, do you get the white led blinking?

yes, it blinks like its loading something but nothing on the screen.
I thought maybe it was a resolution compatibility issue so I tried it on two monitors and a 4k TV too.

It’s the U-Boot. Try to use an older U-Boot. For some reason the current one if giving this issue

1 Like

oik, thanx

I took a look at the uboot area of the wiki but I did not see where I could get an older one…

can I extract the boot.img from one of the Khadas supplied PIE9 images and just substitute into my out/target/product/yukawa directory and reflash?

Zong!! You did it!

I went and found the u-boot_kvim3_noab.bin file you made back in Nov and posted up!
dropped it into the aosp/device/amlogic/yukawa/bootloader/ folder over writeing the one I had.

redid the flash and…

This worked, I have a booting up Android 11 Vim3 now :slight_smile:

time to check this out…

1 Like

now that I am booted up, I see that it is reporting an ATV build.
Is this because perhaps the u-boot_kvim3_noab.bin I got from your build is an ATV build?

I am getting corrupted memory on pretty much everything, it boots lets me look around but all memory seems useless, its also reporting 16gb ram rather than 32gb.

Not complaining on you :slight_smile: Just wondering if this is due to the U-Boot mismatch maybe?

It’s possible, but i also ran it with one of the previous uboots and it’s working for me. Userdata may just need to be reflashed or maybe the whole thing needs to be redone, not too sure.