源码下载:https://download.csdn.net/download/fhqfghgdx1993/16205666?spm=1001.2014.3001.5501
1. 编译过程
$ tar -xf e2fsprogs-1.46.2.tar.gz
$ cd e2fsprogs-1.46.2/
$ mkdir -p output/udev output/crond output/systemd
$ ./configure --host=arm-linux --enable-elf-shlibs --enable-libuuid --enable-libblkid CC=arm-linux-gcc --prefix=/arm/xxx/os_tools/e2fsprogs-1.46.2/output --with-udev-rules-dir=/arm/xxx/os_tools/e2fsprogs-1.46.2/output/udev --with-crond-dir=/arm/xxx/os_tools/e2fsprogs-1.46.2/output/crond --with-systemd-unit-dir=/arm/xxx/os_tools/e2fsprogs-1.46.2/output/systemd
$ make
$ make install
$
$ ls output/
bin etc include lib sbin share
2. 编译问题与解决:
a. 在编译服务器上执行交叉编译会遇到在/lib下创建文件缺少权限问题
making install in scrub
make[1]: Entering directory '/arm/xxx/os_tools/e2fsprogs-1.46.2/scrub'
MKDIR_P /lib/udev/rules.d
MKDIR_P /arm/xxx/os_tools/e2fsprogs-1.46.2/output/sbin /arm/xxx/os_tools/e2fsprogs-1.46.2/output/share/man/man8 /arm/xxx/os_tools/e2fsprogs-1.46.2/output/etc
INSTALL /lib/udev/rules.d/e2scrub.rules
/usr/bin/install: cannot create regular file '/lib/udev/rules.d/96-e2scrub.rules': Permission denied
Makefile:444: recipe for target 'install-udev' failed
make[1]: *** [install-udev] Error 1
make[1]: Leaving directory '/arm/xxx/os_tools/e2fsprogs-1.46.2/scrub'
Makefile:443: recipe for target 'install-progs-recursive' failed
make: *** [install-progs-recursive] Error 1
解决办法:
在配置命令中下面指令,将udev-rules,crond和systemd-unit输出目录重定向。
--with-udev-rules-dir=/arm/xxx/os_tools/e2fsprogs-1.46.2/output/udev --with-crond-dir=/arm/xxx/os_tools/e2fsprogs-1.46.2/output/crond --with-systemd-unit-dir=/arm/xxx/os_tools/e2fsprogs-1.46.2/output/systemd
b. 编译出来的fsck.ext4可执行文件在设备内执行时报错缺陷
[root@dvrdvs sbin] # ./fsck.ext4 -y /dev/mmcblk0p5
./fsck.ext4: error while loading shared libraries: libblkid.so.1: cannot open shared object file: No such file or directory
解决办法:
在配置命令中增加下面指令,使能libuuid和libblkid动态库编译
--enable-libuuid --enable-libblkid