pxe网络启动引导程序_如何使用PXE设置网络可引导实用程序光盘

pxe网络启动引导程序

pxe网络启动引导程序

We’ve shown you how to  network boot the Ubuntu LiveCD. In this article we’ll show how to make some other utilities network bootable, which will give you the knowledge to replicate the procedure for other utilities you may be using.

我们已经向您展示了如何通过网络引导Ubuntu LiveCD 。 在本文中,我们将展示如何使某些其他实用程序可网络启动,这将使您掌握复制其他可能使用的实用程序的过程的知识。

Note: this article is not geared at beginners, though you’re welcome to keep reading!

注意:本文不适合初学者,但也欢迎您继续阅读!

Image by Steve Jurvetson

图片来自Steve Jurvetson

总览 (Overview)

This guide aims to give you the tools with which, you will be able to convert utilities, to be PXEable. While unfortunately, it will not be possible to convert any tool under the sun, we wouldn’t be geeks if we didn’t at least try.

本指南旨在为您提供可以转换实用程序为PXEable的工具。 不幸的是,不可能在阳光下转换任何工具,如果我们至少不尝试的话,我们就不会是极客。

As mentioned on the “How To Network Boot (PXE) The Ubuntu LiveCD” guide, If you are not already using Ubuntu as your number one “go to” for troubleshooting, diagnostics and rescue procedures tool, what are you waiting for?

如“ 如何进行网络引导(PXE)Ubuntu LiveCD ”指南中所述,如果您尚未将Ubuntu用作故障排除,诊断和救援程序工具的“ 首选 ”,那么您还在等什么?

With that said, one has to acknowledge that there are things that simply cannot be done within the Ubuntu LiveCD (like BIOS upgrades), or that you are already using a different tool that you like and would rather keep on using for whatever reason.

话虽如此,您必须承认有些事情根本无法在Ubuntu LiveCD中完成(例如BIOS升级),或者您已经在使用自己喜欢的其他工具,并且无论出于何种原因都愿意继续使用。

建议,假设和前提条件 (Recommendations, Assumptions and Prerequisites)

  • It is assumed that you have already setup the FOG server as explained in our “What Is Network Booting (PXE) and How Can You Use It?” guide.

    假定您已经按照我们的“ 什么是网络引导(PXE)和如何使用它 ”中的说明安装了FOG服务器 指南。

  • You will see the “VIM” program used as the editor, this is mainly because it is widely available on Linux platforms. You may use any other editor that you’d like.

    您将看到“ VIM ”程序用作编辑​​器,这主要是因为它在Linux平台上广泛可用。 您可以使用任何其他想要的编辑器。

  • The Ultimate Boot CD (UBCD) is used as an example, as unlike some other utility collections, it is free to download and the programs it bundles are free to use.

    Ultimate Boot CD(UBCD)为例,它不同于其他一些实用程序集合,它可以免费下载,并且捆绑的程序可以免费使用。

Why not just use ISO over PXE?

为什么不仅仅在PXE上使用ISO?

This is often the first question asked when talking about PXEing. The short answer is that while technically it is possible to take an ISO image and PXE it to the client machines, almost always the content of said ISO, will be expecting to have the physical manifestation of itself accessible in the physical CDROM drive. Therefore, what ever the content of said ISO may be, it will try to look for the “post boot-sector” files in the physical CDROM drive of the client machine, will not find them and fail to boot.

这通常是谈论PXEing时要问的第一个问题。 简短的答案是,尽管从技术上讲可以将ISO映像并将其PXE传输到客户端计算机,但几乎总是希望所说ISO的内容在物理CDROM驱动器中具有其自身的物理表现形式。 因此,无论上述ISO的内容是什么,它都将尝试在客户端计算机的物理CDROM驱动器中查找“后启动扇区”文件,找不到它们并无法启动。

The two ways to overcome this problem are:

解决此问题的两种方法是:

  • Burn the ISO and put it in the CDROM drive of the client machine – While simple, Not using CDs, is exactly what we are trying to avoid…

    刻录ISO并将其放入客户端计算机的CDROM驱动器中-尽管很简单( 使用CD),但这正是我们想要避免的事情……

  • Open the ISO and change the way the program works within it, so that it uses a CDROM driver that knows how to look for the ISO in RAM – Fairly complex, and different for every type of bootable program. I.E. not the same procedure for Linux, WinPE or UBCD to mention a few.

    打开ISO并更改程序在其中的工作方式,以便它使用CDROM 驱动程序 ,该驱动程序知道如何在RAM中查找ISO –相当复杂,并且对于每种类型的可启动程序都不同。 IE对于Linux,WinPE或UBCD的程序不一样,仅举几例。

