Skip to content

Commit

Permalink
Merge common options
Browse files Browse the repository at this point in the history
  • Loading branch information
be32826 committed Jan 19, 2024
1 parent 624afa6 commit 515782f
Show file tree
Hide file tree
Showing 18 changed files with 369 additions and 1,998 deletions.
16 changes: 2 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,7 @@ git push origin v3.1
The CI jobs will then build your release and make it available at `https://github.com/panda-re/linux_builder/releases/download/<TAG-NAME>/kernels-latest.tar.gz`

## Modifying configs
If you'd like to add a given option or set of options to all configs, you can do something like:

```sh
# Write your config options into delta.txt

# Apply delta
for cfg in config.*; do cat delta.txt >> $cfg; done

# Run linter as shown below

# Commit changes
git commit -a
```
If you'd like to add a given option or set of options to all configs, you can add it to [configs/all-common.inc](configs/all-common.inc).

## Linting configs
Before commiting any config update you MUST lint your change by running `./build.sh --config-only`. You can specify architectures to lint with the `--targets` flag, e.g., `./build.sh --config-only --targets "armel mipel"`.
Before commiting any config update you MUST lint your change by running `./build.sh --config-only`. You can specify architectures to lint with the `--targets` flag, e.g., `./build.sh --config-only --targets "armel mipel"`. If the lint fails, build.sh will exit with non-zero status and print a diff containing the problems.
18 changes: 9 additions & 9 deletions _in_container_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -eu

# We want to build linux for each of our targets and versions using the config files. Linux is in /app/linux/[version]
# while our configs are at config.[arch]. We need to set the ARCH and CROSS_COMPILE variables
# while our configs are at configs/[arch]. We need to set the ARCH and CROSS_COMPILE variables
# and put the binaries in /app/binaries

# Get options from build.sh
Expand Down Expand Up @@ -49,27 +49,27 @@ for TARGET in $TARGETS; do
short_arch="mips"
fi

CROSS=$(get_cc $TARGET)

echo "Building $BUILD_TARGETS for $TARGET"

if [ ! -f "/app/config.${TARGET}" ]; then
if [ ! -f "/app/configs/${TARGET}" ]; then
echo "No config for $TARGET"
exit 1
fi
mkdir -p "/tmp/build/${VERSION}/${TARGET}"
cp "/app/config.${TARGET}" "/tmp/build/${VERSION}/${TARGET}/.config"
cpp -P -undef "/app/configs/${TARGET}" -o "/tmp/build/${VERSION}/${TARGET}/.config"

# Actually build
echo "Building kernel for $TARGET"
make -C /app/linux/$VERSION ARCH=${short_arch} CROSS_COMPILE=$(get_cc $TARGET) O=/tmp/build/${VERSION}/${TARGET}/ olddefconfig

# If updating configs, lint them with kernel first! This sorts, removes default options and duplicates.
if $CONFIG_ONLY; then
echo "Updating $TARGET config in place"
make -C /app/linux/$VERSION ARCH=${short_arch} CROSS_COMPILE=$(get_cc $TARGET) O=/tmp/build/${VERSION}/${TARGET}/ savedefconfig
cp /tmp/build/${VERSION}/${TARGET}/defconfig /app/config.${TARGET}
echo "Finished update for config.${TARGET}"
make -C /app/linux/$VERSION ARCH=${short_arch} CROSS_COMPILE=$CROSS O=/tmp/build/${VERSION}/${TARGET}/ savedefconfig
diff -u <(sort /tmp/build/${VERSION}/${TARGET}/.config) <(sort /tmp/build/${VERSION}/${TARGET}/defconfig | sed '/^[ #]/d')
else
make -C /app/linux/$VERSION ARCH=${short_arch} CROSS_COMPILE=$(get_cc $TARGET) O=/tmp/build/${VERSION}/${TARGET}/ $BUILD_TARGETS -j$(nproc)
make -C /app/linux/$VERSION ARCH=${short_arch} CROSS_COMPILE=$CROSS O=/tmp/build/${VERSION}/${TARGET}/ olddefconfig
make -C /app/linux/$VERSION ARCH=${short_arch} CROSS_COMPILE=$CROSS O=/tmp/build/${VERSION}/${TARGET}/ $BUILD_TARGETS -j$(nproc)

mkdir -p /kernels/$VERSION

Expand Down
Loading

0 comments on commit 515782f

Please sign in to comment.