fix: create tmp directories to prevent opkg lock file errors

During firmware image creation, opkg tries to create a lock file in the
staging root filesystem's /tmp directory, but this directory doesn't
always exist, causing the build to fail at the final packaging stage.

Error:
  opkg_conf_load: Could not create lock file
  .../root.orig-mvebu//tmp/opkg.lock: No such file or directory
  ERROR: target/linux failed to build

Solution:
- Create tmp directories in all staging root filesystems before build
- Apply fix in both parallel and single-threaded build paths
- Use wildcard patterns to catch all target architectures

Changes:
- local-build.sh: Create tmp dirs before and during retry
- build-secubox-images.yml: Create tmp dirs in workflow
- .gitignore: Ignore build artifacts (openwrt/, local-feed/, .vscode/)

This ensures the build can complete the final image packaging step
successfully, generating the firmware images.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2025-12-24 18:03:13 +01:00
parent 3a2150d822
commit 804b93a4ff
3 changed files with 21 additions and 0 deletions

View File

@ -455,6 +455,9 @@ jobs:
START_TIME=$(date +%s) START_TIME=$(date +%s)
# Ensure staging directories exist to prevent opkg lock file errors
mkdir -p build_dir/target-*/root*/tmp 2>/dev/null || true
# Build with explicit profile specification to ensure images are generated # Build with explicit profile specification to ensure images are generated
if make -j$(nproc) PROFILE="${{ matrix.profile }}" V=s 2>&1 | tee build.log; then if make -j$(nproc) PROFILE="${{ matrix.profile }}" V=s 2>&1 | tee build.log; then
END_TIME=$(date +%s) END_TIME=$(date +%s)
@ -483,6 +486,9 @@ jobs:
echo "Retrying with -j1 (single thread) for better stability..." echo "Retrying with -j1 (single thread) for better stability..."
echo "" echo ""
# Ensure staging directories exist before retry
mkdir -p build_dir/target-*/root*/tmp 2>/dev/null || true
if make -j1 PROFILE="${{ matrix.profile }}" V=s 2>&1 | tee build-retry.log; then if make -j1 PROFILE="${{ matrix.profile }}" V=s 2>&1 | tee build-retry.log; then
END_TIME=$(date +%s) END_TIME=$(date +%s)
DURATION=$((END_TIME - START_TIME)) DURATION=$((END_TIME - START_TIME))

5
.gitignore vendored
View File

@ -2,3 +2,8 @@
secubox-tools/sdk/ secubox-tools/sdk/
secubox-tools/cache/ secubox-tools/cache/
secubox-tools/build/ secubox-tools/build/
secubox-tools/openwrt/
secubox-tools/local-feed/
# IDE settings
.vscode/

View File

@ -1068,6 +1068,11 @@ build_firmware_image() {
print_header "Compiling Firmware (This may take 1-2 hours)" print_header "Compiling Firmware (This may take 1-2 hours)"
echo "" echo ""
# Create necessary directories to avoid opkg lock file errors
# Find all root directories and ensure tmp subdirectories exist
find build_dir -type d -name "root.orig-*" -exec mkdir -p {}/tmp \; 2>/dev/null || true
find build_dir -type d -name "root-*" -exec mkdir -p {}/tmp \; 2>/dev/null || true
# Build with explicit PROFILE # Build with explicit PROFILE
if make -j$(nproc) PROFILE="$FW_PROFILE" V=s 2>&1 | tee build.log; then if make -j$(nproc) PROFILE="$FW_PROFILE" V=s 2>&1 | tee build.log; then
local end_time=$(date +%s) local end_time=$(date +%s)
@ -1078,6 +1083,11 @@ build_firmware_image() {
print_success "Build completed in ${minutes}m ${seconds}s" print_success "Build completed in ${minutes}m ${seconds}s"
else else
print_error "Parallel build failed, retrying single-threaded..." print_error "Parallel build failed, retrying single-threaded..."
# Ensure staging directories exist before retry
find build_dir -type d -name "root.orig-*" -exec mkdir -p {}/tmp \; 2>/dev/null || true
find build_dir -type d -name "root-*" -exec mkdir -p {}/tmp \; 2>/dev/null || true
if make -j1 PROFILE="$FW_PROFILE" V=s 2>&1 | tee build-retry.log; then if make -j1 PROFILE="$FW_PROFILE" V=s 2>&1 | tee build-retry.log; then
local end_time=$(date +%s) local end_time=$(date +%s)
local duration=$((end_time - start_time)) local duration=$((end_time - start_time))