HDD boot 再チャレンジ

KURO-NAS/X4

OS が HDD からブートし始めたので、 もう一度インストール環境の HDD ブートをやってみる。

退避

KUROBOX-TERA:~# cd /boot
KUROBOX-TERA:/boot# ls
initrd.buffalo  lost+found  uImage.buffalo
KUROBOX-TERA:/boot# mv initrd.buffalo initrd.buffalo.orig
KUROBOX-TERA:/boot# mv uImage.buffalo uImage.buffalo.orig
KUROBOX-TERA:/boot#

ファームウェアを置く

CD-ROM に収められている initrd.buffalo uImage.buffalo を /boot に置く。

ftp で get しようとしたら、、、

KUROBOX-TERA:/boot# ftp fs.yamasita.jp
-bash: ftp: command not found
KUROBOX-TERA:/boot#
仕方がないので、インストール
KUROBOX-TERA:/boot# apt-get install ftp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  ftp
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 55.9kB of archives.
After this operation, 164kB of additional disk space will be used.
Get:1 http://ftp.jp.debian.org lenny/main ftp 0.17-18 [55.9kB]
Fetched 55.9kB in 2s (24.4kB/s)
Selecting previously deselected package ftp.
(Reading database ... 26399 files and directories currently installed.)
Unpacking ftp (from .../archives/ftp_0.17-18_armel.deb) ...
Processing triggers for man-db ...
Setting up ftp (0.17-18) ...
KUROBOX-TERA:/boot#
ファームウェアを転送する。
KUROBOX-TERA:/boot# ftp fs.yamasita.jp
Connected to giga.yamasita.jp.
220 ProFTPD 1.2.10 Server (ProFTPD Default Installation) [192.168.2.32]
Name (fs.yamasita.jp:root): yasunari
331 Password required for yasunari.
Password:
230 User yasunari logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd /home/linkstation/firmware/KURO-NAS/cd/firmware
250 CWD command successful
ftp> ls
200 PORT command successful
150 Opening ASCII mode data connection for file list
-rwxrw-r--   1 yasunari root      7610042 Oct  1 21:10 initrd.buffalo
-rwxrw-r--   1 yasunari root       245776 Sep 22 20:13 u-boot.bin
-rwxrw-r--   1 yasunari root      2773096 Oct  1 16:14 uImage.buffalo
226 Transfer complete.
ftp> bin
200 Type set to I
ftp> hash
Hash mark printing on (1024 bytes/hash mark).
ftp> mget *o
mget initrd.buffalo? y
200 PORT command successful
150 Opening BINARY mode data connection for initrd.buffalo (7610042 bytes)
##################(略)
226 Transfer complete.
7610042 bytes received in 1.36 secs (5474.7 kB/s)
mget uImage.buffalo? y
200 PORT command successful
150 Opening BINARY mode data connection for uImage.buffalo (2773096 bytes)
##################(略)
226 Transfer complete.
2773096 bytes received in 0.52 secs (5205.6 kB/s)
ftp> bye
221 Goodbye.
KUROBOX-TERA:/boot#

一緒?

KUROBOX-TERA:/boot# ls -l
total 20336
-rw-r--r-- 1 root root 7610042 Dec 20 03:42 initrd.buffalo
-rwxr-xr-x 1 root root 7610042 Jan  1  1970 initrd.buffalo.orig
drwx------ 2 root root   16384 Jan  1  1970 lost+found
-rw-r--r-- 1 root root 2773096 Dec 20 03:42 uImage.buffalo
-rwxr-xr-x 1 root root 2773096 Jan  1  1970 uImage.buffalo.orig
KUROBOX-TERA:/boot# cmp initrd.buffalo*
KUROBOX-TERA:/boot# cmp uImage.buffalo*
KUROBOX-TERA:/boot#
一緒。

リブート

念のため、リブートしてみた。
U-Boot はちゃんと initrd.buffalo, uImage.buffalo を 読み込んで立ち上がってきた。
問題なし。

何で Hdd Boot できひんかったの?

HS-DHGL でもう一度

HS-DHGL でパーティションをきったり、フォーマットした HDD からは 起動しない?

再現してみる。

つなぎ換え

KURO-NAS からはずして HS-DHGL に USB で接続

確認

