learning armbian steps(10) ----- armbian 源码分析(五)
在上一节的分析当中,已经知道了uboot kernel的源代码路径及编译选项,以及rootfs的版本,相关信息如下所示:
## BUILD CONFIGURATION Build target:
Board: iotx-3
Branch: default
Desktop: Kernel configuration:
Repository: git://git.ti.com/processor-sdk/processor-sdk-linux.git
Branch: branch:processor-sdk-linux-04.03.00
Config file: linux-cloudwsn-default U-boot configuration:
Repository: git://git.ti.com/ti-u-boot/ti-u-boot.git
Branch: branch:ti-u-boot-2017.01
Config file: am335x_iotx3_config Partitioning configuration:
Root partition type: ext4
Boot partition type: (none)
User provided boot partition size: 0
Offset: 4 CPU configuration:
- with interactive
Displaying message: Downloading sources info
Displaying message: Checking git sources u-boot-am335x ti-u-boot-2017.01 info
继续回到/ib/mian.sh当中
# optimize build time with % CPU usage
CPUS=$(grep -c 'processor' /proc/cpuinfo)
if [[ $USEALLCORES != no ]]; then
CTHREADS="-j$(($CPUS + $CPUS/2))"
else
CTHREADS="-j1"
fi start=`date +%s`
219-225行的代码用来判断是否满负荷编译代码
227行,将编译的起始秒数保存至start变量当中。
接着看lib/main.sh脚本:
[[ $CLEAN_LEVEL == *sources* ]] && cleaning "sources" # ignore updates help on building all images - for internal purposes
# fetch_from_repo <url> <dir> <ref> <subdir_flag>
if [[ $IGNORE_UPDATES != yes ]]; then
display_alert "Downloading sources" "" "info"
fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes"
fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes"
if [[ -n $ATFSOURCE ]]; then
fetch_from_repo "$ATFSOURCE" "$ATFDIR" "$ATFBRANCH" "yes"
fi
fetch_from_repo "https://github.com/linux-sunxi/sunxi-tools" "sunxi-tools" "branch:master"
fetch_from_repo "https://github.com/rockchip-linux/rkbin" "rkbin-tools" "branch:29mirror"
fetch_from_repo "https://github.com/MarvellEmbeddedProcessors/A3700-utils-marvell" "marvell-tools" "branch:A3700_utils-armada-17.10"
fetch_from_repo "https://github.com/armbian/odroidc2-blobs" "odroidc2-blobs" "branch:master"
fi if [[ $BETA == yes ]]; then
IMAGE_TYPE=nightly
elif [[ $BETA != "yes" && $BUILD_ALL == yes && -n $GPG_PASS ]]; then
IMAGE_TYPE=stable
else
IMAGE_TYPE=user-built
fi
228-252行代码:主要是用于通过git 拉取相关的代码。相关的源代码会保存至caach/sources 目录下面,如下所示, 默认的IMAGE_TYPE=user-built
cache/sources$ ls -al
total
drwxrwxr-x root root 1月 : .
drwxrwxr-x root sudo 1月 : ..
drwxrwxr-x root root 1月 : armbian-config
drwxrwxr-x root root 1月 : armbian-firmware
drwxrwxr-x root root 1月 : armbian-firmware-full
drwxrwxr-x root root 1月 : armbian-firmware-git
drwxrwxr-x root root 1月 : hostapd-cloudwsn
drwxrwxr-x root root 1月 : linux-am335x
drwxrwxr-x root root 1月 : marvell-tools
drwxrwxr-x root root 1月 : odroidc2-blobs
drwxrwxr-x root root 1月 : rkbin-tools
drwxrwxr-x root root 1月 : rs485-cloudwsn
drwxrwxr-x root root 1月 : rt8188eu
drwxrwxr-x root root 1月 : sunxi-tools
drwxrwxr-x root root 1月 : u-boot-am335x
继续阅读lib/main.sh
compile_sunxi_tools
install_rkbin_tools
这两个工具在自已配置的板子上面是用不到的,所示跳过不分析。
这个跟厂家的镜像打包有关系统,比如rockchip的RK3328 会通过rkbin_tools工具将其uboot kernel rootfs,打包成GPT格式的镜像。
通过dd命令或者通过带校验功能的etcher命令进行烧录。
继续阅读lib/main.sh 257行开始:
BOOTSOURCEDIR=$BOOTDIR/${BOOTBRANCH##*:}
LINUXSOURCEDIR=$KERNELDIR/${KERNELBRANCH##*:}
[[ -n $ATFSOURCE ]] && ATFSOURCEDIR=$ATFDIR/${ATFBRANCH##*:} # define package names
DEB_BRANCH=${BRANCH//default}
# if not empty, append hyphen
DEB_BRANCH=${DEB_BRANCH:+${DEB_BRANCH}-}
CHOSEN_UBOOT=linux-u-boot-${DEB_BRANCH}${BOARD}
CHOSEN_KERNEL=linux-image-${DEB_BRANCH}${LINUXFAMILY}
CHOSEN_ROOTFS=linux-${RELEASE}-root-${DEB_BRANCH}${BOARD}
CHOSEN_DESKTOP=armbian-${RELEASE}-desktop
CHOSEN_KSRC=linux-source-${BRANCH}-${LINUXFAMILY}
相关的变量如下所示:
BOOTSOURCEDIR=u-boot-am335x/ti-u-boot-2017.01
LINUXSOURCEDIR=linux-am335x/processor-sdk-linux-04.03.00
CHOSE_UBOOT=linux-u-boot-iotx-3
CHOSE_KERNEL=linux-image-cloudwsn
CHOSE_ROOTFS=linux--root-iotx-3
CHOSE_DESKTOP=armbian--desktop
CHOSE_KSRC=linux-source-default-cloudwsn
继续阅读lib/main.sh
# Compile u-boot if packed .deb does not exist
if [[ ! -f $DEST/debs/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb ]]; then
if [[ -n $ATFSOURCE ]]; then
compile_atf
fi
compile_uboot
fi # Compile kernel if packed .deb does not exist
if [[ ! -f $DEST/debs/${CHOSEN_KERNEL}_${REVISION}_${ARCH}.deb ]]; then
compile_kernel
fi
上述的代码主要是判断uboot kernel 的deb包是否存在,否则的话就通过shell函数 compile_uboot compile_kernel进行编译。
我们先来看一下compile_boot
先跳至在 lib/compilation.sh:当中,里面有compile_uboot的实现,然后再回到/lib/main.sh脚本当中
compile_uboot()。
在下一章节我们会来好好分析compile_uboot的编译过程。
最新文章
- Linux服务器jps报process information unavailable
- 利用nodejs搭建服务器,测试AJAX
- nVivo highlight code中的文本
- 使用Rsync进行文件的同步与备份
- spring和mybatis整合配置
- sorcketlog
- jQuery的animate方法在IE8下出现小问题
- jQuery中常用的函数方法
- [BZOJ3460] Jc的宿舍
- zabbix监控自动发现监控tomcat(V1)
- Codeforces.226D.The table(构造)
- codechef QCHEF(不删除莫队)
- TCP状态知识总结(图解)
- Android进程和线程(Android开发指南--译)
- HDU 3068 最长回文 manacher 算法,基本上是O(n)复杂度
- UML类图的画法
- 2018.07.22 洛谷P1967 货车运输(kruskal重构树)
- java web前端easyui(layout+tree+双tabs)布局+树+2个选项卡tabs
- ORACLE DBA应该掌握的9个免费工具
- iOS学习笔记(2)— UIView用户事件响应