第 2 章 製品の使用方法 7
2.3 弊社ドライバソフトウェアを使用する
2.4.1 USB接続のCFリーダ/ライタを使う場合
CPZ-SH03搭載のCFを、 USB接続のCFリーダ/ライタにセットし、
ホストマシンに接続します。(以降、
CFを/dev/sdaと認識したものとして説明します。)
1.
開発キットCDから必要なファイルをコピーUSB-CD
あるいは 内蔵CDドライブに開発キットCDをセットし、マウントします。(ここでは、/cdromディレクトリにマウントしたものとして記載します。)
以下のように必要なファイルをホストマシンにコピーします。kitty:~# cp –a /cdrom/cpz-base /opt kitty:~# cp –a /cdrom/cpz-usbcf /opt/
2. CDへの書き込み
(1) パーティションテーブルの作成
fdiskコマンドでパーティションテーブルを作ります。以下は、実行例です。
kitty:~# cd /opt/cpz-usbcf/
kitty:/opt/cpz-usbcf# fdisk /dev/sda Command (m for help): p
Disk /dev/sda: 256 MB, 256377344 bytes 16 heads, 32 sectors/track, 978 cylinders Units = cylinders of 512 * 512 = 262144 bytes
Device Boot Start End Blocks Id System /dev/sda1 * 1 978 250352 83 Linux Command (m for help): d
Selected partition 1 Command (m for help): p
Disk /dev/sda: 256 MB, 256377344 bytes 16 heads, 32 sectors/track, 978 cylinders Units = cylinders of 512 * 512 = 262144 bytes
Device Boot Start End Blocks Id System Command (m for help): n
Command action e extended
p primary partition (1-4) p
Partition number (1-4): 1 First cylinder (1-978, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-978, default 978):
Using default value 978 Command (m for help): a Partition number (1-4): 1 Command (m for help): p
Disk /dev/sda: 256 MB, 256377344 bytes 16 heads, 32 sectors/track, 978 cylinders Units = cylinders of 512 * 512 = 262144 bytes
Device Boot Start End Blocks Id System /dev/sda1 * 1 978 250352 83 Linux Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
kitty:/opt/cpz-usbcf#
(2) Ext3ファイルシステムの構築
mkfs.ext3コマンドを使用して、CFの1番目の領域(ここでは/dev/sda1)をext3ファイルシステムに
します。kitty:/opt/cpz-usbcf# mkfs.ext3 /dev/sda1 mke2fs 1.35 (28-Feb-2004)
Filesystem label=
〜中略〜
180 days, whichever comes first. Use tune2fs -c or -i to override.
kitty:/opt/cpz-usbcf#
※ SH-Linux(kernel v2.6.11)のリカバリをRed Hat Enterprise Linux v.4(以降RHEL4)で行う場合、
RHEL4のファイルシステムは拡張されており、そのままリカバリを行うと、SH-Linuxの起動時
にルートパーティションのマウントで失敗します。下記の反転箇所のオプションを付けて無効にしておく必要があります。
kitty:/opt/cpz-usbcf# mkfs.ext3 –O^resize_inode /dev/sda1 mke2fs 1.35 (28-Feb-2004)
Filesystem label=
〜中略〜
180 days, whichever comes first. Use tune2fs -c or -i to override.
kitty:/opt/cpz-usbcf#
※ SH-Linux(kernel2.4.17)のリカバリをRHEL4で行う場合、上記の手順を行っても ルートパーティションのマウントで失敗することが確認されています。
kernel 2.4系のLinuxを使用するか、ネットワークブートを使用したリカバリを行ってください。
(3) システムファイルの書き込み
tarコマンドでCPZ-SH03用のシステムファイルをCFに書き込みます。
SH-Linux kernel ver. 2.4.17 i
kitty:/opt/cpz-usbcf# mount -t ext3 /dev/sda1 /mnt/
kitty:/opt/cpz-usbcf# cd /mnt/
kitty:/mnt# tar zxf /opt/cpz-base/cpz-base-2.4-20060320.tar.gz kitty:/mnt#
SH-Linux kernel ver. 2.6.11
i
kitty:/opt/cpz-usbcf# mount -t ext3 /dev/sda1 /mnt/
kitty:/opt/cpz-usbcf# cd /mnt/
kitty:/mnt# tar zxf /opt/cpz-base/cpz-base-2.6-20060320.tar.gz kitty:/mnt#
Red Hat Enterprise Linux v.4の場合
基本手順(4) ブートローダの書き込み
tarコマンドで書き込んだ状態は、セルフでliloを実行する状態になっています。
クロスで実行できるように、/mnt/etc/lilo.confと/mnt/boot/boot.bを変更します。
kitty:/mnt# cp -a etc/lilo.conf etc/lilo.conf-orig kitty:/mnt# mv boot/boot.b boot/boot.b-orig kitty:/mnt# gedit etc/lilo.conf
kitty:/mnt# cp -a /opt/cpz-usbcf/boot.b-21.4 boot/boot.b kitty:/mnt# /opt/cpz-usbcf/lilo -r /mnt/
Added linux * kitty:/mnt#
この例では、
/mnt/etc/lilo.confをlilo.conf-origとして、 /mnt/boot/boot.bをboot.b-origとして保存していま
す。その後、/mnt/etc/lilo.confを変更します。変更内容は以下の通りです。
boot.bもクロス用のファイルを CFにコピーし、boot.bのバージョンに合ったliloを実行します。
/mnt/etc/lilo.confの変更内容 (変更前)
linear compact
# Cross LILO
# Actually, it's /dev/hda boot = /dev/hda disk = /dev/hda bios=0x80
#
delay = 30
###vga = normal image = /boot/vmlinuz label = linux root = /dev/hda1 read-only
(変更後) linear compact
# Cross LILO
# Actually, it's /dev/hda boot = /dev/sda disk = /dev/sda
#boot = /dev/hda
#disk = /dev/hda bios=0x80
#
delay = 30
###vga = normal image = /boot/vmlinuz label = linux root = /dev/hda1 read-only
boot=とdisk=を、/dev/hdaから/dev/sdaに変更します。
(5) 終了処理
セルフでliloを実行しても問題ないように、/mnt/etc/lilo.confと
/mnt/boot/boot.bを元のファイルに戻し、
アンマウントすれば完了です。
kitty:/mnt# cp etc/lilo.conf-orig etc/lilo.conf kitty:/mnt# cp boot/boot.b-orig boot/boot.b kitty:/mnt# cd
kitty:~# umount /mnt/
kitty:~#
以上で、CFのリカバリは完了です。
お知らせ
もし、オリジナルの
boot.b
を上書きしてし まった 場合、/opt/cpz-usbcfに 格納されているboot.b-20.0で上書きしてください。
kitty:/mnt# cp -a /opt/cpz-usbcf/boot.b-20.0 boot/boot.b kitty:/mnt#