Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions lib/functions/artifacts/artifact-armbian-bsp-generic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#!/usr/bin/env bash
#
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2013-2023 Igor Pecovnik, [email protected]
#
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/

function artifact_armbian-bsp-generic_config_dump() {
artifact_input_variables[RELEASE]="${RELEASE}"
artifact_input_variables[BRANCH]="${BRANCH}"
}
Comment on lines +10 to +13
Copy link
Contributor

@coderabbitai coderabbitai bot Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, verify the structure of the artifact-armbian-bsp-generic.sh file and check RELEASE usage
cat -n lib/functions/artifacts/artifact-armbian-bsp-generic.sh | head -100

Repository: armbian/build

Length of output: 5015


🏁 Script executed:

# Search for RELEASE usage in bsp-generic related functions
rg -nC3 'RELEASE.*bsp-generic|bsp-generic.*RELEASE' --type=sh

Repository: armbian/build

Length of output: 39


🏁 Script executed:

# Search for any references to RELEASE within the artifact-armbian-bsp-generic.sh file
rg -n 'RELEASE' lib/functions/artifacts/artifact-armbian-bsp-generic.sh

Repository: armbian/build

Length of output: 368


🏁 Script executed:

# Check the version calculation logic (lines 35-43) to confirm RELEASE is not in version hash
sed -n '35,43p' lib/functions/artifacts/artifact-armbian-bsp-generic.sh

Repository: armbian/build

Length of output: 638


🏁 Script executed:

# Check artifact_name logic (around line 78) 
sed -n '75,80p' lib/functions/artifacts/artifact-armbian-bsp-generic.sh

Repository: armbian/build

Length of output: 392


🏁 Script executed:

# Compare with release-specific artifact to understand expected pattern
head -30 lib/functions/artifacts/artifact-armbian-base-files.sh

Repository: armbian/build

Length of output: 1305


Clarify RELEASE usage or remove it from config_dump.

RELEASE is captured as an artifact input variable (line 11) but is never validated (line 16 only checks BRANCH), never included in the version hash (lines 35-43), and never used in the artifact name (line 78). The package is explicitly marked as release-independent (artifact_deb_repo="global" on line 75), and a FIXME comment on line 77 questions whether RELEASE should be included at all ("BRANCH for sure, RELEASE maybe?").

This creates an inconsistency between what's declared as input and what actually affects the artifact. If the generic BSP package should be release-independent, remove RELEASE from config_dump. If it should be release-specific, add validation and include it in the version calculation (as done in artifact-armbian-base-files.sh).

🤖 Prompt for AI Agents
In lib/functions/artifacts/artifact-armbian-bsp-generic.sh around lines 10 to
13, RELEASE is declared in artifact_input_variables but is never validated,
included in the version hash, or used in the artifact name, creating
inconsistency with the package being marked release-independent; either remove
RELEASE from artifact_input_variables/config_dump (if the package must remain
release-independent) or make it release-specific by validating RELEASE in
config_dump, adding it into the version hash calculation (lines ~35-43) exactly
like artifact-armbian-base-files.sh does, and ensure it is considered when
composing the artifact name (line ~78); pick one approach and apply it
consistently, and remove the FIXME if you choose the release-independent path.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not yet clear if it should be release specific or not. waiting on more knowledgeable heads

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tabrisnet, thanks for clarifying! That makes sense given the PR is still under construction. The existing FIXME comment on line 77 ("BRANCH for sure, RELEASE maybe?") already documents this uncertainty nicely.

Once the maintainers provide guidance on whether armbian-bsp-generic should be release-specific or release-independent, feel free to tag me and I can help ensure the implementation is consistent with whichever approach is chosen (updating validation, version hash calculation, and artifact naming accordingly).


🧠 Learnings used
Learnt from: tabrisnet
Repo: armbian/build PR: 8678
File: config/kernel/linux-sm8250-edge.config:80-82
Timestamp: 2025-09-27T21:50:04.845Z
Learning: In the Armbian build system, kernel configuration files are generated through this automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Learnt from: Grippy98
Repo: armbian/build PR: 8202
File: config/desktop/trixie/environments/gnome/armbian/create_desktop_package.sh:2-3
Timestamp: 2025-05-16T15:34:34.672Z
Learning: The shell scripts in the Armbian build system's desktop configuration files, such as config/desktop/trixie/environments/gnome/armbian/create_desktop_package.sh, rely on environment variables like $SRC and $destination that are expected to be set externally before the script is executed.