HS-DHGL で中身の確認
hackkit:~# mkdir /tmp/boot
hackkit:~# mount /dev/sdb1 /tmp/boot
hackkit:~# ls -l /tmp/boot/
total 20336
-rw-r--r-- 1 root root 7610042 Dec 20 12:42 initrd.buffalo
-rwxr-xr-x 1 root root 7610042 Jan  1  1970 initrd.buffalo.orig
drwx------ 2 root root   16384 Jan  1  1970 lost+found
-rw-r--r-- 1 root root 2773096 Dec 20 12:42 uImage.buffalo
-rwxr-xr-x 1 root root 2773096 Jan  1  1970 uImage.buffalo.orig
退避しておく
hackkit:~# mkdir KURO-NAS
hackkit:~# mv /tmp/boot/initrd.buffalo KURO-NAS
hackkit:~# mv /tmp/boot/uImage.buffalo KURO-NAS
hackkit:~# umount /tmp/boot/
hackkit:~#

パーティションのきりなおし

まずはフォーマットしてつぶす
hackkit:~# mke2fs -j /dev/sdb1
mke2fs 1.41.3 (12-Oct-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
62848 inodes, 251007 blocks
12550 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=260046848
8 block groups
32768 blocks per group, 32768 fragments per group
7856 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
hackkit:~#
パーティションのきりなおし。ひとつだけにする
hackkit:~# fdisk /dev/sdb

The number of cylinders for this disk is set to 24792.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdb: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         125     1004031   83  Linux
/dev/sdb2             126         624     4008217+  83  Linux
/dev/sdb3             625         749     1004062+  82  Linux swap / Solaris
/dev/sdb4             750       24792   193125397+  83  Linux

Command (m for help): d
Partition number (1-4): 1

Command (m for help): d
Partition number (1-4): 2

Command (m for help): d
Partition number (1-4): 3

Command (m for help): d
Selected partition 4

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-24792, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-24792, default 24792): +1024M

Command (m for help): p

Disk /dev/sdb: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         125     1004031   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
hackkit:~#
再度フォーマット
hackkit:~# mke2fs -j /dev/sdb1
mke2fs 1.41.3 (12-Oct-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
62848 inodes, 251007 blocks
12550 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=260046848
8 block groups
32768 blocks per group, 32768 fragments per group
7856 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
hackkit:~#
マウント
hackkit:~# mount /dev/sdb1 /tmp/boot
hackkit:~# 
コピー
hackkit:~# cp KURO-NAS/* /tmp/boot
hackkit:~# ls -l /tmp/boot/
total 10176
-rw-r--r-- 1 root root 7610042 Dec 20 13:18 initrd.buffalo
drwx------ 2 root root   16384 Dec 20 13:17 lost+found
-rw-r--r-- 1 root root 2773096 Dec 20 13:18 uImage.buffalo
hackkit:~#
アンマウント
hackkit:~# umount /tmp/boot
hackkit:~#
これで再現できているはず。

つなぎ換え

HS-DHGL からはずして KURO-NAS に SATA で接続

リブート

	:
	:
Hit any key to stop autoboot:  0

Reset IDE:
Marvell Serial ATA Adapter
Found adapter at bus 1, device 7 ... Scanning channels
  Device 0: OK
Model: Maxtor 6L200M0                           Firm: BANC1G10 Ser#: L40PVARG
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 194481.0 MB = 189.9 GB (398297088 x 512)

Using device ide0, partition 1

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

0 bytes read
<<stop_sound>>
## Booting image at 00100000 ...
Bad Magic Number
bootm fail.
<<system_not_found>>
Using egiga0 device
TFTP from server 192.168.2.39; our IP address is 192.168.2.48
Filename 'uImage.buffalo'.
Load address: 0x100000
Loading: #################################################################
	:
	:
tftp ブートを始めた。再現。

結論

HS-DHGL(など他のマシン?)で フォーマットした HDD からは HDD ブートできない(ようだ)。

なんでやねん!



KURO-NAS/X4
楽天市場
amazon
Yahoo!ショッピング
クレバリー
ソフマップ・ドットコム


パッケージのアップデート / update
ハックの記録
LinkStation/玄箱 をハックしよう

再インストール

Copyright (C) 2003-2008 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市