未解決の問題にあげていますが、なぜかJFFS2で/dev/mtdblock2がmountできない問題があり、カーネルで大量のエラーが吐かれていることからカーネルの問題と仮定。
CONFIGの指定漏れがあるのかとも思いましたが、とりあえずwheezyで組み込まれていると思われる3.2.65のカーネルでそのままorion5x_defconfigを使って作成してみることにした。

セルフコンパイル

まずはセルフコンパイルで試す
# wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.2.65.tar.gz
# tar xvf linux-3.2.65.tar.gz
# cd linux-3.2.65
# vi Makefile
VERSION = 3
PATCHLEVEL = 2
SUBLEVEL = 65
EXTRAVERSION = -orion5x
EXTRAVERSIONに-orion5xを追記。これは後ほど実行するupdate-initramfsのために必要。
このままだとmachine IDが0x0000020eになり玄箱PROと識別されないのでパッチを当てる
# vi arch/arm/boot/Makefile
 $(obj)/zImage:	$(obj)/compressed/vmlinux FORCE
 	$(call if_changed,objcopy)
+	devio > foo 'wl 0xe3a01c05,4' 'wl 0xe38110e5,4'
+	cat foo $(obj)/zImage > zImage.new
+	mv zImage.new $(obj)/zImage
+	rm foo
 	@echo '  Kernel: $@ is ready'
コンパイル。作成するのはuImageではなくzImageとしておく。
# export ARCH=arm
# make orion5x_defconfig
# make menuconfig
変更箇所
  • カーネルは圧縮率の高いLZMAに変更
  • gzip圧縮のinitrdを使うので追加
  • 起動時にdevtmpfsがあった方がよさそうなメッセージがあったので追加
  • mtdblockのマウントができないので代替ツールとしてmtdram、mtdblockを追加(未解決の問題)
  • sda2がext4なのでMから*に変更
  • 他のサーバーの共有フォルダをマウントしたいのでCIFSを追加
  • 言語はiso8859-1を基本に日本語とUTF-8を使えるように設定
