Home | History | Annotate | Download | only in mkubootimage
History log of /src/usr.bin/mkubootimage/mkubootimage.c
RevisionDateAuthorComments
 1.34  29-Oct-2024  gutteridge mkubootimage.c: consistently use endian.h origin functions

Since this already uses bswap32(3), le64toh(3), etc., switch to also
use htobe32(3) and be32toh(3) instead of htonl(3) and ntohl(3). This
seems the best way to fix build breakages under recent Linux distros
where GCC objects to missing prototypes (since otherwise we'd need to
include arpa/inet.h, which wasn't declared). Another issue related to
PR lib/58674.

Confirmed this fixes builds on Fedora 40 (since all these functions are
provided by NetBSD compat). No changes noted to resulting installation
images generated for armv7hf on a NetBSD build.
 1.33  21-May-2024  gutteridge branches: 1.33.2;
mkubootimage(1): adjust usage, etc.

In the tool, reflow and reorder usage() output and also consistently
mark which arguments are optional.

In the man page, add missing -t argument in the synopsis and follow
consistent argument ordering.
 1.32  21-May-2024  gutteridge mkubootimage(1): add riscv
 1.31  09-Feb-2024  christos PR/57914: Jan-Benedict Glaw: Set reproducible timestamp
Cleanup lint.
 1.30  08-Feb-2020  ryo branches: 1.30.8;
arm64_image_header->image_size must be included size of arm64_image_header.

with -u option, image_size should be binary (file) size (header included).
without -u option, image_size should be binary (file) size + header size.
 1.29  01-Jan-2020  martin Avoid mixing signed/unsigned arguments to the ? operator.
 1.28  01-Jan-2020  skrll Adjust image size appropriately when using update_image

OK jmcneill
 1.27  07-Dec-2019  wiz Sync usage with man page, merge single letter options.

Limit program usage line length.
 1.26  04-Dec-2019  jmcneill Fix signed/unsigned comparison
 1.25  04-Dec-2019  jmcneill Add -u flag for updating headers in place.
 1.24  04-Feb-2018  jmcneill branches: 1.24.4; 1.24.6;
Fix tools build
 1.23  04-Feb-2018  jmcneill Add support for writing "AArch64 Linux kernel image" format images.

These images begin with a 64-byte header that includes a load offset,
image size, some flags, and a small (2 word) area at the start for
executable code.

These images are compatible with U-Boot's "booti" command, and can be
used to make U-Boot relocate our kernel to a 2MB aligned base address.
After relocation, U-Boot will jump to the code at the beginning of the
header, where we encode a relative branch forward instruction to branch
to the beginning of the kernel at offset +0x40.
 1.22  05-Nov-2017  jmcneill add missing break after -m case
 1.21  29-Sep-2017  jmcneill add sh arch
 1.20  15-Jul-2017  jmcneill branches: 1.20.2;
Add support for "kernel_noload" image types. This type is the same as the
"kernel" type, except it can run from any load address.
 1.19  05-Jul-2017  jmcneill Load address is not required for "ramdisk" images.
 1.18  30-Sep-2014  msaitoh branches: 1.18.8;
Support arm64, i386 and or1k.
 1.17  29-Dec-2012  jmcneill add support for generating boot.scr scripts with -T script
 1.16  17-Feb-2012  matt branches: 1.16.2;
Avoid signed/unsigned comparision.
 1.15  17-Feb-2012  matt Let address/entry be 64bit if they are just sign-extended 32-bit values.
(change pulled up from matt-nb5-mips64).
 1.14  04-Sep-2011  joerg branches: 1.14.2;
Sprinkle one more static and a bunch of consts.
 1.13  04-Sep-2011  joerg static + __dead
 1.12  06-Aug-2011  wiz Add lzma and lzo to usage. From Elie De Brauwer in PR 45219.
 1.11  04-Aug-2011  matt Add O_TRUNC to the open of the image file (in case the size decreases).
 1.10  03-Aug-2011  matt Add lzma and lzo compression types
 1.9  03-Aug-2011  matt Add -E entrypoint for "byteswapped" entry-points.
 1.8  01-Aug-2011  riz Add an -m flag to mkubootimage, for specifying an alternate magic
value.
 1.7  08-Jun-2011  matt branches: 1.7.2;
When printing the header, convert values to names:
Use strlcpy to copy the name, not strncpy.

magic: 0x27051956
time: Tue Jun 7 15:58:41 2011
size: 2482203
load addr: 0x00020000
entry point: 0x00020000
data crc: 0x700fdf53
os: 2 (netbsd)
arch: 7 (powerpc)
type: 2 (kernel)
comp: 1 (gz)
name: NetBSD/evbppc 5.99.52 (INSTALL_
header crc: 0x94ea96cf
 1.6  26-Feb-2011  phx branches: 1.6.2; 1.6.4;
Add the -O option to set the OS type, which defaults to NetBSD when missing.
This is needed, because some vendors have stripped U-Boot so much that it
only accepts Linux kernel modules.
Also allow 'standalone' as module type.
 1.5  31-Jan-2011  matt Add mips/mips64 support.
 1.4  10-Jul-2010  kiyohara branches: 1.4.2;
Change '-e' to optional. Use load addr(-a), if '-e' not specify.
Just like u-boot's mkimage.
 1.3  09-Jul-2010  kiyohara s/mkuboot/mkubootimage/ in usage().
 1.2  22-Jun-2010  dogcow nbtool.h'ify; fixes cross-compilation.
 1.1  18-Jun-2010  jmcneill add mkubootimage(1), a tool for creating u-boot compatible images
 1.4.2.2  05-Mar-2011  bouyer Sync with HEAD
 1.4.2.1  08-Feb-2011  bouyer Sync with HEAD
 1.6.4.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.6.2.3  15-Feb-2012  matt Let address/entry be 64bit if they are just sign-extended 32-bit values.
 1.6.2.2  20-May-2011  matt Backport mkubootimage from -current
 1.6.2.1  26-Feb-2011  matt file mkubootimage.c was added on branch matt-nb5-mips64 on 2011-05-20 15:05:11 +0000
 1.7.2.2  26-Jul-2011  matt Add mkubootimage from -HEAD
 1.7.2.1  08-Jun-2011  matt file mkubootimage.c was added on branch matt-nb5-pq3 on 2011-07-26 02:57:30 +0000
 1.14.2.2  23-Jan-2013  yamt sync with head
 1.14.2.1  17-Apr-2012  yamt sync with head
 1.16.2.1  25-Feb-2013  tls resync with head
 1.18.8.3  06-Nov-2017  snj Pull up following revision(s) (requested by jmcneill in ticket #347):
usr.bin/mkubootimage/mkubootimage.c: revision 1.22
add missing break after -m case
 1.18.8.2  25-Jul-2017  snj Pull up following revision(s) (requested by jmcneill in ticket #142):
usr.bin/mkubootimage/mkubootimage.1: 1.9-1.10
usr.bin/mkubootimage/mkubootimage.c: 1.20
usr.bin/mkubootimage/uboot.h: 1.7
Add support for "kernel_noload" image types. This type is the same as the
"kernel" type, except it can run from any load address.
--
Remove unnecessary macros. Use standard headers.
 1.18.8.1  05-Jul-2017  snj Pull up following revision(s) (requested by jmcneill in ticket #96):
usr.bin/mkubootimage/mkubootimage.c: revision 1.19
Load address is not required for "ramdisk" images.
 1.20.2.2  15-Jul-2017  jmcneill 3317810
 1.20.2.1  15-Jul-2017  jmcneill file mkubootimage.c was added on branch perseant-stdc-iso10646 on 2017-07-15 11:13:09 +0000
 1.24.6.3  10-Feb-2020  martin Pull up following revision(s) (requested by ryo in ticket #690):

usr.bin/mkubootimage/mkubootimage.c: revision 1.30

arm64_image_header->image_size must be included size of arm64_image_header.

with -u option, image_size should be binary (file) size (header included).
without -u option, image_size should be binary (file) size + header size.
 1.24.6.2  02-Jan-2020  martin Pull up following revision(s) (requested by skrll in ticket #596):

usr.bin/mkubootimage/mkubootimage.c: revision 1.28
usr.bin/mkubootimage/mkubootimage.c: revision 1.29

Adjust image size appropriately when using update_image
OK jmcneill

Avoid mixing signed/unsigned arguments to the ? operator.
 1.24.6.1  09-Dec-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #525):

external/cddl/osnet/dev/dtrace/aarch64/dtrace_isa.c: revision 1.1
distrib/sets/lists/modules/md.i386: revision 1.83
share/mk/bsd.own.mk: revision 1.1168
usr.bin/mkubootimage/mkubootimage.c: revision 1.25
sys/modules/dtrace/Makefile: revision 1.7
usr.bin/mkubootimage/mkubootimage.c: revision 1.26
sys/modules/dtrace/Makefile: revision 1.8
external/cddl/osnet/dist/lib/libdtrace/aarch64/dt_isadep.c: revision 1.2
distrib/sets/lists/modules/mi: revision 1.128
sys/arch/aarch64/include/frame.h: revision 1.3
sys/arch/evbarm/conf/mk.generic64: revision 1.4
external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c: revision 1.12
sys/modules/cyclic/Makefile: revision 1.4
sys/arch/aarch64/conf/Makefile.aarch64: revision 1.16
external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c: revision 1.1
sys/arch/aarch64/aarch64/start.S: revision 1.3
sys/arch/aarch64/aarch64/trap.c: revision 1.22
external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c: revision 1.1
external/cddl/osnet/dev/dtrace/aarch64/dtrace_asm.S: revision 1.1
external/cddl/osnet/dev/fbt/aarch64/fbt_isa.h: revision 1.1
external/cddl/osnet/dev/dtrace/aarch64/regset.h: revision 1.1
external/cddl/osnet/lib/libdtrace/Makefile: revision 1.26
distrib/sets/lists/modules/md.amd64: revision 1.82
usr.bin/mkubootimage/mkubootimage.1: revision 1.13
distrib/sets/lists/modules/ad.arm: revision 1.14

Add KDTRACE_HOOKS support.

Define lwp_trapframe() macro

dtrace: add support for aarch64

Add syscall_linux back for other arm architectures (accidently removed
in previous)

Add -u flag for updating headers in place.

Fix alignment of .text section by changing load address to
0xffffffc000000000 and adding 64 bytes of padding before the entry point.

Update arm64 image header in place

Move dtrace_syscall_linux out of mi set list

Enable DTrace on aarch64

Fix signed/unsigned comparison
 1.24.4.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.30.8.1  15-Dec-2024  martin Pull up following revision(s) (requested by gutteridge in ticket #1023):

usr.bin/mkubootimage/mkubootimage.1: revision 1.15
usr.bin/mkubootimage/crc32.c: revision 1.5
usr.bin/mkubootimage/mkubootimage.c: revision 1.31
usr.bin/mkubootimage/mkubootimage.c: revision 1.34
usr.bin/mkubootimage/crc32.h: revision 1.1

PR/57914: Jan-Benedict Glaw: Set reproducible timestamp
Cleanup lint.

mkubootimage.c: consistently use endian.h origin functions

Since this already uses bswap32(3), le64toh(3), etc., switch to also
use htobe32(3) and be32toh(3) instead of htonl(3) and ntohl(3). This
seems the best way to fix build breakages under recent Linux distros
where GCC objects to missing prototypes (since otherwise we'd need to
include arpa/inet.h, which wasn't declared). Another issue related to
PR lib/58674.

Confirmed this fixes builds on Fedora 40 (since all these functions are
provided by NetBSD compat). No changes noted to resulting installation
images generated for armv7hf on a NetBSD build.
 1.33.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed