1GENERATE-PACKAGE-NOTES(1) General Commands Manual GENERATE-PACKAGE-NOTES(1)
2
3
4
6 generate-package-notes - generate a linker script for package metadata
7
9 generate-package-notes [OPTION...]
10
12 ELF binaries get stamped with a unique, build-time generated hex string
13 identifier called build-id, which gets embedded as an ELF note called
14 .note.gnu.build-id. In most cases, this allows to associate a stripped
15 binary with its debugging information. It is used, for example, to dy‐
16 namically fetch DWARF symbols from a debuginfo server, or to query the
17 local package manager and find out the package metadata or, again, the
18 DWARF symbols or program sources.
19
20 However, this usage of the build-id requires either local metadata,
21 usually set up by the package manager, or access to a remote server
22 over the network. Both of those might be unavailable or forbidden.
23
24 Thus it becomes desirable to add additional metadata to a binary at
25 build time, so that systemd-coredump(8) and other services analyzing
26 core files are able to extract said metadata simply from the core file
27 itself, without external dependencies. The metadata is embedded in a
28 single ELF header section, in a key-value JSON format.
29
30 The metadata format is intentionally left open, so that vendors can add
31 their own information. A set of well-known keys is defined in the doc‐
32 ument Package Metadata for Core Files
33 ⟨https://systemd.io/COREDUMP_PACKAGE_METADATA/⟩, and hopefully shared
34 among all vendors.
35
36 generate-package-notes generates a linker script on standard output,
37 which can then be used at build time via
38 LDFLAGS="-Wl,-dT,/path/to/generated/script" to include the note in the
39 binary. If a Debian package is built using the dh(1) sequencer, the
40 generation can be partly automated using dh_package_notes(1).
41
43 --package-type=TYPE
44 Set the key type to TYPE. This defaults to package, but for De‐
45 bian packages it should be set to deb.
46
47 --package-name=NAME
48 Set the key name to NAME. This defaults to the empty string,
49 but for Debian packages it should be set to the name of the bi‐
50 nary package containing the binary.
51
52 --package-version=VERSION
53 Set the key version to VERSION. This defaults to the empty
54 string, but for Debian packages it should be set to the Debian
55 version of the binary package containing the binary.
56
57 --package-architecture=ARCHITECTURE
58 Set the key architecture to ARCHITECTURE. This defaults to the
59 empty string, but for Debian packages it should be set to the
60 Debian architecture identifier of the binary.
61
62 --cpe=CPE
63 Set the key osCpe to CPE. This defaults to the value of the
64 CPE_NAME field in the first of /etc/os-release or
65 /usr/lib/os-release that exists. Otherwise the key osCpe is
66 omitted in the note.
67
68 --rpm=PACKAGE-VERSION
69 Set the keys type to rpm, name to PACKAGE, and version to VER‐
70 SION. Overrides --package-type, --package-name, --package-ar‐
71 chitecture, and --package-version.
72
73 --debug-info-url=URL
74 Set the key debugInfoUrl to URL. By default this key is omit‐
75 ted, but for Debian packages it should be set to the official
76 Debian debuginfod server address https://debuginfod.debian.org/.
77
78 -h, --help
79 Show a short help message and exit.
80
82 dh_package_notes(1), systemd-coredump(8), Package Metadata for Core
83 Files ⟨https://systemd.io/COREDUMP_PACKAGE_METADATA/⟩
84
85
86
87 May 2021 GENERATE-PACKAGE-NOTES(1)