As both of the above defeat the goal of “just using an ISO”,  this is why we do not recommend pursuing this endeavor.

由于上述两种方法都无法实现“仅使用ISO”的目标,因此我们不建议您继续进行此操作。

The Kernel method

内核方法

While very rare, sometimes the program your trying to boot may only need a Kernel to function. One typical example of this is “memtest86+”. Memtest comes bundled with most Linux distributions installation CDs and with FOG. As Memtest only needs to be able to communicate with the most basic capabilities of the hardware tested, I.E. the memory (RAM), and can work just fine without even fully supporting the hardware it is running on (I.E. it will test the memory, even if it doesn’t know it’s type, speed & etc’) it has no need for anything else and can work completely autonomously.

虽然非常罕见,但有时您尝试引导的程序可能只需要一个内核即可运行。 一个典型的例子是“ memtest86 + ”。 Memtest与大多数Linux发行版安装CD和FOG捆绑在一起。 由于Memtest只需要能够与测试的硬件的最基本功能进行通信,即IE内存(RAM),并且即使在不完全支持其运行的硬件的情况下也可以正常工作(即IE可以测试内存,甚至如果不知道它的类型,速度等),则不需要任何其他操作,并且可以完全自主地工作。

The PXE menu entry for memtest may look as simple as:

memtest的PXE菜单项可能看起来很简单:

LABEL Run Memtest86+
kernel fog/memtest/memtest
append -

LABEL Run Memtest86+
kernel fog/memtest/memtest
append -

In this example, the “LABEL Run Memtest86+“ sets the name of the entry, the “kernel fog/memtest/memtest” tells PXElinux where to take the kernel that will be sent to the client from and “append –“ tells PXElinux to ignore additional boot options from *inheritance.

在此示例中,“ LABEL Run Memtest86 +”设置条目的名称,“ kernel fog / memtest / memtest”告诉PXElinux从何处将要发送到客户端的内核,“ append –”告诉PXElinux忽略*继承中的其他引导选项。

*Note: depending on your setup, this may not even be required and actually in FOG it is not used.

*注意:根据您的设置,甚至可能不需要这样做,并且在FOG中实际上不使用它。

The Kernel + Initrd method

内核+ Initrd方法

This method is by far the most commonly used and widely spread for a couple of reasons:

由于以下两个原因,该方法是迄今为止最常用和广泛使用的方法:

  • A lot of utilities nowadays come from the Linux world.

    如今,许多实用程序都来自Linux世界。
  • Because Linux has great hardware support and is free to use, more and more companies realize that Linux is an excellent base to build their proprietary programs on.

    由于Linux具有强大的硬件支持并且可以免费使用,因此越来越多的公司意识到Linux是构建专有程序的理想基础。

Lets use UBCD’s CPUstress utility as an example.

让我们以UBCD的CPUstress实用程序为例。

On the UBCD file structure, this utility is located in the directory “ubcd/boot/cpustress”. The files we are looking for, are called “bzImage” which is the “kernel”, and “initrd.gz” which is the “initial ram disk”. If you’re using the FOG setup we created, we recommend that you copy the directory under “/tftpboot/howtogeek/utils”. Once that’s done, edit the “/tftpboot/howtogeek/menus/utils.cfg” file and add to it the boot entry found on the UBCD’s menu entries. this can be found in “ubcd/menus/syslinux/cpu.cfg”. With the adjustments for the FOG setup, the menu entry should look like:

在UBCD文件结构上,此实用程序位于目录“ ubcd / boot / cpustress”中。 我们要查找的文件称为“ bzImage ”(即“内核”)和“ initrd.gz”(即“ ram初始磁盘”)。 如果使用的是我们创建的FOG设置,建议您将目录复制到“ / tftpboot / howtogeek / utils”下。 完成后,编辑“ /tftpboot/howtogeek/menus/utils.cfg”文件,并将在UBCD菜单项上找到的引导项添加到该文件。 可以在“ ubcd / menus / syslinux / cpu.cfg”中找到。 通过调整FOG设置,菜单项应如下所示:

