A comprehensive system for building custom Linux-based operating systems using BuildRoot with proper CI/CD, testing, and extensibility for multiple machine architectures.
- Linux development environment (Ubuntu/Debian recommended)
- Basic build tools (make, gcc, git, etc.)
- At least 8GB RAM and 20GB disk space for builds
# Clone the repository
git clone https://github.com/your-username/linux-kernel-playground.git
cd linux-kernel-playground
# Install dependencies (Ubuntu/Debian)
make install-deps
# Download BuildRoot source
make download
# Build default configuration (generic x86_64)
make build# Make the script executable
chmod +x build.sh
# Build with the script
./build.sh generic_x86_64_defconfig
# Build with options
./build.sh --clean --menuconfig --test generic_x86_64_defconfig- generic_x86_64_defconfig - Generic x86_64 system suitable for QEMU and modern hardware
- Kernel: 6.6.21
- Features: SystemD, X11, Desktop environment, Development tools
- Use case: Development, testing, virtual machines
- raspberrypi4_64_defconfig - Raspberry Pi 4 (64-bit) optimized configuration
- Kernel: 6.6.21 with RPi patches
- Features: GPU acceleration, Camera support, WiFi/Bluetooth, Desktop
- Use case: Raspberry Pi 4 single-board computers
# List all available configurations
make list-configs
# Build specific configuration
make build-raspberrypi4_64_defconfig
# Clean build directory
make clean
# Run menuconfig to customize configuration
make menuconfig
# Test built image with QEMU (x86_64 only)
make test
# Show project information
make info# Show help
./build.sh --help
# Build with clean start and menuconfig
./build.sh --clean --menuconfig generic_x86_64_defconfig
# Build and test with QEMU
./build.sh --test generic_x86_64_defconfig
# Download only (no build)
./build.sh --download-only generic_x86_64_defconfig
# Build with custom parallel jobs
./build.sh --jobs 8 generic_x86_64_defconfiglinux-kernel-playground/
βββ buildroot-configs/ # Custom BuildRoot configurations
β βββ x86_64/ # x86_64 specific configs
β β βββ generic_x86_64_defconfig
β βββ arm64/ # ARM64 specific configs
β β βββ raspberrypi4_64_defconfig
β βββ board/ # Board-specific files
β β βββ x86_64/
β β β βββ linux.config
β β βββ raspberrypi4/
β β β βββ linux.config
β β β βββ config.txt
β β β βββ boot.txt
β β βββ post_build.sh
β βββ system/ # System-wide configurations
β β βββ device_table.txt
β βββ package/ # Package configurations
β βββ busybox/
β βββ busybox.config
βββ .github/workflows/ # CI/CD workflows
β βββ buildroot.yml
βββ build.sh # Build script
βββ Makefile # Makefile for development
βββ README.md # This file
# Build and test x86_64 configuration
make build-generic_x86_64_defconfig
make test
# Or using the build script
./build.sh --test generic_x86_64_defconfig
# Run different test suites
make test-basic # Basic boot and system health tests
make test-network # Include network connectivity tests
make test-full # Comprehensive testing with package management
make test-interactive # Interactive QEMU session for manual testing
# Using the dedicated test scripts
./test-ci.sh --arch x86_64 --suite basic --timeout 300 buildroot-2024.02.1/output
./test-qemu.sh --arch x86_64 --test-type ssh --verbose buildroot/output/images/bzImage buildroot/output/images/rootfs.ext2The project includes comprehensive QEMU testing:
Basic Tests:
- System boot verification
- Login prompt availability
- System process checks
- Filesystem mounting verification
- Hello World execution
Network Tests:
- All basic tests plus:
- Network interface configuration
- IP address assignment
- DNS resolution testing
Full Tests:
- All network tests plus:
- SSH service accessibility
- Package management verification
- System performance testing
- Memory usage monitoring
- System logging verification
Interactive Testing:
- Full SSH access to the running system
- Manual testing and exploration
- Real-time system monitoring
The GitHub Actions workflow automatically:
- Validates all configuration files
- Builds all configurations in parallel
- Tests x86_64 images with QEMU
- Runs security scans
- Generates build reports
- Comments on pull requests with results
# Copy an existing configuration
cp buildroot-configs/x86_64/generic_x86_64_defconfig buildroot-configs/x86_64/my_custom_defconfig
# Create board directory if needed
mkdir -p buildroot-configs/board/my_custom
# Copy and modify kernel config
cp buildroot-configs/board/x86_64/linux.config buildroot-configs/board/my_custom/linux.config
# Edit the configuration files
nano buildroot-configs/x86_64/my_custom_defconfig
nano buildroot-configs/board/my_custom/linux.config# Build base configuration
make build-generic_x86_64_defconfig
# Run menuconfig to customize
cd buildroot-2024.02.1
make menuconfig
# Save your configuration
make savedefconfig
# Copy the generated defconfig to your project
cp defconfig ../buildroot-configs/x86_64/my_custom_defconfigEach defconfig should include:
- Architecture selection (BR2_x86_64, BR2_aarch64, etc.)
- Toolchain configuration
- Kernel configuration
- Package selection
- Filesystem settings
- Bootloader configuration
Edit the board-specific kernel config:
nano buildroot-configs/board/<arch>/linux.configModify the defconfig to add/remove packages:
# Add a package
BR2_PACKAGE_<PACKAGE_NAME>=y
# Remove a package
# BR2_PACKAGE_<PACKAGE_NAME>=yEdit the post-build script:
nano buildroot-configs/board/post_build.shAfter building, you'll find these files in buildroot-<version>/output/images/:
bzImage- Linux kernelrootfs.ext2- Root filesystemrootfs.tar- Root filesystem archive
kernel8.img- 64-bit kernelbcm2711-rpi-4-b.dtb- Device treerootfs.ext2- Root filesystemsdcard.img- Complete SD card image
The project includes a comprehensive version management system:
# Show current version
./version.sh --version
# Bump patch version (v1.0.0 β v1.0.1)
./version.sh --bump patch
# Bump minor version (v1.0.1 β v1.1.0)
./version.sh --bump minor
# Bump major version (v1.1.0 β v2.0.0)
./version.sh --bump major
# Set specific version
./version.sh --set v2.0.0
# Bump version, create tag, and push
./version.sh --bump patch --tag --push- Bump version and create tag:
./version.sh --bump patch --tag --push
- GitHub Actions will automatically create a release
- Create and push a tag:
git tag v1.0.0 git push origin v1.0.0
- GitHub Actions will trigger the release workflow
You can also create releases manually through GitHub Actions:
- Go to Actions β Release BuildRoot Linux OS
- Click "Run workflow"
- Enter version details
- Choose whether to create a pre-release
Each release includes:
- Configuration archives (.tar.gz, .zip) with all build artifacts
- Checksums (SHA256, MD5) for verification
- Build reports with detailed build information
- README files with usage instructions
- QEMU testing results (for applicable configurations)
Release artifacts are available through:
- GitHub Releases: Download from the release page
- GitHub Actions: Download as workflow artifacts
- CI Artifacts: Available for 30 days after build
Always verify downloaded releases:
# Download the checksum file
wget https://github.com/your-repo/releases/download/v1.0.0/sha256sums.txt
# Verify your download
sha256sum -c sha256sums.txtqemu-system-x86_64 \
-m 512M \
-kernel buildroot-2024.02.1/output/images/bzImage \
-hda buildroot-2024.02.1/output/images/rootfs.ext2 \
-append "root=/dev/sda console=ttyS0" \
-nographic# Write to SD card
sudo dd if=buildroot-2024.02.1/output/images/sdcard.img of=/dev/sdX bs=1M
# Or manually copy files
sudo cp buildroot-2024.02.1/output/images/* /media/sdcard/boot/-
Build fails with dependency errors
make install-deps
-
QEMU test fails
- Ensure you're using an x86_64 configuration
- Check that bzImage and rootfs.ext2 exist
-
Configuration not found
make list-configs
-
Build takes too long
- Increase parallel jobs:
./build.sh --jobs 16 <config> - Use SSD storage
- Ensure sufficient RAM
- Increase parallel jobs:
- Check the build log:
buildroot-<version>/build.log - Review GitHub Actions build reports
- Open an issue on GitHub
- Fork the repository
- Create a feature branch
- Add your configuration
- Test locally
- Submit a pull request
- Include a clear description of changes
- Test your configuration locally
- Update documentation if needed
- Ensure CI passes
This project is licensed under the MIT License - see the LICENSE file for details.
- BuildRoot project for the excellent build system
- Linux kernel developers
- Raspberry Pi Foundation
- QEMU project for virtualization support