,

Allwinner H6 OrangePi Lite2 Android 7.0 source code compilation

Install compilation dependencies sudo apt-get install git gnupg flex bison gperf build-essential \ zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \ lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache \ libgl1-mesa-dev libxml2-utils xsltproc unzip Install the u-boot-tools tool lemon@ubuntu:~$ sudo apt-get install u-boot-tools Create a repository, add source commits, as First Commit, the underlying code lemon@ubuntu:~/Develop/OrangePi_Lite2$ git init Initialized…


Install compilation dependencies

sudo apt-get install git gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip

Install the u-boot-tools tool

lemon@ubuntu:~$ sudo apt-get install u-boot-tools

Create a repository, add source commits, as First Commit, the underlying code

lemon@ubuntu:~/Develop/OrangePi_Lite2$ git init
Initialized empty Git repository in /home/lemon/Develop/OrangePi_Lite2/.git/
lemon@ubuntu:~/Develop/OrangePi_Lite2$ 
lemon@ubuntu:~/Develop/OrangePi_Lite2$ ll
total 20
drwxr-xr-x 5 lemon lemon 4096 Sep 1 09:58 ./
drwxr-xr-x 4 lemon lemon 4096 Sep 1 09:23 ../
drwxr-xr-x 28 lemon lemon 4096 Nov 22 2017 android/
drwxr-xr-x 7 lemon lemon 4096 Sep 1 09:58 .git/
drwxr-xr-x 8 lemon lemon 4096 Nov 22 2017 lichee/
lemon@ubuntu:~/Develop/OrangePi_Lite2$ 
lemon@ubuntu:~/Develop/OrangePi_Lite2$ git add .
lemon@ubuntu:~/Develop/OrangePi_Lite2$ git commit -m "Init Code"

Compile the kernel source

lemon@ubuntu:~/Develop/OrangePi_Lite2/lichee$ ./build.sh config

Welcome to mkscript setup progress
All available chips:
	0. sun50iw1p1
	1. sun50iw2p1
	2. sun50iw6p1
	3. sun8iw11p1
	4. sun8iw12p1
	5. sun8iw6p1
	6. sun8iw7p1
	7. sun8iw8p1
	8. sun9iw1p1
Choice: 2
All available platforms:
        0. android
	1. dragonboard
	2. linux
	3. eyeseelinux
Choice: 0
All available business:
	0. 5.1
	1. 4.4
	2. 7.x
Choice: 2
LICHEE_BUSINESS=7.x
using kernel 'linux-3.10':
select arch by kernel version and chip
==================================
INFO: ----------------------------------------
INFO: build lichee ...
INFO: chip: sun50iw6p1
INFO: platform: android
INFO: business: 7.x
INFO: kernel: linux-3.10
INFO: arch: arm64
INFO: board: 
INFO: output: out/sun50iw6p1/android/
INFO: ----------------------------------------
INFO: build buildroot ...
installing external toolchain
please wait for a few minutes ...
INFO: build buildroot OK.
INFO: build kernel ...
INFO: prepare toolchain ...
cat: /home/lemon/Develop/OrangePi_Lite2/lichee/linux-3.10/.config: No such file or directory no file name,use gz
Building kernel
/home/lemon/Develop/OrangePi_Lite2/lichee/linux-3.10/output/lib/modules/3.10.65
Copy rootfs for arm64

Using default config sun50iw6p1smp_android_7.x_defconfig ...

Kernel compilation error

output/lib/modules/3.10.65/dma-buf-test-exporter.ko'
make: Leaving directory '/home/lemon/Develop/OrangePi_Lite2/lichee/linux-3.10/modules/gpu'
[GPU]: mali-t720 device driver has been built.
regenerate rootfs cpio
15757 blocks
17099 blocks
awk: line 2: function strtonum never defined
awk: line 2: function strtonum never defined
ERROR: build kernel Failed

Solutions:-

sudo apt-get install gawk

Compiled successfully after modification

make: Leaving directory '/home/lemon/Develop/OrangePi_Lite2/lichee/linux-3.10/modules/gpu'
[GPU]: mali-t720 device driver has been built.
regenerate rootfs cpio
15757 blocks
17099 blocks
build_ramfs
Copy boot.img to output directory ...
Copy modules to target ...

sun50iw6p1 compile Kernel successful

INFO: build kernel OK.
INFO: build rootfs ...
INFO: skip make rootfs for android
INFO: build rootfs OK.
----------------------------------------
build sun50iw6p1 android 7.x lichee OK
----------------------------------------

Note:- 

After the configuration is successful, the next time you can run directly in the lichee directory ./build.sh will continue to use the last configuration of .config, if you change, you need to re-select.

