From 0fce215ebc61a162e95e745d42eb87849cd0b85d Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Tue, 9 Oct 2018 18:32:12 -0400 Subject: Allow multiple config files when building Coreboot The base configuration for a given board can be overriden by config files (also named "config") placed into target-specific subdirectories. These additional configurations are read and passed to make as arguments, overriding their counterparts in the base config file; consquently, commented lines should not be added to these configs. R400/T400/T500/W500 ROMs may now be built for 4/8/16mb flash chip sizes. --- projects/coreboot/coreboot | 15 ++++++++++++--- projects/coreboot/coreboot-helper | 4 ++++ 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'projects/coreboot') diff --git a/projects/coreboot/coreboot b/projects/coreboot/coreboot index a8e13d8f..48da5939 100755 --- a/projects/coreboot/coreboot +++ b/projects/coreboot/coreboot @@ -66,7 +66,7 @@ build() { local sources_path=$(project_sources_path "$project" "$repository" "$board" "$@") local build_path=$(project_build_path "$project" "$board" "$@") - local config_path=$(coreboot_config_path "$board" "$@") + local base_config_path=$(coreboot_config_path "$board" "$@") local variant_config_path="$(coreboot_variant_config_path "$board" "$@")" local arch=$(coreboot_arch "$board" "$@") @@ -75,8 +75,17 @@ build() { local crossgcc_bin_path="$crossgcc_build_path/bin/" local vboot_sources_path=$(project_sources_path "vboot" "vboot" "devices") + local -i base_config_line_count="$(wc -l < "$base_config_path")" + local -a base_config_overrides local -a board_variant_config + # To only get overrides, trim out base config since + # we cannot skip it in project_file_contents_herit() + mapfile -t base_config_overrides \ + < <(tail -n +$(($base_config_line_count+1)) \ + < <(coreboot_config "$board" "$@") \ + 2>/dev/null) + mapfile -t board_variant_config < "$variant_config_path" if git_project_check "$repository" @@ -90,8 +99,8 @@ build() { mkdir -p "$build_path" - make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" XGCCPATH="$crossgcc_bin_path" BUILD_TIMELESS=1 KERNELVERSION="$VERSION" KBUILD_DEFCONFIG="$config_path" "${board_variant_config[@]}" "defconfig" - make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" XGCCPATH="$crossgcc_bin_path" BUILD_TIMELESS=1 KERNELVERSION="$VERSION" VBOOT_SOURCE="$vboot_sources_path" "${board_variant_config[@]}" -j$TASKS + make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" XGCCPATH="$crossgcc_bin_path" BUILD_TIMELESS=1 KERNELVERSION="$VERSION" KBUILD_DEFCONFIG="$base_config_path" "${board_variant_config[@]}" "${base_config_overrides[@]}" "defconfig" + make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" XGCCPATH="$crossgcc_bin_path" BUILD_TIMELESS=1 KERNELVERSION="$VERSION" VBOOT_SOURCE="$vboot_sources_path" "${board_variant_config[@]}" "${base_config_overrides[@]}" -j$TASKS rm -f "$sources_path/.xcompile" } diff --git a/projects/coreboot/coreboot-helper b/projects/coreboot/coreboot-helper index ad696a16..d32ccb67 100755 --- a/projects/coreboot/coreboot-helper +++ b/projects/coreboot/coreboot-helper @@ -25,6 +25,10 @@ coreboot_arch() { project_file_contents "$project" "$CONFIGS" "$ARCH" "$@" } +coreboot_config() { + project_file_contents_herit "$project" "$CONFIGS" "$CONFIG" "$@" +} + coreboot_config_path() { project_file_path "$project" "$CONFIGS" "$CONFIG" "$@" } -- cgit v1.2.3-70-g09d2