MINI2440でのbusybox置き換えのみでpanic2009年08月25日 20時56分32秒

swaponコマンドがリリース版busyboxでは無効

MINI2440の64MBというRAMサイズの場合、swapを有効にしないと決定的にandroid用としてはRAMが足りないというのは各所の情報で明らかでしたので、とりあえず素の状態でswapを有効にしようと思っています。
ところが、リリース時点のbusyboxにはswaponがない。単にシンボリックリンクされていないだけではなく、本体のオブジェクト(applet)がリンクされていないようです。
# swapon
# swapon: applet not found
#

busybox1.13.3をリビルドしてみる

簡単な話だと思いました。
提供されているソースコードを元にswaponを有効にした環境でリビルドすればいいのだと。

手順としてはカーネルのビルドと同じようになってるんですね。

  1. 製品のページにあるソース(busybox-1.13.3-mini2440.tgz)を取得
  2. make defconfig
  3. make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- install
出来上がったbusyboxは「_install」というディレクトリに格納されますので、それを全部ターゲットのルートファイルシステムに書き込めばいいのですが、今回はシンボリックリンクはそのままでも構わないので、とりあえずbusybox本体だけをターゲットの「/bin/busybox」に上書きします。
# chmod +s busybox
も実行しておきます。

結果は以下のようにpanicで落ちます。

U-Boot 1.3.2-mini2440 (Jul  8 2009 - 13:25:23)                                  
                                                                                
I2C:   ready                                                                    
DRAM:  64 MB                                                                    
Flash:  2 MB                                                                    
NAND:  Bad block table not found for chip 0                                     
Bad block table written to 0x03ff8000, version 0x01                             
64 MiB                                                                          
Found Environment offset in OOB..                                               
USB:   S3C2410 USB Deviced                                                      
In:    serial                                                                   
Out:   serial                                                                   
Err:   serial                                                                   
MAC: 08:08:11:18:12:27                                                          
Hit any key to stop autoboot:  0                                                
trying to detect SD Card...                                                     
Manufacturer:       0x1d, OEM "AD"                                              
Product name:       "SD   ", revision 1.0                                       
Serial number:      270541555                                                   
Manufacturing date: 3/2008                                                      
CRC:                0x71, b0 = 1                                                
READ_BL_LEN=15, C_SIZE_MULT=7, C_SIZE=3453                                      
size = 2329935872                                                               
reading uImage.bin                                                              
                                                                                
1928160 bytes read                                                              
## Booting kernel from Legacy Image at 32000000 ...                             
   Image Name:                                                                  
   Created:      2009-08-22   6:39:05 UTC                                       
   Image Type:   ARM Linux Kernel Image (uncompressed)                          
   Data Size:    1928096 Bytes =  1.8 MB                                        
   Load Address: 30008000                                                       
   Entry Point:  30008000                                                       
   Verifying Checksum ... OK                                                    
   Loading Kernel Image ... OK                                                  
OK                                                                              
                                                                                
Starting kernel ...                                                             
                                                                                
