Lichee (two) compiled under the Sun4i_crane platform

Source: Internet
Author: User

Let's review the compile command first.$ cd Workdir/lichee$./build.sh-p Sun4i_crane-k 3.0
build.sh under the Lichee folder
#!/bin/bashset-ebuildroot/scripts/common.sh [email protected]


Build.sh's content is so simple. Valid content is 2 lines. See First line SET-Ethe-e parameter of the SET command. Linux comes with instructions such as the following:"Exit immediately if a simple command exits with a Non-zero status."
Other words. In the code that appears after "Set-e", once the return value is nonzero, the entire script exits immediately.
1. Run build.sh under the BuildRoot folderin buildroot/scripts/common.sh, because we do not have a module parameter, we are not just compiling individual modules. Instead of BuildRoot linux3.0 U-boot, these 3 will be compiled at once .
The key contents of the compilation BuildRoot in Buildroot/scripts/common.sh are as follows:

Br_dir = Buildrootplatform = Sun4i_cranecd ${br_dir} &&./build.sh-p ${platform}

the core content of buildroot/build.sh is
if [-X./scripts/build_${platform}.sh]; Then./scripts/build_${platform}.sh $MODULEelse ...    fi

is actually running./buildroot/scripts/build_sun4i_crane.shvalid code such as the following
Export path=${cur_dir}/output/external-toolchain/bin: $PATHif [!-e Output/external-toolchain];thencd outputtar-jxf. /DL/ARM-2010.09-50-ARM-NONE-LINUX-GNUEABI-I686-PC-LINUX-GNU.TAR.BZ2 mv arm-2010.09 External-toolchain fi


It is obvious that BuildRoot's pre-work is based on the value of ${platform} and uses the cross-compilation tool chain ARM-2010.09-50-ARM-NONE-LINUX-GNUEABI-I686-PC-LINUX-GNU.TAR.BZ2 is the cross-compiler tool chain for Android. at this point, the Android version number under the Sun4i platform is builtroot work is complete.
2. Compiling the kernelThe key contents of the compilation linux-3.0 in Buildroot/scripts/common.sh are as follows:

Export Path=${br_out_dir}/external-toolchain/bin: $PATH CD ${kern_dir} &&./build.sh-p ${platform}-v ${vendor}

The next step is to set the BuildRoot unzipped Android toolchain to path. followed by running the build.sh script in linux3.0.
./.linux-3.0/build.sh
... if [-X./scripts/build_${platform}.sh]; Then./scripts/build_${platform}.sh $MODULEelse printf "\nerror:invalid platform\n" Show_help exit 1fi ...


Similarly , Linux-3.0/build.sh's focus is on running linux/script/build_sun4i_crane.sh, and we've found this script file
./linux/script/build_sun4i_crane.sh
after a simple analysis, we found that the most important 2 shell functions of compiling kernel is Build_kernel () Build_modules (), through our analysis of Lichee (a)--—— Lichee folder structure Introduction and compilation command), Kernel compilation is mostly compiled for module modules that the standard kernel has already provided to the manufacturer Tips :here to talk about the meaning of the modules module. The Sun4i platform is a common driver or its own unique driver included in a separate modules down. can greatly reduce coupling. Even without changing the original kernel configuration or code, you can complete a new product porting

because of the key, the next analysis of the entire build_kernel () function
Build_kernel () {#假设没有配置过kernel run the CP arch/arm/configs/sun4i_crane_defconfig. config, use the preset configuration if [!-E. config]; then Ech O-E "\n\t\tusing Default Config ...! \ n "CP arch/arm/configs/sun4i_crane_defconfig. config fi# compile standby module build_standby# specify BuildRoot tool chain to make uimage make Arch=${arch} cross_compile=${cross_compile}-j8 uimage Modules Update_kern_ver If [-D output]; Then Rm-rf output fi mkdir-p $LICHEE _mod_dir# through buildroot/output/external-toolchain/bin/ The arm-none-linux-gnueabi-objcopy command generates a bimage file ${objcopy}-R. note.gnu.build-id-s-o binary vmlinux output/bimage cp-vf ar Ch/arm/boot/[zu]image output/cp. config output/#拷贝重要文件夹下的模块文件 *.ko to ${lichee_mod_dir} lichee/modules folder for file in $ (fi nd drivers sound crypto block FS security net-name "*.ko"); Do CP $file ${lichee_mod_dir} done cp-f module.symvers ${lichee_mod_dir} #cp-f modules.* ${lichee_mod_dir} #copy bcm433 0 firmware and nvram.txt CP drivers/net/wireless/bcm4330/firmware/bcm4330.bin ${LICHEE_MOD_DIR} CP drivers/NET/WIRELESS/BCM4330/FIRMWARE/BCM4330.HCD ${lichee_mod_dir} CP drivers/net/wireless/bcm4330/firmware/nvram.txt ${ Lichee_mod_dir}/bcm4330_nvram.txt CP Drivers/net/wireless/bcm4330/firmware/mw269v3_fw.bin ${LICHEE_MOD_DIR} CP Drivers/net/wireless/bcm4330/firmware/mw269v3_nvram.txt ${lichee_mod_dir} CP drivers/net/wireless/rtxx7x/ RT2870STA.dat ${lichee_mod_dir} cp drivers/net/wireless/rtxx7x/rt2870stacard.dat ${lichee_mod_dir}}



and the Build_modules () function is the Modules folder under the various modules, assuming that the source code is compiled and copied in Make-c way. Assuming that the. ko file is copied directly
3. Compiling ubootThe key contents of the compilation U-boot in Buildroot/scripts/common.sh are as follows:

echo "Build Uboot for ${platform}" CD ${u_boot_dir} &&./build.sh-p sun4i-v ${vendor}


relative to Kernel. The build.sh in the Uboot folder is much simpler.
if ["$PLATFORM" = "Sun4i_crane"]; Then
Make Distclean && make-j4 sun4i cross_compile=arm-none-linux-gnueabi-else make Distclean && make-j4 $PLA Tform Cross_compile=arm-none-linux-gnueabi-fi


But after a simple clean, we compile again.
at this point it seems that the complex Lichee is coming down through a main context. We are very clear, we also have a general understanding of Lichee The main composition of this project, as a qualified Bspproject division, to achieve the self-initiated compilation packaging is a minimum requirement, which can also give us a future compilation package design to provide a reference.





Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

Lichee (two) compiled under the Sun4i_crane platform

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.