My IFB is not working after recent update in the kernel on my Orange Pi Zero 3

Look in the configuration file of the currently running kernel

           zcat /proc/config.gz | grep CONFIG_IFB
           # If the command above doesn't work, try this alternative:
           grep CONFIG_IFB /boot/config-$(uname -r)

# CONFIG_IFB is not set

# CONFIG_IFB is not set

I tried to compile it from source code to add it back, but failed. Anyone can help? I need this for my cake-autorate.sh.
I would like to request CONFIG_IFB=m to be added to the sunxi64 current kernel config in the coming version.

pls try to use English as this is an international forum. For now, I translate parts of your post from Chinese into Englisch.

#!/usr/bin/env bash
###############################################################################
# build_ifb.sh v5.0 — Final, bulletproof IFB builder - Copyright - cmray168
# - Does NOT compress the module (avoids kernel decompression issues)
# - Detects and skips if ifb is already built-in
# - Auto‑adapts API & vermagic, cleans modprobe config
###############################################################################
set -euo pipefail

if [[ $EUID -ne 0 ]]; then
    echo "ERROR: Please run as root (sudo bash $0)"
    exit 1
fi

KVER=$(uname -r)                      # e.g. 6.18.26-current-sunxi64
HEADER_DIR="/lib/modules/$KVER/build"
UTS_FILE="$HEADER_DIR/include/generated/utsrelease.h"
RELEASE_FILE="$HEADER_DIR/include/config/kernel.release"
SKBUFF_H="$HEADER_DIR/include/linux/skbuff.h"
BUILD_DIR="/usr/src/ifb-build"

# Safety: always restore original headers
restore_headers() {
    [[ -f "${UTS_FILE}.bak" ]] && mv -f "${UTS_FILE}.bak" "$UTS_FILE" 2>/dev/null
    [[ -f "${RELEASE_FILE}.bak" ]] && mv -f "${RELEASE_FILE}.bak" "$RELEASE_FILE" 2>/dev/null
}
trap restore_headers EXIT

echo "============================================"
echo " IFB Module Builder v5.0"
echo " Kernel: $KVER"
echo "============================================"

# 1. Dependencies
echo "[1/8] Installing build dependencies..."
apt-get update -qq
apt-get install -y -qq build-essential bc kmod libelf-dev libssl-dev wget xz-utils git

# 2. Ensure kernel headers exist
echo "[2/8] Checking kernel headers..."
if [[ ! -d "$HEADER_DIR" ]]; then
    apt-get install -y -qq linux-headers-current-sunxi64 || true
    if [[ ! -d "$HEADER_DIR" ]]; then
        echo "FATAL: Cannot find kernel headers."
        exit 1
    fi
fi

# 3. Check if ifb is already built‑in
echo "[3/8] Checking if ifb is built-in..."
if [[ -d /sys/module/ifb ]]; then
    echo "✓ ifb is already built into the kernel (not a module)."
    echo "  Creating ifb0 ..."
    ip link add ifb0 type ifb 2>/dev/null || true
    ip link set ifb0 up 2>/dev/null || true
    if ip link show ifb0 up &>/dev/null; then
        echo "  ✓ ifb0 ready!"
    fi
    exit 0
fi

# 4. Extract base kernel version (e.g. 6.1.18)
echo "[4/8] Extracting base kernel version..."
MAKEFILE="$HEADER_DIR/Makefile"
V=$(awk '/^VERSION =/ {print $3}' "$MAKEFILE")
P=$(awk '/^PATCHLEVEL =/ {print $3}' "$MAKEFILE")
S=$(awk '/^SUBLEVEL =/ {print $3}' "$MAKEFILE")
REAL_KV="$V.$P.$S"
MAJOR_MINOR="$V.$P"   # e.g. 6.1
echo "  Base version: $REAL_KV (major.minor: $MAJOR_MINOR)"