Uncompressing Linux.............................................................
Linux version 2.6.29.6 (sakamoto@sakamoto-laptop) (gcc version 4.3.2 (Sourcery 9
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, (c) 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: console=ttySAC0,115200 root=/de201.93 BogoMIPS (lpj=504832)
Mount-cache hash table entries: 512                                             
CPU: Testing write buffer coherency: ok                                         
net_namespace: 672 bytes                                                        
NET: Registered protocol family 16                                              
MINI2440: Option string mini2440=0tb                                            
MINI2440: LCD [0:240x320] 1:800x480 2:1024x768                                  
S3C2440: Initialising architecture                                              
S3C2440: IRQ Support                                                            
S3C24XX DMA Driver, (c) 2003-2004,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  at 0                                                   
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                                                             
NET: Registered protocJFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.     
msgmni has been set to 118                                                      
alg: No test for stdrng (krng)                                                  
io scheduler noop registered                                                    
io scheduler anticipatory registered (default)                                  
io scheduler deadline registered                                                
io scheduler cfq registered                                                     
Console: switching to colour frame buffer device 60x53                          
fb0: s3c2410fb frame buffer device                                              
s3c2440-uart.0: ttySAC0 at MMIO 0x50000000 (irq = 70) is a S3C2440              
s3c2440-uart.1: ttySAC1 at MMIO 0x50004000 (irq = 73) is a S3C2440              
s3c2440-uart.2: ttySAC2 at MMIO 0x50008000 (irq = 76) is a S3C2440              
brd: module loaded                                                              
dm9000 Ethernet Driver, V1.31                                                   
eth0 (dm9000): not using net_device_ops yet                                     
eth0: dm9000e at c486a300,c486e304 IRQ 51 MAC: 08:08:11:18:12:27 (chip)         
S3C24XX NAND Driver, (c) 2004 Simtec Electronics                                
s3c2440-nand s3c2440-nand: Tacls=1, 9ns Twrph0=3 29ns, Twrph1=2 19ns            
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bi)
Creating 4 MTD partitions on "NAND 64MiB 3,3V 8-bit":                           
0x000000000000-0x000000040000 : "u-boot"                                        
ftl_cs: FTL header not found.                                                   
0x000000040000-0x000000060ftl_cs: FTL header not found.                         
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                            
usb usb1: configuration #1 chosen from 1 choice                                 
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/platfor /dev entries driver                        
s3c2440-i2c s3c2440-i2c: slave address 0x10                                     
s3c2440-i2c s3c2440-i2c: bus frequency set to 395 KHz                           
at24 0-0050: 1024 byte 24c08 EEPROM (writable)                                  
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         
cpuidle: using governor ladder                                                  
sdhci: Secure Digital Host Controller Interface driver                          
sdhci: Copyright(c) Pierre Ossman                                               
mapped channel 0 to 0                                                           
s3c2440-sdi s3c2440-sdi: powered down.                                          
s3c2440-sdi s3c2440-sdi: initialisation done.                                   
s3c2440-sdi s3c2440-sdi: running at 0kHz (requested: 0kHz).                     
s3c2440-sdi s3c2440-sdi: running at 198kHz (requested: 197kHz).                 
s3c2440-sdi s3c2440-sdi: running at 198kHz (requested: 197kHz).                 
s3c2440-sdi s3c2440-sdi: running at 198kHz (requested: 197kHz).                 
Registered led device: led1                                                     
s3c2440-sdi s3c2440-sdi: running at 198kHz (rusbcore: registered new interface v
usbcore: registered new interface driver usbhid                                 
usbhid: v2.6:USB HID core driver                                                
Advanced Linux Sound Architecture Driver Version 1.0.18a.                       
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 kjournald starting.  Commit interval 5 seconds                        
EXT3 FS on mmcblk0p2, internal journal                                          
EXT3-fs: mounted filesystem with ordered data mode.                             
VFS: Mounted root (ext3 filesystem) on device 179:2.                            
Freeing init memory: 152K                                                       
Kernel panic - not syncing: Attempted to kill init!                             

busyboxのサイズの問題?

busyboxのデフォルトの環境でのビルドでpanicしないで起動するかどうかを試した結果が以下。各バージョンのソースはこちらから取得しています。
バージョン起動結果busyboxサイズ
1.13.3 MINI2440同梱版OK634420
1.13.3defconfig版NG798472
1.13.4defconfig版NG802160
1.15.0defconfig版NG814428
1.14.1defconfig版NG822636
1.12.4defconfig版NG732504
1.11.3defconfig版OK753036
1.10.4defconfig版OK744892

さて、1.11.3などはpanicでは落ちないものの以下のようにinitの手順が異なるようで、最後まで処理が完了しません。

U-Boot 1.3.2-mini2440 (Jul  8 2009 - 13:25:23)                                  
                                                                                
I2C:   ready                                                                    
DRAM:  64 MB                                                                    
Flash:  2 MB                                                                    
NAND:  Bad block table not found for chip 0                                     
Bad block table written to 0x03ff8000, version 0x01                             
64 MiB                                                                          
Found Environment offset in OOB..                                               
USB:   S3C2410 USB Deviced                                                      
In:    serial                                                                   
Out:   serial                                                                   
Err:   serial                                                                   
MAC: 08:08:11:18:12:27                                                          
Hit any key to stop autoboot:  0                                                
trying to detect SD Card...                                                     
Manufacturer:       0x1d, OEM "AD"                                              
Product name:       "SD   ", revision 1.0                                       
Serial number:      270541555                                                   
Manufacturing date: 3/2008                                                      
CRC:                0x71, b0 = 1                                                
READ_BL_LEN=15, C_SIZE_MULT=7, C_SIZE=3453                                      
size = 2329935872                                                               
reading uImage.bin                                                              
                                                                                
1928160 bytes read                                                              
## Booting kernel from Legacy Image at 32000000 ...                             
   Image Name:                                                                  
   Created:      2009-08-22   6:39:05 UTC                                       
   Image Type:   ARM Linux Kernel Image (uncompressed)                          
   Data Size:    1928096 Bytes =  1.8 MB                                        
   Load Address: 30008000                                                       
   Entry Point:  30008000                                                       
   Verifying Checksum ... OK                                                    
   Loading Kernel Image ... OK                                                  
OK                                                                              
                                                                                
Starting kernel ...                                                             
                                                                                
Uncompressing Linux.............................................................
Linux version 2.6.29.6 (sakamoto@sakamoto-laptop) (gcc version 4.3.2 (Sourcery 9
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, (c) 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: console=ttySAC0,115200 root=/dev/mmcblk0p2 init=/linuxrc rd
irq: clearing pending status 02000000                                           
irq: clearing subpending status 00000002                                        
PID hash table entries: 256 (order: 8, 1024 bytes)                              
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: 64M201.93 BogoMIPS (lpj=504832)                                         
Mount-cache hash table entries: 512                                             
CPU: Testing write buffer coherency: ok                                         
net_namespace: 672 bytes                                                        
NET: Registered protocol family 16                                              
MINI2440: Option string mini2440=0tb                                            
MINI2440: LCD [0:240x320] 1:800x480 2:1024x768                                  
S3C2440: Initialising architecture                                              
S3C2440: IRQ Support                                                            
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics                       
DMA channel 0 at c48080bio: create slab  at 0                            
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                                                             
NET: Registered protocol family 1                                               
JFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.                           
msgmni has been set to 118                                                      
alg: No test for stdrng (krng)                                                  
io scheduler noop registered                                                    
io scheduler anticipatory registered (default)                                  
io scheduler deadline registered                                                
io scheduler cfq registered                                                     
Console: switching to colour frame buffer device 60x53                          
fb0: s3c2410fb frame buffer device                                              
s3c2440-uart.0: ttySAC0 at MMIO 0x50000000 (irq = 70) is a S3C2440              
s3c2440-uart.1: ttySAC1 at MMIO 0x50004000 (irq = 73) is a S3C2440              
s3c2440-uart.2: ttySAC2 at MMIO 0x50008000 (irq = 76) is a S3C2440              
brd: module loaded                                                              
dm9000 Ethernet Driver, V1.31                                                   
eth0 (dm9000): not using net_device_ops yet                                     
eth0: dm9000e at c486a300,c486e304 IRQ 51 MAC: 08:08:11:18:12:27 (chip)         
S3C24XX NAND Driver, (c) 2004 Simtec Electronics                                
s3c2440-nand s3c2440-nand: Tacls=1, 9ns Twrph0=3 29ns, Twrph1=2 19ns            
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bi)
Creating 4 MTD partitions on "NAND 64MiB 3,3V 8-bit":                           
0x000000000000-0x000000040000 : "u-boot"                                        
ftl_cs: FTL header not found.                                                   
0x000000040000-0x000000060000 : "u-boot-env"                                    
0x00000ftl_cs: FTL header not found.                                            
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                            
usb usb1: configuration #1 chosen from 1 choice                                 
hub 1-0:1.0: USB hub found                                                      
hub 1-0:1.0: 2 ports detected                                                   
us3c2440-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                    
s3c2440-ts s3c2440-ts: Starting                                                 
  Created group ts filter len 12 depth 2 close 10 thresh 6                      
  Created Median ts filter len 20 depth 2 dec 24                                
  Created Mean ts filter len 4 depth 2 thresh 65535                             
  Created Linear ts filter depth 2                                              
s3c2440-ts s3c2440-ts: 4 filter(s) initialized                                  
s3c2440-ts s3c2440-ts: successfully loaded                                      
input: s3c2410 TouchScreen as /devices/virtual/input/input1                     
S3C24XX RTC, (c) 2004,2006 Simtec Electronics                                   
s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling                              
s3c2410-rtc s3c2410-rtc: rtc core: registered s3c as rtc0                       
i2c /dev entries driver                                                         
s3c2440-i2c s3c2440-i2c: slave address 0x10                                     
s3c2440-i2c s3c2440-i2c: bus frequency set to 395 KHz                           
at24 0-0050: 1024 byte 24c08 EEPROM (writable)                                  
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         
cpuidle: using governor ladder                                                  
sdhci: Secure Digital Host Controller Interface driver                          
sdhci: Copyright(c) Pierre Ossman                                               
mapped channel 0 to 0                                                           
s3c2440-sdi s3c2440-sdi: powered down.                                          
s3c2440-sdi s3c2440-sdi: initialisation done.                                   
s3c2440-sdi s3c2440-sdi: running at 0kHz (requested: 0kHz).                     
s3c2440-sdi s3c2440-sdi: running at 198kHz (requested: 197kHz).                 
s3c2440-sdi s3c2440-sdi: running at 198kHz (requested: 197kHz).                 
s3c2440-sdi s3c2440-sdi: running at 198kHz (requested: 197kHz).                 
Registered led device: led1                                                     
Registered led device: led2                                                     
s3c2440-sdi s3c2440-sdi: runnusbcore: registered new interface driver hiddev    
usbcore: registered new interface driver usbhid                                 
usbhid: v2.6:USB HID core driver                                                
Advanced Linux Sound Architecture Driver Version 1.0.18a.                       
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_UDA1kjournald starting.  Commit interval 5 seconds                
EXT3 FS on mmcblk0p2, internal journal                                          
EXT3-fs: mounted filesystem with ordered data mode.                             
VFS: Mounted root (ext3 filesystem) on device 179:2.                            
Freeing init memory: 152K                                                       
init started: BusyBox v1.11.3 (2009-08-25 22:32:38 JST)                         
starting pid 739, tty '': '/etc/init.d/rcS'                                     
                                                                                
Please press Enter to activate this console. 

現在未解決。試行錯誤中

現在未解決です。試行錯誤中です。解決策を募集します。

make menuconfigでかなりオプション指定を削ったつもりでも1.13.3の同梱版ほどコンパクトになりませんし、起動にも失敗しています。