Coe, Colin C. (Unix Engineer)
2006-Oct-13 00:16 UTC
[syslinux] PXELINUX based kickstart query (probably OT)
Hi all I'm guessing this is a little off topic but here goes... We use PXELINUX and kickstart to automate our RHEL deployments and updates. Recently we started using PXELINUX/memdisk and an MS-DOS image to update the workstation BIOS'es. After selecting <F12> (network boot) and picking the update BIOS option, the BIOS is flashed, BIOS configuration made standard and then the workstation reboots needing a second <F12> to kick off the kickstart. I'd like to do this in a single step so the result would be: - Select <F12> during boot - Choose PXELINUX BIOS update option - BIOS gets flashed - BIOS gets configured - Boot info is wiped from /dev/sda (leaving partitions intact) - automatic reboot - PXELINUX is automatically selected as no bootable media - Kickstart commenses What I'd like to know is how do I wipe the boot info from /dev/sda to force a network boot? I tried: - wiping the MBR which works but also wipes the partition tables which we don't want. - removing the boot flag from the first partition (not the MBR I know but I thought I'd try it anyway). - based on the info in http://www.ata-atapi.com/hiwmbr.htm I tried wiping the first 138 bytes of /dev/sda Any pointers on where to try next? Thanks CC
On Fri, 13 Oct 2006, Coe, Colin C. (Unix Engineer) wrote:> - based on the info in http://www.ata-atapi.com/hiwmbr.htm I tried > wiping the first 138 bytes of /dev/sdaIIRC, you need to whack the first 446 bytes. dd if=/dev/zero of=/dev/sda bs=446 count=1 Steve Brown sbrown7 at umbc.edu
H. Peter Anvin
2006-Oct-13 21:23 UTC
[syslinux] PXELINUX based kickstart query (probably OT)
Steve Brown wrote:> On Fri, 13 Oct 2006, Coe, Colin C. (Unix Engineer) wrote: > >> - based on the info in http://www.ata-atapi.com/hiwmbr.htm I tried >> wiping the first 138 bytes of /dev/sda > > IIRC, you need to whack the first 446 bytes. dd if=/dev/zero of=/dev/sda > bs=446 count=1 >No, what you probably need to do is to remove the signature, that is the last two bytes in the first 512-byte sector. -hpa
Coe, Colin C. (Unix Engineer)
2006-Oct-16 00:47 UTC
[syslinux] PXELINUX based kickstart query (probably OT)
Hey all I tried 'dd if=/dev/zero of=/dev/sda bs=2 seek=255 count=1' and while a network boot was forced, all the partition info on /dev/sda was lost. I tried 'dd if=/dev/zero of=/dev/sda bs=446 count=1' and after POST the workstation just sits a blank screen when it should have either gone to a PXE screen or GRUB. On the bright side, the partition ifo was intact so fixing it was easy. So I just need a combination of these to outcomes :) Any ideas? CC -----Original Message----- From: H. Peter Anvin [mailto:hpa at zytor.com] Sent: Saturday, 14 October 2006 5:24 AM To: Steve Brown Cc: Coe, Colin C. (Unix Engineer); SYSLINUX at zytor.com Subject: Re: [syslinux] PXELINUX based kickstart query (probably OT) Steve Brown wrote:> On Fri, 13 Oct 2006, Coe, Colin C. (Unix Engineer) wrote: > >> - based on the info in http://www.ata-atapi.com/hiwmbr.htm I tried >> wiping the first 138 bytes of /dev/sda > > IIRC, you need to whack the first 446 bytes. dd if=/dev/zeroof=/dev/sda> bs=446 count=1 >No, what you probably need to do is to remove the signature, that is the last two bytes in the first 512-byte sector. -hpa
Coe, Colin C. (Unix Engineer)
2006-Oct-17 23:35 UTC
[syslinux] PXELINUX based kickstart query (probably OT)
Wow! You guys are the greatest! I used a hex editor and changed the first two bytes and a network boot was forced *and* the partition info was still there. Many thanks CC -----Original Message----- From: syslinux-bounces at zytor.com [mailto:syslinux-bounces at zytor.com] On Behalf Of H. Peter Anvin Sent: Wednesday, 18 October 2006 5:03 AM To: Josh Lehan Cc: Geert Stappers; syslinux at zytor.com Subject: Re: [syslinux] PXELINUX based kickstart query (probably OT) Josh Lehan wrote:> H. Peter Anvin wrote: >> Can't be done. Unfortunately the BIOS considers loading a bootsector>> (from floppy or from hard disk) to be "terminal" in the sense that it>> has now booted, and there is no going back. >> >> This is one of the most unfortunate aspects of the BIOS. > > Hmm, would calling INT 18 work? > > INT 18 seems to have the meaning of "there's nothing to boot here,move> along". > > In the MBR, an INT 18 will return control to the BIOS. > > A good BIOS hopefully will advance to the next device in the boot > sequence. A bad BIOS will probably just hang then, with theunfortunate> "Missing operating system" error message. > > It might be worth a try to overwrite some of the code in the MBR ofyour> hard drive, to force a call to INT 18, if you don't want to boot from > that drive. > > This differs from INT 19, which should do a full reset of thecomputer,> entirely starting the boot sequence over from the beginning. If INT18> doesn't work, to advance to the next boot device, then maybe INT 19,to> go back to the beginning, might be another way to solve the problem.When I've tried it, INT 18h generally results in printing a message and stopping. The Compaq-Phoenix-Intel BIOS Boot Specification http://www.phoenix.com/NR/rdonlyres/56E38DE2-3E6F-4743-835F-B4A53726ABED /0/specsbbs101.pdf does that that INT 18h is supposed to invoke the next boot device, and it might be worth trying (it might help the OPs problem.) That is, replace the first two bytes in the MBR with CD 18 hex. It will either work, or it won't. I hadn't looked at the BBS for a while, and I clearly should have, because it actually provides a much richer API than I remember. In particular, if the functions in Appendix B are widely implemented, then there might be a lot of things that are possible that I didn't quite realize. Silly me, but this is paydirt! -hpa _______________________________________________ SYSLINUX mailing list Submissions to SYSLINUX at zytor.com Unsubscribe or set options at: http://www.zytor.com/mailman/listinfo/syslinux Please do not send private replies to mailing list traffic.
Coe, Colin C. (Unix Engineer)
2006-Oct-17 23:59 UTC
[syslinux] PXELINUX based kickstart query (probably OT)
One last question, in this thread anyway :) To fully automate this I need a DOS hex editor that can be driven from the command line. It only needs to replace the first two bytes of the MBR. Do you know of such a beast? CC -----Original Message----- From: H. Peter Anvin [mailto:hpa at zytor.com] Sent: Wednesday, 18 October 2006 7:51 AM To: Coe, Colin C. (Unix Engineer) Cc: Josh Lehan; Geert Stappers; syslinux at zytor.com Subject: Re: [syslinux] PXELINUX based kickstart query (probably OT) Coe, Colin C. (Unix Engineer) wrote:> Wow! You guys are the greatest! > > I used a hex editor and changed the first two bytes and a network boot > was forced *and* the partition info was still there. >Excellent! It's entirely possible BBS is much better supported in 2006 than last time I looked at this stuff, which was probably in 1999. I think I have to throw myself an ESTALE and sit in the corner. -hpa
Coe, Colin C. (Unix Engineer)
2006-Oct-18 03:49 UTC
[syslinux] PXELINUX based kickstart query (probably OT)
HPA, you are a legend. Works perfectly! Many thanks CC -----Original Message----- From: H. Peter Anvin [mailto:hpa at zytor.com] Sent: Wednesday, 18 October 2006 8:13 AM To: Coe, Colin C. (Unix Engineer) Cc: syslinux at zytor.com Subject: Re: [syslinux] PXELINUX based kickstart query (probably OT) Coe, Colin C. (Unix Engineer) wrote:> One last question, in this thread anyway :) > > To fully automate this I need a DOS hex editor that can be driven from > the command line. It only needs to replace the first two bytes of the > MBR. Do you know of such a beast? >The following assembly program should do it for you (it might have to be modified if you're using DOS from Win9x as opposed to "real" DOS or FreeDOS). Warning - this is totally untested. Try it on a safe system first! -hpa
Richard L. James
2006-Oct-18 09:34 UTC
[syslinux] PXELINUX based kickstart query (probably OT)
Hi all,
Sorry to clarify the following sentance was referring to my utility rather
than what I was suggesting to do in this particular instance:
"In effect you let the PC boot from a boot sector, copy the interrupt
vector table elsewhere to memory with a CRC and then calling interrupt 19h to
boot again to DOS allowing the initial stored interrupt vector table to be
retrieved without much hassle in a safe and clean way."
Regards Richard
http://www.wimborne.org/richard/
"Richard L. James" wrote:
Hi all,
> This differs from INT 19, which should do a full reset of the computer,
Sorry but this is wrong - Interrupt 19h doesn't do a full reset of the
computer. Interrupt 19h preserves the contents of memory + Interrupt vector
table and simply calls the boot strap loader. Indeed to demo this simply create
a 2 byte com program and run it from native DOS as follows (note this isn't
a debug script I writing this from memory):
debug
n lmrbt.com
a
int 19
rcx
2
w
q
http://www.delorie.com/djgpp/doc/rbinter/ix/19.html
As for the the reliability of calling interrupt 18h (originally the call for
loading built in IBM ROM BASIC) well it depends on the model of the machine on
which it has been executed. Note comments:
http://www.delorie.com/djgpp/doc/rbinter/id/50/22.html
I personally lack usage experience of syslinux/etherboot at the moment.
However I would have thought that it may be possible to do a double boot
(something I was working on for a utility to aid projects like the flopper
project). In effect you let the PC boot from a boot sector, copy the interrupt
vector table elsewhere to memory with a CRC and then calling interrupt 19h to
boot again to DOS allowing the initial stored interrupt vector table to be
retrieved without much hassle in a safe and clean way.
There is also a DOS utility around called NOBOOT (the US "PC
magazine" util by this name appears to do something else) that modified
floppy disk images so that if a disk was left in the drive the disks bootsector
would be executed and then it would simply "reboot" from the MBR
instead. I don't have this util to hand but I got it from a PC mag in the
early 1990's and from memory it written by a reader of the mag which did
something similar to what is also being discussed although obviously the
intention of that utility was to boot first from a floppy and then swap to
booting from a harddisk.
Regards Richard
"H. Peter Anvin" <hpa at zytor.com> wrote:
Josh Lehan wrote:> H. Peter Anvin wrote:
>> Can't be done. Unfortunately the BIOS considers loading a boot
sector
>> (from floppy or from hard disk) to be "terminal" in the sense
that it
>> has now booted, and there is no going back.
>>
>> This is one of the most unfortunate aspects of the BIOS.
>
> Hmm, would calling INT 18 work?
>
> INT 18 seems to have the meaning of "there's nothing to boot here,
move
> along".
>
> In the MBR, an INT 18 will return control to the BIOS.
>
> A good BIOS hopefully will advance to the next device in the boot
> sequence. A bad BIOS will probably just hang then, with the unfortunate
> "Missing operating system" error message.
>
> It might be worth a try to overwrite some of the code in the MBR of your
> hard drive, to force a call to INT 18, if you don't want to boot from
> that drive.
>
> This differs from INT 19, which should do a full reset of the computer,
> entirely starting the boot sequence over from the beginning. If INT 18
> doesn't work, to advance to the next boot device, then maybe INT 19, to
> go back to the beginning, might be another way to solve the problem.
When I've tried it, INT 18h generally results in printing a message and
stopping. The Compaq-Phoenix-Intel BIOS Boot Specification
http://www.phoenix.com/NR/rdonlyres/56E38DE2-3E6F-4743-835F-B4A53726ABED/0/specsbbs101.pdf
does that that INT 18h is supposed to invoke the next boot device, and
it might be worth trying (it might help the OPs problem.)
That is, replace the first two bytes in the MBR with CD 18 hex. It will
either work, or it won't.
I hadn't looked at the BBS for a while, and I clearly should have,
because it actually provides a much richer API than I remember. In
particular, if the functions in Appendix B are widely implemented, then
there might be a lot of things that are possible that I didn't quite
realize. Silly me, but this is paydirt!
-hpa
_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX at zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
---------------------------------
All new Yahoo! Mail "The new Interface is stunning in its simplicity and
ease of use." - PC Magazine
---------------------------------
Try the all-new Yahoo! Mail . "The New Version is radically easier to
use" ? The Wall Street Journal
Op 18-10-2006 om 07:35 schreef Coe, Colin C. (Unix Engineer):> > Wow! You guys are the greatest! > > I used a hex editor and changed the first two bytes and a network boot > was forced *and* the partition info was still there. > > Many thanks > > CC"Thank you"s are allways welcome. Another good way to say thank is to help, to contribute in some way. With the arrival of the syslinux wiki[1] become contributing much easier. So please cultivate it further. Cheers Geert Stappers In an attempt to make contributors from "just users" [1] http://syslinux.zytor.com/wiki and someday just http://syslinux.zytor.com