1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-15 11:03:37 +03:00
mobile-nixos/bin/kernel-normalize-config
2019-10-02 00:34:05 -04:00

35 lines
835 B
Bash
Executable File

#!/usr/bin/env bash
# This script is expected to be used to copy back the `kernel-builder` built
# linux configuration to the kernel's source directory.
#
# Use this to normalize the configuration after:
#
# - Changing configuration options
# - Changing the kernel version
set -e
set -u
PS4=" $ "
if (( $# != 2 )); then
echo "Usage: bin/kernel-normalize-config <device-name> <output>"
exit 1
fi
device="$1"; shift
out="$1"; shift
set -x
build() {
nix-build --no-out-link -A config.mobile.device.info.kernel --argstr device "$device"
}
# The first one actively rebuilds to get the config...
cp "$(build)/build.config" "$out"
# This one rebuilds with the (assumedly) normalized config
cp "$(build)/build.config" "$out"
# This last copy and build is likely useless. Though it's a quick no-op
cp "$(build)/build.config" "$out"