I recently acquired a VIM4 and some supporting accessories to replace a tablet I installed in my car several years back. I wanted to switch to a more modern device that might afford me better capabilities than a tablet that was impossible to keep charged (I did not drive the vehicle enough)
Getting the VIM to work well in an automotive setting meant I would need to change the Android image to enable a secondary logic board to help manage its power. While I have plenty of experience with Linux and as an Android user, Iāve never tried building a custom Android ROM. It was a little more complicated than the old āconfigure, make, make image.ā
This post contains the notes I took during this journey. Iām leaving them here in the hope that they may help another person get started with a custom rom on the VIM4. Note, I am running all of this from a Debian 12 (Bookworm).
Preparing for the Build
- Make sure you have a ton of disk space in your build root. I have a filesystem dedicated to this, and itās sitting at 95% of 480GB after a successful build.
- Khadas Docs: VIM4 Build Android [Khadas Docs]
- Build out the prerequisites in the AOSP documentation. Donāt bother downloading the source tree from the AOSP project; you will be pulling the Android source from Khadas instead (see next document).
- You will download Android as part of the VIM4 Build Android [Khadas Docs] document. However, there are a couple of gotchaās I ran into.
- This may have been my fault, but I did need to pull large files from git (git lfs pull) in two different locations:
${PROJECT_ROOT}/device/khadas
${PROJECT_ROOT}/common
- This may have been my fault, but I did need to pull large files from git (git lfs pull) in two different locations:
- I had to install these supporting packages as part of the process. Note that there may be more; read the docs!
android-tools-adb git-core gnupg flex bison build-essential zip curl zlib1g-dev libc6-dev-i386 x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig repo openjdk-17-jdk automake make git gperf zip dos2unix bison perl gcc g++ tig pkg-config cpp-aarch64-linux-gnu libssl-dev gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu libncurses5 libncurses5-dev minicom
The Build
- I highly recommend using the ādemo.shā script from the VIM4 Build Android [Khadas Docs] document.
- As I am cross-compiling, I had to set compiler flags for the Android build. Oddly enough, I did not need it for the u-boot or kernel builds (the flags caused build failures for u-boot or the kernel, but I donāt recall which). Next build, Iāll move these into the demo.sh to make my life easier
export CROSS_COMPILE=aarch64-linux-gnu-
export ARCH=arm64
Burning the ROM
This part was the trickiest for me to figure out. I had hoped that Oowow would allow me to burn the image, but after a couple of hours of playing around, I threw in the towel and hit the documentation again. Alas, while I found documentation, I still needed to figure out how I was to proceed.
The āVIM4 Boot into Upgrade Modeā document noted a method for burning the ROM in serial mode. So I gave it a try, but it ultimately failed (or I missed a step). Then I came across a post in the forums (Flashing Methods). This post showed that the best way to flash the image was to use the āburn-toolā after placing the board in āupgrade mode.ā
One note on the burn-tool, Khadas only supports Ubuntu. I had to modify the install script to make it function on Debian, but once installed it seems to be working ok.
I hope someone might find this helpful. Cheers!