時間:2015-06-28 00:00:00 來源:IT貓撲網(wǎng) 作者:網(wǎng)管聯(lián)盟 我要評論(1)
一、busybox的編譯
首先是交叉編譯設(shè)置,打開busybox根目錄下的Makefile,進行修改
[attach]220792[/attach]
一般情況下,為了讓busybox能夠獨立于其他的庫文件而可以單獨運行,需要將busybox編譯成靜態(tài)的。
#make menuconfig
Busybox Settings --->
Build Options --->
Build BusyBox as a static binary (no shared libs)? //靜態(tài)
Installation Options --->
Don't use /usr? //make install的時候不會安裝到根目錄,而是安裝到./_install
Linux System Utilities --->
mdev? //相當(dāng)于udev
Support /etc/mdev.conf
Support command execution at device addition/removal
Shells --->
Choose your default shell (msh)? //具有ash沒有的功能,比如支持tab補齊,歷史紀(jì)錄等等的高級功能
而編譯成靜態(tài)的分為glibc和uclibc,如果系統(tǒng)沒有安裝uclibc的話,那就會報下面的錯
[attach]220793[/attach]
解決辦法是打開 applets/applets.c 將其中的錯誤注釋掉
[attach]220794[/attach]
其他的busybox選項根據(jù)需要進行選擇!
#make
#make install
這樣就在./_install目錄下生成了busybox
[attach]220795[/attach]
二、ramdisk文件系統(tǒng)生成
[attach]220796[/attach]
上圖中首先創(chuàng)見了一個10M的文件系統(tǒng)映象
然后使用losetup命令將此鏡像與塊設(shè)備/dev/loop0進行掛接
如果出現(xiàn)"ioctl: LOOP_SET_FD:設(shè)備或資源忙",說明/dev/loop0設(shè)備還和一文件聯(lián)系,可用losetup /dev/loop0查看地,并可用-d 刪除
[attach]220797[/attach]
上圖是用命令mke2fs來格式化此塊設(shè)備/dev/loop0,其實就是格式化我們剛生成的那個文件系統(tǒng)鏡像,ext2格式
[attach]220798[/attach]
上圖是掛載文件系統(tǒng)鏡像,可見經(jīng)過剛才格式化之后的文件系統(tǒng)鏡像里面只有l(wèi)ost+found這個文件夾
之后可以將步驟一中生成的_install目錄下的所有文件拷貝進來即可,
/et/init.d/rcS文件如下修改
[attach]220799[/attach]
其他的系統(tǒng)配置文件可以根據(jù)需要進行更改
三、u-boot加載內(nèi)核和文件系統(tǒng)
=> tftp 800000 uImage; tftp a00000 rootfs.img; bootm 800000 a00000
Using FCC1 ETHERNET device
TFTP from server 192.168.0.102; our IP address is 192.168.0.20
Filename 'uImage'.
Load address: 0x800000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
###########################################
done
Bytes transferred = 1880231 (1cb0a7 hex)
Using FCC1 ETHERNET device
TFTP from server 192.168.0.102; our IP address is 192.168.0.20
Filename 'rootfs.img'.
Load address: 0xa00000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
###################################
done
Bytes transferred = 3170368 (306040 hex)
## Booting image at 00800000 ...
Image Name:?? Linux-2.6.11
Image Type:?? PowerPC Linux Kernel Image (gzip compressed)
Data Size:??? 1880167 Bytes =? 1.8 MB
Load Address: 00000000
Entry Point:? 00000000
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
## cmdline at 0x007FFF00 ... 0x007FFF14
memstart??? = 0x00000000
memsize???? = 0x08000000
flashstart? = 0xFE000000
flashsize?? = 0x01000000
flashoffset = 0x00033000
sramstart?? = 0x00000000
sramsize??? = 0x00000000
immr_base?? = 0xF0000000
bootflags?? = 0x00000001
vco?? =??? 400 MHz
sccfreq???? =??? 100 MHz
brgfreq???? =??? 100 MHz
intfreq???? =??? 400 MHz
cpmfreq???? =??? 200 MHz
busfreq???? =??? 100 MHz
ethaddr???? = 00:08:02:06:10:00
IP addr???? = 192.168.0.20
baudrate??? = 115200 bps
## Loading RAMDisk Image at 00a00000 ...
#p#副標(biāo)題#e#
Image Name:
Image Type:?? PowerPC Linux RAMDisk Image (uncompressed)
Data Size:??? 3170304 Bytes =? 3 MB
Load Address: 00000000
Entry Point:? 00000000
Verifying Checksum ... OK
Loading Ramdisk to 07880000, end 07b86000 ... OK
Linux version 2.6.11 (root@Embedded001) (gcc version 3.4.3) #1 Fri Sep 26 11:08:35 CST 2008
Motorola PQ2 ADS PowerPC port
arch/ppc/syslib/m82xx_pci.c: The PCI bus is 33333333 Mhz.
Waiting 1 second after deasserting RST...
Built 1 zonelists
Kernel command line: console=ttyS0,115200
PID hash table entries: 1024 (order: 10, 16384 bytes)
Warning: real time clock seems stuck!
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 122272k available (2660k kernel code, 1524k data, 116k init, 0k highmem)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
checking if image is initramfs...it isn't (bad gzip magic numbers); looks like an initrd
Freeing initrd memory: 3096k freed
NET: Registered protocol family 16
PCI: Probing PCI hardware
dev = 0, pin = 1
slot = 0, dev = 0, pin = 1
dev = a0, pin = 1
slot = 20, dev = a0, pin = 1
dev = b8, pin = 1
slot = 23, dev = b8, pin = 1
dev = b9, pin = 1
slot = 23, dev = b9, pin = 1
PCI: Cannot allocate resource region 0 of device 0000:00:00.0
PCI: Cannot allocate resource region 1 of device 0000:00:00.0
SCSI subsystem initialized
Sangoma WANPIPE Router v1.1 (c) 1995-2000 Sangoma Technologies Inc.
devfs: 2004-01-31 Richard Gooch ([email][email protected][/email])
devfs: boot_options: 0x1
Initializing Cryptographic API
Serial: CPM driver $Revision: 0.01 $
ttyS0 at MMIO 0xf0011a80 (irq = 4) is a CPM UART
ttyS1 at MMIO 0xf0011a00 (irq = 40) is a CPM UART
ttyS2 at MMIO 0xf0011a60 (irq = 43) is a CPM UART
io
關(guān)鍵詞標(biāo)簽:android,linux
相關(guān)閱讀
熱門文章 安裝紅帽子RedHat Linux9.0操作系統(tǒng)教程 Tomcat9.0如何安裝_Tomcat9.0環(huán)境變量配置方法 多種操作系統(tǒng)NTP客戶端配置 Linux操作系統(tǒng)修改IP
人氣排行 Linux下獲取CPUID、硬盤序列號與MAC地址 dmidecode命令查看內(nèi)存型號 linux tc實現(xiàn)ip流量限制 安裝紅帽子RedHat Linux9.0操作系統(tǒng)教程 linux下解壓rar文件 lcx.exe、nc.exe、sc.exe入侵中的使用方法 Ubuntu linux 關(guān)機、重啟、注銷 命令 查看linux服務(wù)器硬盤IO讀寫負(fù)載