Skip to content

Commit 52551c2

Browse files
committed
Minimze Rpi sysroot
1 parent 5f6aef6 commit 52551c2

File tree

1 file changed

+20
-99
lines changed

1 file changed

+20
-99
lines changed

extract-sysroot-raspberrypi/extract_sysroot.sh

Lines changed: 20 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,25 @@ else
169169
fi
170170

171171
# ===========================================
172-
# Fichiers include/exclude pour rsync
172+
# Règles de filtrage des fichiers à copier pour rsync
173173
# ===========================================
174-
RSYNC_INC="${TMP_DIR}/rsync-include.txt"
175-
RSYNC_EXC="${TMP_DIR}/rsync-exclude.txt"
174+
RSYNC_FILTER="${TMP_DIR}/rsync-filter.rules"
175+
176+
cat >"$RSYNC_FILTER" <<'RSYNC_FILTER_EOF'
177+
- /usr/lib/arm-linux-gnueabihf/libicu***
178+
- /usr/lib/arm-linux-gnueabihf/libQt5***
179+
- /usr/lib/arm-linux-gnueabihf/libqt5***
180+
- /usr/lib/arm-linux-gnueabihf/libQt6***
181+
- /usr/lib/arm-linux-gnueabihf/libqt6***
182+
- /usr/lib/modules/***
183+
- /usr/lib/firmware/***
184+
- /usr/lib/python3.*/***
185+
- /usr/lib/debug/***
186+
- /usr/lib/raspi-firmware/***
187+
- /usr/lib/systemd/***
188+
- /usr/lib/udev/***
189+
- /etc/***
176190
177-
# Whitelist pour MODE=minimal (libs/headers/pkg-config/ssl/ld conf)
178-
cat >"$RSYNC_INC" <<'PATTERNS'
179191
+ /lib/
180192
+ /lib/***
181193
+ /lib/arm-linux-gnueabihf/
@@ -208,108 +220,17 @@ cat >"$RSYNC_INC" <<'PATTERNS'
208220
+ /opt/
209221
+ /opt/vc/
210222
+ /opt/vc/***
223+
211224
- ***
212-
PATTERNS
213-
214-
# Exclusions "en dur" pour environnement headless (sans GUI)
215-
cat >"$RSYNC_EXC" <<'EXCLUDES'
216-
# === Navigateurs et gros clients ===
217-
- /usr/lib/chromium/***
218-
- /usr/lib/chromium-browser/***
219-
- /usr/lib/firefox/***
220-
221-
# === Stack graphique: X11 / Wayland / GL / GPU ===
222-
- /usr/lib/xorg/***
223-
- /usr/lib/X11/***
224-
- /usr/lib/arm-linux-gnueabihf/dri/***
225-
- /usr/lib/arm-linux-gnueabihf/libEGL***
226-
- /usr/lib/arm-linux-gnueabihf/libGLES***
227-
- /usr/lib/arm-linux-gnueabihf/libGL***
228-
- /usr/lib/arm-linux-gnueabihf/libOpenGL***
229-
- /usr/lib/arm-linux-gnueabihf/libopengl***
230-
- /usr/lib/arm-linux-gnueabihf/libGLX***
231-
- /usr/lib/arm-linux-gnueabihf/libxkbcommon***
232-
- /usr/lib/arm-linux-gnueabihf/libX***
233-
- /usr/lib/arm-linux-gnueabihf/libxcb***
234-
- /usr/lib/arm-linux-gnueabihf/libwayland***
235-
- /usr/lib/arm-linux-gnueabihf/libdrm***
236-
- /usr/lib/arm-linux-gnueabihf/libvulkan***
237-
- /usr/lib/arm-linux-gnueabihf/libgbm***
238-
239-
# === Toolkits GUI : GTK/Qt/SDL/Cairo/Pango/etc. ===
240-
- /usr/lib/arm-linux-gnueabihf/libgdk***
241-
- /usr/lib/arm-linux-gnueabihf/libgtk***
242-
- /usr/lib/arm-linux-gnueabihf/libQt5***
243-
- /usr/lib/arm-linux-gnueabihf/libqt5***
244-
- /usr/lib/arm-linux-gnueabihf/libQt6***
245-
- /usr/lib/arm-linux-gnueabihf/libqt6***
246-
- /usr/lib/arm-linux-gnueabihf/libSDL***
247-
- /usr/lib/arm-linux-gnueabihf/libSDL2***
248-
- /usr/lib/arm-linux-gnueabihf/libcairo***
249-
- /usr/lib/arm-linux-gnueabihf/libpango***
250-
- /usr/lib/arm-linux-gnueabihf/libatk***
251-
- /usr/lib/arm-linux-gnueabihf/libgdk_pixbuf***
252-
- /usr/lib/arm-linux-gnueabihf/libfontconfig***
253-
- /usr/lib/arm-linux-gnueabihf/libfreetype***
254-
- /usr/lib/arm-linux-gnueabihf/libharfbuzz***
255-
- /usr/lib/arm-linux-gnueabihf/libpixman***
256-
- /usr/lib/arm-linux-gnueabihf/libfribidi***
257-
- /usr/lib/arm-linux-gnueabihf/libEGL_mesa***
258-
- /usr/lib/arm-linux-gnueabihf/libGLX_mesa***
259-
260-
# === Ressources GUI / thèmes / icônes / polices ===
261-
- /usr/share/X11/***
262-
- /usr/share/icons/***
263-
- /usr/share/fonts/***
264-
- /usr/share/themes/***
265-
- /usr/share/gtk-3.0/***
266-
- /usr/share/gtk-4.0/***
267-
- /usr/share/wayland/***
268-
- /usr/share/applications/***
269-
- /usr/share/mime/***
270-
- /usr/share/glvnd/***
271-
- /usr/share/drirc.d/***
272-
- /usr/share/gdm/***
273-
- /usr/share/lightdm/***
274-
- /usr/share/gnome/***
275-
- /usr/share/kde4/***
276-
- /usr/share/kf5/***
277-
- /usr/share/qt5/***
278-
- /usr/share/qt6/***
279-
- /usr/share/pixmaps/***
280-
- /usr/share/backgrounds/***
281-
282-
# === GPU / firmware graphique / noyau ===
283-
- /lib/modules/***
284-
- /lib/firmware/***
285-
- /opt/vc/src/***
286-
- /opt/vc/lib/libEGL***
287-
- /opt/vc/lib/libGLES***
288-
- /opt/vc/lib/libGL***
289-
- /opt/vc/lib/libvcos***
290-
- /opt/vc/lib/libvchiq***
291-
- /opt/vc/lib/libopenmaxil***
292-
293-
# === Divers lourds non critiques pour la compilation ===
294-
- /usr/lib/llvm-*/
295-
- /usr/lib/debug/***
296-
- /usr/share/doc/***
297-
- /usr/share/man/***
298-
# locales très volumineuses (adapter si besoin)
299-
- /usr/share/locale/zh_CN/***
300-
- /usr/share/locale/ja/***
301-
- /usr/share/locale/ru/***
302-
- /usr/share/locale/de/***
303-
EXCLUDES
225+
RSYNC_FILTER_EOF
304226

305227
# ===========================================
306228
# Copie du sysroot (avec exclusions)
307229
# ===========================================
308230
copy_minimal() {
309231
echo "[*] MODE=minimal : copie whitelist + exclusions GUI…"
310232
rsync -aHAX --numeric-ids --delete \
311-
--include-from="$RSYNC_INC" \
312-
--exclude-from="$RSYNC_EXC" \
233+
--filter="merge ${RSYNC_FILTER}" \
313234
/mnt/root/ "${OUT}/"
314235
}
315236

0 commit comments

Comments
 (0)