Re: Enhancing cdboot [patch for review]

From: Giorgos Keramidas <keramida_at_ceid.upatras.gr>
Date: Tue, 09 Dec 2008 03:29:28 +0200
On Mon, 08 Dec 2008 16:29:04 -0800, Maxim Sobolev <sobomax_at_freebsd.org> wrote:
> 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.

Nice pair of features :-)

If there are no pressing space constraints maybe we can build both
options in by default, but still make them opt-out when necessary?

With a bit of makefile glue we can make it possible to compile with an
`src.conf' that includes:

    WITH_CDBOOT_SILENT=1
    WITHOUT_CDBOOT_PROMPT=1

This way the defaults can include support for both options, but we can
conditionally compile *out* the bits that are not needed for some custom
installation.

Something like this can define one or both of these options in CFLAGS,
depending on what `src.conf' contains:

  # When CDBOOT_SILENT is set, the cdboot doesn't produce any messages except
  # "Loading, please wait..." and it also passes RBX_MUTE flag to the next
  # stage to silence it as well. This is intended for custom installations
  # where end-user is not required to see any messages or interfere with the
  # boot process.

  .if ${MK_CDBOOT_SILENT} != "no"
  CFLAGS+= -DCDBOOT_SILENT
  .endif

  # When CDBOOT_PROMPT is enabled the cdboot behaves like windows xp or vista
  # cd loader, that is it reads MBR from the first hard drive in the system
  # and if the MBR is bootable (i.e. drive has some other operating system
  # installed on it) then it presents user with "Press any key to boot from
  # CD" prompt and waits for 20 seconds. If key is not pressed then the
  # control is passed to the MBR, otherwise CD is booted. This is intended for
  # installation CD to allow unattended mode and also helps when installation
  # CD has been unintentionally left in the drive of the machine that is set
  # to boot off CD.

  .if ${MK_CDBOOT_PROMPT} != "no"
  CFLAGS+= -DCDBOOT_PROMPT
  .endif

The defaults for ${MK_CDBOOT_XXX} will have to be explicitly set in
`src/share/mk/bsd.own.mk', near line 281:

    281 #
    282 # MK_* options which default to "yes".
    283 #
    284 .for var in \
    ...

But that shouldn't be a problem, AFAICT :-)
Received on Tue Dec 09 2008 - 00:29:41 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:38 UTC