版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、根文件系统的移植(yzh)1下载(xi zi)busybox-1.13.4.tar.bz2网址(wn zh):/2解压busybox-1.13.4.tar.bz2到桌面rootlocalhost Desktop# tar -xjvf busybox-1.13.4.tar.bz2 -C ./rootlocalhost Desktop# cd busybox-1.13.4rootlocalhost busybox-1.13.4#3编辑Makefile文件rootlocalhost busybox-1.13.4# gedit Makefile将CROSS_COMPILE ?=改为CROSS_COMP
2、ILE ?=/usr/local/arm/3.4.1/bin/arm-linux-将ARCH ?= $(SUBARCH)改为ARCH ?= arm4进行默认配置rootlocalhost busybox-1.13.4# make defconfig/恢复默认配置5对配置信息进行修改rootlocalhost busybox-1.13.4# make menuconfig HOSTLD scripts/kconfig/mconf HOSTCC scripts/kconfig/lxdialog/checklist.o HOSTCC scripts/kconfig/lxdialog/inputbox
3、.o HOSTCC scripts/kconfig/lxdialog/lxdialog.o HOSTCC scripts/kconfig/lxdialog/menubox.o HOSTCC scripts/kconfig/lxdialog/msgbox.o HOSTCC scripts/kconfig/lxdialog/textbox.o HOSTCC scripts/kconfig/lxdialog/util.o HOSTCC scripts/kconfig/lxdialog/yesno.o HOSTLD scripts/kconfig/lxdialog/lxdialogscripts/kc
4、onfig/mconf Config.in在弹出的TUI界面中进行(jnxng)如下配置:检查Miscellaneous Utilities- taskset 是否去除同时设置如下:Busybox Settings - Build Options - *Build BusyBox as a static binry (no shared libs)/选用静态连接 *Build with Large File Support (for accessing files 2 GB) (/usr/local/arm/3.4.1/bin/arm-linux-) Cross Compiler prefix
5、 Installation Options - * Dont use /usr (./_install) BusyBox installation prefix /安装路径 Busybox Library Tuning - (6) Minimum password length (2) MD5: Trade Bytes for Speed * Faster /proc scanning code (+100 bytes) Support for /etc/networks * Command line editing (1024) Maximum length of input * vi-st
6、yle line editing commands (15) History size * History saving * Tab completion * Username completion * Fancy shell prompts/Setting this option allows for prompts to use things like w and/ $ and escape codes. Give more precise messages when copy fails (cp, mv etc) (4) Copy buffer size, in kilobytes Us
7、e clock_gettime(CLOCK_MONOTONIC) syscall * Use ioctl names rather than hex values in error messages * Support infiniband HW设置(shzh)完毕后,保存(bocn)、退出。6编译(biny)rootlocalhost busybox-1.13.4# make. CC networking/inetd.o CC networking/interface.onetworking/interface.c:818: error: ARPHRD_INFINIBAND undeclar
8、ed here (not in a function)networking/interface.c:818: error: initializer element is not constantnetworking/interface.c:818: error: (near initialization for ib_hwtype.type)make1: * networking/interface.o 错误 1make: * networking 错误 2编译出错,此时需要编辑networking/interface.c文件。rootlocalhost busybox-1.13.4# ged
9、it networking/interface.c将networking/interface.c文件的818行修改为“.type = -1”,然后再次编译。rootlocalhost busybox-1.13.4# make. CC util-linux/volume_id/volume_id.o CC util-linux/volume_id/xfs.o AR util-linux/volume_id/lib.a LINK busybox_unstrippedTrying libraries: crypt m Library crypt is not needed, excluding it
10、 Library m is needed, cant exclude it (yet)Final link with: m DOC busybox.pod DOC BusyBox.txt DOC BusyBox.1 DOC BusyBox.htmlrootlocalhost busybox-1.13.4# ll busybox*-rwxr-xr-x 1 root root 1701216 05-11 17:26 busybox-rwxr-xr-x 1 root root 2045185 05-11 17:26 busybox_unstripped-rw-r-r- 1 root root 889
11、321 05-11 17:26 busybox_unstripped.map-rw-r-r- 1 root root 83503 05-11 17:26 busybox_unstripped.outrootlocalhost busybox-1.13.4# make install如果(rgu)成功(chnggng),会出现(chxin)如下信息:-You will probably need to make your busybox binarysetuid root to ensure all configured applets willwork properly.-解决办法是修改_in
12、stall/bin/busybox文件的属性。rootlocalhost busybox-1.13.4# ll _install/bin/busybox -rwxr-xr-x 1 root root 1701216 05-11 17:41 _install/bin/busyboxrootlocalhost busybox-1.13.4# chmod 4755 ./_install/bin/busybox /修改busybox属性rootlocalhost busybox-1.13.4# ll _install/bin/busybox -rwsr-xr-x 1 root root 1701216
13、 05-11 17:41 _install/bin/busyboxrootlocalhost busybox-1.13.4# ll _install/总计 20drwxr-xr-x 2 root root 4096 05-11 17:41 binlrwxrwxrwx 1 root root 11 05-11 17:41 linuxrc - bin/busyboxdrwxr-xr-x 2 root root 4096 05-11 17:41 sbinrootlocalhost busybox-1.13.4# cd _install/rootlocalhost _install# pwd/root
14、/Desktop/busybox-1.13.4/_install7对配置信息进行(jnxng)修改(1)在/tmp/nfs中创建(chungjin)所需的目录rootlocalhost nfs# mkdir -p bin sbin lib/modules etc/init.d dev usr/bin usr/sbin usr/lib proc sys home root boot mnt/etc mnt/jffs2 mnt/yaffs mnt/data mnt/temp var/lib var/lock var/log var/run var/tmp tmp注意(zh y):其中bin、dev
15、、etc、lib、proc、sbin、sys、usr是必备的8个目录。rootlocalhost nfs# chmod 1777 tmprootlocalhost nfs# chmod 1777 var/tmprootlocalhost nfs# cd dev/rootlocalhost dev# pwd/tmp/nfs/devrootlocalhost dev# mknod -m 600 console c 5 1rootlocalhost dev# mknod -m 666 null c 1 3(2)复制文件到/tmp/nfs中将/root/Desktop/busybox-1.13.4/_
16、install中的内容复制到/tmp/nfs中。rootlocalhost _install# pwd/root/Desktop/busybox-1.13.4/_installrootlocalhost _install# cp -a bin /tmp/nfs/rootlocalhost _install# cp -a sbin /tmp/nfs/rootlocalhost _install# ll linuxrc lrwxrwxrwx 1 root root 11 05-11 17:41 linuxrc - bin/busyboxrootlocalhost _install# cp -a l
17、inuxrc /tmp/nfs/rootlocalhost _install# ll /tmp/nfs/linuxrc lrwxrwxrwx 1 root root 11 05-11 17:43 /tmp/nfs/linuxrc - bin/busyboxrootlocalhost _install# cd .rootlocalhost busybox-1.13.4# pwd/root/Desktop/busybox-1.13.4rootlocalhost busybox-1.13.4# cp -a examples/bootfloppy/etc/* /tmp/nfs/etc/rootloca
18、lhost busybox-1.13.4# ls /tmp/nfs/etc/fstab init.d inittab profilerootlocalhost busybox-1.13.4# 8创建配置文件(1)编写etc/inittab文件、修改其权限rootlocalhost nfs# gedit etc/inittab文件内容如下::sysinit:/etc/init.d/rcS #指定系统初始化脚本文件:respawn:-/bin/login #加上-语句会在登陆终端之后调用/etc/目录下的profile文件:restart:/sbin/init #指定系统重启时执行的初始化程序tt
19、y0:respawn:-/bin/login:shutdown:/bin/umount -a -r#指定关机时执行的操:shutdown:/sbin/swapoff -arootlocalhost nfs# ll etc/inittab-rw-r-r- 1 root root 309 05-11 18:28 etc/inittabrootlocalhost nfs# chmod 755 etc/inittab(2)编写(binxi)etc/init.d/rcS文件、修改(xigi)其权限rootlocalhost nfs# gedit etc/init.d/rcS文件(wnjin)内容如下:#
20、!/bin/sh# mount all filesystem defined in fstabecho #mount all./bin/mount -a/bin/mknod -m 600 /dev/console c 5 1/bin/mknod -m 666 /dev/null c 1 3/bin/mknod -m 666 /dev/tty0 c 4 0/bin/mknod -m 666 /dev/mtdblock0 b 31 0/bin/mknod -m 666 /dev/mtdblock1 b 31 1/bin/mknod -m 666 /dev/mtdblock2 b 31 2/bin/
21、mknod -m 666 /dev/mtdblock3 b 31 3#/bin/mount -t ext2 /dev/mtdblock3 /mnt/temp/echo *echo OK 2410 Rootfs made by ztg, 2009.05echo *rootlocalhost nfs# ll etc/init.d/rcS -rw-r-r- 1 root root 92 05-11 18:27 etc/init.d/rcSrootlocalhost nfs# chmod 755 etc/init.d/rcS (3)编写etc/fstab文件、修改其权限rootlocalhost nf
22、s# gedit etc/fstab文件内容如下:proc/procprocdefaults00sysfs/syssysfsdefaults00none/tmpramfsdefaults00mdev/devramfsdefaults00rootlocalhost nfs# ll etc/fstab -rw-r-r- 1 root root 59 05-11 18:30 etc/fstabrootlocalhost nfs# chmod 755 etc/fstab (4)编写etc/proflie文件、修改其权限rootlocalhost nfs# gedit etc/proflie文件内容如下
23、:# /etc/profile: system-wide .profile file for the Bourne shellsechoecho -n Processing /etc/profile. # no-op# Set search library pathecho Set search library path in /etc/profileexport LD_LIBRARY_PATH=/lib:/usr/lib # Set user pathecho Set user path in /etc/profileexport PATH=/bin:/sbin:/usr/bin:/usr/
24、sbin#设置命令搜索路径export HISTSIZE=100export PS1=uh W$ alias ll=ls -l#/sbin/ifconfig eth0 2 netmask /sbin/ifconfig lo echo Configure net doneecho All Doneecho(5)创建密码文件、修改其权限下面3个文件可以从宿主机中复制,只留下root帐号。rootlocalhost nfs# cp /etc/passwd etc/ ;cp /etc/shadow etc/ ;cp /etc/group etc/rootlocalhost nfs# chmod 600
25、 etc/shadow rootlocalhost nfs# gedit etc/passwd内容(nirng)是:root:x:0:0:root:/root:/bin/shrootlocalhost nfs# gedit etc/shadow内容(nirng)是:root:$1$zs2zr2N4$15U99ll5tUm3DwOvKnCVV1:14335:0:99999:7:rootlocalhost nfs# gedit etc/group内容(nirng)是:root:x:0:root(6)为mdev创建配置文件rootlocalhost nfs# gedit etc/mdev.conf内
26、容是:空rootlocalhost nfs# ll etc/总计 60-rwxr-xr-x 1 root root 117 05-11 19:28 fstab-rw-r-r- 1 root root 14 05-11 20:09 groupdrwxr-xr-x 2 root root 4096 05-11 20:04 init.d-rwxr-xr-x 1 root root 184 05-11 19:33 inittab-rw-r-r- 1 root root 0 05-11 20:09 mdev.conf-rw-r-r- 1 root root 30 05-11 20:07 passwd-r
27、wxr-xr-x 1 root root 801 05-11 19:42 proflie-rw-r-r- 1 root root 59 05-11 20:08 shadow(7)删除备份文件rootlocalhost nfs# rm etc/* etc/init.d/*9复制常用的库文件编写脚本文件copy_lib.sh。rootlocalhost nfs# gedit copy_lib.sh文件内容如下:#!/bin/bash#You should put this file cp.sh in /usr/local/arm/3.4.1/arm-linux/lib/ROOTFS_LIB=/tm
28、p/nfs/lib/for file in libc libcrypt libdl libm libpthread libresolv libutildocp $file-*.so $ROOTFS_LIBcp -d $file.so.*0-9 $ROOTFS_LIBdonecp -d ld*.so* $ROOTFS_LIBrootlocalhost nfs# ll copy_lib.sh-rw-r-r- 1 root root 303 05-11 20:18 copy_lib.shrootlocalhost nfs# chmod a+x copy_lib.shrootlocalhost nfs
29、# cp copy_lib.sh /usr/local/arm/3.4.1/arm-linux/lib/rootlocalhost nfs# cd /usr/local/arm/3.4.1/arm-linux/lib/rootlocalhost lib# ./copy_lib.sh rootlocalhost lib# cd -/tmp/nfsrootlocalhost nfs# ll lib总计 2516-rwxr-xr-x 1 root root 131480 05-11 20:19 ld-2.3.2.solrwxrwxrwx 1 root root 11 05-11 20:19 ld-l
30、inux.so.2 - ld-2.3.2.so-rwxr-xr-x 1 root root 1560352 05-11 20:19 libc-2.3.2.so-rwxr-xr-x 1 root root 30155 05-11 20:19 libcrypt-2.3.2.solrwxrwxrwx 1 root root 17 05-11 20:19 libcrypt.so.1 - libcrypt-2.3.2.solrwxrwxrwx 1 root root 13 05-11 20:19 libc.so.6 - libc-2.3.2.so-rwxr-xr-x 1 root root 15736
31、05-11 20:19 libdl-2.3.2.solrwxrwxrwx 1 root root 14 05-11 20:19 libdl.so.2 - libdl-2.3.2.so-rwxr-xr-x 1 root root 546854 05-11 20:19 libm-2.3.2.solrwxrwxrwx 1 root root 13 05-11 20:19 libm.so.6 - libm-2.3.2.so-rwxr-xr-x 1 root root 97975 05-11 20:19 libpthread-0.10.solrwxrwxrwx 1 root root 18 05-11
32、20:19 libpthread.so.0 - libpthread-0.10.so-rwxr-xr-x 1 root root 81495 05-11 20:19 libresolv-2.3.2.solrwxrwxrwx 1 root root 18 05-11 20:19 libresolv.so.2 - libresolv-2.3.2.so-rwxr-xr-x 1 root root 13689 05-11 20:19 libutil-2.3.2.solrwxrwxrwx 1 root root 16 05-11 20:19 libutil.so.1 - libutil-2.3.2.so
33、drwxr-xr-x 2 root root 4096 05-11 11:23 modulesrootlocalhost nfs# 至此(zhc),一个(y )基本的根文件系统(通过(tnggu)NFS挂载)构建完成。10完整的启动过程(u-boot、内核、文件系统)注意:在嵌入式系统开发的过程中,一般的做法是通过tftp将操作系统内核下载到开发板,内核引导时通过NFS挂载根文件系统,下面的操作过程既是如此。(1)编辑/etc/xinetd.d/tftp文件rootlocalhost Desktop# gedit /etc/xinetd.d/tftptftp文件内容如下:1# default:
34、 off 2# description: The tftp server serves files using the trivial file transfer 3#protocol. The tftp protocol is often used to boot diskless 4#workstations, download configuration files to network-aware printers, 5#and to start the installation process for some operating systems. 6service tftp 7 8
35、socket_type= dgram 9protocol= udp10wait= yes11user= root12server= /usr/sbin/in.tftpd13server_args= -s /tftpboot14disable= no15per_source= 1116cps= 100 217flags= IPv418(2)重启tftp服务器rootlocalhost Desktop# service xinetd restart(3)编辑/etc/exports文件rootlocalhost Desktop# gedit /etc/exportsexports文件内容如下:/t
36、mp/nfs *(rw,sync,no_root_squash)(4)重启NFS服务器rootlocalhost u-boot-1.1.4# service nfs restart关闭 NFS mountd: 确定关闭 NFS 守护进程: 确定关闭 NFS quotas: 确定关闭 NFS 服务: 确定启动 NFS 服务: 确定关掉 NFS 配额: 确定启动 NFS 守护进程: 确定启动 NFS mountd: 确定rootlocalhost u-boot-1.1.4# exportfs/tmp/nfs rootlocalhost u-boot-1.1.4# exportfs -ra/重新扫描
37、配置文件 (5)完整的启动过程(u-boot、内核、文件系统、用户程序),使用NFS文件系统rootlocalhost u-boot-1.1.4# skyeye1.2.6* WARNING *If you want to run ELF image, you should use -e option to indicateyour elf-format image filename. Or you only want to run binary image,you need to set the filename of the image and its entry in skyeye.con
38、f.* /部分启动信息省略Hit any key to stop autoboot: 0 OK2410 # run bootcmdTFTP from server ; our IP address is 10Filename uImage.Load address: 0 x31000000Loading: checksum badchecksum bad# # # #doneBytes transferred = 1161416 (11b8c8 hex)# Booting image at 31000000 . Image Name: linux- Created: 2009-05-24 11
39、:22:39 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1161352 Bytes = 1.1 MB Load Address: 30008000 Entry Point: 30008000 Verifying Checksum . OKOKStarting kernel .Uncompressing Linux. done, booting the kernel.Linux version (rootlocalhost.localdomain) (gcc version 3.4.1) #6 Sun May
40、 24 19:22:08 CST 2009CPU: ARM920Tid(wb) 41009200 revision 0 (ARMvundefined/unknown)Machine: SMDK2410Memory policy: ECC disabled, Data cache writebackCPU S3C2410 (id 0 x32410000)S3C2410: core 202.800 MHz, memory 101.400 MHz, peripheral 50.700 MHzS3C2410 Clocks, (c) 2004 Simtec ElectronicsCLOCK: Slow
41、mode (1.500 MHz), fast, MPLL on, UPLL onCPU0: D VIVT write-back cacheCPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 setsCPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 setsBuilt 1 zonelistsKernel command line: noinitrd root=/dev/nfs rw nfsroot=:/tmp/nfs ip=10: init=lin
42、uxrc console=ttySAC0,115200 mem=64M /部分启动信息省略Memory: 64MB = 64MB totalMemory: 62464KB available (1888K code, 393K data, 92K init) /部分启动信息省略JFFS version 1.0, (C) 1999, 2000 Axis Communications ABJFFS2 version 2.2. (NAND) (C) 2001-2003 Red Hat, Inc.yaffs May 24 2009 19:21:42 Installing. Console: switc
43、hing to colour frame buffer device 80 x25fb0: Virtual frame buffer device, using 1024K of video memory /部分启动信息省略RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksizeCirrus Logic CS8900A driver for Linux (Modified for SMDK2410)eth0: CS8900A rev D at 0 xe0000300 irq=53, no eeprom , add
44、r: 08: 0:3E:26:0A:5BS3C24XX NAND Driver, (c) 2004 Simtec Electronicss3c2410-nand: mapped registers at c4980000s3c2410-nand: timing: Tacls 10ns, Twrph0 30ns, Twrph1 10nsNAND device: Manufacturer ID: 0 xec, Chip ID: 0 x76 (Samsung NAND 64MiB 3,3V 8-bit)NAND_ECC_NONE selected by board driver. This is n
45、ot recommended !Scanning device for bad blocksBad eraseblock 7 at 0 x0001c000Creating 4 MTD partitions on NAND 64MiB 3,3V 8-bit:0 x00000000-0 x00100000 : bootloader0 x00100000-0 x00400000 : kernel0 x00400000-0 x02c00000 : root0 x02d00000-0 x03c00000 : usermice: PS/2 mouse device common for all miceN
46、ET: Registered protocol family 2 /部分启动信息省略IP-Config: Complete: device=eth0, addr=10, mask=, gw=, host=10, domain=, nis-domain=(none), bootserver=, rootserver=, rootpath=Looking up port of RPC 100003/2 on Looking up port of RPC 100005/1 on VFS: Mounted root (nfs filesystem).Mounted devfs on /devFreei
47、ng init memory: 92K#mount all.* OK 2410 Rootfs made by ztg, 2009.05*ztg login: rootlogin25: root login on consoleProcessing /etc/profile. Set search library path in /etc/profileSet user path in /etc/profileConfigure net doneAll Donerootztg /root# printenv USER=rootLD_LIBRARY_PATH=/lib:/usr/libHOME=/
48、rootPS1=uh W$ LOGNAME=rootTERM=vt102PATH=/bin:/sbin:/usr/bin:/usr/sbinHISTSIZE=100SHELL=/bin/shPWD=/rootrootztg /root# ifconfig eth0 Link encap:Ethernet HWaddr 08:00:3E:26:0A:5B inet addr:10 Bcast:55 Mask: UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1826 errors:0 dropped:0 overruns:0
49、 frame:0 TX packets:730 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2386884 (2.2 MiB) TX bytes:116644 (113.9 KiB) Interrupt:53 Base address:0 x300 lo Link encap:Local Loopback inet addr: Mask: UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 ov
50、erruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)rootztg /root# ping -c 2 PING (): 56 data bytes64 bytes from : seq=0 ttl=64 time=0.034 ms64 bytes from : seq=1 ttl=64 time=0.021 ms- ping statistics -2 packets transmitted, 2 packets received, 0% packet lossround-trip min/avg/max = 0.021/0.027/0.034 msrootztg /root# ll -rwxr-xr-x 1 root root 8044 May 14 2009 test /该文件在宿主机通过交叉编译器编译-rw-r-r- 1 root root 284 May 14
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- T/SCGS 313018-2025原发性肝癌数智化诊疗 增强现实联合ICG荧光成像可视化导航 操作规范
- 制造业工厂生产效率与质量监控人员绩效考核表
- 银行信贷部门客户经理风险评估能力绩效考核表
- 云南曲靖市会泽县金钟镇第二中学校 2026-2027学年上学期七年级英语第一次阶段学情自测(Starter Unit1-3)(含答案)
- 电信行业网络维护工程师设备运行效率绩效评定表
- 烧结法溶出工岗前岗位安全责任制考核试卷含答案
- 托育师保密考核试卷含答案
- 压电石英晶片加工工岗前安全文化考核试卷含答案
- 媒体内容创作编辑部总编KPI考核表
- 四氯化钛精制工岗前工作规范考核试卷含答案
- 有机磷农药中毒诊疗专家共识(2025版)
- 大学形势与政策《国家发展战略》课堂讲授课件
- 新版2026年湖南物理卷高考真题(含答案)(网络参考)
- 2026届中国移动校园招聘笔试真题(含详细答案解析)
- 地下水污染阻隔墙建设技术
- 理发店消防责任制度
- 挂网客土喷播施工方案
- 2025-2026学年统编版三年级道德与法治上册全册教案(含教学计划)
- 劳务公司上墙管理制度
- 25春国家开放大学《药剂学(本)》形考任务1-3参考答案
- 燃气维保合同协议
评论
0/150
提交评论