编译U-boot和Linux内核的步骤和详解

1、准备材料

linux内核和uboot的源码包—- 6818GEC.tar.gz 环境:VMware12.0 Ubuntu16.04(64位)

(1)先将 6818GEC.tar.gz 放在Ubuntu的共享目录下,然后将 6818GEC.tar.gz 拷贝到家目录下进行解压。
解压命令: gec@ubuntu:~$ tar -zxvf 6818GEC.tar.gz

2、如何编译u-boot

(2)gec@ubuntu:~/6818GEC$ ./mk -u

编译输出
LD u-boot —–>链接成u-boot可执行映像文件
OBJCOPY u-boot.srec
OBJCOPY u-boot.bin —>将u-boot可执行映像文件进行格式转换,转换成bin格式的文件
./tools/mk6818 GECuboot.bin nsih.txt 2ndboot u-boot.bin —->将nsih.txt 2ndboot u-boot.bin打包生成GECuboot.bin–>eMMC
NSIH : 189 line processed.
NSIH : 512 bytes generated.
Generate destination file: GECuboot.bin
‘/home/gec/6818GEC/GEC6818uboot/GECuboot.bin’ -> ‘/home/gec/6818GEC/out/release/GECuboot.bin’
‘/home/gec/6818GEC/GEC6818uboot/readme.txt’ -> ‘/home/gec/6818GEC/out/release/readme.txt’
‘/home/gec/6818GEC/GEC6818uboot/env.txt’ -> ‘/home/gec/6818GEC/out/release/env.txt’
‘/home/gec/6818GEC/GEC6818uboot/GEC6818-sdmmc.sh’ -> ‘/home/gec/6818GEC/out/release/GEC6818-sdmmc.sh’
^_^ uboot path: /home/gec/6818GEC/out/release/GECuboot.bin —->将GECuboot.bin拷贝到out/release/下

3、如何编译linux内核

(3) gec@ubuntu:~/6818GEC$ ./mk -k

编译输出:
Kernel: arch/arm/boot/Image is ready
Kernel: arch/arm/boot/zImage is ready
UIMAGE arch/arm/boot/uImage
Image Name: Linux-3.4.39-gec
Created: Mon Feb 26 22:06:56 2018
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 5532568 Bytes = 5402.90 kB = 5.28 MB
Load Address: 40008000
Entry Point: 40008000
Image arch/arm/boot/uImage is ready
boot.img -> /home/gec/6818GEC/out/release
‘/home/gec/6818GEC/kernel/arch/arm/boot/uImage’ -> ‘/home/gec/6818GEC/out/target/product/GEC6818//boot/uImage’
make_ext4fs -s -T -1 -l 67108864 -a boot /home/gec/6818GEC/out/target/product/GEC6818//boot.img /home/gec/6818GEC/out/target/product/GEC6818//boot
Creating filesystem with parameters:
Size: 67108864
Block size: 4096
Blocks per group: 32768
Inodes per group: 4096
Inode size: 256
Journal blocks: 1024
Label:
Blocks: 16384
Block groups: 1
Reserved block group size: 7
Created filesystem with 18/4096 inodes and 4212/16384 blocks
‘/home/gec/6818GEC/out/target/product/GEC6818//boot.img’ -> ‘/home/gec/6818GEC/out/release/boot.img’

内核映像文件的生成过程:
内核源码—>Image–>压缩–>zImage—>使用mkimage工具,在zImage的前面加一个头–>uImage—>经过文件系统打包,生成boot.img
/home/gec/6818GEC/out/release/boot.img

4、源码包的分析

1、GEC6818uboot
—–>u-boot的源码包
gec@ubuntu:~/6818GEC$ ls GEC6818uboot/
2ndboot board config.mk doc env.txt GEC6818-sdmmc.sh Kbuild MAKEALL net nsih-2G16b-533M.txt nsih.txt readme.txt System.map u-boot u-boot.map
api boards.cfg CREDITS drivers examples GECuboot.bin lib Makefile nsih-1G16b-533M.txt nsih-2G16b-800M.txt post scripts test u-boot.bin u-boot.srec
arch common disk dts fs include Licenses mkconfig nsih-1G16b-800M.txt nsih-2G8b.txt README snapshot.commit tools u-boot.lds

