Article Title: add an application to the uClinux file system. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Compile the hello. c program with the following code:
# Include
Int main ()
{
Int I;
For (I = 0; I <6; I ++)
{
Printf ("I = % d \ n", I );
Printf ("Hello, embedded linux \ n ");
}
Return 0;
}
Compile hello. c
Linux-dist $ "> stuyou @ UBUNTU:/usr/local/src/uClinux-dist $ sudo arm-elf-gcc-elf2flt-o hello. c
Generate hello, hello. gdb
Mount romfs
Stuyou @ UBUNTU:/usr/local/src/uClinux-dist/images $ mkdir romfs_dir
Stuyou @ UBUNTU:/usr/local/src/uClinux-dist/images $ sudo mount-o loop romfs. img romfs_dir
Copy hello
Stuyou @ UBUNTU:/usr/local/src/uClinux-dist/images $ sudo cp ../hello./romfs_dir
Error
Cp: cannot create regular file 'romfs _ dir/bin/hello': Read-only file system
Copy the root file system to a new directory.
Stuyou @ UBUNTU:/usr/local/src/uClinux-dist/images $ sudo mkdir new_romfs
Stuyou @ UBUNTU:/usr/local/src/uClinux-dist/images $ sudo cp-r romfs_dir/* new_romfs
Copy hello
Stuyou @ UBUNTU:/usr/local/src/uClinux-dist/images $ sudo cp ../hello new_romfs/bin
Generate a new romfs Image
Stuyou @ UBUNTU:/usr/local/src/uClinux-dist/images $ sudo genromfs-f romfs_new.img-d new_romfs/
Modify skyeye. conf to use the new image.
# Skyeye config file sample
Arch: arm
Cpu: arm7tdmi
Mach: at91
Mem_bank: map = M, type = RW, addr = 0x00000000, size = 0x00004000
Mem_bank: map = M, type = RW, addr = 0x01000000, size = 0x00400000
Mem_bank: map = M, type = R, addr = 0x01400000, size = 0x00400000, file =./romfs_new.img
Mem_bank: map = M, type = RW, addr = 0x02000000, size = 0x00400000
Mem_bank: map = M, type = RW, addr = 0x02400000, size = 0x00008000
Mem_bank: map = M, type = RW, addr = 0x04000000, size = 0x00400000
Mem_bank: map = I, type = RW, addr = 0xf0000000, size = 0x10000000
# Set nic info
# Net: type = cs8900a, base = 0xfffa0000, size = 0x20, int = 16, mac = 0: 4: 3: 2: 1: f, ethmod = tuntap, hostip = 10.0.0.1
Net: type = cs8900a, ethmod = tuntap, hostip = 10.0.0.1
Uart: mod = term
# Dbct: state = on
Start uClinux on skyeye
Stuyou @ UBUNTU:/usr/local/src/uClinux-dist/images $ skyeye-c skyeye. conf-e linux
The following startup information is displayed:
Your elf file is little endian.
Arch: arm
Cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0
Mach info: name at91, mach_init addr 0x80605a0
Ethmod num = 1, mac addr = 0: 0: 0: 0: 0: 0, hostip = 10.0.0.1
Failed to setup_module (name: net, type: cs8900a)
Tapif_init: icotl TUNSETIFF erroruart_mod: 0, desc_in:, desc_out:, converter:
SKYEYE: use arm7100 mmu ops
Loaded ROM./romfs_new.img
Exec file "linux"'s format is elf32-little.
Load section. init: addr = 0x01000000 size = 0x0000a000.
Load section. text: addr = 0x0100a000 size = 0x000dccd0.
Load section. data: addr = 0x010e8000 size = 0x00009ce4.
Not load section. bss: addr = 0x010f1d00 size = 0x000220a0.
Not load section. debug_abbrev: addr = 0x00000000 size = 0x0003d30e.
Not load section. debug_info: addr = 0x00000000 size = 0x0186c1ff.
Not load section. debug_line: addr = 0x00000000 size = 0x00304551.
Not load section. debug_pubnames: addr = 0x00000000 size = 0x0000c30b.
Not load section. debug_aranges: addr = 0x00000000 size = 0x00002438.
Call armul_InitSymTable, kernel filename is linux.
Start addr is set to 0x01000000 by exec file.
Linux version 2.4.31-uc0 (root @ UBUNTU) (gcc version 2.95.3 20010315 (release) (ColdFire patches-20010318 from http://fiddes.net/coldfire/) (uClinux XIP and shared lib patches from http://www.snapgear.com /)) #1 Thu May 13 15:02:46 CST 2010
Processor: Atmel AT91M40xxx revision 0
Architecture: EB01
On node 0 totalpages: 1024
Zone (0): 0 pages.
Zone (1): 1024 pages.
Zone (2): 0 pages.
[1] [2] Next page