柘植です。こんにちは。
ブートローダーにGRUBを使ってKnoppixを再構成してみました。
・間違ってMBRにLILOとかを書き込んでしまった時のために、HDDにインストール
されている全てのOSを起動できるようにする。(もちろんWindowsも)
・V3.2から導入されたpersistenthomeの機能を使って起動、使わないで起
動、が簡単に選択できるようにする。
・GRUBのメニュー画面の背景画像にお気に入りの画像を表示させる。
・GRUBのコマンド入力画面で日本語キーボードのキートップに印刷された文字通り
の入力ができるようにする。
以上のことが目標です。
作業の詳細は以下の通りです。
( http://www7.plala.or.jp/buchs/bootloader/grub1.htmlにも置いてます。)
間違いなどを発見された方はフォローおねがいします。
1.GRUBを使った起動イメージ(grub288.bin)を作ります。
まずサイズが2.88MBのファイルを作ります。
$ dd if=/dev/zero of=grub288.bin bs=512 count=5760
読み込んだブロック数は 5760+0
書き込んだブロック数は 5760+0
2949120 bytes transferred in 0.251234 seconds (11738538 bytes/sec)
ext2でフォーマットします。
$ mke2fs grub288.bin
mke2fs 1.32 (09-Nov-2002)
grub288.bin is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
360 inodes, 2880 blocks
144 blocks (5.00%) reserved for the super user
First data block=1
1 block group
8192 blocks per group, 8192 fragments per group
360 inodes per group
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
適当な作業ディレクトリにループバックマウントしてgrubという名のディレクトリを作
ります。
$ mkdir work
$ su
Password:
# mount -o loop grub288.bin work/
# mkdir work/grub
GRUBをインストールします。
# cp /usr/lib/grub/i386-pc/stage[12] work/grub/
# echo "(fd0) /dev/loop0" > dev.map
# /sbin/grub --device-map=dev.map <<END
> root (fd0)
> setup (fd0)
> END
GNU GRUB version 0.93 (640K lower / 3072K upper memory)[ Minimal BASH-like
line editing is supported. For the first word, TABlists possible command
completions. Anywhere else TAB lists the possiblecompletions of a
device/filename.]
grub>root(fd0)Filesystem type is ext2fs, using whole disk
grub>setup(fd0)Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... yes
Checking if "/grub/stage2" exists... yes
Checking if "/grub/e2fs_stage1_5" exists... no
Running "install /grub/stage1 (fd0) /grub/stage2 p /grub/menu.lst "
... succeededDone.
grub>
自分の環境に合わせたmenu.lstを用意します。
# cat menu.lst
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,11)
# kernel /boot/vmlinuz-version ro root=/dev/hda12
# initrd /boot/initrd-version.img
# boot=/dev/hda12
default=6
timeout=10
#前景色
#foreground = ffffff
#背景色
#background = 000000
#GRUB起動時に表示する背景画像(/dev/hda12の/boot/grub/splash.xpm.gzを使う場合)
splashimage=(hd0,10)/boot/grub/splash.xpm.gz
# 日本語キーボードのために
setkey doublequote at
setkey ampersand caret
setkey quote ampersand
setkey parenleft asterisk
setkey parenright parenleft
setkey tilde parenright
setkey equal underscore
setkey plus colon
setkey colon quote
setkey asterisk doublequote
setkey bracketleft bracketright
setkey braceleft braceright
setkey bracketright backslash
setkey braceright bar
setkey backslash equal
setkey underscore plus
setkey backslash bracketleft
setkey bar braceleft
setkey F9 equal
setkey F10 bracketleft
setkey equal k73
setkey bracketleft k7d
title Vine Linux (2.4.19-0vl11)
root (hd0,10)
kernel /boot/vmlinuz-2.4.19-0vl11 ro root=/dev/hda11 hdc=ide-scsi
#video=i810fb:xres=800:yres=600:vyres=600:bpp=24:\
hsync1=30:hsync2=69:vsync1=50:vsync2=160:accel:mtrr
title Knoppix 3.2 (loopback install)
kernel (hd0,11)/vmlinuz ro root=/dev/hda12 hdc=scsi \
noapic apm=power-off vga=normal
initrd (hd0,11)/miniroot.gz
title Knoppix 3.1(hdinstall)
kernel (hd0,9)/boot/vmlinuz ro root=/dev/hda10 hdc=scsi \
noapic apm=power-off vga=normal
initrd (hd0,9)/boot/initrd.gz
title Windows XP Professional
rootnoverify (hd0,0)
chainloader +1
title Debian sarge
kernel (hd0,12)/vmlinuz ro root=/dev/hda13 hdc=scsi \
noapic apm=power-off vga=normal
initrd (hd0,12)/initrd.img
title Knoppix 3.2 (AIST:knoppix_20030324-20030404)
root (fd0)
kernel (fd0)/vmlinuz root=/dev/scd0 ramdisk_size=100000 \
init=/etc/init noapic \ apm=power-off hdc=scsi vga=normal \
lang=ja wheel
initrd (fd0)/miniroot.gz
title Knoppix 3.2 with persistenthome (AIST:knoppix_20030324-20030404)
root (fd0)
kernel (fd0)/vmlinuz root=/dev/scd0 ramdisk_size=100000 \
init=/etc/init noapic \ apm=power-off hdc=scsi vga=normal \
lang=ja home=/dev/hda6 myconf=/dev/sda1
initrd (fd0)/miniroot.gz
menu.lstを起動イメージファイルのgrubディレクトリにコピーします。
# cp menu.lst work/grub/
workディレクトリにマウントしていたgrub288.binをアンマウントします。
# umount work
これで起動イメージファイルgrub288.binができました。
2.KnoppixのISOイメージをリマスタする準備です。
リマスタ用のディレクトリを用意します。
# mount /dev/hda12 /mnt/hda12
# mkdir -p /mnt/hda12/master/KNOPPIX
# cd /mnt/hda12
master/KNOPPIXディレクトリに必要なファイルをコピーします。
# mkdir work
# mount -o loop knoppix_20030324-20030404.iso work
# cp -a work/KNOPPIX/* master/KNOPPIX
# umount work
先ほど作成した起動イメージファイル(grub288.bin)をコピーします。
# cp /home/knoppix/boot_img/grub/grub288.bin master/KNOPPIX
3. ISOイメージを作ります。
# cd master
# mkisofs -l -r -J -V "GRUBKnoppix" -hide-rr-moved -v -b \
KNOPPIX/grub288.bin -c KNOPPIX/boot.catalog -o \
/mnt/hda12/grub-knoppix.iso /mnt/hda12/master
4. 作成したISOイメージをCD-RWに焼いてみます。
# cdrecord dev=0,0,0 blank=fast -v speed=4 -eject \
../grub-knoppix.iso
このままrebootすればGRUBが起動して、menu.lstを反映したメニュー画面が表示されます。
CDのKnoppixを起動した場合以外は、OSが起動したあとすぐにCDを抜いてしまってもかま
いません。
PS.
MLの過去ログ(1301-1400)を
http://www7.plala.or.jp/buchs/MLlog/knx-ml-1301-1400.zip
に置きました。
--
Tsuge Akihide
|