2、kernel
——>linux内核的源码
gec@ubuntu:~/6818GEC$ ls kernel
android COPYING Documentation fs init Kconfig MAINTAINERS modules.builtin net samples sound usr vmlinux.o
arch CREDITS drivers gec6818_linux_config ipc kernel Makefile modules.order README scripts System.map virt
block crypto firmware include Kbuild lib mm Module.symvers REPORTING-BUGS security tools vmlinux

3、prebuilts
——>编译u-boot和kernel的编译器
gec@ubuntu:~/6818GEC/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin$ ./arm-eabi-gcc -v
Using built-in specs.
COLLECT_GCC=./arm-eabi-gcc
COLLECT_LTO_WRAPPER=/home/gec/6818GEC/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/../libexec/gcc/arm-eabi/4.8/lto-wrapper
Target: arm-eabi
Configured with: /tmp/AOSP-toolchain/build/../gcc/gcc-4.8/configure –prefix=/tmp/toolchain-build-eabi/prefix –target=arm-eabi –host=x86_64-linux-gnu –build=x86_64-linux-gnu –with-gnu-as –with-gnu-ld –enable-languages=c,c++ –with-gmp=/tmp/toolchain-build-eabi/temp-install –with-mpfr=/tmp/toolchain-build-eabi/temp-install –with-mpc=/tmp/toolchain-build-eabi/temp-install –with-cloog=/tmp/toolchain-build-eabi/temp-install –with-isl=/tmp/toolchain-build-eabi/temp-install –with-ppl=/tmp/toolchain-build-eabi/temp-install –disable-ppl-version-check –disable-cloog-version-check –disable-isl-version-check –enable-cloog-backend=isl –with-host-libstdcxx=’-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm’ –disable-libssp –enable-threads –disable-nls –disable-libmudflap –disable-libgomp –disable-libstdc__-v3 –disable-sjlj-exceptions –disable-shared –disable-tls –disable-libitm –with-float=soft –with-fpu=vfp –with-arch=armv5te –enable-target-optspace –with-abi=aapcs –enable-initfini-array –disable-nls –prefix=/tmp/toolchain-build-eabi/prefix –with-sysroot=/tmp/toolchain-build-eabi/prefix/sysroot –with-binutils-version=2.23 –with-mpfr-version=3.1.1 –with-mpc-version=1.0.1 –with-gmp-version=5.0.5 –with-gcc-version=4.8 –with-gdb-version=7.6 –with-gxx-include-dir=/tmp/toolchain-build-eabi/prefix/include/c++/4.8 –with-bugurl=http://source.android.com/source/report-bugs.html –disable-bootstrap –disable-libquadmath –enable-plugins –enable-libgomp –disable-libsanitizer –enable-gold –enable-graphite=yes –with-cloog-version=0.18.0 –with-isl-version=0.11.1 –enable-eh-frame-hdr-for-static –with-arch=armv5te –disable-gold –disable-libgomp –program-transform-name=’s&^&arm-eabi-&’
Thread model: single
gcc version 4.8 (GCC)

4、out
——>编译生成的u-boot和kernel的映像文件
/out/release/GECuboot.bin
/out/release/boot.img

5、prototype
——->linux内核使用的一些固件程序,这些固件程序是针对S5P6818底层外设,如:串口、看门狗、定时器、USB.、、、、

6、tools
——->编译u-boot或kernel使用的一些工具

7、linux
——->linux内核使用的一些固件程序,这些固件程序是针对S5P6818中视频处理模块的。

8、buildroot
——->生成跟文件系统的内容

5、GEC6818更新系统的方法

1、使用fastboot
2、使用恢复卡(micro SD==TF卡)

  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值