Skip to content

Commit a29c277

Browse files
committed
coreboot+linux modules: add modules target helpers to edit configs (oldconfig/defconfig)
Most useful to me are: coreboot.modify_and_save_defconfig_in_place coreboot.modify_and_save_oldconfig_in_place linux.modify_and_save_oldconfig_in_place linux.modify_and_save_defconfig_in_place Which permit to take current in tree configs and translate them into other format. This is useful when trying to version bump and build. Also add helpers to save in versioned version to facilitate change tracking: linux.generate_and_save-versioned-oldconfig linux.regenerate_and_save_versioned_defconfig
1 parent 8ff4b9a commit a29c277

File tree

2 files changed

+103
-13
lines changed

2 files changed

+103
-13
lines changed

modules/coreboot

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,31 @@ coreboot.saveconfig:
147147
DEFCONFIG="$(pwd)/$(CONFIG_COREBOOT_CONFIG)" \
148148
savedefconfig
149149

150+
coreboot.save_defconfig_in_place:
151+
$(MAKE) \
152+
-C "$(build)/$(coreboot_base_dir)" \
153+
DOTCONFIG="$(pwd)/$(CONFIG_COREBOOT_CONFIG)" \
154+
DEFCONFIG="$(build)/$(coreboot_dir)/defconfig" \
155+
savedefconfig \
156+
&& mv "$(build)/$(coreboot_dir)/defconfig" "$(pwd)/$(CONFIG_COREBOOT_CONFIG)"
157+
158+
159+
coreboot.modify_and_save_defconfig_in_place:
160+
$(MAKE) \
161+
-C "$(build)/$(coreboot_base_dir)" \
162+
DOTCONFIG="$(pwd)/$(CONFIG_COREBOOT_CONFIG)" \
163+
menuconfig \
164+
&& $(MAKE) \
165+
-C "$(build)/$(coreboot_base_dir)" \
166+
DOTCONFIG="$(pwd)/$(CONFIG_COREBOOT_CONFIG)" \
167+
DEFCONFIG="$(pwd)/$(CONFIG_COREBOOT_CONFIG)" \
168+
savedefconfig \
169+
170+
coreboot.modify_and_save_oldconfig_in_place:
171+
$(MAKE) menuconfig \
172+
-C "$(build)/$(coreboot_base_dir)" \
173+
obj="$(build)/$(coreboot_dir)" \
174+
DOTCONFIG="$(pwd)/$(CONFIG_COREBOOT_CONFIG)"
150175

151176
# if we are not building from a git checkout,
152177
# we must also download the coreboot-blobs tree

modules/linux

Lines changed: 78 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -206,34 +206,57 @@ $(build)/$(BOARD)/$(LINUX_IMAGE_FILE).bundled: \
206206
@touch $@ # force a timestamp update
207207
@sha256sum "$@" | tee -a "$(HASHES)"
208208

209-
# modifydefconfig target allows us edit current in tree defconfig config
210-
# under linux decompressed+patched directory and put it back in git tree
211-
# to check changes with git difftool
212-
# useful for development cycle of linux kernel version bumps.
213-
linux.modifydefconfig:
209+
# modify_and_save_defconfig_in_place target allows us edit current in tree defconfig config
210+
# under linux decompressed+patched directory through menuconfig
211+
# and put it back in git tree to check changes with git difftool iteratively
212+
# Useful for development cycle of linux kernel version bumps if stored in defconfig format.
213+
linux.modify_and_save_defconfig_in_place:
214214
cp "$(pwd)/$(linux_kconfig)" "$(build)/$(linux_dir)/.config" && \
215215
$(MAKE) \
216216
-C "$(build)/$(linux_base_dir)" \
217217
O="$(build)/$(linux_dir)" \
218218
ARCH="$(LINUX_ARCH)" \
219+
CROSS_COMPILE="$(CROSS)" \
219220
menuconfig && \
220221
$(MAKE) \
221222
-C "$(build)/$(linux_base_dir)" \
222223
O="$(build)/$(linux_dir)" \
223224
ARCH="$(LINUX_ARCH)" \
224-
savedefconfig && \
225-
mv "$(build)/$(linux_dir)/defconfig" "$(pwd)/$(linux_kconfig)"
225+
CROSS_COMPILE="$(CROSS)" \
226+
savedefconfig \
227+
&& mv "$(build)/$(linux_dir)/defconfig" "$(pwd)/$(linux_kconfig)"
228+
229+
# modify_and_save_oldconfig_in_place target allows us edit current config in oldconfig format
230+
# under linux decompressed+patched directory through menuconfig
231+
# and put it back in git tree to check changes with git difftool iteratively
232+
# Useful for development cycle of linux kernel version bumps if stored in oldconfig format.
233+
linux.modify_and_save_oldconfig_in_place:
234+
mkdir -p "$(build)/$(linux_dir)" \
235+
&& cp "$(pwd)/$(linux_kconfig)" "$(build)/$(linux_dir)/.config" \
236+
&& $(MAKE) -C "$(build)/$(linux_base_dir)" \
237+
O="$(build)/$(linux_dir)" \
238+
ARCH="$(LINUX_ARCH)" \
239+
CROSS_COMPILE="$(CROSS)" \
240+
menuconfig \
241+
&& $(MAKE) -C "$(build)/$(linux_base_dir)" \
242+
O="$(build)/$(linux_dir)" \
243+
ARCH="$(LINUX_ARCH)" \
244+
CROSS_COMPILE="$(CROSS)" \
245+
olddefconfig \
246+
&& mv "$(build)/$(linux_dir)/.config" "$(pwd)/$(linux_kconfig)"
226247

