热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

自翻译Debian4.0i386稳定版安装向导中关于USB启动盘制作方法

自翻译Debian4.0i386稳定版安装向导中关于USB启动盘制作方法--Linux发行版技术-Debian信息,下面是详情阅读。
4.4.准备文件制作USB 启动盘
制作USB 启动盘, 您首先要具备GNU/Linux 已经运行的系统并且有USB 支持。您应该保证, usb 内核模块被引导(modprobe usb-storage) 并且SCSI 设备USB 盘被映射(在这个例子中即 /dev/sda 被使用) 。为使文件能够正确写入您的盘, 您可以而且必须关闭它的写保护开关。
注意USB 盘至少应该256 MB 大小(更小的设定是可能的,详细见下述4.4.2部分 "复制文件- 灵活的方式") 。

4.4.1. 复制文件- 容易的方式
这里有包含所有 hd-media/boot.img.gz 安装文件(包括内核文件)、SLINUX系统文件和它的配置文件。您只须提取直接对应您的USB 盘即可:
# zcat boot.img.gz > /dev/sda

警告
运用这个方法可能毁坏已经安装的设备。保证您使用的正确设备名称为您的USB 盘。
挂载USB 启动盘(mount /dev/sda /mnt)以后, 将会有一完善的文件系统记录在上, 开始对它复制Debian netinst 或businesscard ISO 图象(参见4.4.3部分, "增加ISO 图象") 。完毕解除挂载盘(umount /mnt)。

4.4.2. 复制文件- 灵活的方式
如果您喜欢更多的灵活性或想要知道怎么回事, 您应该使用以下方法把文件安装在您的盘上。
4.4.2.1.在英特尔x86下的 USB 盘分区
我们将显示怎么在第一分区设定启动盘, 来代替整个设备。

说明
因为多数USB 盘本来预先就设置成唯一的FAT16 分区, 您大概不会重新分区或重新格式化该盘。如果您认为必须这样做, 那么就用命令 cfdisk 或其他分区工具来设置FAT16分区, 然后用下述命令设置文件系统:
# mkdosfs /dev/sda1

小心,您使用正确的设备名称为您的USB 盘。 mkdosfs 命令包含在 Debian 的dosfstools 软件包里。
从USB 盘启动以后为了能正确引导内核, 我们就把起动装载程序也放在了该盘上。虽然所有起动装载程序(即 LILO)都能引导, 它能方便地使用LINUX系统, 因为它使用了FAT16 分区, 能够根据编辑的文本文件重新设置。支持FAT文件系统的任何操作系统都可以使用并对对起动装载程序的配置作变动。
将SYSLINUX 设置在您的USB 盘FAT16 分区, 在您的系统安装 syslinux 和 mtools 软件包,命令:
# syslinux /dev/sda1

又, 必须小心, 您要使用正确的设备名称。当开始SYSLINUX时,分区不能挂载。这样做可以给分区写入一个引导扇区使之包含 ldlinux.sys 起动装载程序代码的文件。
挂载分区(mount /dev/sda1 /mnt) 并且从Debian 档案复制以下文件:
vmlinuz (内核binary)
initrd.gz (启动ramdisk 图象)
syslinux.cfg (SYSLINUX 配置文件)
内核模块选项
如果您想要给文件改名, 请注意 SYSLINUX 可能只处理DOS (8.3) 的文件名。
syslinux.cfg 配置文件应该包含以下二类:
缺省vmlinuz
添附initrd=initrd.gz

4.4.3.增加ISO 图象
安装者往往想在盘上寻找一个Debian ISO 图象来作为安装时数据的补充。如此您的下一步将复制一个Debian ISO 图象(businesscard 、netinst 甚至一个充分的光盘图象)到您的盘(肯定选择一适合的)上 。图象的文件名末尾必须带有 .iso。
如果您想要通过网络安装, 不想使用ISO 图象, 您当然可以跳过这一步。更多的可能是您必须使用从 netboot 启动的最初的ramdisk,来代替那个 hd-media, 因为 hd-media/initrd.gz是没有网络支持的。
接着, 解除挂载USB 启动盘(umount /mnt)并且激活它的写保护开关。

