用單晶片 PIC16F877A + 電波鐘接收模組, 使用 C 語言撰寫解碼程式.
2009年7月13日星期一
2009年2月21日星期六
2008年12月10日星期三
TouchScreen driver has been done - 移植 Linux kernel 2.6.25 (Android 版本) 到 SAMSUNG S3C2440A
關於觸控面板驅動程式(touch screen driver) 的修改, 以下的網址是個好的參考資料:
[轉錄帥哥] Touch Screen Driver
arch/arm/plat-s3c24xx/devs.c
include/asm-arm/plat-s3c24xx/devs.h
arch/arm/mach-s3c2410/mach-h1940.c
drivers/input/touchscreen/Kconfig
drivers/input/touchscreen/Makefile
drivers/input/touchscreen/s3c2410_ts.c
include/asm-arm/arch-s3c2410/ts.h
之後再調整以下檔案, 就大功告成了.
arch/arm/mach-s3c2440/mach-smdk2440.c
arch/arm/plat-s3c24xx/devs.c
arch/arm/plat-s3c24xx/s3c244x.c
下載重新編譯的 kernel, 啟動後的信息如下:
Starting kernel ...
Uncompressing Linux........................................................................................................... done, booting the kernel.
Linux version 2.6.25 (armdev@test.intra.wizign.com) (gcc version 4.1.2) #14 Tue Dec 9 15:23:52 CST 2008
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
Machine: SBZ2440
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C244X: core 399.651 MHz, memory 133.217 MHz, peripheral 66.608 MHz
S3C24XX Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (2.116 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: root=/dev/nfs rw noinitrd console=ttySAC0,115200 init=/linuxrc nfsroot=192.168.1.12:/vdisk/armdev_fs ip=192.168.1.30:192.168.1.12:192.168f
irq: clearing pending ext status 00000080
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
timer tcon=00500000, tcnt d8d2, tcfg 00000200,00000000, usec 0000170f
Console: colour dummy device 80x30
console [ttySAC0] enabled
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: 61184KB available (3044K code, 508K data, 144K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 152 bytes
NET: Registered protocol family 16
S3C2410 Power Management, (c) 2004 Simtec Electronics
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4800000, irq 33
DMA channel 1 at c4800040, irq 34
DMA channel 2 at c4800080, irq 35
DMA channel 3 at c48000c0, irq 36
S3C244X: Clock Support, DVS off
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
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
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.
fuse init (API version 7.9)
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 30x40
fb0: s3c2410fb frame buffer device
lp: driver loaded but no devices found
ppdev: user-space parallel port driver
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
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
loop: module loaded
dm9000 Ethernet Driver, V1.30
eth0: dm9000 at c485e300,c4860304 IRQ 51 MAC: 08:00:3e:26:0a:5b (chip)
Uniform Multi-Platform E-IDE driver
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
BAST NOR-Flash Driver, (c) 2004 Simtec Electronics
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=1, 7ns Twrph0=4 30ns, Twrph1=1 7ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
Scanning device for bad blocks
Creating 2 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x00000000-0x00200000 : "Kernel"
0x00200000-0x04000000 : "root partition"
usbmon: debugfs is not available
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
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
mice: PS/2 mouse device common for all mice
s3c2410 TouchScreen successfully loaded
input: s3c2410 TouchScreen as /class/input/input0
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2440-i2c s3c2440-i2c: slave address 0x10
s3c2440-i2c s3c2440-i2c: bus frequency set to 378 KHz
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
logger: created 64K log 'log_main'
logger: created 64K log 'log_events'
logger: created 64K log 'log_radio'
TCP cubic registered
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
IP-Config: Complete:
device=eth0, addr=192.168.1.30, mask=255.255.255.0, gw=192.168.1.1,
host=android, domain=, nis-domain=(none),
bootserver=192.168.1.12, rootserver=192.168.1.12, rootpath=
Looking up port of RPC 100003/2 on 192.168.1.12
Looking up port of RPC 100005/1 on 192.168.1.12
VFS: Mounted root (nfs filesystem).
Freeing init memory: 144K
--------mount /proc as proc
--------mount /sys as sysfs
--------mount /dev/shm as tmpfs
init started: BusyBox v1.12.1 (2008-11-25 00:32:40 CST)
starting pid 784, tty '': '/etc/rc.d/startup'
--------start mdev
--------mount tmpfs
OK
--------mount devpts
OK
Setting system clock: hwclock: can't open '/dev/misc/rtc': No such file or directory
FAIL
Setting hostname: OK
Cleaning up system: OK
Setting up interface lo: OK
Running start scripts.
Starting syslogd: syslogd: invalid number '80kb'
FAIL
Starting klogd: OK
Setting up interface eth0: OK
starting pid 805, tty '': '-/bin/login'
android login: root
Jan 1 00:00:18 login[805]: root login on 'console'
EMB#
[轉錄帥哥] Touch Screen Driver
S3C2410 touch screen 的 patch file, 請到以下網址下載:patch 檔案裡, 所修改的檔案包括:
s3c2410_touchscreen.patch
arch/arm/plat-s3c24xx/devs.c
include/asm-arm/plat-s3c24xx/devs.h
arch/arm/mach-s3c2410/mach-h1940.c
drivers/input/touchscreen/Kconfig
drivers/input/touchscreen/Makefile
drivers/input/touchscreen/s3c2410_ts.c
include/asm-arm/arch-s3c2410/ts.h
之後再調整以下檔案, 就大功告成了.
arch/arm/mach-s3c2440/mach-smdk2440.c
arch/arm/plat-s3c24xx/devs.c
arch/arm/plat-s3c24xx/s3c244x.c
下載重新編譯的 kernel, 啟動後的信息如下:
Starting kernel ...
Uncompressing Linux........................................................................................................... done, booting the kernel.
Linux version 2.6.25 (armdev@test.intra.wizign.com) (gcc version 4.1.2) #14 Tue Dec 9 15:23:52 CST 2008
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
Machine: SBZ2440
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C244X: core 399.651 MHz, memory 133.217 MHz, peripheral 66.608 MHz
S3C24XX Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (2.116 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: root=/dev/nfs rw noinitrd console=ttySAC0,115200 init=/linuxrc nfsroot=192.168.1.12:/vdisk/armdev_fs ip=192.168.1.30:192.168.1.12:192.168f
irq: clearing pending ext status 00000080
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
timer tcon=00500000, tcnt d8d2, tcfg 00000200,00000000, usec 0000170f
Console: colour dummy device 80x30
console [ttySAC0] enabled
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: 61184KB available (3044K code, 508K data, 144K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 152 bytes
NET: Registered protocol family 16
S3C2410 Power Management, (c) 2004 Simtec Electronics
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4800000, irq 33
DMA channel 1 at c4800040, irq 34
DMA channel 2 at c4800080, irq 35
DMA channel 3 at c48000c0, irq 36
S3C244X: Clock Support, DVS off
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
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
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.
fuse init (API version 7.9)
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 30x40
fb0: s3c2410fb frame buffer device
lp: driver loaded but no devices found
ppdev: user-space parallel port driver
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
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
loop: module loaded
dm9000 Ethernet Driver, V1.30
eth0: dm9000 at c485e300,c4860304 IRQ 51 MAC: 08:00:3e:26:0a:5b (chip)
Uniform Multi-Platform E-IDE driver
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
BAST NOR-Flash Driver, (c) 2004 Simtec Electronics
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=1, 7ns Twrph0=4 30ns, Twrph1=1 7ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
Scanning device for bad blocks
Creating 2 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x00000000-0x00200000 : "Kernel"
0x00200000-0x04000000 : "root partition"
usbmon: debugfs is not available
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
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
mice: PS/2 mouse device common for all mice
s3c2410 TouchScreen successfully loaded
input: s3c2410 TouchScreen as /class/input/input0
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2440-i2c s3c2440-i2c: slave address 0x10
s3c2440-i2c s3c2440-i2c: bus frequency set to 378 KHz
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
logger: created 64K log 'log_main'
logger: created 64K log 'log_events'
logger: created 64K log 'log_radio'
TCP cubic registered
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
IP-Config: Complete:
device=eth0, addr=192.168.1.30, mask=255.255.255.0, gw=192.168.1.1,
host=android, domain=, nis-domain=(none),
bootserver=192.168.1.12, rootserver=192.168.1.12, rootpath=
Looking up port of RPC 100003/2 on 192.168.1.12
Looking up port of RPC 100005/1 on 192.168.1.12
VFS: Mounted root (nfs filesystem).
Freeing init memory: 144K
--------mount /proc as proc
--------mount /sys as sysfs
--------mount /dev/shm as tmpfs
init started: BusyBox v1.12.1 (2008-11-25 00:32:40 CST)
starting pid 784, tty '': '/etc/rc.d/startup'
--------start mdev
--------mount tmpfs
OK
--------mount devpts
OK
Setting system clock: hwclock: can't open '/dev/misc/rtc': No such file or directory
FAIL
Setting hostname: OK
Cleaning up system: OK
Setting up interface lo: OK
Running start scripts.
Starting syslogd: syslogd: invalid number '80kb'
FAIL
Starting klogd: OK
Setting up interface eth0: OK
starting pid 805, tty '': '-/bin/login'
android login: root
Jan 1 00:00:18 login[805]: root login on 'console'
EMB#
2008年11月26日星期三
File system 掛載成功 - 移植 Linux kernel 2.6.25 (Android 版本) 到 SAMSUNG S3C2440A
之前 linux kernel 執行到
Freeing init memory: 140K
就停住了, 經測試之後, 發現是 cross-compiled gcc 的問題.
SAMSUNG S3C2440A 的 ARM core 是 ARM920T, 所以重新建制 Generic arm, little endian 版本的 cross-compiled gcc, 問題就解決了.
以下成功啟動 Linux 的過程:
Starting kernel ...
Uncompressing Linux........................................................................................................... done, booting the kernel.
Linux version 2.6.25 (armdev@test.intra.wizign.com) (gcc version 4.1.2) #3 Tue Nov 25 01:55:06 CST 2008
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
Machine: SBZ2440
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C244X: core 399.651 MHz, memory 133.217 MHz, peripheral 66.608 MHz
S3C24XX Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (2.116 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: root=/dev/nfs rw noinitrd console=ttySAC0,115200 init=/linuxrc nfsroot=192.168.1.12:/vdisk/armdev_fs ip=192.168.1.30:192.168.1.12:1
92.168.1.1:255.255.255.0:android:eth0:off
irq: clearing pending ext status 00000080
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
timer tcon=00500000, tcnt d8d2, tcfg 00000200,00000000, usec 0000170f
Console: colour dummy device 80x30
console [ttySAC0] enabled
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: 61184KB available (3040K code, 507K data, 140K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 152 bytes
NET: Registered protocol family 16
S3C2410 Power Management, (c) 2004 Simtec Electronics
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4800000, irq 33
DMA channel 1 at c4800040, irq 34
DMA channel 2 at c4800080, irq 35
DMA channel 3 at c48000c0, irq 36
S3C244X: Clock Support, DVS off
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
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
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
fuse init (API version 7.9)
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 30x40
fb0: s3c2410fb frame buffer device
lp: driver loaded but no devices found
ppdev: user-space parallel port driver
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
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
loop: module loaded
dm9000 Ethernet Driver, V1.30
eth0: dm9000 at c485e300,c4860304 IRQ 51 MAC: 08:00:3e:26:0a:5b (chip)
Uniform Multi-Platform E-IDE driver
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
BAST NOR-Flash Driver, (c) 2004 Simtec Electronics
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=1, 7ns Twrph0=4 30ns, Twrph1=1 7ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
Scanning device for bad blocks
Creating 2 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x00000000-0x00200000 : "Kernel"
0x00200000-0x04000000 : "root partition"
usbmon: debugfs is not available
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
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2440-i2c s3c2440-i2c: slave address 0x10
s3c2440-i2c s3c2440-i2c: bus frequency set to 378 KHz
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
logger: created 64K log 'log_main'
logger: created 64K log 'log_events'
logger: created 64K log 'log_radio'
TCP cubic registered
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
IP-Config: Complete:
device=eth0, addr=192.168.1.30, mask=255.255.255.0, gw=192.168.1.1,
host=android, domain=, nis-domain=(none),
bootserver=192.168.1.12, rootserver=192.168.1.12, rootpath=
Looking up port of RPC 100003/2 on 192.168.1.12
Looking up port of RPC 100005/1 on 192.168.1.12
VFS: Mounted root (nfs filesystem).
Freeing init memory: 140K
--------mount /proc as proc
--------mount /sys as sysfs
init started: BusyBox v1.12.1 (2008-11-25 00:32:40 CST)
starting pid 777, tty '': '/etc/rc.d/startup'
mkdir: cannot create directory '/dev/pts': File exists
mkdir: cannot create directory '/dev/shm': File exists
--------start mdev
--------mount tmpfs
OK
--------mount devpts
mount: mounting devpts on /dev/pts failed: No such file or directory
FAIL
Setting system clock: hwclock: can't open '/dev/misc/rtc': No such file or directory
FAIL
Setting hostname: OK
Cleaning up system: OK
Setting up interface lo: OK
Running start scripts.
Starting syslogd: syslogd: invalid number '80kb'
FAIL
Starting klogd: OK
Setting up interface eth0: OK
starting pid 800, tty '': '-/bin/login'
android login: root
ash: id -u: bad number
# uname -a
Linux android 2.6.25 #3 Tue Nov 25 01:55:06 CST 2008 armv4tl unknown
# hostname
android
Freeing init memory: 140K
就停住了, 經測試之後, 發現是 cross-compiled gcc 的問題.
SAMSUNG S3C2440A 的 ARM core 是 ARM920T, 所以重新建制 Generic arm, little endian 版本的 cross-compiled gcc, 問題就解決了.
以下成功啟動 Linux 的過程:
Starting kernel ...
Uncompressing Linux........................................................................................................... done, booting the kernel.
Linux version 2.6.25 (armdev@test.intra.wizign.com) (gcc version 4.1.2) #3 Tue Nov 25 01:55:06 CST 2008
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
Machine: SBZ2440
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C244X: core 399.651 MHz, memory 133.217 MHz, peripheral 66.608 MHz
S3C24XX Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (2.116 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: root=/dev/nfs rw noinitrd console=ttySAC0,115200 init=/linuxrc nfsroot=192.168.1.12:/vdisk/armdev_fs ip=192.168.1.30:192.168.1.12:1
92.168.1.1:255.255.255.0:android:eth0:off
irq: clearing pending ext status 00000080
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
timer tcon=00500000, tcnt d8d2, tcfg 00000200,00000000, usec 0000170f
Console: colour dummy device 80x30
console [ttySAC0] enabled
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: 61184KB available (3040K code, 507K data, 140K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 152 bytes
NET: Registered protocol family 16
S3C2410 Power Management, (c) 2004 Simtec Electronics
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4800000, irq 33
DMA channel 1 at c4800040, irq 34
DMA channel 2 at c4800080, irq 35
DMA channel 3 at c48000c0, irq 36
S3C244X: Clock Support, DVS off
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
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
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
fuse init (API version 7.9)
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 30x40
fb0: s3c2410fb frame buffer device
lp: driver loaded but no devices found
ppdev: user-space parallel port driver
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
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
loop: module loaded
dm9000 Ethernet Driver, V1.30
eth0: dm9000 at c485e300,c4860304 IRQ 51 MAC: 08:00:3e:26:0a:5b (chip)
Uniform Multi-Platform E-IDE driver
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
BAST NOR-Flash Driver, (c) 2004 Simtec Electronics
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=1, 7ns Twrph0=4 30ns, Twrph1=1 7ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
Scanning device for bad blocks
Creating 2 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x00000000-0x00200000 : "Kernel"
0x00200000-0x04000000 : "root partition"
usbmon: debugfs is not available
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
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2440-i2c s3c2440-i2c: slave address 0x10
s3c2440-i2c s3c2440-i2c: bus frequency set to 378 KHz
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
logger: created 64K log 'log_main'
logger: created 64K log 'log_events'
logger: created 64K log 'log_radio'
TCP cubic registered
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
IP-Config: Complete:
device=eth0, addr=192.168.1.30, mask=255.255.255.0, gw=192.168.1.1,
host=android, domain=, nis-domain=(none),
bootserver=192.168.1.12, rootserver=192.168.1.12, rootpath=
Looking up port of RPC 100003/2 on 192.168.1.12
Looking up port of RPC 100005/1 on 192.168.1.12
VFS: Mounted root (nfs filesystem).
Freeing init memory: 140K
--------mount /proc as proc
--------mount /sys as sysfs
init started: BusyBox v1.12.1 (2008-11-25 00:32:40 CST)
starting pid 777, tty '': '/etc/rc.d/startup'
mkdir: cannot create directory '/dev/pts': File exists
mkdir: cannot create directory '/dev/shm': File exists
--------start mdev
--------mount tmpfs
OK
--------mount devpts
mount: mounting devpts on /dev/pts failed: No such file or directory
FAIL
Setting system clock: hwclock: can't open '/dev/misc/rtc': No such file or directory
FAIL
Setting hostname: OK
Cleaning up system: OK
Setting up interface lo: OK
Running start scripts.
Starting syslogd: syslogd: invalid number '80kb'
FAIL
Starting klogd: OK
Setting up interface eth0: OK
starting pid 800, tty '': '-/bin/login'
android login: root
ash: id -u: bad number
# uname -a
Linux android 2.6.25 #3 Tue Nov 25 01:55:06 CST 2008 armv4tl unknown
# hostname
android
2008年11月23日星期日
2008年11月19日星期三
移植 Linux kernel 2.6.25 (Android 版本) 到 SAMSUNG S3C2440A
有趣! 上次移植 android 到 TI Davinci DM355 沒成功.
這次移植 android 到 SAMSUNG S3C2440A 的狀況還不錯!
現在已經可以正常啟動 kernel, 接下來計畫進行的工作有:
以下描述的建置過程只是基本設定, 對於調整的細節, 必須參考硬體開發板的相關規格作設定, 一些好的參考資料如下:
linux-2.6.26内核移植到S3C2440平台
linux-2.6.25内核移植到S3C2440平台
移植内核2.6.24.4到S3C2440
《Linux系统移植》
移植過程簡述如下:
硬體 SAMSUNG S3C2440A
Linux kernel Android version 2.6.25.
Cross compiled GCC 以及基本的作業系統建制, 請參考
Cross-Compiled Linux From Scratch - Embedded (Version SVN-0.0.1-20080109-arm).
() Busybox-1.12.1 - 作業環境使用工作
cd ${ARMDEV}/build
tar -jxvf ${ARMDEV}/sources/busybox-1.12.1.tar.bz2
cd busybox-1.12.1
patch -Np1 -i ../busybox-1.12.1-fixes-1.patch
patch -Np1 -i ../busybox-1.12.1-iptunnel_headers-1.patch
make defconfig
BUSYBOX_OPTIONS="CONFIG_DMALLOC CONFIG_BUILD_AT_ONCE CONFIG_BUILD_LIBBUSYBOX
CONFIG_FEATURE_SH_IS_NONE CONFIG_LOCALE_SUPPORT CONFIG_TFTP CONFIG_FTPGET
CONFIG_FTPPUT CONFIG_IPCALC CONFIG_TFTP CONFIG_HUSH CONFIG_LASH
CONFIG_MSH CONFIG_INETD CONFIG_DPKG CONFIG_RPM2CPIO CONFIG_RPM
CONFIG_FOLD CONFIG_LOGNAME CONFIG_OD CONFIG_CRONTAB CONFIG_UUDECODE
CONFIG_UUENCODE CONFIG_SULOGIN CONFIG_DC CONFIG_DEBUG_YANK_SUSv2
CONFIG_DEBUG_INIT CONFIG_DEBUG_CROND_OPTION CONFIG_FEATURE_UDHCP_DEBUG
CONFIG_TASKSET CONFIG_CHATTR CONFIG_FSCK CONFIG_LSATTR CONFIG_CHPST
CONFIG_SETUIDGID CONFIG_ENVUIDGID CONFIG_ENVDIR CONFIG_SOFTLIMIT
CONFIG_FEATURE_2_4_MODULES"
for config in $BUSYBOX_OPTIONS; do
cp .config{,.orig}
sed -e "s:${config}=y:${config}=n:" .config.orig > .config
done
BUSYBOX_OPTIONS="CONFIG_FEATURE_SH_IS_ASH CONFIG_FEATURE_TRACEROUTE_VERBOSE CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE"
for config in $BUSYBOX_OPTIONS; do
cp .config{,.orig}
sed -e "s:# ${config} is not set:${config}=y:" .config.orig > .config
done
make ARCH=arm CROSS_COMPILE="${ARM_TARGET}-"
make ARCH=arm CROSS_COMPILE="${ARM_TARGET}-" CONFIG_PREFIX="${ARMDEV}" install
cp examples/depmod.pl ${ARMDEV}/cross-tools/bin
chmod 755 ${ARMDEV}/cross-tools/bin/depmod.pl
() Ext2 - 檔案系統工具
cd ${ARMDEV}/build
tar -zxvf ${ARMDEV}/sources/e2fsprogs-1.39.tar.gz
cd e2fsprogs-1.39
mkdir -v build
cd build
CC="${CC} -Os" ../configure --build=${ARM_HOST} --host=${ARM_TARGET} --prefix=/usr --with-root-prefix="" --with-cc="${CC} -Os" --with-linker=${LD}
make
make DESTDIR=${ARMDEV} install
make DESTDIR=${ARMDEV} install-libs
() Iana-Etc-2.20 - 網路服務和通訊協定
cd ${ARMDEV}/build
tar -jxvf ${ARMDEV}/sources/iana-etc-2.20.tar.bz2
cd iana-etc-2.20
make
make DESTDIR=${ARMDEV} install
() Zlib-1.2.3 0 - 壓縮和解壓縮程式
cd ${ARMDEV}/build
tar -zxvf ${ARMDEV}/sources/zlib-1.2.3.tar.gz
cd zlib-1.2.3
patch -Np1 -i ${ARMDEV}/sources/zlib-1.2.3-DESTDIR-1.patch
cp configure{,.orig}
sed -e 's/-O3/-Os/g' configure.orig > configure
CC="${CC}" ./configure --prefix=/usr --shared
make
make DESTDIR=${ARMDEV} install
mv -v ${ARMDEV}/usr/lib/libz.so.* ${ARMDEV}/lib
ln -svf ../../lib/libz.so.1 ${ARMDEV}/usr/lib/libz.so
() 建立密碼保護機制
echo "Create /etc/shadow file"
cat > ${ARMDEV}/etc/shadow << "EOF"
root:$1$BQY1.ACn$rvcsFmggQFH.jyCD/X/NV1:13553:0:99999:7:::
bin:x:13553:0:99999:7:::
daemon:x:13553:0:99999:7:::
adm:x:13553:0:99999:7:::
lp:x:13553:0:99999:7:::
mail:x:13553:0:99999:7:::
news:x:13553:0:99999:7:::
uucp:x:13553:0:99999:7:::
operator:x:13553:0:99999:7:::
postmaster:x:13553:0:99999:7:::
nobody:x:13553:0:99999:7:::
EOF
() cramfs-1.1 - 建立 file system 的工具
cd ${ARMDEV}/build
tar -zxvf ${ARMDEV}/sources/cramfs-1.1.tar.gz
cd cramfs-1.1
make
$ su
# cp mkcramfs /usr/bin
# cp cramfsck /usr/bin
() JFFS2 - 管理 Flash 記憶體的 file system
cd ${ARMDEV}/sources
cvs -d :pserver:anoncvs@cvs.infradead.org:/home/cvs login #password: anoncvs
cvs -d :pserver:anoncvs@cvs.infradead.org:/home/cvs co mtd
cd mtd/util/
make clean
make
cp mkfs.jffs /sbin
cp mkfs.jffs2 /sbin
() /etc/fstab
cat > ${ARMDEV}/etc/fstab << "EOF"
# Begin /etc/fstab
# Help information
# man 5 fstab
# file system mount-point type options dump fsck
# order
/dev/ram / ext2 defaults 1 1
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
devpts /dev/pts devpts gid=4,mode=620 0 0
shm /dev/shm tmpfs defaults 0 0
none /proc/bus/usb usbdevfs defaults 0 0
# End /etc/fstab
EOF
() Linux-2.6.25 (android version)
cd ${ARMDEV}/build
tar -jxvf ${ARMDEV}/sources/linux-2.6.25-android-1.0_r1.tar.gz
mv kernel.git linux-android-2.6.25
cd linux-android-2.6.25
make mrproper
make ARCH=arm CROSS_COMPILE=${ARM_TARGET}- s3c2410_defconfig
make ARCH=arm CROSS_COMPILE=${ARM_TARGET}- gconfig
以下的設定只適合本人的開發板, 僅提供參考
Device Drivers
Block Devices BLK_DEV
RAM block device support BLK_DEV_RAM
(2) Default number of RAM disks BLK_DEV_RAM_COUNT
(41984) Default RAM disk size (kbytes) BLK_DEV_RAM_SIZE
(1024) Default RAM disk block size (bytes) BLK_DEV_RAM_BLOCKSIZE
File systems
Kernel automounter support AUTOFS_FS
kernel automounter version 4 support AUTOFS4_FS
Filesystem in Userspace support FUSE_FS
Pseudo filesystems
/dev/ file system support DEVFS_FS
Virtual memory file system support (former shm fs) TMPFS
Userspace-driven configuration filesystem CONFIGFS_FS
Miscellaneous filesystems
YAFFS2 file system support YAFFS_FS
512 byte / page devices YAFFS_YAFFS1
2048 byte / page devices YAFFS_YAFFS2
Network File Systems NETWORK_FILESYSTEMS
NFS file system support NFS_FS
Provide NFSv3 client support NFS_V3
Root file system on NFS ROOT_NFS
Journalling Flash File System v2 (JFFS2) support JFFS2_FS
JFFS2 debugging verbosity (0 = quiet, 2 = noisy) JFFS2_FS_DEBUG
JFFS2 write-buffering support JFFS2_FS_WRITEBUFFER
Advanced compression options for JFFS2 JFFS2_COMPRESSION_OPTIONS
JFFS2 ZLIB compression support JFFS2_ZLIB
JFFS2 RTIME compression support JFFS2_RTIME
JFFS2 RUBIN compression support JFFS2_RUBIN
Boot options
Default kernel command string CMDLINE {command}
{command}
root=/dev/hda1 rw rootfstype=cramfs noinitrd init=/linuxrc console=ttySAC0,115200 mem=64M
() /linuxrc
cd ${ARMDEV}
mv linuxrc linuxrc.busybox
cat > ${ARMDEV}/linuxrc << "EOF"
#!/bin/sh
echo "mount /etc as ramfs"
/bin/mount -n -t ramfs ramfs /etc
/bin/cp -a /mnt/etc/* /etc
# re-create the /etc/mtab entries
echo "re-create the /etc/mtab entries"
/bin/mount -f -t cramfs -o remount,ro /dev/mtdblock1 /
# mount some file system
echo "--------munt /dev/shm as tmpfs"
/bin/mount -n -t tmpfs tmpfs /dev/shm
# mount /proc as proc file system
echo "--------mount /proc as proc"
/bin/mount -n -t proc none /proc
# mount /sys as sysfs file system
echo "--------mount /sys as sysfs
/bin/mount -n -t sysfs none /sys
#input command to LCD
#sh < /dev/ttyS0
exec /sbin/init
EOF
chmod 775 ${ARMDEV}/linuxrc
() /etc/inetd.conf
cat > ${ARMDEV}/etc/inetd.conf << "EOF"
#
telnet stream tcp nowait root /usr/sbin/telnetd
EOF
() CLFS-Bootscripts-1.0-pre4
cd ${ARMDEV}/build
tar -jxvf ${ARMDEV}/sources/clfs-embedded-bootscripts-1.0-pre4.tar.bz2
cd clfs-embedded-bootscripts
make DESTDIR=${ARMDEV} install
() /etc/mdev.conf
cat > ${ARMDEV}/etc/mdev.conf<< "EOF"
# /etc/mdev/conf
SLEEP=10
# Symlinks:
# Syntax: %s -> %s
MAKEDEV -> ../sbin/MAKEDEV
/proc/core -> kcore
fd -> /proc/self/fd
mcdx -> mcdx0
radio -> radio0
ram -> ram1
sbpcd -> sbpcd0
sr0 -> scd0
sr1 -> scd1
sr10 -> scd10
sr11 -> scd11
sr12 -> scd12
sr13 -> scd13
sr14 -> scd14
sr15 -> scd15
sr16 -> scd16
sr2 -> scd2
sr3 -> scd3
sr4 -> scd4
sr5 -> scd5
sr6 -> scd6
sr7 -> scd7
sr8 -> scd8
sr9 -> scd9
stderr -> fd/2
stdin -> fd/0
stdout -> fd/1
# Remove these devices, if using a headless system
# You will see an error mdev: Bad line 35
vbi -> vbi0
vcs -> vcs0
vcsa -> vcsa0
video -> video0
# Stop Remove for headless system
# Devices:
# Syntax: %s %d:%d %s
# devices user:group mode
null 0:0 777
zero 0:0 666
urandom 0:0 444
console 0:5 0600
fd0 0:11 0660
hdc 0:6 0660
kmem 0:9 000
mem 0:9 0640
port 0:9 0640
ptmx 0:5 0660
sda* 0:6 0660
sdb* 0:6 0660
hda* 0:6 0660
hdb* 0:6 0660
tty 0:5 0660
tty0* 0:5 0660
tty1* 0:5 0660
tty2* 0:5 0660
tty3* 0:5 0660
tty4* 0:5 0660
tty5* 0:5 0660
tty6* 0:5 0660
ttyS* 0:20 640
EOF
() /etc/profile
cat > ${ARMDEV}/etc/profile<< "EOF"
# /etc/profile
# Set the initial path
export PATH=/bin:/usr/bin
if [ 'id -u' -eq 0 ] ; then
PATH=/bin:/sbin:/usr/bin:/usr/sbin
unset HISTFILE
fi
# Setup some environment variables.
export USER='id -un'
export LOGNAME=$USER
export HOSTNAME='/bin/hostname'
export HISTSIZE=1000
export HISTFILESIZE=1000
export PAGER='/bin/more '
export EDITOR='/bin/vi'
export INPUTRC=/etc/inputrc
# End /etc/profile
EOF
() Creating the /etc/inputrc File
cat > ${ARMDEV}/etc/inputrc << "EOF"
# Begin /etc/inputrc
# Modified by Chris Lynn
# Allow the command prompt to wrap to the next line
set horizontal-scroll-mode Off
# Enable 8bit input
set meta-flag On
set input-meta On
# Turns off 8th bit stripping
set convert-meta Off
# Keep the 8th bit for display
set output-meta On
# none, visible or audible
set bell-style none
# All of the following map the escape sequence of the
# value contained inside the 1st argument to the
# readline specific functions
"\eOd": backward-word
"\eOc": forward-word
# for linux console
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert
# for xterm
"\eOH": beginning-of-line
"\eOF": end-of-line
# for Konsole
"\e[H": beginning-of-line
"\e[F": end-of-line
# End /etc/inputrc
EOF
() /etc/inittab
cat > ${ARMDEV}/etc/inittab<< "EOF"
# /etc/inittab
::sysinit:/etc/rc.d/startup
::respawn:/usr/sbin/telnetd
tty1::respawn:/sbin/getty 38400 tty1
tty2::respawn:/sbin/getty 38400 tty2
tty3::respawn:/sbin/getty 38400 tty3
tty4::respawn:/sbin/getty 38400 tty4
tty5::respawn:/sbin/getty 38400 tty5
tty6::respawn:/sbin/getty 38400 tty6
# Put a getty on the serial line (for a terminal)
# uncomment this line if your using a serial console
#::respawn:/sbin/getty -L ttyS0 115200 vt100
::respawn:/sbin/getty -L ttySAC0 115200 vt100
#T0:12345:respawn:/sbin/getty -n -l /usr/local/sbin/autologin -L /dev/tts/1 115200 vt100
::shutdown:/etc/rc.d/shutdown
::ctrlaltdel:/sbin/reboot
EOF
() Setting Hostname
echo "android" > ${ARMDEV}/etc/HOSTNAME
() /etc/hosts File
Has network card
cat > ${ARMDEV}/etc/hosts << "EOF"
# Begin /etc/hosts (network card version)
127.0.0.1 localhost
192.168.1.30 android.wizign.com android
# End /etc/hosts (network card version)
EOF
Without network card
cat > ${ARMDEV}/etc/hosts << "EOF"
# Begin /etc/hosts (no network card version)
127.0.0.1 dpf-dev.wizign.com dpf-dev localhost
# End /etc/hosts (no network card version)
EOF
() Configuring the network Script
cat > ${ARMDEV}/etc/network.conf << "EOF"
# /etc/network.conf
# Global Networking Configuration
# interface configuration is in /etc/network.d/
# set to yes to enable networking
NETWORKING=yes
# set to yes to set default route to gateway
USE_GATEWAY=no
# set to gateway IP address
GATEWAY=192.168.1.1
EOF
() creates a sample interface.eth0 file for the eth0 device:
mkdir ${ARMDEV}/etc/network.d &&
cat > ${ARMDEV}/etc/network.d/interface.eth0 << "EOF"
# Network Interface Configuration
# network device name
INTERFACE=eth0
# set to yes to use DHCP instead of the settings below
DHCP=no
# IP address
IPADDRESS=192.168.1.30
# netmask
NETMASK=255.255.255.0
# broadcast address
BROADCAST=192.168.1.255
EOF
() Creating the ${ARMDEV}/etc/resolv.conf File
cat > ${ARMDEV}/etc/resolv.conf << "EOF"
# Begin /etc/resolv.conf
domain wizign.com
nameserver 168.95.1.1
nameserver 168.95.192.1
# End /etc/resolv.conf
EOF
() 複製乾淨的作業系統, 準備移植到開發板
su -
if [ ! -d /mnt/armdev_fs ]; then
mkdir /mnt/armdev_fs
fi
mount --bind /vdisk/armdev_fs /mnt/armdev_fs
export ARMDEV="/mnt/armdev"
export ARMDEV_FS="/mnt/armdev_fs"
for dir in $(ls "${ARMDEV}"); do
if [ "$dir" == 'sources' ]; then
echo "Skip $dir"
elif [ "$dir" == 'build' ]; then
echo "Skip $dir"
elif [ "$dir" == 'cross-tools' ]; then
echo "Skip $dir"
else
cp -avr ""${ARMDEV}"/$dir" "${ARMDEV_FS}/."
fi
done
rm -rfv ${ARMDEV_FS}/usr/src/*
rm -rfv ${ARMDEV_FS}/usr/include
rm -rfv ${ARMDEV_FS}/usr/man
rm -rfv ${ARMDEV_FS}/usr/share/man
FILES="'ls ${ARMDEV_FS}/lib/*.a ${ARMDEV_FS}/usr/lib/*.a'"
for file in $FILES; do
rm -fv $file
done
chown -Rv root:root ${ARMDEV_FS}
chgrp -v utmp ${ARMDEV_FS}/var/run/utmp ${ARMDEV_FS}/var/log/lastlog
mknod -m 0666 ${ARMDEV_FS}/dev/null c 1 3
mknod -m 0600 ${ARMDEV_FS}/dev/console c 5 1
如果是用 cramfs
mkcramfs ${ARMDEV_FS} /mnt/rootfs.cramfs
cp /mnt/rootfs.cramfs /var/lib/tftpboot/ramdisk-android-2.6.25.cramfs
如果是用 jffs2
mkfs.jffs2 -d ${ARMDEV_FS} -p -s 0x200 -e 0x4000 -n -l -U -o ramdisk.jffs2
cp /mnt/ramdisk.jffs2 /var/lib/tftpboot/ramdisk-android-2.6.25.jffs2
() 以下是 shell script 檔案, 用來建 RAM disk
cat > /mnt/mkramdisk.sh << "EOF"
#! /bin/bash
# Remove files
echo "remove files"
rm -f ramdisk.img.gz
rm -f ramdisk32.img
rm -f ramdisk.img
rm -fr ramdisk
# Create ramdisk32
echo "create ramdisk32"
cd /mnt
dd if=/dev/zero of=ramdisk32.img bs=1024 count=40960
mke2fs -F -vm0 ramdisk32.img
mkdir ramdisk
mount -o loop ramdisk32.img ramdisk
cd ramdisk/
cp -arv ${ARMDEV_FS}/* .
cd ..
umount ramdisk
# Make ram disk image
echo "make ram disk image"
cp ramdisk32.img ramdisk.img
gzip ramdisk.img
./mkimage -A arm -O linux -T ramdisk -C gzip -a 30080000 -e 30080000 -d ramdisk.img.gz -n 'SBZ2440 Ramdisk' ram.img
# copy files
echo "Copy RAM disk file"
cp ram.img /var/lib/tftpboot/ramdisk-android-2.6.25.s
echo "Copy uImage file"
cp ${ARMDEV}/build/linux-android-2.6.25/arch/arm/boot/uImage /var/lib/tftpboot/uImage-android-s3c2440
EOF
() 目前系統啟動的內容如下:
Starting kernel ...
Uncompressing Linux........................................................................................................... done, booting the kerne.
Linux version 2.6.25 (armdev@test.intra.wizign.com) (gcc version 4.1.2) #54 Wed Nov 19 09:19:00 CST 2008
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
Machine: SBZ2440
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C244X: core 399.651 MHz, memory 133.217 MHz, peripheral 66.608 MHz
S3C24XX Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (2.116 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: root=/dev/nfs rw noinitrd console=ttySAC0,115200 init=/linuxrc nfsroot=192.168.1.12:/vdisk/armdev_fs ip=192.168.1.30:192.168.1.12f
irq: clearing pending ext status 00000080
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
timer tcon=00500000, tcnt d8d2, tcfg 00000200,00000000, usec 0000170f
Console: colour dummy device 80x30
console [ttySAC0] enabled
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: 61184KB available (3040K code, 507K data, 144K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 152 bytes
NET: Registered protocol family 16
S3C2410 Power Management, (c) 2004 Simtec Electronics
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4800000, irq 33
DMA channel 1 at c4800040, irq 34
DMA channel 2 at c4800080, irq 35
DMA channel 3 at c48000c0, irq 36
S3C244X: Clock Support, DVS off
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
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
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.
fuse init (API version 7.9)
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 30x40
fb0: s3c2410fb frame buffer device
lp: driver loaded but no devices found
ppdev: user-space parallel port driver
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
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
loop: module loaded
dm9000 Ethernet Driver, V1.30
eth0: dm9000 at c485e300,c4860304 IRQ 51 MAC: 08:00:3e:26:0a:5b (chip)
Uniform Multi-Platform E-IDE driver
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
BAST NOR-Flash Driver, (c) 2004 Simtec Electronics
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=3, 22ns Twrph0=8 60ns, Twrph1=3 22ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
Scanning device for bad blocks
Creating 2 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x00000000-0x00200000 : "Kernel"
0x00200000-0x04000000 : "root partition"
usbmon: debugfs is not available
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
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2440-i2c s3c2440-i2c: slave address 0x10
s3c2440-i2c s3c2440-i2c: bus frequency set to 378 KHz
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
logger: created 64K log 'log_main'
logger: created 64K log 'log_events'
logger: created 64K log 'log_radio'
TCP cubic registered
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
IP-Config: Complete:
device=eth0, addr=192.168.1.30, mask=255.255.255.0, gw=192.168.1.1,
host=Android, domain=, nis-domain=(none),
bootserver=192.168.1.12, rootserver=192.168.1.12, rootpath=
prepare_namespace() - start
mount_root()
Looking up port of RPC 100003/2 on 192.168.1.12
Looking up port of RPC 100005/1 on 192.168.1.12
VFS: Mounted root (nfs filesystem).
prepare_namespace() - end
Freeing init memory: 144K
() 用 ping 測試系統是否已經啟動
$ ping 192.168.1.30
PING 192.168.1.30 (192.168.1.30) 56(84) bytes of data.
64 bytes from 192.168.1.30: icmp_seq=1 ttl=64 time=0.417 ms
64 bytes from 192.168.1.30: icmp_seq=2 ttl=64 time=0.384 ms
64 bytes from 192.168.1.30: icmp_seq=3 ttl=64 time=0.381 ms
這次移植 android 到 SAMSUNG S3C2440A 的狀況還不錯!
現在已經可以正常啟動 kernel, 接下來計畫進行的工作有:
- 掛載檔案系統 (目前只能 ping 到 OS, 確定作業系統已經正常運作)
- 調整顯示介面和一些硬體驅動程式
- 移植 Android 的作業環境和 demo APs
- 開發應用程式
以下描述的建置過程只是基本設定, 對於調整的細節, 必須參考硬體開發板的相關規格作設定, 一些好的參考資料如下:
linux-2.6.26内核移植到S3C2440平台
linux-2.6.25内核移植到S3C2440平台
移植内核2.6.24.4到S3C2440
《Linux系统移植》
移植過程簡述如下:
硬體 SAMSUNG S3C2440A
Linux kernel Android version 2.6.25.
Cross compiled GCC 以及基本的作業系統建制, 請參考
Cross-Compiled Linux From Scratch - Embedded (Version SVN-0.0.1-20080109-arm).
() Busybox-1.12.1 - 作業環境使用工作
cd ${ARMDEV}/build
tar -jxvf ${ARMDEV}/sources/busybox-1.12.1.tar.bz2
cd busybox-1.12.1
patch -Np1 -i ../busybox-1.12.1-fixes-1.patch
patch -Np1 -i ../busybox-1.12.1-iptunnel_headers-1.patch
make defconfig
BUSYBOX_OPTIONS="CONFIG_DMALLOC CONFIG_BUILD_AT_ONCE CONFIG_BUILD_LIBBUSYBOX
CONFIG_FEATURE_SH_IS_NONE CONFIG_LOCALE_SUPPORT CONFIG_TFTP CONFIG_FTPGET
CONFIG_FTPPUT CONFIG_IPCALC CONFIG_TFTP CONFIG_HUSH CONFIG_LASH
CONFIG_MSH CONFIG_INETD CONFIG_DPKG CONFIG_RPM2CPIO CONFIG_RPM
CONFIG_FOLD CONFIG_LOGNAME CONFIG_OD CONFIG_CRONTAB CONFIG_UUDECODE
CONFIG_UUENCODE CONFIG_SULOGIN CONFIG_DC CONFIG_DEBUG_YANK_SUSv2
CONFIG_DEBUG_INIT CONFIG_DEBUG_CROND_OPTION CONFIG_FEATURE_UDHCP_DEBUG
CONFIG_TASKSET CONFIG_CHATTR CONFIG_FSCK CONFIG_LSATTR CONFIG_CHPST
CONFIG_SETUIDGID CONFIG_ENVUIDGID CONFIG_ENVDIR CONFIG_SOFTLIMIT
CONFIG_FEATURE_2_4_MODULES"
for config in $BUSYBOX_OPTIONS; do
cp .config{,.orig}
sed -e "s:${config}=y:${config}=n:" .config.orig > .config
done
BUSYBOX_OPTIONS="CONFIG_FEATURE_SH_IS_ASH CONFIG_FEATURE_TRACEROUTE_VERBOSE CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE"
for config in $BUSYBOX_OPTIONS; do
cp .config{,.orig}
sed -e "s:# ${config} is not set:${config}=y:" .config.orig > .config
done
make ARCH=arm CROSS_COMPILE="${ARM_TARGET}-"
make ARCH=arm CROSS_COMPILE="${ARM_TARGET}-" CONFIG_PREFIX="${ARMDEV}" install
cp examples/depmod.pl ${ARMDEV}/cross-tools/bin
chmod 755 ${ARMDEV}/cross-tools/bin/depmod.pl
() Ext2 - 檔案系統工具
cd ${ARMDEV}/build
tar -zxvf ${ARMDEV}/sources/e2fsprogs-1.39.tar.gz
cd e2fsprogs-1.39
mkdir -v build
cd build
CC="${CC} -Os" ../configure --build=${ARM_HOST} --host=${ARM_TARGET} --prefix=/usr --with-root-prefix="" --with-cc="${CC} -Os" --with-linker=${LD}
make
make DESTDIR=${ARMDEV} install
make DESTDIR=${ARMDEV} install-libs
() Iana-Etc-2.20 - 網路服務和通訊協定
cd ${ARMDEV}/build
tar -jxvf ${ARMDEV}/sources/iana-etc-2.20.tar.bz2
cd iana-etc-2.20
make
make DESTDIR=${ARMDEV} install
() Zlib-1.2.3 0 - 壓縮和解壓縮程式
cd ${ARMDEV}/build
tar -zxvf ${ARMDEV}/sources/zlib-1.2.3.tar.gz
cd zlib-1.2.3
patch -Np1 -i ${ARMDEV}/sources/zlib-1.2.3-DESTDIR-1.patch
cp configure{,.orig}
sed -e 's/-O3/-Os/g' configure.orig > configure
CC="${CC}" ./configure --prefix=/usr --shared
make
make DESTDIR=${ARMDEV} install
mv -v ${ARMDEV}/usr/lib/libz.so.* ${ARMDEV}/lib
ln -svf ../../lib/libz.so.1 ${ARMDEV}/usr/lib/libz.so
() 建立密碼保護機制
echo "Create /etc/shadow file"
cat > ${ARMDEV}/etc/shadow << "EOF"
root:$1$BQY1.ACn$rvcsFmggQFH.jyCD/X/NV1:13553:0:99999:7:::
bin:x:13553:0:99999:7:::
daemon:x:13553:0:99999:7:::
adm:x:13553:0:99999:7:::
lp:x:13553:0:99999:7:::
mail:x:13553:0:99999:7:::
news:x:13553:0:99999:7:::
uucp:x:13553:0:99999:7:::
operator:x:13553:0:99999:7:::
postmaster:x:13553:0:99999:7:::
nobody:x:13553:0:99999:7:::
EOF
() cramfs-1.1 - 建立 file system 的工具
cd ${ARMDEV}/build
tar -zxvf ${ARMDEV}/sources/cramfs-1.1.tar.gz
cd cramfs-1.1
make
$ su
# cp mkcramfs /usr/bin
# cp cramfsck /usr/bin
() JFFS2 - 管理 Flash 記憶體的 file system
cd ${ARMDEV}/sources
cvs -d :pserver:anoncvs@cvs.infradead.org:/home/cvs login #password: anoncvs
cvs -d :pserver:anoncvs@cvs.infradead.org:/home/cvs co mtd
cd mtd/util/
make clean
make
cp mkfs.jffs /sbin
cp mkfs.jffs2 /sbin
() /etc/fstab
cat > ${ARMDEV}/etc/fstab << "EOF"
# Begin /etc/fstab
# Help information
# man 5 fstab
# file system mount-point type options dump fsck
# order
/dev/ram / ext2 defaults 1 1
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
devpts /dev/pts devpts gid=4,mode=620 0 0
shm /dev/shm tmpfs defaults 0 0
none /proc/bus/usb usbdevfs defaults 0 0
# End /etc/fstab
EOF
() Linux-2.6.25 (android version)
cd ${ARMDEV}/build
tar -jxvf ${ARMDEV}/sources/linux-2.6.25-android-1.0_r1.tar.gz
mv kernel.git linux-android-2.6.25
cd linux-android-2.6.25
make mrproper
make ARCH=arm CROSS_COMPILE=${ARM_TARGET}- s3c2410_defconfig
make ARCH=arm CROSS_COMPILE=${ARM_TARGET}- gconfig
以下的設定只適合本人的開發板, 僅提供參考
Device Drivers
Block Devices BLK_DEV
RAM block device support BLK_DEV_RAM
(2) Default number of RAM disks BLK_DEV_RAM_COUNT
(41984) Default RAM disk size (kbytes) BLK_DEV_RAM_SIZE
(1024) Default RAM disk block size (bytes) BLK_DEV_RAM_BLOCKSIZE
File systems
Kernel automounter support AUTOFS_FS
kernel automounter version 4 support AUTOFS4_FS
Filesystem in Userspace support FUSE_FS
Pseudo filesystems
/dev/ file system support DEVFS_FS
Virtual memory file system support (former shm fs) TMPFS
Userspace-driven configuration filesystem CONFIGFS_FS
Miscellaneous filesystems
YAFFS2 file system support YAFFS_FS
512 byte / page devices YAFFS_YAFFS1
2048 byte / page devices YAFFS_YAFFS2
Network File Systems NETWORK_FILESYSTEMS
NFS file system support NFS_FS
Provide NFSv3 client support NFS_V3
Root file system on NFS ROOT_NFS
Journalling Flash File System v2 (JFFS2) support JFFS2_FS
JFFS2 debugging verbosity (0 = quiet, 2 = noisy) JFFS2_FS_DEBUG
JFFS2 write-buffering support JFFS2_FS_WRITEBUFFER
Advanced compression options for JFFS2 JFFS2_COMPRESSION_OPTIONS
JFFS2 ZLIB compression support JFFS2_ZLIB
JFFS2 RTIME compression support JFFS2_RTIME
JFFS2 RUBIN compression support JFFS2_RUBIN
Boot options
Default kernel command string CMDLINE {command}
{command}
root=/dev/hda1 rw rootfstype=cramfs noinitrd init=/linuxrc console=ttySAC0,115200 mem=64M
() /linuxrc
cd ${ARMDEV}
mv linuxrc linuxrc.busybox
cat > ${ARMDEV}/linuxrc << "EOF"
#!/bin/sh
echo "mount /etc as ramfs"
/bin/mount -n -t ramfs ramfs /etc
/bin/cp -a /mnt/etc/* /etc
# re-create the /etc/mtab entries
echo "re-create the /etc/mtab entries"
/bin/mount -f -t cramfs -o remount,ro /dev/mtdblock1 /
# mount some file system
echo "--------munt /dev/shm as tmpfs"
/bin/mount -n -t tmpfs tmpfs /dev/shm
# mount /proc as proc file system
echo "--------mount /proc as proc"
/bin/mount -n -t proc none /proc
# mount /sys as sysfs file system
echo "--------mount /sys as sysfs
/bin/mount -n -t sysfs none /sys
#input command to LCD
#sh < /dev/ttyS0
exec /sbin/init
EOF
chmod 775 ${ARMDEV}/linuxrc
() /etc/inetd.conf
cat > ${ARMDEV}/etc/inetd.conf << "EOF"
#
telnet stream tcp nowait root /usr/sbin/telnetd
EOF
() CLFS-Bootscripts-1.0-pre4
cd ${ARMDEV}/build
tar -jxvf ${ARMDEV}/sources/clfs-embedded-bootscripts-1.0-pre4.tar.bz2
cd clfs-embedded-bootscripts
make DESTDIR=${ARMDEV} install
() /etc/mdev.conf
cat > ${ARMDEV}/etc/mdev.conf<< "EOF"
# /etc/mdev/conf
SLEEP=10
# Symlinks:
# Syntax: %s -> %s
MAKEDEV -> ../sbin/MAKEDEV
/proc/core -> kcore
fd -> /proc/self/fd
mcdx -> mcdx0
radio -> radio0
ram -> ram1
sbpcd -> sbpcd0
sr0 -> scd0
sr1 -> scd1
sr10 -> scd10
sr11 -> scd11
sr12 -> scd12
sr13 -> scd13
sr14 -> scd14
sr15 -> scd15
sr16 -> scd16
sr2 -> scd2
sr3 -> scd3
sr4 -> scd4
sr5 -> scd5
sr6 -> scd6
sr7 -> scd7
sr8 -> scd8
sr9 -> scd9
stderr -> fd/2
stdin -> fd/0
stdout -> fd/1
# Remove these devices, if using a headless system
# You will see an error mdev: Bad line 35
vbi -> vbi0
vcs -> vcs0
vcsa -> vcsa0
video -> video0
# Stop Remove for headless system
# Devices:
# Syntax: %s %d:%d %s
# devices user:group mode
null 0:0 777
zero 0:0 666
urandom 0:0 444
console 0:5 0600
fd0 0:11 0660
hdc 0:6 0660
kmem 0:9 000
mem 0:9 0640
port 0:9 0640
ptmx 0:5 0660
sda* 0:6 0660
sdb* 0:6 0660
hda* 0:6 0660
hdb* 0:6 0660
tty 0:5 0660
tty0* 0:5 0660
tty1* 0:5 0660
tty2* 0:5 0660
tty3* 0:5 0660
tty4* 0:5 0660
tty5* 0:5 0660
tty6* 0:5 0660
ttyS* 0:20 640
EOF
() /etc/profile
cat > ${ARMDEV}/etc/profile<< "EOF"
# /etc/profile
# Set the initial path
export PATH=/bin:/usr/bin
if [ 'id -u' -eq 0 ] ; then
PATH=/bin:/sbin:/usr/bin:/usr/sbin
unset HISTFILE
fi
# Setup some environment variables.
export USER='id -un'
export LOGNAME=$USER
export HOSTNAME='/bin/hostname'
export HISTSIZE=1000
export HISTFILESIZE=1000
export PAGER='/bin/more '
export EDITOR='/bin/vi'
export INPUTRC=/etc/inputrc
# End /etc/profile
EOF
() Creating the /etc/inputrc File
cat > ${ARMDEV}/etc/inputrc << "EOF"
# Begin /etc/inputrc
# Modified by Chris Lynn
# Allow the command prompt to wrap to the next line
set horizontal-scroll-mode Off
# Enable 8bit input
set meta-flag On
set input-meta On
# Turns off 8th bit stripping
set convert-meta Off
# Keep the 8th bit for display
set output-meta On
# none, visible or audible
set bell-style none
# All of the following map the escape sequence of the
# value contained inside the 1st argument to the
# readline specific functions
"\eOd": backward-word
"\eOc": forward-word
# for linux console
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert
# for xterm
"\eOH": beginning-of-line
"\eOF": end-of-line
# for Konsole
"\e[H": beginning-of-line
"\e[F": end-of-line
# End /etc/inputrc
EOF
() /etc/inittab
cat > ${ARMDEV}/etc/inittab<< "EOF"
# /etc/inittab
::sysinit:/etc/rc.d/startup
::respawn:/usr/sbin/telnetd
tty1::respawn:/sbin/getty 38400 tty1
tty2::respawn:/sbin/getty 38400 tty2
tty3::respawn:/sbin/getty 38400 tty3
tty4::respawn:/sbin/getty 38400 tty4
tty5::respawn:/sbin/getty 38400 tty5
tty6::respawn:/sbin/getty 38400 tty6
# Put a getty on the serial line (for a terminal)
# uncomment this line if your using a serial console
#::respawn:/sbin/getty -L ttyS0 115200 vt100
::respawn:/sbin/getty -L ttySAC0 115200 vt100
#T0:12345:respawn:/sbin/getty -n -l /usr/local/sbin/autologin -L /dev/tts/1 115200 vt100
::shutdown:/etc/rc.d/shutdown
::ctrlaltdel:/sbin/reboot
EOF
() Setting Hostname
echo "android" > ${ARMDEV}/etc/HOSTNAME
() /etc/hosts File
Has network card
cat > ${ARMDEV}/etc/hosts << "EOF"
# Begin /etc/hosts (network card version)
127.0.0.1 localhost
192.168.1.30 android.wizign.com android
# End /etc/hosts (network card version)
EOF
Without network card
cat > ${ARMDEV}/etc/hosts << "EOF"
# Begin /etc/hosts (no network card version)
127.0.0.1 dpf-dev.wizign.com dpf-dev localhost
# End /etc/hosts (no network card version)
EOF
() Configuring the network Script
cat > ${ARMDEV}/etc/network.conf << "EOF"
# /etc/network.conf
# Global Networking Configuration
# interface configuration is in /etc/network.d/
# set to yes to enable networking
NETWORKING=yes
# set to yes to set default route to gateway
USE_GATEWAY=no
# set to gateway IP address
GATEWAY=192.168.1.1
EOF
() creates a sample interface.eth0 file for the eth0 device:
mkdir ${ARMDEV}/etc/network.d &&
cat > ${ARMDEV}/etc/network.d/interface.eth0 << "EOF"
# Network Interface Configuration
# network device name
INTERFACE=eth0
# set to yes to use DHCP instead of the settings below
DHCP=no
# IP address
IPADDRESS=192.168.1.30
# netmask
NETMASK=255.255.255.0
# broadcast address
BROADCAST=192.168.1.255
EOF
() Creating the ${ARMDEV}/etc/resolv.conf File
cat > ${ARMDEV}/etc/resolv.conf << "EOF"
# Begin /etc/resolv.conf
domain wizign.com
nameserver 168.95.1.1
nameserver 168.95.192.1
# End /etc/resolv.conf
EOF
() 複製乾淨的作業系統, 準備移植到開發板
su -
if [ ! -d /mnt/armdev_fs ]; then
mkdir /mnt/armdev_fs
fi
mount --bind /vdisk/armdev_fs /mnt/armdev_fs
export ARMDEV="/mnt/armdev"
export ARMDEV_FS="/mnt/armdev_fs"
for dir in $(ls "${ARMDEV}"); do
if [ "$dir" == 'sources' ]; then
echo "Skip $dir"
elif [ "$dir" == 'build' ]; then
echo "Skip $dir"
elif [ "$dir" == 'cross-tools' ]; then
echo "Skip $dir"
else
cp -avr ""${ARMDEV}"/$dir" "${ARMDEV_FS}/."
fi
done
rm -rfv ${ARMDEV_FS}/usr/src/*
rm -rfv ${ARMDEV_FS}/usr/include
rm -rfv ${ARMDEV_FS}/usr/man
rm -rfv ${ARMDEV_FS}/usr/share/man
FILES="'ls ${ARMDEV_FS}/lib/*.a ${ARMDEV_FS}/usr/lib/*.a'"
for file in $FILES; do
rm -fv $file
done
chown -Rv root:root ${ARMDEV_FS}
chgrp -v utmp ${ARMDEV_FS}/var/run/utmp ${ARMDEV_FS}/var/log/lastlog
mknod -m 0666 ${ARMDEV_FS}/dev/null c 1 3
mknod -m 0600 ${ARMDEV_FS}/dev/console c 5 1
如果是用 cramfs
mkcramfs ${ARMDEV_FS} /mnt/rootfs.cramfs
cp /mnt/rootfs.cramfs /var/lib/tftpboot/ramdisk-android-2.6.25.cramfs
如果是用 jffs2
mkfs.jffs2 -d ${ARMDEV_FS} -p -s 0x200 -e 0x4000 -n -l -U -o ramdisk.jffs2
cp /mnt/ramdisk.jffs2 /var/lib/tftpboot/ramdisk-android-2.6.25.jffs2
() 以下是 shell script 檔案, 用來建 RAM disk
cat > /mnt/mkramdisk.sh << "EOF"
#! /bin/bash
# Remove files
echo "remove files"
rm -f ramdisk.img.gz
rm -f ramdisk32.img
rm -f ramdisk.img
rm -fr ramdisk
# Create ramdisk32
echo "create ramdisk32"
cd /mnt
dd if=/dev/zero of=ramdisk32.img bs=1024 count=40960
mke2fs -F -vm0 ramdisk32.img
mkdir ramdisk
mount -o loop ramdisk32.img ramdisk
cd ramdisk/
cp -arv ${ARMDEV_FS}/* .
cd ..
umount ramdisk
# Make ram disk image
echo "make ram disk image"
cp ramdisk32.img ramdisk.img
gzip ramdisk.img
./mkimage -A arm -O linux -T ramdisk -C gzip -a 30080000 -e 30080000 -d ramdisk.img.gz -n 'SBZ2440 Ramdisk' ram.img
# copy files
echo "Copy RAM disk file"
cp ram.img /var/lib/tftpboot/ramdisk-android-2.6.25.s
echo "Copy uImage file"
cp ${ARMDEV}/build/linux-android-2.6.25/arch/arm/boot/uImage /var/lib/tftpboot/uImage-android-s3c2440
EOF
() 目前系統啟動的內容如下:
Starting kernel ...
Uncompressing Linux........................................................................................................... done, booting the kerne.
Linux version 2.6.25 (armdev@test.intra.wizign.com) (gcc version 4.1.2) #54 Wed Nov 19 09:19:00 CST 2008
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
Machine: SBZ2440
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C244X: core 399.651 MHz, memory 133.217 MHz, peripheral 66.608 MHz
S3C24XX Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (2.116 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: root=/dev/nfs rw noinitrd console=ttySAC0,115200 init=/linuxrc nfsroot=192.168.1.12:/vdisk/armdev_fs ip=192.168.1.30:192.168.1.12f
irq: clearing pending ext status 00000080
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
timer tcon=00500000, tcnt d8d2, tcfg 00000200,00000000, usec 0000170f
Console: colour dummy device 80x30
console [ttySAC0] enabled
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: 61184KB available (3040K code, 507K data, 144K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 152 bytes
NET: Registered protocol family 16
S3C2410 Power Management, (c) 2004 Simtec Electronics
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4800000, irq 33
DMA channel 1 at c4800040, irq 34
DMA channel 2 at c4800080, irq 35
DMA channel 3 at c48000c0, irq 36
S3C244X: Clock Support, DVS off
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
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
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.
fuse init (API version 7.9)
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 30x40
fb0: s3c2410fb frame buffer device
lp: driver loaded but no devices found
ppdev: user-space parallel port driver
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
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
loop: module loaded
dm9000 Ethernet Driver, V1.30
eth0: dm9000 at c485e300,c4860304 IRQ 51 MAC: 08:00:3e:26:0a:5b (chip)
Uniform Multi-Platform E-IDE driver
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
BAST NOR-Flash Driver, (c) 2004 Simtec Electronics
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=3, 22ns Twrph0=8 60ns, Twrph1=3 22ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
Scanning device for bad blocks
Creating 2 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x00000000-0x00200000 : "Kernel"
0x00200000-0x04000000 : "root partition"
usbmon: debugfs is not available
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
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2440-i2c s3c2440-i2c: slave address 0x10
s3c2440-i2c s3c2440-i2c: bus frequency set to 378 KHz
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
logger: created 64K log 'log_main'
logger: created 64K log 'log_events'
logger: created 64K log 'log_radio'
TCP cubic registered
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
IP-Config: Complete:
device=eth0, addr=192.168.1.30, mask=255.255.255.0, gw=192.168.1.1,
host=Android, domain=, nis-domain=(none),
bootserver=192.168.1.12, rootserver=192.168.1.12, rootpath=
prepare_namespace() - start
mount_root()
Looking up port of RPC 100003/2 on 192.168.1.12
Looking up port of RPC 100005/1 on 192.168.1.12
VFS: Mounted root (nfs filesystem).
prepare_namespace() - end
Freeing init memory: 144K
() 用 ping 測試系統是否已經啟動
$ ping 192.168.1.30
PING 192.168.1.30 (192.168.1.30) 56(84) bytes of data.
64 bytes from 192.168.1.30: icmp_seq=1 ttl=64 time=0.417 ms
64 bytes from 192.168.1.30: icmp_seq=2 ttl=64 time=0.384 ms
64 bytes from 192.168.1.30: icmp_seq=3 ttl=64 time=0.381 ms
2008年11月15日星期六
Source code editor - kscope
如果不習慣 emacs 的操作方式, 可以選擇 kscope 視窗程式來進行 source code 的編輯.
KScope 是 Cscope 在 KDE 環境下的 source code 編輯器
操作方式, 以下做簡略的說明:
開啟 project:

加入相關的 source code 列表 (選 tree button):

開啟所要編輯的 source code 檔案:

尋找 function 的定義位置:

用關聯圖顯示特定 function 和其他 functions 之間的呼叫和被呼叫關係

安裝 kscope 的方式如下:
Fedora Core 9:
# yum install kscope
Ubuntu 8.10:
# apt-get install kscope
KScope 是 Cscope 在 KDE 環境下的 source code 編輯器
操作方式, 以下做簡略的說明:
開啟 project:

加入相關的 source code 列表 (選 tree button):

開啟所要編輯的 source code 檔案:

尋找 function 的定義位置:

用關聯圖顯示特定 function 和其他 functions 之間的呼叫和被呼叫關係

安裝 kscope 的方式如下:
Fedora Core 9:
# yum install kscope
Ubuntu 8.10:
# apt-get install kscope
訂閱:
文章 (Atom)