最初はただ見てるだけ ということに しておきましょう。
http://www.gnu.org/software/grub/
GNU GRUB is a Multiboot boot loader. It was derived from GRUB,
GRand Unified Bootloader, which was originally designed and implemented by Erich Stefan Boleyn.
というらしいのですが、ここが 起源の様です
http://www.uruk.org/orig-grub/
Execute your OS's equivalent of (this should work for recent FreeBSD versions and Linux just fine):
dd if=bin/stage1 of=/dev/fd0 bs=512 count=1 dd if=bin/stage2 of=/dev/fd0 bs=512 seek=1
さて 同じく
http://www.gnu.org/software/grub/manual/grub.html
To create a GRUB boot floppy, you need to take the files stage1 and stage2 from the image directory, and write them to the first and the second block of the floppy disk, respectively. Caution: This procedure will destroy any data currently stored on the floppy. On a UNIX-like operating system, that is done with the following commands:
# cd /usr/lib/grub/i386-pc # dd if=stage1 of=/dev/fd0 bs=512 count=1 1+0 records in 1+0 records out # dd if=stage2 of=/dev/fd0 bs=512 seek=1 153+1 records in 153+1 records out #
The device file name may be different. Consult the manual for your OS.
# find / -name grub ... /boot/grub /usr/local/sbin/grub /usr/local/share/grub /usr/sbin/grub /usr/share/grub # /usr/local/sbin/grub --version grub (GNU GRUB 0.95) # /usr/sbin/grub --version grub (GNU GRUB 0.93) # which grub /usr/local/sbin/grub # pkgtool # find / -name grub ... /boot/grub /usr/local/sbin/grub /usr/local/share/grub /usr/share/grub lx:/usr/share/grub# pwd /usr/share/grub lx:/usr/share/grub# rmdir i386-pc/ lx:/usr/share# pwd /usr/share lx:/usr/share# rmdir grub lx:/usr/share# cd /usr/sbin/ lx:/usr/sbin# ls | grep grub lx:/usr/sbin# lx:/usr/sbin# cd /usr/local/share/ lx:/usr/local/share# ls aclocal/ gnupg/ grub/ locale/ netatalk/ lx:/usr/local/share# cd grub/ lx:/usr/local/share/grub# ls i386-pc/ lx:/usr/local/share/grub# cd i386-pc/ lx:/usr/local/share/grub/i386-pc# ls e2fs_stage1_5 iso9660_stage1_5 reiserfs_stage1_5 stage2_eltorito xfs_stage1_5 fat_stage1_5 jfs_stage1_5 stage1 ufs2_stage1_5 ffs_stage1_5 minix_stage1_5 stage2 vstafs_stage1_5
まあそうして
lx:/usr/local/share/grub/i386-pc# fdformat /dev/fd0u1440 Double-sided, 80 tracks, 18 sec/track. Total capacity 1440 kB. Formatting ... 6 Formatting ... done Verifying ... 8 Verifying ... done lx:/usr/local/share/grub/i386-pc# mkfs.ext2 /dev/fd0 -L compaqgrub mke2fs 1.32 (09-Nov-2002) Filesystem label=compaqgrub OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 184 inodes, 1440 blocks 72 blocks (5.00%) reserved for the super user First data block=1 1 block group 8192 blocks per group, 8192 fragments per group 184 inodes per group Writing inode tables: done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 24 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. lx:/usr/local/share/grub/i386-pc# mount /dev/fd0 /mnt/ lx:/usr/local/share/grub/i386-pc# df Filesystem 1k-blocks Used Available Use% Mounted on /dev/sda5 4960464 2970424 1733992 64% / /dev/sda8 2822080 1348552 1330172 51% /var/data /dev/fd0 1412 13 1327 1% /mnt lx:/usr/local/share/grub/i386-pc# pwd /usr/local/share/grub/i386-pc lx:/usr/local/share/grub/i386-pc# mkdir -p /mnt/boot/grub lx:/usr/local/share/grub/i386-pc# ls -R /mnt/ /mnt/: boot/ lost+found/ /mnt/boot: grub/ /mnt/boot/grub: lx:/usr/local/share/grub/i386-pc# cp stage1 stage2 /mnt/boot/grub/ lx:/usr/local/share/grub/i386-pc# ls -l /mnt/boot/grub/ total 110 -rw-r--r-- 1 root root 512 Apr 26 23:47 stage1 -rw-r--r-- 1 root root 110229 Apr 26 23:47 stage2 # Boot automatically after 15 secs. timeout 15 # By default, boot the first entry. default 0 # Fallback to the second entry. fallback 1 # For booting plamo 3.3 /Linux title plamo 3.3 Nyan Nyan /dev/sda5 root (hd1,4) kernel /vmlinuz root=/dev/sda5 # Vine Linux 3.1 non initrd-version.img title Vine Linux 3.1 ON /dev/sda1 root (hd1,0) kernel /boot/vmlinuz-2.4.27-0vl7 ro root=/dev/sda1 initrd /boot/initrd-2.4.27-0vl7.img # Red Hat Linux 7.3 splashimage=(hd2,1)/boot/grub/splash.xpm.gz title Red Hat Linux (2.4.18-3)/dev/sdb2 root (hd2,1) kernel /boot/vmlinuz-2.4.18-3 ro root=/dev/sdb2 initrd /boot/initrd-2.4.18-3.imgother sample
lx:/usr/local/share/grub/i386-pc# ls -l /mnt/boot/grub/ total 125 -rwxr-xr-x 1 root root 3915 Nov 20 2004 001_me~1.lst* -rwxr-xr-x 1 root root 3953 Feb 21 2005 002_me~1.lst* -rwxr-xr-x 1 root root 3953 Feb 4 2006 003_me~1.lst* -rwxr-xr-x 1 root root 3951 Apr 9 16:54 menu.lst* -rwxr-xr-x 1 root root 512 Nov 20 2004 stage1* -rwxr-xr-x 1 root root 110229 Nov 20 2004 stage2*
へてから
lx:~# ls -l /mnt/boot/grub/ total 110 -rw-r--r-- 1 root root 512 Apr 26 23:47 stage1 -rw-r--r-- 1 root root 110229 Apr 26 23:47 stage2 lx:~# chmod 755 /mnt/boot/grub/* lx:~# ls -l /mnt/boot/grub/ total 110 -rwxr-xr-x 1 root root 512 Apr 26 23:47 stage1* -rwxr-xr-x 1 root root 110229 Apr 26 23:47 stage2* lx:~# cp /home/mm/public_html/001_first/d_grub/1001_grub/menu.lst /mnt/boot/grub/ lx:~# ls -l /mnt/boot/grub/ total 115 -rwxr-xr-x 1 root root 4445 Apr 27 00:11 menu.lst* -rwxr-xr-x 1 root root 512 Apr 26 23:47 stage1* -rwxr-xr-x 1 root root 110229 Apr 26 23:47 stage2* lx:~# df Filesystem 1k-blocks Used Available Use% Mounted on /dev/sda5 4960464 2970412 1734004 64% / /dev/sda8 2822080 1348552 1330172 51% /var/data /dev/fd0 1412 119 1221 9% /mnt lx:~# umount /mnt/ lx:~# /usr/local/sbin/grub Probing devices to guess BIOS drives. This may take a long time. GNU GRUB version 0.95 (640K lower / 3072K upper memory) [ Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename. ] grub> root (fd0) Filesystem type is ext2fs, using whole disk grub> setup (fd0) Checking if "/boot/grub/stage1" exists... yes Checking if "/boot/grub/stage2" exists... yes Checking if "/boot/grub/e2fs_stage1_5" exists... no Running "install /boot/grub/stage1 (fd0) /boot/grub/stage2 p /boot/grub/menu.lst "... succeed ed Done. grub> quit lx:~#
実際の試行するには どうするか
にゃんたろう 拝!
2009年 6月23日 (火) 21:01:58 JST 作成