Skip to content

Commit

Permalink
Removed the 'build-all-targets.sh' script and replaced the 'build-bui…
Browse files Browse the repository at this point in the history
…ldroot.sh' script by a more generic one. Also bumped the Buildroot version to 2024.02.

The Buildroot version 2024.02 is the first version providing PPP in version 2.5.0, so a lot of hacks in the Buildroot pppd packages are no more needed.

Signed-off-by: RICCIARDI-Adrien <adrien.ricciardi@hotmail.fr>
  • Loading branch information
RICCIARDI-Adrien committed Mar 27, 2024
1 parent 310faa3 commit efe3d21
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 147 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/generate_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/checkout@v4
- name: Run build script
run: |
bash -x ${{ github.workspace }}/build-buildroot.sh ${{ matrix.defconfig_name }} ${{ matrix.libc_name }} /home/runner
bash -x ${{ github.workspace }}/build-image.sh ${{ matrix.defconfig_name }} ${{ matrix.libc_name }} /home/runner
- name: Archive image
run: |
tar -c ${{ env.BUILDROOT_DIRECTORY_NAME }} -f ${{ env.BUILDROOT_DIRECTORY_NAME }}.tar
Expand Down
48 changes: 0 additions & 48 deletions build-all-targets.sh

This file was deleted.

98 changes: 0 additions & 98 deletions build-buildroot.sh

This file was deleted.

77 changes: 77 additions & 0 deletions build-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/sh

# Exit if any error occurs
set -e

PrintMessage()
{
printf "\033[33m--> $1\033[0m\n"
}

BUILDROOT_VERSION=2024.02

# Check arguments
if [ $# -ne 3 ]
then
echo "Usage : $0 buildroot_defconfig_name libc_name output_directory"
echo " buildroot_defconfig_name : see all available defconfigs here https://git.busybox.net/buildroot/tree/configs?h=${BUILDROOT_VERSION}"
echo " libc_name : must be \"glibc\", \"uclibc\" or \"musl\""
echo " output_directory : will contain the build directory and the final compressed artifacts"
exit 1
fi
DEFCONFIG_NAME="$1"
LIBC_NAME="$2"
OUTPUT_DIRECTORY="$3"

# Create the build directory name
BUILD_DIRECTORY_NAME="buildroot-${DEFCONFIG_NAME}-${LIBC_NAME}"
BUILD_DIRECTORY_PATH=$(realpath "${OUTPUT_DIRECTORY}")/"${BUILD_DIRECTORY_NAME}"

PrintMessage "Removing previous build artifacts..."
rm -rf "${BUILD_DIRECTORY_PATH}"

PrintMessage "Downloading Buildroot sources..."
git clone --depth=1 --branch="${BUILDROOT_VERSION}" https://github.com/buildroot/buildroot "${BUILD_DIRECTORY_PATH}"

PrintMessage "Modifying the PPP Buildroot package to use upstream PPP sources..."
PPP_PACKAGE_PATH="${BUILD_DIRECTORY_PATH}/package/pppd"
# Upstream version always needs OpenSSL
sed -i '/select BR2_PACKAGE_OPENSSL/c\\select BR2_PACKAGE_OPENSSL' ${PPP_PACKAGE_PATH}/Config.in
# Do not check for package hash, so there is no need to compute it
rm ${PPP_PACKAGE_PATH}/pppd.hash
# Buildroot patches are already applied upstream
rm -f ${PPP_PACKAGE_PATH}/*.patch
# Get package sources from head of master branch
LAST_COMMIT_HASH=$(curl -s -H "Accept: application/vnd.github.VERSION.sha" "https://api.github.com/repos/ppp-project/ppp/commits/master")
sed -i "/PPPD_VERSION =/c\\PPPD_VERSION = ${LAST_COMMIT_HASH}" ${PPP_PACKAGE_PATH}/pppd.mk
sed -i '/PPPD_SITE =/c\\PPPD_SITE = https://github.com/ppp-project/ppp' ${PPP_PACKAGE_PATH}/pppd.mk
sed -i '9iPPPD_SITE_METHOD = git' ${PPP_PACKAGE_PATH}/pppd.mk

PrintMessage "Enabling PPP build in Buildroot configuration..."
# Enable all Buildroot PPP options as everything is built by upstream build system
echo "BR2_PACKAGE_PPPD=y" >> ${BUILD_DIRECTORY_PATH}/configs/${DEFCONFIG_NAME}
echo "BR2_PACKAGE_PPPD_FILTER=y" >> ${BUILD_DIRECTORY_PATH}/configs/${DEFCONFIG_NAME}

PrintMessage "Selecting the ${LIBC_NAME} C library..."
case $LIBC_NAME in
"glibc")
echo "BR2_TOOLCHAIN_BUILDROOT_GLIBC=y" >> "${BUILD_DIRECTORY_PATH}/configs/${DEFCONFIG_NAME}"
;;
"uclibc")
echo "BR2_TOOLCHAIN_BUILDROOT_UCLIBC=y" >> "${BUILD_DIRECTORY_PATH}/configs/${DEFCONFIG_NAME}"
;;
"musl")
echo "BR2_TOOLCHAIN_BUILDROOT_MUSL=y" >> "${BUILD_DIRECTORY_PATH}/configs/${DEFCONFIG_NAME}"
;;
*)
echo "Unknown C library, please specify \"glibc\", \"uclibc\" or \"musl\"."
exit 1
;;
esac

PrintMessage "Generating the Buildroot configuration..."
cd "${BUILD_DIRECTORY_PATH}"
make "${DEFCONFIG_NAME}"

PrintMessage "Building the Buildroot image..."
make

0 comments on commit efe3d21

Please sign in to comment.