交叉编译dosfstools

项目需要编译fsck.fat用于修复fat格式的文件系统,记录交叉编译命令

首先下载源码,可从github上下载压缩包dosfstools_4.1.orig.tar.xz,我下载的是4.1版本

交叉工具为:arm-poky-linux-gcc

交叉工具路径:/opt/fsl-imx-fb/4.14-sumo/sysroots,内容如下:

gateway@edenliu_ubuntu:/opt/fsl-imx-fb/4.14-sumo/sysroots$ tree -L 2
.
├── cortexa7hf-neon-poky-linux-gnueabi
│   ├── bin
│   ├── boot
│   ├── etc
│   ├── lib
│   ├── sbin
│   ├── usr
│   └── var
└── x86_64-pokysdk-linux
    ├── bin
    ├── environment-setup.d
    ├── etc
    ├── lib
    ├── sbin
    └── usr
 

cd 到dosfstools源码路径,比如

gateway@edenliu_ubuntu:~/git_new/dosfstools-4.1$ 

使用configure命令生成makefile

./configure --target=arm-poky-linux --host=arm-poky-linux --prefix=/opt/fsl-imx-fb/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/jansson CC="/opt/fsl-imx-fb/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux/arm-poky-linux-gcc -march=armv7ve -marm -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 -D__arm__=1 --sysroot=/opt/fsl-imx-fb/4.14-sumo/sysroots/cortexa7hf-neon-poky-linux-gnueabi" CFLAGS="-mfloat-abi=hard -I /opt/fsl-imx-fb/4.14-sumo/sysroots/cortexa7hf-neon-poky-linux-gnueabi/usr/include -L/opt/fsl-imx-fb/4.14-sumo/sysroots/cortexa7hf-neon-poky-linux-gnueabi/usr/lib" CPPFLAGS="-I /opt/fsl-imx-fb/4.14-sumo/sysroots/cortexa7hf-neon-poky-linux-gnueabi/usr/include -std=gnu++11 -march=armv7ve -marm -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7"

成功生成makefile后调用make,在src路径下生成可执行程序:

gateway@edenliu_ubuntu:~/git_new/dosfstools-4.1/src$ ls fsck.fat mkfs.fat -la
-rwxrwxr-x 1 gateway gateway 99212 Jul 13 19:44 fsck.fat
-rwxrwxr-x 1 gateway gateway 71460 Jul 13 19:44 mkfs.fat


 

你可能感兴趣的:(linux,linux)