You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rpardini's May'24 fix batch: slim for 2Gb RAM devices (#225)
> - recent userspace additions took the initramfs size near or over the 900mb mark for certain kernels.
> - initramfs (gzipped cpio) is uncompressed by bootloader and mounted on tmpfs by kernel.
> - tmpfs allows only 50% of physical RAM by default, and default can't be changed easily.
> - slim down both the userspace (by stripping / removing some / etc) and the Armbian kernels (by removing modules)
> - with those we're back below 900mb uncompressed again, and the default x86 hook tarball is down from 223 to 180mb compressed.
> - add a check for uncompressed cpio size at 900mb; warn in GHA if it is ever hit again.
> - also includes: fixes for ttyAML consoles, better logging, some dev/debug options used for batch
>
> note: review is easier if done commit-by-commit; sent a large batch due to same-line changes across them
----
#### build: common: better logging & emit notice/warn/error also to GHA workflow commands
- see https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-notice-message
- introduces `notice` level, which is just like `info` but brighter and goes to GHA
- also: curb warning about USE_KERNEL_ID down to info
#### kernel: armbian: fix: use ORAS binary appropriate to the (host) arch; bump ORAS to 1.2.0-rc.1 (from beta.1)
- otherwise can't build those "kernels" on arm64-only & qemu+binfmt-deprived hosts
#### build: introduce `OUTPUT_TARBALL_FILELIST=yes` to include LK's `--format tar` output and its filelist
- useful during development for:
- debugging esoteric issue with file permissions
- checking the space usage distribution, so we can slim down where needed
#### kernel: armbian: ensure kernel.tar contains entry for the / (root) directory
- quite esoteric, but it seems LinuxKit uses the kernel.tar's root entry as its own entry
- if that is missing, then the final product rootfs will have root dir with very strange permissions
#### kernel: armbian: don't flood output with tar's verbose option
#### kernel: armbian: remove some heavy kernel modules (so it fits in 2Gb RAM)
- Armbian kernels are meant for general-purpose initrd's, and including all modules is overkill
- this allows to boot on 2Gb RAM machines (tmpfs allows only up to 50% RAM)
#### images: slim down golang binaries, by building without DWARF/debug symbols, stripping prebuilts, and removing unneeded bins
- strip golang binaries (both during build with ldflags and prebuilt ones with 'strip'/binutils)
- don't ship apk caches
- we won't use docker-buildx nor docker-compose bins, which are huge; remove them
- remove stray 'hook-bootkit' binary from source directory (leftover from ?)
#### hook: add handling for ttyAML0/1 (used on Amlogic SoCs)
- complements a68b629
- create /dev devices with 243 major and 0/1 minor
- add to securetty
#### build: introduce check for initramfs size > 900Mb and warn/notice
- those will most likely fail to boot on 2Gb RAM machines
- initramfs will by default use tmpfs (which defaults to 50% ram), not ramfs
@@ -83,8 +90,16 @@ function calculate_kernel_version_armbian() {
83
90
# Get the kernel image...
84
91
RUN cp -v boot/vmlinuz* /armbian/output/kernel
85
92
86
-
# Create a tarball with the modules in lib
87
-
RUN tar -cvf /armbian/output/kernel.tar lib
93
+
# Create a tarball with the modules in lib.
94
+
# Important: this tarball needs to have permissions for the root directory included! Otherwise linuxkit rootfs will have the wrong permissions on / (root)
95
+
WORKDIR /armbian/modules_only
96
+
RUN mv /armbian/image/lib /armbian/modules_only/
97
+
RUN echo "Before cleaning: " && du -h -d 10 -x . | sort -h | tail -n 20
98
+
# Trim the kernel modules to save space; hopefully your required hardware is not included here
99
+
RUN rm -rfv ./lib/modules/*/kernel/drivers/net/wireless ./lib/modules/*/kernel/sound ./lib/modules/*/kernel/drivers/media
100
+
RUN rm -rfv ./lib/modules/*/kernel/drivers/infiniband
101
+
RUN echo "After cleaning: " && du -h -d 10 -x . | sort -h | tail -n 20
102
+
RUN tar -cf /armbian/output/kernel.tar .
88
103
89
104
# Create a tarball with the dtbs in usr/lib/linux-image-*
90
105
RUN { cd usr/lib/linux-image-* || { echo "No DTBS for this arch, empty tar..." && mkdir -p usr/lib/linux-image-no-dtbs && cd usr/lib/linux-image-* ; } ; } && pwd && du -h -d 1 . && tar -czvf /armbian/output/dtbs.tar.gz . && ls -lah /armbian/output/dtbs.tar.gz
RUN make binaries EXTRA_FLAGS="-buildmode pie" EXTRA_LDFLAGS='-extldflags "-fno-PIC -static"' BUILDTAGS="static_build no_devmapper"
21
+
RUN make binaries EXTRA_FLAGS="-buildmode pie" EXTRA_LDFLAGS='-w -s -extldflags "-fno-PIC -static"' BUILDTAGS="static_build no_devmapper"
22
22
23
23
# install nerdctl
24
24
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then ARCHITECTURE=amd64; elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then ARCHITECTURE=arm64; else ARCHITECTURE=amd64; fi \
0 commit comments