摘要:NVR平台因为经常掉电硬重启,长时间使用中会偶尔出现,存储硬盘文件目录损坏,导致一些文件无法读取和删除,影响视频的循环存储。所以希望每次开机之前系统可以自动检测并修复硬盘损坏的文件以及目录。
一、工具
- 海思平台的开发环境(SDK)
- e2fsprogs-1.45.4源码(https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git)
二、编译
- 解压e2fsprogs-1.45.4源码
- 进入e2fsprogs-1.45.4文件夹根目录并执行以下命令:
./configure --host=arm-linux --prefix=$PWD/_install --disable-nls --disable-defrag CC=/opt/hisi-linux-nptl/arm-hisiv100-linux/target/bin/arm-hisiv100nptl-linux-gcc
make -j4
make install
- 文件被安装在 _install 文件夹下,复制到我们的hi3535平台上,就可以使用了。

- 为了每次开机可以自动的检查硬盘 在/etc/udev/rules.d/10-usbstorage.rules
增加:
# mount the specify dir
ACTION=="add", SYSFS{removable}=="0", RUN+="/sbin/fsck.ext4 -cy /dev/%k"
ACTION=="add", SYSFS{removable}=="0", RUN+="/bin/mount /dev/%k /home/videos", GOTO="media_by_label_auto_mount_end"
https://wiki.archlinux.org/index.php/Udev_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)
https://www.ibm.com/developerworks/cn/linux/l-cn-udev/index.html
三、问题
1.问题
e4defrag.c:199: error: #error fallocate64 not available!
Makefile:460: recipe for target 'e4defrag.o' failed
解决
加 --disable-defrag
http://lists.busybox.net/pipermail/buildroot/2015-July/134916.html
2.问题
fatal error: libintl.h: No such file or directory
解决
加 --disable-nls
说明
The --enable-nls option enables Native Language Support (NLS), which lets GCC output diagnostics in languages other than American English. Native Language Support is enabled by default if not doing a canadian cross build. The --disable-nls option disables NLS.
http://flash.uchicago.edu/~jbgallag/configure.html