Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 3.14 #36

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,20 @@ jobs:
strategy:
matrix:
target: [armel, arm64, mipsel, mipseb, mips64el, mips64eb, x86_64]
version: ["4.10"] # XXX: quotes are necessary, otherwise 4.10 -> 4.1
version: ["4.10", "3.14"] # XXX: quotes are necessary, otherwise 4.10 -> 4.1
exclude:
- target: arm64
version: "3.14"
- target: mipsel
version: "3.14"
- target: mipseb
version: "3.14"
- target: mips64el
version: "3.14"
- target: mips64eb
version: "3.14"
- target: x86_64
version: "3.14"

steps:
- uses: actions/checkout@v4 # Clones to $GITHUB_WORKSPACE
Expand Down Expand Up @@ -77,22 +90,32 @@ jobs:
for archive in $(find downloaded-kernels -name "*.tar.gz"); do
tar -xzf "$archive" -C combined-kernels
done

# Combine OSI profiles for each kernel version
# otherwise the extracted kernel configs willc lobber each other
if [ -d combined-kernels/kernels/4.10 ] ; then
for archive in $(find downloaded-kernels -name "*.tar.gz"); do
tar -O -xf "$archive" "kernels/4.10/osi.config";
if tar -tzf "$archive" "kernels/4.10/osi.config" &>/dev/null; then
tar -O -xf "$archive" "kernels/4.10/osi.config";
fi
done > combined-kernels/kernels/4.10/osi.config
fi

if [ -d combined-kernels/kernels/6.7 ] ; then
for archive in $(find downloaded-kernels -name "*.tar.gz"); do
tar -O -xf "$archive" "kernels/6.7/osi.config";
if tar -tzf "$archive" "kernels/6.7/osi.config" &>/dev/null; then
tar -O -xf "$archive" "kernels/6.7/osi.config";
fi
done > combined-kernels/kernels/6.7/osi.config
fi


if [ -d combined-kernels/kernels/3.14 ] ; then
for archive in $(find downloaded-kernels -name "*.tar.gz"); do
if tar -tzf "$archive" "kernels/3.14/osi.config" &>/dev/null; then
tar -O -xf "$archive" "kernels/3.14/osi.config";
fi
done > combined-kernels/kernels/3.14/osi.config
fi

# Create a new single archive from the combined content
tar -czvf kernels-latest.tar.gz -C combined-kernels .
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
path = linux/6.7
url = https://github.com/rehosting/linux.git
branch = main_6.7
[submodule "linux/3.14"]
path = linux/3.14
url = https://github.com/rehosting/linux.git
branch = main_3.14
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,13 @@ RUN apt-get update && apt-get -y install gdb xonsh flex bison libssl-dev

# Get panda for kernelinfo_gdb. Definitely a bit overkill to pull the whole repo
RUN git clone --depth 1 https://github.com/panda-re/panda.git

# Download and build GCC 4.6.2
RUN echo "deb http://dk.archive.ubuntu.com/ubuntu/ xenial main" >> /etc/apt/sources.list
RUN echo "deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe" >> /etc/apt/sources.list
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5 3B4FE6ACC0B21F32
RUN apt-get update -y
RUN apt-get install -y gcc gcc-4.9 gcc-4.9-aarch64-linux-gnu gcc-4.9-arm-linux-gnueabi g++-4.9-arm-linux-gnueabi build-essential wget libncurses5-dev git vim && \
update-alternatives --install /usr/bin/arm-linux-gnueabi-gcc arm-linux-gnueabi-gcc /usr/bin/arm-linux-gnueabi-gcc-4.9 60 && \
update-alternatives --install /usr/bin/arm-linux-gnueabi-g++ arm-linux-gnueabi-g++ /usr/bin/arm-linux-gnueabi-g++-4.9 60 && \
update-alternatives --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-gcc-4.9 60
61 changes: 40 additions & 21 deletions _in_container_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,55 @@ echo "Targets: $TARGETS"