General setup  --->
        Kernel compression mode (LZMA)  --->
    [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
    ()    Initramfs source file(s)
    [*]   Support initial ramdisks compressed using gzip
    [ ]   Support initial ramdisks compressed using bzip2
    [ ]   Support initial ramdisks compressed using LZMA
    [ ]   Support initial ramdisks compressed using XZ
    [ ]   Support initial ramdisks compressed using LZO
Device Drivers  --->
        Generic Driver Options  --->
            [*] Maintain a devtmpfs filesystem to mount at /dev
            [*]   Automount devtmpfs at /dev, after the kernel mounted the rootfs
        <*> Memory Technology Device (MTD) support  --->
            Self-contained MTD device drivers  --->
                <M> Test driver using RAM
                (4096) MTDRAM device size in KiB
                (128) MTDRAM erase block size in KiB
                <M> MTD using block device
File systems
    <*> The Extended 4 (ext4) filesystem
    [*]   Ext4 extended attributes
    [*] Network File Systems  --->
        <M>   CIFS support (advanced network filesystem, SMBFS successor)
    -*- Native language support  --->
        (iso8859-1) Default NLS Option
        <M>   Japanese charsets (Shift-JIS, EUC-JP)
        <*>   NLS ISO 8859-1  (Latin 1; Western European Languages)
        <M>   NLS UTF-8
コンパイル
# nohup make zImage modules modules_install &
# jobs
# disown %1
セルフコンパイルで時間が掛かるので終わるまで気長に待つ。
完了。
# cp arch/arm/boot/zImage /boot/vmlinuz-3.2.65-orion5x
# mv /boot/uImage.buffalo /boot/uImage.buffalo.old
# cp arch/arm/boot/uImage /boot/uImage.buffalo
# update-initramfs -c -k 3.2.65-orion5x -t
update-initramfs: Generating /boot/initrd.img-3.2.65-orion5x
flash-kernel: installing version 3.2.65-orion5x
Generating kernel u-boot image... done.
Installing new uImage.buffalo.
Generating initramfs u-boot image... done.
Installing new initrd.buffalo.
# reboot
起動完了
起動はできたが、
# mount -t jffs2 /dev/mtdblock1 /mnt/mtd
同じ。
ダメ。マウントできない。大量のエラーが出る症状も同じ。
なにがいけないのか分からない。

クロスコンパイル

何度も作り直すと玄箱PROでは時間がかかるのでクロスコンパイル環境を準備する。
VMware Player 7.1.0にdebian-7.8.0-i386-netinst.isoをセットしてDebian 7.xを導入。
Intel PC上のVMware Player環境でarmel向けのクロスコンパイル環境を作成する。

■bintuilsをコンパイルしてインストールする
# cd ~
# apt-get install dpkg-dev
# mkdir binutils
# cd binutils
# apt-get source binutils
# apt-get build-dep binutils
# cd binutils*
# TARGET=armel dpkg-buildpackage -b -uc -us 
# cd ..
# dpkg -i *.deb

■gccをコンパイルしてインストールする
# cd ~
# mkdir gcc
# cd gcc
# apt-get install xapt
# apt-get source gcc-4.7
# apt-get build-dep gcc-4.7
# xapt -a armel -m libc6-dev
# apt-get install binutils-multiarch
# cd gcc-*
# GCC_TARGET=armel dpkg-buildpackage -b -uc -us
# cd ..
# dpkg -i *.deb

■クロスコンパイル・チェック
# cd ~
# vi main.c 

#include <stdio.h>
int main(int argc, char** argv)
{
        printf( "Hello World\n" );
        return 0;
}

# arm-linux-gnueabi-gcc-4.7 -static -o main main.c
# apt-get install qemu qemu-system
# qemu-arm ./main
Hello World

■リンク作成
# ln -s /usr/bin/arm-linux-gnueabi-cpp-4.7        /usr/local/bin/arm-linux-gnueabi-cpp
# ln -s /usr/bin/arm-linux-gnueabi-gcc-ar-4.7     /usr/local/bin/arm-linux-gnueabi-gcc-ar
# ln -s /usr/bin/arm-linux-gnueabi-gccgo-4.7      /usr/local/bin/arm-linux-gnueabi-gccgo
# ln -s /usr/bin/arm-linux-gnueabi-g++-4.7        /usr/local/bin/arm-linux-gnueabi-g++
# ln -s /usr/bin/arm-linux-gnueabi-gcc-nm-4.7     /usr/local/bin/arm-linux-gnueabi-gcc-nm
# ln -s /usr/bin/arm-linux-gnueabi-gcov-4.7       /usr/local/bin/arm-linux-gnueabi-gcov
# ln -s /usr/bin/arm-linux-gnueabi-gcc-4.7        /usr/local/bin/arm-linux-gnueabi-gcc
# ln -s /usr/bin/arm-linux-gnueabi-gcc-ranlib-4.7 /usr/local/bin/arm-linux-gnueabi-gcc-ranlib
# ln -s /usr/bin/arm-linux-gnueabi-gfortran-4.7   /usr/local/bin/arm-linux-gnueabi-gfortran

■環境設定、準備
# cd /opt
# export ARCH=arm
# export CROSS_COMPILE=arm-linux-gnueabi-
# export INSTALL_MOD_PATH=/opt/kurobox_pro
# export INSTALL_PATH=$INSTALL_MOD_PATH/boot
# mkdir -p /opt/kurobox_pro/boot
# wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.2.65.tar.gz
# tar xvf linux-3.2.65.tar.gz
# cd linux-3.2.65
# vi Makefile
VERSION = 3
PATCHLEVEL = 2
SUBLEVEL = 65
EXTRAVERSION = -orion5x
EXTRAVERSIONに-orion5xを追記
# vi arch/arm/boot/Makefile
 $(obj)/zImage:	$(obj)/compressed/vmlinux FORCE
 	$(call if_changed,objcopy)
	devio > foo 'wl 0xe3a01c05,4' 'wl 0xe38110e5,4'
	cat foo $(obj)/zImage > zImage.new
	mv zImage.new $(obj)/zImage
	rm foo
 	@echo '  Kernel: $@ is ready'
# apt-get install devio
# apt-get install libncurses5-dev

■コンパイル
# make mrproper
# make orion5x_defconfig
# cp .config /opt/kurobox_pro/boot/config-3.2.65-orion5x-default
# make menuconfig
# make zImage modules modules_install
# cp arch/arm/boot/zImage /opt/kurobox_pro/boot/vmlinuz-3.2.65-orion5x
# cp .config /opt/kurobox_pro/boot/config-3.2.65-orion5x
# cd /opt/kurobox_pro
# tar cjvf kurobox-kernel.tar.bz2 *
※configの内容は上のセルフコンパイルと同様

■展開(玄箱PRO側)
# tar -C / -xjvf kurobox-kernel.tar.bz2
# cd /boot
# mv uImage.buffalo uImage.buffalo.old
# mv initrd.buffalo initrd.buffalo.old
# update-initramfs -c -k 3.2.65-orion5x
update-initramfs: Generating /boot/initrd.img-3.2.65-orion5x
flash-kernel: installing version 3.2.65-orion5x
Generating kernel u-boot image... done.
Installing new uImage.buffalo.
Generating initramfs u-boot image... done.
Installing new initrd.buffalo.
# shutdown -r 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
Found boot image 
hit any key to switch tftp boot.
Hit any key to stop autoboot:  2  1  0 
<<system_bootend>>
Hit any key to stop autoboot:  3  2  1  0 

Reset IDE: 
Marvell Serial ATA Adapter
Integrated Sata device found
  Device 0: OK
Model: Hitachi HTS542525K9SA00                  Firm: BBFOC31P Ser#: 080422BB6F00WDDDBT6G
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 238475.1 MB = 232.8 GB (488397168 x 512)

Using device ide0, partition 1

Loading from block device ide device 0, partition 1: Name: hda1
  Type: U-Boot  File:/uImage.buffalo

1684112 bytes read
Using device ide0, partition 1

Loading from block device ide device 0, partition 1: Name: hda1
  Type: U-Boot  File:/initrd.buffalo

1828423 bytes read
<<stop_sound>>
## Booting image at 00100000 ...
   Image Name:   kernel 3.2.65-orion5x
   Created:      2015-03-27   1:03:13 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1684048 Bytes =  1.6 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
OK
## Loading Ramdisk Image at 02000000 ...
   Image Name:   ramdisk 3.2.65-orion5x
   Created:      2015-03-27   1:03:13 UTC
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    1828359 Bytes =  1.7 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK

Starting kernel ...

arg:console=ttyS0,115200
Uncompressing Linux... done, booting the kernel.
Linux version 3.2.65-orion5x (root@debian) (gcc version 4.7.2 (Debian 4.7.2-5) ) #4 PREEMPT Fri Mar 27 09:53:47 JST 2015
CPU: Feroceon [41069260] revision 0 (ARMv5TEJ), cr=a0053177
CPU: VIVT data cache, VIVT instruction cache
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
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
Kernel command line: console=ttyS0,115200
PID hash table entries: 512 (order: -1, 2048 bytes)
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: 123548k/123548k available, 7524k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xc8800000 - 0xfd800000   ( 848 MB)
    lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc0415368   (4149 kB)
      .init : 0xc0416000 - 0xc0439000   ( 140 kB)
      .data : 0xc043a000 - 0xc045b200   ( 133 kB)
       .bss : 0xc045b224 - 0xc0477164   ( 112 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:64
sched_clock: 32 bits at 166MHz, resolution 5ns, wraps every 25769ms
Calibrating delay loop... 265.42 BogoMIPS (lpj=1327104)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
devtmpfs: initialized
NET: Registered protocol family 16
Orion ID: MV88F5182-A2. TCLK=166666667.
Applying Orion-1/Orion-NAS PCIe config read transaction workaround
PCI: bus0: Fast back to back transfers disabled
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Switching to clocksource orion_clocksource
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
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Trying to unpack rootfs image as initramfs...
Freeing initrd memory: 1784K
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) c 2001-2006 Red Hat, Inc.
msgmni has been set to 244
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
mv_xor_shared mv_xor_shared.0: Marvell shared XOR driver
mv_xor mv_xor.0: Marvell XOR: ( xor cpy )
mv_xor mv_xor.1: Marvell XOR: ( xor fill cpy )
Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xf1012000 (irq = 3) is a 16550A
console [ttyS0] enabled
serial8250.1: ttyS1 at MMIO 0xf1012100 (irq = 4) is a 16550A
brd: module loaded
loop: module loaded
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
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
Generic platform RAM MTD, (c) 2004 Simtec Electronics
NAND device: Manufacturer ID: 0x20, Chip ID: 0xda (ST Micro NAND 256MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 854 at 0x000006ac0000
Creating 3 MTD partitions on "orion_nand":
0x000000000000-0x000000400000 : "uImage"
0x000000400000-0x000004400000 : "rootfs"
0x000004400000-0x000010000000 : "extra"
mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
mv643xx_eth smi: probed
mv643xx_eth_port mv643xx_eth_port.0: eth0: port 0 with MAC address 00:16:01:a4:c9:b9
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
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
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
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
usbcore: registered new interface driver usblp
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver ums-datafab
usbcore: registered new interface driver ums-freecom
usbcore: registered new interface driver ums-jumpshot
usbcore: registered new interface driver ums-sddr09
usbcore: registered new interface driver ums-sddr55
i2c /dev entries driver
rtc-rs5c372 0-0032: rs5c372a found, 24hr, driver version 0.6
rtc-rs5c372 0-0032: rtc core: registered rtc-rs5c372 as rtc0
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
oprofile: hardware counters not available
oprofile: using timer interrupt.
TCP cubic registered
NET: Registered protocol family 17
VFP support v0.3: not present
rtc-rs5c372 0-0032: setting system clock to 2015-03-27 01:03:50 UTC (1427418230)
ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
ata1.00: ATA-8: Hitachi HTS542525K9SA00, BBFOC31P, max UDMA/133
ata1.00: 488397168 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata1.00: configured for UDMA/133
scsi 0:0:0:0: Direct-Access     ATA      Hitachi HTS54252 BBFO PQ: 0 ANSI: 5
sd 0:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/232 GiB)
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
ata2: SATA link down (SStatus 0 SControl 300)
 sda: sda1 sda2 sda3 < sda5 > sda4
sd 0:0:0:0: [sda] Attached SCSI disk
Freeing init memory: 140K
Loading, please wait...
udevd[457]: starting version 175
Begin: Loading essential drivers ... modprobe: module platform:sata_mv not found in modules.dep
done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... done.
EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null)
Begin: Running /scripts/local-bottom ... done.
done.
Begin: Running /scripts/init-bottom ... done.
INIT: version 2.88 booting
[info] Using makefile-style concurrent boot in runlevel S.
[....] Starting the hotplug events dispatcher: udevdudevd[658]: starting version 175
[ ok .
[....] Synthesizing the initial hotplug events...[ ok done.
[....] Waiting for /dev to be fully populated...[ ok done.
[....] Activating swap...Adding 365564k swap on /dev/sda5.  Priority:-1 extents:1 across:365564k 
[ ok done.
EXT4-fs (sda2): re-mounted. Opts: (null)
[....] Checking root file system...fsck from util-linux 2.20.1
/dev/sda2: clean, 33480/1310720 files, 355119/5242880 blocks
[ ok done.
EXT4-fs (sda2): re-mounted. Opts: errors=remount-ro
[....] Cleaning up temporary files... /tmp[ ok .
[....] Activating lvm and md swap...[ ok done.
[....] Checking file systems...fsck from util-linux 2.20.1
/dev/sda4: clean, 142666/13918208 files, 34355865/55652608 blocks
/dev/sda1: clean, 29/124496 files, 38315/248832 blocks
[ ok done.
[....] Mounting local filesystems...EXT4-fs (sda4): mounted filesystem with ordered data mode. Opts: (null)
[ ok done.
[....] Activating swapfile swap...[ ok done.
[....] Cleaning up temporary files...[ ok .
[....] Setting kernel variables ...[ ok done.
[....] Configuring network interfaces...[ ok done.
[....] Starting rpcbind daemon...rpcbind: cannot create socket for udp6
rpcbind: cannot create socket for tcp6
[ ok .
[....] Starting NFS common utilities: statd idmapd[ ok .
[....] Cleaning up temporary files...mv643xx_eth_port mv643xx_eth_port.0: eth0: link up, 100 Mb/s, full duplex, flow control disabled
[ ok .
[....] Setting up X socket directories... /tmp/.X11-unix /tmp/.ICE-unix[ ok .
INIT: Entering runlevel: 2
[info] Using makefile-style concurrent boot in runlevel 2.
[....] Starting rpcbind daemon...[....] Already running.[ ok .
[....] Starting NFS common utilities: statd idmapd[ ok .
[....] Starting enhanced syslogd: rsyslogd[ ok .
[....] Starting deferred execution scheduler: atd[ ok .
[....] Starting periodic command scheduler: cron[ ok .
[....] Starting system message bus: dbus[ ok .
[....] Starting MTA: exim4[ ok .
ALERT: exim paniclog /var/log/exim4/paniclog has non-zero size, mail system possibly broken
[....] Starting Daemon for Linkstation/Kuro micro controller: micro-evtd[ ok .
[....] Starting Samba daemons: nmbd smbd[ ok .
[....] Starting OpenBSD Secure Shell server: sshd[ ok .

Debian GNU/Linux 7 KUROBOX-PRO ttyS0

KUROBOX-PRO login: root
Password: 
Last login: Fri Mar 27 11:05:45 JST 2015 on ttyS0
Linux KUROBOX-PRO 3.2.65-orion5x #4 PREEMPT Fri Mar 27 09:53:47 JST 2015 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:~# mount /dev/mtdblock2 /mnt/mtd
だめ
KUROBOX-PRO:~# mount -t jffs2 /dev/mtdblock2 /mnt/mtd
これもだめ
カーネル変えても変わらない
最終更新:2015年03月27日 13:57