烧写uClinux
通过tftp下载uCLinux镜像文件并固化到flash中:
u-boot=>set serverip 192.168.0.30
u-boot=>set bootfile “uclinux_rom.bin”
u-boot=>save
……打印信息……
u-boot=>erase 0x50000 0x1fffff
……
u-boot=>tftp 0xc008000
Loading:###############################################
……
u-boot=>cp 0xc008000 0x50000 0x491b9
//(最后一个参数为传送的uclinux大小除4然后加1得出的)
u-boot=>set bootcmdbootm 0x50000
u-boot=>save
u-boot=>reset
下载uCLinux镜像文件到sdram中并在sdram中运行:
u-boot=>tftp 0xc208000
u-boot=>bootm0xc208000
……
构建最小根文件系统
【方法1】
在$(ROMFSDIR)/vendors/Samsung/44B0目录下的Makefile文件中更改:
ROMFS_DIRS = bin dev etc home lib mnt proc usr var
DEVICES = console,c,5,1 null,c,1,3
【方法2】
#cd romfs
#mkdir bin dev etc home lib mnt proc usr var
#cd dev
#mknod console,c,5,1 null,c,1,3
将arm-elf-交叉工具中的lib下的libpam.so.0文件拷贝到romfs的lib目录中。拷贝对应发bin程序到bin目录。
【完善1】
ps命令与proc虚拟文件系统的关系:
当proc目录没有挂载proc虚拟文件系统时,ps命令时时没有任何显示的。proc虚拟文件系统是linux内核收集当前运行程序的信息的系统。ps命令会到/proc目录下查看相应信息。所以,当proc虚拟文件系统挂载到/proc目录时ps就能显示当前运行程序信息了。
挂载命令:mount –t proc proc /proc |
ps命令中的PID号对应的proc目录下对应的数字名称的目录名。
/proc> cat cmdline
root=/dev/rom0 init=/linuxrc
/proc> cat filesystems
nodev rootfs
nodev bdev
nodev proc
nodev sockfs
nodev pipefs
ext2
nodev ramfs
nodev nfs
romfs
/proc> cd fs
/proc/fs> ls
/proc/fs>
/proc> cat meminfo
total: used: free: shared: buffers: cached:
Mem: 5201920 2465792 2736128 0 606208 536576
Swap: 0 0 0
MemTotal: 5080 kB
MemFree: 2672 kB
MemShared: 0 kB
Buffers: 592 kB
Active: 904 kB
Inactive: 212 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 5080 kB
LowFree: 2672 kB
SwapTotal: 0 kB
SwapFree: 0 kB
/proc> catinterrupts
3: 4070 s3c44b0_uart_tx
7: 269 s3c44b0_uart_rx
8: 39342 timer
24: 0 NE2000
Err: 0
/proc> cat devices
Character devices:
1mem
2 pty
3ttyp
4ttyS
5console
10misc
126 gpio
162 raw
Block devices:
1ramdisk
31Blkmem
/proc> cat mounts
rootfs / rootfs rw 0 0
/dev/root / romfs ro 0 0
/proc /proc proc rw 0 0
/dev/ram0 /var ext2 rw 0 0
/proc>
【完善2】
将二进制ram文件系统扩展到设备块中。
/bin/expand /etc/ramfs.img /dev/ram0
/bin/expand /etc/ramfs2048.img /dev/ram1
将设备块挂载到对应目录下。
mount -t ext2 /dev/ram0 /var
mount -t ext2 /dev/ram1 /ramdisk
注意:在uCLinux中的dev目录下的设备节点只能通过手动添加,不能自动添加。
Linux间通过NFS实现共享 Windows间通过共享目录实现共享 Linux与windows间通过samba实现共享 |