Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Editing the boot menu

195 views
Skip to first unread message

Paul Schmehl

unread,
Jun 8, 2005, 3:17:37 PM6/8/05
to
When you use FreeBSD's boot manager, you get a menu like this at bootup:

F1 DOS
F2 FreeBSD
F3 Linux
F4 ??
F5 Drive 1

Default: F2

Is there a way to edit the list? Or is that fixed when boot manager is
installed and not configurable?

By edit, I mean, for example, change F4 ?? to F4 MyOS.

Paul Schmehl (pa...@utdallas.edu)
Adjunct Information Security Officer
University of Texas at Dallas
AVIEN Founding Member
http://www.utdallas.edu/ir/security/
_______________________________________________
freebsd-...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questi...@freebsd.org"

José de Paula Rodrigues

unread,
Jun 8, 2005, 3:29:22 PM6/8/05
to
On 6/8/05, Paul Schmehl <pa...@utdallas.edu> wrote:
> When you use FreeBSD's boot manager, you get a menu like this at bootup:
>
> F1 DOS
> F2 FreeBSD
> F3 Linux
> F4 ??
> F5 Drive 1
>
> Default: F2
>
> Is there a way to edit the list? Or is that fixed when boot manager is
> installed and not configurable?
>
> By edit, I mean, for example, change F4 ?? to F4 MyOS.
>

man boot0cfg

HTH

Paul Schmehl

unread,
Jun 8, 2005, 4:24:39 PM6/8/05
to
--On Wednesday, June 08, 2005 16:29:22 -0300 José de Paula Rodrigues
<espi...@gmail.com> wrote:

> On 6/8/05, Paul Schmehl <pa...@utdallas.edu> wrote:

>> When you use FreeBSD's boot manager, you get a menu like this at bootup:
>>
>> F1 DOS
>> F2 FreeBSD
>> F3 Linux
>> F4 ??
>> F5 Drive 1
>>
>> Default: F2
>>
>> Is there a way to edit the list? Or is that fixed when boot manager is
>> installed and not configurable?
>>
>> By edit, I mean, for example, change F4 ?? to F4 MyOS.
>>
>

> man boot0cfg
>
I *thought* it would go without saying that I had already read man boot0cfg.

Obviously, I missed the part where you edit the menu. Wanna give me a hint?

uname -imr
5.4-RELEASE i386 GENERIC

boot0cfg -v /dev/ad4
# flag start chs type end chs offset size
1 0x00 0: 1: 1 0x07 1023:254:63 63 204796557
2 0x80 1023:255:63 0xa5 1023:254:63 204796620 283482990

version=1.0 drive=0x80 mask=0xf ticks=182
options=packet,update,nosetdrv
default_selection=F2 (Slice 2)

The options for boot0cfg are:

-B Install the `boot0' boot manager. This option causes MBR code
to
be replaced, without affecting the embedded slice table.

I don't need to install it.

-b boot0
Specify which `boot0' image to use. The default is /boot/boot0
which will use the video card as output, alternatively
/boot/boot0sio can be used for output to the COM1 port. (Be
aware that nothing will be output to the COM1 port unless the
modem signals DSR and CTS are active.)

I don't need to specify the boot image.

-d drive
Specify the drive number used by the PC BIOS in referencing the
drive which contains the specified disk. Typically this will
be
0x80 for the first hard drive, 0x81 for the second hard drive,
and so on; however any integer between 0 and 0xff is acceptable
here.

I don't need to specify the drive.

-f file
Specify that a backup copy of the preexisting MBR should be
writ-
ten to file. This file is created if it does not exist, and
replaced if it does.

I don't need to make a backup copy.

-m mask
Specify slices to be enabled/disabled, where mask is an integer
between 0 (no slices enabled) and 0xf (all four slices
enabled).

The correct slices are already enabled. The system boots fine to either OS.

-o options
A comma-separated string of any of the following options may be
specified (with ``no'' prepended as necessary):

The default options are being used, and I see no reason to change them.

packet Use the disk packet (BIOS INT 0x13 extensions)
interface,
as opposed to the legacy (CHS) interface, when doing
disk
I/O. This allows booting above cylinder 1023, but
requires specific BIOS support. The default is
`nopacket'.

setdrv Forces the drive containing the disk to be referenced
using drive number definable by means of the -d option.
The default is `nosetdrv'.

update Allow the MBR to be updated by the boot manager. (The

update Allow the MBR to be updated by the boot manager. (The
MBR may be updated to flag slices as `active', and to
save slice selection information.) This is the
default;
a `noupdate' option causes the MBR to be treated as
read-
only.

-s slice
Set the default boot selection to slice. Values between 1 and
4
refer to slices; a value of 5 refers to the option of booting
from a second disk.

The default slice is determined by the last boot. I see no reason to
change that.

-t ticks
Set the timeout value to ticks. (There are approximately 18.2
ticks per second.)

The timeout is set to 10, and I see no reason to change that.

-v Verbose: display information about the slices defined, etc.

Self-explanatory.

So where is the switch that I use to edit the menu?

Alejandro Pulver

unread,
Jun 8, 2005, 4:38:36 PM6/8/05
to
On Wed, 08 Jun 2005 14:17:37 -0500
Paul Schmehl <pa...@utdallas.edu> wrote:

> When you use FreeBSD's boot manager, you get a menu like this at
> bootup:
>
> F1 DOS
> F2 FreeBSD
> F3 Linux
> F4 ??
> F5 Drive 1
>
> Default: F2
>
> Is there a way to edit the list? Or is that fixed when boot manager
> is installed and not configurable?
>
> By edit, I mean, for example, change F4 ?? to F4 MyOS.
>

Hello,

You can try using GAG, a Graphical Boot Loader which does not need a
slice or partition for installing (it uses a special part of the disk,
reserved for things like that), it can be configured while booting,
self uninstalled (restoring the previous bootloader) and supports a lot
of operating systems. Of course, it is free and open-source.

http://gag.sourceforge.net/

It is the *best* bootloader (for booting more than one operating
systems) I have found (I have tried BootMagic, Lilo and Grub).

Best Regards,
Ale

José de Paula Rodrigues

unread,
Jun 8, 2005, 4:42:44 PM6/8/05
to
On 6/8/05, Paul Schmehl <pa...@utdallas.edu> wrote:
> --On Wednesday, June 08, 2005 16:29:22 -0300 José de Paula Rodrigues
> <espi...@gmail.com> wrote:
>
> > On 6/8/05, Paul Schmehl <pa...@utdallas.edu> wrote:
> >> When you use FreeBSD's boot manager, you get a menu like this at bootup:
> >>
> >> F1 DOS
> >> F2 FreeBSD
> >> F3 Linux
> >> F4 ??
> >> F5 Drive 1
> >>
> >> Default: F2
> >>
> >> Is there a way to edit the list? Or is that fixed when boot manager is
> >> installed and not configurable?
> >>
> >> By edit, I mean, for example, change F4 ?? to F4 MyOS.
> >>
> >
> > man boot0cfg
> >
> I *thought* it would go without saying that I had already read man boot0cfg.
>
> Obviously, I missed the part where you edit the menu. Wanna give me a hint?
>

I'm really sorry I underestimated you, I misunderstood your question
in the first place.

>From what I gather, these labels come straight from /boot/boot0, not
from boot0cfg. Looking at the boot0 source code (found at
/usr/src/sys/boot/i386/boot0/boot0.S), you can see that the OS options
are hard-coded into the boot0 program, so there is no way to edit that
other than by changing the source code and recompiling.

Did you try using Grub instead? It now supports UFS2, and is a great
bootloader, with lots of features. You can find it in your ports tree.

Paul Schmehl

unread,
Jun 8, 2005, 4:50:17 PM6/8/05
to
--On Wednesday, June 08, 2005 17:38:36 -0300 Alejandro Pulver
<alej...@varnet.biz> wrote:
>
> You can try using GAG, a Graphical Boot Loader which does not need a
> slice or partition for installing (it uses a special part of the disk,
> reserved for things like that), it can be configured while booting,
> self uninstalled (restoring the previous bootloader) and supports a lot
> of operating systems. Of course, it is free and open-source.
>
> http://gag.sourceforge.net/
>
> It is the *best* bootloader (for booting more than one operating
> systems) I have found (I have tried BootMagic, Lilo and Grub).
>
I'm not interested in using GAG. (I have used it before, but don't want to
in this instance.)

Alex Zbyslaw

unread,
Jun 8, 2005, 4:54:54 PM6/8/05
to
Paul Schmehl wrote:

> When you use FreeBSD's boot manager, you get a menu like this at bootup:
>
> F1 DOS
> F2 FreeBSD
> F3 Linux
> F4 ??
> F5 Drive 1
>
> Default: F2
>
> Is there a way to edit the list? Or is that fixed when boot manager
> is installed and not configurable?
>

You have to edit the source. If you know the hex for the partition type
then it's reasonably easy. Below is a simple patch that adds 0x7 (my
NTFS/Windows) and recognises it as DOS. Done out of curiosity, more
than anything.

(From memory...)

cd /usr/src
patch < {patchname}
cd sys/boot/i386/boot0/
make
make install
boot0cfg -B -o packet /dev/{your disk}

Be warned that the final boot0cfg has to be 512 bytes so if you add a
string it may become longer. I haven't tested my patch for the serial
console boot. The patch incorporates taking out the bell on
non-serial-console boots as well (pinched from somewhere else, now
forgotten) -- it was just annoying. The patch comes with no warranties,
but it's working for me. (I don't promise either that including it here
won't bu**er up the spaces/tabs).

Of course, once you applied and rebuilt you have to write it to your
boot sector. Man boot0cfg and don't forget -o packet if your partitions
go past cylinder 1024. And have a FreebSD boot CD handy so you can
rewrite with a standard one if this doesn't work!

The final problem is that if you use cvsup it will trash all over any
source changes you make when you next run it. Doing anything about that
seems more complicated than can be justified for a small number of
patches so I just keep them in a separate dir an re-apply them whenever
I need to. In this case, it will be just after I reaslise that I've
installed a beeping boot manager again :-)

--Alex

