0.顶层Makefile增加交叉编译器

顶层makefile:

ARCH		?= $(SUBARCH)
CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)

改为:

ARCH		?= arm64
CROSS_COMPILE ?= aarch64-linux-gnu-

1.生成.config

***_defconfig文件一般的芯片都有,找到以后,用如下命令,其实就是拷贝到顶层目录,并命名为.config,里面包含一堆配置,make时读取。

***_defconfig文件在 arch/arm64/configs/目录下

[liuwanpeng@localhost linux]$ make xilinx_zynqmp_defconfig O=./output/
#
# configuration written to .config
#

单独输出到其他文件件有助于源码进行git管理,否则乱的文件。

2.make

[liuwanpeng@localhost linux]$ make LOADADDR=0x8000

默认生成Image,若想生成uImage,需要加上uImage后缀

[liuwanpeng@localhost linux]$ make LOADADDR=0x8000 uImage
make: *** 没有规则可以创建目标“uImage”。 停止。

2.1 uImage无法生成问题

mpsoc不像ZYNQ,把make uImage集成到makefile里了,可以单独执行mkimage指令。

mkimage是uboot编译后,生成的工具,拷贝到/usr/bin里

[liuwanpeng@localhost tools]$ mkimage
Error: Missing output filename
Usage: mkimage -l image
-l ==> list image header information
mkimage [-x] -A arch -O os -T type -C comp -a addr -e ep -n name -d data_file[:data_file...] image
-A ==> set architecture to 'arch'
-O ==> set operating system to 'os'
-T ==> set image type to 'type'
-C ==> set compression type 'comp'
-a ==> set load address to 'addr' (hex)
-e ==> set entry point to 'ep' (hex)
-n ==> set image name to 'name'
-d ==> use image data from 'datafile'
-x ==> set XIP (execute in place)
mkimage [-D dtc_options] [-f fit-image.its|-f auto|-F] [-b <dtb> [-b <dtb>]] [-i <ramdisk.cpio.gz>] fit-image
<dtb> file is used with -f auto, it may occur multiple times.
-D => set all options for device tree compiler
-f => input filename for FIT source
-i => input filename for ramdisk file
Signing / verified boot not supported (CONFIG_FIT_SIGNATURE undefined)
mkimage -V ==> print version information and exit
Use -T to see a list of available image types

在Image所在目录执行如下命令即可:

 mkimage -n 'xlnx-linux' -A arm64 -O linux -T kernel -C none -a 0x00080000 -e 0x00080000 -d Image uImage

2.2 几种linux镜像格式

  • vmlinux 未压缩内核镜像文件,
  • zImage zImage是一般情况下默认的压缩内核映像文件,压缩vmlinux,加上一段解压启动代码得到,只能从0X0地址运行
  • uImage uImage是u-boot使用bootm命令引导的Linux压缩内核映像文件格式, 使用工具mkimage(uboot提供此工具)对普通的压缩内核映像文件(zImage)加工而得。可以由bootm命令从任意地址解压启动内核。由于bootloader一般要占用0x0地址,所以,uImage相比zImage的好处就是可以和bootloader共存。

3. dts文件

dts文件在arch/arm64/boot/dts中

make dtbs

可以生成dtb文件,整个目录都编译了

make xxx.dtb

不好用了,具体原因还未定位,估计是makefile体系的问题

可以用dtc命令编译或反编译特定的dtb文件

liuwanpeng@liuwanpeng-virtual-machine:~/work/linux/output/arch/arm64/boot/dts/xilinx$ dtc --help
Usage: dtc [options] <input file> Options: -[qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv]
-q, --quiet
Quiet: -q suppress warnings, -qq errors, -qqq all
-I, --in-format <arg>
Input formats are:
dts - device tree source text
dtb - device tree blob
fs - /proc/device-tree style directory
-o, --out <arg>
Output file
-O, --out-format <arg>
Output formats are:
dts - device tree source text
dtb - device tree blob
asm - assembler source
-V, --out-version <arg>
Blob version to produce, defaults to 17 (for dtb and asm output)
-d, --out-dependency <arg>
Output dependency file
-R, --reserve <arg>
Make space for <number> reserve map entries (for dtb and asm output)
-S, --space <arg>
Make the blob at least <bytes> long (extra space)
-p, --pad <arg>
Add padding to the blob of <bytes> long (extra space)
-b, --boot-cpu <arg>
Set the physical boot cpu
-f, --force
Try to produce output even if the input tree has errors
-i, --include <arg>
Add a path to search for include files
-s, --sort
Sort nodes and properties before outputting (useful for comparing trees)
-H, --phandle <arg>
Valid phandle formats are:
legacy - "linux,phandle" properties only
epapr - "phandle" properties only
both - Both "linux,phandle" and "phandle" properties
-W, --warning <arg>
Enable/disable warnings (prefix with "no-")
-E, --error <arg>
Enable/disable errors (prefix with "no-")
-h, --help
Print this help and exit
-v, --version
Print version and exit

例如:

反汇编,由dtb生成dts,反之亦然

dtc -I dtb -O dts -o zynqmp-zcu102.dts zynqmp-zcu102.dtb

