玄箱PRO でも Windowsマシンで使っている NTFS フォーマットのUSB外付けハードディスクを使ってみたくなりました。最近では Linux でも ntfs-3g を使うとNTFSの読み書きが問題なくできるようになっています。玄箱PRO で ntfs-3g を使うためにはカーネルにFUSEドライバを組み込む必要があります。ちょうど 2008/07/13 に 2.6.25.11 が公開されたので、標準のカーネルを玄箱PROで使うテストを兼ねて、FUSEドライバを組み込むためカーネルを gcc-4.1 でセルフコンパイルしてみました。
カーネルのコンパイルは基本的に https://buffalo.nas-central.org/index.php/Buffalo_ARM9_Kernel_Portの手順に従いました。
パッチを適用しない plain vanilla な linux-2.6.25.11 でも、玄箱PRO で動作するようになっていますが、まだ電源ボタンの長押しで電源OFFができないようです。電源OFFのためにログインして「shutdown -hP now」を実行しなくてはならないのでは困るため、 Sylver Bruneau 氏のパッチを修正して適用して、また Keventd を修正することで電源ボタンの長押しで電源OFF出来るようにしました。
2008/08/09 linux-2.6.26.2 に関して追記。
カーネルのコンパイルには devio と mkimage が必要です。インストールされていない場合は以下のように apt-get してください。
apt-get install uboot-mkimage apt-get install devio
Debian lenny では gcc-4.1 も必要です。
apt-get install gcc-4.1
カーネルのコンパイルには必要ありませんが、ntfs-3g を使用する場合はインストールします。(etch にはないかもしれません)
apt-get install ntfs-3g
kernel.org から plain vanillaなカーネルソースを入手します。私は /usr/src に linux-2.6.25.11.tar.bz2 を置いて作業しました。
KUROBOX-PRO:/usr/src# time tar jxf linux-2.6.25.11.tar.bz2
real 4m50.576s
user 3m45.990s
sys 0m56.300s
/usr/src/linux を /usr/src/linux-2.6.25.11/ へのシンボリックリンクとして作成して作業しました。
KUROBOX-PRO:/usr/src# ln -s linux-2.6.25.11 linux
シャットダウン時に電源を切れるように Sylver Bruneau 氏のパッチ( https://marc.info/?l=linux-arm-kernel&m=120963179224741&w=2) を適用しますが、2.6.26用のため 2.5.25.11用に変更します。基本的に orion5x_ から orion_ への変更だけです。(パッチ)
diff -u a/kurobox_pro-setup.c b/kurobox_pro-setup.c --- a/kurobox_pro-setup.c 2008-07-14 03:00:25.000000000 +0900 +++ b/kurobox_pro-setup.c 2008-07-21 15:59:01.000000000 +0900 @@ -13,10 +13,12 @@ #include <linux/platform_device.h> #include <linux/pci.h> #include <linux/irq.h> +#include <linux/delay.h> #include <linux/mtd/physmap.h> #include <linux/mtd/nand.h> #include <linux/mv643xx_eth.h> #include <linux/i2c.h> +#include <linux/serial_reg.h> #include <linux/ata_platform.h> #include <asm/mach-types.h> #include <asm/gpio.h> @@ -183,6 +185,138 @@ &kurobox_pro_nand_flash, }; +/* + * Kurobox Pro specific power off method via UART1-attached microcontroller + */ + +#define UART1_REG(x) (UART1_VIRT_BASE + ((UART_##x) << 2)) + +static int kurobox_pro_miconread(unsigned char *buf, int count) +{ + int i; + int timeout; + + for (i = 0; i < count; i++) { + timeout = 10; + + while (!(orion_read(UART1_REG(LSR)) & UART_LSR_DR)) { + if (--timeout == 0) + break; + udelay(1000); + } + + if (timeout == 0) + break; + buf[i] = orion_read(UART1_REG(RX)); + } + + /* return read bytes */ + return i; +} + +static int kurobox_pro_miconwrite(const unsigned char *buf, int count) +{ + int i = 0; + + while (count--) { + while (!(orion_read(UART1_REG(LSR)) & UART_LSR_THRE)) + barrier(); + orion_write(UART1_REG(TX), buf[i++]); + } + + return 0; +} + +static int kurobox_pro_miconsend(const unsigned char *data, int count) +{ + int i; + unsigned char checksum = 0; + unsigned char recv_buf[40]; + unsigned char send_buf[40]; + unsigned char correct_ack[3]; + int retry = 2; + + /* Generate checksum */ + for (i = 0; i < count; i++) + checksum -= data[i]; + + do { + /* Send data */ + kurobox_pro_miconwrite(data, count); + + /* send checksum */ + kurobox_pro_miconwrite(&checksum, 1); + + if (kurobox_pro_miconread(recv_buf, sizeof(recv_buf)) <= 3) { + printk(KERN_ERR ">%s: receive failed.\n", __func__); + + /* send preamble to clear the receive buffer */ + memset(&send_buf, 0xff, sizeof(send_buf)); + kurobox_pro_miconwrite(send_buf, sizeof(send_buf)); + /* make dummy reads */ + mdelay(100); + kurobox_pro_miconread(recv_buf, sizeof(recv_buf)); + } else { + /* Generate expected ack */ + correct_ack[0] = 0x01; + correct_ack[1] = data[1]; + correct_ack[2] = 0x00; + + /* checksum Check */ + if (0 != (0xFF & (recv_buf[0] + recv_buf[1] + + recv_buf[2] + recv_buf[3]))) { + printk(KERN_ERR ">%s: Checksum Error : " + "Received data[%02x, %02x, %02x, %02x]" + "\n", __func__, recv_buf[0], + recv_buf[1], recv_buf[2], recv_buf[3]); + } else { + /* Check Received Data */ + if ((correct_ack[0] == recv_buf[0]) && + (correct_ack[1] == recv_buf[1]) && + (correct_ack[2] == recv_buf[2])) { + /* Interval for next command */ + mdelay(10); + + /* Receive ACK */ + return 0; + } + } + /* Received NAK or illegal Data */ + printk(KERN_ERR ">%s: Error : NAK or Illegal Data " + "Received\n", __func__); + } + } while (retry--); + + /* Interval for next command */ + mdelay(10); + return -1; +} + +static void kurobox_pro_power_off(void) +{ + const unsigned char watchdogkill[] = {0x01, 0x35, 0x00}; + const unsigned char shutdownwait[] = {0x00, 0x0c}; + const unsigned char poweroff[] = {0x00, 0x06}; + /* 38400 baud divisor */ + const unsigned divisor = ((ORION_TCLK + (8 * 38400)) / (16 * 38400)); + + pr_info("%s: triggering power-off...\n", __func__); + + /* hijack uart1 and reset into sane state (38400,8n1,even parity) */ + orion_write(UART1_REG(LCR), 0x83); + orion_write(UART1_REG(DLL), divisor & 0xff); + orion_write(UART1_REG(DLM), (divisor >> 8) & 0xff); + orion_write(UART1_REG(LCR), 0x1b); + orion_write(UART1_REG(IER), 0x00); + orion_write(UART1_REG(FCR), 0x07); + orion_write(UART1_REG(MCR), 0x00); + + /* Send the commands to shutdown the Kurobox Pro */ + kurobox_pro_miconsend(watchdogkill, sizeof(watchdogkill)) ; + kurobox_pro_miconsend(shutdownwait, sizeof(shutdownwait)) ; + kurobox_pro_miconsend(poweroff, sizeof(poweroff)); +} + static void __init kurobox_pro_init(void) { /* @@ -217,7 +351,10 @@ * MPP[13] SATA 1 presence Indication * MPP[14] SATA 0 active Indication * MPP[15] SATA 1 active indication - * MPP[16-19] Not used + * MPP[16] UART1 RXD + * MPP[17] UART1 TXD + * MPP[18] UART1 CTSn + * MPP[19] UART1 RTSn */ orion_write(MPP_0_7_CTRL, 0x44220003); orion_write(MPP_8_15_CTRL, 0x55550000); @@ -225,6 +362,9 @@ orion_gpio_set_valid_pins(0x0000000c); + /* register Kurobox Pro specific power-off method */ + pm_power_off = kurobox_pro_power_off; + platform_add_devices(kurobox_pro_devices, ARRAY_SIZE(kurobox_pro_devices)); i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1); orion_eth_init(&kurobox_pro_eth_data);
/usr/src/linux/arch/arm/mach-orion/ に移動した後、パッチを適用します。
KUROBOX-PRO:# cd linux/arch/arm/mach-orion/ KUROBOX-PRO:# patch -p1 < /tmp/kpro_2.6.25.11_shutdown.patch patching file kurobox_pro-setup.c
まず、以下のように orion_defconfig を実行します。
KUROBOX-PRO:/usr/src/linux# make ARCH=arm orion_defconfig
メニューから変更します。
KUROBOX-PRO:/usr/src/linux# make ARCH=arm menuconfig
KuroBox Proのみを指定しました。
.config - Linux Kernel v2.6.25.11 Configuration ------------------------------------------------------------------------------ +------------------------- Orion Implementations -------------------------+ | Arrow keys navigate the menu. <Enter> selects submenus --->. | | Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, | | <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> | | for Search. Legend: [*] built-in [ ] excluded <M> module < > | | +---------------------------------------------------------------------+ | | | [ ] Marvell Orion-2 Development Board | | | | [ ] Marvell Orion-NAS Reference Design | | | | [*] KuroBox Pro | | | | [ ] D-Link DNS-323 | | | | [ ] QNAP TS-109/TS-209 | | | | | | | +---------------------------------------------------------------------+ | +-------------------------------------------------------------------------+ | <Select> < Exit > < Help > | +-------------------------------------------------------------------------+
EABIの指定を解除してOABIなカーネルとします。
+---------------------------- Kernel Features ----------------------------+ | Arrow keys navigate the menu. <Enter> selects submenus --->. | | Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, | | <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> | | for Search. Legend: [*] built-in [ ] excluded <M> module < > | | +---------------------------------------------------------------------+ | | | [*] Tickless System (Dynamic Ticks) | | | | [*] High Resolution Timer Support | | | | [*] Preemptible Kernel (EXPERIMENTAL) | | | | [ ] Use the ARM EABI to compile the kernel | | | | Memory model (Flat Memory) ---> | | | | [ ] 64 bit Memory and IO resources (EXPERIMENTAL) | | | | | | | | | | | +---------------------------------------------------------------------+ | +-------------------------------------------------------------------------+ | <Select> < Exit > < Help > | +-------------------------------------------------------------------------+
ntfs-3g を使うため、FUSE のドライバを組み込みます。
+----------------------------- File systems ------------------------------+ | Arrow keys navigate the menu. <Enter> selects submenus --->. | | Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, | | <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> | | for Search. Legend: [*] built-in [ ] excluded <M> module < > | | +----^(-)-------------------------------------------------------------+ | | | [ ] Quota support | | | | < > Kernel automounter support | | | | < > Kernel automounter version 4 support (also supports v3) | | | | <*> Filesystem in Userspace support | | | | CD-ROM/DVD Filesystems ---> | | | | DOS/FAT/NT Filesystems ---> | | | | Pseudo filesystems ---> | | | | Miscellaneous filesystems ---> | | | +----v(+)-------------------------------------------------------------+ | +-------------------------------------------------------------------------+ | <Select> < Exit > < Help > | +-------------------------------------------------------------------------+
日本語のサポートを追加します。
+------------------------ Native language support ------------------------+ | Arrow keys navigate the menu. <Enter> selects submenus --->. | | Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, | | <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> | | for Search. Legend: [*] built-in [ ] excluded <M> module < > | | +----^(-)-------------------------------------------------------------+ | | | < > Codepage 869 (Greek) | | | | < > Simplified Chinese charset (CP936, GB2312) | | | | < > Traditional Chinese charset (Big5) | | | | <*> Japanese charsets (Shift-JIS, EUC-JP) | | | | < > Korean charset (CP949, EUC-KR) | | | | < > Thai charset (CP874, TIS-620) | | | | < > Hebrew charsets (ISO-8859-8, CP1255) | | | | < > Windows CP1250 (Slavic/Central European Languages) | | | +----v(+)-------------------------------------------------------------+ | +-------------------------------------------------------------------------+ | <Select> < Exit > < Help > | +-------------------------------------------------------------------------+
今回作成した cofig ファイルはこちら。
lenny の場合、gcc-4.3 が使われるため、gcc-4.1 を使うように Makefile を修正します。 (先頭の番号は行番号)etch の場合は gcc のバージョンは 4.1 のため以下の変更は不要です。
KUROBOX-PRO:/usr/src/linux# vi Makefile 298 # Make variables (CC, etc...) 299 300 AS = $(CROSS_COMPILE)as 301 LD = $(CROSS_COMPILE)ld 302 CC = $(CROSS_COMPILE)gcc-4.1 303 CPP = $(CC) -E 304 AR = $(CROSS_COMPILE)ar 305 NM = $(CROSS_COMPILE)nm 306 STRIP = $(CROSS_COMPILE)strip 307 OBJCOPY = $(CROSS_COMPILE)objcopy 308 OBJDUMP = $(CROSS_COMPILE)objdump
玄箱PRO上でセルフコンパイルします。約90分かかります。
KUROBOX-PRO:/usr/src/linux# time make zImage
CHK include/linux/version.h
SYMLINK include/asm-arm/arch -> include/asm-arm/arch-orion
Generating include/asm-arm/mach-types.h
CHK include/linux/utsrelease.h
HOSTCC scripts/basic/fixdep
HOSTCC scripts/basic/docproc
CC arch/arm/kernel/asm-offsets.s
GEN include/asm-arm/asm-offsets.h
CALL scripts/checksyscalls.sh
:
:
AS .tmp_kallsyms2.o
LD vmlinux
SYSMAP System.map
SYSMAP .tmp_System.map
OBJCOPY arch/arm/boot/Image
Kernel: arch/arm/boot/Image is ready
AS arch/arm/boot/compressed/head.o
GZIP arch/arm/boot/compressed/piggy.gz
AS arch/arm/boot/compressed/piggy.o
CC arch/arm/boot/compressed/misc.o
LD arch/arm/boot/compressed/vmlinux
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
real 88m12.648s
user 79m51.480s
sys 7m24.620s
zImage のサイズを確認します。玄箱PROのオリジナルカーネルは 1,736,436 ですから少し大きくなっています。
KUROBOX-PRO:/usr/src/linux# ls -l arch/arm/boot/zImage
-rwxr-xr-x 1 root root 1842032 Jul 21 19:07 arch/arm/boot/zImage
KUROBOX-PRO:/usr/src/linux# time make modules
CHK include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
CALL scripts/checksyscalls.sh
<stdin>:1097:2: warning: #warning syscall fadvise64 not implemented
<stdin>:1265:2: warning: #warning syscall migrate_pages not implemented
<stdin>:1321:2: warning: #warning syscall pselect6 not implemented
<stdin>:1325:2: warning: #warning syscall ppoll not implemented
<stdin>:1365:2: warning: #warning syscall epoll_pwait not implemented
<stdin>:1377:2: warning: #warning syscall timerfd_create not implemented
<stdin>:1389:2: warning: #warning syscall timerfd_settime not implemented
<stdin>:1393:2: warning: #warning syscall timerfd_gettime not implemented
CC [M] fs/udf/balloc.o
CC [M] fs/udf/dir.o
CC [M] fs/udf/file.o
:
:
CC drivers/scsi/sr_mod.mod.o
LD [M] drivers/scsi/sr_mod.ko
CC fs/udf/udf.mod.o
LD [M] fs/udf/udf.ko
CC net/core/pktgen.mod.o
LD [M] net/core/pktgen.ko
real 6m16.938s
user 5m22.260s
sys 0m45.190s
KUROBOX-PRO:/usr/src/linux# make modules_install
INSTALL crypto/cbc.ko
INSTALL crypto/crypto_algapi.ko
INSTALL crypto/crypto_blkcipher.ko
INSTALL crypto/cryptomgr.ko
INSTALL crypto/ecb.ko
INSTALL crypto/pcbc.ko
INSTALL drivers/cdrom/cdrom.ko
INSTALL drivers/char/hw_random/rng-core.ko
INSTALL drivers/scsi/scsi_wait_scan.ko
INSTALL drivers/scsi/sg.ko
INSTALL drivers/scsi/sr_mod.ko
INSTALL fs/udf/udf.ko
INSTALL net/core/pktgen.ko
DEPMOD 2.6.25.11
カーネルをコンパイルして出来た zImage を玄箱PROで使用できる形式に変換します。
devio > foo 'wl 0xe3a01c05,4' 'wl 0xe38110e5,4' cat foo arch/arm/boot/zImage > zImage.new mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n 'linux' -d zImage.new uImage.new
私の環境 (標準のHDDブート環境) では /dev/sda1 にカーネルを置くようになっているので、uImage.new を uImage.buffalo にコピーしてリブートします。この作業を行うと正常に動作しない場合には、復帰にシリアルコンソールが必須となります。
mount /dev/sda1 /mnt/sda1 cp uImage.new /mnt/sda1/uImage.buffalo reboot
KUROBOX-PRO:/usr/src/linux# devio > foo 'wl 0xe3a01c05,4' 'wl 0xe38110e5,4' KUROBOX-PRO:/usr/src/linux# cat foo arch/arm/boot/zImage > zImage.new KUROBOX-PRO:/usr/src/linux# mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n 'linux' -d zImage.new uImage.new Image Name: linux Created: Mon Jul 21 19:42:04 2008 Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1842040 Bytes = 1798.87 kB = 1.76 MB Load Address: 0x00008000 Entry Point: 0x00008000 KUROBOX-PRO:/usr/src/linux# mount /dev/sda1 /mnt/sda1 KUROBOX-PRO:/usr/src/linux# cp uImage.new /mnt/sda1/uImage.buffalo KUROBOX-PRO:/usr/src/linux# reboot Broadcast message from root@KUROBOX-PRO (pts/0) (Mon Jul 21 19:43:42 2008): The system is going down for reboot NOW!
以上の作業で作成したカーネルで起動した場合のシリアルコンソールの出力です。
Orion1 CPU = Low
=== KURO U-Boot. ===
** LOADER **
** KUROBOX BOARD: KURO_BOX LE (CFG_ENV_ADDR=fffff000)
U-Boot 1.1.1 (Apr 10 2007 - 18:10:08) Marvell version: 1.12.1 - TINY
DRAM CS[0] base 0x00000000 size 128MB
DRAM Total size 128MB
[256kB@fffc0000] Flash: 256 kB
Addresses 20M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (20M - 16M): Done
NAND: 256 MB
Soc: 88F5182 A2
CPU: ARM926 (Rev 0) running @ 500Mhz
Orion 1 streaming disabled
SysClock = 250Mhz , TClock = 166Mhz
USB 0: host mode
USB 1: host mode
PCI 0: PCI Express Root Complex Interface
PCI 1: Conventional PCI, speed = 33000000
Net: egiga0 [PRIME]
Using 88E1118 phy
hit any key to switch tftp boot.
Hit any key to stop autoboot: 0
<<system_bootend>>
Hit any key to stop autoboot: 0
Reset IDE:
Marvell Serial ATA Adapter
Integrated Sata device found
Device 0: OK
Model: HDT722516DLA380 Firm: V43OA9BA Ser#: VDS91DTC1MPVEZ
Type: Hard Disk
Supports 48-bit addressing
Capacity: 157066.8 MB = 153.3 GB (321672960 x 512)
Using device ide0, partition 1
Loading from block device ide device 0, partition 1: Name: hda1
Type: U-Boot File:/uImage.buffalo
1842104 bytes read
<<stop_sound>>
## Booting image at 00100000 ...
Image Name: linux
Created: 2008-07-21 10:42:04 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1842040 Bytes = 1.8 MB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
OK
Starting kernel ...
arg:console=ttyS0,115200 root=/dev/sda2 rw panic=5 BOOTVER=1.091
Uncompressing Linux............................................................
............................................................. done, booting the kernel.
Linux version 2.6.25.11 (root@KUROBOX-PRO) (gcc version 4.1.3 20080623 (prerelease)
(Debian 4.1.2-23)) #1 PREEMPT Mon Jul 21 19:06:01 JST 2008
CPU: Feroceon [41069260] revision 0 (ARMv5TEJ), cr=a0053177
Machine: Buffalo/Revogear Kurobox Pro
Clearing invalid memory bank 0KB@0xffffffff
Clearing invalid memory bank 0KB@0xffffffff
Clearing invalid memory bank 0KB@0xffffffff
Ignoring unrecognised tag 0x00000000
Ignoring unrecognised tag 0x00000000
Ignoring unrecognised tag 0x00000000
Ignoring unrecognised tag 0x41000403
Memory policy: ECC disabled, Data cache writeback
CPU0: D VIVT write-back cache
CPU0: I cache: 32768 bytes, associativity 1, 32 byte lines, 1024 sets
CPU0: D cache: 32768 bytes, associativity 1, 32 byte lines, 1024 sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512
Kernel command line: console=ttyS0,115200 root=/dev/sda2 rw panic=5 BOOTVER=1.091
PID hash table entries: 512 (order: 9, 2048 bytes)
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: 128MB = 128MB total
Memory: 125952KB available (3548K code, 230K data, 104K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 152 bytes
NET: Registered protocol family 16
Orion ID: MV88F5182-A2. TCLK=166666667.
PCI: bus0: Fast back to back transfers enabled
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: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
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
io scheduler deadline registered
io scheduler cfq registered (default)
Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xf1012000 (irq = 3) is a 16550A
console [ttyS0] enabled
serial8250.0: ttyS1 at MMIO 0xf1012100 (irq = 4) is a 16550A
loop: module loaded
Intel(R) PRO/1000 Network Driver - version 7.3.20-k2-NAPI
Copyright (c) 1999-2006 Intel Corporation.
e100: Intel(R) PRO/100 Network Driver, 3.5.23-k4-NAPI
e100: Copyright(c) 1999-2006 Intel Corporation
MV-643xx 10/100/1000 Ethernet Driver
eth0: port 0 with MAC address 00:16:01:00:00:00
eth0: Scatter Gather Enabled
eth0: TX TCP/IP Checksumming Supported
eth0: RX TCP/UDP Checksum Offload ON
eth0: RX NAPI Enabled
Driver 'sd' needs updating - please use bus_type methods
sata_mv sata_mv.0: version 1.20
sata_mv sata_mv.0: slots 32 ports 2
scsi0 : sata_mv
scsi1 : sata_mv
ata1: SATA max UDMA/133 irq 29
ata2: SATA max UDMA/133 irq 29
ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
ata1.00: ATA-7: HDT722516DLA380, V43OA9BA, max UDMA/133
ata1.00: 321672960 sectors, multi 0: LBA48 NCQ (depth 0/32)
ata1.00: configured for UDMA/133
ata2: SATA link down (SStatus 0 SControl 300)
scsi 0:0:0:0: Direct-Access ATA HDT722516DLA380 V43O PQ: 0 ANSI: 5
sd 0:0:0:0: [sda] 321672960 512-byte hardware sectors (164697 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sd 0:0:0:0: [sda] 321672960 512-byte hardware sectors (164697 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sda: sda1 sda2 sda3 sda4
sd 0:0:0:0: [sda] Attached SCSI disk
NFTL driver: nftlcore.c $Revision: 1.98 $, nftlmount.c $Revision: 1.41 $
physmap platform flash device: 00040000 at f4000000
Found: SST 39LF020
physmap-flash.0: Found 1 x8 devices at 0x0 in 8-bit bank
number of JEDEC chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
RedBoot partition parsing not available
ftl_cs: FTL header not found.
NAND device: Manufacturer ID: 0x20, Chip ID: 0xda (ST Micro NAND 256MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 223 at 0x01be0000
Bad eraseblock 572 at 0x04780000
Creating 3 MTD partitions on "orion_nand":
0x00000000-0x00400000 : "uImage"
ftl_cs: FTL header not found.
0x00400000-0x04400000 : "rootfs"
ftl_cs: FTL header not found.
0x04400000-0x10000000 : "extra"
ftl_cs: FTL header not found.
orion-ehci orion-ehci.0: Marvell Orion EHCI
orion-ehci orion-ehci.0: new USB bus registered, assigned bus number 1
orion-ehci orion-ehci.0: irq 17, io mem 0xf1050000
orion-ehci orion-ehci.0: 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: 1 port detected
orion-ehci orion-ehci.1: Marvell Orion EHCI
orion-ehci orion-ehci.1: new USB bus registered, assigned bus number 2
orion-ehci orion-ehci.1: irq 12, io mem 0xf10a0000
orion-ehci orion-ehci.1: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb2: configuration #1 chosen from 1 choice
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
usb 1-1: new high speed USB device using orion-ehci and address 2
usb 1-1: configuration #1 chosen from 1 choice
usbcore: registered new interface driver usblp
Initializing USB Mass Storage driver...
scsi2 : SCSI emulation for USB Mass Storage devices
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
rtc-rs5c372 0-0032: rs5c372a found, 24hr, driver version 0.5
rtc-rs5c372 0-0032: rtc core: registered rtc-rs5c372 as rtc0
usbcore: registered new interface driver usbhid
drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
VFP support v0.3: not present
rtc-rs5c372 0-0032: setting system clock to 2008-07-21 10:46:13 UTC (1216637173)
kjournald starting. Commit interval 5 seconds
EXT3-fs warning: maximal mount count reached, running e2fsck is recommended
EXT3 FS on sda2, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem).
Freeing init memory: 104K
Mount failed for selinuxfs on /selinux: No such file or directory
INIT: version 2.86 booting
Setting the system clock.
Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.
* Unable to set System Clock to: Mon Jul 21 19:46:16 JST 2008
Activating swap:swapon on /dev/sda3
Adding 136544k swap on /dev/sda3. Priority:-1 extents:1 across:136544k
.
Setting the system clock.
Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.
* Unable to set System Clock to: Mon Jul 21 19:46:17 JST 2008
Cleaning up ifupdown....
Loading device-mapper support.
Will now check all file systems.
fsck 1.40.11 (17-June-2008)
Checking all file systems.
Done checking file systems.
A log is being saved in /var/log/fsck/checkfs if that location is writable.
Setting kernel variables (/etc/sysctl.conf)...done.
Fuse filesystem already available.
Mounting fuse control filesystem.
Will now mount local filesystems:kjournald starting. Commit interval 5 seconds
EXT3-fs warning: maximal mount count reached, running e2fsck is recommended
EXT3 FS on sda4, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
.
Will now activate swapfile swap:done.
Cleaning /tmp...done.
Cleaning /var/run...done.
Cleaning /var/lock...done.
Checking minimum space in /tmp...done.
Setting up networking....
* /etc/network/options still exists and it will be IGNORED! Read README.Debian of netbase.
Configuring network interfaces...scsi 2:0:0:0: Direct-Access SAMSUNG HD501LJ
PQ: 0 ANSI: 2 CCS
sd 2:0:0:0: [sdb] 976773168 512-byte hardware sectors (500108 MB)
sd 2:0:0:0: [sdb] Write Protect is off
sd 2:0:0:0: [sdb] Assuming drive cache: write through
sd 2:0:0:0: [sdb] 976773168 512-byte hardware sectors (500108 MB)
sd 2:0:0:0: [sdb] Write Protect is off
sd 2:0:0:0: [sdb] Assuming drive cache: write through
sdb: sdb1 sdb2 sdb3 sdb4 < sdb5 >
sd 2:0:0:0: [sdb] Attached SCSI disk
done.
Setting console screen modes and fonts.
Initializing random number generator...done.
Setting up X server socket directory /tmp/.X11-unix....
Setting up ICE socket directory /tmp/.ICE-unix....
INIT: Entering runlevel: 2
Starting system log daemon....
Starting kernel log daemon....
Starting OpenBSD Secure Shell server: sshd.
Starting MySQL database server: mysqld ..
Checking for corrupt, not cleanly closed and upgrade needing tables..
Not starting estmaster - edit /etc/default/hyperestraier and change NO_START to be 0.
Starting internet superserver: inetd.
Starting Samba daemons: nmbd smbd.
Starting NTP server: ntpd.
warning: `ntpd' uses 32-bit capabilities (legacy support in use)
Starting periodic command scheduler: crond.
Starting web server: apache2[Mon Jul 21 19:46:41 2008] [warn] The Alias directive in /etc/apach
e2/apache2.conf at line 240 will probably never match because it overlaps an earlier Alias.
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1
for ServerName
[Mon Jul 21 19:46:41 2008] [warn] NameVirtualHost *:80 has no VirtualHosts
.
Running local boot scripts (/etc/rc.local).
Debian GNU/Linux lenny/sid KUROBOX-PRO ttyS0
KUROBOX-PRO login:
上記の例では 500GB の USB 外付け HDD を接続しているため sdb が検出されています。
電源ボタンの割込みを監視してシャットダウンするスクリプトです。/proc/buffalo/kernevnt が使えないので スイッチを2秒おきに監視して4秒間電源ボタンが押されていたら「shutdown -hP now」を実行します。miconapl は 「miconapl互換コマンド」使っています。
#!/bin/sh # /usr/local/kpro/bin/Keventd 20080721 GET_SW="/usr/local/bin/miconapl -a int_get_switch_status" BEEP="/usr/local/bin/miconapl -a bz_melody 960 E4 C4" BEEP2="/usr/local/bin/miconapl -a bz_melody 120 C5" COUNT=4 while : do SW=`$GET_SW |grep "int=" |sed -e "s/int=//"` case ${SW} in power_sw) COUNT=`expr ${COUNT} - 1` if [ ${COUNT} -eq 0 ] then ${BEEP2} /sbin/shutdown -hP now else ${BEEP} fi sleep 1 ;; init_sw_front) ;; *) COUNT=4 sleep 2 ;; esac done
起動時にUSBドライブが接続されている場合、手動でマウントしなくても使えるように以下のように設定しました。もっとスマートな方法があるはずですが、まずは動作確認です。
/dev/sdb は noauto として起動時にマウントしていません。
# UNCONFIGURED FSTAB FOR BASE SYSTEM proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 devpts /dev/pts devpts gid=4,mode=620 0 0 /dev/sda2 / ext3 defaults 1 0 /dev/sda4 /home ext3 defaults 1 0 /dev/sda3 swap swap defaults 0 0 /dev/sdb1 /mnt/sdb1 ntfs-3g noauto,rw,exec,uid=1000,locale=ja_JP.UTF-8 0 0 /dev/sdb2 /mnt/sdb2 ntfs-3g noauto,rw,exec,uid=1000,locale=ja_JP.UTF-8 0 0 /dev/sdb3 /mnt/sdb3 ntfs-3g noauto,rw,exec,uid=1000,locale=ja_JP.UTF-8 0 0 /dev/sdb5 /mnt/sdb5 ntfs-3g noauto,rw,exec,uid=1000,locale=ja_JP.UTF-8 0 0
rc.local で起動の最終段階でマウントしています。USBドライブが接続されていない場合はコンソールにエラー表示されますが、実害はありません。
#!/bin/sh -e # # rc.local /usr/local/bin/miconapl -a boot_end if [ -x /usr/local/bin/Keventd ] ; then /usr/local/bin/Keventd & fi if [ -x /usr/local/bin/Fand ] ; then /usr/local/bin/Fand & fi /usr/local/bin/miconapl -a bz_on boot mount /dev/sdb1 mount /dev/sdb2 mount /dev/sdb3 mount /dev/sdb5 exit 0
KUROBOX-PRO login: root Password: Last login: Mon Jul 21 19:45:30 JST 2008 on ttyS0 Linux KUROBOX-PRO 2.6.25.11 #1 PREEMPT Mon Jul 21 19:06:01 JST 2008 armv5tel The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.
マウント状況を確認します。
KUROBOX-PRO:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 2893660 1618692 1127976 59% /
tmpfs 63064 0 63064 0% /lib/init/rw
tmpfs 63064 0 63064 0% /dev/shm
/dev/sda4 155225988 18497780 128843108 13% /home
/dev/sdb1 122879996 44048408 78831588 36% /mnt/sdb1
/dev/sdb2 122879996 7775552 115104444 7% /mnt/sdb2
/dev/sdb3 122879996 91364 122788632 1% /mnt/sdb3
/dev/sdb5 119743484 91268 119652216 1% /mnt/sdb5
外付けHDD の NTFS領域に移動してファイル一覧を表示してみます。
KUROBOX-PRO:~# cd /mnt/sdb1/Backup20080329 KUROBOX-PRO:/mnt/sdb1/Backup20080329# ls -l total 7079760 -rwxrwxrwx 2 kuro root 2135931196 Mar 30 03:06 20080329.img.gz.000 -rwxrwxrwx 2 kuro root 2135933347 Mar 30 03:13 20080329.img.gz.001 -rwxrwxrwx 2 kuro root 2135929176 Mar 30 03:21 20080329.img.gz.002 -rwxrwxrwx 2 kuro root 654463019 Mar 30 03:23 20080329.img.gz.003 -rwxrwxrwx 2 kuro root 8510 Mar 23 00:58 SystemRescueCD-x86-1.0.0.txt -rwxrwxrwx 2 kuro root 187392000 Mar 22 23:11 systemrescuecd-x86-1.0.0.iso
ファイルを作成してみます。
KUROBOX-PRO:/mnt/sdb1/Backup20080329# touch test.txt KUROBOX-PRO:/mnt/sdb1/Backup20080329# ls 20080329.img.gz.000 20080329.img.gz.003 test.txt 20080329.img.gz.001 SystemRescueCD-x86-1.0.0.txt 20080329.img.gz.002 systemrescuecd-x86-1.0.0.iso
test.txt が作成されていることが確認できます。
玄箱PROでNTFSを使えるまでの失敗も記録しておきます。Debian lenny の環境で2.6.25.11、2.6.26ともにセルフコンパイルしましたが、カーネルが正常に起動しませんでした。どちらもコンソールに以下のように表示したまま停止します。
Uncompressing Linux.......................................................... .............................................................. done, booting the kernel.
CONFIG_DEBUG_LL を指定して 下記の Byron Bradley 氏のパッチ ( https://buffalo.nas-central.org/forums/viewtopic.php?f=18&t=4242&st=0&sk=t&sd=a&start=15) を適用してコンソール出力を見てみました。
diff --git a/kernel/printk.c b/kernel/printk.c index a30fe33..9758c4f 100644 --- a/kernel/printk.c +++ b/kernel/printk.c @@ -16,6 +16,8 @@ * 01Mar01 Andrew Morton <andrewm@uow.edu.au> */ +extern void printascii(const char *); + #include <linux/kernel.h> #include <linux/mm.h> #include <linux/tty.h> @@ -653,6 +655,8 @@ asmlinkage int vprintk(const char *fmt, va_list args) /* Emit the output into the temporary buffer */ printed_len = vscnprintf(printk_buf, sizeof(printk_buf), fmt, args); + printascii(printk_buf); + /* * Copy the output into log_buf. If the caller didn't provide * appropriate log level tags, we insert them here
すると 2.6.25.11 では以下のようなエラーの結果、カーネルパニックになっていました。
<6>PCI: bus0: Fast back to back transfers enabled <1>Unable to handle kernel NULL pointer dereference at virtual address 00000000 <1>pgd = c0004000 <1>[00000000] *pgd=00000000 Internal error: Oops: 5 [#1] PREEMPT
どうもコンパイラが怪しそうです。lenny の gcc のバージョンは 4.3.1 ですが、gcc-4.1 で試すと 2.6.25.11 では正常に起動しました。
2.6.26 では gcc-4.1 でも、以下のように表示してエラーもなく停止します。
Uncompressing Linux......................................................... .......................................................................... done, booting the kernel. <5>Linux version 2.6.26 (root@KUROBOX-PRO) (gcc version 4.1.3 20080420 (prerelease) (Debian 4.1.2-22)) #3 PREEMPT Sun Jul 20 19:59:52 JST 2008 CPU: Feroceon [41069260] revision 0 (ARMv5TEJ), cr=a0053177 Machine: Buffalo/Revogear Kurobox Pro <4>Clearing invalid memory bank 0KB@0xffffffff <4>Clearing invalid memory bank 0KB@0xffffffff <4>Clearing invalid memory bank 0KB@0xffffffff <4>Ignoring unrecognised tag 0x00000000 <4>Ignoring unrecognised tag 0x00000000 <4>Ignoring unrecognised tag 0x00000000 <4>Ignoring unrecognised tag 0x41000403 Memory policy: ECC disabled, Data cache writeback <7>On node 0 totalpages: 32768 <7> DMA zone: 256 pages used for memmap <7> DMA zone: 0 pages reserved <7> DMA zone: 32512 pages, LIFO batch:7 <7> Normal zone: 0 pages used for memmap <7> Movable zone: 0 pages used for memmap CPU0: D VIVT write-back cache CPU0: I cache: 32768 bytes, associativity 1, 32 byte lines, 1024 sets CPU0: D cache: 32768 bytes, associativity 1, 32 byte lines, 1024 sets Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512 <5>Kernel command line: console=ttyS0,115200 root=/dev/sda2 rw panic=5 BOOTVER=1.091 PID hash table entries: 512 (order: 9, 2048 bytes) Console: colour dummy device 80x30 <6>Dentry cache hash table entries: 16384 (order: 4, 65536 bytes) <6>Inode-cache hash table entries: 8192 (order: 3, 32768 bytes) <6>Memory: 128MB = 128MB total <5>Memory: 125696KB available (3828K code, 253K data, 112K init) <7>Calibrating delay loop... 265.42 BogoMIPS (lpj=1327104) Mount-cache hash table entries: 512 <6>CPU: Testing write buffer coherency: ok <6>net_namespace: 192 bytes <6>NET: Registered protocol family 16 <6>Orion ID: MV88F5182-A2. TCLK=166666667. <5>Applying Orion-1/Orion-NAS PCIe config read transaction workaround <6>PCI: bus0: Fast back to back transfers disabled
原因不明です。(追記参照 2008/08/09)
掲示板で吉山さんに教えて頂いた部分を修正して、linux-2.6.26.2 をコンパイルしてみたところ2.6.26.2でも正常に動作しました。
上記の2.6.25.11で行った作業のうち、シャットダウン時に電源を切れるようにする Sylver Bruneau 氏のパッチ( https://marc.info/?l=linux-arm-kernel&m=120963179224741&w=2)はそのまま適用します。また、教えて頂いたhttps://marc.info/?l=linux-arm-kernel&m=121774486709422&w=2)は以下のようにソースを直接変更しました。
KUROBOX-PRO:/usr/src/linux/# vi arch/arm/mach-orion5x/kurobox_pro-setup.c 142 static struct hw_pci kurobox_pro_pci __initdata = { 143 .nr_controllers = 1, 144 .swizzle = pci_std_swizzle, 145 .setup = orion5x_pci_sys_setup, 146 .scan = orion5x_pci_sys_scan_bus, 147 .map_irq = kurobox_pro_pci_map_irq, 148 };
今回もコンパイラは gcc-4.1 を使いました。95分でコンパイル終了。
Linux KUROBOX-PRO 2.6.26.2 #1 PREEMPT Sat Aug 9 16:09:19 JST 2008 armv5tel
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
KUROBOX-PRO:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 2893660 1684252 1062416 62% /
tmpfs 63048 0 63048 0% /lib/init/rw
tmpfs 63048 0 63048 0% /dev/shm
/dev/sda4 155225988 18906356 128434532 13% /home
/dev/sdb1 122879996 44048408 78831588 36% /mnt/sdb1
/dev/sdb2 122879996 8231760 114648236 7% /mnt/sdb2
/dev/sdb3 122879996 91364 122788632 1% /mnt/sdb3
/dev/sdb5 119743484 91268 119652216 1% /mnt/sdb5
以上のように正常に起動しました。