Linux系统下移植busybox中mkfs.vfat命令

吾爱主题 阅读:138 2024-04-05 15:05:43 评论:0

为了延长磁盘寿命来存储音视频文件,打发在格式化磁盘过程中将簇的大小设置大点。因为存储的音视频文件现对较大,那么将簇大小设置得尽可能大,这样可以增强磁盘读取数据的性能,同时也不会浪费太多空间。

但发现我们设备的mkfs.vfat不支持-s参数设置簇的大小。

 

于是打算重新移植mkfs.vfat.

思路1

重新移植busybox

1.官网上下载最新的busybox源码

 

 

 

2.修改makefile

?
1 2 3 arch =arm   cross_compile = /opt/hisi-linux-nptl/arm-hisiv100-linux/target/bin/arm-hisiv100nptl-linux-

 

 

 

2.make menuconfig

设置为静态库

 

 

 

3.make

出现错误

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 make : *** [busybox_unstripped] error 1 root@chenwr-pc: /home/soft/busybox-1 .31.0 # make   link  busybox_unstripped your linker does not support -- sort -section,alignment your linker does not support -- sort -common static linking against glibc, can't use --gc-sections trying libraries: crypt m resolv failed: -wl,--start-group -lcrypt -lm -lresolv -wl,--end-group output of: /opt/hisi-linux-nptl/arm-hisiv100-linux/target/bin/arm-hisiv100nptl-linux-gcc -wall -wshadow -wwrite-strings -wundef -wstrict-prototypes -wunused -wunused-parameter -wunused- function -wunused-value -wmissing-prototypes -wmissing-declarations -wno- format -security -wdeclaration-after-statement -wold-style-definition -fno- builtin -strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-guess-branch-probability -funsigned-char -static-libgcc -falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1 -fno-unwind-tables -fno-asynchronous-unwind-tables -fno- builtin - printf -os -static -march=armv7l -o busybox_unstripped -wl,--start-group applets /built-in .o archival /lib .a archival /libarchive/lib .a console-tools /lib .a coreutils /lib .a coreutils /libcoreutils/lib .a debianutils /lib .a klibc-utils /lib .a e2fsprogs /lib .a editors /lib .a findutils /lib .a init /lib .a libbb /lib .a libpwdgrp /lib .a loginutils /lib .a mailutils /lib .a miscutils /lib .a modutils /lib .a networking /lib .a networking /libiproute/lib .a networking /udhcp/lib .a printutils /lib .a procps /lib .a runit /lib .a selinux /lib .a shell /lib .a sysklogd /lib .a util-linux /lib .a util-linux /volume_id/lib .a archival /built-in .o archival /libarchive/built-in .o console-tools /built-in .o coreutils /built-in .o coreutils /libcoreutils/built-in .o debianutils /built-in .o klibc-utils /built-in .o e2fsprogs /built-in .o editors /built-in .o findutils /built-in .o init /built-in .o libbb /built-in .o libpwdgrp /built-in .o loginutils /built-in .o mailutils /built-in .o miscutils /built-in .o modutils /built-in .o networking /built-in .o networking /libiproute/built-in .o networking /udhcp/built-in .o printutils /built-in .o procps /built-in .o runit /built-in .o selinux /built-in .o shell /built-in .o sysklogd /built-in .o util-linux /built-in .o util-linux /volume_id/built-in .o -wl,--end-group -wl,--start-group -lcrypt -lm -lresolv -wl,--end-group ========== networking /lib .a(ipcalc.o): in function `ipcalc_main': ipcalc.c:(.text.ipcalc_main+0x24c): warning: gethostbyaddr is obsolescent, use getaddrinfo() instead. libbb /lib .a(inet_common.o): in function `inet_resolve': inet_common.c:(.text.inet_resolve+0x60): warning: gethostbyname is obsolescent, use getnameinfo() instead. coreutils /lib .a(mktemp.o): in function `mktemp_main': mktemp.c:(.text.mktemp_main+0x8c): warning: the use of `mktemp ' is dangerous, better use `mkstemp' networking /lib .a( nslookup .o): in function `add_query': nslookup .c:(.text.add_query+0x70): undefined reference to `res_mkquery' networking /lib .a( nslookup .o): in function `send_queries': nslookup .c:(.text.send_queries+0x2d0): undefined reference to `__ns_initparse' nslookup .c:(.text.send_queries+0x308): undefined reference to `__ns_parserr' nslookup .c:(.text.send_queries+0x480): undefined reference to `__ns_get16' nslookup .c:(.text.send_queries+0x5cc): undefined reference to `__ns_get32' nslookup .c:(.text.send_queries+0x5e4): undefined reference to `__ns_get32' nslookup .c:(.text.send_queries+0x5fc): undefined reference to `__ns_get32' nslookup .c:(.text.send_queries+0x614): undefined reference to `__ns_get32' nslookup .c:(.text.send_queries+0x628): undefined reference to `__ns_get32' util-linux /lib .a(fallocate.o): in function `fallocate_main': fallocate.c:(.text.fallocate_main+0x80): undefined reference to `posix_fallocate' util-linux /lib .a(unshare.o): in function `unshare_main': unshare.c:(.text.unshare_main+0x1ec): undefined reference to `unshare' collect2: ld returned 1 exit status note: if build needs additional libraries, put them in config_extra_ldlibs. example: config_extra_ldlibs= "pthread dl tirpc audit pam" make : *** [busybox_unstripped] error 1

重新make menuconfig 进入设置把报错的模块关闭不勾选。

 

       

 

参考网上的说法,还是会有很多错误。而且关闭很多网络的东西和系统的配置,担心万一影响到其他命令呢。因为我发现原来移植后的busybox,比如ls命令,不是单独的一个bin文件。而是软连接到busybox中

 

 

 

而且我发觉设备的空间有限,原先的busybox才800多k,即使新移植成功也要2m多。于是换个思路,单独源码移植mkfs.vfat

 

 

 

到此该命令移植完毕。

总结

以上所述是小编给大家介绍的linux系统下移植busybox中mkfs.vfat命令,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!

如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

原文链接:https://juejin.im/post/5d2011c351882512a8102093

可以去百度分享获取分享代码输入这里。
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

【腾讯云】云服务器产品特惠热卖中
搜索
标签列表
    关注我们

    了解等多精彩内容