@@ -212,6 +212,22 @@ overlay_paths() { # $1 = subvol prefix (e.g. /@Desktop); remaining args = overl
212212 printf ' %s' " $_paths "
213213}
214214
215+ # Per-profile user drop-in overlays: every *.dtbo under this root's /etc/kernel/dtbo, applied to
216+ # each of the profile's entries. OVERLAY_USER_DIR is the on-disk scan dir (default CONF_ROOT/dtbo,
217+ # i.e. the booted profile; flipper_write_entry points it at the target root). The in-entry path is
218+ # subvol-prefixed like devicetreedir. Silent no-op when the dir is absent or empty.
219+ OVERLAY_USER_REL=/etc/kernel/dtbo
220+ user_overlay_paths () { # $1 = subvol prefix (e.g. /@Desktop)
221+ _udir=" ${OVERLAY_USER_DIR:- $CONF_ROOT / dtbo} "
222+ [ -d " $_udir " ] || return 0
223+ _upaths=" "
224+ for _uf in " $_udir " /* .dtbo; do
225+ [ -f " $_uf " ] || continue # unmatched glob -> skip
226+ _upaths=" $_upaths ${_upaths: + } $1 $OVERLAY_USER_REL /${_uf##*/ } "
227+ done
228+ printf ' %s' " $_upaths "
229+ }
230+
215231# Set BASE_OPTS from CONF_ROOT/cmdline (root=UUID + policy) + this kernel's console layout.
216232# FIQ kernel -> console=ttyFIQ0 ; mainline -> console=ttyS0 + ttyS4 + fbcon=map:1.
217233compute_base_opts () {
@@ -281,9 +297,10 @@ emit_entry() {
281297 _opts=" $BASE_OPTS "
282298 [ -n " $_extra " ] && _opts=" $_opts $_extra "
283299 _fn=" $ENTRIES /$ENTRY_TOKEN -$KERNEL_VERSION .conf"
300+ _user=" $( user_overlay_paths " $( fdt_prefix " $_opts " ) " ) " # user drop-ins, always optional
284301
285302 if [ -z " $_dtbos " ]; then
286- write_entry " $_fn " " $( make_title " $_suf " ) " " $_opts " " "
303+ write_entry " $_fn " " $( make_title " $_suf " ) " " $_opts " " $_user "
287304 return 0
288305 fi
289306
@@ -297,7 +314,8 @@ emit_entry() {
297314 log " skip $ENTRY_TOKEN (overlays not found for $KERNEL_VERSION )"
298315 return 0
299316 fi
300- write_entry " $_fn " " $( make_title " $_suf " ) " " $_opts " " $_paths "
317+ # profile overlays first, then the user's drop-ins layered on top
318+ write_entry " $_fn " " $( make_title " $_suf " ) " " $_opts " " $_paths ${_paths: +${_user: + } } $_user "
301319}
302320
303321# flipper_write_entry <subvol> <mounted-path> [<origin-hint>]: write a BLS entry for an EXISTING
@@ -325,6 +343,7 @@ flipper_write_entry() {
325343 # devicetreedir is the target root's OWN kernel dir (KERNEL_VERSION came from it, so it exists).
326344 DEVICETREEDIR_REL=" /usr/lib/linux-image-$KERNEL_VERSION "
327345 OVERLAY_DIR=" $DTB_DIR /$VENDOR "
346+ OVERLAY_USER_DIR=" $_snap /etc/kernel/dtbo" # scan the TARGET root's drop-ins, not the running one
328347 # pin the root's own entry-token so a later runtime apt install in it lands in the same band
329348 mkdir -p " $_snap /etc/kernel" && printf ' %s\n' " $ENTRY_TOKEN " > " $_snap /etc/kernel/entry-token"
330349 emit_entry " $( printf ' %s' " $_name " | tr -d ' @' ) " " rootflags=subvol=$_name " " " " "
0 commit comments