Compile u-boot

lemon@ubuntu:~/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07$ make distclean && make sun50iw6p1_config && make -j8
Makefile:1216: *** missing separator. Stop.

Solutions:-

lemon@ubuntu:~/Develop/OrangePi_Lite2$ git diff lichee/brandy/u-boot-2014.07/Makefile
diff --git a/lichee/brandy/u-boot-2014.07/Makefile b/lichee/brandy/u-boot-2014.07/Makefile
index 295d766..b2cb3b2 100755
--- a/lichee/brandy/u-boot-2014.07/Makefile
+++ b/lichee/brandy/u-boot-2014.07/Makefile
@@ -1213,7 +1213,7 @@ TAG_SUBDIRS := $(u-boot-dirs) include $(SPLDIR)

 FIND := find
 FINDFLAGS := -L
--R --c++-kinds=+p --fields=+iaS --extra=+q
+#-R --c++-kinds=+p --fields=+iaS --extra=+q
 tags ctags:
               ctags -w -o ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
                                                -name '*.[chS]' -print`

Uboot compiled successfully

  LD examples/standalone/hello_world
  OBJCOPY examples/standalone/hello_world.bin
  OBJCOPY examples/standalone/hello_world.srec
  LD u-boot
  OBJCOPY u-boot.srec
  OBJCOPY u-boot.bin
./tools/add_hash_uboot.sh -f u-boot.bin -m uboot
 build_uboot 
'u-boot.bin' -> 'u-boot-sun50iw6p1.bin'
'u-boot-sun50iw6p1.bin' -> '/home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../tools/pack/chips/sun50iw6p1/bin/u-boot-sun50iw6p1.bin'
if [ -z "" ]; then \
 cp -v u-boot-"sun50iw6p1".bin /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../tools/pack/chips/"sun50iw6p1"/bin/u-boot-"sun50iw6p1".bin; \
else \
 cp -v u-boot-"sun50iw6p1".bin /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../tools/pack/chips/"sun50iw6p1"/bin/u-boot-"sun50iw6p1"-.bin; \
fi
'u-boot-sun50iw6p1.bin' -> '/home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../tools/pack/chips/sun50iw6p1/bin/u-boot-sun50iw6p1.bin'
lemon@ubuntu:~/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07$ 

Compile boot0

lemon@ubuntu:~/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07$ make distclean && make sun50iw6p1_config && make spl

/home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../gcc-linaro/bin/arm-linux-gnueabi-gcc -E -include /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/include/u-boot/u-boot.lds.h -DSBROMSWADDR="(0x20A00)" -ansi -D__ASSEMBLY__ -P - /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../bootloader/uboot_2014_sunxi_spl/sunxi_spl/sbrom/sboot.lds
/home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../gcc-linaro/bin/arm-linux-gnueabi-ld /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../bootloader/uboot_2014_sunxi_spl/sunxi_spl/dram/sun50iw6p1/dram/libchipid.o /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../bootloader/uboot_2014_sunxi_spl/sunxi_spl/dram/sun50iw6p1/dram/libdram.o /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../bootloader/uboot_2014_sunxi_spl/sunxi_spl/sbrom/flash/libflash.o /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../bootloader/uboot_2014_sunxi_spl/sunxi_spl/sbrom/keyladder/libkeyladder.o /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../bootloader/uboot_2014_sunxi_spl/sunxi_spl/sbrom/libs/libgeneric.o /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../bootloader/uboot_2014_sunxi_spl/sunxi_spl/sbrom/load/libload.o /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../bootloader/uboot_2014_sunxi_spl/sunxi_spl/sbrom/main/libmain.o /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../bootloader/uboot_2014_sunxi_spl/sunxi_spl/sbrom/openssl/libopenssl.o /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../bootloader/uboot_2014_sunxi_spl/sunxi_spl/sbrom/spl/libsource_spl.o /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../bootloader/uboot_2014_sunxi_spl/sunxi_spl/spl/lib/libgeneric.o /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/arch/arm/cpu/armv7/sun50iw6p1/nand/libnand.o /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/arch/arm/cpu/armv7/sun50iw6p1/mmc/libmmc.o -L /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/gcc-linaro/bin/../lib/gcc/arm-linux-gnueabi/4.6.3 -lgcc -T/home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../bootloader/uboot_2014_sunxi_spl/sunxi_spl/sbrom/sboot.lds -o sboot.axf -Map sboot.map
/home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../gcc-linaro/bin/arm-linux-gnueabi-objcopy -O binary /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../bootloader/uboot_2014_sunxi_spl/sunxi_spl/sbrom/sboot.axf /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../bootloader/uboot_2014_sunxi_spl/sunxi_spl/sbrom/sboot.bin
/home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../bootloader/uboot_2014_sunxi_spl/sunxi_spl/../../tools/add_hash.sh -f /home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../bootloader/uboot_2014_sunxi_spl/sunxi_spl/sbrom/sboot.bin -m sboot
build_sboot
'sboot_sun50iw6p1.bin' -> '/home/lemon/Develop/OrangePi_Lite2/lichee/brandy/u-boot-2014.07/../../tools/pack/chips/sun50iw6p1/bin/sboot_sun50iw6p1.bin'

Compile Android source code

lemon@ubuntu:~/Develop/OrangePi_Lite2/android$ source ./build/envsetup.sh 
including device/asus/fugu/vendorsetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including device/generic/mini-emulator-mips64/vendorsetup.sh
including device/generic/mini-emulator-mips/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including device/google/dragon/vendorsetup.sh
including device/htc/flounder/vendorsetup.sh
including device/huawei/angler/vendorsetup.sh
including device/lge/bullhead/vendorsetup.sh
including device/linaro/hikey/vendorsetup.sh
including device/moto/shamu/vendorsetup.sh
including device/softwinner/cheetah-cmcc-p1/vendorsetup.sh
including device/softwinner/cheetah-p1/vendorsetup.sh
including device/softwinner/common/vendorsetup.sh
including device/softwinner/petrel-cmcc-p1/vendorsetup.sh
including device/softwinner/petrel-p1/vendorsetup.sh
including sdk/bash_completion/adb.bash
lemon@ubuntu:~/Develop/OrangePi_Lite2/android$ lunch petrel_fvd_p1-eng

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=7.0
TARGET_PRODUCT=petrel_fvd_p1
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a7
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=NRD91N
OUT_DIR=out
============================================
lemon@ubuntu:~/Develop/OrangePi_Lite2/android$ extract-bsp
/home/lemon/Develop/OrangePi_Lite2/android/device/*/petrel-p1/bImage copied!
/home/lemon/Develop/OrangePi_Lite2/android/device/*/petrel-p1/modules copied!

Execute make to compile

lemon@ubuntu:~/Develop/OrangePi_Lite2/android$ make -j8 && pack

[ 0% 364/39294] host Java: antlr-runtime (out/host/common/obj/JAVA_LIBRARIES/antlr-runtime_intermediates/classes)
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[ 1% 591/39294] Lex: libaidl-common <= system/tools/aidl/aidl_language_l.ll
FAILED: /bin/bash -c "prebuilts/misc/linux-x86/flex/flex-2.5.39 -oout/host/linux-x86/obj/STATIC_LIBRARIES/libaidl-common_intermediates/aidl_language_l.cpp system/tools/aidl/aidl_language_l.ll"
flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.
Aborted (core dumped)
[ 1% 591/39294] host Java: guavalib (out/host/common/obj/JAVA_LIBRARIES/guavalib_intermediates/classes)
warning: [options] bootstrap class path not set in conjunction with -source 1.7
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 warning
[ 1% 591/39294] target Java: core-all (out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1

#### make failed to build some targets (01:45 (mm:ss)) ####

Note:-

Also reported an error. . .  this is the Ubuntu 18.04 pot, you need to execute the export before executing the compilation LC_ALL=C

export LC_ALL=C

Successfully compiled

usbtool.fex Len: 0x23600
aultools.fex Len: 0x2847b
aultls32.fex Len: 0x24d23
cardtool.fex Len: 0x11e00
cardscript.fex Len: 0x779
sunxi_mbr.fex Len: 0x10000
dlinfo.fex Len: 0x4000
arisc.fex Len: 0x6
bootloader.fex Len: 0x7d7400
Vbootloader.fex Len: 0x4
env.fex Len: 0x20000
Venv.fex Len: 0x4
boot.fex Len: 0x106d800
Vboot.fex Len: 0x4
system.fex Len: 0x259c2a74
Vsystem.fex Len: 0x4
verity_block.fex Len: 0x1045b4
Vverity_block.fex Len: 0x4
recovery.fex Len: 0x12cd000
Vrecovery.fex Len: 0x4
sysrecovery.fex Len: 0xb
diskfs.fex Len: 0x200
BuildImg 0
Dragon execute image.cfg SUCCESS !
----------image is at----------

/home/lemon/Develop/OrangePi_Lite2/lichee/tools/pack/sun50iw6p1_android_petrel-p1_uart0.img

pack finish

Credit to https://blog.csdn.net/sweetmilkcake/article/details/82534930


Leave a Reply

Discover more from Prabhu System Technology

Subscribe now to keep reading and get access to the full archive.

Continue reading