get_cc() {
local arch=$1
local version=$2
local abi=""

# Clear CFLAGS and KCFLAGS if they are set
unset CFLAGS
unset KCFLAGS

if [[ $arch == *"arm64"* ]]; then
abi=""
arch="aarch64"
elif [[ $arch == *"arm"* ]]; then
abi="eabi"
if [[ $arch == *"eb"* ]]; then
export CFLAGS="-mbig-endian"
export KCFLAGS="-mbig-endian"
if [[ $version == "4.10" ]] || [[ $version == "6.7" ]]; then
if [[ $arch == *"arm64"* ]]; then
abi=""
arch="aarch64"
elif [[ $arch == *"arm"* ]]; then
abi="eabi"
if [[ $arch == *"eb"* ]]; then
export CFLAGS="-mbig-endian"
export KCFLAGS="-mbig-endian"
fi
arch="arm"
fi
arch="arm"
echo "/opt/cross/${arch}-linux-musl${abi}/bin/${arch}-linux-musl${abi}-"
elif [[ $version == "2.6" ]]; then
if [[ $arch == *"arm64"* ]]; then
echo "aarch64-linux-gnu-"
elif [[ $arch == *"arm"* ]]; then
echo "arm-linux-gnueabi-"
else
echo "gcc-4.9" #probably not this
fi
elif [[ $version == "3.14" ]]; then
if [[ $arch == *"arm64"* ]]; then
echo "aarch64-linux-gnu-"
elif [[ $arch == *"arm"* ]]; then
echo "arm-linux-gnueabi-"
else
echo "gcc-4.9" #probably not this
fi
else
echo "Unsupported version"
fi
echo "/opt/cross/${arch}-linux-musl${abi}/bin/${arch}-linux-musl${abi}-"
}


for VERSION in $VERSIONS; do
for TARGET in $TARGETS; do
BUILD_TARGETS="vmlinux"
if [ $TARGET == "armel" ]; then
BUILD_TARGETS="vmlinux zImage"
elif [ $TARGET == "arm64" ]; then
BUILD_TARGETS="vmlinux Image.gz"
elif [ $TARGET == "x86_64" ]; then
BUILD_TARGETS="vmlinux bzImage"
fi

# Set short_arch based on TARGET
Expand All @@ -69,24 +89,23 @@ for TARGET in $TARGETS; do
# If updating configs, lint them with kernel first! This removes default options and duplicates.
if $CONFIG_ONLY; then
echo "Linting config for $TARGET to config_${VERSION}_${TARGET}.linted"
make -C /app/linux/$VERSION ARCH=${short_arch} CROSS_COMPILE=$(get_cc $TARGET) O=/tmp/build/${VERSION}/${TARGET}/ savedefconfig
make -C /app/linux/$VERSION ARCH=${short_arch} CROSS_COMPILE=$(get_cc $TARGET $VERSION) O=/tmp/build/${VERSION}/${TARGET}/ savedefconfig
cp "/tmp/build/${VERSION}/${TARGET}/defconfig" "/app/config_${VERSION}_${TARGET}.linted"
diff -u <(sort /tmp/build/${VERSION}/${TARGET}/.config) <(sort /tmp/build/${VERSION}/${TARGET}/defconfig | sed '/^[ #]/d')
else
echo "Building kernel for $TARGET"
make -C /app/linux/$VERSION ARCH=${short_arch} CROSS_COMPILE=$(get_cc $TARGET) O=/tmp/build/${VERSION}/${TARGET}/ olddefconfig
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=$(get_cc $TARGET $VERSION) O=/tmp/build/${VERSION}/${TARGET}/ olddefconfig
CFLAGS=""

make -C /app/linux/$VERSION ARCH=${short_arch} CROSS_COMPILE=$(get_cc $TARGET $VERSION) O=/tmp/build/${VERSION}/${TARGET}/ $BUILD_TARGETS -j$(nproc) EXTRA_CFLAGS="$CFLAGS"

mkdir -p /kernels/$VERSION

# Copy out zImage (if present) and vmlinux (always)
if [ -f "/tmp/build/${VERSION}/${TARGET}/arch/${short_arch}/boot/zImage" ]; then
cp "/tmp/build/${VERSION}/${TARGET}/arch/${short_arch}/boot/zImage" /kernels/$VERSION/zImage.${TARGET}
fi

if [ -f "/tmp/build/${VERSION}/${TARGET}/arch/${short_arch}/boot/bzImage" ]; then
cp "/tmp/build/${VERSION}/${TARGET}/arch/${short_arch}/boot/bzImage" /kernels/$VERSION/bzImage.${TARGET}
fi

# Copy out Image.gz (if present)
if [ -f "/tmp/build/${VERSION}/${TARGET}/arch/${short_arch}/boot/Image.gz" ]; then
Expand All @@ -101,8 +120,8 @@ for TARGET in $TARGETS; do
/kernels/$VERSION/vmlinux.${TARGET} /tmp/panda_profile.${TARGET}
cat /tmp/panda_profile.${TARGET} >> /kernels/$VERSION/osi.config

# strip vmlinux
$(get_cc $TARGET)strip /kernels/$VERSION/vmlinux.${TARGET}
# strip vmlinux
$(get_cc $TARGET $VERSION)strip /kernels/$VERSION/vmlinux.${TARGET}
fi
done
done
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ EOF

# Default options
CONFIG_ONLY=false
#VERSIONS="4.10 6.7"
#VERSIONS="3.14 4.10 6.7"
VERSIONS="4.10"
TARGETS="armeb armel arm64 mipseb mipsel mips64eb mips64el x86_64"

Expand Down
Loading
Loading