# 5. Download ifb.c – exact tag first, then matching stable branch
echo "[5/8] Downloading ifb.c..."
rm -rf "$BUILD_DIR" && mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR"

download_success=0
TAG="v$REAL_KV"
URL_TAG="https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/plain/drivers/net/ifb.c?h=$TAG"
if wget -q --timeout=10 "$URL_TAG" -O ifb.c 2>/dev/null && grep -q "ifb_ri_tasklet" ifb.c; then
    echo "  ✓ Downloaded exact tag $TAG"
    download_success=1
else
    # Fallback 1: the exact major.minor.y branch
    BRANCH="linux-${MAJOR_MINOR}.y"
    URL_BRANCH="https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/plain/drivers/net/ifb.c?h=$BRANCH"
    if wget -q --timeout=10 "$URL_BRANCH" -O ifb.c 2>/dev/null && grep -q "ifb_ri_tasklet" ifb.c; then
        echo "  ✓ Downloaded from stable branch $BRANCH"
        download_success=1
    else
        # Fallback 2: try known longterm branches
        for bb in linux-6.1.y linux-6.6.y linux-6.12.y; do
            URL_BB="https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/plain/drivers/net/ifb.c?h=$bb"
            if wget -q --timeout=10 "$URL_BB" -O ifb.c 2>/dev/null && grep -q "ifb_ri_tasklet" ifb.c; then
                echo "  ⚠ Using fallback branch $bb (may need extra patches)"
                download_success=1
                break
            fi
        done
    fi
fi
[[ $download_success -eq 1 ]] || { echo "FATAL: Cannot download ifb.c"; exit 1; }

# 6. Adapt to your kernel's API
echo "[6/8] Adapting to kernel API..."

# 6a. skb ingress field
if grep -q 'tc_at_ingress' "$SKBUFF_H"; then
    FIELD="tc_at_ingress"
elif grep -q 'from_ingress' "$SKBUFF_H"; then
    FIELD="from_ingress"
elif grep -q 'tc_from_ingress' "$SKBUFF_H"; then
    FIELD="tc_from_ingress"
else
    FIELD=""
fi
if [[ -n "$FIELD" ]]; then
    sed -i "s/\->from_ingress/->$FIELD/g" ifb.c
    sed -i "s/\->tc_from_ingress/->$FIELD/g" ifb.c
    sed -i "s/\->tc_at_ingress/->$FIELD/g" ifb.c
    echo "  skb field set to ->$FIELD"
else
    echo "  WARNING: Could not detect skb field; will try to compile as-is"
fi

# 6b. rtnl_link_unregister (kernel >= 6.4 only)
KERNEL_MAJOR=$(echo "$REAL_KV" | cut -d. -f1)
KERNEL_MINOR=$(echo "$REAL_KV" | cut -d. -f2)
if [[ $KERNEL_MAJOR -gt 6 ]] || { [[ $KERNEL_MAJOR -eq 6 && $KERNEL_MINOR -ge 4 ]]; }; then
    # >=6.4 uses rtnl_link_unregister
    if grep -q '__rtnl_link_unregister' ifb.c; then
        sed -i 's/__rtnl_link_unregister/rtnl_link_unregister/g' ifb.c
        echo "  Patched __rtnl_link_unregister → rtnl_link_unregister"
    fi
else
    # <6.4: keep __rtnl_link_unregister (remove any accidental rtnl_link_unregister)
    sed -i 's/rtnl_link_unregister/__rtnl_link_unregister/g' ifb.c
fi

# 7. Fix vermagic (only if needed)
echo "[7/8] Ensuring vermagic match..."
CURRENT_UTS=$(grep -oP '#define UTS_RELEASE "\K[^"]+' "$UTS_FILE" || true)
if [[ "$CURRENT_UTS" != "$KVER" ]]; then
    cp -f "$UTS_FILE" "${UTS_FILE}.bak"
    sed -i "s/#define UTS_RELEASE \"[^\"]*\"/#define UTS_RELEASE \"$KVER\"/" "$UTS_FILE"
    echo "  ✓ utsrelease.h patched ($CURRENT_UTS → $KVER)"
    if [[ -f "$RELEASE_FILE" ]]; then
        cp -f "$RELEASE_FILE" "${RELEASE_FILE}.bak"
        echo -n "$KVER" > "$RELEASE_FILE"
    fi
