Debian Codegraph @

README

raw
1 flash-kernel
2 ------------
3
4 flash-kernel is a script which will put the kernel and initramfs in
5 the boot location of embedded devices that don't load the kernel and
6 initramfs directly from /boot. flash-kernel supports devices that
7 boot from flash memory (hence the name) as well as some devices that
8 require a special boot image on the disk.
9
10 Check the Database file db/all.db (in the source package) or
11 /usr/share/flash-kernel/db/all.db (in the installed package) for supported
12 machines.
13
14 If you would like to see support for another device, please file a bug
15 report in the Debian Bug Tracking System and include all information
16 related to the boot process of your device. Instructions can be found
17 at https://bugs.debian.org/ . Alternatively prepare a Merge Request on
18 https://salsa.debian.org/ .
19
20
21 Testsuite
22 - - - - -
23
24 Run the testsuite with:
25 FK_CHECKOUT=. ./test_db
26 FK_CHECKOUT=. ./test_flash-kernel
27 FK_CHECKOUT=. ./test_functions
28
29 You need the devscripts package for the checkbashisms test.
30
31
32 Database format
33 - - - - - - - -
34
35 To accommodate the differences between machines, db/*.db files contain
36 information on supported machines. The files look somewhat like
37 RFC 2822 data or Debian control data, i.e. header: value pairs,
38 with definitions separated by an empty line. Comments starting with a
39 pound are ignored.
40
41 /etc/flash-kernel/db is parsed first and allows for local override of
42 any field. Note that you must include the "Machine" field (including
43 multiple instances if necessary) here as well as the field(s) to be
44 overridden.
45
46 The supported fields are:
47
48 * Machine: (required) value of the "Hardware:" line in /proc/cpuinfo
49 or content of /proc/device-tree/model. Used as a unique
50 identifier. Must be the first field in each stanza. There can be
51 multiple instances of this field (to support system which have both
52 cpuinfo:Hardware and device-tree based identifiers depending on the
53 current kernel) but all instances of the Machine: field must come
54 before any other field in the stanza.
55
56 * Kernel-Flavors: (optional) allowed flavors (suffixes) for the to be
57 installed kernel; if the vmlinuz file doesn't end with a listed
58 suffix, installation is aborted
59
60 * Machine-Id: (optional) linux mach-type to set before starting vmlinuz;
61 will be set by a small piece of ARM code prepended to the kernel image.
62 This option is ignored if a DTB is to be appended, via either DTB-Append or
63 DTB-Append-From.
64
65 * DTB-Id: (optional) specifies the name of the DTB file for this device.
66 If DTB-Id specifies an absolute path the directory specifies the path from
67 where the DTB is copied.
68 If DTB-Id specifies a relative path the directory specifies the subdirectory
69 of the kernel version directory where the DTB will be installed.
70 The filename is used to search for the filename in subdirectories of
71 /usr/lib/linux-image-* or /etc/flash-kernel/dtbs.
72 If the value begins with a `!' then the field is a script which should be
73 run. The script must produce the DTB filename (possibly including a
74 directory) on stdout.
75
76 * DTB-Append: (optional) when yes the DTB specified by DTB-Id will be appended
77 to the kernel image.
78
79 * DTB-Append-From: (optional): Can be used instead of DTB-Append. The argument
80 is a kernel version, if the kernel to be installed is at least this version
81 then the DTB specified named by DTB-Id will be appended to the kernel image.
82 When adding or updating this field remember to consider whether the kernel
83 will require an update to its versioned Breaks: on flash-kernel.
84
85 * U-Boot-Kernel-Address, U-Boot-Kernel-Entry-Point, U-Boot-Initrd-Address:
86 (optional) address where to load in (physical) RAM the kernel, entry point
87 and initrd, respectively; this also indicates that U-Boot images should be
88 generated with mkimage
89
90 * U-Boot-Script-Address: (optional) like U-Boot-Kernel-Address and
91 U-Boot-Initrd-Address but for an U-Boot boot script; see also
92 U-Boot-Script-Name
93
94 * U-Boot-Script-Name: (optional) name of U-Boot boot script to install
95 from the flash-kernel files. @@KERNEL_VERSION@@ will be substituted for the
96 actual kernel version
97
98 * Boot-Kernel-Path, Boot-Initrd-Path: (optional) where to put the
99 generated kernel and initrd files on the filesystem; see also
100 Boot-Device
101
102 * Boot-Kernel-Path-Version, Boot-Initrd-Path-Version, Boot-DTB-Path-Version:
103 (optional) if "yes" appends the kernel version to files created with
104 Boot-Kernel-Path, Boot-Initrd-Path and Boot-DTB-Path.
105
106 * Boot-Script-Path: (optional) like Boot-Kernel-Path and
107 Boot-Initrd-Path but for an U-Boot boot script; see also
108 U-Boot-Script-Name and Boot-Device
109
110 * Boot-DTB-Path: (optional) like Boot-Kernel-Path and Boot-Initrd-Path
111 but for a DTB file. The DTB file named by DTB-Id will be copied
112 here; see also DTB-Id
113
114 * Mtd-Kernel, Mtd-Initrd: (optional) Specifies the raw MTD partition
115 name (per /proc/mtd) to use for the kernel and initrd respectively.
116
117 * Required-Packages: (optional) list of packages which must be added
118 during installer phase for flash-kernel to work properly; failure to
119 add these packages aborts the installation
120
121 * Optional-Packages: (optional) list of packages which should be
122 added during installer phase for flash-kernel to offer full
123 functionality; failure to add these packages just triggers a warning
124
125 * Bootloader-Sets-Incorrect-Root: (optional) when "yes" indicates that
126 the bootloader passes a root= value to the kernel and that this
127 should be overridden in the initrd; when "no", flash-kernel only sets
128 a default value for the root device, which allows end-users to pass
129 root= to the kernel.
130
131 * Method: (optional) indicates how to support this particular machine;
132 the default is "generic"; other available methods are: android, bootspec,
133 multi, redboot, slug, symlink and olpc
134
135 * Boot-Device: (optional) block device to mount before installing
136 kernel, initrd and U-Boot script; Boot-Kernel-Path, Boot-Initrd-Path and
137 Boot-Script-Path are then taken relative to this boot device
138
139
140 Configuration
141 - - - - - - -
142
143 Configuration files currently supported:
144 * /etc/flash-kernel/machine allows skipping the machine auto-detection from
145 /proc/cpuinfo or /proc/dtmodel and forcing a specific Machine.
146
147 * /etc/flash-kernel/db allows overriding / adding fields from the Machine
148 database (but it doesn't allow removing fields or entries).
149
150 * /etc/flash-kernel/dtbs (directory). If a DTB matching DTB-Id is
151 found here then it will be used in preference to the one shipped by
152 the kernel being installed.
153
154 * /etc/flash-kernels/bootscript (directory). The files referenced via
155 the Boot-Script-Name field are installed here.
156
157 * /etc/flash-kernel/ubootenv.d and /etc/flash-kernel/preboot.d can be used to
158 add or override u-boot script snippets. See "Adding U-Boot Commands for
159 Pre-Boot Execution" below for more details.
160
161 * /etc/default/flash-kernel currently contains the following variables:
162 - LINUX_KERNEL_CMDLINE, which should be used by bootscripts to set kernel
163 options, overriding the firmwares defaults (e.g. u-boot's ${bootargs}).
164 - LINUX_KERNEL_CMDLINE_DEFAULTS, which should be used by bootscripts to set
165 kernel options which should be overrideable by the firmware's defaults
166 (e.g. u-boot's ${bootargs}).
167 - NO_CREATE_DOT_BAK_FILES, which if set to "true" or "yes" will
168 prevent flash-kernel from creating backup ".bak" versions of
169 kernel, initrd, and dtb files when installing a new version. The
170 default is to create such backups to aid in recovery from
171 failed updates. If this option is enabled then more complex
172 methods or specialised hardware (e.g. JTAG) may be required to
173 recover.
174 - MTD_BACKUP_DIR, which if set, names a directory to which
175 flash-kernel will write copies of files which would not normally
176 be accessible in the regular filesystem (either written to a
177 rawflash partition or to a firmware partition which is not
178 normally mounted). If unset defaults to
179 /var/backups/flash-kernel. Set to "none" to disable.
180
181 Adding U-Boot Commands for Pre-Boot Execution
182 - - - - - - - - - - - - - - - - - - - - - - -
183
184 Packages can drop in files containing U-Boot commands to be executed by a
185 platform's bootscript before starting the OS. These files should be
186 dropped in /usr/share/flash-kernel/ubootenv.d and
187 /usr/share/flash-kernel/preboot.d. Users can add additional
188 stubs, or override stubs provided by packages, by adding files to
189 /etc/flash-kernel/ubootenv.d and /etc/flash-kernel/preboot.d. Files in the
190 /etc path that have the same name as files in the /usr path will override the
191 /usr counterparts.
192
193 Platform bootscripts must contain the @@UBOOT_ENV_EXTRA@@ and
194 @@UBOOT_PREBOOT_EXTRA@@ macros for the contents of these stubs to be
195 incorporated.