History log of /openbsd-current/usr.sbin/installboot/util.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.16 03-Feb-2022 visa

installboot(8): Adjustments for EFI platforms

Reduce #ifdef'ing within the control logic to make it clearer that there
are no essential differences in behaviour between the platforms.

Make installboot(8) write startup.nsh to enable simpler and more consistent
code in install.md.

Input and OK kettenis@ deraadt@


# 1.15 02-Feb-2022 visa

Add missing mode argument to open(2) with O_CREAT.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.14 03-Jul-2019 deraadt

snprintf/vsnprintf return < 0 on error, rather than -1.


Revision tags: OPENBSD_6_5_BASE
# 1.13 07-Nov-2018 miko

avoid freeing r twice in error case; OK otto@


Revision tags: OPENBSD_6_4_BASE
# 1.12 03-Jul-2018 jcs

installboot: adapt fileprefix() to future realpath(3) behavior

This was relying on realpath(3) working for paths that don't exist
yet, which will be changing soon.

Use a combination of dirname(3), realpath(3), and basename(3) to
construct a sane path while still ensuring that the target directory
exists.

with martijn
ok martijn, deraadt


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.11 04-Nov-2015 jsg

fix a memory leak in multiple error paths
ok krw@


# 1.10 19-Oct-2015 krw

Nuke unused variable.


# 1.9 14-Oct-2015 krw

Backout last. Breaks sparc64, amoung other dubiousness.

requested by deraadt@


# 1.8 12-Oct-2015 krw

Check that the disk specified on the command line is the disk that
files are copied to. Error out with 'cross-device install' if not.

ok millert@, ok deraadt@ & jsing@ for previous version


# 1.7 08-Oct-2015 krw

Refactor fileprefix() and filecopy() to use warn() instead of err()
to display error message, and to return error indications (NULL and
-1 respectively). Use the error indications in write_efisystem()
to unwind in the face of more error conditions. In other cases just
exit(1) to emulation current behaviour.

ok deraadt@


# 1.6 07-Oct-2015 krw

Add initial support for installing UEFI boot files to a GTP EFI System
Partition. Further work to be done in-tree.

ok deraadt@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.5 16-Jan-2015 deraadt

first batch of cleanup to programs based upon the namespace cleanups
in net/pfvar.h sys/proc.h sys/ucred.h arpa/nameser.h
change to PATH_MAX, reduce use of MIN() and MAX(), HOST_NAME_MAX+1,
LOGIN_NAME_MAX, etc etc
ok millert guenther, some review by doug


Revision tags: OPENBSD_5_6_BASE
# 1.4 09-Jun-2014 jsing

Change the installboot file copying process so that it carefully
overwrites the existing file, before truncating it to the final length.
This means that we will keep the same inode and potentially retain the
same disk data block allocation between runs.

This will aid users who multiboot since it makes it less likely that the
PBR will change, although as before, there is no guarantee. Obviously if
the second stage boot loader grows or shrinks then the PBR will change
regardless.


Revision tags: OPENBSD_5_5_BASE
# 1.3 19-Jan-2014 jsing

When copying files do it in 512 byte blocks so that we're less likely to
hit file system allocation issues on install media.

Requested by deraadt@


# 1.2 18-Jan-2014 jsing

Make installboot(8) easier to use - copy the second stage boot loader to
the default location used by the given architecture. This eliminates the
need to copy it over manually prior to running installboot.


# 1.1 18-Jan-2014 jsing

Add a -r flag that allows for the mount point of the root filesystem to be
specified. This is primarily for use by the installer and defaults to /.


# 1.14 03-Jul-2019 deraadt

snprintf/vsnprintf return < 0 on error, rather than -1.


Revision tags: OPENBSD_6_5_BASE
# 1.13 07-Nov-2018 miko

avoid freeing r twice in error case; OK otto@


Revision tags: OPENBSD_6_4_BASE
# 1.12 03-Jul-2018 jcs

installboot: adapt fileprefix() to future realpath(3) behavior

This was relying on realpath(3) working for paths that don't exist
yet, which will be changing soon.

Use a combination of dirname(3), realpath(3), and basename(3) to
construct a sane path while still ensuring that the target directory
exists.

with martijn
ok martijn, deraadt


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.11 04-Nov-2015 jsg

fix a memory leak in multiple error paths
ok krw@


# 1.10 19-Oct-2015 krw

Nuke unused variable.


# 1.9 14-Oct-2015 krw

Backout last. Breaks sparc64, amoung other dubiousness.

requested by deraadt@


# 1.8 12-Oct-2015 krw

Check that the disk specified on the command line is the disk that
files are copied to. Error out with 'cross-device install' if not.

ok millert@, ok deraadt@ & jsing@ for previous version


# 1.7 08-Oct-2015 krw