4.4.4 启动USB 盘

警告

如果您的系统拒绝从启动盘启动, 该盘也许包含一个无效主要引导记录(MBR) 。解决这个问题, 需要安装mbr软件包,命令:
# install-mbr /dev/sda

以下是原文:

4.4. Preparing Files for USB Memory Stick Booting
To prepare the USB stick, you will need a system where GNU/Linux is already running and where USB is supported. You should ensure that the usb-storage kernel module is loaded (modprobe usb-storage) and try to find out which SCSI device the USB stick has been mapped to (in this example /dev/sda is used). To write to your stick, you may have to turn off its write protection switch.
Note that the USB stick should be at least 256 MB in size (smaller setups are possible if you follow Section 4.4.2, “Copying the files — the flexible way”).
4.4.1. Copying the files — the easy way
There is an all-in-one file hd-media/boot.img.gz which contains all the installer files (including the kernel) as well as SYSLINUX and its configuration file. You only have to extract it directly to your USB stick:
# zcat boot.img.gz > /dev/sda

Warning
Using this method will destroy anything already on the device. Make sure that you use the correct device name for your USB stick.
After that, mount the USB memory stick (mount /dev/sda /mnt), which will now have a FAT filesystem on it, and copy a Debian netinst or businesscard ISO image to it (see Section 4.4.3, “Adding an ISO image”). Unmount the stick (umount /mnt) and you are done.
4.4.2. Copying the files — the flexible way
If you like more flexibility or just want to know what's going on, you should use the following method to put the files on your stick.
4.4.2.1. USB stick partitioning on Intel x86
We will show how to setup the memory stick to use the first partition, instead of the entire device.
Note
Since most USB sticks come pre-configured with a single FAT16 partition, you probably won't have to repartition or reformat the stick. If you have to do that anyway, use cfdisk or any other partitioning tool to create a FAT16 partition, and then create the filesystem using:
# mkdosfs /dev/sda1

Take care that you use the correct device name for your USB stick. The mkdosfs command is contained in the dosfstools Debian package.
In order to start the kernel after booting from the USB stick, we will put a boot loader on the stick. Although any boot loader (e.g. LILO) should work, it's convenient to use SYSLINUX, since it uses a FAT16 partition and can be reconfigured by just editing a text file. Any operating system which supports the FAT file system can be used to make changes to the configuration of the boot loader.
To put SYSLINUX on the FAT16 partition on your USB stick, install the syslinux and mtools packages on your system, and do:
# syslinux /dev/sda1

Again, take care that you use the correct device name. The partition must not be mounted when starting SYSLINUX. This procedure writes a boot sector to the partition and creates the file ldlinux.sys which contains the boot loader code.
Mount the partition (mount /dev/sda1 /mnt) and copy the following files from the Debian archives to the stick:
vmlinuz (kernel binary)
initrd.gz (initial ramdisk image)
syslinux.cfg (SYSLINUX configuration file)
Optional kernel modules
If you want to rename the files, please note that SYSLINUX can only process DOS (8.3) file names.
The syslinux.cfg configuration file should contain the following two lines:
default vmlinuz
append initrd=initrd.gz

4.4.3. Adding an ISO image
The installer will look for a Debian ISO image on the stick as its source for additional data needed for the installation. So your next step is to copy a Debian ISO image (businesscard, netinst or even a full CD image) onto your stick (be sure to select one that fits). The file name of the image must end in .iso.
If you want to install over the network, without using an ISO image, you will of course skip the previous step. Moreover you will have to use the initial ramdisk from the netboot directory instead of the one from hd-media, because hd-media/initrd.gz does not have network support.
When you are done, unmount the USB memory stick (umount /mnt) and activate its write protection switch.
4.4.4. Booting the USB stick
Warning
If your system refuses to boot from the memory stick, the stick may contain an invalid master boot record (MBR). To fix this, use the install-mbr command from the package mbr:
# install-mbr /dev/sda
推荐阅读
author-avatar
童画小欧_904
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有