Skip to content

Commit 33b7265

Browse files
committed
coreboot+linux modules: add helpers to edit config, save in oldconfig/defconfig
1 parent 8ff4b9a commit 33b7265

File tree

2 files changed

+100
-13
lines changed

2 files changed

+100
-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_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: 75 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -206,34 +206,53 @@ $(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_defconfig_menuconfig 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 in defconfig stored format.
213+
linux.modify_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+
linux.modify_and_save_oldconfig_in_place:
230+
mkdir -p "$(build)/$(linux_dir)" \
231+
&& cp "$(pwd)/$(linux_kconfig)" "$(build)/$(linux_dir)/.config" \
232+
&& $(MAKE) -C "$(build)/$(linux_base_dir)" \
233+
O="$(build)/$(linux_dir)" \
234+
ARCH="$(LINUX_ARCH)" \
235+
CROSS_COMPILE="$(CROSS)" \
236+
menuconfig \
237+
&& $(MAKE) -C "$(build)/$(linux_base_dir)" \
238+
O="$(build)/$(linux_dir)" \
239+
ARCH="$(LINUX_ARCH)" \
240+
CROSS_COMPILE="$(CROSS)" \
241+
olddefconfig \
242+
&& mv "$(build)/$(linux_dir)/.config" "$(pwd)/$(linux_kconfig)"
226243

227-
# generateoldconfig target allows us to copy current in git tree defconfig
244+
# generate_old_config target allows us to copy current in git tree defconfig
228245
# into decompressed linux directory's .config file. This permits
229246
# us to edit that .config file and remove unneeded stuff prior
230-
# of calling saveconfig target from heads main directory (cd -)
231-
linux.generateoldconfig:
247+
# of calling save_defconfig target from heads main directory (cd -)
248+
# to store it where the board expects it stored and used from.
249+
linux.generate_old_config:
232250
mkdir -p "$(build)/$(linux_dir)" \
233251
&& cp "$(pwd)/$(linux_kconfig)" "$(build)/$(linux_dir)/.config" \
234252
&& $(MAKE) -C "$(build)/$(linux_base_dir)" \
235253
O="$(build)/$(linux_dir)" \
236254
ARCH="$(LINUX_ARCH)" \
255+
CROSS_COMPILE="$(CROSS)" \
237256
olddefconfig \
238257
&& echo "" \
239258
&& echo "You can now edit $(build)/$(linux_dir)/.config" \
@@ -243,6 +262,15 @@ linux.generateoldconfig:
243262
&& echo "" \
244263
&& echo "To save chances in git tree for review, type:" \
245264
&& echo "make BOARD=XYZ linux.saveconfig"
265+
linux.generate_and_save-versioned-oldconfig:
266+
mkdir -p "$(build)/$(linux_dir)" \
267+
&& cp "$(pwd)/$(linux_kconfig)" "$(build)/$(linux_dir)/.config" \
268+
&& $(MAKE) -C "$(build)/$(linux_base_dir)" \
269+
O="$(build)/$(linux_dir)" \
270+
ARCH="$(LINUX_ARCH)" \
271+
CROSS_COMPILE="$(CROSS)" \
272+
olddefconfig \
273+
&& mv "$(build)/$(linux_dir)/.config" "$(pwd)/$(linux_kconfig)_oldconfig_$(CONFIG_LINUX_VERSION)"
246274

247275
# menuconfig target allows us to easily reconfigure this Linux kernel
248276
# Afterwards make linux.saveconfig to generate a minimal config from it
@@ -251,14 +279,48 @@ linux.menuconfig:
251279
-C "$(build)/$(linux_base_dir)" \
252280
O="$(build)/$(linux_dir)" \
253281
ARCH="$(LINUX_ARCH)" \
282+
CROSS_COMPILE="$(CROSS)" \
254283
menuconfig \
255284

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

0 commit comments

Comments
 (0)