MPSOC之6——开发流程linux编译的更多相关文章

  1. MPSOC之7——开发流程uramdisk

    用petalinux的预编译目录里有rootfs文件,选择rootfs.tar.gz作为初始输入. 1.原始文件-->uramdisk 1.1 解压原始rootfs.tar.gz,得到若干文件 ...

  2. MPSOC之5——开发流程BOOT.BIN

    需要把若干文件打成大包,烧写到flash或者sd卡中,才能启动运行. 1.petalinux打包 petalinux-packet打包时,需要petalinux的工程,限制太死了,不用. 2 wind ...

  3. Linux下服务器端开发流程及相关工具介绍(C++)

    去年刚毕业来公司后,做为新人,发现很多东西都没有文档,各种工具和地址都是口口相传的,而且很多时候都是不知道有哪些工具可以使用,所以当时就想把自己接触到的这些东西记录下来,为后来者提供参考,相当于一个路 ...

  4. linux驱动开发流程

    嵌入式linux驱动开发流程嵌入式系统中,操作系统是通过各种驱动程序来驾驭硬件设备的.设备驱动程序是操作系统内核和硬件设备之间的接口,它为应用程序屏蔽了硬件的细节,这样在应用程序看来,硬件设备只是一个 ...

  5. SoC的软件开发流程,主要包含一些Linux下的操作命令

    该笔记主要记录SoC的软件开发流程,主要包含一些Linux下的操作命令 1. 编写design file .c .h 2. 编写makefile    可执行文件名,交叉编译环境,compile fl ...

  6. JNI开发流程-JNI/NDK【转】

    本文转载自:http://wiki.jikexueyuan.com/project/jni-ndk-developer-guide/workflow.html 开发流程 JNI 全称是 Java Na ...

  7. JNI/NDK开发指南(一)—— JNI开发流程及HelloWorld

    转载请注明出处:http://blog.csdn.net/xyang81/article/details/41777471 JNI全称是Java Native Interface(Java本地接口)单 ...

  8. JNI开发流程

    交叉编译 在一个平台上去编译另一个平台上可以执行的本地代码 cpu平台 arm x86 mips 操作系统平台 windows linux mac os 原理 模拟不同平台的特性去编译代码 jni开发 ...

  9. 【Linux开发】Linux及Arm-Linux程序开发笔记(零基础入门篇)

    Linux及Arm-Linux程序开发笔记(零基础入门篇) 作者:一点一滴的Beer http://beer.cnblogs.com/ 本文地址:http://www.cnblogs.com/beer ...

随机推荐

  1. C#多功能DataGridView打印类(WinForm)

    ;                printPreviewDialog.ShowDialog();            }            catch            {         ...

  2. C#实现将输入的数自动转换为科学计数法

    一朋友写了一个把输入的整型或浮点数转换为科学计数法表示的算法,写好后叫我去帮他看看有没有什么bug之类的没有考虑周全.我还没有细看就已经把我吓到了----整整写了将近三百行代码.我也没说他什么,只是回 ...

  3. [转载] 基于Dubbo的Hessian协议实现远程调用

    转载自http://shiyanjun.cn/archives/349.html Dubbo基于Hessian实现了自己Hessian协议,可以直接通过配置的Dubbo内置的其他协议,在服务消费方进行 ...

  4. ubuntu-16.04使用MDK3伪造wifi热点和攻击wifi热点至死

    MDK3是? MDK3 是一款无线DOS 攻击测试工具,能够发起Beacon Flood.Authentication DoS.Deauthentication/Disassociation Amok ...

  5. JSON Web Tokens(JWT)

    现在API越来越流行,如何安全保护这些API? JSON Web Tokens(JWT)能提供基于JSON格式的安全认证.它有以下特点: JWT是跨不同语言的,JWT可以在 .NET, Python, ...

  6. ERP中通过EDI导入资料的时候出现【Microsoft Office Excel不能访问文件‘C:\Windows\TEMP\433....’

    问题描述: ERP中导入单据的时候报错,Microsoft Office Excel不能访问文件'C:\Windows\TEMP\433....可能的原因有:·文件名称或路径不存在,文件正被其他程序使 ...

  7. TFboy养成记 tensor shape到底怎么说

    tensor.shape 对于一位向量,其形式为[x,] 对于矩阵,二维矩阵[x,y],三维矩阵[x,y,z] 对于标量,也就是0.3*x这种0.3,表示形式为() 如果说这个矩阵是三维的,你想获得其 ...

  8. QuickTime视频解析问题

    在QuickTime中可以解析出视频并播放视频,解析的格式后缀名为.mov,之后将该视频导入到Unity Project中,显示未解析到视频文件,本来应该会自动生成MovieTexture材质,但是并 ...

  9. C++反汇编第一讲,认识构造函数,析构函数,以及成员函数

    C++反汇编第一讲,认识构造函数,析构函数,以及成员函数 以前说过在C系列下的汇编,怎么认识函数.那么现在是C++了,隐含有构造和析构函数 一丶认识构造函数 高级代码: class MyTest { ...

  10. Undefined index: HTTP_RAW_POST_DATA的解决办法

    $postStr = $GLOBALS["HTTP_RAW_POST_DATA"]; 替换为 $postStr = isset($GLOBALS['HTTP_RAW_POST_DA ...