aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/mkimg
Commit message (Collapse)AuthorAgeFilesLines
* mkimg: Add SPDX-License-Identifier tagsTuukka Pasanen6 days20-0/+40
| | | | | Reviewed by: emaste Sponsored by: The FreeBSD Foundation
* mkimg(1): Sync mkimg(1) and usage() with the implementationLi-Wen Hsu2026-01-232-20/+37
| | | | | | Reviewed by: imp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D54419
* mkimg: Add a -h option and improve usage output to be more expressiveBrad Davis2025-10-181-8/+13
| | | | | | Reviewed by: imp, kp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D52906
* mkimg: Make output reproducible using a specific timestampMark Johnston2025-07-075-18/+27
| | | | | | | | | | | | | | | | | | | | | In commit 95ac5b0e27e9 ("mkimg: Add a reproducible mode"), I added a -R flag to mkimg, indicating that output should be reproducible. There is one place in the VHD image backend that uses time(3) to populate an image metadata field; this field is visible to tools which know how to process VHD images. Rather than picking an arbitrary value for that timestamp, it seems better to behave like makefs(8) and let the invoker pick a suitable timestamp. So, remove -R and instead add a -t option which lets the timestamp be specified directly. Then, modify the VHD backend to use that timestamp. Fixes: 95ac5b0e27e9 ("mkimg: Add a reproducible mode") Reviewed by: bnovkov MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D51077
* mkimg: Add a reproducible modeMark Johnston2025-06-264-16/+24
| | | | | | | | | | | | | | | | mkimg embeds a UUID in the GPT header and uses the current time of day to generate it, so its output is not reproducible by default. Add a -R flag to ask it to use a fixed time for UUID generation. Merge the FreeBSD-specific implementation of osdep_uuidgen() with that of Linux, as the use of uuidgen(2) is incompatible with reproducible output mode. Reviewed by: bnovkov MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D49716
* Remove residual blank line at start of MakefileWarner Losh2024-07-152-2/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* mkimg(1): process non-seekable output gracefullyEugene Grosbein2024-03-122-2/+15
| | | | | | | | | | mkimg may make severe load only to fail in the end if output is non-seekable pipe, socket or FIFO unless output format is raw disk image. Check it out and fail early. Make it clear in the manual. MFC after: 1 week
* mkimg.1: add new PARTITION SPECIFICATION sectionEugene Grosbein2024-02-271-1/+38
| | | | | | | The specification follows a commentary to the function parse_part() in the source code and the code itself. MFC after: 3 days
* mkimg(1): Fix typoYu-Hsun Chen2023-12-171-1/+1
| | | | | | | This is from the Advanced UNIX Programming Course (Fall’23) at NTHU. MFC after: 3 days Pull Request: https://github.com/freebsd/freebsd-src/pull/930
* usr.bin: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* Remove $FreeBSD$: one line sh-patternJose Luis Duran2023-10-1829-31/+1
| | | | | | | | Remove the $FreeBSD$ pattern added to the tests, as well as fixing the mkimg_test.sh script to stop adding it when we rebase the tests. Reviewed by: imp, emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/870
* mkimg: Regenerate all the tests for gptWarner Losh2023-10-1728-3754/+3798
| | | | | | | Recent changes to mkimg has changed the generated GPT images to be more correct. Use make rebase to regenerate the baseline. Sponsored by: Netflix
* mkimg_test: remove vtoc8 images, they aren't neededWarner Losh2023-10-1728-4472/+0
| | | | | | vtoc8 support expired with sparc64 removal, so remove them all. Sponsored by: Netflix
* mkimg: Ensure GPT Entry Array is at least 16kWarner Losh2023-10-171-4/+12
| | | | | | | | | | | | | | | | UEFI v2.10 Section 5.3 documentes that the minimum reserved space after the GPT header be at least 16kB. Enforce this minimum. Before, we'd only set the number of entries to be the unpadded size. gpart's selective enforcement of aspects of the GPT standard meant that these images would work, but couldn't be changed (to add a partition or grow the size of a partition). This ensures that gpart's overly picky standards don't cause problems for people wishing to, for example, resize release images. MFC after: 1 day (we want this in 14.0) PR: 274312 Sponsored by: Netflix Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D42245
* Remove $FreeBSD$: two-line nroff patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-16174-174/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1615-30/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-165-10/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* base: Remove support for the VTOC8 partitioning schemeMarius Strobl2023-07-263-116/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The removal of the sparc64 support in February 2020 obsoleted the VTOC8 partitioning scheme as no other FreeBSD platform makes use of it. Moreover, the code is bitrotting as nothing defines e. g. LOADER_VTOC8_SUPPORT any more and, thus, should go now, too. With this change, the following commits are reverted as far as VTOC8 is concerned and parts haven't already previously been deleted along with prior sparc64 removals: 094fcb157d4c98211899cf09d06e2cf19149b7e0 a7d366e9589c95feda6f3bc78c59c6355d51f126 ba8d50d08b9df4e8213f9a6997ff6792ecebcd9b The alignment example d9711c28efc4ec89ba5ea11f8fd63e9d0a7fc81b added to the VTOC8 section of gpart.8 is folded into the MBR one. This should finally conclude the deorbit of sparc64-specific bits. We had joy, we had fun we ran Unix on a Sun. But that source and the song of FreeBSD have all gone. Credits to Michael Bueker for the original "Unix on a Sun" and Rod McKuen for the "Seasons in the Sun" lyrics.
* Build host tools on non-FreeBSD host with DIRDEPS_BUILDSimon J. Gerraty2023-04-222-0/+17
| | | | | | | | | | | | Add Makefile.depend.options to libnetbsd, mkimg and makefs to ensure libegacy is build if needed. targets/pseudo/stage/Makefile avoid the need for mtree the staging process creates target dirs as needed anyway. Reviewed by: stevek Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D39757
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-1/+0
|
* mkimg: zero entry in vhdx_write_metadataEd Maste2021-11-211-0/+1
| | | | | | | Otherwise _reserved might contain uninitialized data. MFC after: 1 week Sponsored by: The FreeBSD Foundation
* mkimg(1): Correct a typo in the usage outputGordon Bergling2021-08-091-1/+1
| | | | | | - s/partion/partition/ MFC after: 5 days
* mkimg: Add fat32lba partition typeJose Luis Duran2021-06-224-0/+4
| | | | | | | Syntactic sugar for a `gpart add -t '!12' ...` equivalent. Reviewed by: emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/484
* mkimg: Add support for offset if the source is an imageEmmanuel Vadot2021-02-251-8/+11
| | | | | | | | | | This allow us to create image with the following format: mkimg -v -o sdcard -s gpt -p efi:=esp_aarch64.img:1M -p freebsd-ufs::1G Which will add a efi partition at a 1M offset on the image with its content coming from the esp_aarch64.img file. MFC after: 3 days
* mkimg: We always want the last block of the last inserted partitionEmmanuel Vadot2021-02-251-4/+2
| | | | | | | | | | | | Even with an absolute offset we want to know the last block the partition otherwise we endup with an image the size of the metadata. This allow to create image with the ESP placed at a specific position which is useful on arm/arm64 where u-boot have always a hard time to read the ESP if it's not aligned on 512k. mkimg -v -o sdcard -s gpt -p efi::54M:1M -p freebsd-ufs::1G now works. MFC after: 3 days
* Add GPT PREP-boot type to mkimg(1) from geom_gpt.Nathan Whitehorn2021-02-241-0/+2
| | | | | | This partition type can be used to boot some PowerKVM VMs. We don't support it well because of some limitations in SLOF, but it's worth at least have feature parity in geom and mkimg.
* Fix -Wpointer-sign warnings in makefs and mkimgAlex Richardson2021-01-071-1/+1
| | | | | Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D27175
* Significantly speed up mkimg_testAlex Richardson2020-10-182-3/+19
| | | | | | | | | | | | | | | | | It turns out that the majority of the test time for the mkimg tests isn't mkimg itself but rather the use of jot and hexdump which can be quite slow on emulated platforms such as QEMU. On QEMU-RISC-V this reduces the time for `kyua test mkimg_test` from 655 seconds to 200. And for CheriBSD on QEMU-CHERI this saves 4-5 hours (25% of the time for the entire testsuite!) since jot ends up triggering slow functions inside the QEMU emulation a lot. Reviewed By: lwhsu Differential Revision: https://reviews.freebsd.org/D26796 Notes: svn path=/head/; revision=366815
* Fix a few mandoc issuesGordon Bergling2020-10-091-2/+2
| | | | | | | | | | - skipping paragraph macro: Pp after Sh - sections out of conventional order: Sh EXAMPLES - whitespace at end of input line - normalizing date format Notes: svn path=/head/; revision=366583
* Do a sweep and remove most WARNS=6 settingsKyle Evans2020-10-011-2/+0
| | | | | | | | | | | | | | | Repeating the default WARNS here makes it slightly more difficult to experiment with default WARNS changes, e.g. if we did something absolutely bananas and introduced a WARNS=7 and wanted to try lifting the default to that. Drop most of them; there is one in the blake2 kernel module, but I suspect it should be dropped -- the default WARNS in the rest of the build doesn't currently apply to kernel modules, and I haven't put too much thought into whether it makes sense to make it so. Notes: svn path=/head/; revision=366304
* Fix invalid VHDX generation for image larger than 4GbOleksandr Tymoshenko2020-07-131-4/+4
| | | | | | | | | | | | | - Part of BAT payload location was lost due to invalid BAT entry encoding type (32 bits instead of 64 bits) - The sequence of PB/SB entries in BAT was broken due to off-by-one index check. It worked for smaller than 4Gb because there were no SB entries in BAT. MFC after: 1 day Notes: svn path=/head/; revision=363140
* Revert r362466Baptiste Daroussin2020-06-221-1/+1
| | | | | | | | | Such change should not have happen without prior discussion and review. With hat: transitioning core Notes: svn path=/head/; revision=362488
* Improve wording to be more precise and clear.Hans Petter Selasky2020-06-211-1/+1
| | | | | | | | | | | | No functional change intended. s/Master Boot/Main Boot/ (also called MBR) MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=362466
* Use Fl instead of Ar for long flagsMateusz Piotrowski2020-06-081-5/+5
| | | | | | | | | Also, bump date after r361935. MFC after: 1 week Notes: svn path=/head/; revision=361940
* Add VHDX support to mkimg(1)Oleksandr Tymoshenko2020-06-0828-1/+2510
| | | | | | | | | | | | | | | VHDX is the successor of Microsoft's VHD file format. It increases maximum capacity of the virtual drive to 64TB and introduces features to better handle power/system failures. VHDX is the required format for 2nd generation Hyper-V VMs. Reviewed by: marcel MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D25184 Notes: svn path=/head/; revision=361935
* Allow bootstrapping mkimg on macOS/LinuxAlex Richardson2020-01-161-0/+2
| | | | | | | | | | | On these systems the (u)int64_t typedefs will not be implicitly defined by the previous includes, so include <stdint.h> in the header that uses uint64_t. Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D23202 Notes: svn path=/head/; revision=356790
* Don't compress and uuencode the "hexdump -C" output files. JustMarcel Moolenaar2019-03-09290-6701/+26409
| | | | | | | | | save them with the $FreeBSD$ tag prepended. Changes to these files are now a lot easier to comprehend, which makes diffs also reviewable. Notes: svn path=/head/; revision=344957
* Round # partitions up to fill the last GPT table sectorMarcel Moolenaar2019-03-0526-1094/+1097
| | | | | | | | | | | | | Set the number of partitions entries in the GPT header to a multiple of the number of entries that fit in a sector. PR: 236238 Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D19465 Notes: svn path=/head/; revision=344826
* Remove unneeded headers.Xin LI2019-01-0614-24/+2
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=342813
* Fix a conditional that got mucked up.Benno Rice2018-04-121-2/+2
| | | | | | | Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=332440
* Add the ability to specify absolute and relative offsets to size partitions.Benno Rice2018-04-122-21/+104
| | | | | | | | | | | | | | | | | To create hybrid boot media we want to specify a partition at a known location. This extends the syntax of size partitions to include an optional offset that can be absolute or relative. It also introduces validation to make sure that this hasn't resulted in overlapping partitions. I haven't added this to the file and process partition specifications yet but the mechanics are designed such that if someone comes up with a good way of specifying the offset it will be fairly easy to add in. Reviewed by: imp Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D14916 Notes: svn path=/head/; revision=332436
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Add HAS_TESTS to all Makefiles that are currently using theEnji Cooper2017-08-021-0/+1
| | | | | | | | | `SUBDIR.${MK_TESTS}+= tests` idiom. This is a follow up to r321912. Notes: svn path=/projects/make-check-sandbox/; revision=321914
* Convert traditional ${MK_TESTS} conditional idiom for including testEnji Cooper2017-08-021-3/+1
| | | | | | | | | | | | | | directories to SUBDIR.${MK_TESTS} idiom This is being done to pave the way for future work (and homogenity) in ^/projects/make-check-sandbox . No functional change intended. MFC after: 1 weeks Notes: svn path=/head/; revision=321912
* Update the usr.bin/mkimg golden test output files after ^/head@r319125Enji Cooper2017-05-3124-867/+868
| | | | | | | | | | | | | | | ^/head@r319125 changed the location of the backup pmbr, requiring the output files to be regenerated, since they're binary disk dumps. The output files were regenerated with "make rebase"--fixed in ^/head@r319294. MFC with: r319125, r319294 PR: 219673 Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=319295
* Fix "make rebase" after ^/head@r315776Enji Cooper2017-05-311-3/+4
| | | | | | | | | | | | "make rebase" can be used for rebasing the output files from mkimg after making a change to mkimg. This will come in handy soon, per bug 219673. MFC after: 3 days Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=319294
* Formalize the dependent/dependency relationship for <foo>.gz.uu vs <foo>Enji Cooper2017-05-311-2/+6
| | | | | | | | | | | This helps ensure that the output files are regenerated if the input files change, after the output files have been created. MFC after: 3 days Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=319293
* mkimg: Correct an off by one error in the PMBR sizeEmmanuel Vadot2017-05-291-1/+1
| | | | | | | | | | | The PMBR last sector should be number of sector - 1 (As stated in UEFI Spec 2.6 page 118 table 17). This fixes warning printed by linux tools like parted or fdisk. Sponsored by: Gandi.net Notes: svn path=/head/; revision=319125
* mkimg: Add -C argument to specify maximum capacityEmmanuel Vadot2017-05-102-16/+53
| | | | | | | | | | | | | | | | Add a -C option to specify a maximum capacity for the final image file. It is useful to control the size of the generated image for sdcard or when we will add dynamic size partition. Add --capacity which is a shorthand to define min and max capacity at the same time. Reviewed by: bapt, marcel, wblock (manpages) Sponsored by: Gandi.net Differential Revision: https://reviews.freebsd.org/D10509 Notes: svn path=/head/; revision=318137