PS just spotted the -m flag to boo0cfg for the first time. Amazing what
you find when you read the man pages :-)

patch-boot0.S.i386

Hanspeter Roth

unread,
Jun 8, 2005, 4:54:52 PM6/8/05
to
On Jun 08 at 14:17, Paul Schmehl spoke:

> When you use FreeBSD's boot manager, you get a menu like this at bootup:
>
> F1 DOS
> F2 FreeBSD
> F3 Linux
> F4 ??
> F5 Drive 1
>
> Default: F2
>
> Is there a way to edit the list? Or is that fixed when boot manager is
> installed and not configurable?
>
> By edit, I mean, for example, change F4 ?? to F4 MyOS.

This boot selector has no configuration file. It resides within the
512 Byte MBR.
You may change Lables by editing
/usr/src/sys/boot/i386/boot0/boot0.S.
It's probably easier if you don't touch the length of the label.
After making boot0 copy it to /boot and run boot0cfg.

-Hanspeter

Paul Schmehl

unread,
Jun 8, 2005, 5:12:29 PM6/8/05
to
--On Wednesday, June 08, 2005 17:42:44 -0300 José de Paula Rodrigues
<espi...@gmail.com> wrote:
>
>> From what I gather, these labels come straight from /boot/boot0, not
> from boot0cfg. Looking at the boot0 source code (found at
> /usr/src/sys/boot/i386/boot0/boot0.S), you can see that the OS options
> are hard-coded into the boot0 program, so there is no way to edit that
> other than by changing the source code and recompiling.
>
I see that now. Thanks for pointing that out.

> Did you try using Grub instead? It now supports UFS2, and is a great
> bootloader, with lots of features. You can find it in your ports tree.

It's not that big of an issue. It's just my workstation, and I know what
?? means. I was just being anal. I like to straighten out twisted phone
cords too.

Remington L

unread,
Jun 8, 2005, 5:30:36 PM6/8/05
to
Just use grub, much easier and more flexible

On 6/8/05, Paul Schmehl <pa...@utdallas.edu> wrote:
>

> --On Wednesday, June 08, 2005 17:42:44 -0300 José de Paula Rodrigues
> <espi...@gmail.com> wrote:
> >
> >> From what I gather, these labels come straight from /boot/boot0, not
> > from boot0cfg. Looking at the boot0 source code (found at
> > /usr/src/sys/boot/i386/boot0/boot0.S), you can see that the OS options
> > are hard-coded into the boot0 program, so there is no way to edit that
> > other than by changing the source code and recompiling.
> >
> I see that now. Thanks for pointing that out.
>
> > Did you try using Grub instead? It now supports UFS2, and is a great
> > bootloader, with lots of features. You can find it in your ports tree.
>
> It's not that big of an issue. It's just my workstation, and I know what
> ?? means. I was just being anal. I like to straighten out twisted phone
> cords too.
>

Hanspeter Roth

unread,
Jun 9, 2005, 4:27:59 AM6/9/05
to
On Jun 08 at 17:42, Jos de Paula Rodrigues spoke:

> Did you try using Grub instead? It now supports UFS2, and is a great
> bootloader, with lots of features. You can find it in your ports tree.

Grub is heavy. The FreeBsd boot selector is much more efficient. It
is more suited for an old laptop.

The FreeBsd boot selector allows a one keystroke selection.
Grub forces you to press arrow keys until the curser is over the
desired option.

I put the FreeBsd boot selector into the MBR and for Linux Grub or
Lilo into a primary or extended slice (partition).

-Hanspeter

Valerio Daelli

unread,
Jun 9, 2005, 5:12:32 AM6/9/05
to
Hi all,
we are using FreeBSD 5.4 with some jails.
One of this jail is on a NFS directory - I mean: the whole filesystem of
this jail is on a remote directory, exported by a FreeBSD 5.4 server with
NFS, and the 'host' system (the one that started and stopped the jail)
mounts it via NFS. In this jail we can't perform a 'flock' operation, even
if the NFS server has rpc.lockd and rpc.statd. We built a little executable
in C like this (let's call it myflock):

___________________________________________________________
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>

int main() {
int lockfd;
char* tempfile="tempfile";

lockfd=open(tempfile,O_CREAT);
if (flock(lockfd, LOCK_SH|LOCK_NB)==-1) {
printf("ERROR shared lock: %d",errno);
}
if (flock(lockfd, LOCK_EX|LOCK_NB)==-1) {
printf("ERROR exclusive lock: %d",errno);
}
close(lockfd);
}
___________________________________________________________

We executed on a local directory and it gets the flock.
We executed on the mounted NFS partition (with rpc.lockd and rpc.statd) and
it works.
We executed in the jail-NFS and it fails! Errno 45 (from
'/usr/include/errno.h': #define EOPNOTSUPP 45 /* Operation
not supported */). The directory where we launch myflock is the same as the
previous command (no permission problems).
We executed in a jail contained in a md mounted on a NFS directory and it
works.
Could it be a rpcbind issue (the jail can't get the flock since it can't
rpc-contact the NFS server)?
Thanks a lot

Valerio Daelli

0 new messages