Skip to content
Closed
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
192 changes: 192 additions & 0 deletions config/boards/beaglebadge.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
# BeagleBadge Texas Instruments AM62L dual core 256MB 2xGBE OSPI HDMI
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix the hardware description on Line 1.

This looks copied from another TI board and advertises 2xGBE OSPI HDMI, which does not match the badge-specific E-Ink/CC33xx setup introduced below. This string is shown during interactive board selection, so it needs to describe the actual hardware.

Based on learnings: in Armbian board configuration files, the first-line comment must be a proper hardware feature description because it is used during interactive compilation.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@config/boards/beaglebadge.conf` at line 1, Replace the incorrect header
comment on the first line (currently advertising "2xGBE OSPI HDMI") with an
accurate one describing the BeagleBadge hardware features used by interactive
board selection: update the first-line comment to mention "BeagleBadge Texas
Instruments AM62L dual-core 256MB with E-Ink display and CC33xx wireless"
(remove references to 2xGBE, OSPI, HDMI) so the board selector shows the correct
hardware capabilities.


BOARD_NAME="BeagleBadge"
BOARD_VENDOR="beagleboard"
BOARDFAMILY="k3"
BOARD_MAINTAINER="Grippy98"
BOOT_SOC="am62l"
BOOTCONFIG="am62lx_badge_defconfig"
BOOTFS_TYPE="fat"
BOOT_FDT_FILE="ti/k3-am62l3-badge.dts"
TIBOOT3_FILE="tiboot3.bin"
DEFAULT_CONSOLE="serial"
KERNEL_TARGET="vendor,vendor-rt,vendor-edge"
KERNEL_TEST_TARGET="vendor"
SERIALCON="ttyS2"
ATF_BOARD="am62l3-badge"
EXTRA_ATF_TARGETS="build/k3low/am62l3-badge/release/bl1.bin:bl1.bin"
OPTEE_ARGS="CFG_TEE_CORE_LOG_LEVEL=1"
OPTEE_PLATFORM="k3-am62lx"
EXTRA_BOOT_ARGS="BL1=bl1.bin"
DISPLAY_SUPPORT="yes"
CC33XX_SUPPORT="yes"
PACKAGE_LIST_BOARD_REMOVE="weston seatd ti-lvgl-demo firmware-cnm-wave"
PACKAGE_LIST_BOARD+=" bluetooth bluez-tools"

# ============================================================================
# LOW-RAM OPTIMIZATIONS FOR 256MB BADGE
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What about using:
https://github.com/armbian/build/blob/main/extensions/lowmem.sh
and improving it if not good enough?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah did not know about that, will take a look!

# ============================================================================

function post_customize_image__beaglebadge_05_configure_zram() {
display_alert "$BOARD" "Configuring ZRAM for 256MB RAM system" "info"

cat <<-EOF > "${SDCARD}"/etc/default/armbian-zram-config
ENABLED=true
ZRAM_PERCENTAGE=25
ZRAM_ALGORITHM=zstd
SWAP_PRIORITY=100
EOF

chroot "${SDCARD}" /bin/bash -c "systemctl enable armbian-zram-config.service || true"

display_alert "$BOARD" "ZRAM configured: 25% of physical RAM (priority 100)" "info"
}

function post_customize_image__beaglebadge_06_enable_cc33xx_ble() {
display_alert "$BOARD" "Configuring CC33xx udev rule for BLE" "info"

mkdir -p "${SDCARD}"/etc/udev/rules.d/
cat <<-EOF > "${SDCARD}"/etc/udev/rules.d/99-cc33xx-ble.rules
# Enable BLE when the cc33xx wlan physical interface initializes
ACTION=="add", KERNEL=="phy[0-9]*", SUBSYSTEM=="ieee80211", DRIVERS=="cc33xx", RUN+="/bin/sh -c 'sleep 1; echo 1 > /sys/kernel/debug/ieee80211/%k/cc33xx/ble_enable'"
EOF
}

function post_customize_image__zz_beaglebadge_10_disable_apt_periodic() {
display_alert "$BOARD" "Disabling APT periodic services (post-config)" "info"

# Disable and mask APT timers; timers are what trigger the services
chroot "${SDCARD}" /bin/bash -c "
systemctl disable apt-daily.timer apt-daily-upgrade.timer || true
systemctl mask apt-daily.timer apt-daily-upgrade.timer apt-daily.service apt-daily-upgrade.service || true
"

# Override APT periodic config
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minimal image doesn't have unnatended-upgrade service - probably don't need to bother with this?

cat <<-EOF > "${SDCARD}"/etc/apt/apt.conf.d/02-armbian-periodic
// Disabled for 256MB RAM optimization
APT::Periodic::Enable "0";
APT::Periodic::Update-Package-Lists "0";
APT::Periodic::Download-Upgradeable-Packages "0";
APT::Periodic::Unattended-Upgrade "0";
APT::Periodic::AutocleanInterval "0";
EOF

# Add low-RAM APT settings
cat <<-EOF > "${SDCARD}"/etc/apt/apt.conf.d/99-lowram
// Reduce APT memory usage
// APT::Cache-Limit "8388608";
// APT::Cache-Start "8388608";
// APT::Cache-Grow "1048576";
Dir::Cache::Archives::MaxAge "0";
Dir::Cache::Archives::MaxSize "50M";
APT::AutoRemove::RecommendsImportant "0";
APT::AutoRemove::SuggestsImportant "0";
EOF
}



function post_customize_image__zz_beaglebadge_30_trim_systemd() {
display_alert "$BOARD" "Trimming systemd services (post-config)" "info"

# Services to disable (not mask - let them exist but not start)
local services_to_disable=(
"keyboard-setup.service"
"console-setup.service"
"rsyslog.service"
"systemd-homed.service"
"systemd-homed-activate.service"
)

for service in "${services_to_disable[@]}"; do
chroot "${SDCARD}" /bin/bash -c "systemctl disable ${service} || true"
done

# Timers to mask (these are safe and won't conflict)
local timers_to_mask=(
"man-db.timer"
"dpkg-db-backup.timer"
"e2scrub_all.timer"
)

for timer in "${timers_to_mask[@]}"; do
chroot "${SDCARD}" /bin/bash -c "systemctl mask ${timer} || true"
local service="${timer%.timer}.service"
chroot "${SDCARD}" /bin/bash -c "systemctl mask ${service} || true"
done
}

function post_customize_image__zz_beaglebadge_40_limit_journal() {
display_alert "$BOARD" "Limiting systemd journal size" "info"

mkdir -p "${SDCARD}"/etc/systemd/journald.conf.d/
cat <<-EOF > "${SDCARD}"/etc/systemd/journald.conf.d/00-journal-size.conf
[Journal]
SystemMaxUse=16M
SystemMaxFileSize=4M
RuntimeMaxUse=8M
RuntimeMaxFileSize=2M
MaxRetentionSec=1day
ForwardToSyslog=no
ForwardToKMsg=no
ForwardToConsole=no
ForwardToWall=no
MaxLevelStore=info
MaxLevelSyslog=info
Compress=yes
EOF
}

function post_customize_image__zz_beaglebadge_50_optimize_systemd_timeouts() {
display_alert "$BOARD" "Optimizing systemd timeouts" "info"

mkdir -p "${SDCARD}"/etc/systemd/system.conf.d/
cat <<-EOF > "${SDCARD}"/etc/systemd/system.conf.d/99-lowram.conf
[Manager]
DefaultTimeoutStartSec=30s
DefaultTimeoutStopSec=15s
DefaultTimeoutAbortSec=15s
DefaultDeviceTimeoutSec=30s
# Cap processes to prevent out-of-memory fork bombs
DefaultLimitNPROC=256:512
EOF

mkdir -p "${SDCARD}"/etc/systemd/coredump.conf.d/
cat <<-EOF > "${SDCARD}"/etc/systemd/coredump.conf.d/disable.conf
[Coredump]
Storage=none
ProcessSizeMax=0
EOF
}

function post_customize_image__zz_beaglebadge_60_kernel_params() {
display_alert "$BOARD" "Setting low-RAM kernel parameters" "info"

cat <<-EOF > "${SDCARD}"/etc/sysctl.d/99-lowram.conf
# Memory management for 256MB system
vm.swappiness=100
zswap.enabled=0
vm.page-cluster=0
vm.watermark_scale_factor=125
vm.compact_memory=1
Comment on lines +164 to +170
Copy link
Copy Markdown
Contributor

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

🌐 Web query:

Is zswap.enableda valid Linux sysctl key, or is it only configurable via kernel cmdline / module parameter? What does writingvm.compact_memory=1 via sysctl actually do?

💡 Result:

zswap.enabled is not a valid Linux sysctl key under /proc/sys/vm/. It is configurable via kernel command line (e.g., zswap.enabled=1) or module parameter (echo 1 > /sys/module/zswap/parameters/enabled). Writing vm.compact_memory=1 via sysctl triggers memory compaction across all zones (if CONFIG_COMPACTION is enabled), moving free memory into contiguous blocks to reduce fragmentation. This aids allocations like huge pages, though processes compact as needed.

Citations:


Remove zswap.enabled and vm.compact_memory from sysctl.d configuration.

zswap.enabled is not a valid sysctl key—it can only be configured via kernel command line or module parameter. vm.compact_memory triggers an immediate one-time compaction during boot rather than setting a persistent memory management policy.

Suggested fix
  # Memory management for 256MB system
  vm.swappiness=100
- zswap.enabled=0
  vm.page-cluster=0
  vm.watermark_scale_factor=125
- vm.compact_memory=1
  vm.vfs_cache_pressure=150
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@config/boards/beaglebadge.conf` around lines 164 - 170, Remove the two
invalid/persistent-inappropriate sysctl keys from the heredoc that writes the
99-lowram.conf: delete the lines setting zswap.enabled and vm.compact_memory so
only valid persistent sysctl keys remain (e.g., vm.swappiness, vm.page-cluster,
vm.watermark_scale_factor) in the block that generates
"${SDCARD}"/etc/sysctl.d/99-lowram.conf; do not add alternate handling here for
zswap (kernel cmdline/module param) or vm.compact_memory (one-time compaction) —
leave those to boot/kernel config instead.