Learnt from: tabrisnet
Repo: armbian/build PR: 8678
File: config/kernel/linux-sm8250-current.config:78-80
Timestamp: 2025-09-27T21:49:55.796Z
Learning: In the Armbian build system, kernel configuration files are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Learnt from: pyavitz
Repo: armbian/build PR: 8388
File: config/boards/kickpik2b.conf:1-14
Timestamp: 2025-07-17T04:12:33.125Z
Learning: In the Armbian build system, board configuration files (*.conf) follow a project standard of not including shebang lines, even though they contain bash code and are sourced by the build system. This is an established Armbian convention that individual contributors are expected to follow, and changes to this standard would require broader project maintainer approval.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8754
File: config/boards/bestv-r3300-l.csc:14-16
Timestamp: 2025-10-14T05:08:11.785Z
Learning: In the Armbian build system, BOOTBRANCH_BOARD is a valid framework variable used as a fallback when BOOTBRANCH is unset. The framework checks BOOTBRANCH_BOARD before applying the default bootloader branch value (see config/sources/common.conf). Board configuration files can use BOOTBRANCH_BOARD to specify the bootloader branch.

Learnt from: tabrisnet
Repo: armbian/build PR: 8678
File: config/kernel/linux-bcm2711-edge.config:859-861
Timestamp: 2025-09-27T21:47:58.020Z
Learning: In the Armbian build system, kernel configuration files in config/kernel/ are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-08-02T05:46:10.664Z
Learning: In the Armbian build system, the modern recommended approach for kernel configuration is to use the kernel-config command via "./compile.sh BOARD=boardname BRANCH=branchname kernel-config" instead of the deprecated KERNEL_CONFIGURE=yes flag. This provides a two-step workflow: configure using menuconfig, then build, with better transparency and control over configuration changes.

