Forum Discussion
Here’s a script to extract a current kernel .config, minimize it using make savedefconfig, and create a custom defconfig you can reuse for your SoCFPGA ARM64 board (e.g., Agilex or Stratix 10).
Example reference script:
#!/bin/bash
# Variables — customize these
ARCH=arm64
DEFCONFIG_NAME=socfpga_agilex_defconfig
KERNEL_SOURCE_DIR=~/linux-socfpga # Change to your kernel source path
# Step 1: Extract running config from target board
echo "[*] Extracting config from /proc/config.gz..."
zcat /proc/config.gz > config_from_target
# Step 2: Copy to kernel source tree
echo "[*] Copying to source tree..."
cp config_from_target $KERNEL_SOURCE_DIR/.config
# Step 3: Minimize it using savedefconfig
cd $KERNEL_SOURCE_DIR
make ARCH=$ARCH savedefconfig
# Step 4: Rename and store the result
cp defconfig arch/$ARCH/configs/$DEFCONFIG_NAME
echo "[✔] Defconfig created at: arch/$ARCH/configs/$DEFCONFIG_NAME"
This script gives you a clean starting point without the bloat of unrelated SoCs and boards.