vm.vfs_cache_pressure=150
vm.dirty_background_ratio=5
vm.dirty_ratio=10
vm.min_free_kbytes=8192
vm.overcommit_memory=1

# Reduce kernel verbosity
kernel.printk=3 4 1 3

# Minimize network buffers
net.core.rmem_max=262144
net.core.wmem_max=262144
net.ipv4.tcp_rmem=4096 65536 262144
net.ipv4.tcp_wmem=4096 16384 262144
net.core.netdev_max_backlog=1000

# Reduce inotify limits
fs.inotify.max_user_watches=8192
fs.inotify.max_user_instances=256
EOF
}
5 changes: 3 additions & 2 deletions config/boards/tmds62levm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ DEFAULT_CONSOLE="serial"
KERNEL_TARGET="vendor,vendor-rt,vendor-edge"
KERNEL_TEST_TARGET="vendor"
SERIALCON="ttyS2"
ATF_BOARD="am62l"
EXTRA_ATF_TARGETS="build/k3/am62l/release/bl1.bin:bl1.bin"
ATF_BOARD="am62lx"
EXTRA_ATF_TARGETS="build/k3low/am62lx/release/bl1.bin:bl1.bin"
OPTEE_ARGS="CFG_TEE_CORE_LOG_LEVEL=1"
OPTEE_PLATFORM="k3-am62lx"
EXTRA_BOOT_ARGS="BL1=bl1.bin"
DISPLAY_SUPPORT="yes"
CC33XX_SUPPORT="yes"
5 changes: 4 additions & 1 deletion config/bootscripts/boot-k3.cmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
bootpart=1:1
bootdir=
finduuid=part uuid \${boot} 1:2 uuid
check_beaglebadge=if test "${fdtfile}" = "ti/k3-am62l3-badge.dtb"; then rdaddr=0x84900000; name_overlays=ti/k3-am62l3-badge-eink-gdey042t81.dtbo; fi
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Apr 15, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Append the badge overlay instead of replacing name_overlays.

