forked from armbian/build
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbeaglebadge.conf
More file actions
192 lines (163 loc) · 5.75 KB
/
beaglebadge.conf
File metadata and controls
192 lines (163 loc) · 5.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# BeagleBadge Texas Instruments AM62L dual core 256MB 2xGBE OSPI HDMI
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
# ============================================================================
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
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
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
}