Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


Sidebar

products:sbc:vim4:development:android:build-android

VIM4 Build Android

Preparations

Building

Make sure you have done all the Preparations listed above before getting started.

Build U-Boot

$ cd PATH_YOUR_PROJECT
$ cd bootloader/uboot
$ ./mk kvim4 --avb2 --vab

Gernerate images in this step:

  • build/u-boot.bin: for onboard eMMC storage booting
  • build/u-boot.bin.sd.bin: for external TF card booting

Build Linux Kernel

$ ./mk kvim4 -v 5.4 -jN

Replace N with the actual number of threads on your own computer.

Build Android

$ cd PATH_YOUR_PROJECT
$ . build/envsetup.sh
$ lunch TARGET_LUNCH
$ make -jN otapackage

Gernerate images in this step: out/target/product/TARGET/update.img.

  • Unlike VIM3, VIM4 doesn't support compiling Android and Linux Kernel at the same time.
  • Replace N with the actual number of threads on your own computer
  • Replace TARGET_LUNCH to your lunch select.
    • For VIM4, it's kvim4-userdebug.

Build Script Demo

demo.sh
$ cat demo.sh
#!/bin/bash
 
#build U-Boot
if [ "$1" == 'u' ] || [ "$1" == 'n' ]; then	
	echo "build U-Boot"
	cd bootloader/uboot
	./mk kvim4 --avb2 --vab 
	cd -
fi
 
#build Kernel
if [ "$1" == 'k' ] || [ "$1" == 'n' ]; then
	echo "build Kernel"
if [ "$2" == 'n' ] || [ "$1" == 'n' ]; then
	. build/envsetup.sh 
	lunch kvim4-userdebug 
	make distclean
fi	
	./mk kvim4 -v 5.4 -j100
fi
 
#build Android
if [ "$1" == 'a' ] || [ "$1" == 'n' ]; then
	echo "build Android"
if [ "$2" == 'n' ] || [ "$1" == 'n' ]; then
	. build/envsetup.sh 
	lunch kvim4-userdebug 
	make clean
fi	 
	. build/envsetup.sh 
	lunch kvim4-userdebug 
	make installclean
	#make -j80 otapackage
	make -j80
fi

Build U-Boot:

$ ./demo.sh u

Build Kernel:

$ ./demo.sh k

Build Android:

$ ./demo.sh a

Build all:

$ ./demo.sh n
Last modified: 2023/08/22 21:23 by goenjoy