This assignment discards any overlays already supplied by the user, so BeagleBadge owners can't combine the mandatory E-Ink overlay with their own add-ons.

🩹 Proposed fix
-check_beaglebadge=if test "${fdtfile}" = "ti/k3-am62l3-badge.dtb"; then rdaddr=0x84900000; name_overlays=ti/k3-am62l3-badge-eink-gdey042t81.dtbo; fi
+check_beaglebadge=if test "${fdtfile}" = "ti/k3-am62l3-badge.dtb"; then rdaddr=0x84900000; if test -n "${name_overlays}"; then name_overlays="${name_overlays} ti/k3-am62l3-badge-eink-gdey042t81.dtbo"; else name_overlays=ti/k3-am62l3-badge-eink-gdey042t81.dtbo; fi; fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
check_beaglebadge=if test "${fdtfile}" = "ti/k3-am62l3-badge.dtb"; then rdaddr=0x84900000; name_overlays=ti/k3-am62l3-badge-eink-gdey042t81.dtbo; fi
check_beaglebadge=if test "${fdtfile}" = "ti/k3-am62l3-badge.dtb"; then rdaddr=0x84900000; if test -n "${name_overlays}"; then name_overlays="${name_overlays} ti/k3-am62l3-badge-eink-gdey042t81.dtbo"; else name_overlays=ti/k3-am62l3-badge-eink-gdey042t81.dtbo; fi; fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@config/bootscripts/boot-k3.cmd` at line 4, The current check_beaglebadge
assignment overwrites name_overlays, discarding user-supplied overlays; change
it to append the BeagleBadge E-Ink overlay to existing name_overlays instead of
replacing it. Update the block that checks fdtfile ("ti/k3-am62l3-badge.dtb") so
it still sets rdaddr but builds name_overlays by preserving any existing value
(e.g., add the overlay to the existing space-separated name_overlays when
non-empty) and ensures the overlay filename
ti/k3-am62l3-badge-eink-gdey042t81.dtbo is included.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jonaswood01 Can you take a look

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

name_rd=uInitrd
get_rd_mmc=load mmc ${bootpart} ${rdaddr} ${bootdir}/${name_rd}

uenvcmd=run get_rd_${boot}; env set rd_spec ${rdaddr}:${filesize}; setexpr fdtfile sub ti/ti ti; run bootcmd_ti_mmc
uenvcmd=run check_beaglebadge; run get_rd_${boot}; env set rd_spec ${rdaddr}:${filesize}; setexpr fdtfile sub ti/ti ti; run bootcmd_ti_mmc

optargs=vt.global_cursor_default=0
Loading