Enhancing cdboot [patch for review]

Maxim Sobolev sobomax at FreeBSD.org
Tue Dec 9 00:29:32 UTC 2008

Luigi Rizzo wrote:
> On Mon, Dec 08, 2008 at 02:40:41PM -0800, Maxim Sobolev wrote:
>> Hi,
>> Below please find patch that enhances cdboot with two compile-time options:
> ...
>> Any comments/suggestions are appreciated. If there are no objections I
>> would like to commit the change. The long-term goal is to make
>> CDBOOT_PROMPT default mode for installation CD.
>> http://sobomax.sippysoft.com/~sobomax/cdboot.diff
> Looks good. Some comments:

Thank you for the review and comments. Please see my answers below.

> 1. since there is plenty of space in the cdboot sector, why don't you
>    make the two option always compiled in, controlling which one to
>    activate through flags in the bootsector itself, to be set
>    patching the binary sector itself using a mechanism similar to
>    boot0cfg.
>       Of course you cannot alter a cdrom after you burn it,
>    but it makes it easier to build CDs with one or the other defaults,
>    patching cdboot or the iso image itself before creating/burning it.
> 2. in fact, the 'silent' option could be disabled at runtime by
>    pressing some key (e.g. adding a short wait loop before proceeding;
>    if this is meant for custom, unattended CDs the extra delay should not
>    matter much);

Good idea, I will see if I can put that in. In fact this behavior should 
have to be optional as well, since one of the uses for the "silent" 
option here is to provide tamper-resistant boot process on custom hardware.

> 3. one nitpick -- in one of the first chunks you replace $start
>    with $LOAD, but if i am not mistaken operation depends on $LOAD = $start,
>    so why don't you always use the same ?

No, they are not the same. $LOAD is address where BIOS loads boot 
sector, which is 0x7c00 by default (you can configure it when building 
CD-ROM, which is why it's an option). On the other hand, $start is 
address where code is compiled to be located, which is 0x0600.

>      Also in terms of relocation size, wouldn't it be the case of
>    hardwiring the size of the cd boot sector:
> -       mov $((end_init - start)/2),%cx
> +       mov 1024,%cx

Well, I don't see the reason to hardwire this. CDROM boot code can be of 
different size (within certain limits of course, to be selected when 
building ISO), it's not limited to fixed number of sectors like boot[012].

> 4. another nitpick -- the value you pass in %si to the MBR does not
>    seem to point to anything useful. As discussed about boot0.S and
>    the followup in the mailing lists, there seems to be no standard
>    but at least some MBR expect %si to point to a partition entry,
>    so you should probably initialize one in a way similar way to that
>    used by boot0.S

Hmm, maybe I misunderstood it then. What do you mean by "point to 
partition entry exactly"? Right now it points to the beginning on MBR.


More information about the freebsd-current mailing list