Refactor fileprefix() and filecopy() to use warn() instead of err()
to display error message, and to return error indications (NULL and
-1 respectively). Use the error indications in write_efisystem()
to unwind in the face of more error conditions. In other cases just
exit(1) to emulation current behaviour.

ok deraadt@


# 1.6 07-Oct-2015 krw

Add initial support for installing UEFI boot files to a GTP EFI System
Partition. Further work to be done in-tree.

ok deraadt@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.5 16-Jan-2015 deraadt

first batch of cleanup to programs based upon the namespace cleanups
in net/pfvar.h sys/proc.h sys/ucred.h arpa/nameser.h
change to PATH_MAX, reduce use of MIN() and MAX(), HOST_NAME_MAX+1,
LOGIN_NAME_MAX, etc etc
ok millert guenther, some review by doug


Revision tags: OPENBSD_5_6_BASE
# 1.4 09-Jun-2014 jsing

Change the installboot file copying process so that it carefully
overwrites the existing file, before truncating it to the final length.
This means that we will keep the same inode and potentially retain the
same disk data block allocation between runs.

This will aid users who multiboot since it makes it less likely that the
PBR will change, although as before, there is no guarantee. Obviously if
the second stage boot loader grows or shrinks then the PBR will change
regardless.


Revision tags: OPENBSD_5_5_BASE
# 1.3 19-Jan-2014 jsing

When copying files do it in 512 byte blocks so that we're less likely to
hit file system allocation issues on install media.

Requested by deraadt@


# 1.2 18-Jan-2014 jsing

Make installboot(8) easier to use - copy the second stage boot loader to
the default location used by the given architecture. This eliminates the
need to copy it over manually prior to running installboot.


# 1.1 18-Jan-2014 jsing

Add a -r flag that allows for the mount point of the root filesystem to be
specified. This is primarily for use by the installer and defaults to /.


# 1.13 07-Nov-2018 miko

avoid freeing r twice in error case; OK otto@


Revision tags: OPENBSD_6_4_BASE
# 1.12 03-Jul-2018 jcs

installboot: adapt fileprefix() to future realpath(3) behavior

This was relying on realpath(3) working for paths that don't exist
yet, which will be changing soon.

Use a combination of dirname(3), realpath(3), and basename(3) to
construct a sane path while still ensuring that the target directory
exists.

with martijn
ok martijn, deraadt


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.11 04-Nov-2015 jsg

fix a memory leak in multiple error paths
ok krw@


# 1.10 19-Oct-2015 krw

Nuke unused variable.


# 1.9 14-Oct-2015 krw

Backout last. Breaks sparc64, amoung other dubiousness.

requested by deraadt@


# 1.8 12-Oct-2015 krw

Check that the disk specified on the command line is the disk that
files are copied to. Error out with 'cross-device install' if not.

ok millert@, ok deraadt@ & jsing@ for previous version


# 1.7 08-Oct-2015 krw

Refactor fileprefix() and filecopy() to use warn() instead of err()
to display error message, and to return error indications (NULL and
-1 respectively). Use the error indications in write_efisystem()
to unwind in the face of more error conditions. In other cases just
exit(1) to emulation current behaviour.

ok deraadt@


# 1.6 07-Oct-2015 krw

Add initial support for installing UEFI boot files to a GTP EFI System
Partition. Further work to be done in-tree.

ok deraadt@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.5 16-Jan-2015 deraadt

first batch of cleanup to programs based upon the namespace cleanups
in net/pfvar.h sys/proc.h sys/ucred.h arpa/nameser.h
change to PATH_MAX, reduce use of MIN() and MAX(), HOST_NAME_MAX+1,
LOGIN_NAME_MAX, etc etc
ok millert guenther, some review by doug


Revision tags: OPENBSD_5_6_BASE
# 1.4 09-Jun-2014 jsing

Change the installboot file copying process so that it carefully
overwrites the existing file, before truncating it to the final length.
This means that we will keep the same inode and potentially retain the
same disk data block allocation between runs.

This will aid users who multiboot since it makes it less likely that the
PBR will change, although as before, there is no guarantee. Obviously if
the second stage boot loader grows or shrinks then the PBR will change
regardless.


Revision tags: OPENBSD_5_5_BASE
# 1.3 19-Jan-2014 jsing

When copying files do it in 512 byte blocks so that we're less likely to
hit file system allocation issues on install media.

Requested by deraadt@


# 1.2 18-Jan-2014 jsing

Make installboot(8) easier to use - copy the second stage boot loader to
the default location used by the given architecture. This eliminates the
need to copy it over manually prior to running installboot.


# 1.1 18-Jan-2014 jsing

Add a -r flag that allows for the mount point of the root filesystem to be
specified. This is primarily for use by the installer and defaults to /.


# 1.12 03-Jul-2018 jcs

installboot: adapt fileprefix() to future realpath(3) behavior

This was relying on realpath(3) working for paths that don't exist
yet, which will be changing soon.

Use a combination of dirname(3), realpath(3), and basename(3) to
construct a sane path while still ensuring that the target directory
exists.

