[ipxe-devel] Fwd: ipxe image for hard drive booting - ipxe.hd ?

Thomas Miletich thomas.miletich at gmail.com
Tue Feb 18 13:20:15 UTC 2014


---------- Forwarded message ----------
From: Thomas Miletich <thomas.miletich at gmail.com>
Date: Tue, Feb 18, 2014 at 2:16 PM
Subject: Re: [ipxe-devel] ipxe image for hard drive booting - ipxe.hd ?
To: Håkan Johansson <f96hajo at chalmers.se>


If I'm not mistaken ipxe.hd is for hard disk partitions. ipxe.usb contains
a partition table and a partition containing ipxe.hd. ipxe.usb is the image
file you'll want to use for a whole hard disk(or usb drive).

Thomas

On Feb 17, 2014 7:21 PM, "Håkan Johansson" <f96hajo at chalmers.se> wrote:
>
>
> Hi,
>
> I want to be able to put a small ipxe image on a hard drive in a machine
to load ipxe, without having to install a bootloader.  (Or using a USB
stick, as many bioses delete such boot entries if the machine by accident
is booted without the stick inserted.)  (Basically just 'dd if=ipxe.hd
of=/dev/sdX'.)  Is ipxe.hd intended for that?  Or some other suggested way?
 Searching the documentation did not come up with a solution.
>
> However, ipxe.hd does not work as is, as there is no active partition
(marked 0x80).  Perhaps this is why it is not built as default?
> ('make bin/ipxe.hd' fixed that.)
>
> Below are two ways that made it work for me (on a Dell Optiplex 620 and
Dell Dimension 9150 (the first method only tested on the optiplex)).
>
> 1)
>
> dd if=ipxe.hd of=/dev/sdX
> fdisk /dev/sdX              # create a normal partition, starting at
>                             # sector 2048 and mark it active
> dd if=ipxe.hd of=/dev/sdX1
>
> Machine boots and loads IPXE.
>
> Here, ipxe.hd is actually placed twice on the harddrive.
>
> 2)
>
> In the second solution, the MBR (src/arch/i386/prefix/hdprefix.S)
partition table is changed so that the first 'partition' includes the
ipxe.hd (the MBR itself).  The ipxe.hd boot-loader code then sort of finds
itself and loads.
>
> As far as I understood the loader code, the partition size (end) is not
used, so can be some arbitrary dummy value.  I guess also zeros, but not
tested.  Probably makes sense to have some non-zero value to help avoid
partitioning tools from using the first part of the disk (ipxe.hd), if one
wants to use the hard-drive for other partitions too.
>
> Something to include into ipxe?
>
> diff --git a/src/arch/i386/prefix/hdprefix.S
b/src/arch/i386/prefix/hdprefix.S
> index 876bfe1..5a5a6f1 100644
> --- a/src/arch/i386/prefix/hdprefix.S
> +++ b/src/arch/i386/prefix/hdprefix.S
> @@ -82,6 +82,14 @@ load_failed:
>         jmp     boot_error
>  10:    .asciz  "Could not load iPXE\r\n"
>
> +       .org 446
> +       .byte 0x80 /* Active */
> +       .byte 0x00, 0x01, 0x00 /* head, sector, cylinder */
> +       .byte 0x83 /* Linux :-) */
> +       .byte 0x10, 0x10, 0x00 /* dummy end: head, sector, cylinder */
> +       .byte 0x00, 0x00, 0x00, 0x00 /* first sector */
> +       .byte 0x00, 0x04, 0x00, 0x00 /* number of sectors: 1024 */
> +
>         .org 510
>         .byte 0x55, 0xaa
>
> Best regards,
> Håkan
> _______________________________________________
> ipxe-devel mailing list
> ipxe-devel at lists.ipxe.org
> https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ipxe.org/pipermail/ipxe-devel/attachments/20140218/28f160dd/attachment.htm>


More information about the ipxe-devel mailing list