个人工具

“UbuntuHelp:GrubHowto/BootFloppy”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(New page: {{From|https://help.ubuntu.com/community/GrubHowto/BootFloppy}} {{Languages|php5}} '''Making a GRUB boot floppy.''' GRUB (GRand Unified Bootloader) is the boot manager installed by defaul...)
 
 
(未显示2个用户的7个中间版本)
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/GrubHowto/BootFloppy}}
 
{{From|https://help.ubuntu.com/community/GrubHowto/BootFloppy}}
{{Languages|php5}}
+
{{Languages|UbuntuHelp:GrubHowto/BootFloppy}}
 
'''Making a GRUB boot floppy.'''
 
'''Making a GRUB boot floppy.'''
 
 
GRUB (GRand Unified Bootloader) is the boot manager installed by default in recent versions of Ubuntu Linux. It is an effort by the GNU project to provide a bootloader that supports the greatest number of operating systems. This document explains how to make a boot floppy that can either boot an installed operating system or present you with a GRUB command shell so that you can enter commands directly. It assumes that you are making the diskette on an Ubuntu Linux box.
 
GRUB (GRand Unified Bootloader) is the boot manager installed by default in recent versions of Ubuntu Linux. It is an effort by the GNU project to provide a bootloader that supports the greatest number of operating systems. This document explains how to make a boot floppy that can either boot an installed operating system or present you with a GRUB command shell so that you can enter commands directly. It assumes that you are making the diskette on an Ubuntu Linux box.
 
 
1. Obtain root privileges.
 
1. Obtain root privileges.
<pre><nowiki>
 
sudo -s  </nowiki></code>
 
  
2. Format the floppy with the ext2 filesystem:
 
 
<pre><nowiki>
 
<pre><nowiki>
  mke2fs /dev/fd0 </nowiki></code>
+
  sudo -s  </nowiki></pre>
 +
2. Format the floppy with the ext2 filesystem:
  
 +
<pre><nowiki>
 +
mke2fs /dev/fd0 </nowiki></pre>
 
3. Mount the floppy and copy the files that GRUB needs to make it bootable:
 
3. Mount the floppy and copy the files that GRUB needs to make it bootable:
 +
 
<pre><nowiki>
 
<pre><nowiki>
 
  mount /dev/fd0 /media/floppy
 
  mount /dev/fd0 /media/floppy
第19行: 第18行:
 
  mkdir /media/floppy/boot/grub
 
  mkdir /media/floppy/boot/grub
 
  cd /boot/grub
 
  cd /boot/grub
  cp stage1 stage2 /media/floppy/boot/grub  </nowiki></code>
+
  cp stage1 stage2 /media/floppy/boot/grub  </nowiki></pre>
 
+
 
If you want to boot the operating system already installed on the
 
If you want to boot the operating system already installed on the
 
machine you are making the floppy from, also copy
 
machine you are making the floppy from, also copy
 
/boot/grub/menu.lst and /boot/grub/device.map to the corresponding
 
/boot/grub/menu.lst and /boot/grub/device.map to the corresponding
 
directories on the floppy.
 
directories on the floppy.
 
 
4. Unmount the floppy (umount /dev/fd0), then start GRUB in
 
4. Unmount the floppy (umount /dev/fd0), then start GRUB in
 +
 
interactive mode by typing grub. You will see the GRUB command
 
interactive mode by typing grub. You will see the GRUB command
 
prompt (grub >). Enter these commands:
 
prompt (grub >). Enter these commands:
第33行: 第31行:
 
  root (fd0)
 
  root (fd0)
 
  setup (fd0)
 
  setup (fd0)
  quit  </nowiki></code>
+
  quit  </nowiki></pre>
 
+
 
5. At this point, you have a bootable floppy. If you added the extra
 
5. At this point, you have a bootable floppy. If you added the extra
 +
 
files mentioned above, you should get a standard GRUB screen when
 
files mentioned above, you should get a standard GRUB screen when
 
you boot from it, just as if you had booted from the
 
you boot from it, just as if you had booted from the
 
hard drive.
 
hard drive.
 
 
6. If you want to be extra cautious, you can save a copy of the current
 
6. If you want to be extra cautious, you can save a copy of the current
 +
 
machine's master boot record to a file on the floppy. The following  
 
machine's master boot record to a file on the floppy. The following  
 
example assumes the master boot record is on device hda; the file containing  
 
example assumes the master boot record is on device hda; the file containing  
 
the boot record is named boot.mbr.
 
the boot record is named boot.mbr.
 
<pre><nowiki>
 
<pre><nowiki>
  dd if=/dev/hda of=/media/floppy/boot.mbr bs=512 count=1  </nowiki></code>
+
  dd if=/dev/hda of=/media/floppy/boot.mbr bs=512 count=1  </nowiki></pre>
 
+
 
To restore it, you would just reverse the parameters of the dd
 
To restore it, you would just reverse the parameters of the dd
 
command:
 
command:
 
<pre><nowiki>
 
<pre><nowiki>
  dd if=/media/floppy/boot.mbr of=/dev/hda bs=512 count=1 </nowiki></code>
+
  dd if=/media/floppy/boot.mbr of=/dev/hda bs=512 count=1 </nowiki></pre>
 
+
'''Boot a floppy image without a floppy drive.'''
CategoryDocumentation
+
Some computers don't have a floppy drive and can't boot from a CD-ROM. One way of getting the CD to boot is
 +
from a bootloader floppy image. You'll need the memdisk file from the syslinux package. To get it run
 +
<pre><nowiki>
 +
sudo apt-get install syslinux </nowiki></pre>
 +
Copy the memdisk file to the grub folder
 +
<pre><nowiki>
 +
sudo cp /usr/lib/syslinux/memdisk /boot/grub/ </nowiki></pre>
 +
There is a floppy image on the *ubuntu CD that can be used if you don't feel like making one. Mount the CD
 +
and copy it to the grub folder as well.
 +
<pre><nowiki>
 +
sudo cp /<cd_mountpoint>/install/sbm.bin /boot/grub/ </nowiki></pre>
 +
Next you have to make some changes to /boot/grub/menu.lst. Open it as root and add
 +
<pre><nowiki>
 +
title      Floppy Image
 +
kernel      /boot/grub/memdisk
 +
initrd      /boot/grub/sbm.bin </nowiki></pre>
 +
above "title Ubuntu x.xx, memtest86+". Save the changes. Now you should be able to boot the floppy image
 +
without a floppy drive and boot from the CD.
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2009年5月12日 (二) 17:01的最新版本

Making a GRUB boot floppy. GRUB (GRand Unified Bootloader) is the boot manager installed by default in recent versions of Ubuntu Linux. It is an effort by the GNU project to provide a bootloader that supports the greatest number of operating systems. This document explains how to make a boot floppy that can either boot an installed operating system or present you with a GRUB command shell so that you can enter commands directly. It assumes that you are making the diskette on an Ubuntu Linux box. 1. Obtain root privileges.

 sudo -s  

2. Format the floppy with the ext2 filesystem:

 mke2fs /dev/fd0 

3. Mount the floppy and copy the files that GRUB needs to make it bootable:

 mount /dev/fd0 /media/floppy
 mkdir /media/floppy/boot
 mkdir /media/floppy/boot/grub
 cd /boot/grub
 cp stage1 stage2 /media/floppy/boot/grub  

If you want to boot the operating system already installed on the machine you are making the floppy from, also copy /boot/grub/menu.lst and /boot/grub/device.map to the corresponding directories on the floppy. 4. Unmount the floppy (umount /dev/fd0), then start GRUB in

interactive mode by typing grub. You will see the GRUB command prompt (grub >). Enter these commands:

 device (fd0) /dev/fd0
 root (fd0)
 setup (fd0)
 quit   

5. At this point, you have a bootable floppy. If you added the extra

files mentioned above, you should get a standard GRUB screen when you boot from it, just as if you had booted from the hard drive. 6. If you want to be extra cautious, you can save a copy of the current

machine's master boot record to a file on the floppy. The following example assumes the master boot record is on device hda; the file containing the boot record is named boot.mbr.

 dd if=/dev/hda of=/media/floppy/boot.mbr bs=512 count=1  

To restore it, you would just reverse the parameters of the dd command:

 dd if=/media/floppy/boot.mbr of=/dev/hda bs=512 count=1 

Boot a floppy image without a floppy drive. Some computers don't have a floppy drive and can't boot from a CD-ROM. One way of getting the CD to boot is from a bootloader floppy image. You'll need the memdisk file from the syslinux package. To get it run

 sudo apt-get install syslinux 

Copy the memdisk file to the grub folder

 sudo cp /usr/lib/syslinux/memdisk /boot/grub/ 

There is a floppy image on the *ubuntu CD that can be used if you don't feel like making one. Mount the CD and copy it to the grub folder as well.

 sudo cp /<cd_mountpoint>/install/sbm.bin /boot/grub/ 

Next you have to make some changes to /boot/grub/menu.lst. Open it as root and add

 title       Floppy Image
 kernel      /boot/grub/memdisk
 initrd      /boot/grub/sbm.bin 

above "title Ubuntu x.xx, memtest86+". Save the changes. Now you should be able to boot the floppy image without a floppy drive and boot from the CD.