with martijn
ok martijn, deraadt


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.11 04-Nov-2015 jsg

fix a memory leak in multiple error paths
ok krw@


# 1.10 19-Oct-2015 krw

Nuke unused variable.


# 1.9 14-Oct-2015 krw

Backout last. Breaks sparc64, amoung other dubiousness.

requested by deraadt@


# 1.8 12-Oct-2015 krw

Check that the disk specified on the command line is the disk that
files are copied to. Error out with 'cross-device install' if not.

ok millert@, ok deraadt@ & jsing@ for previous version


# 1.7 08-Oct-2015 krw

Refactor fileprefix() and filecopy() to use warn() instead of err()
to display error message, and to return error indications (NULL and
-1 respectively). Use the error indications in write_efisystem()
to unwind in the face of more error conditions. In other cases just
exit(1) to emulation current behaviour.

ok deraadt@


# 1.6 07-Oct-2015 krw

Add initial support for installing UEFI boot files to a GTP EFI System
Partition. Further work to be done in-tree.

ok deraadt@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.5 16-Jan-2015 deraadt

first batch of cleanup to programs based upon the namespace cleanups
in net/pfvar.h sys/proc.h sys/ucred.h arpa/nameser.h
change to PATH_MAX, reduce use of MIN() and MAX(), HOST_NAME_MAX+1,
LOGIN_NAME_MAX, etc etc
ok millert guenther, some review by doug


Revision tags: OPENBSD_5_6_BASE
# 1.4 09-Jun-2014 jsing

Change the installboot file copying process so that it carefully
overwrites the existing file, before truncating it to the final length.
This means that we will keep the same inode and potentially retain the
same disk data block allocation between runs.

This will aid users who multiboot since it makes it less likely that the
PBR will change, although as before, there is no guarantee. Obviously if
the second stage boot loader grows or shrinks then the PBR will change
regardless.


Revision tags: OPENBSD_5_5_BASE
# 1.3 19-Jan-2014 jsing

When copying files do it in 512 byte blocks so that we're less likely to
hit file system allocation issues on install media.

Requested by deraadt@


# 1.2 18-Jan-2014 jsing

Make installboot(8) easier to use - copy the second stage boot loader to
the default location used by the given architecture. This eliminates the
need to copy it over manually prior to running installboot.


# 1.1 18-Jan-2014 jsing

Add a -r flag that allows for the mount point of the root filesystem to be
specified. This is primarily for use by the installer and defaults to /.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.11 04-Nov-2015 jsg

fix a memory leak in multiple error paths
ok krw@


# 1.10 19-Oct-2015 krw

Nuke unused variable.


# 1.9 14-Oct-2015 krw

Backout last. Breaks sparc64, amoung other dubiousness.

requested by deraadt@


# 1.8 12-Oct-2015 krw

Check that the disk specified on the command line is the disk that
files are copied to. Error out with 'cross-device install' if not.

ok millert@, ok deraadt@ & jsing@ for previous version


# 1.7 08-Oct-2015 krw

Refactor fileprefix() and filecopy() to use warn() instead of err()
to display error message, and to return error indications (NULL and
-1 respectively). Use the error indications in write_efisystem()
to unwind in the face of more error conditions. In other cases just
exit(1) to emulation current behaviour.

ok deraadt@


# 1.6 07-Oct-2015 krw

Add initial support for installing UEFI boot files to a GTP EFI System
Partition. Further work to be done in-tree.

ok deraadt@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.5 16-Jan-2015 deraadt

first batch of cleanup to programs based upon the namespace cleanups
in net/pfvar.h sys/proc.h sys/ucred.h arpa/nameser.h
change to PATH_MAX, reduce use of MIN() and MAX(), HOST_NAME_MAX+1,
LOGIN_NAME_MAX, etc etc
ok millert guenther, some review by doug


Revision tags: OPENBSD_5_6_BASE
# 1.4 09-Jun-2014 jsing

Change the installboot file copying process so that it carefully
overwrites the existing file, before truncating it to the final length.
This means that we will keep the same inode and potentially retain the
same disk data block allocation between runs.

This will aid users who multiboot since it makes it less likely that the
PBR will change, although as before, there is no guarantee. Obviously if
the second stage boot loader grows or shrinks then the PBR will change
regardless.


Revision tags: OPENBSD_5_5_BASE
# 1.3 19-Jan-2014 jsing

When copying files do it in 512 byte blocks so that we're less likely to
hit file system allocation issues on install media.

Requested by deraadt@


# 1.2 18-Jan-2014 jsing

Make installboot(8) easier to use - copy the second stage boot loader to
the default location used by the given architecture. This eliminates the
need to copy it over manually prior to running installboot.


# 1.1 18-Jan-2014 jsing

Add a -r flag that allows for the mount point of the root filesystem to be
specified. This is primarily for use by the installer and defaults to /.