Learnt from: igorpecovnik
Repo: armbian/build PR: 8849
File: config/boards/radxa-e54c.csc:14-28
Timestamp: 2025-11-02T20:49:56.719Z
Learning: In Armbian board configuration files (config/boards/*.conf, *.csc, etc.), do not use kernel_config_set, kernel_config_set_m, kernel_config_set_y, or custom_kernel_config__* functions to modify kernel configuration. Kernel configuration is associated with LINUXFAMILY/BOARDFAMILY, not individual BOARD. Board-specific kernel modifications cause inconsistency in kernel packages published to the apt repository because boards within a family share the same kernel packages. Kernel configuration changes must be made in the appropriate kernel config file (e.g., config/kernel/linux-*-*.config) or in family configuration files (config/sources/families/*.conf, *.inc) instead.

Learnt from: tabrisnet
Repo: armbian/build PR: 8661
File: lib/functions/compilation/armbian-kernel.sh:200-200
Timestamp: 2025-09-22T21:59:36.334Z
Learning: Functions named with the pattern `armbian_kernel_config__*` in lib/functions/compilation/armbian-kernel.sh are automatically discovered and invoked by Armbian's extension system via metaprogramming using `compgen -A function`, without requiring explicit registration or calls.

Learnt from: tabrisnet
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-08-30T06:48:09.091Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the user prefers flexible grep patterns over anchored ones for BTRFS configuration checks, but agrees to use quiet grep (-q) to avoid polluting build logs.

Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-07-21T04:12:02.439Z
Learning: In the Armbian build system, for recurring maintenance tasks like kernel version bumping, TODO comments should use generic version formats (e.g., "MAJOR.MINOR-rc1") rather than specific version numbers (e.g., "6.17-rc1") to avoid the need for frequent comment updates that would create unnecessary maintenance overhead.

Learnt from: tabrisnet
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-10-24T04:46:22.901Z
Learning: In lib/functions/rootfs/rootfs-create.sh, the FIXME comment about mmdebstrap usage with --aptopt is a future note related to PR #8785, which hasn't been merged yet.

Learnt from: igorpecovnik
Repo: armbian/build PR: 9087
File: .github/workflows/pr-check-pictures.yml:138-146
Timestamp: 2025-12-16T13:40:01.143Z
Learning: In the Armbian build repository, when introducing new requirements or checks (like the board assets verification workflow), the project prefers an initial educational-only period where violations post helpful PR comments and warnings but don't block merges. This allows contributors to become familiar with new requirements before enforcement is enabled (typically after ~6 months).

Learnt from: EvilOlaf
Repo: armbian/build PR: 8968
File: patch/u-boot/u-boot-sunxi/arm64-dts-sun50i-h6-orangepi.dtsi-Rollback-r_rsb-to-r_i2c.patch:36-36
Timestamp: 2025-11-20T18:20:11.985Z
Learning: The rewrite-patches tool (REWRITE_PATCHES=yes) in the Armbian build system can inadvertently introduce semantic changes when the u-boot/kernel git base revision differs from expected state. The tool applies patches, commits them, and re-exports them using git format-patch, which can cause the re-exported patch to reflect the base revision's state rather than preserving the original patch intent. This is particularly problematic for device tree changes like interrupt specifications. The tool currently lacks validation mechanisms to detect such semantic drift, and affected patches must be manually corrected after rewriting.

Learnt from: leggewie
Repo: armbian/build PR: 8357
File: config/boards/qcom-robotics-rb5.conf:88-88
Timestamp: 2025-07-04T18:33:19.873Z
Learning: In the Armbian build system, package transitions in Debian/Ubuntu don't happen uniformly across all releases. For example, the transition from plasma-workspace-wayland to plasma-workspace occurred in newer releases like trixie (Debian testing) around July 2024, but older releases like jammy (Ubuntu 22.04) still maintain the original plasma-workspace-wayland package. Release-specific package availability must be considered when updating package references.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8328
File: lib/functions/compilation/patch/drivers_network.sh:542-545
Timestamp: 2025-06-24T10:08:40.313Z
Learning: In the Armbian build system, when a PR removes build support for a specific kernel version, version check issues for that removed version become practically irrelevant even if they appear incorrect in isolation. Context about which kernel versions are being deprecated/removed is important for understanding the impact of version-related code changes.

Learnt from: The-going
Repo: armbian/build PR: 8147
File: config/sources/families/include/sunxi64_common.inc:38-39
Timestamp: 2025-04-30T16:16:47.150Z
Learning: The Armbian build system references Linux kernel versions in the form "tag:v6.14.4" in the KERNELBRANCH variable, even when point release tags might not be directly visible in the upstream repository in the same form.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub or the PR API to get the complete picture of what files are being added or modified.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub API (https://api.github.com/repos/armbian/build/pulls/{pr_number}/files) to get the complete picture of what files are being added or modified, especially for U-Boot patches that will be applied during the build process.

Learnt from: tabrisnet
Repo: armbian/build PR: 9085
File: lib/functions/rootfs/rootfs-create.sh:303-306
Timestamp: 2025-12-16T12:22:12.924Z
Learning: The post_debootstrap_customize hook concept in lib/functions/rootfs/rootfs-create.sh has been tested in PR #9000. The hook placement after package installations (including desktop packages) and before cleanup operations (autoremove, qemu undeploy) is validated as appropriate for rootfs customization.

Learnt from: rpardini
Repo: armbian/build PR: 8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:76-86
Timestamp: 2025-03-31T22:20:48.475Z
Learning: For the Armbian build project, maintaining consistency with existing patches across U-Boot versions (such as between 2025.01 and 2025.04) is prioritized over refactoring individual patches for code improvements.

Learnt from: tabrisnet
Repo: armbian/build PR: 8661
File: lib/functions/compilation/armbian-kernel.sh:194-199
Timestamp: 2025-09-25T18:37:00.330Z
Learning: In PR armbian/build#8661, line 235 of lib/functions/compilation/armbian-kernel.sh already contains the corrected comment "BPF link support for netfilter hooks" for NETFILTER_BPF_LINK, not the misleading "BPF_SYSCALL" comment that was flagged during review.

Learnt from: tabrisnet
Repo: armbian/build PR: 8661
File: lib/functions/compilation/armbian-kernel.sh:194-199
Timestamp: 2025-09-25T18:37:00.330Z
Learning: In PR armbian/build#8661, line 235 of lib/functions/compilation/armbian-kernel.sh already contains the corrected comment "BPF link support for netfilter hooks" for NETFILTER_BPF_LINK, not the misleading "BPF_SYSCALL" comment that was flagged during review.


function artifact_armbian-bsp-generic_prepare_version() {
: "${BRANCH:?BRANCH is not set}"

artifact_version="undetermined" # outer scope
artifact_version_reason="undetermined" # outer scope

declare short_hash_size=4

declare fake_unchanging_base_version="1"

# Generic package has no board/family hooks
declare hash_hooks_short="0000"

# Hash variables that affect the contents of bsp-generic package.
# Those contain /armbian a lot, so don't normalize them.
declare -a vars_to_hash_no_normalize=()
declare hash_variables="undetermined" # will be set by calculate_hash_for_variables(), but without normalization
do_normalize_src_path="no" calculate_hash_for_variables "${vars_to_hash_no_normalize[@]}" # don't normalize
declare hash_vars_no_normalize="${hash_variables}"

declare -a vars_to_hash=(
"KEEP_ORIGINAL_OS_RELEASE: ${KEEP_ORIGINAL_OS_RELEASE:-"no"}" # /etc/os-release
"IMAGE_TYPE: ${IMAGE_TYPE}" # /etc/armbian-release
"hash_vars_no_normalize: ${hash_vars_no_normalize}" # The non-normalized part, above
)
declare hash_variables="undetermined" # will be set by calculate_hash_for_variables(), which normalizes the input
calculate_hash_for_variables "${vars_to_hash[@]}"
declare vars_config_hash="${hash_variables}"
declare var_config_hash_short="${vars_config_hash:0:${short_hash_size}}"
Comment on lines +35 to +43
Copy link
Contributor

@coderabbitai coderabbitai bot Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find lib packages -name "*artifact-armbian-bsp-generic*" -o -name "*bsp-cli-deb*" | head -20

Repository: armbian/build

Length of output: 153


🏁 Script executed:

cat -n lib/functions/artifacts/artifact-armbian-bsp-generic.sh | head -80

Repository: armbian/build

Length of output: 3929


🏁 Script executed:

# Search for KEEP_ORIGINAL_OS_RELEASE usage in the codebase
rg -n "KEEP_ORIGINAL_OS_RELEASE" lib packages --type sh | head -30

Repository: armbian/build

Length of output: 662


🏁 Script executed:

# Check what KEEP_ORIGINAL_OS_RELEASE does in bsp-cli-deb.sh
sed -n '385,395p' lib/functions/bsp/armbian-bsp-cli-deb.sh

Repository: armbian/build

Length of output: 834


🏁 Script executed:

# Search for IMAGE_TYPE in bsp-cli-deb.sh
rg -n "IMAGE_TYPE" lib/functions/bsp/armbian-bsp-cli-deb.sh

Repository: armbian/build

Length of output: 128


🏁 Script executed:

# Check what happens with IMAGE_TYPE in bsp-cli-deb.sh context
sed -n '110,130p' lib/functions/bsp/armbian-bsp-cli-deb.sh

Repository: armbian/build

Length of output: 723


🏁 Script executed:

# Check the broader context of these variables in bsp-cli-deb.sh
sed -n '100,180p' lib/functions/bsp/armbian-bsp-cli-deb.sh

Repository: armbian/build

Length of output: 3372


🏁 Script executed:

# Check if IMAGE_TYPE affects content in the directories used by generic package
rg -r "IMAGE_TYPE" packages/bsp/common/ config/optional/_any_board/_packages/bsp-generic/ --type sh 2>/dev/null | head -20

Repository: armbian/build

Length of output: 39


Remove IMAGE_TYPE from generic BSP package hash — it doesn't affect package content.

Line 37 includes IMAGE_TYPE in vars_to_hash, but IMAGE_TYPE is only metadata written to /etc/armbian-release and is not referenced in the actual package content directories (packages/bsp/common/ or config/optional/_any_board/_packages/bsp-generic/). This causes unnecessary package rebuilds when switching image types, even though the package content is identical. Remove this line unless IMAGE_TYPE actually influences package generation.

🤖 Prompt for AI Agents
In lib/functions/artifacts/artifact-armbian-bsp-generic.sh around lines 35 to
43, remove IMAGE_TYPE from the vars_to_hash array because IMAGE_TYPE is only
metadata written to /etc/armbian-release and does not affect package contents;
delete the "IMAGE_TYPE: ${IMAGE_TYPE}" entry (and any trailing comma/formatting
adjustments) so calculate_hash_for_variables no longer includes IMAGE_TYPE when
computing vars_config_hash, leaving the other entries unchanged.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is IMAGE_TYPE?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find where IMAGE_TYPE is defined/set
rg -n "IMAGE_TYPE=" lib/ --type sh -C3 | head -60

Length of output: 1678


🏁 Script executed:

#!/bin/bash
# Find how IMAGE_TYPE is used throughout the codebase
rg -n "IMAGE_TYPE" lib/ --type sh | head -40

Length of output: 1070


🏁 Script executed:

#!/bin/bash
# Check if there's documentation or comments about IMAGE_TYPE
rg -n "IMAGE_TYPE" lib/ --type sh -B2 -A1 | grep -E "(#|IMAGE_TYPE)" | head -50

Length of output: 2326


🏁 Script executed:

#!/bin/bash
# Look for IMAGE_TYPE in main configuration or compilation files
rg -n "IMAGE_TYPE" lib/functions/main/ lib/functions/compilation/ --type sh -C2 | head -50

Length of output: 1351


@tabrisnet IMAGE_TYPE is a build classification variable set in lib/functions/main/config-prepare.sh based on the BETA parameter. It can have three values:

  • nightly — when BETA=yes (development/beta builds)
  • stable — when BETA=no (production/stable builds)
  • user-built — when BETA is unset or has another value (custom user builds)

Its primary purposes are:

  1. Metadata: Written to /etc/armbian-release to identify the build type
  2. Repository selection: At rootfs creation time (line 488 in distro-agnostic.sh), if IMAGE_TYPE=nightly, the build switches to the beta/nightly Armbian repository

The question from the previous review comment is whether IMAGE_TYPE affects the actual package contents of armbian-bsp-generic. Since the repository switching happens during rootfs/image creation (not within the package itself), and IMAGE_TYPE is only written to /etc/armbian-release (which is created outside the package), it appears that IMAGE_TYPE doesn't influence what files go into the bsp-generic package—making it potentially unnecessary in the package's version hash.

(Note: Don't confuse this with KERNEL_IMAGE_TYPE, which is completely different—it specifies the kernel binary format like Image, zImage, etc.)


🧠 Learnings used
Learnt from: Grippy98
Repo: armbian/build PR: 8202
File: config/desktop/trixie/environments/gnome/armbian/create_desktop_package.sh:2-3
Timestamp: 2025-05-16T15:34:34.672Z
Learning: The shell scripts in the Armbian build system's desktop configuration files, such as config/desktop/trixie/environments/gnome/armbian/create_desktop_package.sh, rely on environment variables like $SRC and $destination that are expected to be set externally before the script is executed.

Learnt from: tabrisnet
Repo: armbian/build PR: 8678
File: config/kernel/linux-sm8250-edge.config:80-82
Timestamp: 2025-09-27T21:50:04.845Z
Learning: In the Armbian build system, kernel configuration files are generated through this automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Learnt from: pyavitz
Repo: armbian/build PR: 8388
File: config/boards/kickpik2b.conf:1-14
Timestamp: 2025-07-17T04:12:33.125Z
Learning: In the Armbian build system, board configuration files (*.conf) follow a project standard of not including shebang lines, even though they contain bash code and are sourced by the build system. This is an established Armbian convention that individual contributors are expected to follow, and changes to this standard would require broader project maintainer approval.

Learnt from: tabrisnet
Repo: armbian/build PR: 8678
File: config/kernel/linux-sm8250-current.config:78-80
Timestamp: 2025-09-27T21:49:55.796Z
Learning: In the Armbian build system, kernel configuration files are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-07-21T04:12:02.439Z
Learning: In the Armbian build system, for recurring maintenance tasks like kernel version bumping, TODO comments should use generic version formats (e.g., "MAJOR.MINOR-rc1") rather than specific version numbers (e.g., "6.17-rc1") to avoid the need for frequent comment updates that would create unnecessary maintenance overhead.

Learnt from: tabrisnet
Repo: armbian/build PR: 8678
File: config/kernel/linux-bcm2711-edge.config:859-861
Timestamp: 2025-09-27T21:47:58.020Z
Learning: In the Armbian build system, kernel configuration files in config/kernel/ are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8754
File: config/boards/bestv-r3300-l.csc:14-16
Timestamp: 2025-10-14T05:08:11.785Z
Learning: In the Armbian build system, BOOTBRANCH_BOARD is a valid framework variable used as a fallback when BOOTBRANCH is unset. The framework checks BOOTBRANCH_BOARD before applying the default bootloader branch value (see config/sources/common.conf). Board configuration files can use BOOTBRANCH_BOARD to specify the bootloader branch.

Learnt from: igorpecovnik
Repo: armbian/build PR: 8849
File: config/boards/radxa-e54c.csc:14-28
Timestamp: 2025-11-02T20:49:56.719Z
Learning: In Armbian board configuration files (config/boards/*.conf, *.csc, etc.), do not use kernel_config_set, kernel_config_set_m, kernel_config_set_y, or custom_kernel_config__* functions to modify kernel configuration. Kernel configuration is associated with LINUXFAMILY/BOARDFAMILY, not individual BOARD. Board-specific kernel modifications cause inconsistency in kernel packages published to the apt repository because boards within a family share the same kernel packages. Kernel configuration changes must be made in the appropriate kernel config file (e.g., config/kernel/linux-*-*.config) or in family configuration files (config/sources/families/*.conf, *.inc) instead.

Learnt from: tabrisnet
Repo: armbian/build PR: 8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.

Learnt from: tabrisnet
Repo: armbian/build PR: 8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.

Learnt from: tabrisnet
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-12-13T23:43:54.707Z
Learning: In the Armbian build framework, the schedule_deletion mechanism is used to handle files that are created by package installations at variable times but must be removed before image finalization. For example, /var/lib/dbus/machine-id is created by the dbus package but should not exist in the final image (it should be generated on first boot). Scheduling the deletion ensures removal happens after all package operations complete, regardless of installation timing.

Learnt from: amazingfate
Repo: armbian/build PR: 8668
File: extensions/ufs.sh:2-2
Timestamp: 2025-09-24T09:54:07.968Z
Learning: In Armbian's build system, DOCKER_ARMBIAN_BASE_IMAGE must be set globally at file load time in extensions, not inside extension_prepare_config functions, because docker operations happen early in the build process and would default to ubuntu:noble if not set before docker_cli_prepare() runs.

Learnt from: amazingfate
Repo: armbian/build PR: 8617
File: lib/functions/compilation/kernel.sh:126-127
Timestamp: 2025-09-12T09:49:31.957Z
Learning: In the Armbian build system, the "all" target in kernel build has been used for a long time without issues. The "all" target builds vmlinux/Image/Image.gz defaults for the architecture and works correctly alongside KERNEL_IMAGE_TYPE in the build_targets_build array.

Learnt from: tabrisnet
Repo: armbian/build PR: 8925
File: lib/functions/host/docker.sh:141-141
Timestamp: 2025-11-13T14:50:44.662Z
Learning: In the Armbian build system, certain boards have U-Boot that doesn't build correctly on ubuntu:noble but works on ubuntu:jammy. For these boards, DOCKER_ARMBIAN_BASE_IMAGE can be set to "ubuntu:jammy" via an extension file loaded before docker_cli_prepare() runs, allowing legacy toolchains to work while the community works on proper fixes with limited resources.

Learnt from: amazingfate
Repo: armbian/build PR: 8419
File: lib/functions/host/prepare-host.sh:272-275
Timestamp: 2025-07-23T10:01:41.310Z
Learning: In the Armbian build system, the design philosophy is to fail fast when host dependencies are not met rather than gracefully skipping unsupported architectures. This ensures build environment consistency and prevents silent failures. Host dependency checks should be explicit and non-negotiable.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8968
File: patch/u-boot/u-boot-sunxi/arm64-dts-sun50i-h6-orangepi.dtsi-Rollback-r_rsb-to-r_i2c.patch:36-36
Timestamp: 2025-11-20T18:20:11.985Z
Learning: The rewrite-patches tool (REWRITE_PATCHES=yes) in the Armbian build system can inadvertently introduce semantic changes when the u-boot/kernel git base revision differs from expected state. The tool applies patches, commits them, and re-exports them using git format-patch, which can cause the re-exported patch to reflect the base revision's state rather than preserving the original patch intent. This is particularly problematic for device tree changes like interrupt specifications. The tool currently lacks validation mechanisms to detect such semantic drift, and affected patches must be manually corrected after rewriting.

Learnt from: igorpecovnik
Repo: armbian/build PR: 9087
File: .github/workflows/pr-check-pictures.yml:138-146
Timestamp: 2025-12-16T13:40:01.143Z
Learning: In the Armbian build repository, when introducing new requirements or checks (like the board assets verification workflow), the project prefers an initial educational-only period where violations post helpful PR comments and warnings but don't block merges. This allows contributors to become familiar with new requirements before enforcement is enabled (typically after ~6 months).

Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub or the PR API to get the complete picture of what files are being added or modified.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub API (https://api.github.com/repos/armbian/build/pulls/{pr_number}/files) to get the complete picture of what files are being added or modified, especially for U-Boot patches that will be applied during the build process.

Learnt from: tabrisnet
Repo: armbian/build PR: 9085
File: lib/functions/rootfs/rootfs-create.sh:303-306
Timestamp: 2025-12-16T12:22:12.924Z
Learning: The post_debootstrap_customize hook concept in lib/functions/rootfs/rootfs-create.sh has been tested in PR #9000. The hook placement after package installations (including desktop packages) and before cleanup operations (autoremove, qemu undeploy) is validated as appropriate for rootfs customization.

Learnt from: rpardini
Repo: armbian/build PR: 8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:76-86
Timestamp: 2025-03-31T22:20:48.475Z
Learning: For the Armbian build project, maintaining consistency with existing patches across U-Boot versions (such as between 2025.01 and 2025.04) is prioritized over refactoring individual patches for code improvements.

Learnt from: tabrisnet
Repo: armbian/build PR: 8661
File: lib/functions/compilation/armbian-kernel.sh:194-199
Timestamp: 2025-09-25T18:37:00.330Z
Learning: In PR armbian/build#8661, line 235 of lib/functions/compilation/armbian-kernel.sh already contains the corrected comment "BPF link support for netfilter hooks" for NETFILTER_BPF_LINK, not the misleading "BPF_SYSCALL" comment that was flagged during review.

Learnt from: tabrisnet
Repo: armbian/build PR: 8661
File: lib/functions/compilation/armbian-kernel.sh:194-199
Timestamp: 2025-09-25T18:37:00.330Z
Learning: In PR armbian/build#8661, line 235 of lib/functions/compilation/armbian-kernel.sh already contains the corrected comment "BPF link support for netfilter hooks" for NETFILTER_BPF_LINK, not the misleading "BPF_SYSCALL" comment that was flagged during review.

Learnt from: tabrisnet
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-10-24T04:46:22.901Z
Learning: In lib/functions/rootfs/rootfs-create.sh, the FIXME comment about mmdebstrap usage with --aptopt is a future note related to PR #8785, which hasn't been merged yet.

Learnt from: tabrisnet
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-09-11T04:34:05.589Z
Learning: When users identify architectural issues during code review, they may prefer to split them into separate issues rather than expanding the scope of the current PR. This allows for focused fixes while ensuring broader problems get proper tracking and discussion.


declare -a dirs_to_hash=(
"${SRC}/packages/bsp/common" # common stuff
"${SRC}/config/optional/_any_board/_packages/bsp-generic"
)
declare hash_files="undetermined"
calculate_hash_for_all_files_in_dirs "${dirs_to_hash[@]}"
packages_config_hash="${hash_files}"
declare packages_config_hash_short="${packages_config_hash:0:${short_hash_size}}"

# get the hashes of the lib/ bash sources involved...
declare hash_files="undetermined"
#FIXME: do we need to fork bsp/armbian-bsp-cli-deb.sh ?
calculate_hash_for_bash_deb_artifact "bsp/armbian-bsp-cli-deb.sh" "bsp/utils-bsp.sh"
declare bash_hash="${hash_files}"
declare bash_hash_short="${bash_hash:0:${short_hash_size}}"

# outer scope
artifact_version="${fake_unchanging_base_version}-PC${packages_config_hash_short}-V${var_config_hash_short}-H${hash_hooks_short}-B${bash_hash_short}"

declare -a reasons=(
"Armbian package armbian-bsp-generic"
"BRANCH \"${BRANCH}\""
"Packages and config files hash \"${packages_config_hash}\""
"Hooks hash \"${hash_hooks}\""
"Variables/bootscripts hash \"${vars_config_hash}\""
"framework bash hash \"${bash_hash}\""
)

artifact_version_reason="${reasons[*]}" # outer scope

artifact_deb_repo="global" # "global" meaning: release-independent repo. could be '${RELEASE}' for a release-specific package.
artifact_deb_arch="all" # arch-specific package, or 'all' for arch-independent package.
#FIXME: BRANCH for sure, RELEASE maybe?
artifact_name="armbian-bsp-generic-${BRANCH}"
artifact_type="deb-tar"

artifact_map_packages=(["armbian-bsp-generic"]="${artifact_name}")

# Register the function used to re-version the _contents_ of the bsp-cli deb file (non-transitional)
# FIXME: can we live without this?
#artifact_debs_reversion_functions+=("reversion_armbian-bsp-generic_deb_contents")

# there is no transitional package, this is just boilerplate
#if artifact_armbian-bsp-generic_needs_transitional_package; then
# artifact_map_packages+=(["armbian-bsp-generic-transitional"]="armbian-bsp-generic-${BOARD}${EXTRA_BSP_NAME}")
# # Register the function used to re-version the _contents_ of the bsp-cli deb file (transitional)
# artifact_debs_reversion_functions+=("reversion_armbian-bsp-generic-transitional_deb_contents")
#fi

return 0
}

function artifact_armbian-bsp-generic_build_from_sources() {
LOG_SECTION="compile_armbian-bsp-generic" do_with_logging compile_armbian-bsp-generic

# Generate transitional package when needed.
if artifact_armbian-bsp-generic_needs_transitional_package; then
: # we don't have this hook, it's just boilerplate
#LOG_SECTION="compile_armbian-bsp-generic" do_with_logging compile_armbian-bsp-generic-transitional
fi
}

function artifact_armbian-bsp-generic_cli_adapter_pre_run() {
declare -g ARMBIAN_COMMAND_REQUIRE_BASIC_DEPS="yes" # Require prepare_host_basic to run before the command.

# "gimme root on a Linux machine"
cli_standard_relaunch_docker_or_sudo
}

function artifact_armbian-bsp-generic_cli_adapter_config_prep() {
# there is no need for aggregation here.
use_board="no" allow_no_family="yes" skip_kernel="no" prep_conf_main_minimal_ni < /dev/null # no stdin for this, so it bombs if tries to be interactive.
}

function artifact_armbian-bsp-generic_get_default_oci_target() {
artifact_oci_target_base="${GHCR_SOURCE}/armbian/os/"
}

function artifact_armbian-bsp-generic_is_available_in_local_cache() {
is_artifact_available_in_local_cache
}

function artifact_armbian-bsp-generic_is_available_in_remote_cache() {
is_artifact_available_in_remote_cache
}

function artifact_armbian-bsp-generic_obtain_from_remote_cache() {
obtain_artifact_from_remote_cache
}

function artifact_armbian-bsp-generic_deploy_to_remote_cache() {
upload_artifact_to_oci
}

function artifact_armbian-bsp-generic_needs_transitional_package() {
return 1 # we're too new to need a transitional package. Note that this follows the C/bash errno convention where 0 is true
# see equivalent for artifact_armbian-bsp-cli
}
2 changes: 1 addition & 1 deletion lib/functions/artifacts/artifacts-obtain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function initialize_artifact() {
[[ "${chosen_artifact}" == *","* ]] && exit_with_error "Artifact name cannot contain commas"

armbian_register_artifacts
declare -g chosen_artifact_impl="${ARMBIAN_ARTIFACTS_TO_HANDLERS_DICT["${chosen_artifact}"]}"
declare -g chosen_artifact_impl="${ARMBIAN_ARTIFACTS_TO_HANDLERS_DICT["${chosen_artifact}"]}" #"
[[ "x${chosen_artifact_impl}x" == "xx" ]] && exit_with_error "Unknown artifact '${chosen_artifact}'"
display_alert "artifact" "${chosen_artifact} :: ${chosen_artifact_impl}()" "info"
create_artifact_functions
Expand Down
1 change: 1 addition & 0 deletions lib/functions/artifacts/artifacts-registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function armbian_register_artifacts() {
["armbian-plymouth-theme"]="armbian-plymouth-theme"
["armbian-base-files"]="armbian-base-files"
["armbian-bsp-cli"]="armbian-bsp-cli"
["armbian-bsp-generic"]="armbian-bsp-generic"
["armbian-bsp-desktop"]="armbian-bsp-desktop"
["armbian-desktop"]="armbian-desktop"

Expand Down
Loading