else
    echo "  ✓ Already matched"
fi

# 8. Compile
echo "[8/8] Compiling ifb.ko..."
cat <<'EOF' > Makefile
obj-m += ifb.o
KDIR := /lib/modules/$(shell uname -r)/build

all:
	$(MAKE) -C $(KDIR) M=$(PWD) modules
clean:
	$(MAKE) -C $(KDIR) M=$(PWD) clean
EOF

if ! make -j"$(nproc)" 2>&1 | tail -15; then
    echo "FATAL: Compilation failed. See errors above."
    exit 1
fi
[[ -f ifb.ko ]] || { echo "FATAL: Compilation did not produce ifb.ko"; exit 1; }

# 9. Install WITHOUT compression
echo "[9/9] Installing and loading module..."

MODULE_DST="/lib/modules/$KVER/kernel/drivers/net"
mkdir -p "$MODULE_DST"

# Remove any old ifb files (any compression)
rm -f "$MODULE_DST"/ifb.ko "$MODULE_DST"/ifb.ko.xz "$MODULE_DST"/ifb.ko.gz 2>/dev/null || true

# Always install as plain .ko (never compress – avoids kernel decompression bugs)
cp ifb.ko "$MODULE_DST/ifb.ko"
chmod 644 "$MODULE_DST/ifb.ko"

# Clean conflicting modprobe settings
echo "  Cleaning modprobe.d conflicts..."
for f in /etc/modprobe.d/*.conf; do
    [[ -f "$f" ]] || continue
    if grep -q '^options ifb ' "$f" 2>/dev/null; then
        echo "  Removing conflicting options in $f"
        sed -i '/^options ifb /d' "$f"
    fi
done
sed -i 's/^ifb .*/ifb/' /etc/modules 2>/dev/null || true

depmod -a "$KVER" 2>/dev/null || true
rmmod ifb 2>/dev/null || true

# Try to load
if modprobe ifb 2>/dev/null; then
    echo "✓ Loaded via modprobe"
elif insmod "$MODULE_DST/ifb.ko" 2>/dev/null; then
    echo "✓ Loaded via insmod"
else
    echo "FATAL: Could not load module. Running manual test:"
    echo "Command: insmod $MODULE_DST/ifb.ko"
    insmod "$MODULE_DST/ifb.ko" 2>&1 || true
    dmesg | tail -15
    exit 1
fi

# 10. Create ifb0 and persistence
if ! ip link show ifb0 &>/dev/null; then
    ip link add ifb0 type ifb 2>/dev/null || true
fi
ip link set ifb0 up 2>/dev/null || true

cat <<EOF > /etc/systemd/system/ifb-init.service
[Unit]
Description=Initialize IFB interface for CAKE
After=network-pre.target
Before=network.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=-/sbin/modprobe ifb
ExecStartPre=/bin/sleep 1
ExecStart=/sbin/ip link add ifb0 type ifb
ExecStart=/sbin/ip link set ifb0 up
ExecStop=/sbin/ip link del ifb0

[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl enable --now ifb-init.service 2>/dev/null || true

echo ""
echo "============================================"
if ip link show ifb0 up &>/dev/null; then
    echo "✓ SUCCESS – ifb0 is ready"
    ip -brief link show ifb0
else
    echo "⚠ ifb0 not active – run: ip link add ifb0 type ifb && ip link set ifb0 up"
fi
echo "============================================"

Save the script

nano /root/build_ifb.sh

(paste the content above, save with Ctrl+X)

Make executable and run

chmod +x /root/build_ifb.sh
sudo bash /root/build_ifb.sh

Fixed.