MENU LABEL StressCPU V2.0 (requires CPU with SSE)
TEXT HELP
Torture-test your CPU in order to make sure that you don't have overheating
problems. Requires SSE-equipped x86 CPUs. Executes a special version of the
Gromacs innerloops that mixes SSE and normal assembly instructions to heat
your CPU as much as possible.
ENDTEXT
KERNEL howtogeek/utils/cpustress/bzImage
INITRD howtogeek/utils/cpustress/initrd.gz
APPEND root=/dev/ram0 ramdisk_size=12000 noapic ubcdcmd=stresscpu2

MENU LABEL StressCPU V2.0 (requires CPU with SSE)
TEXT HELP
Torture-test your CPU in order to make sure that you don't have overheating
problems. Requires SSE-equipped x86 CPUs. Executes a special version of the
Gromacs innerloops that mixes SSE and normal assembly instructions to heat
your CPU as much as possible.
ENDTEXT
KERNEL howtogeek/utils/cpustress/bzImage
INITRD howtogeek/utils/cpustress/initrd.gz
APPEND root=/dev/ram0 ramdisk_size=12000 noapic ubcdcmd=stresscpu2

Where :

哪里:

  • MENU LABEL – sets the name of the entry

    MENU LABEL –设置条目的名称
  • TEXT HELP – This optional directive, gives help text that will be shown in the menu to provide information on the entry selected.

    TEXT HELP(文本帮助)–此可选指令提供帮助文本,该文本将显示在菜单中,以提供有关所选条目的信息。
  • KERNEL – Specifies the location of the “kernel” file in the TFTPD directory.

    KERNEL –指定TFTPD目录中“内核”文件的位置。
  • INITRD – the same as above only for the “initrd” file.

    INITRD –仅与“ initrd”文件相同。
  • APPEND – Specifies additional parameters that should be passed to the booted program.

    APPEND –指定应传递给启动程序的其他参数。

A couple of things to note are:

需要注意的几件事是:

  • Hardcore geeks would notice that we replaced the original directive of “LINUX” with “KERNEL”. This is because: A. this makes the example easier to read. B. In this example it doesn’t really matter.

    顽固的极客会注意到我们用“ KERNEL”代替了原来的“ LINUX”指令。 这是因为:A.这使示例更易于阅读。 B.在这个例子中,这并不重要。

    With that said, usually when the directive “LINUX” is used, it is better to leave it that way because it tells pxelinux/syslinux that we are not using just any kernel but a Linux one.

    话虽如此,通常在使用“ LINUX”指令时,最好还是保留这种方式,因为它告诉pxelinux / syslinux我们使用的不是内核,而不仅仅是Linux。

  • We have deliberately taken the “quiet” directive out of the appended parameters. This is due to a change in how Syslinux handles the “quiet” parameter in recent versions.

    我们故意从附加参数中删除了“ quiet”指令。 这是由于Syslinux在最新版本中处理“ quiet”参数的方式发生了变化。
  • It is possible to change the operation of the “StressCPU” program, by simply changing the appended parameter “ubcdcmd”. So in order to use the other functions, one needs only to copy the entry and replace “stresscpu2” to be: cpuinfo, cpuburn or mprime24.

    只需更改附加参数“ ubcdcmd”,就可以更改“ StressCPU”程序的操作。 因此,为了使用其他功能,只需复制条目并将“ stresscpu2”替换为:cpuinfo,cpuburn或mprime24。

While this is a very simple example, it should be enough to get you going.

尽管这是一个非常简单的示例,但足以让您继续前进。

The Kernel + Initrd + NFS method

内核+ Initrd + NFS方法

This method, is the one we used on the “How To Network Boot (PXE) The Ubuntu LiveCD” guide. This method builds on the previous one and utilizes the fact that some Linux distributions support having their “root filesystem” mounted from NFS. The Ubuntu guide is an excellent example, but rest assured that we already have another one planned for the near future. “Keep your eyes open for a Black Mushroom”.

此方法是我们在“ 如何网络引导(PXE)Ubuntu LiveCD ”指南中使用的方法。 此方法建立在前一个方法的基础上,并利用了以下事实:某些Linux发行版支持从NFS​​挂载其“根文件系统”。 Ubuntu指南是一个很好的例子,但是请放心,我们已经为不久的将来制定了另一个指南。 “ 睁大眼睛寻找黑蘑菇 ”。

The MEMDISK method

MEMDISK方法

