PowerPC 版 LinkStation?/TeraStation?/玄箱の U-Boot に関するページです。

U-Bootとは

以前は、PPCBootという名前でPowerPC専用だったが、その後U-Bootに名称変更され、PowerPC以外の板もサポートするようになった。TFTPによるネットワーク経由でkernelをロードできるなど、非常に多機能なブートローダ。

LinkStation?/玄箱への移植

U-Bootを初めてLinkStation?/玄箱に移植したのは、LinkStation?/玄箱のカーネルパッチでおなじみの虹野氏である。

残念ながら、その後Web上では公開されなくなった。それに代わり、Mr.Mihai Georgianが引き続きLinkStation?/玄箱への移植作業を行っている。

debug() を有効にする

U-Bootでは、デバッグ用に ソースコード中に debug() が組み込まれており、これを有効にすれば、起動中の状況をモニタリングできる。DEBUGオプションを定義してコンパイルすれば、debug() が有功になる。

$ diff -Nur config.mk.orig config.mk
--- config.mk.orig	2010-05-24 15:40:01.000000000 +0900
+++ config.mk	2010-05-24 15:40:19.000000000 +0900
@@ -136,7 +136,7 @@
 ARFLAGS = crv
 endif
 RELFLAGS= $(PLATFORM_RELFLAGS)
-DBGFLAGS= -g # -DDEBUG
+DBGFLAGS= -g -DDEBUG
 OPTFLAGS= -Os #-fomit-frame-pointer
 ifndef LDSCRIPT
 #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug

ST Micro M29W320DT など 16bit mode も持っている FlashROM の問題

NAS Centralでの tonyo 氏の書き込み

This might sound confusing, so I've tried to say too much rather than too little
in the hopes that it will help.

First, I don't have a schematic, so I'm not sure how A1, A0 and/or BYTE# are
wired. I'm still not sure if it's 8-bit or 16-bit in truth.

Regardless, the CFI probe and detection code only works when all of the CFI
table offsets are doubled. This is consistent with addressing a 16-bit flash,
since the address lines are typically shifted by one bit. The A0 line (and up) 
on the flash are driven by A1 and up on the CPU. So byte addresses 0, 2, 4 would 
access flash word-addresses 0, 1, 2. This is a typical arrangement for 16-bit 
memory. In most cases the A0 line on the CPU is simply not connected.

The mtd driver doesn't know what the board is doing, so to figure it out, it 
simply tries it both ways in the probe code. In our case, the probe is 
successful with an offset scaling factor of two. This is typical for a 16-bit 
word memory accessed by byte addresses. This "offset scaling factor" is called 
"cfi->device_type" in the mtd driver.

Flash chips usually want to see commands written to the magic offsets 0x555 and 
0x2aa. To get these offsets to appear at the 16-bit flash, the CPU writes to 
byte addresses 0xaaa and 0x555, which get shifted right due to the A1->A0 
hookup, to become 0x555 and 0x2aa, which is what the flash wants to see.

However, what the mtd driver does is it takes the magic offsets 0x555 and 0x2aa 
and it shifts them left using the scaling factor "cfi->device_type" to produce 
the necessary doubled CPU byte addresses. This is a problem because a shift-left 
of 0x2aa does not yield 0x555, but rather 0x554. I think this is the real 
problem.

Unfortunately, the flash chip really does want the CPU to generate the byte 
addresses 0xaaa and 0x555. It seems to be emulating the behavior of 16-bit 
addressing while using byte addresses. The mtd driver writes to 0x554, but this 
usually works, because the A0 bit would be dropped anyway, i.e. it's not 
connected.

What I decided to do was change the scaling factor back to one and let the code 
directly use 0xaaa and 0x555 instead. This should work, because cfi->device_type 
isn't used for anything else once the detection and CFI table parsing is 
finished. I dislike the hack on aesthetic grounds, but it works. A more elegant 
approach would be to fix up the 0x554, whenever it occurs due to the scaling, 
but I thought the one-liner was simpler, even if it seems weird.

tonyo 氏による Linux kernel へのパッチ

diff -C 16 -r /usr/src/olinux/linux-2.6.23/drivers/mtd/chips/cfi_cmdset_0002.c /usr/src/linux/drivers/mtd/chips/cfi_cmdset_0002.c
*** /usr/src/olinux/linux-2.6.23/drivers/mtd/chips/cfi_cmdset_0002.c   Tue Oct  9 15:31:38 2007 [#s7430195]
--- /usr/src/linux/drivers/mtd/chips/cfi_cmdset_0002.c   Wed Feb  6 06:45:04 2008
*************** [#o0e60ecc]
*** 319,350 **** [#v5c68b3f]
--- 319,362 ----
                  "bank location. Assuming top.\n", map->name);
           bootloc = 2;
        }
 
        if (bootloc == 3 && cfi->cfiq->NumEraseRegions > 1) {
           printk(KERN_WARNING "%s: Swapping erase regions for broken CFI table.\n", map->name);
 
           for (i=0; i<cfi->cfiq->NumEraseRegions / 2; i++) {
              int j = (cfi->cfiq->NumEraseRegions-1)-i;
              __u32 swap;
 
              swap = cfi->cfiq->EraseRegionInfo[i];
              cfi->cfiq->EraseRegionInfo[i] = cfi->cfiq->EraseRegionInfo[j];
              cfi->cfiq->EraseRegionInfo[j] = swap;
           }
        }
+
+       /*
+        * LinkStation hack - A problem was occurring because 0x555 is not equal to (0x2aa << 1).
+        *
+        * This hack turns off the addr_unlock scaling and causes the addr_unlock
+        * values to be pre-assigned properly below.
+        */
+       cfi->device_type = CFI_DEVICETYPE_X8;
+       /*
+        * end of LinkStation hack
+        */
+
        /* Set the default CFI lock/unlock addresses */
        cfi->addr_unlock1 = 0x555;
        cfi->addr_unlock2 = 0x2aa;
        /* Modify the unlock address if we are in compatibility mode */
        if (   /* x16 in x8 mode */
           ((cfi->device_type == CFI_DEVICETYPE_X8) &&
              (cfi->cfiq->InterfaceDesc == 2)) ||
           /* x32 in x16 mode */
           ((cfi->device_type == CFI_DEVICETYPE_X16) &&
              (cfi->cfiq->InterfaceDesc == 4)))
        {
           cfi->addr_unlock1 = 0xaaa;
           cfi->addr_unlock2 = 0x555;
        }
 
     } /* CFI mode */

400円日記における虹野氏の書き込み

10月31日
フラッシュ消去不可
    玄箱では問題なく動いているMTDなのに、何故かTeraStationでは読み出しだけで書き
込みが出来ない……。正確には書き込み前の消去が異常終了してるんだけど。
    確かにTeraStationのフラッシュメモリは玄箱と違うんだけど、データシートを見る限
り同じコマンドセットなのに、一体何が原因なんだろう?

11月1日
unlockアドレス
    x8 Modeでのunlockアドレスが0x555でなく0x554になってるよ……。これってやっぱり
MTDのバグなのかなぁ。でも、これで MBM29PL32TMはちゃんと動いてるんだよなぁ。
    さて、悪いのは誰でしょう?

       1. unlockアドレスの生成方法を間違えているMTD
       2. 0x554がunlockアドレスと認識されないM29DW324DB
       3. 楽する為にCFIを使っている虹野(笑)

    とりあえずイレーズに失敗する原因は分かったけど、これどうやって直すかなぁ……。

DTC対応U-Bootの作成

kernel 2.6.20以降からDTCを利用するようになったので、ブートローダもDTCに対応したものでないといけない。ただし、DTCを利用せずに、以前からの loader.o を使った起動も可能。

2010.03

標準で DTC に対応している。(というか、EMブートできなくなっている?) netconsole を使いたい場合は、include/configs/linkstation.h を適宜編集すること。

KuroBoxHG/Linkstation HGLANの場合

