([\u@\h \W]\# )在移植根文件系統(tǒng)時的處理方法
出處:互聯(lián)網(wǎng) 發(fā)布于:2011-09-04 17:20:24
現(xiàn)在我們經(jīng)常會用busybox生成根文件系統(tǒng),可是根文件系統(tǒng)起來以后命令行提示符只有一個“#”號,沒有像linux發(fā)行版那樣是[user@hostname currentpath] #,那么我們這里就說說如何讓我們的根文件系統(tǒng)按這個方式顯示。
要修改命令行提示符,首先我們需要知道一個環(huán)境變量PS1,我們可以查看bash的幫助文檔查看關于PS1的說明:
bash有兩級命令提示符,我們這里說的是級,這缺省的提示符是字符“$”(超級用戶是“#”),我們可以通過修改PS1修改這個提示符,格式為:
PS1=“command list”
命令列表有很多參數(shù)如下:
\! 顯示該命令的歷史記錄編號。
\# 顯示當前命令的命令編號。
\$ 顯示$符作為提示符,如果用戶是root的話,則顯示#號。
\\ 顯示反斜杠。
\d 顯示當前日期。
\h 顯示主機名。
\n 打印新行。
\nnn 顯示nnn的八進制值。
\s 顯示當前運行的shell的名字。
\t 顯示當前時間。
\u 顯示當前用戶的用戶名。
\W 顯示當前工作目錄的名字。
\w 顯示當前工作目錄的路徑
我們查看我們發(fā)行版linux中的PS1.
$echo echo $PS1
[\u@\h \W] \$
看了發(fā)行版是如何顯示命令行提示符,那么我們再看一下為什么我們做的根文件系統(tǒng)只顯示一個#,用busybox生成的根文件系統(tǒng)使用的是ash,我們看下busybox中關于ash的文件。
在busybox-1.15.4/shell/ash.h中有這樣的語句
/*
* PS1 depends on uid
*/
#if ENABLE_FEATURE_EDITING && ENABLE_FEATURE_EDITING_FANCY_PROMPT
vps1.text = “PS1=\\w \\$ ”;
#else
if (!geteuid())
vps1.text = “PS1=# ”;
#endif
結合上面PS1參數(shù)我們可以看出在busybox生成的根文件系統(tǒng)中可能出現(xiàn)兩種顯示方式,一種是“currentpath $”另一種是 “#”這兩種顯示在較老的版本中都有。
按照上面的方法修改我們的根文件系統(tǒng)中的命令行提示符。首先我們需要修改buxybox中配置,添加如下兩個選項:
Busybox Settings --->
Busybox Library Tuning --->
[*] Username completion
[*] Fancy shell prompts
如果不選擇上面兩項,文件系統(tǒng)是不是別PS1這個環(huán)境變量的參數(shù)的。
創(chuàng)建/etc/hostname添加如下內容(我們的主機名):
farsight
修改/etc/init.d/rcS添加如下內容(導入主機名配置文件):
/bin/hostname –F /etc/hostname
修改根文件系統(tǒng)中/etc/profile文件添加如下內容:
HOSTNAM=`/bin/hostname`
PS1=`[\u@\h \W]\# `
export PS1 HOSTNAME
創(chuàng)建/etc/passwd添加如下內容:
root:x:0:0:root:/root:/bin/sh
這個時候我們重新啟動我們的開發(fā)板會發(fā)現(xiàn)命令行提示符已經(jīng)是我們想要的那種現(xiàn)實了:
[root@farsight /etc] #
給出我的實驗過程的打印信息
SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Hierarchical RCU implementation.
RCU-based detection of stalled CPUs is disabled.
Verbose stalled-CPUs detection is disabled.
NR_IRQS:85
irq: clearing subpending status 00000002
Console: colour dummy device 80x30
console [ttySAC0] enabled
Calibrating delay loop… 201.93 BogoMIPS (lpj=504832)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
MINI2440: Option string mini2440=0tb
MINI2440: 't' ignored, touchscreen not compiled in
MINI2440: LCD [0:240x320] 1:800x480 2:1024x768
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, Copyright 2003-2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
DMA channel 2 at c4808080, irq 35
DMA channel 3 at c48080c0, irq 36
S3C244X: Clock Support, DVS off
bio: create slab <bio-0> at 0
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
s3c-i2c s3c2440-i2c: slave address 0x10
s3c-i2c s3c2440-i2c: bus frequency set to 98 KHz
s3c-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
Advanced Linux Sound Architecture Driver Version 1.0.23.
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
JFFS2 version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 118
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Console: switching to colour frame buffer device 60x53
fb0: s3c2410fb frame buffer device
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
at24 0-0050: 1024 byte 24c08 EEPROM (writable)
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c2440-nand: Tacls=1, 9ns Twrph0=3 29ns, Twrph1=2 19ns
s3c24xx-nand s3c2440-nand: NAND soft ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit
?。?BR> Creating 4 MTD partitions on “nand”:
0x000000000000-0x000000050000 : “u-boot”
0x000000050000-0x000000060000 : “u-boot-env”
0x000000060000-0x000000560000 : “kernel”
0x000000560000-0x000004000000 : “root”
UBI: attaching mtd3 to ubi0
UBI: physical eraseblock size: 16384 bytes (16 KiB)
UBI: logical eraseblock size: 15872 bytes
UBI: smallest flash I/O unit: 512
UBI: sub-page size: 256
UBI: VID header offset: 256 (aligned 256)
UBI: data offset: 512
UBI: max. sequence number: 1307
UBI: attached mtd3 to ubi0
UBI: MTD device name: “root”
UBI: MTD device size: 58 MiB
UBI: number of good PEBs: 3752
UBI: number of bad PEBs: 0
UBI: max. allowed volumes: 92
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 1
UBI: available PEBs: 0
UBI: total number of reserved PEBs: 3752
UBI: number of PEBs reserved for bad PEB handling: 37
UBI: max/mean erase counter: 4/1
UBI: image sequence number: 0
UBI: background thread “ubi_bgt0d” started, PID 677
dm9000 Ethernet Driver, V1.31
dm9000 dm9000: eth%d: Invalid ethernet MAC address. Please set using ifconfig
eth0: dm9000e at c4886300,c488a304 IRQ 51 MAC: 00:00:00:00:00:00 (chip)
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
usbcore: registered new interface driver libusual
s3c2440-usbgadget s3c2440-usbgadget: S3C2440: increasing FIFO to 128 bytes
mice: PS/2 mouse device common for all mice
input: gpio-keys as /devices/platform/gpio-keys/input/input0
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
i2c /dev entries driver
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
cpuidle: using governor ladder
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
s3c-sdi s3c2440-sdi: powered down.
s3c-sdi s3c2440-sdi: mmc0 - using pio, sw SDIO IRQ
usbcore: registered new interface driver hiddev
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
No device for DAI UDA134X
No device for DAI s3c24xx-i2s
S3C24XX_UDA134X SoC Audio driver
UDA134X SoC Audio Codec
asoc: UDA134X <-> s3c24xx-i2s mapping ok
ALSA device list:
#0: S3C24XX_UDA134X (UDA134X)
TCP cubic registered
NET: Registered protocol family 17
Registering the dns_resolver key type
s3c-rtc s3c2410-rtc: setting system clock to 2000-05-13 01:01:51 UTC (958179711)
UBIFS: recovery needed
UBIFS: recovery completed
UBIFS: mounted UBI device 0, volume 0, name “rootfs”
UBIFS: file system size: 58440704 bytes (57071 KiB, 55 MiB, 3682 LEBs)
UBIFS: journal size: 8110592 bytes (7920 KiB, 7 MiB, 511 LEBs)
UBIFS: media format: w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root: 0 bytes (0 KiB)
VFS: Mounted root (ubifs filesystem) on device 0:13.
Freeing init memory: 136K
/etc/init.d/rcS: line 20: tarp: not found
ifconfig: SIOCSIFFLAGS: Cannot assign requested address
ln: tty0: File exists
Please press Enter to activate this console.
[\u@\h \W]\#
[\u@\h \W]\#
[\u@\h \W]\#
[\u@\h \W]\# tftp ubifs11.img
BusyBox v1.13.3 (2010-06-04 22:52:32 CST) multi-call binary
Usage: tftp [OPTION]… HOST [PORT]
Transfer a file from/to tftp server
Options:
-l FILE Local FILE
-r FILE Remote FILE
-g Get file
-p Put file
-b SIZE Transfer blocks of SIZE octets
[\u@\h \W]\# tftp ubifs11.img
U-Boot 2010.06-rc1-00073-g54841ab-dirty (Jan 10 2011 - 17:27:06)
DRAM: 64 MiB
Flash: 2 MiB
NAND: 64 MiB
In: serial
Out: serial
Err: serial
Net: dm9000
arch type: 1999
Hit any key to stop autoboot: 0
[mini2440]#
[mini2440]#
[mini2440]# tftp ubifs11.img
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:00:3e:26:0a:5b
operating at unknown: 0 mode
Using dm9000 device
TFTP from server 192.168.1.10; our IP address is 192.168.1.6
Filename 'ubifs11.img'.
Load address: 0x30008000
Loading: T #################################################################
#################################################################
#################################################################
#################################################################
###################
done
Bytes transferred = 4094976 (3e7c00 hex)
[mini2440]# ubi write 0x30008000 rootfs 0x3e7c00
mtdparts variable not set, see 'help mtdparts'
Error, no UBI device/partition selected!
[mini2440]# mtdpart
mtdparts variable not set, see 'help mtdparts'
no partitions defined
defaults:
mtdids : nand0=nandflash0
mtdparts: mtdparts=nandflash0:320k@0(uboot),64k(params),5m(kernel),-(root)
[mini2440]# mtdpart default
[mini2440]# mtdpart
device nand0 <nandflash0>, # parts = 4
#: name size offset mask_flags
0: uboot 0x00050000 0x00000000 0
1: params 0x00010000 0x00050000 0
2: kernel 0x00500000 0x00060000 0
3: root 0x03aa0000 0x00560000 0
active partition: nand0,0 - (uboot) 0x00050000 @ 0x00000000
defaults:
mtdids : nand0=nandflash0
mtdparts: mtdparts=nandflash0:320k@0(uboot),64k(params),5m(kernel),-(root)
[mini2440]# nand erase root
NAND erase: device 0 offset 0x560000, size 0x3aa0000
Erasing at 0x3ffc00000000000 -- 0% complete.
OK
[mini2440]# ubi part root
Creating 1 MTD partitions on “nand0”:
0x5600003304698c-0x400000000000000 : “<NULL>”
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size: 16384 bytes (16 KiB)
UBI: logical eraseblock size: 15872 bytes
UBI: smallest flash I/O unit: 512
UBI: sub-page size: 256
UBI: VID header offset: 256 (aligned 256)
UBI: data offset: 512
UBI: empty MTD device detected
UBI: create volume table (copy #1)
UBI: create volume table (copy #2)
UBI: attached mtd1 to ubi0
UBI: MTD device name: “mtd=3”
UBI: MTD device size: 249108103168 MiB
UBI: number of good PEBs: 3752
UBI: number of bad PEBs: 0
UBI: max. allowed volumes: 92
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 0
UBI: available PEBs: 3711
UBI: total number of reserved PEBs: 41
UBI: number of PEBs reserved for bad PEB handling: 37
UBI: max/mean erase counter: 1/0
[mini2440]# ubi create rootfs
Creating dynamic volume rootfs of size 58900992
[mini2440]# tftp ubifs22.img
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:00:3e:26:0a:5b
operating at unknown: 0 mode
Using dm9000 device
TFTP from server 192.168.1.10; our IP address is 192.168.1.6
Filename 'ubifs22.img'.
Load address: 0x30008000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
done
Bytes transferred = 20808192 (13d8200 hex)
[mini2440]# ubi write 0x30008000 roofs 0x13d8200
roofs volume not found
[mini2440]# mtdpart
device nand0 <nandflash0>, # parts = 4
#: name size offset mask_flags
0: uboot 0x00050000 0x00000000 0
1: params 0x00010000 0x00050000 0
2: kernel 0x00500000 0x00060000 0
3: root 0x03aa0000 0x00560000 0
active partition: nand0,0 - (uboot) 0x00050000 @ 0x00000000
defaults:
mtdids : nand0=nandflash0
mtdparts: mtdparts=nandflash0:320k@0(uboot),64k(params),5m(kernel),-(root)
[mini2440]# ubi write 0x30008000 rootfs 0x13d8200
Volume “rootfs” found at volume id 0
[mini2440]# boot
NAND read: device 0 offset 0x60000, size 0x500000
5242880 bytes read: OK
## Booting kernel from Legacy Image at 30008000 …
Image Name: Linux Kernel Image
Created: 2011-01-18 6:56:00 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2218728 Bytes = 2.1 MiB
Load Address: 30008000
Entry Point: 30008040
Verifying Checksum … OK
XIP Kernel Image … OK
OK
Starting kernel …
Uncompressing Linux… done, booting the kernel.
Linux version 2.6.36.3 (root@songzi) (gcc version 4.4.3 (ctng-1.6.1) ) #5 Tue Ja
n 18 14:50:35 CST 2011
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: MINI2440
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: ubi.mtd=3 root=ubi0:rootfs console=ttySAC0,115200 mem=64M r
ootfstype=ubifs rw
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 60440k/60440k available, 5096k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
DMA : 0xffc00000 - 0xffe00000 ( 2 MB)
vmalloc : 0xc4800000 - 0xe0000000 ( 440 MB)
lowmem : 0xc0000000 - 0xc4000000 ( 64 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.init : 0xc0008000 - 0xc002a000 ( 136 kB)
.text : 0xc002a000 - 0xc03f4000 (3880 kB)
.data : 0xc040c000 - 0xc042dc80 ( 136 kB)
SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Hierarchical RCU implementation.
RCU-based detection of stalled CPUs is disabled.
Verbose stalled-CPUs detection is disabled.
NR_IRQS:85
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
Console: colour dummy device 80x30
console [ttySAC0] enabled
Calibrating delay loop… 201.93 BogoMIPS (lpj=504832)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
MINI2440: Option string mini2440=0tb
MINI2440: 't' ignored, touchscreen not compiled in
MINI2440: LCD [0:240x320] 1:800x480 2:1024x768
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, Copyright 2003-2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
DMA channel 2 at c4808080, irq 35
DMA channel 3 at c48080c0, irq 36
S3C244X: Clock Support, DVS off
bio: create slab <bio-0> at 0
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
s3c-i2c s3c2440-i2c: slave address 0x10
s3c-i2c s3c2440-i2c: bus frequency set to 98 KHz
s3c-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
Advanced Linux Sound Architecture Driver Version 1.0.23.
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
JFFS2 version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 118
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Console: switching to colour frame buffer device 60x53
fb0: s3c2410fb frame buffer device
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
at24 0-0050: 1024 byte 24c08 EEPROM (writable)
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c2440-nand: Tacls=1, 9ns Twrph0=3 29ns, Twrph1=2 19ns
s3c24xx-nand s3c2440-nand: NAND soft ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit
)
Creating 4 MTD partitions on “nand”:
0x000000000000-0x000000050000 : “u-boot”
0x000000050000-0x000000060000 : “u-boot-env”
0x000000060000-0x000000560000 : “kernel”
0x000000560000-0x000004000000 : “root”
UBI: attaching mtd3 to ubi0
UBI: physical eraseblock size: 16384 bytes (16 KiB)
UBI: logical eraseblock size: 15872 bytes
UBI: smallest flash I/O unit: 512
UBI: sub-page size: 256
UBI: VID header offset: 256 (aligned 256)
UBI: data offset: 512
UBI: max. sequence number: 1294
UBI: attached mtd3 to ubi0
UBI: MTD device name: “root”
UBI: MTD device size: 58 MiB
UBI: number of good PEBs: 3752
UBI: number of bad PEBs: 0
UBI: max. allowed volumes: 92
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 1
UBI: available PEBs: 0
UBI: total number of reserved PEBs: 3752
UBI: number of PEBs reserved for bad PEB handling: 37
UBI: max/mean erase counter: 4/1
UBI: image sequence number: 0
UBI: background thread “ubi_bgt0d” started, PID 677
dm9000 Ethernet Driver, V1.31
eth0: dm9000e at c4886300,c488a304 IRQ 51 MAC: 08:00:3e:26:0a:5b (chip)
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
usbcore: registered new interface driver libusual
s3c2440-usbgadget s3c2440-usbgadget: S3C2440: increasing FIFO to 128 bytes
mice: PS/2 mouse device common for all mice
input: gpio-keys as /devices/platform/gpio-keys/input/input0
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
i2c /dev entries driver
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
cpuidle: using governor ladder
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
s3c-sdi s3c2440-sdi: powered down.
s3c-sdi s3c2440-sdi: mmc0 - using pio, sw SDIO IRQ
usbcore: registered new interface driver hiddev
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
No device for DAI UDA134X
No device for DAI s3c24xx-i2s
S3C24XX_UDA134X SoC Audio driver
UDA134X SoC Audio Codec
asoc: UDA134X <-> s3c24xx-i2s mapping ok
ALSA device list:
#0: S3C24XX_UDA134X (UDA134X)
TCP cubic registered
NET: Registered protocol family 17
Registering the dns_resolver key type
s3c-rtc s3c2410-rtc: setting system clock to 2000-05-13 01:17:00 UTC (958180620)
UBIFS: mounted UBI device 0, volume 0, name “rootfs”
UBIFS: file system size: 58440704 bytes (57071 KiB, 55 MiB, 3682 LEBs)
UBIFS: journal size: 8110592 bytes (7920 KiB, 7 MiB, 511 LEBs)
UBIFS: media format: w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root: 0 bytes (0 KiB)
VFS: Mounted root (ubifs filesystem) on device 0:13.
Freeing init memory: 136K
/etc/init.d/rcS: line 20: tarp: not found
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
ln: tty0: File exists
Please press Enter to activate this console.
[root@songzi /]#
[root@songzi /]#
[root@songzi /]# ls
bin etc lib mnt root sys tty0
dev fs linuxrc proc sbin tmp usr
[root@songzi /]# ls
bin etc lib mnt root sys tty0
dev fs linuxrc proc sbin tmp usr
[root@songzi /]# ?
-/bin/sh: ?: not found
[root@songzi /]# cd usr/
[root@songzi /usr]# ls
bin button helloworld listview pda_kero
bmpbkgnd dialogbox listbox local sbin
[root@songzi /usr]# ./helloworld
IAL: Does not find the request engine: cosole.
IAL: Use the first engine: dummy
^C[root@songzi /usr]#
[root@songzi /usr]#
[root@songzi /usr]#
[root@songzi /usr]#
[root@songzi /usr]# ls
bin button helloworld listview pda_kero
bmpbkgnd dialogbox listbox local sbin
[root@songzi /usr]# ./pda_kero
./pda_kero: line 1: syntax error: “(” unexpected
[root@songzi /usr]#
[root@songzi /usr]#
[root@songzi /usr]# ls
bin button helloworld listview pda_kero
bmpbkgnd dialogbox listbox local sbin
[root@songzi /usr]# ./listbox
IAL: Does not find the request engine: cosole.
IAL: Use the first engine: dummy
busybox是一個集成了一百多個常用linux命令和工具的軟件,他甚至還集成了一個http服務器和一個telnet服務器,而所有這一切功能卻只有區(qū)區(qū)1M左右的大小.我們平時用的那些linux命令就好比是分立式的電子元件,而busybox就好比是一個集成電路,把常用的工具和命令集成壓縮在一個可執(zhí)行文件里,功能基本不變,而大小卻小很多倍,在嵌入式linux應用中,busybox有非常廣的應用,另外,大多數(shù)linux發(fā)行版的安裝程序中都有busybox的身影,安裝linux的時候案ctrl+alt+F2就能得到一個控制臺,而這個控制臺中的所有命令都是指向busybox的鏈接.
Busybox的小身材大作用的特性,給制作一張軟盤的linux帶來了及大方便.
busybox的用法
可以這樣用busybox
#busybox ls
他的功能就相當運行l(wèi)s命令
常用的用法是建立指向busybox的鏈接,不同的鏈接名完成不同的功能。
#ln -s busybox ls
#ln -s busybox rm
#ln -s busybox mkdir
然后分別運行這三個鏈接:
#./ls
#./rm
#./mkdir
就可以分別完成了ls rm 和mkdir命令的功能。雖然他們都指向同一個可執(zhí)行程序busybox,但是只要鏈接名不同,完成的功能就不同,很多l(xiāng)inux網(wǎng)站都提供busybox的源代碼。
配置busybox
busybox的配置程序和linux內核菜單配置方式簡直一模一樣。熟悉用make menuconfig方式配置linux內核的朋友很容易上手。
#cp busybox-1.00.tar.gz /babylinux
#cd /babylinux
#tar xvfz busybox-1.00.tar.gz
#cd busybox-1.00
#make menuconfig
下面是需要編譯進busybox的功能選項。
General Configuration應該選的選項
Show verbose applet usage messages
Runtime SUID/SGID configuration via /etc/busybox.conf
Build Options
Build BusyBox as a static binary (no shared libs)
這個選項是一定要選擇的,這樣才能把busybox編譯成靜態(tài)鏈接的可執(zhí)行文件,運行時才獨立于其他函數(shù)庫。否則必需要其他庫文件才能運行,在單一個linux內核不能使它正常工作。
Installation Options
Don't use /usr
這個選項也一定要選,否則make install 后busybox將安裝在原系統(tǒng)的/usr下,這將覆蓋掉系統(tǒng)原有的命令。選擇這個選項后,make install后會在busybox目錄下生成一個叫_install的目錄,里面有busybox和指向它的鏈接。
其它選項都是一些linux基本命令選項,自己需要哪些命令就編譯進去,一般用默認的就可以了,配置好后退出并保存。
編譯并安裝busybox
#make
#make install
編譯好后在busybox目錄下生成子目錄_install,里面的內容:
drwxr-xr-x 2 root root 4096 11月 24 15:28 bin
rwxrwxrwx 1 root root 11 11月 24 15:28 linuxrc -> bin/busybox
drwxr-xr-x 2 root root 4096 11月 24 15:28 sbin
其中可執(zhí)行文件busybox在bin目錄下,其他的都是指向他的符號鏈接。
希望本文能夠給從事相關工作的人一些小小的幫助,也希望新人在本文的幫助下更快的掌握提示符的用法.
版權與免責聲明
凡本網(wǎng)注明“出處:維庫電子市場網(wǎng)”的所有作品,版權均屬于維庫電子市場網(wǎng),轉載請必須注明維庫電子市場網(wǎng),http://m.58mhw.cn,違反者本網(wǎng)將追究相關法律責任。
本網(wǎng)轉載并注明自其它出處的作品,目的在于傳遞更多信息,并不代表本網(wǎng)贊同其觀點或證實其內容的真實性,不承擔此類作品侵權行為的直接責任及連帶責任。其他媒體、網(wǎng)站或個人從本網(wǎng)轉載時,必須保留本網(wǎng)注明的作品出處,并自負版權等法律責任。
如涉及作品內容、版權等問題,請在作品發(fā)表之日起一周內與本網(wǎng)聯(lián)系,否則視為放棄相關權利。
- ARM技術架構與應用開發(fā)實踐指南2026/1/6 10:40:19
- 嵌入式實時操作系統(tǒng)(RTOS)選型與移植技術指南2025/12/31 10:42:31
- 工業(yè)嵌入式系統(tǒng):通信接口技術選型與抗干擾設計實踐2025/12/15 14:36:53
- 深入解析嵌入式 OPENAMP 框架:開啟異核通信新時代2025/7/22 16:27:29
- 一文快速了解OPENWRT基礎知識2025/7/14 16:59:04