MEMDISK is a utility that is distributed with the Syslinux package. The purpose of this utility is to enable you to emulate a “disk” (mainly referring to floppies) using it’s image. The way this utility works, is to hook into the location in RAM that specifies how to  communicate with the floppy drive (A.K.A. Interrupt handler) and points it to a new location that is handled by the MEMDISK program.  With this method, the “kernel” is the MEMDISK utility and the “initrd” is the floppy image (.img) file.

MEMDISK是随Syslinux软件包一起分发的实用程序。 此实用程序的目的是使您能够使用其映像来模拟“磁盘”(主要指软盘)。 该实用程序的工作方式是挂接到RAM中的位置,该位置指定如何与软盘驱动器(AKA中断处理程序)通信,并将其指向由MEMDISK程序处理的新位置。 使用此方法,“内核”是MEMDISK实用程序,“ initrd”是软盘映像(.img)文件。

The one thing to note is, that FOG comes with a “memdisk” version that is compatible to the pxelinux.0 version it uses. Therefore, it is recommended to not copy the “memdisk” file accompanying the “img” file from their source.

需要注意的一件事是,FOG附带了一个“内存磁盘”版本,该版本与其使用的pxelinux.0版本兼容。 因此,建议不要从其源中复制“ img”文件随附的“ memdisk”文件。

As this method is already wildly used, even for regular utilities and BootCDs, most of the time it is a simple matter of finding the “IMG” file on the BootCD, copying it to the PXE’s server TFTPD directory and copying the ISOlinux menu entry to the PXElinux menu. They say “talk is cheap” so lets have a look at how can we adapt one of the utilities that use the MEMDISK method  from UBCD, to work from PXE.

由于这种方法已经被广泛使用,即使对于常规实用程序和BootCD,大多数情况下,在BootCD上查找“ IMG”文件,将其复制到PXE的服务器TFTPD目录并将ISOlinux菜单项复制到PXElinux菜单。 他们说“谈价便宜”,所以让我们看一下如何使UBCD中使用MEMDISK方法的一种实用程序适应PXE。

The TestMemIV utility, can be found on the UBCD file structure at “ubcd/images/testmem4.img.gz”. As we already have the memdisk disk utility, one only needs to copy the “img” file to the “howtogeek/utils/” directory. With the adjustments for the FOG setup, the menu entry should look like:

可以在UBCD文件结构的“ ubcd / images / testmem4.img.gz”上找到TestMemIV实用程序。 由于我们已经有了内存磁盘实用程序,因此只需要将“ img”文件复制到“ howtogeek / utils /”目录中。 通过调整FOG设置,菜单项应如下所示:

MENU LABEL TestMemIV
TEXT HELP
Tests system memory and memory on Nvidia video cards.
ENDTEXT
LINUX memdisk
INITRD howtogeek/utils/testmem4.img.gz

MENU LABEL TestMemIV
TEXT HELP
Tests system memory and memory on Nvidia video cards.
ENDTEXT
LINUX memdisk
INITRD howtogeek/utils/testmem4.img.gz

While this is an example of a self contained floppy image file from UBCD, most of the other UBCD programs, use the same base image to start working (fdubcd.img.gz) and use the “ubcdcmd” appended parameter to autostart a program from the CDROM post boot. This means you will not be able to convert most of their utilities to be network bootable without some major reverse engineering. While such a reverse engineering is possible (as can be seen here) and is an excellent geek exercise, it is beyond the scope of this guide.

尽管这是UBCD中自包含的软盘映像文件的示例,但其他大多数UBCD程序都使用相同的基本映像开始工作(fdubcd.img.gz),并使用附加的“ ubcdcmd”参数从以下位置自动启动程序: CDROM启动后。 这意味着,如果不进行一些重大的逆向工程,您将无法将它们的大多数实用程序转换为可网络启动。 虽然这样的逆向工程是可能的(如可看到这里 ),并且是优异的极客运动,它超出了本指南的范围。

With the above said, you now have the tools to perform this procedure for that esoteric OEM diagnostic or BIOS upgrade utility.

有了以上所述,您现在已经拥有用于执行该神秘的OEM诊断或BIOS升级实用程序的工具。



And so, locked beyond the Gateway of Blood and past the Hall of Fire, Valor awaits for the Hero of Light to awaken…

因此,Valor被锁在血之门之外,经过火厅,等待着光之英雄醒来……

翻译自: https://www.howtogeek.com/63226/how-to-setup-network-bootable-utility-discs-using-pxe/

pxe网络启动引导程序

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值