mirror of
https://github.com/linuxboot/heads.git
synced 2025-02-20 17:22:53 +00:00
modules/ coreboot+linux: add helpers to edit config in place + save in oldconfig/defconfig formats
both linux/coreboot: - save_in_defconfig_format_in_place : takes whatever coreboot config file for a make BOARD=xyz statement and saves it in defconfig - save_in_oldefconfig_format_in_place : takes whatever coreboot config file for a make BOARD=xyz statement and saves it in oldefconfig linux: - linux.prompt_for_new_config_options_for_kernel_version_bump: - The most useful helper as of now when doing kernel version bump. - Requires to save current kernel config in oldconfig (make BOARD=xyz linux.save_in_oldefconfig_format_in_place) first, then bump kernel version in board config and then use that helper to review new options and save in tree.
This commit is contained in:
parent
c84a0f7e9c
commit
13daaa1203
@ -140,42 +140,43 @@ endif
|
||||
#
|
||||
# Helpful target for reconfiguring the coreboot target
|
||||
#
|
||||
coreboot.menuconfig:
|
||||
coreboot.save_in_defconfig_format_in_place:
|
||||
mkdir -p "$(build)/$(coreboot_dir)" && \
|
||||
cp "$(pwd)/$(CONFIG_COREBOOT_CONFIG)" "$(build)/$(coreboot_dir)/.config" && \
|
||||
$(MAKE) \
|
||||
-C "$(build)/$(coreboot_base_dir)" \
|
||||
DOTCONFIG="$(build)/$(coreboot_dir)/.config" \
|
||||
menuconfig
|
||||
|
||||
# The config file in the repo is stored as a "defconfig" format
|
||||
# which only includes the options that have changed from the defaults.
|
||||
coreboot.saveconfig:
|
||||
olddefconfig && \
|
||||
$(MAKE) \
|
||||
-C "$(build)/$(coreboot_base_dir)" \
|
||||
DOTCONFIG="$(build)/$(coreboot_dir)/.config" \
|
||||
savedefconfig && \
|
||||
mv "$(build)/$(coreboot_base_dir)/defconfig" "$(pwd)/$(CONFIG_COREBOOT_CONFIG)"
|
||||
|
||||
coreboot.save_in_oldconfig_format_in_place:
|
||||
mkdir -p "$(build)/$(coreboot_dir)" && \
|
||||
cp "$(pwd)/$(CONFIG_COREBOOT_CONFIG)" "$(build)/$(coreboot_dir)/.config" && \
|
||||
$(MAKE) \
|
||||
-C "$(build)/$(coreboot_base_dir)" \
|
||||
DOTCONFIG="$(build)/$(coreboot_dir)/.config" \
|
||||
olddefconfig \
|
||||
&& mv "$(build)/$(coreboot_dir)/.config" "$(pwd)/$(CONFIG_COREBOOT_CONFIG)"
|
||||
|
||||
coreboot.modify_defconfig_in_place:
|
||||
mkdir -p "$(build)/$(coreboot_dir)" && \
|
||||
cp "$(pwd)/$(CONFIG_COREBOOT_CONFIG)" "$(build)/$(coreboot_dir)/.config" && \
|
||||
$(MAKE) \
|
||||
-C "$(build)/$(coreboot_base_dir)" \
|
||||
DOTCONFIG="$(build)/$(coreboot_dir)/.config" \
|
||||
menuconfig \
|
||||
&& $(MAKE) \
|
||||
-C "$(build)/$(coreboot_base_dir)" \
|
||||
DOTCONFIG="$(build)/$(coreboot_dir)/.config" \
|
||||
DEFCONFIG="$(pwd)/$(CONFIG_COREBOOT_CONFIG)" \
|
||||
savedefconfig
|
||||
|
||||
coreboot.save_defconfig_in_place:
|
||||
$(MAKE) \
|
||||
-C "$(build)/$(coreboot_base_dir)" \
|
||||
DOTCONFIG="$(pwd)/$(CONFIG_COREBOOT_CONFIG)" \
|
||||
DEFCONFIG="$(build)/$(coreboot_dir)/defconfig" \
|
||||
savedefconfig \
|
||||
&& mv "$(build)/$(coreboot_dir)/defconfig" "$(pwd)/$(CONFIG_COREBOOT_CONFIG)"
|
||||
|
||||
|
||||
coreboot.modify_and_save_defconfig_in_place:
|
||||
$(MAKE) \
|
||||
-C "$(build)/$(coreboot_base_dir)" \
|
||||
DOTCONFIG="$(pwd)/$(CONFIG_COREBOOT_CONFIG)" \
|
||||
menuconfig \
|
||||
&& $(MAKE) \
|
||||
-C "$(build)/$(coreboot_base_dir)" \
|
||||
DOTCONFIG="$(pwd)/$(CONFIG_COREBOOT_CONFIG)" \
|
||||
DEFCONFIG="$(pwd)/$(CONFIG_COREBOOT_CONFIG)" \
|
||||
savedefconfig \
|
||||
|
||||
coreboot.modify_and_save_oldconfig_in_place:
|
||||
mkdir -p "$(build)/$(coreboot_dir)" && \
|
||||
$(MAKE) menuconfig \
|
||||
-C "$(build)/$(coreboot_base_dir)" \
|
||||
obj="$(build)/$(coreboot_dir)" \
|
||||
|
108
modules/linux
108
modules/linux
@ -71,6 +71,7 @@ $(INSTALL)/include/linux/limits.h: $(build)/$(linux_base_dir)/.canary
|
||||
-C "$(build)/$(linux_base_dir)" \
|
||||
ARCH="$(LINUX_ARCH)" \
|
||||
INSTALL_HDR_PATH="$(INSTALL)" \
|
||||
CROSS_COMPILE="$(CROSS)" \
|
||||
O="$(linux_dir)" \
|
||||
KCONFIG_CONFIG="$(pwd)/$(linux_kconfig)" \
|
||||
headers_install
|
||||
@ -207,10 +208,9 @@ $(build)/$(BOARD)/$(LINUX_IMAGE_FILE).bundled: \
|
||||
@touch $@ # force a timestamp update
|
||||
@sha256sum "$@" | tee -a "$(HASHES)"
|
||||
|
||||
# modify_and_save_defconfig_in_place target allows us edit current in tree defconfig config
|
||||
# modify_and_save_defconfig_in_place target allows us edit current in tree config
|
||||
# under linux decompressed+patched directory through menuconfig
|
||||
# and put it back in git tree to check changes with git difftool iteratively
|
||||
# Useful for development cycle of linux kernel version bumps if stored in defconfig format.
|
||||
linux.modify_and_save_defconfig_in_place:
|
||||
cp "$(pwd)/$(linux_kconfig)" "$(build)/$(linux_dir)/.config" && \
|
||||
$(MAKE) \
|
||||
@ -227,10 +227,9 @@ linux.modify_and_save_defconfig_in_place:
|
||||
savedefconfig \
|
||||
&& mv "$(build)/$(linux_dir)/defconfig" "$(pwd)/$(linux_kconfig)"
|
||||
|
||||
# modify_and_save_oldconfig_in_place target allows us edit current config in oldconfig format
|
||||
# modify_and_save_oldconfig_in_place target allows us edit current in tree config
|
||||
# under linux decompressed+patched directory through menuconfig
|
||||
# and put it back in git tree to check changes with git difftool iteratively
|
||||
# Useful for development cycle of linux kernel version bumps if stored in oldconfig format.
|
||||
linux.modify_and_save_oldconfig_in_place:
|
||||
mkdir -p "$(build)/$(linux_dir)" \
|
||||
&& cp "$(pwd)/$(linux_kconfig)" "$(build)/$(linux_dir)/.config" \
|
||||
@ -246,85 +245,60 @@ linux.modify_and_save_oldconfig_in_place:
|
||||
olddefconfig \
|
||||
&& mv "$(build)/$(linux_dir)/.config" "$(pwd)/$(linux_kconfig)"
|
||||
|
||||
# generate_old_config target allows us to copy current in git tree defconfig
|
||||
# into decompressed linux directory's .config file. This permits
|
||||
# us to edit that .config file and remove unneeded stuff prior
|
||||
# of calling save_defconfig target from heads main directory (cd -)
|
||||
# to store it where the board expects it stored and used from.
|
||||
linux.generate_old_config:
|
||||
#Add some tooling to permit us to keep track of what we currently use.
|
||||
# save_in_defconfig_format_in_place: regenerate a defconfig from current board linux config and overwrites it
|
||||
# save_in_versioned_defconfig_format: same as avove but doesn't overwrite: writes it in seperate versioned file
|
||||
# same for oldconfig
|
||||
linux.save_in_defconfig_format_in_place:
|
||||
mkdir -p "$(build)/$(linux_dir)" \
|
||||
&& cp "$(pwd)/$(linux_kconfig)" "$(build)/$(linux_dir)/.config" \
|
||||
&& $(MAKE) -C "$(build)/$(linux_base_dir)" \
|
||||
O="$(build)/$(linux_dir)" \
|
||||
ARCH="$(LINUX_ARCH)" \
|
||||
CROSS_COMPILE="$(CROSS)" \
|
||||
olddefconfig \
|
||||
&& echo "" \
|
||||
&& echo "You can now edit $(build)/$(linux_dir)/.config" \
|
||||
&& echo "Either:" \
|
||||
&& echo " Manually through text editor" \
|
||||
&& echo " Through make BOARD=XYZ linux.menuconfig" \
|
||||
&& echo "" \
|
||||
&& echo "To save chances in git tree for review, type:" \
|
||||
&& echo "make BOARD=XYZ linux.saveconfig"
|
||||
linux.generate_and_save-versioned-oldconfig:
|
||||
savedefconfig \
|
||||
&& mv "$(build)/$(linux_dir)/defconfig" "$(pwd)/$(linux_kconfig)"
|
||||
|
||||
linux.save_in_versioned_defconfig_format:
|
||||
mkdir -p "$(build)/$(linux_dir)" \
|
||||
&& cp "$(pwd)/$(linux_kconfig)" "$(build)/$(linux_dir)/.config" \
|
||||
&& $(MAKE) -C "$(build)/$(linux_base_dir)" \
|
||||
O="$(build)/$(linux_dir)" \
|
||||
ARCH="$(LINUX_ARCH)" \
|
||||
CROSS_COMPILE="$(CROSS)" \
|
||||
olddefconfig \
|
||||
savedefconfig \
|
||||
&& mv "$(build)/$(linux_dir)/defconfig" "$(pwd)/$(linux_kconfig)_defconfig_$(CONFIG_LINUX_VERSION)"
|
||||
|
||||
linux.save_in_oldconfig_format_in_place:
|
||||
mkdir -p "$(build)/$(linux_dir)" \
|
||||
&& cp "$(pwd)/$(linux_kconfig)" "$(build)/$(linux_dir)/.config" \
|
||||
&& $(MAKE) -C "$(build)/$(linux_base_dir)" \
|
||||
O="$(build)/$(linux_dir)" \
|
||||
ARCH="$(LINUX_ARCH)" \
|
||||
CROSS_COMPILE="$(CROSS)" \
|
||||
oldconfig \
|
||||
&& mv "$(build)/$(linux_dir)/.config" "$(pwd)/$(linux_kconfig)"
|
||||
|
||||
linux.save_in_versioned_oldconfig:
|
||||
mkdir -p "$(build)/$(linux_dir)" \
|
||||
&& cp "$(pwd)/$(linux_kconfig)" "$(build)/$(linux_dir)/.config" \
|
||||
&& $(MAKE) -C "$(build)/$(linux_base_dir)" \
|
||||
O="$(build)/$(linux_dir)" \
|
||||
ARCH="$(LINUX_ARCH)" \
|
||||
CROSS_COMPILE="$(CROSS)" \
|
||||
oldefconfig \
|
||||
&& mv "$(build)/$(linux_dir)/.config" "$(pwd)/$(linux_kconfig)_oldconfig_$(CONFIG_LINUX_VERSION)"
|
||||
|
||||
# menuconfig target allows us to easily reconfigure this Linux kernel
|
||||
# Afterwards make linux.saveconfig to generate a minimal config from it
|
||||
linux.menuconfig:
|
||||
$(MAKE) \
|
||||
-C "$(build)/$(linux_base_dir)" \
|
||||
O="$(build)/$(linux_dir)" \
|
||||
ARCH="$(LINUX_ARCH)" \
|
||||
CROSS_COMPILE="$(CROSS)" \
|
||||
menuconfig \
|
||||
|
||||
#Add some tooling to permit us to keep track of what we currently use.
|
||||
# regenerate_and_save_defconfig: regenerate a defconfig from current board linux config and overwrites it
|
||||
# regenerate_and_save_versioned_defconfig : same as avove but doesn't overwrite: writes it in seperate versioned file
|
||||
linux.regenerate_and_save_defconfig:
|
||||
# Prior of attempting to bump kernel version, call make BOARD=xyz linux.save_in_oldconfig_format_in_place
|
||||
# Then bump board config's CONFIG_LINUX_VERSION. build as usual to extract new linux tarball.
|
||||
# Then call make BOARD=xyz linux.prompt_for_new_config_options_for_kernel_version_bump
|
||||
#The following ask new config choice for all new symbols that should be evaluated prior of creating PR
|
||||
# Tip: Open a browser at https://www.kernelconfig.io/index.html
|
||||
linux.prompt_for_new_config_options_for_kernel_version_bump:
|
||||
mkdir -p "$(build)/$(linux_dir)" \
|
||||
&& cp "$(pwd)/$(linux_kconfig)" "$(build)/$(linux_dir)/.config" \
|
||||
&& $(MAKE) -C "$(build)/$(linux_base_dir)" \
|
||||
O="$(build)/$(linux_dir)" \
|
||||
ARCH="$(LINUX_ARCH)" \
|
||||
CROSS_COMPILE="$(CROSS)" \
|
||||
savedefconfig \
|
||||
&& mv "$(build)/$(linux_dir)/defconfig" "$(pwd)/$(linux_kconfig)"
|
||||
linux.regenerate_and_save_versioned_defconfig:
|
||||
mkdir -p "$(build)/$(linux_dir)" \
|
||||
&& cp "$(pwd)/$(linux_kconfig)" "$(build)/$(linux_dir)/.config" \
|
||||
&& $(MAKE) -C "$(build)/$(linux_base_dir)" \
|
||||
O="$(build)/$(linux_dir)" \
|
||||
ARCH="$(LINUX_ARCH)" \
|
||||
savedefconfig \
|
||||
&& mv "$(build)/$(linux_dir)/defconfig" "$(pwd)/$(linux_kconfig)_defconfig_$(CONFIG_LINUX_VERSION)"
|
||||
|
||||
# The config file in the repo is stored as a "defconfig" format
|
||||
# which only includes the options that have changed from the defaults.
|
||||
# Here dave_defconfig takes .config under extracted linux dir and save it back to where board expects it
|
||||
linux.save_defconfig:
|
||||
$(MAKE) \
|
||||
-C "$(build)/$(linux_base_dir)" \
|
||||
O="$(build)/$(linux_dir)" \
|
||||
ARCH="$(LINUX_ARCH)" \
|
||||
CROSS_COMPILE="$(CROSS)" \
|
||||
savedefconfig \
|
||||
&& mv "$(build)/$(linux_dir)/defconfig" "$(pwd)/$(linux_kconfig)"
|
||||
#Same as above, but instead of overwriting the board's expected file, we store it in a file versioned by kernel version
|
||||
linux.save_versioned_defconfig:
|
||||
$(MAKE) \
|
||||
-C "$(build)/$(linux_base_dir)" \
|
||||
O="$(build)/$(linux_dir)" \
|
||||
ARCH="$(LINUX_ARCH)" \
|
||||
CROSS_COMPILE="$(CROSS)" \
|
||||
savedefconfig \
|
||||
&& mv "$(build)/$(linux_dir)/defconfig" "$(pwd)/$(linux_kconfig)_defconfig_$(CONFIG_LINUX_VERSION)"
|
||||
oldconfig \
|
||||
&& mv "$(build)/$(linux_dir)/.config" "$(pwd)/$(linux_kconfig)"
|
||||
|
Loading…
x
Reference in New Issue
Block a user