164 CROSS_COMPILE ?= /home/jun/work/tool/arm-linux-gcc/gcc-linaro-4.9.4-2017.01-x86_64_arm-
linux-gnueabihf/bin/arm-linux-gnueabihf-
192 ARCH ?= arm
修改busybox-1.29.0/libbb/printable_string.c:修改(1)(2)
const char* FAST_FUNC printable_string(uni_stat_t *stats, const char *str)
{
while (1) {
... ...
if (c < ' ')
break;
// if (c >= 0x7f) /* (1) */
// break;
s++;
}
#if ENABLE_UNICODE_SUPPORT
dst = unicode_conv_to_printable(stats, str);
#else
{
char *d = dst = xstrdup(str);
while (1) {
unsigned char c = *d;
if (c == '\0')
break;
// if (c < ' ' || c >= 0x7f) /* (2) */
if(c < ' ')
*d = '?';
d++;
}
}
#endif
return auto_string(dst);
}
修改busybox-1.29.0/libbb/unicode.c:修改(1)(2)
static char* FAST_FUNC unicode_conv_to_printable2(uni_stat_t *stats, const char *src, unsigned width, int flags)
{
if (unicode_status != UNICODE_ON) {
char *d;
if (flags & UNI_FLAG_PAD) {
d = dst = xmalloc(width + 1);
while ((int)--width >= 0) {
unsigned char c = *src;
if (c == '\0') {
do
*d++ = ' ';
while ((int)--width >= 0);
break;
}
// *d++ = (c >= ' ' && c < 0x7f) ? c : '?'; /* (1) */
*d++ = (c >= ' ') ? c : '?';
src++;
}
*d = '\0';
} else {
d = dst = xstrndup(src, width);
while (*d) {
unsigned char c = *d;
// if (c < ' ' || c >= 0x7f) /* (2) */
if (c < ' ')
*d = '?';
d++;
}
}
}
}
预先默认配置busybox再进行图形化详细配置
make defconfig
make menuconfig
1、动态编译设置
Location: -> Settings -> Build static binary (no shared libs) 不能勾选。
2、vi命令行编辑
Location: -> Settings -> vi-style line editing commands
3、取消简化
Location: -> Linux Module Utilities -> Simplified modutils 取消勾选
4、使能unicode
Location: -> Settings -> Support Unicode勾选
创建rootfs文件,并设置nfs环境值:
sudo vi /etc/exports
/home/jun/work/nfs/rootfs *(rw,sync,no_root_squash)
sudo /etc/init.d/nfs-kernel-server restart
指定编译结果放在提前创建好的rootfs文件中:
make install CONFIG_PREFIX=/home/jun/work/nfs/rootfs
1、rootfs目录下创建lib文件夹
2、拷贝安装的交叉编译工具中的libc/lib文件到rootfs的lib目录中去。
jun@zero:~/work/tool/arm-linux-gcc/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/lib$
cp *so* *.a /home/jun/work/nfs/rootfs/lib/ -d
其中文件“ld-linux-armhf.so.3”不能作为符号链接,需要从“链接方式”改为“源文件”。
删除刚才拷贝到rootfs/lib目下的符号链接文件,重新拷贝一次过去
cp ld-linux-armhf.so.3 /home/jun/work/nfs/rootfs/lib
3、拷贝libc/usr/lib目录下的文件到rootfs/usr/lib目录中去。
jun@zero:~/work/tool/arm-linux-gcc/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/lib$
cp *so* *.a ~/work/nfs/rootfs/usr/lib/ -d
jun@zero:~/work/nfs/rootfs$ mkdir dev proc mnt sys tmp root
jun@zero:~/work/nfs/rootfs$ ls
bin dev lib linuxrc mnt proc root sbin sys tmp usr
1、创建/etc/init.d/rcS,并给予权限“chmod 777 rcS”
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib:/usr/lib
export PATH LD_LIBRARY_PATH runlevel
mount -a
mkdir /dev/pts
mount -t devpts devpts /dev/pts
echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev -s
2、创建/etc/fstab
#
proc /proc proc defaults 0 0
tmpfs /tmp tmpfs defaults 0 0
sysfs /sys sysfs defaults 0 0