부트로더는 U-Boot 1.1.4 를 이용하여 SMDK2440 용으로 포팅 했다.
그다지 어려울 것은 없고 U-Boot 에 미리 들어있는 SMDK2410 용을 이용하여 변형만 시켜주면 된다.
커널은 2.6.13, 2.6.14, 2.6.16.16 의 세가지 버전을 적용시켜 보았다.
2440 보드는 2410 과 거의 유사하므로 별로 할것이 없다.
S3C2410_defconfig 파일을 이용한 후에 SMDK2440 을 체크하면 끝.
640 x 479 pixels
다음으로 mach-type 를 맞춰줘야 한다.
이 작업은 부트로더와 커널 양쪽을 맞춰주면 되나, 간단하게 빨리 끝내는 방법은
arch/arm/kernel/head.S
파일을 아래와 같이 편집한다.
Uncompressing Linux..................................................................................... done, booting the kernel.
Linux version 2.6.16.16 (root@exchange) (gcc version 3.4.1) #5 Tue May 16 06:11:17 EDT 2006
CPU: ARM920Tid(wb) [41129200] revision 0 (ARMv4T)
Machine: SMDK2440
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C2440: core 399.651 MHz, memory 133.217 MHz, peripheral 66.608 MHz
S3C2410 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
Kernel command line: root=/dev/nfs rw nfsroot=192.168.0.3:/arm/work/nfsroot/AESOP ip=192.168.0.5:192.168.0.3:192.168.0.1:255.255.255.0::eth0:off console=ttySAC1,115200n81 ethaddr=08:00:3e:26:0a:5b mem=64M init=/sbin/init
irq: clearing subpending status 00000018
irq: clearing subpending status 00000010
PID hash table entries: 512 (order: 9, 8192 bytes)
timer tcon=00500000, tcnt d8d2, tcfg 00000200,00000000, usec 0000170f
Console: colour dummy device 80x30
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 64MB = 64MB total
Memory: 62080KB available (2180K code, 456K data, 108K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
S3C2410 Power Management, (c) 2004 Simtec Electronics
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C2440: Clock Support, UPLL 47.980 MHz, DVS off
S3C2410 DMA Driver, (c) 2003-2004 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
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS version 1.0, (C) 1999, 2000 Axis Communications AB
JFFS2 version 2.2. (NAND) (C) 2001-2003 Red Hat, Inc.
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
S3C2410 RTC, (c) 2004 Simtec Electronics
ppdev: user-space parallel port driver
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
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
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
loop: loaded (max 8 devices)
cs89x0:cs89x0_probe(0x0)
cs89x0: no cs8900 or cs8920 detected. Be sure to disable PnP with SETUP
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
mice: PS/2 mouse device common for all mice
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
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 2, 16384 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
TCP bic registered
NET: Registered protocol family 1
IP-Config: Device `eth0' not found.
Looking up port of RPC 100003/2 on 192.168.0.3
portmap: RPC call returned error 101
Root-NFS: Unable to get nfsd port number from server, using default
Looking up port of RPC 100005/1 on 192.168.0.3
portmap: RPC call returned error 101
Root-NFS: Unable to get mountd port number from server, using default
mount: RPC call returned error 101
Root-NFS: Server returned error -101 while mounting /arm/work/nfsroot/AESOP
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "nfs" or unknown-block(2,0)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
일단 현재로는 CS8900 드라이버가 활성화 되질 못했다.
nfs 로 root 파일시스템을 사용하도록 하였기 때문에 Kernel panic 이 나타났다.
위의 메시지 중
Kernel command line: root=/dev/nfs rw nfsroot=192.168.0.3:/arm/work/nfsroot/AESOP ip=192.168.0.5:192.168.0.3:192.168.0.1:255.255.255.0::eth0:off console=ttySAC1,115200n81 ethaddr=08:00:3e:26:0a:5b mem=64M init=/sbin/init
이 부분은 U-Boot 에서 설정된 값이 커널로 넘겨진 것이다.
커널 옵션에서
Boot options -> Default kernel command string
의 값이 전달된 형태인데, 이곳에 직접 적어주게 되면 변경할 때 마다 커널을 다시 컴파일 해야 하므로 매우 귀찮다.
따라서 U-Boot 에다
ADS 나 RVDS 의 컴파일러에서는 -fpu 옵션을 사용 할 수 있다.
옵션의 각 내용은 다음과 같다.
none
Selects no floating-point option. No floating-point code is to be used.
vfp
Selects hardware vector floating-point unit conforming to architecture VFPv1. This is a synonym for -fpu vfpv1. This option is not available for the Thumb compilers.
vfpv1
Selects hardware vector floating-point unit conforming to architecture VFPv1, such as the VFP10 rev 0. This option is not available for the Thumb compilers.
vfpv2
Selects hardware vector floating-point unit conforming to architecture VFPv2, such as the VFP10 rev 1. This option is not available for the Thumb compilers.
fpa
Selects hardware Floating Point Accelerator (FPA). This option is not available for the Thumb compilers and is only provided for backwards compatibility.
softvfp+vfp
Selects a floating-point library with pure-endian doubles and software floating-point linkage that uses the VFP hardware. Select this option if you are interworking Thumb code with ARM code on a system that implements a VFP unit.
If you select this option:
- tcc and tcpp behave exactly as for -fpu softvfp except that they link with VFP-optimized floating-point libraries.
- armcc and armcpp behave the same as for -fpu vfp except that all functions are given software floating-point linkage. This means that ARM functions compiled with this option pass and return floating-point arguments and results as they would for -fpu softvfp, but use VFP instructions internally.
* Note
If you specify this option for both armcc and tcc, it ensures that your interworking floating-point code is compiled to use software floating-point linkage. If you specify vfp, vfpv1, or vfpv2 for armcc you must use the __softfp keyword to ensure that your interworking ARM code is compiled to use software floating-point linkage. See the description of __softfp in Function keywords for more information.
softvfp
Selects software floating-point library (FPLib) with pure-endian doubles. This is the default if you do not specify a -fpu option.
softfpa
Selects software floating-point library with mixed-endian doubles.
-- DynaText 4.1 에서 발췌.
위의 옵션을 적용하는데 앞서 확인해야 할 사항은 VFP 를 가진 CPU는 ARM10 과 ARM11 코어 이며, 이외에는 거의가 내장되어 있지 않다.
FPA : ARM7500FE
VFPv1 : ARM10200(VFP10 revision 0 silicon)
VFPv2 : ARM10200E(VFP10 revision 1), ARM1136JF-S(VFP11), VFP9-S
또한 -cpu 옵션에 의해 명시되는 경우 -fpu 옵션은 쓰지 않아도 상관이 없다.
그리고 이러한 경우에 -fpu 를 명시해 주면 -cpu 의 아키텍쳐에 오버라이드 된다.
하지만, -cpu 로 명시된 FPU 아키텍처에 -fpu fpa 처럼 옵션을 주면 에러가 발생된다.
서로 호환성이 없기 때문이다.
대부분의 ARM9 프로세서는 VFP 를 가지고 있지 않다.
따라서 이런경우에는 -fpu softvfp 를 사용하면 vfp 에물레이션으로 동작하게 된다.
단, 속도는 역시 매우 느리다.
If you encounter problems at runtime with the C library character handling functions from ctype.h,
e.g. isdigit(), toupper(), tolower()
or string conversion functions from stdlib.h,
e.g. atoi(), atof()
or string i/o functions,
e.g. sscanf() and sprintf()
this normally arises because the locale has not been correctly initialised.
A typical problem might be when the call isdigit('1') returns 0 rather than 1.
Most cases of such behaviour are caused by bypassing the C library standard initialization code, e.g. by providing your own __main() function. The best solution to this is to ensure that the C library's initialization code in __rt_lib_init() is called correctly. This will setup locale, and any other C library functions which need to be initialized, automatically.
Alternatively you may be able to work around the problem by using:
#include <locale.h>
setlocale(LC_ALL,"C");
However this is not recommend, especially as this will pull in additional parts of locale which may not be needed in your system (potentially around 1.4KB extra). It also leaves the possibility of other parts of the C library remaining uninitialized which may lead to later problems.