$ wget ftp://ftp.denx.de/pub/u-boot/u-boot-2010.03.tar.bz2
$ tar u-boot-2010.03.tar.bz2
$ cd u-boot-2010.03
$ make linkstation_HGLAN_config
$ make

できあがった u-boot.bin をFlashROM に書き込む。

KuroBox?/Linkstation HDLANの場合

Ver. 1.1.4 の kurobox.path に含まれていた tulip ドライバ用のパッチが 2010.03 ではすべて抜け落ちていたので、kurobox.path を参考にして、config_HLAN か config_LAN が定義されている場合にそれらのコードが有効になるようパッチを当てたら、FlashROMが富士通 29PL32TM のボードで動いた。FlashROM に ST Micro のM29W320DT や M29DW325DB が使われているボードでは動かないと思うので、注意。

以下が起動画面。

U-Boot 2010.03 (May 29 2010 - 18:52:22) LinkStation / KuroBox

CPU:   MPC8245 Revision 1.4 at 196.608 MHz: 16 kB I-Cache 16 kB D-Cache
DRAM:  64 MB
FLASH:  4 MB
*** Warning - bad CRC, using default environment [#m4e21cda]

        00  0b  1317  0985  0200  ff
        00  0c  1095  0680  0101  ff
        00  0e  1033  0035  0c03  ff
        00  0e  1033  0035  0c03  ff
        00  0e  1033  00e0  0c03  ff
In:    serial
Out:   serial
Err:   serial
Net:   COMET#0
IDE:   Bus 0: ......OK
  Device 0: Model: ST33232A Firm: 0.39 Ser#: VH126546
            Type: Hard Disk
            Capacity: 3077.6 MB = 3.0 GB (6303024 x 512)
Boot in 10 seconds ('s' to stop)...Loading 0:1:boot/uImage
Loading file "boot/uImage" from ide device 0:1 (hda1)
** File not found boot/uImage
Loading file "boot/kuroboxHG.dtb" from ide device 0:1 (hda1)
** File not found boot/kuroboxHG.dtb
Wrong Image Format for bootm command
ERROR: can't get kernel image!
Wrong Image Format for bootm command
ERROR: can't get kernel image!
=> printenv
bootcmd=run bootcmd1
nfsboot=bootp;run nfsargs;bootm
bootdelay=10
baudrate=57600
autoload=no
stdin=serial
stdout=serial
stderr=serial
ipaddr=192.168.11.150
netmask=255.255.255.0
serverip=192.168.11.149
ncip=192.168.11.149
netretry=no
nc=setenv stdin nc;setenv stdout nc;setenv stderr nc
ser=setenv stdin serial;setenv stdout serial;setenv stderr serial
ldaddr=800000
hdpart=0:1
hdfile=boot/uImage
hdload=echo Loading ${hdpart}:${hdfile};ext2load ide ${hdpart} ${ldaddr} ${hdfile};ext2load ide ${hdpart} 7f0000 boot/kuroboxHG.dtb
boothd=setenv bootargs root=/dev/sda1 console=ttyS1,57600 netconsole=@192.168.1.7/eth0,@192.168.1.1/00:50:BF:A4:59:71 rtc-rs5c372.probe=0,0x32 debug;bootm ${ldaddr} - 7f0000
hdboot=run hdload;run boothd
flboot=setenv bootargs root=/dev/hda1;bootm ffc00000
emboot=setenv bootargs root=/dev/ram0;bootm ffc00000
nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
bootretry=30
bootcmd1=run hdboot;run flboot
bootcmd2=run flboot
bootcmd3=run emboot
writeng=protect off fff70000 fff7ffff;era fff70000 fff7ffff;mw.l 800000 4e474e47 1;cp.b 800000 fff70000 4
writeok=protect off fff70000 fff7ffff;era fff70000 fff7ffff;mw.l 800000 4f4b4f4b 1;cp.b 800000 fff70000 4
ubpart=0:3
ubfile=share/u-boot/u-boot-hd.flash.bin
ubload=echo Loading ${ubpart}:${ubfile};ext2load ide ${ubpart} ${ldaddr} ${ubfile}
ubsaddr=fff00000
ubeaddr=fff2ffff
ubflash=protect off ${ubsaddr} ${ubeaddr};era ${ubsaddr} ${ubeaddr};cp.b ${ldaddr} ${ubsaddr} ${filesize};cmp.b ${ldaddr} ${ubsaddr} ${filesize}
upgrade=run ubload ubflash
ethact=COMET#0
bootargs=root=/dev/hda1

Environment size: 1652/65532 bytes
MBM29PL32TM
=> flinfo

Bank # 1: CFI conformant FLASH (8 x 8)  Size: 4 MB in 71 Sectors
  AMD Standard command set, Manufacturer ID: 0x00, Device ID: 0x01
  Erase timeout: 16384 ms, write timeout: 1 ms
  Buffer write timeout: 5 ms, buffer size: 32 bytes

  Sector Start Addresses:
  FFC00000        FFC02000        FFC04000        FFC06000        FFC08000
  FFC0A000        FFC0C000        FFC0E000        FFC10000        FFC20000
  FFC30000        FFC40000        FFC50000        FFC60000        FFC70000
  FFC80000        FFC90000        FFCA0000        FFCB0000        FFCC0000
  FFCD0000        FFCE0000        FFCF0000        FFD00000        FFD10000
  FFD20000        FFD30000        FFD40000        FFD50000        FFD60000
  FFD70000        FFD80000        FFD90000        FFDA0000        FFDB0000
  FFDC0000        FFDD0000        FFDE0000        FFDF0000        FFE00000
  FFE10000        FFE20000        FFE30000        FFE40000        FFE50000
  FFE60000        FFE70000        FFE80000        FFE90000        FFEA0000
  FFEB0000        FFEC0000        FFED0000 E      FFEE0000 E      FFEF0000 E
  FFF00000   RO   FFF10000   RO   FFF20000   RO   FFF30000   RO   FFF40000 E
  FFF50000 E      FFF60000 E RO   FFF70000        FFF80000        FFF90000 E
  FFFA0000 E      FFFB0000 E      FFFC0000 E      FFFD0000 E      FFFE0000 E
  FFFF0000 E

KURO-BOX/T4用のパッチを当てた場合の flinfo

=> flinfo

Bank # 1: CFI conformant FLASH (8 x 8)  Size: 4 MB in 71 Sectors
  AMD Standard command set, Manufacturer ID: 0x04, Device ID: 0x7E1A01
  Erase timeout: 16384 ms, write timeout: 1 ms
  Buffer write timeout: 5 ms, buffer size: 32 bytes

  Sector Start Addresses:
  FFC00000        FFC02000        FFC04000        FFC06000        FFC08000
  FFC0A000        FFC0C000        FFC0E000        FFC10000        FFC20000
  FFC30000        FFC40000        FFC50000        FFC60000        FFC70000
  FFC80000        FFC90000        FFCA0000        FFCB0000        FFCC0000
  FFCD0000        FFCE0000        FFCF0000        FFD00000        FFD10000
  FFD20000        FFD30000        FFD40000        FFD50000        FFD60000
  FFD70000        FFD80000        FFD90000        FFDA0000        FFDB0000
  FFDC0000        FFDD0000        FFDE0000        FFDF0000        FFE00000
  FFE10000        FFE20000        FFE30000        FFE40000        FFE50000
  FFE60000        FFE70000        FFE80000        FFE90000        FFEA0000
  FFEB0000        FFEC0000        FFED0000 E      FFEE0000 E      FFEF0000 E
  FFF00000   RO   FFF10000   RO   FFF20000   RO   FFF30000   RO   FFF40000 E
  FFF50000 E      FFF60000 E RO   FFF70000        FFF80000        FFF90000 E
  FFFA0000 E      FFFB0000 E      FFFC0000 E      FFFD0000 E      FFFE0000 E
  FFFF0000 E

KURO-BOX/T4用のパッチを当てて、DEBUG を有効にした場合の起動画面

U-Boot 2010.03 (Jun 03 2010 - 18:39:00) LinkStation / KuroBox

CPU:   MPC8245 Revision 1.4 at 196.608 MHz: 16 kB I-Cache 16 kB D-Cache
DRAM:  64 MB
Top of RAM usable for U-Boot at: 04000000
Reserving 241k for U-Boot at: 03fc3000
Reserving 576k for malloc() at: 03f33000
Reserving 56 Bytes for Board Info at: 03f32fc8
Reserving 52 Bytes for Global Data at: 03f32f94
Stack Pointer at: 03f32f78
New Stack Pointer is: 03f32f78
Now running in RAM - U-Boot at: 03fc3000
FLASH: flash detect cfi
fwc addr ffc00000 cmd f0 f0 8bit x 8 bit
fwc addr ffc00000 cmd ff ff 8bit x 8 bit
fwc addr ffc000aa cmd 98 98 8bit x 8 bit
is= cmd 51(Q) addr ffc00020 is= 51 51
is= cmd 52(R) addr ffc00022 is= 52 52
is= cmd 59(Y) addr ffc00024 is= 59 59
device interface is 2
found port 1 chip 1 port 8 bits chip 8 bits
00 : 51 52 59 02 00 40 00 00 00 00 00 27 36 00 00 07  QRY..@.....'6...
10 : 07 0a 00 01 05 04 00 16 02 00 05 00 02 07 00 20  ...............
20 : 00 3e 00 00 01 00 00 00 00 00 00 00 00 ff b9 ff  .>..............
fwc addr ffc00000 cmd f0 f0 8bit x 8 bit
fwc addr ffc00aaa cmd aa aa 8bit x 8 bit
fwc addr ffc00555 cmd 55 55 8bit x 8 bit
fwc addr ffc00aaa cmd 90 90 8bit x 8 bit
fwc addr ffc00000 cmd f0 f0 8bit x 8 bit
fwc addr ffc000aa cmd 98 98 8bit x 8 bit
manufacturer is 2
manufacturer id is 0x04
device id is 0x007e
device id2 is 0x1a01
cfi version is 0x3133
size_ratio 1 port 8 bits chip 8 bits
found 2 erase regions
erase region 0: 0x00200007
erase_region_count = 8 erase_region_size = 8192
erase region 1: 0x0100003e
erase_region_count = 63 erase_region_size = 65536
fwc addr ffc00000 cmd f0 f0 8bit x 8 bit
flash_protect ON: from 0xFFF00000 to 0xFFF35FFF
protect on 55
protect on 56
protect on 57
protect on 58
flash_protect ON: from 0xFFF60000 to 0xFFF6FFFF
protect on 61
 4 MB

DEBUG を有効にした場合の起動画面。

U-Boot 2010.03 (May 30 2010 - 18:54:28) LinkStation / KuroBox

CPU:   MPC8245 Revision 1.4 at 196.608 MHz: 16 kB I-Cache 16 kB D-Cache
DRAM:  64 MB
Top of RAM usable for U-Boot at: 04000000
Reserving 241k for U-Boot at: 03fc3000
Reserving 576k for malloc() at: 03f33000
Reserving 56 Bytes for Board Info at: 03f32fc8
Reserving 52 Bytes for Global Data at: 03f32f94
Stack Pointer at: 03f32f78
New Stack Pointer is: 03f32f78
Now running in RAM - U-Boot at: 03fc3000
FLASH: flash detect cfi
fwc addr ffc00000 cmd f0 f0 8bit x 8 bit
fwc addr ffc00000 cmd ff ff 8bit x 8 bit
fwc addr ffc00055 cmd 98 98 8bit x 8 bit
is= cmd 51(Q) addr ffc00010 is= 28 51
fwc addr ffc00555 cmd 98 98 8bit x 8 bit
is= cmd 51(Q) addr ffc00010 is= 28 51
fwc addr ffc00000 cmd f0 f0f0 16bit x 8 bit
fwc addr ffc00000 cmd ff ffff 16bit x 8 bit
fwc addr ffc000aa cmd 98 9898 16bit x 8 bit
is= cmd 51(Q) addr ffc00020 is= 5151 5151
is= cmd 52(R) addr ffc00022 is= 5252 5252
is= cmd 59(Y) addr ffc00024 is= 5959 5959
device interface is 2
found port 2 chip 1 port 16 bits chip 8 bits
00 : 51 52 59 02 00 40 00 00 00 00 00 27 36 00 00 07  QRY..@.....'6...
10 : 07 0a 00 01 05 04 00 16 02 00 05 00 02 07 00 20  ...............
20 : 00 3e 00 00 01 00 00 00 00 00 00 00 00 ff f7 ff  .>..............
fwc addr ffc00000 cmd f0 f0f0 16bit x 8 bit
fwc addr ffc01554 cmd aa aaaa 16bit x 8 bit
fwc addr ffc00aaa cmd 55 5555 16bit x 8 bit
fwc addr ffc01554 cmd 90 9090 16bit x 8 bit
fwc addr ffc00000 cmd f0 f0f0 16bit x 8 bit
fwc addr ffc000aa cmd 98 9898 16bit x 8 bit
manufacturer is 2
manufacturer id is 0x0
device id is 0x1
device id2 is 0x0
cfi version is 0x3133
size_ratio 1 port 16 bits chip 8 bits
found 2 erase regions
erase region 0: 0x00200007
erase_region_count = 8 erase_region_size = 8192
erase region 1: 0x0100003e
erase_region_count = 63 erase_region_size = 65536
fwc addr ffc00000 cmd f0 f0 8bit x 8 bit
flash_protect ON: from 0xFFF00000 to 0xFFF35FFF
protect on 55
protect on 56
protect on 57
protect on 58
flash_protect ON: from 0xFFF60000 to 0xFFF6FFFF
protect on 61
 4 MB

TopJTAG における Flash Array Information

Detected Command SetAMD (Buffered Prog.)
Manufacture0x04h (Fujitsu)
Device Code0x7Eh
Common Flash Interface (CFI) CompliantYes
Common Flash Interface (CFI) Information
Primary Command SetAMD/Fujitsu Std
Alternative Command SetN/A
Vcc Min Program/Erase Voltage2.7V
Vcc Max Program/Erase Voltage3.6V
Vpp Min Program/Erase VoltageN/A
Vpp Max Program/Erase VoltageN/A
Typ Timeout per Single Byte/Word Program128 us
Typ Timeout for Single Multi-Byte Program4096 us
Max Timeout per Indivisual Block Erase16384 ms
Max Timeout for Full Chip EraseN/A
Device Size4194304 Bytes
Flash Device Interfacex8/x17 async
Max Number of Bytes in Multi-Byte Program32 Bytes
Sectors8 x 8192 Bytes,
63 x 65536 Bytes
M29W320DT

KURO-BOX/T4用のパッチを当てた場合の flinfo

flinfo

Bank # 1: CFI conformant FLASH (8 x 8)  Size: 4 MB in 67 Sectors
  AMD Standard command set, Manufacturer ID: 0x20, Device ID: 0xCA
  Erase timeout: 16384 ms, write timeout: 1 ms

  Sector Start Addresses:
  FFC00000        FFC04000        FFC06000        FFC08000        FFC10000
  FFC20000        FFC30000        FFC40000        FFC50000        FFC60000
  FFC70000        FFC80000        FFC90000        FFCA0000        FFCB0000
  FFCC0000        FFCD0000        FFCE0000        FFCF0000        FFD00000
  FFD10000        FFD20000        FFD30000        FFD40000        FFD50000
  FFD60000        FFD70000        FFD80000        FFD90000        FFDA0000
  FFDB0000        FFDC0000        FFDD0000        FFDE0000        FFDF0000
  FFE00000        FFE10000        FFE20000        FFE30000        FFE40000
  FFE50000        FFE60000        FFE70000        FFE80000        FFE90000
  FFEA0000        FFEB0000        FFEC0000        FFED0000        FFEE0000 E
  FFEF0000 E      FFF00000   RO   FFF10000   RO   FFF20000   RO   FFF30000   RO
  FFF40000 E      FFF50000 E      FFF60000 E RO   FFF70000        FFF80000
  FFF90000 E      FFFA0000 E      FFFB0000 E      FFFC0000 E      FFFD0000 E
  FFFE0000 E      FFFF0000 E

KURO-BOX/T4用のパッチを当てて、DEBUG を有効にした場合の起動画面。

U-Boot 2010.03 (Jun 03 2010 - 18:39:00) LinkStation / KuroBox

CPU:   MPC8245 Revision 1.4 at 196.608 MHz: 16 kB I-Cache 16 kB D-Cache
DRAM:  64 MB
Top of RAM usable for U-Boot at: 04000000
Reserving 241k for U-Boot at: 03fc3000
Reserving 576k for malloc() at: 03f33000
Reserving 56 Bytes for Board Info at: 03f32fc8
Reserving 52 Bytes for Global Data at: 03f32f94
Stack Pointer at: 03f32f78
New Stack Pointer is: 03f32f78
Now running in RAM - U-Boot at: 03fc3000
FLASH: flash detect cfi
fwc addr ffc00000 cmd f0 f0 8bit x 8 bit
fwc addr ffc00000 cmd ff ff 8bit x 8 bit
fwc addr ffc000aa cmd 98 98 8bit x 8 bit
is= cmd 51(Q) addr ffc00020 is= 51 51
is= cmd 52(R) addr ffc00022 is= 52 52
is= cmd 59(Y) addr ffc00024 is= 59 59
device interface is 2
found port 1 chip 1 port 8 bits chip 8 bits
00 : 51 52 59 02 00 40 00 00 00 00 00 27 36 b5 c5 04  QRY..@.....'6...
10 : 00 0a 00 05 00 04 00 16 02 00 00 00 04 00 00 40  ...............@
20 : 00 01 00 20 00 00 00 80 00 3e 00 00 01 00 00 00  ... .....>......
fwc addr ffc00000 cmd f0 f0 8bit x 8 bit
fwc addr ffc00aaa cmd aa aa 8bit x 8 bit
fwc addr ffc00555 cmd 55 55 8bit x 8 bit
fwc addr ffc00aaa cmd 90 90 8bit x 8 bit
fwc addr ffc00000 cmd f0 f0 8bit x 8 bit
fwc addr ffc000aa cmd 98 98 8bit x 8 bit
manufacturer is 2
manufacturer id is 0x20
device id is 0x00ca
device id2 is 0x0000
cfi version is 0x3130
size_ratio 1 port 8 bits chip 8 bits
found 4 erase regions
erase region 0: 0x00400000
erase_region_count = 1 erase_region_size = 16384
erase region 1: 0x00200001
erase_region_count = 2 erase_region_size = 8192
erase region 2: 0x00800000
erase_region_count = 1 erase_region_size = 32768
erase region 3: 0x0100003e
erase_region_count = 63 erase_region_size = 65536
fwc addr ffc00000 cmd f0 f0 8bit x 8 bit
flash_protect ON: from 0xFFF00000 to 0xFFF35FFF
protect on 51
protect on 52
protect on 53
protect on 54
flash_protect ON: from 0xFFF60000 to 0xFFF6FFFF
protect on 57
 4 MB

DEBUG を有効にした場合の起動画面。

U-Boot 2010.03 (May 30 2010 - 18:54:28) LinkStation / KuroBox

CPU:   MPC8245 Revision 1.4 at 196.608 MHz: 16 kB I-Cache 16 kB D-Cache
DRAM:  64 MB
Top of RAM usable for U-Boot at: 04000000
Reserving 241k for U-Boot at: 03fc3000
Reserving 576k for malloc() at: 03f33000
Reserving 56 Bytes for Board Info at: 03f32fc8
Reserving 52 Bytes for Global Data at: 03f32f94
Stack Pointer at: 03f32f78
New Stack Pointer is: 03f32f78
Now running in RAM - U-Boot at: 03fc3000
FLASH: flash detect cfi
fwc addr ffc00000 cmd f0 f0 8bit x 8 bit
fwc addr ffc00000 cmd ff ff 8bit x 8 bit
fwc addr ffc00055 cmd 98 98 8bit x 8 bit
is= cmd 51(Q) addr ffc00010 is= 28 51
fwc addr ffc00555 cmd 98 98 8bit x 8 bit
is= cmd 51(Q) addr ffc00010 is= 28 51
fwc addr ffc00000 cmd f0 f0f0 16bit x 8 bit
fwc addr ffc00000 cmd ff ffff 16bit x 8 bit
fwc addr ffc000aa cmd 98 9898 16bit x 8 bit
is= cmd 51(Q) addr ffc00020 is= 5100 5151
fwc addr ffc00aaa cmd 98 9898 16bit x 8 bit
is= cmd 51(Q) addr ffc00020 is= 5100 5151
fwc addr ffc00000 cmd f0 00f0 16bit x 16 bit
fwc addr ffc00000 cmd ff 00ff 16bit x 16 bit
fwc addr ffc000aa cmd 98 0098 16bit x 16 bit
is= cmd 51(Q) addr ffc00020 is= 5100 0051
fwc addr ffc00aaa cmd 98 0098 16bit x 16 bit
is= cmd 51(Q) addr ffc00020 is= 5100 0051
fwc addr ffc00000 cmd f0 f0f0f0f0 32bit x 8 bit
fwc addr ffc00000 cmd ff ffffffff 32bit x 8 bit
fwc addr ffc00154 cmd 98 98989898 32bit x 8 bit
is= cmd 51(Q) addr ffc00040 is= 00000000 51515151
fwc addr ffc01554 cmd 98 98989898 32bit x 8 bit
is= cmd 51(Q) addr ffc00040 is= 00000000 51515151
fwc addr ffc00000 cmd f0 00f000f0 32bit x 16 bit
fwc addr ffc00000 cmd ff 00ff00ff 32bit x 16 bit
fwc addr ffc00154 cmd 98 00980098 32bit x 16 bit
is= cmd 51(Q) addr ffc00040 is= 00000000 00510051
fwc addr ffc01554 cmd 98 00980098 32bit x 16 bit
is= cmd 51(Q) addr ffc00040 is= 00000000 00510051
fwc addr ffc00000 cmd f0 000000f0 32bit x 32 bit
fwc addr ffc00000 cmd ff 000000ff 32bit x 32 bit
fwc addr ffc00154 cmd 98 00000098 32bit x 32 bit
is= cmd 51(Q) addr ffc00040 is= 00000000 00000051
fwc addr ffc01554 cmd 98 00000098 32bit x 32 bit
is= cmd 51(Q) addr ffc00040 is= 00000000 00000051
fwrite addr ffc00000 cmd f0 f0f0f0f0f0f0f0f0 64 bit x 8 bit
fwrite addr ffc00000 cmd ff ffffffffffffffff 64 bit x 8 bit
fwrite addr ffc002a8 cmd 98 9898989898989898 64 bit x 8 bit
is= cmd 51(Q) addr ffc00080 is= 7d705455963fafbb 5151515151515151
fwrite addr ffc02aa8 cmd 98 9898989898989898 64 bit x 8 bit
is= cmd 51(Q) addr ffc00080 is= 7d705455963fafbb 5151515151515151
fwrite addr ffc00000 cmd f0 00f000f000f000f0 64 bit x 16 bit
fwrite addr ffc00000 cmd ff 00ff00ff00ff00ff 64 bit x 16 bit
fwrite addr ffc002a8 cmd 98 0098009800980098 64 bit x 16 bit
is= cmd 51(Q) addr ffc00080 is= 7d705455963fafbb 0051005100510051
fwrite addr ffc02aa8 cmd 98 0098009800980098 64 bit x 16 bit
is= cmd 51(Q) addr ffc00080 is= 7d705455963fafbb 0051005100510051
fwrite addr ffc00000 cmd f0 000000f0000000f0 64 bit x 32 bit
fwrite addr ffc00000 cmd ff 000000ff000000ff 64 bit x 32 bit
fwrite addr ffc002a8 cmd 98 0000009800000098 64 bit x 32 bit
is= cmd 51(Q) addr ffc00080 is= 7d705455963fafbb 0000005100000051
fwrite addr ffc02aa8 cmd 98 0000009800000098 64 bit x 32 bit
is= cmd 51(Q) addr ffc00080 is= 7d705455963fafbb 0000005100000051
fwrite addr ffc00000 cmd f0 00000000000000f0 64 bit x 64 bit
fwrite addr ffc00000 cmd ff 00000000000000ff 64 bit x 64 bit
fwrite addr ffc002a8 cmd 98 0000000000000098 64 bit x 64 bit
is= cmd 51(Q) addr ffc00080 is= 7d705455963fafbb 0000000000000051
fwrite addr ffc02aa8 cmd 98 0000000000000098 64 bit x 64 bit
is= cmd 51(Q) addr ffc00080 is= 7d705455963fafbb 0000000000000051
not found
*** failed ***
### ERROR ### Please RESET the board ###

以前はサポートされていたが、最近のバージョンではサポート外扱いである。無理やりコメント文を削除するなどして RAM版をビルドしてみたが、以下のところでハングアップしてしまった。debug() を有効にした際の起動画面。

U-Boot 2010.03 (May 23 2010 - 18:31:40) LinkStation? / KuroBox?

CPU:   MPC8245 Revision 1.4 at 196.608 MHz: 16 kB I-Cache 16 kB D-Cache
DRAM:  64 MB
Top of RAM usable for U-Boot at: 04000000
Reserving 234k for U-Boot at: 03fc5000
Reserving 576k for malloc() at: 03f35000
Reserving 56 Bytes for Board Info at: 03f34fc8
Reserving 52 Bytes for Global Data at: 03f34f94
Stack Pointer at: 03f34f78
New Stack Pointer is: 03f34f78

コンパイル済みバイナリ

LinkStation? HGLAN/KuroBoxHG用

リンク

1.2.0

ダウンロードとパッチ当て

U-Boot 1.2.0 以降しか DTC に対応できないので、U-Boot 1.2.0 と LinkStation? 用パッチをダウンロードする。

$ cd /usr/src
$ wget ftp://ftp.denx.de/pub/u-boot/u-boot-1.2.0.tar.bz2
$ wget http://git.openmoko.org/git/openmoko.git/packages/u-boot/u-boot-1.2.0/u-boot-kurobox.patch
$ wget http://git.openmoko.org/git/openmoko.git/packages/u-boot/u-boot-1.2.0/u-boot-kurobox-fdt.patch
$ wget http://git.openmoko.org/git/openmoko.git/packages/u-boot/u-boot-1.2.0/defconfig_lsppchg
$ tar jxvf u-boot-1.2.0.tar.bz2
$ cd u-boot-1.2.0
$ patch -p 1 < ../u-boot-kurobox.patch
$ patch -p 1 < ../u-boot-kurobox-fdt.patch

include/configs/linkstation.h の編集

IPアドレス関係
#define CONFIG_IPADDR_LS       192.168.10.145	←LinkStation?/玄箱のIPアドレス
#define CONFIG_SERVERIP_LS     192.168.10.21	←nc(network console)を起動するマシンのIPアドレス
ブートパラメータ

ルートパーティションやnc関連の設定を自分の環境に合わせて変更する。

#define CONFIG_BOOTARGS                        "root=/dev/hda1"
							↓
#define CONFIG_BOOTARGS                        "root=/dev/sda1 netconsole=6666@192.168.10.145/,@192.168.10.21/ rtc-rs5c372.probe=0,0x32"
IMAGEROOTの定義
#define IMAGEROOT "usr/src/"追加
#if defined(CONFIG_HLAN) || defined(CONFIG_LAN)
#define UBFILE                 IMAGEROOT "u-boot-hd.flash.bin"
#elif defined(CONFIG_HGLAN)
#define UBFILE                 IMAGEROOT "u-boot-hg.flash.bin"
#elif defined(CONFIG_HTGL)
#define UBFILE                 IMAGEROOT "u-boot-ht.flash.bin"
ubpartの設定

/usr/srcが含まれるパーティションが /dev/hda4 ならば

"ubpart=0:4\0"

となる。

クロスコンパイル用設定

emdebian-tools や apt-cross で構築したクロスコンパイル環境でコンパイルするには、環境変数 CROSS_COMPILE やパスの設定をする必要がある。

  • emdebian-tools の場合
    コンパイラ等のバイナリは /usr/bin にインストールされるので、パス追加する必要はない。しかし、gcc-4.2.4 ではコンパイルはできたが、起動させると FLASH: のところまで表示して、ハングアップしてしまった。apt-cross でも同様。gcc-4 系でのクロスコンパイルに問題があるのかもしれない。(gcc-3.4.6 で動いたので、それ以上は深く追求していない。
    • Makefile
      --- Makefile.orig	2009-03-25 12:13:20.000000000 +0900
      +++ Makefile	2009-03-25 12:13:36.000000000 +0900
      @@ -122,7 +122,7 @@
       CROSS_COMPILE =
       else
       ifeq ($(ARCH),ppc)
      -CROSS_COMPILE = ppc_6xx-
      +CROSS_COMPILE = powerpc-linux-gnu-
       endif
       ifeq ($(ARCH),arm)
       CROSS_COMPILE = arm-linux-
  • gcc-4.2.4 でのコンパイル
    いろいろ試してみたが、以下のところでおかしくなっているようだ。(2009-03-31追記:gcc-4.3.3 でも同様だった。)どうすればよいかは、皆目検討がつかないが...
    • board/linkstation/flash.c
       90 /* Basic Query Structure */
       91 struct cfi_ident {
       92   __u8  qry[3];
       93   __u16 P_ID;
       94   __u16 P_ADR;
       95   __u16 A_ID;
       96   __u16 A_ADR;
       97   __u8  VccMin;
       98   __u8  VccMax;
       99   __u8  VppMin;
      100   __u8  VppMax;
      101   __u8  WordWriteTimeoutTyp;
      102   __u8  BufWriteTimeoutTyp;
      103   __u8  BlockEraseTimeoutTyp;
      104   __u8  ChipEraseTimeoutTyp;
      105   __u8  WordWriteTimeoutMax;
      106   __u8  BufWriteTimeoutMax;
      107   __u8  BlockEraseTimeoutMax;
      108   __u8  ChipEraseTimeoutMax;
      109   __u8  DevSize;
      110   __u16 InterfaceDesc;
      111   __u16 MaxBufWriteSize;
      112   __u8  NumEraseRegions;
      113   __u32 EraseRegionInfo[MAX_ERASE_REGIONS];
      114 } __attribute__((packed));
      115 
      116 struct cfi_private {
      117         __u32 base;
      118         int device_type;
      119         int addr_unlock1;
      120         int addr_unlock2;
      121         struct cfi_ident *cfiq;
      122         int mfr;
      123         int id[3]; /* Supports AMD MirrorBit flash */
      124         char *flash_name;
      125         int  wrd_wr_time;
      126         int  buf_wr_time;
      127         int  erase_time;
      128         int (*blk_erase)(flash_info_t *info, int s_first, int s_last);
      129         int (*blk_write)(flash_info_t *info, __u8 *buf, __u32 addr, int sz);
      130 };
      
      165 flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
      166 static struct cfi_private cfis;
      167 static struct cfi_ident   cfi_idents;
      168 static struct cfi_private *cfi;
      169 
      170 static int cfi_probe_chip(struct cfi_private *cfi);
      171 static unsigned long cfi_amdstd_setup(struct cfi_private *cfi, int primary);
      172 static void print_cfi_ident(struct cfi_ident *)
      
      - gcc-4.2.4 の場合
      address of cfi = 0x7f2d1c8
      address of cfi->cfiq = 0x7f2d198
      
      - gcc-3.4.6 の場合
      address of cfi = 0x7f2c2a8
      address of cfi->cfiq = 0x7f2c2e4
      
      static にメモリを割り当てている変数 cfi と cfi->cfiq のメモリ上の位置が逆転している。そのため、gcc-4.2.4 では、以下に示すように構造体 cfi の内容が改変されてしまう。
      mem[0] = ff
      mem[1] = c0
      mem[2] = 0
      mem[3] = 0
      mem[4] = 0
      mem[5] = 0
      mem[6] = 0
      mem[7] = 2
      mem[8] = 0
      mem[9] = 0
      mem[10] = 0
      mem[11] = 0
      mem[12] = 0
      mem[13] = 0
      mem[14] = 0
      mem[15] = 0
      mem[16] = 7
      mem[17] = f2
      mem[18] = d1
      mem[19] = 98
      mem[20] = 0
      mem[21] = 0
      mem[22] = 0
      mem[23] = 0
      mem[24] = 0
      mem[25] = 0
      mem[26] = 0
      mem[27] = 0
      mem[28] = 0
      mem[29] = 0
      mem[30] = 0
      mem[31] = 0
      mem[32] = 0
      mem[33] = 0
      mem[34] = 0
      mem[35] = 0
      mem[36] = 0
      mem[37] = 0
      mem[38] = 0
      mem[39] = 0
      mem[40] = 0
      mem[41] = 0
      mem[42] = 0
      mem[43] = 0
      mem[44] = 0
      mem[45] = 0
      mem[46] = 0
      mem[47] = 0
      mem[48] = 0
      mem[49] = 0
      mem[50] = 0
      mem[51] = 0
      mem[52] = 0
      mem[53] = 0
      mem[54] = 0
      mem[55] = 0
      mem[56] = 0
      mem[57] = 0
      mem[58] = 0
      mem[59] = 0
      i = 0 addr[ffc00020] = 0x51
      i = 1 addr[ffc00022] = 0x52
      i = 2 addr[ffc00024] = 0x59
      i = 3 addr[ffc00026] = 0x2
      i = 4 addr[ffc00028] = 0x0
      i = 5 addr[ffc0002a] = 0x40
      i = 6 addr[ffc0002c] = 0x0
      i = 7 addr[ffc0002e] = 0x0
      i = 8 addr[ffc00030] = 0x0
      i = 9 addr[ffc00032] = 0x0
      i = 10 addr[ffc00034] = 0x0
      i = 11 addr[ffc00036] = 0x27
      i = 12 addr[ffc00038] = 0x36
      i = 13 addr[ffc0003a] = 0x0
      i = 14 addr[ffc0003c] = 0x0
      i = 15 addr[ffc0003e] = 0x7
      i = 16 addr[ffc00040] = 0x7
      i = 17 addr[ffc00042] = 0xa
      i = 18 addr[ffc00044] = 0x0
      i = 19 addr[ffc00046] = 0x1
      i = 20 addr[ffc00048] = 0x5
      i = 21 addr[ffc0004a] = 0x4
      i = 22 addr[ffc0004c] = 0x0
      i = 23 addr[ffc0004e] = 0x16
      i = 24 addr[ffc00050] = 0x2
      i = 25 addr[ffc00052] = 0x0
      i = 26 addr[ffc00054] = 0x5
      i = 27 addr[ffc00056] = 0x0
      i = 28 addr[ffc00058] = 0x2
      i = 29 addr[ffc0005a] = 0x7
      i = 30 addr[ffc0005c] = 0x0
      i = 31 addr[ffc0005e] = 0x20
      i = 32 addr[ffc00060] = 0x0
      i = 33 addr[ffc00062] = 0x3e
      i = 34 addr[ffc00064] = 0x0
      i = 35 addr[ffc00066] = 0x0
      i = 36 addr[ffc00068] = 0x1
      i = 37 addr[ffc0006a] = 0x0
      i = 38 addr[ffc0006c] = 0x0
      i = 39 addr[ffc0006e] = 0x0
      i = 40 addr[ffc00070] = 0x0
      i = 41 addr[ffc00072] = 0x0
      i = 42 addr[ffc00074] = 0x0
      i = 43 addr[ffc00076] = 0x0
      i = 44 addr[ffc00078] = 0x0
      i = 45 addr[ffc0007a] = 0x0
      i = 46 addr[ffc0007c] = 0x0
      i = 47 addr[ffc0007e] = 0x0
      i = 48 addr[ffc00080] = 0x50
      i = 49 addr[ffc00082] = 0x52
      i = 50 addr[ffc00084] = 0x49
      i = 51 addr[ffc00086] = 0x31
      i = 52 addr[ffc00088] = 0x33
      mem[0] = 50	←ここ
      mem[1] = 52	←ここ
      mem[2] = 49	←ここ
      mem[3] = 31	←ここ
      mem[4] = 33	←ここ
      mem[5] = 0
      mem[6] = 0
      mem[7] = 2
      mem[8] = 0
      mem[9] = 0
      mem[10] = 0
      mem[11] = 0
      mem[12] = 0
      mem[13] = 0
      mem[14] = 0
      mem[15] = 0
      mem[16] = 7
      mem[17] = f2
      mem[18] = d1
      mem[19] = 98
      mem[20] = 0
      mem[21] = 0
      mem[22] = 0
      mem[23] = 0
      mem[24] = 0
      mem[25] = 0
      mem[26] = 0
      mem[27] = 0
      mem[28] = 0
      mem[29] = 0
      mem[30] = 0
      mem[31] = 0
      mem[32] = 0
      mem[33] = 0
      mem[34] = 0
      mem[35] = 0
      mem[36] = 0
      mem[37] = 0
      mem[38] = 0
      mem[39] = 0
      mem[40] = 0
      mem[41] = 0
      mem[42] = 0
      mem[43] = 0
      mem[44] = 0
      mem[45] = 0
      mem[46] = 0
      mem[47] = 0
      mem[48] = 0
      mem[49] = 0
      mem[50] = 0
      mem[51] = 0
      mem[52] = 0
      mem[53] = 0
      mem[54] = 0
      mem[55] = 0
      mem[56] = 0
      mem[57] = 0
      mem[58] = 0
      mem[59] = 0
      fileflash.c デバッグ用に改変した board/linkstation/flash.c
  • apt-cross の場合
    コンパイラー等のインストール先にパスを通す必要がある。
    $ export PATH=/usr/cross/powerpc/bin;$PATH
    あとは、emdebian-tools 同様 Makefile を編集し、コンパイルする。

RAM版 U-Bootのビルド

KuroBox?/Linkstation HDLANの場合
$ cd /usr/src/u-boot-1.2.0
$ make linkstation_HDLAN_RAM_config
$ make linkstation_HDLAN_RAM
$ cp u-boot-hd.ram.bin ..
KuroBoxHG/Linkstation HGLANの場合
$ cd /usr/src/u-boot-1.2.0
$ make linkstation_HGLAN_RAM_config
$ make linkstation_HGLAN_RAM
$ cp u-boot-hg.ram.bin ..

古い binutils だと、以下のようなエラーが出る場合がある。

cd /usr/src/u-boot-1.2.0 && ld -Bstatic -T /usr/src/u-boot-1.2.0/board/linkstation/u-boot.lds
 -Ttext 0x07F00000  -n $UNDEF_SYM cpu/mpc824x/start.o
 --start-group lib_generic/libgeneric.a board/linkstation/liblinkstation.a
 cpu/mpc824x/libmpc824x.a lib_ppc/libppc.a fs/cramfs/libcramfs.a
 fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a
 fs/ext2/libext2fs.a net/libnet.a disk/libdisk.a rtc/librtc.a dtt/libdtt.a
 drivers/libdrivers.a drivers/nand/libnand.a drivers/nand_legacy/libnand_legacy.a
 drivers/sk98lin/libsk98lin.a post/libpost.a post/cpu/libcpu.a
 common/libcommon.a --end-group -L /usr/lib/gcc-lib/powerpc-linux/3.3.5 -lgcc
 -Map u-boot.map -o u-boot
make[1]: *** [u-boot] Error 139

Binutils のバージョンを上げるか、場当たり的対応だが、Makefileから -Map u-boot.map を消去すればよい。

$ diff -c Makefile.orig Makefile
*** Makefile.orig       Tue Mar 17 10:50:26 2009 [#ubd56e1e]
--- Makefile    Tue Mar 17 10:50:47 2009
*************** [#e9afe6e8]
*** 297,303 **** [#t19bff05]
                UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed  -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
                cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
                        --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
!                       -Map u-boot.map -o u-boot

  $(OBJS):
                $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
--- 297,303 ----
                UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed  -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
                cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
                        --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
!                       -o u-boot

  $(OBJS):
                $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))

FlashROM版 U-Bootのビルド

KuroBox?/Linkstation HDLANの場合
$ cd /usr/src/u-boot-1.2.0
$ make linkstation_HDLAN_config
$ make linkstation_HDLAN
$ cp u-boot-hd.flash.bin ..
KuroBoxHG/Linkstation HGLANの場合
$ cd /usr/src/u-boot-1.2.0
$ make linkstation_HGLAN_config
$ make linkstation_HGLAN
$ cp u-boot-hg.flash.bin ..

コンパイル済みバイナリ

LinkStation? HDLAN/初代KuroBox?
LinkStation? HGLAN/KuroBoxHG用

起動画面

M29W32DT の場合

U-Boot 1.2.0 (Apr 13 2007 - 22:25:08) LinkStation / KuroBox

CPU:   MPC8245 Revision 1.2 at 196.608 MHz: 16 kB I-Cache 16 kB D-Cache
DRAM:  64 MB
FLASH: Device ID is 0xCA. Assuming broken CFI table.
 4 MB
        00  0b  1317  0985  0200  ff
        00  0c  1095  0680  0101  ff
        00  0e  1033  0035  0c03  ff
        00  0e  1033  0035  0c03  ff
        00  0e  1033  00e0  0c03  ff
Net:   COMET#0
stdin :   serial
stdout:   serial
stderr:   serial
IDE:   Bus 0: ........OK
  Device 0: Model: IC35L060AVER07-0 Firm: ER6OA44A Ser#: SZPTZLS7974
            Type: Hard Disk
            Capacity: 58644.1 MB = 57.2 GB (120103200 x 512)
Boot in 01 seconds ('s' to stop)...

リンク

以下は、Obsolete。

U-Bootのインストール

まずは、動作実績のあるバイナリからテストするのがよいだろう。幸いにもgenbako氏(270氏)のサイトで動作実績のあるバイナリが公開されているので利用する。

LinkStation?/初代玄箱の場合

$ wget http://mirror.crow2.net/www.genbako.com/u-boot_loader/u-boot-hd.flash.bin
$ wget http://mirror.crow2.net/www.genbako.com/u-boot_loader/u-boot-hd.flash.md5
$ md5sum -cv u-boot-hd.flash.md5
u-boot-hd.flash.bin OK
$ su
# dd if=u-boot-hd.flash.bin of=/dev/fl2 bs=1k
# cmp u-boot-hd.flash.bin /dev/fl2

2.6系カーネルを利用している場合は
# dd if=u-boot-hd.flash.bin of=/dev/mtd1 bs=1k
# cmp u-boot-hd.flash.bin /dev/mtd1

# reboot

LinkStationHG/玄箱HGの場合

$ wget http://mirror.crow2.net/www.genbako.com/u-boot_loader/u-boot-hg.flash.bin
$ wget http://mirror.crow2.net/www.genbako.com/u-boot_loader/u-boot-hg.flash.md5
$ md5sum -cv u-boot-hg.flash.md5
u-boot-hg.flash.bin OK
$ su
# dd if=u-boot-hg.flash.bin of=/dev/mtd1 bs=1k
# cmp u-boot-hg.flash.bin /dev/mtd1
# reboot

起動

コンソールを nc にしている場合は、指定されたIPアドレスのマシン上で以下のコマンドを入力して、netconsoleを起動する。

$ nc -v -v -n -u -s 192.168.11.149 -p 6666 192.168.11.150 6666

コンソールをシリアルに指定している場合は、ターミナルウィンドウを開いておく。(デフォルトは 57600bps)

Flash-EMモードで起動する

まれに起動に1分以上かかることがあるので注意。

U-Boot 1.1.4 LiSt? 2.1.0 (Sep 21 2006 - 00:22:56) LinkStation? / KuroBox?

CPU:   MPC8245 Revision 1.4 at 196.608 MHz: 16 kB I-Cache 16 kB D-Cache
DRAM:  64 MB
FLASH:  4 MB
*** Warning - bad CRC, using default environment [#wbd6a957]

        00  0b  1317  0985  0200  ff
        00  0c  1095  0680  0101  ff
        00  0e  1033  0035  0c03  ff
        00  0e  1033  0035  0c03  ff
        00  0e  1033  00e0  0c03  ff
Net:   COMET#0
next_cons_choice: Unexpected code: 0x33
stdin :   serial
stdout:   serial
stderr:   serial
IDE:   Bus 0: OK 
  Device 0: Model: HDS722580VLAT20 Firm: V32OA60A Ser#: VNR21EC2T1N83M
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 78533.4 MB = 76.6 GB (160836480 x 512)
Boot in 08 seconds ('s' to stop)...		←s と入力する
=> run writeng
Un-Protected 1 sectors

Flash erase: first = 55 @ 0xfff70000
             last  = 55 @ 0xfff70000
Flash erase: Done
Erased 1 sectors
Copy to Flash... done
=> run emboot
## Booting image at ffc00000 ...

******* Product Information ******* [#q2a75868]
----------------------------------
Product Name: KURO-BOX(IETSUNA)
         VER: 1.02
        Date: 2004/4/16 11:46:41
----------------------------------
Verifying checksum... OK
Uncompressing kernel...done.
Loading Ramdisk at 0x03C67000, end 0x03E6E647 ... OK
Booting the kernel
Memory BAT mapping: BAT2=64Mb, BAT3=0Mb, residual: 0Mb
Linux version 2.4.17_kuro-box (root@toda_dev.melcoinc.co.jp) (gcc version 2.95.3 20010315 (release/MontaVista?)) #4 2004年 4月 16日 金曜日 11:45:05 JST
KURO-BOX (C) 2004 KUROUTO-SHIKOU.
On node 0 totalpages: 16384
zone(0): 16384 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/hda1

ブート画面

U-Boot 1.1.4 LiSt 2.1.0 (Sep 21 2006 - 00:22:56) LinkStation / KuroBox

CPU:   MPC8245 Revision 1.4 at 196.608 MHz: 16 kB I-Cache 16 kB D-Cache
DRAM:  64 MB
FLASH:  4 MB
*** Warning - bad CRC, using default environment [#xee5056b]

        00  0b  1317  0985  0200  ff
        00  0c  1095  0680  0101  ff
        00  0e  1033  0035  0c03  ff
        00  0e  1033  0035  0c03  ff
        00  0e  1033  00e0  0c03  ff
Net:   COMET#0
next_cons_choice: Unexpected code: 0x33
stdin :   serial
stdout:   serial
stderr:   serial
IDE:   Bus 0: OK 
  Device 0: Model: HDS722580VLAT20 Firm: V32OA60A Ser#: VNR21EC2T1N83M
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 78533.4 MB = 76.6 GB (160836480 x 512)
Boot in 01 seconds ('s' to stop)...
Loading 0:1:boot/vmlinux.UBoot

1327058 bytes read
## Booting image at 00800000 ...
   Image Name:   Linux-2.6.20-kurobox
   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
   Data Size:    1326994 Bytes =  1.3 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK


KERNELBASE=c0000000 (r6=7fff00 r7=7fff0e) r3=7ffec0 (r4=0 r5=0)
Linux version 2.6.20-kurobox (hiroyuki@hg-lan) (gcc version 3.3.5 (Debian 1:3.3.5-13)) #2 Mon Feb 5 23:11:01 JST 2007
Early serial console at MMIO 0x80004600 (options '57600n8')
BUFFALO Network Attached Storage Series
(C) 2002-2005 BUFFALO INC.
Zone PFN ranges:
  DMA             0 ->    16384
  Normal      16384 ->    16384
early_node_map[1] active PFN ranges
    0:        0 ->    16384
Built 1 zonelists.  Total pages: 16256
Kernel command line: root=/dev/hda1
OpenPIC Version 1.2 (1 CPUs and 11 IRQ sources) at 80040000
PID hash table entries: 256 (order: 8, 1024 bytes)
decrementer frequency = 24.391680 MHz 
Console: colour dummy device 80x25
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 62116k available (1932k kernel code, 740k data, 120k init, 0k highmem)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
PCI: Probing PCI hardware
PCI: Cannot allocate resource region 1 of device 0000:00:00.0
SCSI subsystem initialized
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: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 2048 bind 1024)
TCP reno registered
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
I2C: rs5c372 RTC driver successfully loaded
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0x80004600 (irq = 26) is a 16550A
serial8250.1: ttyS1 at MMIO 0x80004500 (irq = 25) is a 16550A
RAMDISK driver initialized: 2 RAM disks of 8192K size 1024 blocksize
loop: loaded (max 8 devices)
Linux Tulip driver version 1.1.14 (May 11, 2002)
tulip0:  MII transceiver #1 config 1000 status 786d advertising 05e1.
eth0: ADMtek Comet rev 17 at Port 0xbfff00, 00:07:40:A4:48:03, IRQ 16.
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
SiI680: IDE controller at PCI slot 0000:00:0c.0
SiI680: chipset revision 2
siimage: IDE controller MMIO ports not available.
SiI680: BASE CLOCK == 100
SiI680: 100% native mode on irq 17
    ide0: BM-DMA at 0xbffed0-0xbffed7, BIOS settings: hda:pio, hdb:pio
    ide1: BM-DMA at 0xbffed8-0xbffedf, BIOS settings: hdc:pio, hdd:pio
hda: HDS722580VLAT20, ATA DISK drive
ide0 at 0xbffef8-0xbffeff,0xbffef6 on irq 17
hda: max request size: 64KiB
hda: 160836480 sectors (82348 MB) w/1794KiB Cache, CHS=16383/255/63, UDMA(100)
hda: cache flushes supported
 hda: hda1 hda2 hda3
physmap platform flash device: 00400000 at ffc00000
physmap-flash.0: Found 1 x16 devices at 0x0 in 8-bit bank
 Amd/Fujitsu Extended Query Table at 0x0040
physmap-flash.0: Swapping erase regions for broken CFI table.
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
cmdlinepart partition parsing not available
RedBoot partition parsing not available
Using physmap partition information
Creating 5 MTD partitions on "physmap-flash.0":
0x00000000-0x00300000 : "mtd_firmimg"
0x00300000-0x00370000 : "mtd_bootcode"
0x00370000-0x00380000 : "mtd_status"
0x00380000-0x00400000 : "mtd_conf"
0x00000000-0x00400000 : "mtd_allflash"
usbmon: debugfs is not available
ehci_hcd 0000:00:0e.2: EHCI Host Controller
ehci_hcd 0000:00:0e.2: new USB bus registered, assigned bus number 1
ehci_hcd 0000:00:0e.2: irq 19, io mem 0xbfffcf00
ehci_hcd 0000:00:0e.2: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 5 ports detected
ohci_hcd 0000:00:0e.0: OHCI Host Controller
ohci_hcd 0000:00:0e.0: new USB bus registered, assigned bus number 2
ohci_hcd 0000:00:0e.0: irq 19, io mem 0xbfffe000
usb usb2: configuration #1 chosen from 1 choice
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 3 ports detected
ohci_hcd 0000:00:0e.1: OHCI Host Controller
ohci_hcd 0000:00:0e.1: new USB bus registered, assigned bus number 3
ohci_hcd 0000:00:0e.1: irq 19, io mem 0xbfffd000
usb usb3: configuration #1 chosen from 1 choice
hub 3-0:1.0: USB hub found
hub 3-0:1.0: 2 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
mice: PS/2 mouse device common for all mice
i2c /dev entries driver
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
Adding console on ttyS0 at MMIO 0x80004600 (options '57600n8')
kjournald starting.  Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem) readonly.
Freeing unused kernel memory: 120k init
INIT: version 2.86 booting
Activating swap...Adding 265064k swap on /dev/hda2.  Priority:-1 extents:1 across:265064k
done.
EXT3 FS on hda1, internal journal
Setting the system clock..
Cleaning up ifupdown....
Loading kernel modules...done.
Loading device-mapper support.
Checking file systems...fsck 1.40-WIP (14-Nov-2006)
done.
Setting kernel variables...done.
Mounting local filesystems...mount: none already mounted or /dev/pts busy
mount: according to mtab, devpts is already mounted on /dev/pts
failed.
Activating swapfile swap...done.
Setting up networking....
Configuring network interfaces...done.
INIT: Entering runlevel: 2
Starting system log daemon: syslogdeth0: Setting full-duplex based on MII#1 link partner capability of 45e1.
.
Starting kernel log daemon: klogd.
Starting KURO-BOX event daemon: kuroevtd.
Starting internet superserver: inetd.
Starting periodic command scheduler: crond.
ttyS1 port init : AVR init string send.

Debian GNU/Linux 4.0 KURO-BOX ttyS0

KURO-BOX login: 

デフォルトの環境変数

シリアルコンソールの場合(u-boot-hg.serial.flash.bin)

=> printenv
bootargs=root=/dev/hda1
bootcmd=run bootcmd1
nfsboot=bootp;run nfsargs;bootm
bootdelay=10
baudrate=57600
autoload=no
stdin=serial
stdout=serial
stderr=serial
ipaddr=192.168.11.150
netmask=255.255.255.0
serverip=192.168.11.149
ncip=192.168.11.149
netretry=no
nc=setenv stdin nc;setenv stdout nc;setenv stderr nc
ser=setenv stdin serial;setenv stdout serial;setenv stderr serial
ldaddr=800000
hdpart=0:1
hdfile=boot/vmlinux.UBoot
hdload=echo Loading ${hdpart}:${hdfile};ext2load ide ${hdpart} ${ldaddr} ${hdfile}
boothd=setenv bootargs root=/dev/hda1;bootm ${ldaddr}
hdboot=run hdload boothd
flboot=setenv bootargs root=/dev/hda1;bootm ffc00000
emboot=setenv bootargs root=/dev/ram0;bootm ffc00000
nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
bootretry=30
bootcmd1=run hdboot;run flboot
bootcmd2=run flboot
bootcmd3=run emboot
writeng=protect off fff70000 fff7ffff;era fff70000 fff7ffff;mw.l 800000 4e474e47 1;cp.b 800000 fff70000 4
writeok=protect off fff70000 fff7ffff;era fff70000 fff7ffff;mw.l 800000 4f4b4f4b 1;cp.b 800000 fff70000 4
ubpart=0:3
ubfile=share/u-boot/u-boot-hg.flash.bin
ubload=echo Loading ${ubpart}:${ubfile};ext2load ide ${ubpart} ${ldaddr} ${ubfile}
ubsaddr=fff00000
ubeaddr=fff2ffff
ubflash=protect off ${ubsaddr} ${ubeaddr};era ${ubsaddr} ${ubeaddr};cp.b ${ldaddr} ${ubsaddr} ${filesize};cmp.b ${ldaddr} ${ubsaddr} ${filesize}
upgrade=run ubload ubflash
ethact=RTL8169#0

Environment size: 1488/65532 bytes

リンク


添付ファイル: filehd-hlan.patch 115件 [詳細] fileu-boot-2010.03-hg-flash-serial.bin 116件 [詳細] fileu-boot-1.2.0-hg.ram.bin 105件 [詳細] fileu-boot-1.2.0-hg.flash.bin 119件 [詳細] fileu-boot-1.2.0-hd.ram.bin 98件 [詳細] fileu-boot-1.2.0-hd.flash.bin 96件 [詳細] fileflash.c 124件 [詳細]

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2010-06-04 (金) 17:54:52 (94d)