227-
# generateoldconfig target allows us to copy current in git tree defconfig
248+
# generate_old_config target allows us to copy current in git tree defconfig
228249
# into decompressed linux directory's .config file. This permits
229250
# us to edit that .config file and remove unneeded stuff prior
230-
# of calling saveconfig target from heads main directory (cd -)
231-
linux.generateoldconfig:
251+
# of calling save_defconfig target from heads main directory (cd -)
252+
# to store it where the board expects it stored and used from.
253+
linux.generate_old_config:
232254
mkdir -p "$(build)/$(linux_dir)" \
233255
&& cp "$(pwd)/$(linux_kconfig)" "$(build)/$(linux_dir)/.config" \
234256
&& $(MAKE) -C "$(build)/$(linux_base_dir)" \
235257
O="$(build)/$(linux_dir)" \
236258
ARCH="$(LINUX_ARCH)" \
259+
CROSS_COMPILE="$(CROSS)" \
237260
olddefconfig \
238261
&& echo "" \
239262
&& echo "You can now edit $(build)/$(linux_dir)/.config" \
@@ -243,6 +266,15 @@ linux.generateoldconfig:
243266
&& echo "" \
244267
&& echo "To save chances in git tree for review, type:" \
245268
&& echo "make BOARD=XYZ linux.saveconfig"
269+
linux.generate_and_save-versioned-oldconfig:
270+
mkdir -p "$(build)/$(linux_dir)" \
271+
&& cp "$(pwd)/$(linux_kconfig)" "$(build)/$(linux_dir)/.config" \
272+
&& $(MAKE) -C "$(build)/$(linux_base_dir)" \
273+
O="$(build)/$(linux_dir)" \
274+
ARCH="$(LINUX_ARCH)" \
275+
CROSS_COMPILE="$(CROSS)" \
276+
olddefconfig \
277+
&& mv "$(build)/$(linux_dir)/.config" "$(pwd)/$(linux_kconfig)_oldconfig_$(CONFIG_LINUX_VERSION)"
246278

247279
# menuconfig target allows us to easily reconfigure this Linux kernel
248280
# Afterwards make linux.saveconfig to generate a minimal config from it
@@ -251,14 +283,47 @@ linux.menuconfig:
251283
-C "$(build)/$(linux_base_dir)" \
252284
O="$(build)/$(linux_dir)" \
253285
ARCH="$(LINUX_ARCH)" \
286+
CROSS_COMPILE="$(CROSS)" \
254287
menuconfig \
255288

289+
#Add some tooling to permit us to keep track of what we currently use.
290+
# regenerate_and_save_defconfig: regenerate a defconfig from current board linux config and overwrites it
291+
# regenerate_and_save_versioned_defconfig : same as avove but doesn't overwrite: writes it in seperate versioned file
292+
linux.regenerate_and_save_defconfig:
293+
mkdir -p "$(build)/$(linux_dir)" \
294+
&& cp "$(pwd)/$(linux_kconfig)" "$(build)/$(linux_dir)/.config" \
295+
&& $(MAKE) -C "$(build)/$(linux_base_dir)" \
296+
O="$(build)/$(linux_dir)" \
297+
ARCH="$(LINUX_ARCH)" \
298+
CROSS_COMPILE="$(CROSS)" \
299+
savedefconfig \
300+
&& mv "$(build)/$(linux_dir)/defconfig" "$(pwd)/$(linux_kconfig)"
301+
linux.regenerate_and_save_versioned_defconfig:
302+
mkdir -p "$(build)/$(linux_dir)" \
303+
&& cp "$(pwd)/$(linux_kconfig)" "$(build)/$(linux_dir)/.config" \
304+
&& $(MAKE) -C "$(build)/$(linux_base_dir)" \
305+
O="$(build)/$(linux_dir)" \
306+
ARCH="$(LINUX_ARCH)" \
307+
savedefconfig \
308+
&& mv "$(build)/$(linux_dir)/defconfig" "$(pwd)/$(linux_kconfig)_defconfig_$(CONFIG_LINUX_VERSION)"
309+
256310
# The config file in the repo is stored as a "defconfig" format
257311
# which only includes the options that have changed from the defaults.
258-
linux.saveconfig:
312+
# Here dave_defconfig takes .config under extracted linux dir and save it back to where board expects it
313+
linux.save_defconfig:
314+
$(MAKE) \
315+
-C "$(build)/$(linux_base_dir)" \
316+
O="$(build)/$(linux_dir)" \
317+
ARCH="$(LINUX_ARCH)" \
318+
CROSS_COMPILE="$(CROSS)" \
319+
savedefconfig \
320+
&& mv "$(build)/$(linux_dir)/defconfig" "$(pwd)/$(linux_kconfig)"
321+
#Same as above, but instead of overwriting the board's expected file, we store it in a file versioned by kernel version
322+
linux.save_versioned_defconfig:
259323
$(MAKE) \
260324
-C "$(build)/$(linux_base_dir)" \
261325
O="$(build)/$(linux_dir)" \
262326
ARCH="$(LINUX_ARCH)" \
263-
savedefconfig
264-
mv "$(build)/$(linux_dir)/defconfig" "$(pwd)/$(linux_kconfig)"
327+
CROSS_COMPILE="$(CROSS)" \
328+
savedefconfig \
329+
&& mv "$(build)/$(linux_dir)/defconfig" "$(pwd)/$(linux_kconfig)_defconfig_$(CONFIG_LINUX_VERSION)"

0 commit comments

Comments
 (0)