mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
- this contains .md with the git logs short and full for the armbian-next history pre-squash
2.0 MiB
2.0 MiB
This is armbian-next.
Short fuller log
- c9cf3fc241cfb4c872f4aef7bbc41d5854db7ea3 to 6809de3d6063cb041205a8318e19da6a4dee68c9 ref extensions_08_10_2022_pre_v30
commit 6809de3d6063cb041205a8318e19da6a4dee68c9
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Oct 8 11:30:37 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:32:06 2022 +0200
armbian-next: manual merge (30) of lib changes between 882f995e21f4791d773bc59efdfdb676494ee6ba and 31ac6383e1ac7ebddd0813abc0f1f9632a9c9c40
lib/functions/configuration/main-config.sh
lib/functions/general/downloads.sh
commit 404916b083a1f1a9735abe40452d460c65cd412f
Author: Igor Pecovnik <igor.pecovnik@gmail.com>
AuthorDate: Sun Jan 16 23:59:47 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:32:06 2022 +0200
armbian-next: manual merge (30) of family/board changes between 882f995e21f4791d773bc59efdfdb676494ee6ba and 31ac6383e1ac7ebddd0813abc0f1f9632a9c9c40
config/sources/families/media.conf
commit adc5e01444daf4548cba3ef99ea3430d8bbf8335
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Sep 25 01:49:11 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: manual merge (29) of family/board changes between 3435c4636723e9553be0a9ce3666bddb0887069e and 882f995e21f4791d773bc59efdfdb676494ee6ba (A LOT!)
config/boards/uefi-arm64.conf
config/boards/uefi-x86.conf
config/sources/arm64.conf
config/sources/armhf.conf
config/sources/families/bcm2711.conf
config/sources/families/include/meson_common.inc
config/sources/families/uefi-x86.conf
commit c1aef1c25eb29772a754bd3961b69f98c7afa48d
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Sep 25 01:36:43 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: manual merge (29) of lib changes between 3435c4636723e9553be0a9ce3666bddb0887069e and 882f995e21f4791d773bc59efdfdb676494ee6ba (A LOT!)
extensions/grub.sh
lib/functions/bsp/bsp-desktop.sh
lib/functions/compilation/debs.sh
lib/functions/compilation/patch/kernel-bootsplash.sh
lib/functions/compilation/patch/kernel-drivers.sh
lib/functions/configuration/interactive.sh
lib/functions/configuration/main-config.sh
lib/functions/general/chroot-helpers.sh
lib/functions/general/cleaning.sh
lib/functions/general/downloads.sh
lib/functions/host/external-toolchains.sh
lib/functions/image/initrd.sh
lib/functions/image/partitioning.sh
lib/functions/image/rootfs-to-image.sh
lib/functions/main/default-build.sh
lib/functions/rootfs/create-cache.sh
lib/functions/rootfs/distro-agnostic.sh
lib/functions/rootfs/distro-specific.sh
commit dde4db8ee4d9f984b35f8fb909785622316207a8
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Aug 27 12:52:47 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: manual merge (28) of lib changes between revisions af6ceee6c55bd4726139fb8b1ad77641d385515a and 38df56fbf39739b48b31b5e393f15261d053b3cd
lib/functions/compilation/patch/kernel-bootsplash.sh
lib/functions/compilation/patch/kernel-drivers.sh
lib/functions/image/fingerprint.sh
lib/functions/image/partitioning.sh
commit 0ae75757f23941e025ed29dae1aacf44cd2249ac
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Aug 27 12:41:42 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: manual merge (28) of sources/families changes between revisions af6ceee6c55bd4726139fb8b1ad77641d385515a and 38df56fbf39739b48b31b5e393f15261d053b3cd
config/sources/families/include/meson_common.inc
config/sources/families/media.conf
config/sources/families/odroidxu4.conf
commit e3e84f5c72e34013ea09dbd556c30870017b43a8
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Aug 13 13:53:57 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: manual merge (27) of `lib` changes between revisions 9c52562176390624d33c93634e63a8f91cc0815b and af6ceee6c55bd4726139fb8b1ad77641d385515a
lib/functions/bsp/bsp-cli.sh
lib/functions/compilation/patch/kernel-bootsplash.sh
lib/functions/compilation/patch/kernel-drivers.sh
lib/functions/general/cleaning.sh
lib/functions/general/downloads.sh
lib/functions/image/partitioning.sh
lib/functions/main/rootfs-image.sh
lib/functions/rootfs/create-cache.sh
lib/functions/rootfs/distro-agnostic.sh
commit d08b0971d93456143e2648b94341fedc5a612049
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Aug 13 13:24:53 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: manual merge (27) of `sources/families` changes between revisions 9c52562176390624d33c93634e63a8f91cc0815b and af6ceee6c55bd4726139fb8b1ad77641d385515a
config/sources/families/bcm2711.conf
config/sources/families/imx6.conf
config/sources/families/include/meson64_common.inc
config/sources/families/include/meson_common.inc
config/sources/families/include/rockchip64_common.inc
config/sources/families/include/sunxi64_common.inc
config/sources/families/include/sunxi_common.inc
config/sources/families/include/uefi_common.inc
config/sources/families/jethub.conf
config/sources/families/media.conf
config/sources/families/mvebu64.conf
config/sources/families/rk322x.conf
config/sources/families/rockchip-rk3588.conf
config/sources/families/rockchip.conf
commit 2306f2c90751a293dfed429819496b1c7cce3ab0
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Jun 29 10:38:41 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: move `ROOTFSCACHE_VERSION` resolution from GitHub from `main-config` down to `create-cache`
- this way config does not depend on remote...
lib/functions/configuration/main-config.sh
lib/functions/rootfs/create-cache.sh
commit dfcfcbc5e08b81d294170bb901900f7772abc0ae
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Jun 29 13:26:06 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: move `ARMBIAN_MIRROR` selection (network) from `main-config` to `prepare-host`
- this way CONFIG_DEFS_ONLY can run without touching the network
lib/functions/configuration/main-config.sh
lib/functions/host/prepare-host.sh
commit 8f2922f37b7ccc5c790c77d96bcc25ba5f13118b
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Jul 18 15:37:15 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: manual merge (26) of MD5-checking via debsums (3955) re-imagined
- @TODO make sure
lib/functions/rootfs/create-cache.sh
commit 733b9bfb06ea36373049b98751f42e13905247d5
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Jul 18 15:26:08 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: manual merge (26) of sources/families changes between revisions 20ee8c54502f877bfa563e113d67709cb80dc6f9 and 9c52562176390624d33c93634e63a8f91cc0815b
config/sources/families/jetson-nano.conf
config/sources/families/media.conf
commit 63aa49ecac9c0401f359bb3ad801af6f7618a5ce
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Jul 18 15:17:50 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: manual merge (26) of lib changes between revisions 20ee8c54502f877bfa563e113d67709cb80dc6f9 and 9c52562176390624d33c93634e63a8f91cc0815b
- @TODO NOT including the md5/debsums check, that needs further rewrite
lib/functions/configuration/interactive.sh
lib/functions/main/config-prepare.sh
lib/functions/rootfs/apt-install.sh
commit a71814dfd278aa138d679c56026f7de1d4d6d892
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Jun 29 10:06:29 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: manual merge (25) of lib changes between revisions fe972621c61f339c9b84aaf94fd851fa789882e8 and 20ee8c54502f877bfa563e113d67709cb80dc6f9
- @TODO hmm Igor is now going out to the network for rootfs cache version during configuration phase!!! BAD BAD BAD
lib/functions/configuration/main-config.sh
lib/functions/general/downloads.sh
lib/functions/rootfs/create-cache.sh
commit 7b782918ecd066682e15b10a37a076d8ab07c70c
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Jun 29 09:59:36 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: manual merge (25) of family changes between revisions fe972621c61f339c9b84aaf94fd851fa789882e8 and 20ee8c54502f877bfa563e113d67709cb80dc6f9
config/sources/families/include/rockchip64_common.inc
config/sources/families/media.conf
commit 35a5ec860a5729794add0bc3f5b71f4dc09cd708
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Jun 22 20:23:12 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: manual merge (24) of families changes between revisions 9ca9120420aa2a39b91ab7283a7dafe113de42e8 and 560531a63505eb610d269b26858689307a9483f5
config/sources/families/include/meson64_common.inc
config/sources/families/include/rockchip64_common.inc
commit ac26f77b6eaebec9d11537995eeadb07bf87c54a
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Jun 22 20:22:08 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: manual merge (24) of lib changes between revisions 9ca9120420aa2a39b91ab7283a7dafe113de42e8 and 560531a63505eb610d269b26858689307a9483f5
lib/functions/configuration/main-config.sh
commit d868b7b64ae2da0614078cccefab59804715542c
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Jun 17 12:19:32 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: manual merge (23) of all changes between revisions 17b4fb913c76233d1e2126cfd35ecb85acfa5a25 and 9ca9120420aa2a39b91ab7283a7dafe113de42e8
config/sources/families/sun50iw6.conf
lib/functions/configuration/main-config.sh
commit d4904385fe7e7506638e68638e348d9f0b412bd7
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Jun 12 14:03:44 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: manual merge (22) of all changes between revisions 0eb8fe7497aebf341bead2b3b0fb7309fd7bdc14 and 1dddf78cd0ed096edd6506241cfd9aa8cc27ba4e
- @TODO EXCEPT the insanity about locales/eval/VERYSILENT in #3850, requires deep review
config/sources/families/bcm2711.conf
config/sources/families/imx6.conf
config/sources/families/include/meson_common.inc
config/sources/families/include/rockchip64_common.inc
config/sources/families/include/sunxi64_common.inc
config/sources/families/include/sunxi_common.inc
config/sources/families/include/uefi_common.inc
config/sources/families/mvebu64.conf
config/sources/families/odroidxu4.conf
config/sources/families/rk322x.conf
config/sources/families/rockchip.conf
lib/functions/compilation/patch/kernel-drivers.sh
lib/functions/compilation/uboot.sh
lib/functions/extras/buildpkg.sh
lib/functions/host/prepare-host.sh
lib/functions/image/partitioning.sh
commit 3459a57c661ce495eba407216a8c38f6f297b617
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat May 28 12:44:49 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: manual merge (21) of all changes between revisions e7d7dab1bb50c1172206629a44f983c1794f8359 and 0eb8fe7497aebf341bead2b3b0fb7309fd7bdc14
config/sources/families/include/meson_common.inc
config/sources/families/include/rockchip64_common.inc
config/sources/families/media.conf
config/sources/families/mvebu64.conf
config/sources/families/sun50iw9.conf
lib/functions/compilation/debs.sh
lib/functions/compilation/patch/kernel-drivers.sh
lib/functions/host/prepare-host.sh
lib/functions/image/partitioning.sh
commit e4d0f9c279b4b8859b23e4828579337ea415f175
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon May 23 20:35:54 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: fix: patching CREATE_PATCHES=yes
- needed to create output dir
lib/functions/compilation/patch/patching.sh
commit 2058ba0f88aa1196667089faedd64e469c7d7f32
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat May 21 21:36:33 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: add `python2-dev` dep for old uboots
- cleanup some comments
lib/functions/host/prepare-host.sh
commit 79185a3bad52301322e806a22103922b430f99fc
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat May 21 18:52:18 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: manual merge (20) of all changes between revisions 6b72ae3c864fc020c6aadea473997ca033a0d8cc and 247c4c45fd18aa370575998443fc837466c02971
config/sources/families/include/rockchip64_common.inc
lib/functions/compilation/debs.sh
lib/functions/extras/buildpkg.sh
lib/functions/image/fingerprint.sh
commit 449ce337d3997a00b867dcb9baae9624983fefdb
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat May 21 16:22:58 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:40 2022 +0200
armbian-next: fix: pass `TERM` to kernel's make, so `make menuconfig` can work
lib/functions/compilation/kernel.sh
commit 61c3306cdf3f79c318f93aa677b26da072d003bc
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed May 18 11:49:04 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: fix: git: read commit UNIX timestamp/local date correctly
- `checked_out_revision_ts` was correct; git outputs `%ct` as a UNIX timestamp, UTC-based
- `checked_out_revision_mtime` was incorrect: git output it without converting to local time
- manually convert using `date @xx` so it has correct local time, whatever it is.
- add debugging to `get_file_modification_time()` too
lib/functions/compilation/patch/fasthash.sh
lib/functions/general/git.sh
commit 73dba5953b8b76715005d8f8096040c4d5bcc153
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Tue May 17 11:06:22 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: abstract `$QEMU_BINARY` to `qemu-static.sh`: `deploy_qemu_binary_to_chroot()`/`undeploy_qemu_binary_from_chroot()`
- add hackish logic to avoid removing binary that would be needed if image actually contains `qemu-user-static` package
config/sources/amd64.conf
extensions/flash-kernel.sh
lib/functions/image/initrd.sh
lib/functions/rootfs/create-cache.sh
lib/functions/rootfs/post-tweaks.sh
lib/functions/rootfs/qemu-static.sh
lib/library-functions.sh
commit ef945476dee668f7ab3889f0cc2994467613b0d7
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon May 16 18:06:25 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: fix `uuidgen` basic dep check; use fake bash `$RANDOM` if uuidgen not available
- not good: we need uuidgen to begin logging, but it may not be installed yet. workaround.
lib/functions/cli/cli-entrypoint.sh
lib/functions/host/basic-deps.sh
commit bc644378ffa202f368e6c0bc705d7c3b05709f21
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed May 11 21:15:18 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: retry 3 times download-only also for `PACKAGE_LIST_BOARD`
- acng is really not helping
lib/functions/rootfs/distro-agnostic.sh
commit 37a7eb9cbbf8fdf02054e2c9b5fd9eb924aa2524
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed May 11 16:51:09 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: allow customizing UBUNTU_MIRROR (ports mirror) with `CUSTOM_UBUNTU_MIRROR_ARM64=host/path`
lib/functions/configuration/main-config.sh
commit 6533471c376936d076fe884304b27e904af6d54e
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon May 9 20:41:47 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: WiP: kernel make via `env -i` for clean env; show produced /boot tree
lib/functions/compilation/kernel-debs.sh
lib/functions/compilation/kernel.sh
commit 514a63ddef96369aa2be85175544eedb000779c5
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun May 8 20:50:42 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: manual merge (19) of all changes between revisions b23498b94909a855d8b0fda1a95ccfc0ab17c747 and e621d25adc8ee66b0d14c94605ef462a13464b85
- the ssh firstrun revert stuff mostly
lib/functions/main/rootfs-image.sh
commit 896c4e78d75f23a8dfa21354773cd8254f34d196
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat May 7 03:55:49 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: *breaking change* remove `LIB_TAG` and `.ignore_changes` completely
- one day should be replaced with an "update checker" extension, or even "update-enforcer"
- for now this just causes chaos
config/templates/config-example.conf
lib/functions/cli/cli-entrypoint.sh
lib/functions/cli/utils-cli.sh
commit d20902020953d75c3f7d1a9c27ec9c553825660a
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun May 8 14:15:32 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: `python2` is required for some u-boot builds
- would be "use `python-is-python2` so /usr/bin/python exists and points to Python 2.x" but Jammy does not have that anymore
- python2 is required for some u-boot builds.
- that said, python 2.x is deprecated for a while and needs work thus @TODO
lib/functions/host/prepare-host.sh
commit cec6a1b3ebe5c7df20dc8be8f7687416843d5db9
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun May 8 13:45:19 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: bump Python info gatherer to RELEASE=jammy too
lib/tools/info.py
commit 75a638f13bfeeb3327510ad9c1ef3ce3adb166bd
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun May 8 13:44:28 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: add `KERNEL_MAJOR_MINOR` info to `media` kernel (@balbes150)
- 5.18 is not yet released so might be a problem here
config/sources/families/media.conf
commit 91db9e2a305cd385077289363ffe1212a7c614f2
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun May 8 00:18:35 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: allow to skip submodules during `fetch_from_repo`; introduce hook `fetch_custom_uboot`
- via GIT_SKIP_SUBMODULES=yes, which disables all submodules everywhere
- via UBOOT_GIT_SKIP_SUBMODULES=yes, which disables fetching of submodules during uboot fetch (hidden rkbins anyone?)
- extension hook `fetch_custom_uboot` so we can fetch our own stuff if needed
lib/functions/compilation/uboot.sh
lib/functions/general/git.sh
commit fb3add638441223317735bf5eb826badfe8c0924
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon May 9 12:15:08 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: `initrd` caching fixes (always enable hook; if cache hit, convert to uImage too)
lib/functions/image/initrd.sh
commit a732119d010bf7008caaacf3e50b3659c8dbf472
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Apr 17 05:19:46 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: introduce `initramfs`/`initrd` caching
- using hashes of (hopefully) all involved files
- cache hits are rewarded with sprinkly hearts.
- why? this proves we got a reproducible kernel modules build!
- also, you just saved yourself 2-10 minutes of pain
lib/functions/image/initrd.sh
lib/functions/logging/logging.sh
commit 220529f8f779673746843fa55b84d23753f1e037
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat May 7 16:54:00 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: manual merge (18) of changes between revisions 08cf31de73de5f5ba1986348e4556b00d77af09f and c8855aa08dafaa02c939039e55e01967bad61c28
- heh; most bash code changes are for things already done in -next, or no longer used
- some version bumps, etc
config/sources/families/bcm2711.conf
config/sources/families/imx6.conf
config/sources/families/include/meson64_common.inc
config/sources/families/include/rockchip64_common.inc
config/sources/families/jetson-nano.conf
config/sources/families/media.conf
config/sources/families/mvebu.conf
config/sources/families/mvebu64.conf
config/sources/families/odroidxu4.conf
config/sources/families/rk35xx.conf
config/sources/families/virtual.conf
lib/functions/bsp/bsp-cli.sh
lib/functions/compilation/patch/kernel-bootsplash.sh
lib/functions/compilation/patch/kernel-drivers.sh
lib/functions/configuration/main-config.sh
lib/functions/general/downloads.sh
lib/functions/general/repo.sh
lib/functions/image/partitioning.sh
lib/functions/main/rootfs-image.sh
lib/functions/rootfs/distro-agnostic.sh
commit eb38c77729431d0c89ae1f0546ab56e450429acc
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat May 7 13:09:55 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: cleanup entrypoint and shuffle `prepare_host_basic()` into logging section
lib/functions/cli/cli-entrypoint.sh
lib/functions/host/basic-deps.sh
commit 91af44294685e7747b5df793778a1790756e8ce7
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Apr 20 15:32:16 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: *breaking change* add global extlinux killswitch `ALLOW_EXTLINUX`
- unless you set `ALLOW_EXTLINUX=yes`, then `SRC_EXTLINUX` will be disabled globally.
- add a bunch of logging regarding extlinux, armbianEnv and bootscripts for clarity during build
- this is due to nand-sata-install problems with extlinux
- some boards _only work_ with extlinux; we'll have to handle it later
lib/functions/bsp/bsp-cli.sh
lib/functions/configuration/main-config.sh
lib/functions/image/partitioning.sh
lib/functions/rootfs/distro-agnostic.sh
commit 03516ad0f6d5fc598f67c896e6dc28eb91b54ddf
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri May 6 10:25:26 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: extensions: `image-output-{qcow2|ovf}`: virtual output formats
- which use `qemu-utils` for `qemu-img` conversion of the .img
extensions/image-output-ovf.sh
extensions/image-output-qcow2.sh
commit 36a2c3741d28a6280af99bcd7d8f9d3a339a7fcb
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri May 6 10:24:10 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: extension: `kernel-localmodconfig`: faster/slimmer kernel builds with `make localmodconfig`
extensions/kernel-localmodconfig.sh
commit 981a9f5856ba100eaad07c9ffe7e24f578e93003
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri May 6 10:23:29 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: extension: `cleanup-space-final-image`: zerofree, slim down firmware, show used space
extensions/cleanup-space-final-image.sh
commit 5d51b5559c28815deb56d27e1ca22765dc22e853
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Apr 23 16:07:44 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: introduce `do_with_ccache_statistics` and use it for kernel compile
- some TODOs
- better logging for .config copying
lib/functions/compilation/kernel.sh
commit 0a29ad6f91eae99594e52173724fdf87b5b186d5
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Apr 16 19:23:13 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: *breaking change* really disable apt sources for non-desktop builds
lib/functions/rootfs/apt-sources.sh
commit fc0621decc383f2aed1194f882035b26de49c0aa
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Apr 29 17:55:47 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: fix: don't manage apt-cacher-ng if told NOT to, not the other way around
lib/functions/host/apt-cacher-ng.sh
commit bdb9aba47d9b70cfb04089866bafe176a1e6dab6
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Apr 16 14:55:43 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: `JUST_UBOOT=yes` + hooks `build_custom_uboot()`/`post_write_uboot_platform()`
- post_write_uboot_platform()
- only runs during build, for now (not on device)
- build_custom_uboot()
- allow fully custom, extension driven, building of u-boot
- also partial preparation of uboot source combined with default Armbian build
- HACK: u-boot: downgrade some errors to warnings via KCFLAGS
- fix copy of atf bins to uboot, don't do it if atf's not there
lib/functions/compilation/uboot.sh
lib/functions/image/loop.sh
lib/functions/main/default-build.sh
commit 893b8615a1a976ee6246e186f59aba468ad1a7b5
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Apr 28 09:35:26 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: fix: no use testing the host for resolvconf if we're manipulating the SDCARD
lib/functions/rootfs/distro-agnostic.sh
commit 25a8de27bb2b240734c1647a71826688b474b0a0
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Apr 24 09:32:14 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: sunxi_common: avoid shortcircuit error on family_tweaks_bsp when family_tweaks_bsp_s is not defined
config/sources/families/include/sunxi_common.inc
lib/functions/bsp/bsp-cli.sh
commit c46418fd00b24879e4a4f18f77c19ccb887a9346
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Apr 22 12:50:21 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: fix: add `zstd` and `parallel` to hostdeps
lib/functions/host/prepare-host.sh
commit 6d5a8490804d8427c6f4578389b0ae73c746ed61
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Apr 20 12:49:20 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: manual merge (17) of all changes between revisions 64410fb74b44cca82e9affbdf93a59d5692862ff and 08cf31de73de5f5ba1986348e4556b00d77af09f
- changes about `git safe dir` ignored, I've done the same in a different way
- hash calculation changes ignored, fasthash is completely different
config/sources/families/include/sunxi64_common.inc
config/sources/families/include/sunxi_common.inc
config/sources/families/include/uefi_common.inc
config/sources/families/mvebu64.conf
lib/functions/compilation/patch/kernel-drivers.sh
lib/functions/host/external-toolchains.sh
commit 8341a778f0a1b9678858904eaddb540f43129b58
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Tue Apr 19 13:48:06 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: add `crossbuild-essential-armel` so `arm-linux-gnueabi-gcc` is available with system toolchains
- need to for some ATF builds, at least.
lib/functions/host/prepare-host.sh
commit 8fdc420cc001b9ad79784ff486461eb0a2af6be8
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Tue Apr 19 00:18:04 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: rockchip64_common: lotsa logging and debugging
- supposedly no practical changes
config/sources/families/include/rockchip64_common.inc
commit 52922a6b105279e73ccb760523e43fa6f7b0d5e0
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Apr 18 10:56:34 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: grub: better logging
extensions/grub.sh
commit 7bf6574305c5d2b7230225007fa4a62e0f19a817
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Apr 18 11:23:10 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: fix for chaos caused by git's fix of CVE-2022-24765 otherwise "fatal: unsafe repository"
- might not be the best solution, but it's the only one I found
compile.sh
lib/functions/compilation/debs.sh
lib/functions/configuration/main-config.sh
lib/functions/general/git.sh
commit ad315fb153cd743614eb2d4102ad8a61d8be99aa
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Apr 18 23:14:20 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
partitioning: fix: don't try fixing a bootscript that's not there
- this fixes a bug when "rootpart=2" without rootpart 1 being /boot
lib/functions/image/partitioning.sh
commit 1661922e79f34bec964fdd86e278489e28945b4d
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Apr 18 23:15:29 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: cleanups: umount tmpfs-based $SDCARD during cleanup too
lib/functions/main/rootfs-image.sh
commit 7253f98a262253eab6094b29640293079b673ab0
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Apr 18 23:16:32 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: indented heredoc, no functional changes
lib/functions/image/rootfs-to-image.sh
commit 1ac36b752e2982dbf59336c3ee857c91080ed8cf
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Apr 16 19:23:00 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: fix shortcircuit as last statement in case of extlinux
- yes, I wasted 3 hours on this tiny bit, so *you* don't have to!
- better logging for rootfs `mkfs` et al
- introduce `PRESERVE_SDCARD_MOUNT=yes` to preserve SDCARD, MOUNT, and LOOP for debugging
lib/functions/image/partitioning.sh
lib/functions/main/rootfs-image.sh
commit ef3709d30ee099523db2ad28e3f65e0d17754f50
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Apr 16 12:13:07 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: kernel-headers: less verbose, trimmed down tools a bit (perf and testing)
lib/functions/compilation/kernel-debs.sh
commit 20c29c1d6e04783ac8e8151f27f57b52b8531342
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Apr 16 11:23:13 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
khadas-vim3l: add asound.state for Khadas VIM3L
config/boards/khadas-vim3l.conf
packages/blobs/asound.state/asound.state.khadas-vim3l
commit a22979940d28a816571644e92f157fe8e0af431f
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Apr 16 11:14:23 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: introduce hook `extension_finish_config()` - late hook for ext configuration
- `extension_finish_config()` is the last thing done in config phase
- use it for determining stuff based on kernel version details, package names, etc
- also tune down some logging which was too verbose
- CI logs with no ANSI escape codes
extensions/nvidia.sh
extensions/zfs.sh
lib/functions/logging/logging.sh
lib/functions/main/config-prepare.sh
lib/functions/rootfs/apt-sources.sh
commit bedd3aa1a4c661bc177af7dd0db3062296d7ec5f
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Apr 16 00:45:30 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: shuffle around code and logic of `add_desktop_package_sources()`
- @TODO: still needs proper asset logging for sources.list(.d)
- @TODO: tunes down adding of sources/packages to CLI builds, check with Igor
lib/functions/rootfs/apt-install.sh
lib/functions/rootfs/apt-sources.sh
lib/functions/rootfs/create-cache.sh
lib/functions/rootfs/rootfs-desktop.sh
lib/library-functions.sh
commit 4876e0444f33ea1ce28cb340215638702ef98792
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Apr 15 22:07:17 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: 4.x can't build objtool in kernel-headers; allow for handling that later
- 4.x has a lot more obtuse dependencies
- introduce KERNEL_HAS_WORKING_HEADERS calculated based on KERNEL_MAJOR_MINOR
extensions/nvidia.sh
extensions/zfs.sh
lib/functions/compilation/kernel-debs.sh
lib/functions/main/config-prepare.sh
commit 6b5726444e6be8a935fe758664847184e7642840
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Apr 15 21:48:22 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: downgrade `error=misleading-indentation` to warning
- some 4.x kernels patches are really messy
- newer gcc's make that an error now
lib/functions/compilation/kernel.sh
commit 54cad4f827e14967d692ae4d14426394cc56b4ff
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Apr 15 17:23:42 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: *allow cross compilation*, even the so-called "reverse cross-compile" (amd64 on arm64)
config/sources/amd64.conf
lib/functions/compilation/kernel.sh
commit c57535fbcab21c0cf7284e0cbcb614971e6d4bd7
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Apr 15 13:49:23 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: add `zfs` extension, which installs headers and builds ZFS via DKMS in chroot
- similar to how `nvidia` extension does it
extensions/zfs.sh
commit 82756687f5930a55f413a3f7164b1fb9337bd2b0
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Apr 15 13:49:56 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: x86: enable `nvidia` extension for all releases (only desktop)
config/sources/families/uefi-x86.conf
commit d4ce330682ba9563b1821ae08b8412e9149fec80
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Apr 15 13:53:14 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: `headers-debian-byteshift.patch` is dead; long-live cross-compiled source-only kernel-headers
- kernel-headers package now only includes _sources_
- postinst does the compilation and preparation for DKMS compatibility
- `tools` dir is included now, which includes the byteshift utilities
- handle special scripts/module.lds case after 5.10
- tested on a 6 combinations of `x86` / `arm64` / `armhf` (3x targets, 2x hosts)
- @TODO: we might be able to reduce the size of tools a bit (perf/tests/etc)
- @TODO: still missing ARCH vs ARCHITECTURE vs SRC_ARCH clarity elsewhere
lib/functions/compilation/kernel-debs.sh
lib/functions/compilation/kernel.sh
patch/misc/headers-debian-byteshift.patch
commit d797c800c30b6a86f105e511068e545f90b9c825
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Apr 15 13:37:13 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: allow `use_clean_environment=yes` for `chroot_sdcard_apt_get()` and descendants
- this causes command to be run under `env -i`, for a clean environment
lib/functions/logging/runners.sh
commit 0caf73b8ee67c9f34b6e6d1fce8b86ed4021694c
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Apr 14 09:58:15 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: manual merge (16) of all changes between revisions be9b5156a4bdcb3850fbe0e7ada0f4421acde174 and 2a8e1ecac1c4fdbf986034be9d6c05a8f1b6e6fb
- many `traps` ignored: we don't use them anymore
config/sources/families/include/meson64_common.inc
config/sources/families/media.conf
config/sources/families/rk322x.conf
config/sources/families/rockchip.conf
config/sources/families/sun50iw6.conf
config/templates/Dockerfile
lib/functions/compilation/patch/kernel-drivers.sh
lib/functions/configuration/main-config.sh
lib/functions/extras/buildpkg.sh
lib/functions/general/downloads.sh
lib/functions/image/partitioning.sh
lib/functions/rootfs/distro-specific.sh
commit 71addbe3ffd4e9e8015125186d11fc53eac1da25
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Apr 7 15:56:19 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: fix logging for apt sources/gpg keys
lib/functions/rootfs/rootfs-desktop.sh
commit 7ca67f8d2669568a654d0fcf11415b24434cfd0b
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Apr 7 13:54:59 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: don't leak `if_error_xxx` vars across runner helper invocations; always clean then (even if no error)
- also: fix wireguard-tools install, had a double parameter there
lib/functions/logging/runners.sh
lib/functions/rootfs/distro-agnostic.sh
commit a057b793478fde9b1e0015d52b711c0442d91789
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Apr 7 13:53:58 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
bcm2711: rpi4b: add `pi-bluetooth` which provides working Bluetooth
config/sources/families/bcm2711.conf
commit b0d907082d89474a04a790919fad6e27043bc474
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Apr 7 12:06:26 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: fixes for (non-)logging when interactively configuring kernel (`KERNEL_CONFIGURE=yes`)
lib/functions/compilation/kernel.sh
commit e10cb5c51bd77b47ee06ac7c9aaaaa4485646f61
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Apr 3 11:28:18 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: move `lz4` rootfs caches to `zstd`, multithreaded
lib/functions/rootfs/create-cache.sh
commit 1b602cf8ebae2179b8590126751ce801c976cdfb
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Apr 3 11:25:50 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: customize.sh: error handling, do not mount overlay if it doesn't exist
lib/functions/rootfs/customize.sh
commit 09a55387f126f1907945ee72060cdd42973a8d4b
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Apr 2 21:15:55 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:39 2022 +0200
armbian-next: extra info for runners; `if_error_detail_message` and `if_error_find_files_sdcard` globals
- those are unset after running any command
- if error occur, message and/or found files will be included in log, for clarity
extensions/nvidia.sh
lib/functions/compilation/uboot.sh
lib/functions/logging/logging.sh
lib/functions/logging/runners.sh
lib/functions/rootfs/apt.sh
lib/functions/rootfs/create-cache.sh
commit 4cbbde478c436b76c883d4ece3a74fc8d0aeb72d
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Apr 2 16:01:19 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: manual merge (15) of all changes between revisions 0f7200c7932bb04a34601a25fe30dca0197fbc8b and 101eaec90750f23cae3075d6b5329a33b2bf4685
config/sources/families/rk35xx.conf
lib/functions/configuration/main-config.sh
lib/functions/rootfs/create-cache.sh
lib/functions/rootfs/rootfs-desktop.sh
commit 0023bcce6aaed245b27c031156ba650acbafed3b
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Apr 1 12:27:19 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: better logging for `rsync` calls everywhere
- make rsync verbose
lib/functions/bsp/bsp-cli.sh
lib/functions/compilation/debs.sh
lib/functions/compilation/kernel.sh
lib/functions/compilation/uboot.sh
lib/functions/image/rootfs-to-image.sh
lib/functions/rootfs/apt.sh
commit 5aa5cad33ed6ea11af0cb371c0f5a1ef3cce0309
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Apr 1 00:51:22 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: downloads: skip download if no `ARMBIAN_MIRROR` nor `DOWNLOAD_MIRROR`; less logs
lib/functions/general/downloads.sh
commit fcc2cdc23237549cde54eee47b76776106c29ec0
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Mar 31 20:02:17 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: update rockchip.conf from master and use runners
config/sources/families/rockchip.conf
commit 0b7e6c6bb6a744d6b95038e9ab3b1ab7b1aa7027
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Mar 31 19:33:39 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: update mvebu64.conf from master and use functions
config/sources/families/mvebu64.conf
commit b1ded35c1baa90f16652299b433410fef216f8f7
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Mar 31 19:23:33 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: git: fix `fetch_from_repo` with actual submodules usage
lib/functions/general/git.sh
commit 8996fb16048de112e985c9f2a4d5f896623b1cd0
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Mar 31 16:25:50 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: `armbian-next`ify the `nvidia` extension after rebase from master
- driver version is configurable via `NVIDIA_DRIVER_VERSION`
- use runner function to log/error-handle/use apt cache/etc
extensions/nvidia.sh
commit d72e4b69754671ba464882cbca6b68c67e2c7c9a
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Mar 10 00:00:39 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
rpi4b: there's no legacy branch anymore, remove it from KERNEL_TARGET
config/boards/rpi4b.wip
commit 1dbe3c33255a6947743bed2c3dd0ba067035208f
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Mar 9 13:19:20 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: `download_and_verify` non-error handled; logging is messy [WiP] [HACK]
lib/functions/general/downloads.sh
commit 30ee27b4fd6d9b578ad19ca9b0b484809242d77f
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Mar 21 17:21:03 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: logging: let ANSI colors pass to logfile; CALLER_PID instead of BASHPID in subshell
lib/functions/logging/logging.sh
commit a63ba98aefbb6ba7998ad8abedc5d239e1520191
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Mar 21 17:20:17 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: enable HTTPS CONNECT in Armbian-managed apt-cacher-ng configuration
- PPAs require it
lib/functions/host/apt-cacher-ng.sh
commit d3641a69a60266f3d7a75109fa6e396b20d85700
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Mar 31 13:41:53 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: don't loop forever if we can't obtain ARMBIAN_MIRROR from redirector
- also, don't even try to do it if `SKIP_ARMBIAN_REPO=yes`
lib/functions/configuration/main-config.sh
commit 617e2ef1d6ff85e0bc6d5c24bc391a21e125f2aa
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Mar 31 12:25:09 2022 +0200
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: manual merge (14) of all changes between revisions 13469fd8a9eda4a53f87b7dfee0f431dbab8db54 and 09e416e31cc01ece4533a65f02a470a4c21b90ea
- also editorconfig and compile.sh (root) changes
.editorconfig
config/desktop/bullseye/appgroups/browsers/armbian/create_desktop_package.sh
config/desktop/bullseye/environments/mate/armbian/create_desktop_package.sh
config/desktop/buster/appgroups/browsers/armbian/create_desktop_package.sh
config/desktop/buster/environments/cinnamon/armbian/create_desktop_package.sh
config/desktop/buster/environments/lxde/armbian/create_desktop_package.sh
config/desktop/buster/environments/mate/armbian/create_desktop_package.sh
config/desktop/focal/appgroups/browsers/armbian/create_desktop_package.sh
config/desktop/focal/environments/budgie/armbian/create_desktop_package.sh
config/desktop/focal/environments/cinnamon/armbian/create_desktop_package.sh
config/desktop/focal/environments/deepin/armbian/create_desktop_package.sh
config/desktop/focal/environments/enlightenment/armbian/create_desktop_package.sh
config/desktop/focal/environments/gnome/armbian/create_desktop_package.sh
config/desktop/focal/environments/mate/armbian/create_desktop_package.sh
config/desktop/focal/environments/xfce/debian/armbian-bsp-desktop/prepare.sh
config/desktop/sid/appgroups/browsers/armbian/create_desktop_package.sh
config/desktop/sid/environments/lxde/armbian/create_desktop_package.sh
config/desktop/sid/environments/mate/armbian/create_desktop_package.sh
config/desktop/sid/environments/xfce/armbian/create_desktop_package.sh
config/sources/families/include/rockchip64_common.inc
config/templates/Dockerfile
lib/functions/cli/utils-cli.sh
lib/functions/compilation/patch/kernel-drivers.sh
lib/functions/configuration/main-config.sh
lib/functions/host/prepare-host.sh
lib/functions/rootfs/distro-specific.sh
lib/functions/rootfs/rootfs-desktop.sh
commit d2d2fa9315f74ec155f209096fe55ead120491c6
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Mar 18 02:17:01 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: *much* improved logging to HTML; log archiving; consistency
- keep only current logfile
- log to LOGFILE also if SHOW_LOG=yes
- log cmd runtime and success/error directly in runner
lib/functions/cli/cli-entrypoint.sh
lib/functions/logging/logging.sh
lib/functions/logging/runners.sh
commit 1b160ce366c31c724346f52a7f7bfa79036a6acf
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Mar 18 00:34:46 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: *breaking change* use `MemAvailable` (not including swap) and up requirements for tmpfs
- of course add debugging logs
- rename vars
- should really only use this if we've really a lot of completely free RAM to spare
- otherwise OOM killer comes knocking
- or swapping to disk, that is counter-productive
lib/functions/main/rootfs-image.sh
commit 04a11cc78f5681dd41e3764ce644c53e7032156b
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Mar 17 22:46:05 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: *breaking change* `DEB_COMPRESS=none` by default if not running in CI/GHA
lib/functions/configuration/main-config.sh
commit 667a8de92b5075c05d2ca67761a13c93b8e8b99d
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Mar 17 22:21:45 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: *breaking change* `CLEAN_LEVEL=make` is no more; new `make-kernel`, `make-atf`, `make-uboot`
- allows individual control of what to clean
- this effectively disables `make clean` by default
- rebuilds work and timestamping works for patching, so no reason to clean everytime by default.
config/templates/config-example.conf
lib/functions/compilation/atf.sh
lib/functions/compilation/kernel.sh
lib/functions/compilation/uboot.sh
lib/functions/general/cleaning.sh
lib/functions/main/default-build.sh
commit 39999ad4efc4854213d0b2164d999071684ec1ea
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Mar 17 21:16:21 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: refactor `prepare_host`, give `apt-cacher-ng` some much needed attention
- library dir for host-related stuff, pull it out of "general" finally
lib/functions/host/apt-cacher-ng.sh
lib/functions/host/basic-deps.sh
lib/functions/host/external-toolchains.sh
lib/functions/host/host-utils.sh
lib/functions/host/prepare-host.sh
lib/functions/logging/runners.sh
lib/functions/rootfs/create-cache.sh
lib/library-functions.sh
commit 2c4ee50aabed7ad126f7ca80b870077672371a5d
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Mar 9 13:20:25 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: hostdeps: all toolchains via `crossbuild-essential-arm64`/`armhf`/`amd64`
- trying to sort out hostdeps for Jammy [WiP]
lib/functions/general/host.sh
commit c8a9f3aca890ed098b160bd060f11042d21ee711
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Mar 17 16:19:49 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: remove `eatmydata` usage, leftover from failed tries to make git faster
lib/functions/general/git.sh
commit 5d4c5aa9320ab317f540415ddb5403538630bcfb
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Mar 16 03:13:29 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: fix git origin check, recreate working copy if origin does not match
- fix cold bundle https download progress reporting
lib/functions/general/git.sh
commit 625031cd5797295e14494d7d2c986c7de9b6e15d
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Tue Mar 15 14:10:32 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: finally consolidating logs into output/logs; colorized HTML logs
lib/functions/cli/cli-entrypoint.sh
lib/functions/configuration/main-config.sh
lib/functions/general/host.sh
lib/functions/logging/logging.sh
commit 58e643c14a0b527d25856938bfc219835984e83d
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Tue Mar 15 11:30:55 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: introduce `do_with_retries()` and use it for apt remote operations during image build
lib/functions/logging/runners.sh
lib/functions/rootfs/create-cache.sh
commit ff3ccab39db2e364feb16b583c973d6d305c69d5
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Mar 7 09:42:57 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: another round of logging tuning/fixes; log assets; git logging
- introduce `do_with_log_asset()` and `LOG_ASSET=xxx`
- separate "git" logging level
- add `trap_handler_cleanup_destimg()` to cleanup DESTIMG
lib/functions/cli/cli-entrypoint.sh
lib/functions/compilation/kernel-debs.sh
lib/functions/compilation/patch/fasthash.sh
lib/functions/configuration/main-config.sh
lib/functions/general/git.sh
lib/functions/image/initrd.sh
lib/functions/image/rootfs-to-image.sh
lib/functions/logging/logging.sh
lib/functions/main/default-build.sh
lib/functions/main/rootfs-image.sh
lib/functions/rootfs/distro-agnostic.sh
commit fb943e2aa891513456e76a07a32351f04d2b1fe2
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Mar 14 18:51:39 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: kernel: use parallel compressors; reproducible kernel builds
- also remove leftover mkdebian/builddeb parameters in make invocation
- add pbzip2 to hostdeps
lib/functions/compilation/kernel.sh
lib/functions/general/host.sh
commit fcba106dae815e6d90fea84cc538239030fde9ac
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Mar 14 18:50:13 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: tuning logging for timestamp/fasthash related stuff which is very verbose
- idea is to not completely overwhelm `SHOW_DEBUG=yes` case
- make patching quieter and use file instead of stdin
- set checked_out_revision_ts during git checkout (timestamp version of _mtime)
- timestamp | fasthash logging level (via `SHOW_FASTHASH=yes`)
lib/functions/compilation/patch/fasthash.sh
lib/functions/compilation/patch/patching.sh
lib/functions/general/git.sh
lib/functions/logging/logging.sh
commit dab49a9133741fce7b40bdeff1e6cccf6becc180
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Mar 14 15:02:20 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: completely remove mkdebian/builddeb/general-packaging kernel packaging stuff
lib/functions/compilation/kernel.sh
lib/functions/compilation/patch/kernel-pkg.sh
lib/library-functions.sh
packages/armbian/builddeb
packages/armbian/mkdebian
patch/misc/general-packaging-4.14.y.patch
patch/misc/general-packaging-4.19.y-rk35xx.patch
patch/misc/general-packaging-4.19.y.patch
patch/misc/general-packaging-4.4.y-rk3399.patch
patch/misc/general-packaging-4.4.y-rockchip64.patch
patch/misc/general-packaging-4.4.y.patch
patch/misc/general-packaging-4.9.y.patch
patch/misc/general-packaging-5.10.y.patch
patch/misc/general-packaging-5.3.y.patch
patch/misc/general-packaging-5.6.y.patch
patch/misc/general-packaging-5.8-9.y.patch
commit 134bb92d95726ae56da8734bc9c39552c4821e4c
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Mar 9 23:43:39 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: manual merge (12) of all changes between revisions 34d4be6b7b346507af58133125cef0bc8ff5aef1 and 5fe0f36aa832ac64d1db05adc4eb09a4df4b5509
config/sources/families/rk35xx.conf
lib/functions/configuration/main-config.sh
lib/functions/general/git.sh
commit 6058f580ae03c4c197ea60789128edca73046758
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Mar 9 18:41:30 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: introduce `PRESERVE_WORKDIR=yes` for heavy debugging
lib/functions/main/default-build.sh
commit 87c808d5d398dc51a1fabe97b732d94d3094b8b9
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Mar 9 14:39:21 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: packaging linux-headers again
- do NOT use any output from `make headers_install` - that's for libc headers
- grabs "headers" (and binary tools) directly from the kernel build tree, not install target
- does not produce headers if cross compiling, for now
- produces kernel-headers package for the architecture on which it was built
- doing a single make invocation with build and install for packaging
- using 'make all' in place of vmlinuz/bzImage/image/zImage
lib/functions/compilation/kernel-debs.sh
lib/functions/compilation/kernel.sh
commit 8cfda3dcc398e3abb11f05f76509b4a165e402d3
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Mar 9 13:20:05 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: apt download-only retried 3 times before installing main packages
lib/functions/logging/runners.sh
lib/functions/rootfs/create-cache.sh
commit 4b82345a588df2d9214b1ace097599ad42ee3463
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Tue Mar 8 12:56:04 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: fix `VER=` read from kernel-image package, also add `linux` default
lib/functions/compilation/kernel-debs.sh
lib/functions/rootfs/distro-agnostic.sh
commit 5d2a41313f02fd2e651c911984ae6b6f803154c7
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Mar 7 10:24:52 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: some logging for atf compilation
lib/functions/compilation/atf.sh
commit 779e9978e01f5d1706d85acc3f0182046cebcfbd
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Mar 7 10:09:29 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: rewrite hostdeps as array, add armhf toolchains
lib/functions/general/host.sh
commit 3a8770b0a1e28eaa7009964d6ebc3ba494de8010
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Mar 7 06:20:17 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: distro-agnostic: cleanups
lib/functions/rootfs/distro-agnostic.sh
commit 4d47d22489538006f32464dc9a0058a77810536b
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Mar 5 02:24:29 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: armbianEnv hooks/debugs (bsp / image)
lib/functions/bsp/bsp-cli.sh
lib/functions/image/partitioning.sh
commit 1afd681bab297b9441fe9e65104ba52d1a3d96ce
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Mar 4 04:16:50 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: rpi: completely remove dtb hacks, allowing flash-kernel to work again
config/sources/families/bcm2711.conf
commit 33beb042960cbf7ab66271a44b53b79dafa01642
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Mar 4 01:09:55 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: refactor new kernel packaging; add linux-dtb package back in finally, upgrades untested
lib/functions/compilation/kernel-debs.sh
commit 5cd4b7a471267aaf8a1336629a65a6df4b81b087
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Mar 3 23:31:08 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: refactor new kernel packaging; extract hook helper, fix kernel symlink
lib/functions/compilation/kernel-debs.sh
commit c2259116c1728595802cf29aae7f29098a4a5c99
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Mar 3 21:49:24 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: refactor new kernel packaging; add linux-dtb package back in finally, all hooks untested
lib/functions/compilation/kernel-debs.sh
lib/functions/compilation/kernel.sh
commit 7cd425e1c3c2efa14c7fb7a13a9b24f9bb5cfc38
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Mar 2 20:31:44 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
flash-kernel: fix short-circuits as last statement in functions
extensions/flash-kernel.sh
commit b459fb3af894ae4315e8416fee62d77c2a1a191b
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Mar 2 13:28:37 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: do not force `SHOW_LOG=yes` if `CI=true`; let's _trust_ logging and error handling works
compile.sh
commit a0ed264825785655fba53d67de525ddebbb48090
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Mar 2 13:26:56 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: back out of setting mtime to the revision time during git checkout.
- of course this causes huge recompiles when wanted revision moves forward
lib/functions/general/git.sh
commit 4d1d62558c4cf4f670fae821f7629a01a1f2c35e
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Mar 2 13:16:04 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: sync 'config' dir from master revision ed589b248aef675cb5e845fcb55c12dfbcc5e925
- this is _also_ getting out of hand... gotta merge soon
config/boards/rpi4b.wip
config/boards/uefi-arm64.conf
config/boards/uefi-x86.conf
config/sources/families/bcm2711.conf
config/sources/families/include/meson64_common.inc
config/sources/families/include/rockchip64_common.inc
config/sources/families/include/uefi_common.inc
config/sources/families/jetson-nano.conf
config/sources/families/media.conf
commit b4c137bdb097e7cbba7bfc22795fa1223ea2bc7d
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Mar 2 12:57:31 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: sync 'packages' dir from master revision ed589b248aef675cb5e845fcb55c12dfbcc5e925
packages/armbian/builddeb
packages/armbian/mkdebian
packages/bsp/common/etc/profile.d/armbian-activate-profile-sync-daemon.sh
packages/bsp/common/etc/profile.d/armbian-check-first-login-reboot.sh
packages/bsp/common/etc/profile.d/armbian-ssh-title.sh
packages/bsp/jethub/jethub-remove-log-file.sh
packages/bsp/nanopim4/nanopim4-pwm-fan.sh
packages/bsp/odroid/c1_init.sh
packages/bsp/odroid/c2_init.sh
packages/bsp/rk3328/z28pro/start_bt.sh
packages/bsp/rockchip/start_bt.sh
packages/bsp/sunxi/zeroplus2-bt.sh
packages/extras-buildpkgs/hostapd-realtek/debian/ifupdown/hostapd.sh
packages/extras-buildpkgs/hostapd/debian/ifupdown/hostapd.sh
commit c216282d323014ca365a1539a305911ca835906b
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Mar 2 12:44:36 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: manual merge (11) of all lib/*.sh changes between revisions 3305d45b8175dbdd647dc1dc53fa6f0a522920c7 and ed589b248aef675cb5e845fcb55c12dfbcc5e925
lib/functions/compilation/patch/kernel-bootsplash.sh
lib/functions/compilation/patch/kernel-drivers.sh
lib/functions/configuration/main-config.sh
lib/functions/main/config-prepare.sh
commit c2871d87a4237f167e274f9ec38442e6ff4e0934
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Mar 2 02:31:37 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: more refactorings, general logging; fixes; split image stuff
- logging flowing correct to LOGDIR, still needs packaging
lib/extensions.sh
lib/functions/compilation/kernel.sh
lib/functions/configuration/main-config.sh
lib/functions/general/chroot-helpers.sh
lib/functions/image/compress-checksum.sh
lib/functions/image/fingerprint.sh
lib/functions/image/partitioning.sh
lib/functions/image/rootfs-to-image.sh
lib/functions/image/write-device.sh
lib/functions/logging/logging.sh
lib/functions/logging/traps.sh
lib/functions/main/default-build.sh
lib/functions/main/rootfs-image.sh
lib/library-functions.sh
commit c7862c7c5e2807060ead176597998270256faff9
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Tue Mar 1 11:44:32 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: complete removal of usages of `LOG_SUBPATH`; 100% error handled
- loose ends, use new LOGDIR
- remove the last shortcircuit in extensions execution, now it's 100% error handled
- many logging fixes
- still missing: final log consolidation/cleanup
extensions/gen-sample-extension-docs.sh
extensions/grub.sh
lib/extensions.sh
lib/functions/bsp/bsp-desktop.sh
lib/functions/cli/cli-entrypoint.sh
lib/functions/configuration/main-config.sh
lib/functions/general/downloads.sh
lib/functions/general/host.sh
lib/functions/image/initrd.sh
lib/functions/image/partitioning.sh
lib/functions/image/rootfs-to-image.sh
lib/functions/logging/logging.sh
lib/functions/logging/runners.sh
lib/functions/main/config-prepare.sh
lib/functions/main/rootfs-image.sh
lib/functions/rootfs/distro-agnostic.sh
lib/functions/rootfs/rootfs-desktop.sh
commit 11d89f69e44b97e6f494a92ea688099f2c9b8370
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Feb 28 20:36:55 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
logging: blue groups if `SHOW_DEBUG=yes` or `SHOW_GROUPS=yes` (console equivalent of CI's avocado)
lib/functions/logging/logging.sh
commit c3f70639f0f0323baef75950f664e10517ef94fb
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Feb 28 17:20:18 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:38 2022 +0200
armbian-next: shut down some too-verbose logging: logo building and update-initramfs
lib/functions/image/initrd.sh
lib/functions/rootfs/boot_logo.sh
commit 9218d4a1196a4b7d0f303a972e2f5c293e789d90
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Feb 28 15:43:03 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: git/patching, kernel: use date from git as mtime minimum for patched files
- use revision's date from git log as mtime for all fetch_from_repo
- fix patched files date at least checkout date, otherwise some patches never build
lib/functions/compilation/kernel.sh
lib/functions/compilation/patch/fasthash.sh
lib/functions/compilation/patch/patching.sh
lib/functions/general/git.sh
commit 839e3ab254e7d5f91fa5eeb1f456e66bf0483a1c
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Feb 28 00:20:41 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: first attempt at kernel packaging rework; just linux-image pkg, no dtbs yet
- correctly predict KERNELRELEASE, put image-dtbs in the right spot for flash-kernel
- remove dpkg-gencontrol, do it all directly
lib/functions/compilation/kernel-debs.sh
lib/functions/compilation/kernel.sh
lib/functions/compilation/patch/kernel-pkg.sh
lib/library-functions.sh
commit 477926aac9205e2b7bc07c14e2727730eba11a27
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Feb 25 22:49:47 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: rework kernel source packaging, now exporting from git, to .tar.zst
- compress with zstdmt (multi-thread zstd), remove pv indicator, it's much faster anyway
- export from git (soon will have all patches et al too)
- better logging, show pkg name
- much, much faster due to zstdmt and deb with none compression
lib/functions/compilation/kernel.sh
commit d14b2a9265f92d47185047eb8520a956f6ce9ea4
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Feb 25 00:50:27 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: a bit atrocious, nameref loaded, `get_list_of_all_buildable_boards()`
- in the process, add support for userpatches/config structure mirroring core, for easy upstreaming
lib/functions/compilation/kernel.sh
lib/functions/configuration/interactive.sh
lib/functions/configuration/main-config.sh
lib/functions/main/config-prepare.sh
commit bc0d123dc5e1baf21a20ef86d5c4e32aff3aa931
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Feb 24 19:57:43 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: make `SKIP_EXTERNAL_TOOLCHAINS=yes` default. lets see what breaks [WiP]
lib/functions/configuration/main-config.sh
commit 7fb54baca48ed6ae60b6a0025e83b0e29380164f
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Feb 24 19:57:17 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: keeping stdout clean, use display_alert() for cleanup logging
compile.sh
lib/functions/configuration/config-desktop.sh
lib/functions/configuration/main-config.sh
lib/functions/main/rootfs-image.sh
commit a3b64e15f9130871ff37061aa533ca0649c0bc0c
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Feb 24 19:35:23 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: library cleanups; remove `build-all.sh` for good; bring `patching.sh` back
lib/functions/compilation/patch/patching.sh
lib/functions/multi/build-all.sh
lib/library-functions.sh
commit 68efe99a09da93c27a9cf20d1f14fc9354c73b92
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Feb 24 19:27:06 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: `interactive_desktop_main_configuration()` and stderr'ed + error handl'ed dialog
- use redirection to fd 3 for dialog, now cleanly on stderr
- `show_menu()` -> `dialog_menu()` et al
- interactive configuration now works again!
lib/functions/configuration/config-desktop.sh
lib/functions/configuration/interactive.sh
lib/functions/configuration/main-config.sh
lib/functions/configuration/menu.sh
lib/functions/general/host.sh
lib/functions/main/config-prepare.sh
commit 8aed5b427cbc6fd3ddef54b604ee0a8287ebdd7b
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Feb 24 16:36:59 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: logging: `SHOW_PIDS=yes`
lib/functions/logging/logging.sh
commit 5ede8ce433706f6e98413a2e976c8698bbc85afa
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Feb 24 16:36:18 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: refactor and error-handle most of desktop configuration, incl menus/dialog
- `dialog_if_terminal_set_vars()` in place of `dialog_if_terminal()`
lib/functions/configuration/config-desktop.sh
lib/functions/configuration/interactive.sh
lib/functions/configuration/main-config.sh
lib/functions/configuration/menu.sh
lib/functions/general/repo.sh
lib/functions/main/config-prepare.sh
commit 6d5802b05da59513e169dd2837d293b8d99e95c4
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Feb 24 01:27:39 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
[WiP] ddk stuff, allow if not in `$KERNEL_TARGET`
lib/functions/main/config-prepare.sh
commit e1e33a3e9413fda79f7240abf61a9bd3ef95d27a
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Feb 24 00:39:31 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: split `compile_kernel()` function into smaller functions (+logging)
- `do_with_logging()` galore, much better error reporting for kernel
- `do_with_hooks()` is for the future, just a placeholder for now
lib/functions/compilation/kernel.sh
lib/functions/main/default-build.sh
commit e16b1e19e04308d5313908a5750e74ed2bdd72aa
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Feb 24 00:31:23 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: `do_with_hooks()` placeholder for future ideas
lib/extensions.sh
commit 4416b6b18cdb3c9311aa254189b21dfdf03747cf
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Feb 24 00:30:55 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: logging: small refactor and `do_with_logging` admit it does not do error control
lib/functions/logging/logging.sh
commit 3047f4362cad224283a9febd1dc05c4178768964
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Feb 24 00:28:09 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: fix: traps: `trap_manager_error_handled` is integer (`-i`) not array (`-a`)
lib/functions/logging/traps.sh
commit a6df63b905f60045a41f640f98c01e8e5305e8ed
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Feb 24 00:25:30 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: sunxi-tools: fix logging for sunxi-tools compilation
extensions/sunxi-tools.sh
commit 1f1f7c01f3e77fa8de9c5657a123f0bf723cceb0
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Feb 24 00:24:33 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: runners now run bash with `-o pipefail` in addition to `-e`
- attention, only affects stuff run through the functions in runners.sh
lib/functions/logging/runners.sh
commit cdfe8e12f9940a457f5161798d11c5131c99b81b
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Feb 23 21:02:10 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: kernel: reduce logging clutter (CC,LD,AR)
- hide fasthash_debug under `SHOW_FASTHASH`
lib/functions/compilation/kernel.sh
lib/functions/compilation/patch/fasthash.sh
commit 9ffb0891d8572ab04126bff74632dcabc31a81b1
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Feb 23 21:00:59 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: `armhf` should make `zImage` -- or should it?
config/sources/armhf.conf
commit 4d8eab13c18560b8d64735858b2cf2462ac3f644
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Feb 23 13:22:21 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: show logs through ccze; avoid ANSI escapes in file; `SHOW_xxx` control
- `SHOW_DEBUG` shows the debug level
- `SHOW_COMMAND` shows all invoked commands through the runners
- `SHOW_TRAPS` to show 'cleanup' and 'trap' level
- `SHOW_TIMING` to show $SECONDS but pretty
- replace hardcoded traps/cleanups logging
lib/extensions.sh
lib/functions/compilation/patch/fasthash.sh
lib/functions/general/host.sh
lib/functions/logging/logging.sh
lib/functions/logging/stacktraces.sh
lib/functions/logging/traps.sh
lib/functions/main/default-build.sh
commit 6cbb8c84798438b5ca5b353829b011cdbc263f1b
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Tue Feb 22 14:36:41 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: add `KERNEL_MAJOR_MINOR=x.z` to every family, manually from the `KERNELBRANCH`
config/sources/families/imx6.conf
config/sources/families/imx7d.conf
config/sources/families/include/meson_common.inc
config/sources/families/include/rockchip64_common.inc
config/sources/families/include/sunxi64_common.inc
config/sources/families/include/sunxi_common.inc
config/sources/families/jetson-nano.conf
config/sources/families/media.conf
config/sources/families/mt7623.conf
config/sources/families/mvebu.conf
config/sources/families/mvebu64.conf
config/sources/families/odroidxu4.conf
config/sources/families/rk322x.conf
config/sources/families/rk3399.conf
config/sources/families/rk35xx.conf
config/sources/families/rockchip.conf
config/sources/families/rockchip64.conf
config/sources/families/rockpis.conf
config/sources/families/s5p6818.conf
config/sources/families/sun50iw9.conf
config/sources/families/virtual.conf
config/sources/families/zynq.conf
commit 7b907d446bfae3db8c5afb4431d8e9bbd9e5df9e
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Tue Feb 22 02:27:09 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: cold/warm bundles import/download/export for fetch_from_repo
- warm remote, if present, can be exported shallow
- if warm remote bundle is present, can be imported shallow too
- fallback to cold bundle if warm not present
- export (from cold, if exists + warm) shallow bundle
- use temp clone and DATE (not rev or tag) for shallowing, WORKS!
- info JSON/CSV, include "config_ok" true/false, kernel/uboot info
- include logs for failed configs too
- core reports ARMBIAN_WILL_BUILD_KERNEL and ARMBIAN_WILL_BUILD_UBOOT now with package names
lib/functions/compilation/kernel.sh
lib/functions/general/git.sh
lib/functions/main/config-prepare.sh
lib/tools/info.py
lib/tools/json2csv.py
commit 8eca261f5e3e41d7f363514a79b4fd764c3e9b71
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Feb 21 17:39:40 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: `KERNELDIR` is out, `KERNEL_MAJOR_MINOR` is in for all `meson64`, `rpi4b` and `uefi`
config/sources/families/bcm2711.conf
config/sources/families/include/meson64_common.inc
config/sources/families/include/uefi_common.inc
extensions/grub.sh
commit 6f046c4f36a156468666b8c7bfff995934c44264
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Feb 21 17:37:10 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: new kernel workdir layout: cache/sources/kernel/<ARCH>-<KERNEL_MAJOR_MINOR>-<LINUXFAMILY>
- `GIT_FIXED_WORKDIR` is used to ignore 2nd param and use a specific dir
- this now REQUIRES `KERNEL_MAJOR_MINOR` to be set.
- prepare some `WARM_REMOTE_NAME` and related, based on it
lib/functions/compilation/kernel.sh
lib/functions/general/git.sh
lib/functions/main/config-prepare.sh
lib/functions/main/default-build.sh
commit e736b5233c440555fa8a1a654f1c3ac9ae664580
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Feb 21 16:01:19 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: JUST_KERNEL=yes (opposed to KERNEL_ONLY=yes) is really just the kernel build
lib/functions/main/default-build.sh
commit df90ffa11bff94bcb3b90b3460bacd7ed102a567
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Feb 21 14:40:47 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: fetch_from_repos now done when actually compiling atf/uboot/kernel, not before
- lib regen after removing empty files (sources.sh and errors.sh are now gone)
lib/functions/compilation/atf.sh
lib/functions/compilation/kernel.sh
lib/functions/compilation/sources.sh
lib/functions/compilation/uboot.sh
lib/functions/logging/errors.sh
lib/functions/main/default-build.sh
lib/library-functions.sh
commit a44e91752d1005daa5bba5eb0b0114654199e3e5
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Feb 21 01:50:16 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: linux: back to Torvalds bundle, no tags; reminder about export
lib/functions/configuration/main-config.sh
lib/functions/general/git.sh
commit 9acef6be57519029f5e4eeccabac183e27e3f845
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Feb 19 02:29:27 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: full cached kernel build; refactor all make's in a single place, even for packaging
- 2nd+ runs build in less than a minute
- kernel: compile and package in a single step, more efficient?
- KERNEL_BUILD_DTBS yes/no to build or not dtbs, replaces KERNEL_EXTRA_TARGETS
- dtbs_install, modules_install and headers_install now called by Armbian, not packaging
- kernel with split, but identical, build and install makes for modules/headers/dtbs
- make mkdebian and builddeb idempotent as possible
- keep a lot more cache, specially 'debian' folder
- filtering logging of install stuff
- might be a few leftovers, revisit gains with packaging later
- keeping the arm64 makefile Image.gz vs Image hack
- fix order of packaging patch byteshift, but still there
- cleaning of scripts tools on cross compile removed (!)
config/sources/amd64.conf
lib/functions/compilation/kernel.sh
lib/functions/compilation/patch/apply.sh
lib/functions/compilation/patch/fasthash.sh
lib/functions/compilation/patch/kernel-pkg.sh
lib/functions/compilation/sources.sh
lib/functions/main/default-build.sh
packages/armbian/builddeb
packages/armbian/mkdebian
commit 0e26d1439e8e6ad7ae331247a618db4ea4a4130c
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Feb 19 01:06:32 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: minor stylistic changes that I end up doing while working on other stuff
- I am `OFFLINE_WORK`'ing, I don't wanna waste 3 seconds, thanks
- OCD-fix of double `local` declarations
lib/functions/cli/cli-entrypoint.sh
lib/functions/general/git.sh
commit 1b0d604efc56025a1dfd8a2d9ef3485799fbbe1b
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Feb 18 04:26:28 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
[giga-wip] rework patching, introducing fasthash
lib/functions/compilation/kernel.sh
lib/functions/compilation/patch/apply.sh
lib/functions/compilation/patch/fasthash.sh
lib/functions/compilation/patch/kernel-bootsplash.sh
lib/functions/compilation/patch/kernel-drivers.sh
lib/functions/compilation/patch/kernel-pkg.sh
lib/functions/compilation/sources.sh
lib/library-functions.sh
commit 8939a9142a7e08f0dae8bc866811687119501c5e
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Feb 18 04:17:22 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
[wip] git: experiment with stable kernel bundle, and all tags. nice, but for what?
- also: never delete working copy, exit with error instead.
lib/functions/configuration/main-config.sh
lib/functions/general/git.sh
commit b853358ccab458dce0efca486ec5a15fda4ec193
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Feb 18 04:09:37 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
[wip] disable make clean during packaging. I wanna rebuild fast, always [NO PR?]
packages/armbian/builddeb
commit d61b6ddd982f316604bdedd82a0907beef7cfa0b
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Feb 17 22:21:33 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: export CHOSEN_KERNEL_WITH_ARCH for reporting info
- fix info gathering, parse all boards first, and stop if some failed
- fix KERNEL_TARGET regex by including optional "export "
- add export from info to CSV, very basic stuff, but works
lib/functions/main/config-prepare.sh
lib/tools/info.py
lib/tools/json2csv.py
commit dcf101ccbcb61fb4bf0af97f8592f6f166a20b92
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Feb 17 21:47:02 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
[squash] remove ddk bullshit from KERNEL_TARGET
config/boards/rpi4b.wip
config/boards/uefi-arm64.conf
config/boards/uefi-x86.conf
commit 7183b3290b9df1c4fce8307813702c23846be817
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Feb 17 15:49:27 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: remove file logging of aggregation stuff. config phase can't touch disk anymore.
lib/functions/configuration/aggregation.sh
lib/functions/configuration/main-config.sh
commit 4f858ace7b8674c8d5555e311bd053819555648a
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Feb 17 03:24:08 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
[WiP] git cold bundle; no: shallow clones/fetched; yes: locally packed repo
config/sources/families/include/sunxi64_common.inc
config/sources/families/include/sunxi_common.inc
lib/functions/compilation/debs.sh
lib/functions/compilation/extra-drivers.sh
lib/functions/compilation/kernel.sh
lib/functions/compilation/patching.sh
lib/functions/compilation/sources.sh
lib/functions/compilation/uboot.sh
lib/functions/configuration/main-config.sh
lib/functions/general/git.sh
lib/functions/multi/build-all.sh
commit 134877c13df20aa7403185b41d75ee3db95c4485
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Feb 16 23:06:37 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: reorder functions in file, they have a ~logical call-tree order
lib/functions/logging/runners.sh
commit f148d9aa6b42c96ee1fe9c58053886d693a5c58e
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Feb 16 23:05:28 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: move `fingerprint_image()` out of `git.sh` into its own file
lib/functions/general/fingerprint.sh
lib/functions/general/git.sh
lib/library-functions.sh
lib/tools/gen-library.sh
commit 9f774b4dac5b1c1808c2a57b2cb7b7ed2dd2e308
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Feb 16 12:02:32 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
logging: fix for double stderr redirect during `fakeroot_dpkg_deb_build`
lib/functions/logging/runners.sh
commit 8164916306b8b4bc06cd8dca5f7d937d0bfee368
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Feb 16 11:47:38 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
logging: subdued "command" logging for debugging low level cmd invocations ("frog")
lib/functions/compilation/kernel.sh
lib/functions/logging/logging.sh
lib/functions/logging/runners.sh
commit b173dbe20aff3996a3ad8b32860d001336eaa34c
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Feb 16 02:23:16 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: when showing log, emit all host-side invocations as `debug` too.
lib/functions/logging/runners.sh
commit 550e748f1a27d875cf9badfa85d6f1c251fa52aa
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Feb 13 16:49:58 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
[WiP] trap handler abstraction, somewhat works!
compile.sh
lib/extensions.sh
lib/functions/cli/cli-entrypoint.sh
lib/functions/image/rootfs-to-image.sh
lib/functions/logging/errors.sh
lib/functions/logging/logging.sh
lib/functions/logging/stacktraces.sh
lib/functions/logging/traps.sh
lib/functions/main/default-build.sh
lib/functions/main/rootfs-image.sh
lib/functions/rootfs/create-cache.sh
commit 7f06253437a0ae20d4570e09e8babe3302bb8350
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Feb 16 00:01:54 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: manual merge (10) of all lib/*.sh changes between revisions a4ae3a22703a66f1e383a193d74655533ff96c3a and 3305d45b8175dbdd647dc1dc53fa6f0a522920c7 - but NOT the git unshallow stuff, that will be rewritten
config/sources/families/bcm2711.conf
config/sources/families/include/uefi_common.inc
lib/functions/configuration/main-config.sh
lib/functions/image/partitioning.sh
packages/armbian/builddeb
commit dcbc1fa8d159e9a7423e82c5bc81b223c20dfbc1
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Feb 13 14:35:36 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: trapmanager pt1, identifying spots for trap manager intervention
lib/functions/bsp/bsp-cli.sh
lib/functions/bsp/bsp-desktop.sh
lib/functions/compilation/atf.sh
lib/functions/compilation/debs.sh
lib/functions/compilation/kernel.sh
lib/functions/compilation/uboot.sh
commit d2c3f332f9e9a04ff68d2bf1e694a223999e3304
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Feb 13 13:42:44 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: `install_pkg_deb` -> `install_host_side_packages` which is completely rewritten version
- much simplified; compare installed packages vs wanted, and only update if some missing
lib/functions/general/host.sh
lib/functions/logging/runners.sh
commit 3b2d026b59d86cd463119876a9b69b02fd6ecf45
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Feb 13 13:27:31 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: force u-boot and kernel's gcc to output colors to make easy to spot warnings and errors
lib/functions/compilation/kernel.sh
lib/functions/compilation/uboot.sh
commit fb4be3fa4a0d19043ee8d7ff1304ec3ccdf618cb
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Feb 13 13:23:51 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
docker: pass the `CI` env var through Docker invocation, for GitHub Actions
config/templates/config-docker.conf
commit 3db36a4fd3e6ad8c1b2d47d88d664936274bb875
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Feb 13 13:23:09 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: avoid warning if "file" utility not installed
- should not happen, but better safe than sorry
lib/functions/logging/runners.sh
commit d986cbc68bc926d9dc8fca44cbe9b5a19d6a88b6
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Feb 13 13:22:33 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: disable long_running `pv` progress bar for custom case too
- will rework later, for now pipe causes subshell and caos
lib/functions/logging/runners.sh
commit 7d49d5f6a72be78fa8afcd362fe7984e34d28614
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Feb 13 13:21:12 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: if `CI=true` then `SHOW_LOG=yes` always
compile.sh
commit a803a9dbbb8b86301ca930214675c1365e9125a7
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Feb 12 23:18:05 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
docker: add arm64 toolchain to Dockerfile; warn, but don't break, on modprobe failure
config/templates/Dockerfile
lib/functions/general/host.sh
commit aaed9afade2dda38d9e92a7054f3477801468760
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Feb 12 21:52:01 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: docker: use ubuntu:rolling, fix deps, use `$SRC/cache` as container's cache dir
config/templates/Dockerfile
config/templates/config-docker.conf
commit 6e52c4d1b50f4bff209d7536573329f7ea9e5e47
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Feb 12 23:17:20 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: logging fixes (padding, don't show error more than once, don't remove trap)
lib/functions/logging/logging.sh
lib/functions/logging/stacktraces.sh
lib/functions/logging/traps.sh
commit 5022af1c97af824af73d6e79bee988a3bf3773d1
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Feb 12 21:50:37 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:37 2022 +0200
armbian-next: fixes for early error handling and logging
- split stacktrace-related functions into their own lib file
- simplify the traps
- some stacktrace formatting for readability
compile.sh
lib/extensions.sh
lib/functions/logging/stacktraces.sh
lib/functions/logging/traps.sh
lib/library-functions.sh
commit a94d0cf61be12647c9ce5ce05440b6fe44b53cb4
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Feb 12 21:45:05 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: fix: don't `trap` `ERR` twice, it causes bash to go bananas regarding `caller`
lib/extensions.sh
commit 54ce1b35ffac8eb5933a147b264352ac7ceb026a
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Feb 12 17:01:00 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: `UPSTEM_VER` -> `UBOOT_REPO_VERSION` and related fixes
lib/functions/image/loop.sh
lib/functions/image/rootfs-to-image.sh
lib/functions/multi/build-all.sh
lib/functions/rootfs/distro-agnostic.sh
commit e4d30f131db7f9ab15759e4fa7fe5f18117cccd6
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Feb 12 16:06:30 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: oops, fix some non-lib changes I missed, up to revision ff4346c4682e260be3137a2301ac7a69b97c044d
config/desktop/focal/environments/deepin/armbian/create_desktop_package.sh
config/sources/families/include/rockchip64_common.inc
config/sources/families/include/sunxi64_common.inc
config/sources/families/include/sunxi_common.inc
config/sources/families/jetson-nano.conf
config/sources/families/mvebu64.conf
config/sources/families/odroidxu4.conf
config/sources/families/rk322x.conf
config/sources/families/rk35xx.conf
config/sources/families/rockchip64.conf
config/templates/config-example.conf
packages/armbian/builddeb
commit 326548a2fb5909159b84ad75d11c714b4dbe42b3
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Feb 12 15:46:09 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: manual merge (9) of all lib/*.sh changes between revisions 3b7f5b1f3418b7ad7a7c03f2af6d8da66f20bcb9 and ff4346c4682e260be3137a2301ac7a69b97c044d
lib/functions/compilation/extra-drivers.sh
lib/functions/configuration/main-config.sh
lib/functions/image/partitioning.sh
lib/functions/image/rootfs-to-image.sh
lib/functions/rootfs/distro-agnostic.sh
commit 8180b79f136be27a79d225ade02faa823012923f
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Feb 12 10:18:32 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: more error handling fixes. avoid shortcircuits.
- store previous error message in `MSG_IF_ERROR` (still to be actually shown somewhere during error)
lib/functions/compilation/atf.sh
lib/functions/compilation/uboot.sh
lib/functions/image/partitioning.sh
lib/functions/rootfs/apt.sh
lib/functions/rootfs/create-cache.sh
lib/functions/rootfs/distro-agnostic.sh
commit f549907b967be0199cb10b995f8aa3449e0de8ad
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Feb 12 09:17:38 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: more error handling fixes. avoid subshells, shortcircuits, and pipes
- add `CFLAGS=-fdiagnostics-color=always` to kernel compile; would need also for u-boot soon
lib/functions/compilation/kernel.sh
lib/functions/logging/logging.sh
lib/functions/logging/runners.sh
lib/functions/logging/traps.sh
commit 6e3a035ec4ba55378e61e0229fb0290f3b0cdf99
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Jan 31 20:03:34 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
WiP: indexing JSON into OpenSearch, all-hardcoded version
lib/tools/index-opensearch.py
commit a1e81b3a46d9511962246ff6852ae9549b154fb9
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Feb 6 01:57:09 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
rpi: add DTB symlink in Debian/Ubuntu standard location /lib/firmware/$version/device-tree; remove build-time-only hacks
- this allows us to remove the most horrible hack
- should allow for correctly working DTB upgrades
- should NOT impact other families, although a new symlink will be created, nothing uses it.
config/sources/families/bcm2711.conf
packages/armbian/builddeb
commit e665d2fb3e9a25b2e9e927e3749ff14065f29ffb
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Feb 5 23:37:01 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
rpi: fix: flash-kernel fix to ignore kernel 'flavour' for all raspi's
config/sources/families/bcm2711.conf
commit acb9b1ee273bb16ab3a5caf47830f63a9eedef37
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Feb 6 14:19:04 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: don't try to remove packages that are not installed to begin with
- much faster
- new chroot_sdcard_with_stdout() runner, without bash or any escaping.
lib/functions/logging/runners.sh
lib/functions/rootfs/distro-agnostic.sh
commit c2a084f37049b0a3338e8f8bdf1e103539439c89
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Feb 6 12:42:25 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: don't try to enable systemd services for units that don't exist
- those might be removed by a bsp extension, so check for existence before trying to enable
lib/functions/rootfs/distro-agnostic.sh
commit 9291369c6d68660e9a43f43ee3fc94c8ad0fc774
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Feb 6 12:12:01 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: don't error/warn on failure to enable bootsplash when systemd units missing
lib/functions/rootfs/boot_logo.sh
commit ee634ea265ad9947f4061cd3bc0ffdf7d83d3e78
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Feb 6 11:24:33 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: use indented HEREDOCS for all call_extension_method's
lib/extensions.sh
lib/functions/bsp/bsp-cli.sh
lib/functions/image/partitioning.sh
lib/functions/image/rootfs-to-image.sh
lib/functions/main/default-build.sh
lib/functions/main/rootfs-image.sh
lib/functions/rootfs/customize.sh
lib/functions/rootfs/distro-agnostic.sh
lib/functions/rootfs/post-tweaks.sh
commit cba342a0ce4843cf69144c11ea881e0ce0b6ba40
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Feb 6 14:39:49 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: manual merge (8) of all lib/*.sh changes between revisions 1d499d9ac282d44d4fdb052e5f64fb902688c18f and 3b7f5b1f3418b7ad7a7c03f2af6d8da66f20bcb9
lib/functions/compilation/patching.sh
commit b2b1fdf3dae9193072994369c7b5bac7318366eb
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Feb 5 22:05:21 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: manual merge (7) of all lib/*.sh changes between revisions d885bfc97d908b09dddac06393c2987995704d0a and 1d499d9ac282d44d4fdb052e5f64fb902688c18f
lib/functions/compilation/extra-drivers.sh
lib/functions/configuration/main-config.sh
lib/functions/general/git.sh
lib/functions/image/rootfs-to-image.sh
lib/functions/main/default-build.sh
lib/functions/rootfs/distro-agnostic.sh
lib/functions/rootfs/distro-specific.sh
commit b2849431e1736e9bae4eeddd3ef363a058352465
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Jan 30 22:21:50 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: manual merge (6) of all lib/*.sh changes between revisions c7f3c239fe93f8fcfdd1b1edf6f11e143802e379 and d885bfc97d908b09dddac06393c2987995704d0a
lib/functions/compilation/extra-drivers.sh
lib/functions/compilation/patching.sh
lib/functions/configuration/main-config.sh
lib/functions/general/git.sh
lib/functions/rootfs/create-cache.sh
commit 4fcb0204e5df9bc6c540806096def9ce8e3126e1
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Jan 24 00:16:42 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: avoid writing to disk during configuration; `ANSI_COLOR=none` logging; make CONFIG_DEFS_ONLY=yes runnable without sudo
- when `CONFIG_DEFS_ONLY=yes`, avoid writing the config summary output.log file.
- refactor that into a function as to be easy to if-out-of
- don't write to disk during aggregate_content() if `CONFIG_DEFS_ONLY=yes`
- don't write to disk during show_checklist_variables() if `CONFIG_DEFS_ONLY=yes`
- don't write to disk during write_deboostrap_list_debug_log() if `CONFIG_DEFS_ONLY=yes`
- don't compress and rotate logs if `CONFIG_DEFS_ONLY=yes`
- don't pretend to be handling errors we can't handle during var capture
- I foresee a world we can build all .debs without sudo
- and a some kind of split of codebase entrypoint due to that future feature
- some python info.py enhancements, not ready yet
lib/extensions.sh
lib/functions/cli/cli-entrypoint.sh
lib/functions/configuration/aggregation.sh
lib/functions/configuration/main-config.sh
lib/functions/logging/capture.sh
lib/functions/logging/logging.sh
lib/functions/main/config-prepare.sh
lib/tools/info.py
commit c7785c788f81bce938f2af6b3d576ba9834433b7
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Jan 23 23:00:17 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: shellfmt and regen library (after rebase from master n.5)
lib/functions/compilation/atf.sh
lib/functions/logging/logging.sh
lib/functions/rootfs/create-cache.sh
lib/library-functions.sh
commit ac99b0432bdbb7d2ee589a5f41a72e17dcbfecee
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Jan 23 22:59:25 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
tools/shellfmt.sh: exclude "cache" and ".tmp" from formatting, for obvious reasons
lib/tools/shellfmt.sh
commit b17bb64ddc739b7084b98d070848aade693f3794
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Jan 23 22:58:36 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
tools/gen-library.sh: sort function files, so it does not keep changing between runs on different machines.
- order should not be important, since files only contain functions, but avoid git churn
lib/tools/gen-library.sh
commit d84cbf9f3a367ab068bd619619daa58c56e7c96f
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Jan 23 22:42:25 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: manual merge (5) of all lib/*.sh changes between revisions 1b18df3c834c5c4166e99f731d53ec88d14caf7d and e7962bb2b555d3afdca0ff168982cc45235ca0a8
- most PKG_PREFIX work was already done
config/sources/families/jetson-nano.conf
lib/functions/general/host.sh
lib/functions/rootfs/distro-agnostic.sh
commit b18f3c81a1613e4b1550674a471f309a59526167
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Jan 23 22:08:16 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: `TMPDIR` for all, many logging fixes, error handling: leave-no-garbage-behind without needing traps.
- set `MOUNT_UUID` and `WORKDIR`/`MOUNT`/`SDCARD`/`EXTENSION_MANAGER_TMP_DIR`/`DESTIMG` early in do_main_configuration()
- but, they're just _set_ there, dirs are not created early, but on demand later
- still @TODO: actually clean those during error trap. (unhappy path leaves garbage still)
- but does not leave garbage behind during "successful" runs at least (happy path works)
- actually export `TMPDIR` (== `WORKDIR`) during start of build (not config!), so all `mktemp` are subject to it
- `runners.sh` has helpers to avoid passing `TMPDIR` to chroot. Use the helpers! don't call `chroot` directly.
- don't trap/cleanup individual `mktemp` temp dirs during .deb packaging's, all is handled at once now.
- kernel packaging, for example, automatically picks up `TMPDIR` too. So now hosts `/tmp` is mostly left alone.
- fix some "infodumps" that are done into `.log` files directly.
- don't use sudo if `CONFIG_DEFS_ONLY=yes`; we'll only be collecting info, not doing anything.
- simpler logging for `rsync` operations (just dump to stdout, logging will handle it!)
- use padded counter for section logfiles, so we know which order things ran. exported as `CURRENT_LOGGING_COUNTER`
- no reason to use `apt-get` with `-yqq` anymore, since all logging is handled, so now `-y` by default
- desktop: using runners helpers for rootfs-desktop.sh, which should help a lot with acng caching and finding of problems
- extensions: correctly cleanup temp stuff, extensions has its own tmp/workdir now, and is always cleaned up at end of build.
lib/extensions.sh
lib/functions/bsp/bsp-cli.sh
lib/functions/bsp/bsp-desktop.sh
lib/functions/cli/cli-entrypoint.sh
lib/functions/compilation/atf.sh
lib/functions/compilation/debs.sh
lib/functions/compilation/kernel.sh
lib/functions/compilation/patching.sh
lib/functions/compilation/uboot.sh
lib/functions/configuration/main-config.sh
lib/functions/configuration/menu.sh
lib/functions/general/host.sh
lib/functions/image/rootfs-to-image.sh
lib/functions/logging/logging.sh
lib/functions/logging/runners.sh
lib/functions/main/config-prepare.sh
lib/functions/main/default-build.sh
lib/functions/rootfs/rootfs-desktop.sh
commit 84ad3ec52fa01eacca30bd3754853cff312dde5a
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Jan 22 10:35:06 2022 +0000
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: bye `PKG_PREFIX`, hello `run_host_x86_binary_logged()` wrapper function; better error handling
- we've x86-only utilities that might need to be run on non-x86 build machines
- previously duplicated logic in PKG_PREFIX variable refactored into logged function
- added centralized debug logging
- replace all PKG_PREFIX usage with the new wrapper function, which already handles logging and errors.
- mostly FIP tooling invocations
- but also the boot_logo image builder
- wrapper function delegates to common `run_host_command_logged`
- wrap other FIP invocations with `run_host_command_logged` too, for tidy logging
- avoid using conditionals when invoking functions; that completely disables error handling inside the called function
- use explicit bash opts instead of shortcuts like `set -e`
- a _lot_ of debug logging added
compile.sh
config/sources/families/include/meson64_common.inc
config/sources/families/include/rockchip64_common.inc
config/sources/families/meson-gxbb.conf
config/sources/families/meson-gxl.conf
lib/functions/cli/cli-entrypoint.sh
lib/functions/compilation/uboot.sh
lib/functions/general/host.sh
lib/functions/logging/runners.sh
lib/functions/rootfs/boot_logo.sh
lib/library-functions.sh
lib/tools/gen-library.sh
commit f9e02b2152c1c82a74312ccf48ef530dac167512
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Jan 22 10:32:08 2022 +0000
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:36 2022 +0200
armbian-next: always use UPPERCASE labels for FAT32 UEFI filesystems (rpi4b, uefi-*)
config/sources/families/bcm2711.conf
lib/functions/image/partitioning.sh
commit acbc2f21da023796c5a72e3b78e0b20f09cf5ed0
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Jan 20 23:41:18 2022 +0000
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:34 2022 +0200
armbian-next: shellfmt after rebase onto master
config/sources/families/media.conf
commit 407ecdb1b9108b57afea57b3ca6a17ed86ef1fcc
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Thu Jan 20 23:35:46 2022 +0000
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
armbian-next: manual merge (4) of all lib/*.sh changes between revisions 23afccf56e295610340188dc2613143d5323659e and e610f00bc7fdcab5ba4c648fa21148518b4b767b
- plus ooops
config/sources/families/bcm2711.conf
config/sources/families/include/sunxi_common.inc
config/sources/families/jethub.conf
lib/functions/configuration/main-config.sh
lib/functions/general/git.sh
lib/functions/general/host.sh
commit cdf0389ba5f0a747f4c1f9feee9527001aa61a35
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Jan 16 23:02:52 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
atf: fix for `set -e` mode; fix CROSS_COMPILE quoting
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
lib/functions/compilation/atf.sh
commit eea2f5f4041541f8055be549eea4cf8c2f32a901
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Jan 16 23:03:45 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
logging: predict the future location of .img file
- otherwise it's really unhelpful
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
lib/functions/image/rootfs-to-image.sh
commit 873136d95f303e1acfce017ad7d38464ee0058ec
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Jan 15 19:37:27 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
uefi: alias `BRANCH=ddk` to `current`'s `DISTRO_GENERIC_KERNEL=yes`
- no real change, just to match rpi4b's BRANCH=style
- opens space for Armbian-built `current` soon
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
config/boards/uefi-arm64.conf
config/boards/uefi-x86.conf
config/sources/families/include/uefi_common.inc
commit fe8e12e095465e7098e5f4cff98fdb4ee80769ff
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Jan 15 02:46:02 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
rpi: `legacy`->`ddk` (distro default kernel), remove overclock
- common vars in bcm2711.conf moved to top
- removed overclock/overvolt that was leftover my old setup
- confirmed: works with rpi3b too, should work with CM4/CM3 and others
- use valid UPPERCASE FAT label for RPICFG (in place of `rpicfg`)
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
config/boards/rpi4b.wip
config/sources/families/bcm2711.conf
commit 1390b62e7c08fc0d0e834854ddd5d19c5243aa8d
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Jan 15 02:37:48 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
armbian-next: shellfmt again after rebase
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
config/boards/rpi4b.wip
config/sources/families/bcm2711.conf
commit 03b4020135b5915e54895f5dcd53250df25d57e5
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Tue Jan 11 11:36:25 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
armbian-next: manual merge (3) of all lib/*.sh changes between revisions 1035905760884fbea567717684c38faae3ef28a4 and e4e4ab0791e60e1e7a204dd0409fa29a1cf7a376
- missed non lib change on Several improvements for RPi builds (#3391)
- I just realized I will have to drop all non lib changes
config/boards/rpi4b.wip
config/sources/families/bcm2711.conf
lib/functions/compilation/debs.sh
lib/functions/general/downloads.sh
lib/functions/general/host.sh
commit 1f2306a3ad4f0abf5730bb5eb26a70c979d86ff3
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Jan 9 15:22:10 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
rockship: fixes for `set -e` mode in rockship armhf family and bsp tweaks
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
config/sources/families/rockchip.conf
commit 7bfb222e11c2a658ce29df17d17981fce8e03382
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Jan 9 15:21:40 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
armhf: enable building armhf targets on amd64 using system toolchains
- SKIP_EXTERNAL_TOOLCHAINS=yes on amd64 should use the same system toolchains as an arm64 build
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
config/sources/armhf.conf
commit 79348c956a29a2077e017c2d83e129beed99208d
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Jan 9 15:20:50 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
logging: better logging about family_tweaks and family_tweaks_bsp
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
lib/functions/bsp/bsp-cli.sh
lib/functions/rootfs/distro-agnostic.sh
commit eca8ea1ba1b44474c3fd1baae9bdacae5ef7e431
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Jan 8 21:26:08 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
kernel: unblock cross compilation, warn about headers package
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
lib/functions/compilation/kernel.sh
commit 739a4fe4d589a9d9ce58a725ed1d7db76b9aab3b
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Jan 8 20:02:23 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
logging: fixes for sunxi/megous stuff with `set -e`
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
config/sources/families/include/sunxi64_common.inc
config/sources/families/include/sunxi_common.inc
lib/functions/general/git.sh
commit 9fc0bd5788857c43c3f4d6e217928539ccd894a9
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Jan 8 15:01:03 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
logging: fix shellcheck references generation
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
lib/library-functions.sh
lib/tools/gen-library.sh
commit 49cdd43f9fa208e13607eae9dad138d4d49a0a5f
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Jan 8 13:56:36 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
logging: manual merge (2) of all lib/*.sh changes between revisions 117633687e9942ade647a8b7d3f80f01e3145193 and 30830388555e463402161a6e0d6993dd6fb0544e
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
lib/functions/cli/utils-cli.sh
lib/functions/general/host.sh
commit 496713bb6f122440105626db767b39db7dd41e2f
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Jan 8 13:35:51 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
logging: renaming function files a bit more consistently
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
lib/functions/cli/utils-cli.sh
lib/functions/compilation/utils-compilation.sh
lib/functions/rootfs/distro-agnostic.sh
lib/functions/rootfs/distro-specific.sh
lib/library-functions.sh
commit 3c36aa6e495d06ab1fc599585e14c3a66ec14f03
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Jan 8 01:46:22 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
logging: removing leftover empty file after all the moving around
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
lib/functions/image.sh
lib/library-functions.sh
commit 5d19b3686e732d07ac0d49abba76e03b42f4309e
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Jan 8 01:16:55 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
logging: really insist on set -e during library loading
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
lib/library-functions.sh
lib/tools/gen-library.sh
commit dc2dd8dd4ced5244a5c615fe815b08455b119bbb
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Jan 7 23:35:25 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
logging: shellfmt again after rebasing master
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
config/boards/jetson-nano.conf
config/sources/families/jetson-nano.conf
extensions/flash-kernel.sh
lib/functions/configuration/menu.sh
lib/library-functions.sh
commit ce5bebdb917d1e3c88e36899c268207779716965
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Jan 7 23:28:12 2022 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
logging: manual merge of all lib/*.sh changes between revisions f6143eff670d435cc8d15b52335b1b70ccb91e1c and f3388b9aee0d1564a28fbc661c6e7b0415a6dfd0
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
lib/functions/bsp/bsp-cli.sh
lib/functions/compilation/extra-drivers.sh
lib/functions/extras/buildpkg.sh
lib/functions/general/git.sh
lib/functions/general/host.sh
lib/functions/main/default-build.sh
lib/functions/rootfs/distro_agnostic.sh
commit 9486f6117f1011dbeefd44fdda9e1d9e7f3c7425
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sun Dec 26 12:39:03 2021 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
logging: generic do_capturing_defs wrapper; Python parser
- enabled by passing CONFIG_DEFS_ONLY=yes; in this case does not build anything
- [WiP] Python3 info reader / matrix expander
- multithreaded version
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
compile.sh
config/boards/virtual-qemu.wip
lib/functions/cli/cli-entrypoint.sh
lib/functions/configuration/main-config.sh
lib/functions/logging/capture.sh
lib/functions/logging/traps.sh
lib/functions/main/config-prepare.sh
lib/functions/main/default-build.sh
lib/library-functions.sh
lib/tools/info.py
commit 328c4f75664d68f01579467631672c5645466cdc
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Sat Dec 25 17:12:19 2021 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
logging: move some interactive parts of config into its own functions
- mostly from config-prepare;
- there is still a lot of others in main-config
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
lib/functions/configuration/interactive.sh
lib/functions/configuration/main-config.sh
lib/functions/configuration/menu.sh
lib/functions/main/config-prepare.sh
lib/library-functions.sh
commit 078ad44f58e718d842b6a14d3f441560ac685022
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Dec 24 08:43:34 2021 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:31 2022 +0200
logging: use chroot_custom for grub and flash-kernel extension logging
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
extensions/flash-kernel.sh
extensions/grub.sh
commit e4cc689b82986aa917ccf71cefcae121261559bd
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Fri Dec 24 01:43:23 2021 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:30 2022 +0200
logging: use line buffering, fix runner output color for GHA
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
lib/functions/logging/logging.sh
commit b1cfead3ac2957d5e19a3f10010a814ef0e70297
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Dec 22 01:19:47 2021 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:30 2022 +0200
logging: wrap dpkg-deb; set TMPDIR (not in chroot); refactor kernel make
- And a huge amount of @TODO's added
- Add "debug" and "deprecation" `display_alert()` levels
- insist that `install_common` is now `install_distribution_agnostic`
- unrelated: realtek 8822CS is EXTRAWIFI=yes only now, sorry.
- many debug statements for desktop
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
config/sources/amd64.conf
lib/functions/bsp/bsp-cli.sh
lib/functions/bsp/bsp-desktop.sh
lib/functions/compilation/compilation-utils.sh
lib/functions/compilation/debs.sh
lib/functions/compilation/extra-drivers.sh
lib/functions/compilation/kernel.sh
lib/functions/compilation/uboot.sh
lib/functions/configuration/main-config.sh
lib/functions/general/host.sh
lib/functions/image/loop.sh
lib/functions/logging/logging.sh
lib/functions/logging/runners.sh
lib/functions/main/config-prepare.sh
lib/functions/main/rootfs-image.sh
lib/functions/rootfs/apt.sh
lib/functions/rootfs/distro_agnostic.sh
commit 9869508b622be33fe5114313c02d107b500f79aa
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Dec 22 19:39:26 2021 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:30 2022 +0200
logging: don't bail out on patching error
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
lib/functions/compilation/patching.sh
commit 91806c9e0934a7d4a01425bf76c013dca110f5f0
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Wed Dec 22 01:18:23 2021 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:30 2022 +0200
logging: bunch of fixes; no-stdin; traps; better stacks
- mostly no-stdin dialog handling (desktop et al)
- let ERR trap run together with unmount trap (EXIT etc)
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
compile.sh
lib/extensions.sh
lib/functions/configuration/main-config.sh
lib/functions/configuration/menu.sh
lib/functions/general/repo.sh
lib/functions/logging/traps.sh
lib/functions/main/config-prepare.sh
lib/functions/rootfs/create-cache.sh
commit 70b9182fb02337c6c8d023469571acb2f1462317
Author: Ricardo Pardini <ricardo@pardini.net>
AuthorDate: Mon Dec 20 23:29:18 2021 +0100
Commit: Ricardo Pardini <ricardo@pardini.net>
CommitDate: Sat Oct 8 11:19:30 2022 +0200
logging: trap ERR very early, pass-in caller info
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
compile.sh
lib/extensions.sh
lib/functions/logging/runners.sh
lib/functions/logging/traps.sh
lib/functions/main/default-build.sh
Full mbox log
- c9cf3fc241cfb4c872f4aef7bbc41d5854db7ea3 to 6809de3d6063cb041205a8318e19da6a4dee68c9 ref extensions_08_10_2022_pre_v30
From 6809de3d6063cb041205a8318e19da6a4dee68c9 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 8 Oct 2022 11:30:37 +0200
Subject: [PATCH] armbian-next: manual merge (30) of lib changes between
882f995e21f4791d773bc59efdfdb676494ee6ba and
31ac6383e1ac7ebddd0813abc0f1f9632a9c9c40
---
lib/functions/configuration/main-config.sh | 12 +++++++++---
lib/functions/general/downloads.sh | 1 +
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 91c3844ca..87f772113 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -318,18 +318,24 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
DEBIAN_MIRROR='deb.debian.org/debian'
DEBIAN_SECURTY='security.debian.org/'
- UBUNTU_MIRROR='ports.ubuntu.com/'
+ [[ "${ARCH}" == "amd64" ]] &&
+ UBUNTU_MIRROR='archive.ubuntu.com/ubuntu/' ||
+ UBUNTU_MIRROR='ports.ubuntu.com/'
if [[ $DOWNLOAD_MIRROR == "china" ]]; then
DEBIAN_MIRROR='mirrors.tuna.tsinghua.edu.cn/debian'
DEBIAN_SECURTY='mirrors.tuna.tsinghua.edu.cn/debian-security'
- UBUNTU_MIRROR='mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/'
+ [[ "${ARCH}" == "amd64" ]] &&
+ UBUNTU_MIRROR='mirrors.tuna.tsinghua.edu.cn/ubuntu/' ||
+ UBUNTU_MIRROR='mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/'
fi
if [[ $DOWNLOAD_MIRROR == "bfsu" ]]; then
DEBIAN_MIRROR='mirrors.bfsu.edu.cn/debian'
DEBIAN_SECURTY='mirrors.bfsu.edu.cn/debian-security'
- UBUNTU_MIRROR='mirrors.bfsu.edu.cn/ubuntu-ports/'
+ [[ "${ARCH}" == "amd64" ]] &&
+ UBUNTU_MIRROR='mirrors.bfsu.edu.cn/ubuntu/' ||
+ UBUNTU_MIRROR='mirrors.bfsu.edu.cn/ubuntu-ports/'
fi
if [[ "${ARCH}" == "amd64" ]]; then
diff --git a/lib/functions/general/downloads.sh b/lib/functions/general/downloads.sh
index e6cfc8beb..482ea0ccb 100644
--- a/lib/functions/general/downloads.sh
+++ b/lib/functions/general/downloads.sh
@@ -55,6 +55,7 @@ function download_and_verify_internal() {
"9F0E78D5" # Igor Pecovnik
)
+ mkdir -p "${SRC}/cache/.aria2"
local aria2_options=(
# Display
--console-log-level=error
From 404916b083a1f1a9735abe40452d460c65cd412f Mon Sep 17 00:00:00 2001
From: Igor Pecovnik <igor.pecovnik@gmail.com>
Date: Sun, 16 Jan 2022 23:59:47 +0100
Subject: [PATCH] armbian-next: manual merge (30) of family/board changes
between 882f995e21f4791d773bc59efdfdb676494ee6ba and
31ac6383e1ac7ebddd0813abc0f1f9632a9c9c40
---
config/sources/families/media.conf | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/config/sources/families/media.conf b/config/sources/families/media.conf
index eb2711377..b65b6b070 100644
--- a/config/sources/families/media.conf
+++ b/config/sources/families/media.conf
@@ -8,11 +8,17 @@ elif [[ $BOARD == quartz64a ]]; then
BOOTSOURCE='https://github.com/150balbes/u-boot-rk'
BOOTBRANCH='branch:rk35xx'
BOOTPATCHDIR="u-boot-station-p2"
+elif [[ $BOARD == station-m3 ]]; then
+ BOOTSOURCE='https://github.com/150balbes/u-boot-rk'
+ BOOTBRANCH='branch:rk3588'
+ BOOTPATCHDIR="u-boot-station-p2"
else
BOOTBRANCH="tag:v2022.07"
BOOTPATCHDIR="u-boot-media"
fi
+SKIP_BOOTSPLASH="yes"
+
case $BRANCH in
legacy)
@@ -27,6 +33,13 @@ case $BRANCH in
LINUXCONFIG='linux-station-p2-'$BRANCH
EXTRAWIFI="no"
WIREGUARD="no"
+ elif [[ $BOARD == station-m3 ]]; then
+ KERNELSOURCE='https://github.com/150balbes/rockchip-kernel'
+ KERNELBRANCH='branch:kernel-5.10'
+ LINUXFAMILY=station-m3
+ LINUXCONFIG='linux-station-m3-'$BRANCH
+ KERNELPATCHDIR='station-m3-'$BRANCH
+ AUFS="no"
elif [[ $BOARD == jetson-nano ]]; then
KERNELDIR='linux-nano'
KERNELSOURCE='https://github.com/150balbes/Jetson-Nano'
@@ -70,6 +83,7 @@ case $BRANCH in
else
KERNELPATCHDIR='media-'$BRANCH
LINUXFAMILY=media
+
if [[ $BOARD == jetson-nano ]]; then
MODULES_INITRD="jetson-nano-current"
fi
@@ -83,7 +97,7 @@ case $BRANCH in
KERNELBRANCH="branch:linux-5.19.y"
LINUXFAMILY=media
LINUXCONFIG='linux-media-'$BRANCH
- SKIP_BOOTSPLASH="yes"
+
if [[ $BOARD == jetson-nano ]]; then
MODULES_INITRD="jetson-nano-edge"
fi
From adc5e01444daf4548cba3ef99ea3430d8bbf8335 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 25 Sep 2022 01:49:11 +0200
Subject: [PATCH] armbian-next: manual merge (29) of family/board changes
between 3435c4636723e9553be0a9ce3666bddb0887069e and
882f995e21f4791d773bc59efdfdb676494ee6ba (A LOT!)
---
config/boards/uefi-arm64.conf | 2 ++
config/boards/uefi-x86.conf | 2 ++
config/sources/arm64.conf | 2 +-
config/sources/armhf.conf | 4 ++--
config/sources/families/bcm2711.conf | 9 +--------
config/sources/families/include/meson_common.inc | 4 +---
config/sources/families/uefi-x86.conf | 3 ++-
7 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/config/boards/uefi-arm64.conf b/config/boards/uefi-arm64.conf
index 3da87e459..5a705cdeb 100644
--- a/config/boards/uefi-arm64.conf
+++ b/config/boards/uefi-arm64.conf
@@ -2,3 +2,5 @@
export BOARD_NAME="UEFI arm64"
export BOARDFAMILY="uefi-arm64"
export KERNEL_TARGET="current,edge"
+
+export BOOT_LOGO=desktop
diff --git a/config/boards/uefi-x86.conf b/config/boards/uefi-x86.conf
index 0188da545..d6153e717 100644
--- a/config/boards/uefi-x86.conf
+++ b/config/boards/uefi-x86.conf
@@ -2,3 +2,5 @@
export BOARD_NAME="UEFI x86"
export BOARDFAMILY="uefi-x86"
export KERNEL_TARGET="current,edge"
+
+export BOOT_LOGO=desktop
diff --git a/config/sources/arm64.conf b/config/sources/arm64.conf
index 452f58f6a..6bcf3306b 100644
--- a/config/sources/arm64.conf
+++ b/config/sources/arm64.conf
@@ -42,7 +42,7 @@ fi
[[ -z $UBOOT_USE_GCC ]] && UBOOT_USE_GCC='> 8.0'
[[ -z $BOOTSOURCE ]] && BOOTSOURCE=$MAINLINE_UBOOT_SOURCE
[[ -z $BOOTDIR ]] && BOOTDIR=$MAINLINE_UBOOT_DIR
-[[ -z $BOOTBRANCH ]] && BOOTBRANCH='tag:v2021.10'
+[[ -z $BOOTBRANCH ]] && BOOTBRANCH='tag:v2022.07'
[[ -z $KERNELDIR ]] && KERNELDIR=$MAINLINE_KERNEL_DIR
[[ -z $KERNELSOURCE ]] && KERNELSOURCE=$MAINLINE_KERNEL_SOURCE
diff --git a/config/sources/armhf.conf b/config/sources/armhf.conf
index 01a9eac47..e70e71edd 100644
--- a/config/sources/armhf.conf
+++ b/config/sources/armhf.conf
@@ -16,7 +16,7 @@ INITRD_ARCH=arm
QEMU_BINARY="qemu-arm-static"
ARCHITECTURE=arm
ARCH=armhf
-KERNEL_IMAGE_TYPE=zImage
+KERNEL_IMAGE_TYPE=Image
CAN_BUILD_STRETCH=yes
FAST_CREATE_IMAGE="yes"
@@ -28,7 +28,7 @@ fi
[[ -z $UBOOT_USE_GCC ]] && UBOOT_USE_GCC='> 8.0'
[[ -z $BOOTSOURCE ]] && BOOTSOURCE=$MAINLINE_UBOOT_SOURCE
[[ -z $BOOTDIR ]] && BOOTDIR=$MAINLINE_UBOOT_DIR
-[[ -z $BOOTBRANCH ]] && BOOTBRANCH='tag:v2021.10'
+[[ -z $BOOTBRANCH ]] && BOOTBRANCH='tag:v2022.07'
if [ "$(uname -m)" = "aarch64" ]; then
[[ -z $KERNEL_COMPILER ]] && KERNEL_COMPILER="arm-linux-gnueabihf-"
diff --git a/config/sources/families/bcm2711.conf b/config/sources/families/bcm2711.conf
index d031d7e50..57fed76b2 100644
--- a/config/sources/families/bcm2711.conf
+++ b/config/sources/families/bcm2711.conf
@@ -5,7 +5,6 @@ export UEFI_FS_LABEL="RPICFG" # Windows/Mac users will see this if
export SKIP_BOOTSPLASH="yes" # video is init-ed before us
export FK__PUBLISHED_KERNEL_VERSION="raspi" # flash kernel (FK) configuration
export FK__KERNEL_PACKAGES=""
-export RASPI_ROOT_FS_LABEL="armbian"
export CPUMIN=500000
export CPUMAX=2000000
export GOVERNOR=ondemand
@@ -35,15 +34,9 @@ case "${BRANCH}" in
;;
esac
-# Add a label to the root partition - this is common, should refactor into a separate segment
-prepare_partitions_custom__add_rootfs_raspi_label_to_mkfs() {
- display_alert "raspi rootfs label ${RASPI_ROOT_FS_LABEL}" "boot with root=LABEL=${RASPI_ROOT_FS_LABEL}" "info"
- mkopts[ext4]="-L ${RASPI_ROOT_FS_LABEL} ${mkopts[ext4]}"
-}
-
pre_initramfs_flash_kernel__write_raspi_cmdline() {
cat <<- EOD > "${FIRMWARE_DIR}/cmdline.txt"
- root=LABEL=${RASPI_ROOT_FS_LABEL} rootfstype=ext4 elevator=deadline rootwait fixrtc cgroup_enable=memory cgroup_memory=1 console=tty1 logo.nologo loglevel=1
+ root=LABEL=${ROOT_FS_LABEL} rootfstype=ext4 rootwait fixrtc cgroup_enable=memory cgroup_memory=1 console=tty1 logo.nologo loglevel=1
EOD
}
diff --git a/config/sources/families/include/meson_common.inc b/config/sources/families/include/meson_common.inc
index ee515aaaf..f0471ac6c 100644
--- a/config/sources/families/include/meson_common.inc
+++ b/config/sources/families/include/meson_common.inc
@@ -47,10 +47,8 @@ case $BRANCH in
;;
edge)
- KERNELDIR='linux-meson'
- KERNELSOURCE='https://github.com/xdarklight/linux'
export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:meson-mx-integration-5.18-20220516"
+ KERNELBRANCH="branch:linux-5.18.y"
KERNELPATCHDIR='meson-'$BRANCH
;;
diff --git a/config/sources/families/uefi-x86.conf b/config/sources/families/uefi-x86.conf
index 55923fd7b..7a40a5b00 100644
--- a/config/sources/families/uefi-x86.conf
+++ b/config/sources/families/uefi-x86.conf
@@ -1,5 +1,6 @@
# Important: LINUXFAMILY and ARCH are defined _before_ including the common family include
-[[ "$BUILD_DESKTOP" == yes ]] && enable_extension "nvidia"
+[[ "$BUILD_DESKTOP" == yes && "$RELEASE" == jammy ]] && enable_extension "nvidia"
+export UEFI_GRUB_TERMINAL="gfxterm"
export LINUXFAMILY="x86"
export ARCH="amd64"
source "${BASH_SOURCE%/*}/include/uefi_common.inc"
From c1aef1c25eb29772a754bd3961b69f98c7afa48d Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 25 Sep 2022 01:36:43 +0200
Subject: [PATCH] armbian-next: manual merge (29) of lib changes between
3435c4636723e9553be0a9ce3666bddb0887069e and
882f995e21f4791d773bc59efdfdb676494ee6ba (A LOT!)
---
extensions/grub.sh | 35 ++-
lib/functions/bsp/bsp-desktop.sh | 1 +
lib/functions/compilation/debs.sh | 62 ++++-
.../compilation/patch/kernel-bootsplash.sh | 25 +-
lib/functions/compilation/patch/kernel-drivers.sh | 32 ++-
lib/functions/configuration/interactive.sh | 3 +-
lib/functions/configuration/main-config.sh | 10 +-
lib/functions/general/chroot-helpers.sh | 4 +-
lib/functions/general/cleaning.sh | 1 +
lib/functions/general/downloads.sh | 278 ++++++++++-----------
lib/functions/host/external-toolchains.sh | 46 ++--
lib/functions/image/initrd.sh | 2 +-
lib/functions/image/partitioning.sh | 149 +++++------
lib/functions/image/rootfs-to-image.sh | 6 +-
lib/functions/main/default-build.sh | 7 +
lib/functions/rootfs/create-cache.sh | 121 ++++-----
lib/functions/rootfs/distro-agnostic.sh | 21 ++
lib/functions/rootfs/distro-specific.sh | 48 ++--
18 files changed, 488 insertions(+), 363 deletions(-)
diff --git a/extensions/grub.sh b/extensions/grub.sh
index e3eacb955..2f64fb172 100644
--- a/extensions/grub.sh
+++ b/extensions/grub.sh
@@ -1,4 +1,4 @@
-# This runs *after* user_config. Don't change anything not coming from other variables or meant to be configured by the user.
+# This runs *after* user_config. Don't change anything not coming from other variables or meant to be configured by the u ser.
function extension_prepare_config__prepare_flash_kernel() {
# Extension configuration defaults.
export DISTRO_GENERIC_KERNEL=${DISTRO_GENERIC_KERNEL:-no} # if yes, does not build our own kernel, instead, uses generic one from distro
@@ -6,6 +6,7 @@ function extension_prepare_config__prepare_flash_kernel() {
export UEFI_GRUB_DISABLE_OS_PROBER="${UEFI_GRUB_DISABLE_OS_PROBER:-}" # 'true' will disable os-probing, useful for SD cards.
export UEFI_GRUB_DISTRO_NAME="${UEFI_GRUB_DISTRO_NAME:-Armbian}" # Will be used on grub menu display
export UEFI_GRUB_TIMEOUT=${UEFI_GRUB_TIMEOUT:-0} # Small timeout by default
+ export GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT:-}" # Cmdline by default
export UEFI_ENABLE_BIOS_AMD64="${UEFI_ENABLE_BIOS_AMD64:-yes}" # Enable BIOS too if target is amd64
export UEFI_EXPORT_KERNEL_INITRD="${UEFI_EXPORT_KERNEL_INITRD:-no}" # Export kernel and initrd for direct kernel boot "kexec"
# User config overrides.
@@ -53,6 +54,7 @@ function extension_prepare_config__prepare_flash_kernel() {
unset KERNELSOURCE # This should make Armbian skip most stuff. At least, I hacked it to.
export INSTALL_ARMBIAN_FIRMWARE=no # Should skip build and install of Armbian-firmware.
else
+ export KERNELDIR="linux-uefi-${LINUXFAMILY}" # Avoid sharing a source tree with others, until we know it's safe.
# Don't install anything. Armbian handles everything.
DISTRO_KERNEL_PACKAGES=""
DISTRO_FIRMWARE_PACKAGES=""
@@ -91,6 +93,10 @@ pre_umount_final_image__install_grub() {
GRUB_DISABLE_OS_PROBER=true
grubCfgFragHostSide
+ # copy Armbian GRUB wallpaper
+ mkdir -p "${MOUNT}"/usr/share/images/grub/
+ cp "${SRC}"/packages/blobs/splash/grub.png "${MOUNT}"/usr/share/images/grub/wallpaper.png
+
# Mount the chroot...
mount_chroot "$chroot_target/" # this already handles /boot/efi which is required for it to work.
@@ -101,7 +107,7 @@ pre_umount_final_image__install_grub() {
}
fi
- local install_grub_cmdline="update-initramfs -c -k all && update-grub && grub-install --target=${UEFI_GRUB_TARGET} --no-nvram --removable" # nvram is global to the host, even across chroot. take care.
+ local install_grub_cmdline="update-grub && grub-install --verbose --target=${UEFI_GRUB_TARGET} --no-nvram --removable" # nvram is global to the host, even across chroot. take care.
display_alert "Installing GRUB EFI..." "${UEFI_GRUB_TARGET}" ""
chroot_custom "$chroot_target" "$install_grub_cmdline" || {
exit_with_error "${install_grub_cmdline} failed!"
@@ -136,18 +142,31 @@ pre_umount_final_image__900_export_kernel_and_initramfs() {
}
configure_grub() {
- display_alert "GRUB EFI kernel cmdline" "console=${SERIALCON} distro=${UEFI_GRUB_DISTRO_NAME} timeout=${UEFI_GRUB_TIMEOUT} grub terminal=${UEFI_GRUB_TERMINAL}" ""
-
- if [[ "_${SERIALCON}_" != "__" ]]; then
- cat <<- grubCfgFrag >> "${MOUNT}"/etc/default/grub.d/98-armbian.cfg
- GRUB_CMDLINE_LINUX_DEFAULT="console=${SERIALCON}" # extra Kernel cmdline is configured here
- grubCfgFrag
+ [[ -n "$SERIALCON" ]] &&
+ GRUB_CMDLINE_LINUX_DEFAULT+=" console=${SERIALCON}"
+
+ [[ "$BOOT_LOGO" == "yes" || "$BOOT_LOGO" == "desktop" && "$BUILD_DESKTOP" == "yes" ]] &&
+ GRUB_CMDLINE_LINUX_DEFAULT+=" quiet splash plymouth.ignore-serial-consoles i915.force_probe=* loglevel=3" ||
+ GRUB_CMDLINE_LINUX_DEFAULT+=" splash=verbose i915.force_probe=*"
+
+ # Enable Armbian Wallpaper on GRUB
+ if [[ "${VENDOR}" == Armbian ]]; then
+ mkdir -p "${MOUNT}"/usr/share/desktop-base/
+ cat <<- grubWallpaper >> "${MOUNT}"/usr/share/desktop-base/grub_background.sh
+ WALLPAPER=/usr/share/images/grub/wallpaper.png
+ COLOR_NORMAL=white/black
+ COLOR_HIGHLIGHT=black/white
+ grubWallpaper
fi
+ display_alert "GRUB EFI kernel cmdline" "${GRUB_CMDLINE_LINUX_DEFAULT} distro=${UEFI_GRUB_DISTRO_NAME} timeout=${UEFI_GRUB_TIMEOUT}" ""
cat <<- grubCfgFrag >> "${MOUNT}"/etc/default/grub.d/98-armbian.cfg
+ GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT}"
GRUB_TIMEOUT_STYLE=menu # Show the menu with Kernel options (Armbian or -generic)...
GRUB_TIMEOUT=${UEFI_GRUB_TIMEOUT} # ... for ${UEFI_GRUB_TIMEOUT} seconds, then boot the Armbian default.
GRUB_DISTRIBUTOR="${UEFI_GRUB_DISTRO_NAME}" # On GRUB menu will show up as "Armbian GNU/Linux" (will show up in some UEFI BIOS boot menu (F8?) as "armbian", not on others)
+ GRUB_GFXMODE=1024x768
+ GRUB_GFXPAYLOAD=keep
grubCfgFrag
if [[ "a${UEFI_GRUB_DISABLE_OS_PROBER}" != "a" ]]; then
diff --git a/lib/functions/bsp/bsp-desktop.sh b/lib/functions/bsp/bsp-desktop.sh
index 8ebc53738..eca6670ed 100644
--- a/lib/functions/bsp/bsp-desktop.sh
+++ b/lib/functions/bsp/bsp-desktop.sh
@@ -47,6 +47,7 @@ create_desktop_package() {
Priority: optional
Recommends: ${DEBIAN_RECOMMENDS//[:space:]+/,}, armbian-bsp-desktop
Provides: ${CHOSEN_DESKTOP}, armbian-${RELEASE}-desktop
+ Conflicts: gdm3
Pre-Depends: ${PACKAGE_LIST_PREDEPENDS//[:space:]+/,}
Description: Armbian desktop for ${DISTRIBUTION} ${RELEASE}
EOF
diff --git a/lib/functions/compilation/debs.sh b/lib/functions/compilation/debs.sh
index 3db0c44d4..10eca1f03 100644
--- a/lib/functions/compilation/debs.sh
+++ b/lib/functions/compilation/debs.sh
@@ -14,7 +14,9 @@ compile_firmware() {
if [[ -n $FULL ]]; then
fetch_from_repo "$MAINLINE_FIRMWARE_SOURCE" "linux-firmware-git" "branch:main"
# cp : create hardlinks
- cp -af --reflink=auto "${SRC}"/cache/sources/linux-firmware-git/* "${firmwaretempdir}/${plugin_dir}/lib/firmware/"
+ run_host_command_logged cp -af --reflink=auto "${SRC}"/cache/sources/linux-firmware-git/* "${firmwaretempdir}/${plugin_dir}/lib/firmware/"
+ # cp : create hardlinks for ath11k WCN685x hw2.1 firmware since they are using the same firmware with hw2.0
+ run_host_command_logged cp -af --reflink=auto "${firmwaretempdir}/${plugin_dir}/lib/firmware/ath11k/WCN6855/hw2.0/" "${firmwaretempdir}/${plugin_dir}/lib/firmware/ath11k/WCN6855/hw2.1/"
fi
# overlay our firmware
# cp : create hardlinks
@@ -129,7 +131,9 @@ compile_armbian-config() {
fetch_from_repo "https://github.com/armbian/config" "armbian-config" "branch:master"
fetch_from_repo "https://github.com/dylanaraps/neofetch" "neofetch" "tag:7.1.0"
- fetch_from_repo "https://github.com/complexorganizations/wireguard-manager" "wireguard-manager" "tag:v1.0.0.10-26-2021"
+
+ # @TODO: move this to where it is actually used; not everyone needs to pull this in
+ fetch_from_repo "$GITHUB_SOURCE/complexorganizations/wireguard-manager" "wireguard-manager" "branch:main"
mkdir -p "${tmp_dir}/${armbian_config_dir}"/{DEBIAN,usr/bin/,usr/sbin/,usr/lib/armbian-config/}
@@ -188,3 +192,57 @@ compile_xilinx_bootgen() {
popd
}
+
+# @TODO: code from master via Igor; not yet armbian-next'fied! warning!!
+compile_plymouth-theme-armbian() {
+
+ local tmp_dir work_dir
+ tmp_dir=$(mktemp -d)
+ chmod 700 ${tmp_dir}
+ trap "ret=\$?; rm -rf \"${tmp_dir}\" ; exit \$ret" 0 1 2 3 15
+ plymouth_theme_armbian_dir=armbian-plymouth-theme_${REVISION}_all
+ display_alert "Building deb" "armbian-plymouth-theme" "info"
+
+ mkdir -p "${tmp_dir}/${plymouth_theme_armbian_dir}"/{DEBIAN,usr/share/plymouth/themes/armbian}
+
+ # set up control file
+ cat <<- END > "${tmp_dir}/${plymouth_theme_armbian_dir}"/DEBIAN/control
+ Package: armbian-plymouth-theme
+ Version: $REVISION
+ Architecture: all
+ Maintainer: $MAINTAINER <$MAINTAINERMAIL>
+ Depends: plymouth, plymouth-themes
+ Section: universe/x11
+ Priority: optional
+ Description: boot animation, logger and I/O multiplexer - armbian theme
+ END
+
+ cp "${SRC}"/packages/plymouth-theme-armbian/debian/{postinst,prerm,postrm} \
+ "${tmp_dir}/${plymouth_theme_armbian_dir}"/DEBIAN/
+ chmod 755 "${tmp_dir}/${plymouth_theme_armbian_dir}"/DEBIAN/{postinst,prerm,postrm}
+
+ convert -resize 256x256 \
+ "${SRC}"/packages/plymouth-theme-armbian/armbian-logo.png \
+ "${tmp_dir}/${plymouth_theme_armbian_dir}"/usr/share/plymouth/themes/armbian/bgrt-fallback.png
+
+ # convert -resize 52x52 \
+ # "${SRC}"/packages/plymouth-theme-armbian/spinner.gif \
+ # "${tmp_dir}/${plymouth_theme_armbian_dir}"/usr/share/plymouth/themes/armbian/animation-%04d.png
+
+ convert -resize 52x52 \
+ "${SRC}"/packages/plymouth-theme-armbian/spinner.gif \
+ "${tmp_dir}/${plymouth_theme_armbian_dir}"/usr/share/plymouth/themes/armbian/throbber-%04d.png
+
+ cp "${SRC}"/packages/plymouth-theme-armbian/watermark.png \
+ "${tmp_dir}/${plymouth_theme_armbian_dir}"/usr/share/plymouth/themes/armbian/
+
+ cp "${SRC}"/packages/plymouth-theme-armbian/{bullet,capslock,entry,keyboard,keymap-render,lock}.png \
+ "${tmp_dir}/${plymouth_theme_armbian_dir}"/usr/share/plymouth/themes/armbian/
+
+ cp "${SRC}"/packages/plymouth-theme-armbian/armbian.plymouth \
+ "${tmp_dir}/${plymouth_theme_armbian_dir}"/usr/share/plymouth/themes/armbian/
+
+ fakeroot dpkg-deb -b -Z${DEB_COMPRESS} "${tmp_dir}/${plymouth_theme_armbian_dir}" > /dev/null
+ rsync --remove-source-files -rq "${tmp_dir}/${plymouth_theme_armbian_dir}.deb" "${DEB_STORAGE}/"
+ rm -rf "${tmp_dir}"
+}
diff --git a/lib/functions/compilation/patch/kernel-bootsplash.sh b/lib/functions/compilation/patch/kernel-bootsplash.sh
index 3a366234c..9939de493 100644
--- a/lib/functions/compilation/patch/kernel-bootsplash.sh
+++ b/lib/functions/compilation/patch/kernel-bootsplash.sh
@@ -7,28 +7,19 @@ function apply_kernel_patches_for_bootsplash() {
# @TODO: rpardini: so, can we completely remove this?
SKIP_BOOTSPLASH=yes
- # previously: if linux-version compare "${version}" ge 5.10 && [ $SKIP_BOOTSPLASH != yes ]; then
[[ "${SKIP_BOOTSPLASH}" == "yes" ]] && return 0
- linux-version compare "${version}" le 5.10 && return 0
- linux-version compare "${version}" lt 5.19 && return 0
+ linux-version compare "${version}" le 5.14 && return 0
+ display_alert "Adding" "Kernel splash file" "info"
- display_alert "Adding" "Kernel bootsplash patch" "info"
-
- if linux-version compare "${version}" ge 5.11; then
- process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0000-Revert-fbcon-Avoid-cap-set-but-not-used-warning.patch" "applying"
- fi
-
- if (linux-version compare "${version}" ge 5.18.18 && linux-version compare "${version}" lt 5.19) ||
- (linux-version compare "${version}" ge 5.15.61 && linux-version compare "${version}" lt 5.16); then
- process_patch_file "${SRC}/patch/misc/0001-Revert-fbcon-Fix-accelerated-fbdev-scrolling-while-logo-is-still-shown.patch" "applying"
+ if linux-version compare "${version}" ge 5.19.6 ||
+ (linux-version compare "${version}" ge 5.15.64 && linux-version compare "${version}" lt 5.16); then
+ process_patch_file "${SRC}/patch/misc/0001-Revert-fbdev-fbcon-Properly-revert-changes-when-vc_r.patch" "applying"
fi
+ process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0000-Revert-fbcon-Avoid-cap-set-but-not-used-warning.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/0001-Revert-fbcon-Fix-accelerated-fbdev-scrolling-while-logo-is-still-shown.patch" "applying"
process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0001-Revert-fbcon-Add-option-to-enable-legacy-hardware-ac.patch" "applying"
-
- if linux-version compare "${version}" ge 5.15; then
- process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0002-Revert-vgacon-drop-unused-vga_init_done.patch" "applying"
- fi
-
+ process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0002-Revert-vgacon-drop-unused-vga_init_done.patch" "applying"
process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0003-Revert-vgacon-remove-software-scrollback-support.patch" "applying"
process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0004-Revert-drivers-video-fbcon-fix-NULL-dereference-in-f.patch" "applying"
process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0005-Revert-fbcon-remove-no-op-fbcon_set_origin.patch" "applying"
diff --git a/lib/functions/compilation/patch/kernel-drivers.sh b/lib/functions/compilation/patch/kernel-drivers.sh
index 505a3a89e..46ca22109 100644
--- a/lib/functions/compilation/patch/kernel-drivers.sh
+++ b/lib/functions/compilation/patch/kernel-drivers.sh
@@ -10,6 +10,15 @@
# https://github.com/armbian/build/
function prepare_extra_kernel_drivers() {
+ #
+ # Returning headers needed for some wireless drivers
+ #
+
+ if linux-version compare "${version}" ge 5.4 && [ $EXTRAWIFI == yes ]; then
+ display_alert "Adding" "Missing headers" "info" # @TODO: which headers?
+ process_patch_file "${SRC}/patch/misc/wireless-bring-back-headers.patch" "applying"
+ fi
+
#
# mac80211 wireless driver injection features from Kali Linux
#
@@ -254,20 +263,20 @@ function prepare_extra_kernel_drivers() {
display_alert "Adding" "Wireless drivers for Xradio XR819 chipsets" "info"
- fetch_from_repo "https://github.com/karabek/xradio" "xradio" "branch:master" "yes"
+ fetch_from_repo "$GITHUB_SOURCE/dbeinder/xradio" "xradio" "branch:karabek_rebase" "yes"
cd "$kerneldir" || exit
rm -rf "$kerneldir/drivers/net/wireless/xradio"
mkdir -p "$kerneldir/drivers/net/wireless/xradio/"
- cp "${SRC}"/cache/sources/xradio/master/*.{h,c} \
+ cp "${SRC}"/cache/sources/xradio/karabek_rebase/*.{h,c} \
"$kerneldir/drivers/net/wireless/xradio/"
# Makefile
- cp "${SRC}/cache/sources/xradio/master/Makefile" \
+ cp "${SRC}/cache/sources/xradio/karabek_rebase/Makefile" \
"$kerneldir/drivers/net/wireless/xradio/Makefile"
# Kconfig
- sed -i 's/---help---/help/g' "${SRC}/cache/sources/xradio/master/Kconfig"
- cp "${SRC}/cache/sources/xradio/master/Kconfig" \
+ sed -i 's/---help---/help/g' "${SRC}/cache/sources/xradio/karabek_rebase/Kconfig"
+ cp "${SRC}/cache/sources/xradio/karabek_rebase/Kconfig" \
"$kerneldir/drivers/net/wireless/xradio/Kconfig"
# Add to section Makefile
@@ -279,6 +288,10 @@ function prepare_extra_kernel_drivers() {
# add support for K5.13+
process_patch_file "${SRC}/patch/misc/wireless-xradio-5.13.patch" "applying"
+ # add support for aarch64
+ if [[ $ARCH == arm64 ]]; then
+ process_patch_file "${SRC}/patch/misc/wireless-xradio-aarch64.patch" "applying"
+ fi
fi
# Wireless drivers for Realtek RTL8811CU and RTL8821C chipsets
@@ -377,7 +390,7 @@ function prepare_extra_kernel_drivers() {
# @TODO: fasthash for this is... ? remote git hash?
# attach to specifics tag or branch
- local rtl88x2buver="branch:fix-6.0"
+ local rtl88x2buver="commit:00f51d93fe8309b0e23782ad621a038c98c7f031"
display_alert "Adding" "Wireless drivers for Realtek 88x2bu chipsets ${rtl88x2buver}" "info"
@@ -499,7 +512,12 @@ function prepare_extra_kernel_drivers() {
if linux-version compare $version ge 5.0 && [ "$EXTRAWIFI" == yes ]; then
# @TODO: fasthash for this is... ? remote git hash?
- local rtl8723duver="branch:master"
+ # attach to specifics tag or branch
+ if linux-version compare $version ge 5.12; then
+ local rtl8723duver="branch:v5.13.4"
+ else
+ local rtl8723duver="branch:master"
+ fi
display_alert "Adding" "Wireless drivers for Realtek 8723DU chipsets ${rtl8723duver}" "info"
diff --git a/lib/functions/configuration/interactive.sh b/lib/functions/configuration/interactive.sh
index 743d8a22b..2cee5395d 100644
--- a/lib/functions/configuration/interactive.sh
+++ b/lib/functions/configuration/interactive.sh
@@ -170,10 +170,11 @@ function interactive_config_ask_release() {
function interactive_config_ask_desktop_build() {
# don't show desktop option if we choose minimal build
- [[ $BUILD_MINIMAL == yes ]] && BUILD_DESKTOP=no
+ [[ $HAS_VIDEO_OUTPUT == no || $BUILD_MINIMAL == yes ]] && BUILD_DESKTOP=no
[[ $KERNEL_ONLY == yes ]] && return 0
[[ -n ${BUILD_DESKTOP} ]] && return 0
+
# read distribution support status which is written to the armbian-release file
set_distribution_status
options=()
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index cdae96d38..91c3844ca 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -82,7 +82,7 @@ function do_main_configuration() {
fi
# small SD card with kernel, boot script and .dtb/.bin files
- [[ $ROOTFS_TYPE == nfs ]] && FIXED_IMAGE_SIZE=64
+ [[ $ROOTFS_TYPE == nfs ]] && FIXED_IMAGE_SIZE=256
# Since we are having too many options for mirror management,
# then here is yet another mirror related option.
@@ -171,6 +171,7 @@ function do_main_configuration() {
[[ -z $WIREGUARD ]] && WIREGUARD="yes"
[[ -z $EXTRAWIFI ]] && EXTRAWIFI="yes"
[[ -z $SKIP_BOOTSPLASH ]] && SKIP_BOOTSPLASH="no"
+ [[ -z $PLYMOUTH ]] && PLYMOUTH="yes"
[[ -z $AUFS ]] && AUFS="yes"
[[ -z $IMAGE_PARTITION_TABLE ]] && IMAGE_PARTITION_TABLE="msdos"
[[ -z $EXTRA_BSP_NAME ]] && EXTRA_BSP_NAME=""
@@ -210,6 +211,13 @@ function do_main_configuration() {
# shellcheck source=/dev/null
source "${SRC}/config/sources/${ARCH}.conf"
+ if [[ "$HAS_VIDEO_OUTPUT" == "no" ]]; then
+ SKIP_BOOTSPLASH="yes"
+ PLYMOUTH="no"
+ [[ $BUILD_DESKTOP != "no" ]] && exit_with_error "HAS_VIDEO_OUTPUT is set to no. So we shouldn't build desktop environment"
+ fi
+
+
## Extensions: at this point we've sourced all the config files that will be used,
## and (hopefully) not yet invoked any extension methods. So this is the perfect
## place to initialize the extension manager. It will create functions
diff --git a/lib/functions/general/chroot-helpers.sh b/lib/functions/general/chroot-helpers.sh
index 8c90cc578..a8425ae99 100644
--- a/lib/functions/general/chroot-helpers.sh
+++ b/lib/functions/general/chroot-helpers.sh
@@ -5,6 +5,7 @@
mount_chroot() {
local target=$1
+ mount -t tmpfs tmpfs "${target}/tmp"
mount -t proc chproc "${target}"/proc
mount -t sysfs chsys "${target}"/sys
mount -t devtmpfs chdev "${target}"/dev || mount --bind /dev "${target}"/dev
@@ -19,10 +20,11 @@ mount_chroot() {
umount_chroot() {
local target=$1
display_alert "Unmounting" "$target" "info"
- while grep -Eq "${target}.*(dev|proc|sys)" /proc/mounts; do
+ while grep -Eq "${target}.*(dev|proc|sys|tmp)" /proc/mounts; do
umount --recursive "${target}"/dev > /dev/null 2>&1 || true
umount "${target}"/proc > /dev/null 2>&1 || true
umount "${target}"/sys > /dev/null 2>&1 || true
+ umount "${target}"/tmp > /dev/null 2>&1 || true
sync
done
}
diff --git a/lib/functions/general/cleaning.sh b/lib/functions/general/cleaning.sh
index 833ac4ce7..5d4b51976 100644
--- a/lib/functions/general/cleaning.sh
+++ b/lib/functions/general/cleaning.sh
@@ -24,6 +24,7 @@ general_cleaning() {
find "${DEB_STORAGE}" -name "${CHOSEN_UBOOT}_*.deb" -delete
find "${DEB_STORAGE}" \( -name "${CHOSEN_KERNEL}_*.deb" -o \
-name "armbian-*.deb" -o \
+ -name "plymouth-theme-armbian_*.deb" -o \
-name "${CHOSEN_KERNEL/image/dtb}_*.deb" -o \
-name "${CHOSEN_KERNEL/image/headers}_*.deb" -o \
-name "${CHOSEN_KERNEL/image/source}_*.deb" -o \
diff --git a/lib/functions/general/downloads.sh b/lib/functions/general/downloads.sh
index 5bbd161fe..e6cfc8beb 100644
--- a/lib/functions/general/downloads.sh
+++ b/lib/functions/general/downloads.sh
@@ -1,42 +1,42 @@
-function webseed() {
-
- # list of mirrors that host our files
- unset text
- local CCODE=$(curl -s redirect.armbian.com/geoip | jq '.continent.code' -r)
-
- if [[ "$2" == rootfs* ]]; then
- WEBSEED=($(curl -s ${1}mirrors | jq -r '.'${CCODE}' | .[] | values'))
- else
- WEBSEED=($(curl -s https://redirect.armbian.com/mirrors | jq -r '.'${CCODE}' | .[] | values'))
- fi
-
- # remove dead mirrors to suppress download errors
- while read -r line; do
- REMOVE=$(echo $line | egrep -o 'https?://[^ ]+/')
- WEBSEED=("${WEBSEED[@]/$REMOVE/}")
- done < <(
- for k in ${WEBSEED[@]}; do
- echo "$k$2/$3"
- done | parallel --halt soon,fail=10 --jobs 32 wget -q --spider --timeout=15 --tries=4 --retry-connrefused {} 2>&1 > /dev/null
- )
-
- # aria2 simply split chunks based on sources count not depending on download speed
- # when selecting china mirrors, use only China mirror, others are very slow there
- if [[ $DOWNLOAD_MIRROR == china ]]; then
- WEBSEED=(
- https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/
- )
- elif [[ $DOWNLOAD_MIRROR == bfsu ]]; then
- WEBSEED=(
- https://mirrors.bfsu.edu.cn/armbian-releases/
- )
- fi
+function get_urls() {
+ local catalog=$1
+ local filename=$2
- for toolchain in ${WEBSEED[@]}; do
- text="${text} ${toolchain}"$2/"${3}"
- done
- text="${text:1}"
- echo "${text}"
+ case $catalog in
+ toolchain)
+ local CCODE=$(curl --silent --fail https://dl.armbian.com/geoip | jq '.continent.code' -r)
+ local urls=(
+ # "https://dl.armbian.com/_toolchain/${filename}"
+
+ $(
+ curl --silent --fail "https://dl.armbian.com/mirrors" |
+ jq -r "(${CCODE:+.${CCODE} // } .default) | .[]" |
+ sed "s#\$#/_toolchain/${filename}#"
+ )
+ )
+ ;;
+
+ rootfs)
+ local CCODE=$(curl --silent --fail https://cache.armbian.com/geoip | jq '.continent.code' -r)
+ local urls=(
+ # "https://cache.armbian.com/rootfs/${ROOTFSCACHE_VERSION}/${filename}"
+ "https://github.com/armbian/cache/releases/download/${ROOTFSCACHE_VERSION}/${filename}"
+
+ $(
+ curl --silent --fail "https://cache.armbian.com/mirrors" |
+ jq -r "(${CCODE:+.${CCODE} // } .default) | .[]" |
+ sed "s#\$#/rootfs/${ROOTFSCACHE_VERSION}/${filename}#"
+ )
+ )
+ ;;
+
+ *)
+ exit_with_error "Unknown catalog" "$catalog" >&2
+ return
+ ;;
+ esac
+
+ echo "${urls[@]}"
}
# Terrible idea, this runs download_and_verify_internal() with error handling disabled.
@@ -45,99 +45,100 @@ function download_and_verify() {
}
function download_and_verify_internal() {
- local remotedir=$1
- local filename=$2
- local localdir=$SRC/cache/${remotedir//_/}
- local dirname=${filename//.tar.xz/}
- [[ -z $DISABLE_IPV6 ]] && DISABLE_IPV6="true"
-
- local server=${ARMBIAN_MIRROR}
- if [[ $DOWNLOAD_MIRROR == china ]]; then
- server="https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/"
- elif [[ $DOWNLOAD_MIRROR == bfsu ]]; then
- server="https://mirrors.bfsu.edu.cn/armbian-releases/"
- fi
-
- if [[ "x${server}x" == "xx" ]]; then
- display_alert "ARMBIAN_MIRROR is not set, nor valid DOWNLOAD_MIRROR" "not downloading '${filename}'" "debug"
- return 0
- fi
-
- if [[ -f ${localdir}/${dirname}/.download-complete ]]; then
- return 0
- fi
- # rootfs has its own infra
- if [[ "${remotedir}" == "_rootfs" ]]; then
- local server="https://cache.armbian.com/"
- remotedir="rootfs/$ROOTFSCACHE_VERSION"
- fi
-
- # switch to china mirror if US timeouts
- timeout 10 curl --head --fail --silent "${server}${remotedir}/${filename}"
- if [[ $? -ne 7 && $? -ne 22 && $? -ne 0 ]]; then
- display_alert "Timeout from $server" "retrying" "info"
- server="https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/"
-
- # switch to another china mirror if tuna timeouts
- timeout 10 curl --head --fail --silent ${server}${remotedir}/${filename}
- if [[ $? -ne 7 && $? -ne 22 && $? -ne 0 ]]; then
- display_alert "Timeout from $server" "retrying" "info"
- server="https://mirrors.bfsu.edu.cn/armbian-releases/"
- fi
- fi
+ local catalog=$1
+ local filename=$2
+ local localdir=$SRC/cache/$catalog
- # check if file exists on remote server before running aria2 downloader
- [[ ! $(timeout 10 curl --head --fail --silent ${server}${remotedir}/${filename}) ]] && return
+ local keys=(
+ "8F427EAF" # Linaro Toolchain Builder
+ "9F0E78D5" # Igor Pecovnik
+ )
- cd "${localdir}" || exit
+ local aria2_options=(
+ # Display
+ --console-log-level=error
+ --summary-interval=0
+ --download-result=hide
+
+ # Meta
+ --server-stat-if="${SRC}/cache/.aria2/server_stats"
+ --server-stat-of="${SRC}/cache/.aria2/server_stats"
+ --dht-file-path="${SRC}/cache/.aria2/dht.dat"
+ --rpc-save-upload-metadata=false
+ --auto-save-interval=0
+
+ # File
+ --auto-file-renaming=false
+ --allow-overwrite=true
+ --file-allocation=trunc
+
+ # Connection
+ --disable-ipv6=$DISABLE_IPV6
+ --connect-timeout=10
+ --timeout=10
+ --allow-piece-length-change=true
+ --max-connection-per-server=2
+ --lowest-speed-limit=500K
+
+ # BT
+ --seed-time=0
+ --bt-stop-timeout=30
+ )
- # use local control file
- if [[ -f "${SRC}"/config/torrents/${filename}.asc ]]; then
- local torrent="${SRC}"/config/torrents/${filename}.torrent
+ # use local signature file
+ if [[ -f "${SRC}/config/torrents/${filename}.asc" ]]; then
+ local torrent="${SRC}/config/torrents/${filename}.torrent"
ln -sf "${SRC}/config/torrents/${filename}.asc" "${localdir}/${filename}.asc"
- elif [[ ! $(timeout 10 curl --head --fail --silent "${server}${remotedir}/${filename}.asc") ]]; then
- return
else
- # download control file
- local torrent=${server}$remotedir/${filename}.torrent
- run_host_command_logged aria2c --download-result=hide --disable-ipv6=${DISABLE_IPV6} --summary-interval=0 --console-log-level=error --auto-file-renaming=false \
- --continue=false --allow-overwrite=true --dir="${localdir}" ${server}${remotedir}/${filename}.asc $(webseed "$remotedir/${filename}.asc") -o "${filename}.asc"
- [[ $? -ne 0 ]] && display_alert "Failed to download control file" "" "wrn"
+ # download signature file
+ aria2c "${aria2_options[@]}" \
+ --continue=false \
+ --dir="${localdir}" --out="${filename}.asc" \
+ $(get_urls "${catalog}" "${filename}.asc")
+
+ local rc=$?
+ if [[ $rc -ne 0 ]]; then
+ # Except `not found`
+ [[ $rc -ne 3 ]] && display_alert "Failed to download signature file. aria2 exit code:" "$rc" "wrn"
+ return $rc
+ fi
+
+ [[ ${USE_TORRENT} == "yes" ]] &&
+ local torrent="$(get_urls "${catalog}" "${filename}.torrent")"
fi
# download torrent first
+ local direct=yes
if [[ ${USE_TORRENT} == "yes" ]]; then
+
display_alert "downloading using torrent network" "$filename"
- local ariatorrent="--summary-interval=0 --auto-save-interval=0 --seed-time=0 --bt-stop-timeout=120 --console-log-level=error \
- --allow-overwrite=true --download-result=hide --rpc-save-upload-metadata=false --auto-file-renaming=false \
- --file-allocation=trunc --continue=true ${torrent} \
- --dht-file-path=${SRC}/cache/.aria2/dht.dat --disable-ipv6=${DISABLE_IPV6} --stderr --follow-torrent=mem --dir=$localdir"
-
- # exception. It throws error if dht.dat file does not exists. Error suppress needed only at first download.
- if [[ -f "${SRC}"/cache/.aria2/dht.dat ]]; then
- # shellcheck disable=SC2086
- run_host_command_logged aria2c ${ariatorrent}
- else
- # shellcheck disable=SC2035
- run_host_command_logged aria2c ${ariatorrent}
- fi
- # mark complete
- touch "${localdir}/${filename}.complete"
+ aria2c "${aria2_options[@]}" \
+ --follow-torrent=mem \
+ --dir="${localdir}" \
+ ${torrent}
+
+ [[ $? -eq 0 ]] && direct=no
+
fi
# direct download if torrent fails
- if [[ ! -f "${localdir}/${filename}.complete" ]]; then
- if [[ ! $(timeout 10 curl --head --fail --silent ${server}${remotedir}/${filename} 2>&1 > /dev/null) ]]; then
- display_alert "downloading from $(echo $server | cut -d'/' -f3 | cut -d':' -f1) using http(s) network" "$filename"
- run_host_command_logged aria2c --allow-overwrite=true --download-result=hide --rpc-save-upload-metadata=false --console-log-level=error \
- --dht-file-path="${SRC}"/cache/.aria2/dht.dat --disable-ipv6=${DISABLE_IPV6} --summary-interval=0 --auto-file-renaming=false --dir="${localdir}" ${server}${remotedir}/${filename} $(webseed "${remotedir}/${filename}") -o "${filename}"
- # mark complete
- [[ $? -eq 0 ]] && touch "${localdir}/${filename}.complete" && echo ""
-
+ if [[ $direct != "no" ]]; then
+ display_alert "downloading using http(s) network" "$filename"
+ aria2c "${aria2_options[@]}" \
+ --dir="${localdir}" --out="${filename}" \
+ $(get_urls "${catalog}" "${filename}")
+
+ local rc=$?
+ if [[ $rc -ne 0 ]]; then
+ display_alert "Failed to download. aria2 exit code:" "$rc" "wrn"
+ return $rc
fi
+
+ echo ""
fi
+ local verified=false
if [[ -f ${localdir}/${filename}.asc ]]; then
if grep -q 'BEGIN PGP SIGNATURE' "${localdir}/${filename}.asc"; then
@@ -149,42 +150,31 @@ function download_and_verify_internal() {
chmod 600 "${SRC}"/cache/.gpg/gpg.conf
fi
- # Verify archives with Linaro and Armbian GPG keys
-
- if [ x"" != x"${http_proxy}" ]; then
- (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 8F427EAF || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \
- --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options http-proxy="${http_proxy}" \
- --recv-keys 8F427EAF)
+ for key in "${keys[@]}"; do
+ gpg --homedir "${SRC}/cache/.gpg" --no-permission-warning \
+ --list-keys "${key}" >> "${DEST}/${LOG_SUBPATH}/output.log" 2>&1 ||
+ gpg --homedir "${SRC}/cache/.gpg" --no-permission-warning \
+ ${http_proxy:+--keyserver-options http-proxy="${http_proxy}"} \
+ --keyserver "hkp://keyserver.ubuntu.com:80" \
+ --recv-keys "${key}" >> "${DEST}/${LOG_SUBPATH}/output.log" 2>&1 ||
+ exit_with_error "Failed to recieve key" "${key}"
+ done
+
+ gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --trust-model always \
+ -q --verify "${localdir}/${filename}.asc" >> "${DEST}/${LOG_SUBPATH}/output.log" 2>&1
+ [[ ${PIPESTATUS[0]} -eq 0 ]] && verified=true && display_alert "Verified" "PGP" "info"
- (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 9F0E78D5 || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \
- --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options http-proxy="${http_proxy}" \
- --recv-keys 9F0E78D5)
- else
- (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 8F427EAF || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \
- --keyserver hkp://keyserver.ubuntu.com:80 \
- --recv-keys 8F427EAF)
+ else
- (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 9F0E78D5 || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \
- --keyserver hkp://keyserver.ubuntu.com:80 \
- --recv-keys 9F0E78D5)
- fi
+ [[ "$(md5sum "${localdir}/${filename}" | awk '{printf $1}')" == "$(awk '{printf $1}' ${localdir}/${filename}.asc)" ]] &&
+ verified=true && display_alert "Verified" "MD5" "info"
- gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --verify --trust-model always -q "${localdir}/${filename}.asc"
- [[ ${PIPESTATUS[0]} -eq 0 ]] && verified=true && display_alert "Verified" "PGP" "info"
- else
- md5sum -c --status "${localdir}/${filename}.asc" && verified=true && display_alert "Verified" "MD5" "info"
fi
- if [[ $verified == true ]]; then
- if [[ "${filename:(-6)}" == "tar.xz" ]]; then
- display_alert "decompressing"
- pv -p -b -r -c -N "$(logging_echo_prefix_for_pv "decompress") ${filename}" "${filename}" |
- xz -dc |
- tar xp --xattrs --no-same-owner --overwrite &&
- touch "${localdir}/${dirname}/.download-complete"
- fi
- else
+ if [[ $verified != true ]]; then
+ rm -rf "${localdir}/${filename}"* # We also delete asc file
exit_with_error "verification failed"
fi
+
fi
}
diff --git a/lib/functions/host/external-toolchains.sh b/lib/functions/host/external-toolchains.sh
index f8733d294..6e5fd80cb 100644
--- a/lib/functions/host/external-toolchains.sh
+++ b/lib/functions/host/external-toolchains.sh
@@ -15,34 +15,48 @@ function download_external_toolchains() {
# download external Linaro compiler and missing special dependencies since they are needed for certain sources
local toolchains=(
- "${ARMBIAN_MIRROR}/_toolchain/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz"
- "${ARMBIAN_MIRROR}/_toolchain/gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz"
- "${ARMBIAN_MIRROR}/_toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux.tar.xz"
- "${ARMBIAN_MIRROR}/_toolchain/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi.tar.xz"
- "${ARMBIAN_MIRROR}/_toolchain/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz"
- "${ARMBIAN_MIRROR}/_toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz"
- "${ARMBIAN_MIRROR}/_toolchains/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz"
- "${ARMBIAN_MIRROR}/_toolchain/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf.tar.xz"
- "${ARMBIAN_MIRROR}/_toolchain/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz"
- "${ARMBIAN_MIRROR}/_toolchain/gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf.tar.xz"
- "${ARMBIAN_MIRROR}/_toolchain/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz"
+ "gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz"
+ "gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz"
+ "gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux.tar.xz"
+ "gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi.tar.xz"
+ "gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz"
+ "gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz"
+ "gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz"
+ "gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf.tar.xz"
+ "gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz"
+ "gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf.tar.xz"
+ "gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz"
)
USE_TORRENT_STATUS=${USE_TORRENT}
USE_TORRENT="no"
for toolchain in ${toolchains[@]}; do
- download_and_verify "_toolchain" "${toolchain##*/}"
+ local toolchain_zip="${SRC}/cache/toolchain/${toolchain}"
+ local toolchain_dir="${toolchain_zip%.tar.*}"
+ if [[ ! -f "${toolchain_dir}/.download-complete" ]]; then
+ download_and_verify "toolchain" "${toolchain}" ||
+ exit_with_error "Failed to download toolchain" "${toolchain}"
+
+ display_alert "decompressing"
+ pv -p -b -r -c -N "[ .... ] ${toolchain}" "${toolchain_zip}" |
+ xz -dc |
+ tar xp --xattrs --no-same-owner --overwrite -C "${SRC}/cache/toolchain/"
+ if [[ $? -ne 0 ]]; then
+ rm -rf "${toolchain_dir}"
+ exit_with_error "Failed to decompress toolchain" "${toolchain}"
+ fi
+
+ touch "${toolchain_dir}/.download-complete"
+ rm -rf "${toolchain_zip}"* # Also delete asc file
+ fi
done
USE_TORRENT=${USE_TORRENT_STATUS}
- rm -rf "${SRC}"/cache/toolchain/*.tar.xz*
local existing_dirs=($(ls -1 "${SRC}"/cache/toolchain))
for dir in ${existing_dirs[@]}; do
local found=no
for toolchain in ${toolchains[@]}; do
- local filename=${toolchain##*/}
- local dirname=${filename//.tar.xz/}
- [[ $dir == $dirname ]] && found=yes
+ [[ $dir == ${toolchain%.tar.*} ]] && found=yes
done
if [[ $found == no ]]; then
display_alert "Removing obsolete toolchain" "$dir"
diff --git a/lib/functions/image/initrd.sh b/lib/functions/image/initrd.sh
index 2ba34e759..3a10c5f7a 100644
--- a/lib/functions/image/initrd.sh
+++ b/lib/functions/image/initrd.sh
@@ -20,7 +20,7 @@ update_initramfs() {
initrd_kern_ver="$(basename "$target_dir")"
initrd_file="${chroot_target}/boot/initrd.img-${initrd_kern_ver}"
- update_initramfs_cmd="update-initramfs -uv -k ${initrd_kern_ver}"
+ update_initramfs_cmd="TMPDIR=/tmp update-initramfs -uv -k ${initrd_kern_ver}" # @TODO: why? TMPDIR=/tmp
else
exit_with_error "No kernel installed for the version" "${VER}"
fi
diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh
index 3340db9e9..267218f06 100644
--- a/lib/functions/image/partitioning.sh
+++ b/lib/functions/image/partitioning.sh
@@ -72,9 +72,9 @@ function prepare_partitions() {
UEFISIZE=${UEFISIZE:-0}
BIOSSIZE=${BIOSSIZE:-0}
UEFI_MOUNT_POINT=${UEFI_MOUNT_POINT:-/boot/efi}
- UEFI_FS_LABEL="${UEFI_FS_LABEL:-ARMBIEFI}" # Should be always uppercase
- ROOT_FS_LABEL="${ROOT_FS_LABEL:-armbian_root}"
- BOOT_FS_LABEL="${BOOT_FS_LABEL:-armbianboot}"
+ UEFI_FS_LABEL="${UEFI_FS_LABEL:-armbi_efi}"
+ ROOT_FS_LABEL="${ROOT_FS_LABEL:-armbi_root}"
+ BOOT_FS_LABEL="${BOOT_FS_LABEL:-armbi_boot}"
call_extension_method "pre_prepare_partitions" "prepare_partitions_custom" <<- 'PRE_PREPARE_PARTITIONS'
*allow custom options for mkfs*
@@ -82,44 +82,28 @@ function prepare_partitions() {
PRE_PREPARE_PARTITIONS
# stage: determine partition configuration
- if [[ -n $BOOTFS_TYPE ]]; then
- # 2 partition setup with forced /boot type
- local bootfs=$BOOTFS_TYPE
- local bootpart=1
- local rootpart=2
- [[ -z $BOOTSIZE || $BOOTSIZE -le 8 ]] && BOOTSIZE=${DEFAULT_BOOTSIZE}
- elif [[ $ROOTFS_TYPE != ext4 && $ROOTFS_TYPE != nfs ]]; then
- # 2 partition setup for non-ext4 local root
- local bootfs=ext4
- local bootpart=1
- local rootpart=2
- [[ -z $BOOTSIZE || $BOOTSIZE -le 8 ]] && BOOTSIZE=${DEFAULT_BOOTSIZE}
- elif [[ $ROOTFS_TYPE == nfs ]]; then
- # single partition ext4 /boot, no root
- local bootfs=ext4
- local bootpart=1
- [[ -z $BOOTSIZE || $BOOTSIZE -le 8 ]] && BOOTSIZE=${DEFAULT_BOOTSIZE} # For cleanup processing only
- elif [[ $CRYPTROOT_ENABLE == yes ]]; then
- # 2 partition setup for encrypted /root and non-encrypted /boot
- local bootfs=ext4
- local bootpart=1
- local rootpart=2
- [[ -z $BOOTSIZE || $BOOTSIZE -le 8 ]] && BOOTSIZE=${DEFAULT_BOOTSIZE}
- elif [[ $UEFISIZE -gt 0 ]]; then
+ local next=1
+ # Check if we need UEFI partition
+ if [[ $UEFISIZE -gt 0 ]]; then
if [[ "${IMAGE_PARTITION_TABLE}" == "gpt" ]]; then
- # efi partition and ext4 root. some juggling is done by parted/sgdisk
local uefipart=15
- local rootpart=1
+ # Check if we need BIOS partition
+ [[ $BIOSSIZE -gt 0 ]] && local biospart=14
else
- # efi partition and ext4 root.
- local uefipart=1
- local rootpart=2
+ local uefipart=$((next++))
fi
+ fi
+ # Check if we need boot partition
+ if [[ -n $BOOTFS_TYPE || $ROOTFS_TYPE != ext4 || $CRYPTROOT_ENABLE == yes ]]; then
+ local bootpart=$((next++))
+ local bootfs=${BOOTFS_TYPE:-ext4}
+ [[ -z $BOOTSIZE || $BOOTSIZE -le 8 ]] && BOOTSIZE=${DEFAULT_BOOTSIZE}
else
- # single partition ext4 root
- local rootpart=1
BOOTSIZE=0
fi
+ # Check if we need root partition
+ [[ $ROOTFS_TYPE != nfs ]] &&
+ local rootpart=$((next++))
# stage: calculate rootfs size
export rootfs_size=$(du -sm $SDCARD/ | cut -f1) # MiB
@@ -145,9 +129,9 @@ function prepare_partitions() {
# Hardcoded overhead +25% is needed for desktop images,
# for CLI it could be lower. Align the size up to 4MiB
if [[ $BUILD_DESKTOP == yes ]]; then
- local sdsize=$(bc -l <<< "scale=0; ((($imagesize * 1.30) / 1 + 0) / 4 + 1) * 4")
+ local sdsize=$(bc -l <<< "scale=0; ((($imagesize * 1.35) / 1 + 0) / 4 + 1) * 4")
else
- local sdsize=$(bc -l <<< "scale=0; ((($imagesize * 1.25) / 1 + 0) / 4 + 1) * 4")
+ local sdsize=$(bc -l <<< "scale=0; ((($imagesize * 1.30) / 1 + 0) / 4 + 1) * 4")
fi
fi
@@ -169,60 +153,53 @@ function prepare_partitions() {
# stage: create partition table
display_alert "Creating partitions" "${bootfs:+/boot: $bootfs }root: $ROOTFS_TYPE" "info"
- run_host_command_logged parted -s ${SDCARD}.raw -- mklabel ${IMAGE_PARTITION_TABLE}
if [[ "${USE_HOOK_FOR_PARTITION}" == "yes" ]]; then
- display_alert "Using create_partition_table hook_point" "yes" "debug"
+ { [[ "$IMAGE_PARTITION_TABLE" == "msdos" ]] && echo "label: dos" || echo "label: $IMAGE_PARTITION_TABLE"; } |
+ run_host_command_logged sfdisk ${SDCARD}.raw || exit_with_error "Create partition table fail"
+
call_extension_method "create_partition_table" <<- 'CREATE_PARTITION_TABLE'
*only called when USE_HOOK_FOR_PARTITION=yes to create the complete partition table*
Finally, we can get our own partition table. You have to partition ${SDCARD}.raw
yourself. Good luck.
CREATE_PARTITION_TABLE
- elif [[ $ROOTFS_TYPE == nfs ]]; then
- # single /boot partition
- run_host_command_logged parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$bootfs]} ${bootstart}s "100%"
- elif [[ $UEFISIZE -gt 0 ]]; then
- # uefi partition + root partition
- if [[ "${IMAGE_PARTITION_TABLE}" == "gpt" ]]; then
- if [[ ${BIOSSIZE} -gt 0 ]]; then
- display_alert "Creating partitions" "BIOS+UEFI+rootfs" "info"
- # UEFI + GPT automatically get a BIOS partition at 14, EFI at 15
- local biosstart=$(($OFFSET * 2048))
- local uefistart=$(($OFFSET * 2048 + ($BIOSSIZE * 2048)))
- local rootstart=$(($uefistart + ($UEFISIZE * 2048)))
- local biosend=$(($uefistart - 1))
- local uefiend=$(($rootstart - 1))
- run_host_command_logged parted -s ${SDCARD}.raw -- mkpart bios fat32 ${biosstart}s ${biosend}s
- run_host_command_logged parted -s ${SDCARD}.raw -- mkpart efi fat32 ${uefistart}s ${uefiend}s
- run_host_command_logged parted -s ${SDCARD}.raw -- mkpart rootfs ${parttype[$ROOTFS_TYPE]} ${rootstart}s "100%"
- # transpose so BIOS is in sda14; EFI is in sda15 and root in sda1; requires sgdisk, parted cant do numbers
- run_host_command_logged sgdisk --transpose 1:14 ${SDCARD}.raw
- run_host_command_logged sgdisk --transpose 2:15 ${SDCARD}.raw
- run_host_command_logged sgdisk --transpose 3:1 ${SDCARD}.raw
- # set the ESP (efi) flag on 15
- run_host_command_logged parted -s ${SDCARD}.raw -- set 14 bios_grub on
- run_host_command_logged parted -s ${SDCARD}.raw -- set 15 esp on
- else
- display_alert "Creating partitions" "UEFI+rootfs (no BIOS)" "info"
- # Simple EFI + root partition on GPT, no BIOS.
- run_host_command_logged parted -s ${SDCARD}.raw -- mkpart efi fat32 ${bootstart}s ${bootend}s
- run_host_command_logged parted -s ${SDCARD}.raw -- mkpart rootfs ${parttype[$ROOTFS_TYPE]} ${rootstart}s "100%"
- # transpose so EFI is in sda15 and root in sda1; requires sgdisk, parted cant do numbers
- run_host_command_logged sgdisk --transpose 1:15 ${SDCARD}.raw
- run_host_command_logged sgdisk --transpose 2:1 ${SDCARD}.raw
- # set the ESP (efi) flag on 15
- run_host_command_logged parted -s ${SDCARD}.raw -- set 15 esp on
- fi
- else
- run_host_command_logged parted -s ${SDCARD}.raw -- mkpart primary fat32 ${bootstart}s ${bootend}s
- run_host_command_logged parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$ROOTFS_TYPE]} ${rootstart}s "100%"
- fi
- elif [[ $BOOTSIZE == 0 ]]; then
- # single root partition
- run_host_command_logged parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$ROOTFS_TYPE]} ${rootstart}s "100%"
else
- # /boot partition + root partition
- run_host_command_logged parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$bootfs]} ${bootstart}s ${bootend}s
- run_host_command_logged parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$ROOTFS_TYPE]} ${rootstart}s "100%"
+ {
+ [[ "$IMAGE_PARTITION_TABLE" == "msdos" ]] && echo "label: dos" || echo "label: $IMAGE_PARTITION_TABLE"
+
+ local next=$OFFSET
+ if [[ -n "$biospart" ]]; then
+ # gpt: BIOS boot
+ local type="21686148-6449-6E6F-744E-656564454649"
+ echo "$biospart : name=\"bios\", start=${next}MiB, size=${BIOSSIZE}MiB, type=${type}"
+ local next=$(($next + $BIOSSIZE))
+ fi
+ if [[ -n "$uefipart" ]]; then
+ # dos: EFI (FAT-12/16/32)
+ # gpt: EFI System
+ [[ "$IMAGE_PARTITION_TABLE" != "gpt" ]] && local type="ef" || local type="C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
+ echo "$uefipart : name=\"efi\", start=${next}MiB, size=${UEFISIZE}MiB, type=${type}"
+ local next=$(($next + $UEFISIZE))
+ fi
+ if [[ -n "$bootpart" ]]; then
+ # Linux extended boot
+ [[ "$IMAGE_PARTITION_TABLE" != "gpt" ]] && local type="ea" || local type="BC13C2FF-59E6-4262-A352-B275FD6F7172"
+ if [[ -n "$rootpart" ]]; then
+ echo "$bootpart : name=\"bootfs\", start=${next}MiB, size=${BOOTSIZE}MiB, type=${type}"
+ local next=$(($next + $BOOTSIZE))
+ else
+ # no `size` argument mean "as much as possible"
+ echo "$bootpart : name=\"bootfs\", start=${next}MiB, type=${type}"
+ fi
+ fi
+ if [[ -n "$rootpart" ]]; then
+ # dos: Linux
+ # gpt: Linux filesystem
+ [[ "$IMAGE_PARTITION_TABLE" != "gpt" ]] && local type="83" || local type="0FC63DAF-8483-4772-8E79-3D69D8477DE4"
+ # no `size` argument mean "as much as possible"
+ echo "$rootpart : name=\"rootfs\", start=${next}MiB, type=${type}"
+ fi
+ } |
+ run_host_command_logged sfdisk ${SDCARD}.raw || exit_with_error "Partition fail."
fi
call_extension_method "post_create_partitions" <<- 'POST_CREATE_PARTITIONS'
@@ -281,7 +258,12 @@ function prepare_partitions() {
local rootfs="UUID=$(blkid -s UUID -o value $rootdevice)"
fi
echo "$rootfs / ${mkfs[$ROOTFS_TYPE]} defaults,noatime${mountopts[$ROOTFS_TYPE]} 0 1" >> $SDCARD/etc/fstab
+ else
+ # update_initramfs will fail if /lib/modules/ doesn't exist
+ mount --bind --make-private $SDCARD $MOUNT/
+ echo "/dev/nfs / nfs defaults 0 0" >> $SDCARD/etc/fstab
fi
+
if [[ -n $bootpart ]]; then
display_alert "Creating /boot" "$bootfs on ${LOOP}p${bootpart}"
check_loop_device "${LOOP}p${bootpart}"
@@ -298,7 +280,6 @@ function prepare_partitions() {
run_host_command_logged mount ${LOOP}p${uefipart} "${MOUNT}${UEFI_MOUNT_POINT}"
echo "UUID=$(blkid -s UUID -o value ${LOOP}p${uefipart}) ${UEFI_MOUNT_POINT} vfat defaults 0 2" >> $SDCARD/etc/fstab
fi
- [[ $ROOTFS_TYPE == nfs ]] && echo "/dev/nfs / nfs defaults 0 0" >> $SDCARD/etc/fstab
echo "tmpfs /tmp tmpfs defaults,nosuid 0 0" >> $SDCARD/etc/fstab
call_extension_method "format_partitions" <<- 'FORMAT_PARTITIONS'
diff --git a/lib/functions/image/rootfs-to-image.sh b/lib/functions/image/rootfs-to-image.sh
index 9d128c960..ca8f49a0a 100644
--- a/lib/functions/image/rootfs-to-image.sh
+++ b/lib/functions/image/rootfs-to-image.sh
@@ -75,11 +75,15 @@ create_image_from_sdcard_rootfs() {
Called before unmounting both `/root` and `/boot`.
PRE_UMOUNT_FINAL_IMAGE
+ # Check the partition table after the uboot code has been written
+ display_alert "nPartition table after write_uboot" "$LOOP" "debug"
+ run_host_command_logged sfdisk -l "${LOOP}" # @TODO: use asset..
+
# unmount /boot/efi first, then /boot, rootfs third, image file last
sync
[[ $UEFISIZE != 0 ]] && umount "${MOUNT}${UEFI_MOUNT_POINT}"
[[ $BOOTSIZE != 0 ]] && umount "${MOUNT}/boot"
- [[ $ROOTFS_TYPE != nfs ]] && umount "${MOUNT}"
+ umount "${MOUNT}"
[[ $CRYPTROOT_ENABLE == yes ]] && cryptsetup luksClose $ROOT_MAPPER
umount_chroot_recursive "${MOUNT}" # @TODO: wait. NFS is not really unmounted above.
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index 6f0823648..ba5516768 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -108,6 +108,13 @@ function main_default_build_single() {
fi
fi
+ # Compile plymouth-theme-armbian if packed .deb does not exist or use the one from repository
+ if [[ ! -f ${DEB_STORAGE}/plymouth-theme-armbian_${REVISION}_all.deb ]]; then
+ if [[ "${REPOSITORY_INSTALL}" != *plymouth-theme-armbian* ]]; then
+ compile_plymouth-theme-armbian
+ fi
+ fi
+
# Compile armbian-firmware if packed .deb does not exist or use the one from repository
if ! ls "${DEB_STORAGE}/armbian-firmware_${REVISION}_all.deb" 1> /dev/null 2>&1 || ! ls "${DEB_STORAGE}/armbian-firmware-full_${REVISION}_all.deb" 1> /dev/null 2>&1; then
diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh
index 4ebe8f03f..3ed167b43 100644
--- a/lib/functions/rootfs/create-cache.sh
+++ b/lib/functions/rootfs/create-cache.sh
@@ -1,11 +1,5 @@
# this gets from cache or produces a new rootfs, and leaves a mounted chroot "$SDCARD" at the end.
get_or_create_rootfs_cache_chroot_sdcard() {
- if [[ "$ROOT_FS_CREATE_ONLY" == "yes" ]]; then
- local cycles=1
- else
- local cycles=3
- fi
-
# @TODO: this was moved from configuration to this stage, that way configuration can be offline
# if variable not provided, check which is current version in the cache storage in GitHub.
if [[ -z "${ROOTFSCACHE_VERSION}" ]]; then
@@ -15,67 +9,60 @@ get_or_create_rootfs_cache_chroot_sdcard() {
ROOTFSCACHE_VERSION=${ROOTFSCACHE_VERSION:-$(curl -L --silent https://cache.armbian.com/rootfs/latest --fail)}
fi
- INITIAL_ROOTFSCACHE_VERSION=$ROOTFSCACHE_VERSION
+ local packages_hash=$(get_package_list_hash)
+ local packages_hash=${packages_hash:0:8}
- # seek last cache, proceed to previous otherwise build it
- for ((n = 0; n < cycles; n++)); do
+ local cache_type="cli"
+ [[ ${BUILD_DESKTOP} == yes ]] && local cache_type="xfce-desktop"
+ [[ -n ${DESKTOP_ENVIRONMENT} ]] && local cache_type="${DESKTOP_ENVIRONMENT}"
+ [[ ${BUILD_MINIMAL} == yes ]] && local cache_type="minimal"
- ROOTFSCACHE_VERSION=$(expr $INITIAL_ROOTFSCACHE_VERSION - $n)
- ROOTFSCACHE_VERSION=$(printf "%04d\n" ${ROOTFSCACHE_VERSION})
+ # seek last cache, proceed to previous otherwise build it
+ local cache_list
+ readarray -t cache_list <<< "$(get_rootfs_cache_list "$cache_type" "$packages_hash" | sort -r)"
+ for ROOTFSCACHE_VERSION in "${cache_list[@]}"; do
- local packages_hash=$(get_package_list_hash "$ROOTFSCACHE_VERSION")
- local cache_type="cli"
- [[ ${BUILD_DESKTOP} == yes ]] && local cache_type="xfce-desktop"
- [[ -n ${DESKTOP_ENVIRONMENT} ]] && local cache_type="${DESKTOP_ENVIRONMENT}"
- [[ ${BUILD_MINIMAL} == yes ]] && local cache_type="minimal"
- local cache_name=${RELEASE}-${cache_type}-${ARCH}.$packages_hash.tar.zst
+ local cache_name=${ARCH}-${RELEASE}-${cache_type}-${packages_hash}-${ROOTFSCACHE_VERSION}.tar.zst
local cache_fname=${SRC}/cache/rootfs/${cache_name}
- local display_name=${RELEASE}-${cache_type}-${ARCH}.${packages_hash:0:3}...${packages_hash:29}.tar.zst
[[ "$ROOT_FS_CREATE_ONLY" == yes ]] && break
- if [[ -f ${cache_fname} && -f ${cache_fname}.aria2 ]]; then
- rm ${cache_fname}*
- display_alert "Partially downloaded file. Re-start."
- download_and_verify "_rootfs" "$cache_name"
- fi
-
- display_alert "Checking local cache" "$display_name" "info"
-
- if [[ -f $cache_fname ]]; then
- break
- else
- display_alert "searching on servers"
- download_and_verify "_rootfs" "$cache_name"
- [[ -f ${cache_fname} ]] && break
- fi
+ display_alert "Checking cache" "$cache_name" "info"
- if [[ ! -f $cache_fname ]]; then
- display_alert "not found: try to use previous cache"
+ # if aria2 file exists download didn't succeeded
+ if [[ ! -f $cache_fname || -f ${cache_fname}.aria2 ]]; then
+ display_alert "Downloading from servers"
+ download_and_verify "rootfs" "$cache_name" ||
+ continue
fi
+ [[ -f $cache_fname && ! -f ${cache_fname}.aria2 ]] && break
done
- # check if cache exists and we want to make it
- if [[ -f ${cache_fname} && "$ROOT_FS_CREATE_ONLY" == "yes" ]]; then
- display_alert "Checking cache integrity" "$display_name" "info"
- zstd -tqq ${cache_fname} || {
- rm $cache_fname
- exit_with_error "Cache $cache_fname is corrupted and was deleted. Please restart!"
- }
- fi
+ ##PRESERVE## # check if cache exists and we want to make it
+ ##PRESERVE## if [[ -f ${cache_fname} && "$ROOT_FS_CREATE_ONLY" == "yes" ]]; then
+ ##PRESERVE## display_alert "Checking cache integrity" "$display_name" "info"
+ ##PRESERVE## zstd -tqq ${cache_fname} || {
+ ##PRESERVE## rm $cache_fname
+ ##PRESERVE## exit_with_error "Cache $cache_fname is corrupted and was deleted. Please restart!"
+ ##PRESERVE## }
+ ##PRESERVE## fi
# if aria2 file exists download didn't succeeded
- if [[ -f $cache_fname && ! -f $cache_fname.aria2 ]]; then
+ if [[ "$ROOT_FS_CREATE_ONLY" != "yes" && -f $cache_fname && ! -f $cache_fname.aria2 ]]; then
local date_diff=$((($(date +%s) - $(stat -c %Y $cache_fname)) / 86400))
- display_alert "Extracting $display_name" "$date_diff days old" "info"
- pv -p -b -r -c -N "$(logging_echo_prefix_for_pv "extract_rootfs") $display_name" "$cache_fname" | zstdmt -dc | tar xp --xattrs -C $SDCARD/
+ display_alert "Extracting $cache_name" "$date_diff days old" "info"
+ pv -p -b -r -c -N "$(logging_echo_prefix_for_pv "extract_rootfs") $cache_name" "$cache_fname" | zstdmt -dc | tar xp --xattrs -C $SDCARD/
[[ $? -ne 0 ]] && rm $cache_fname && exit_with_error "Cache $cache_fname is corrupted and was deleted. Restart."
rm $SDCARD/etc/resolv.conf
echo "nameserver $NAMESERVER" >> $SDCARD/etc/resolv.conf
create_sources_list "$RELEASE" "$SDCARD/"
else
+ local ROOT_FS_CREATE_VERSION=${ROOT_FS_CREATE_VERSION:-$(date --utc +"%Y%m%d")}
+ local cache_name=${ARCH}-${RELEASE}-${cache_type}-${packages_hash}-${ROOT_FS_CREATE_VERSION}.tar.zst
+ local cache_fname=${SRC}/cache/rootfs/${cache_name}
+
display_alert "Creating new rootfs cache for" "$RELEASE" "info"
create_new_rootfs_cache
@@ -216,7 +203,7 @@ function create_new_rootfs_cache() {
fi
# stage: check md5 sum of installed packages. Just in case.
- display_alert "Check MD5 sum of installed packages" "info"
+ display_alert "Checking MD5 sum of installed packages" "debsums" "info"
export if_error_detail_message="Check MD5 sum of installed packages failed"
# shellcheck disable=SC2154 # this '$' and '\n' syntax is for dpkg-query
chroot_sdcard dpkg-query -f '"${binary:Package}\n"' -W "|" xargs debsums --silent || true # @TODO: ignore result for now until we can find all the divergences
@@ -242,7 +229,7 @@ function create_new_rootfs_cache() {
display_alert "Mount point" "$(echo -e "$freespace" | grep $MOUNT | head -1 | awk '{print $5}')" "info"
# create list of installed packages for debug purposes - this captures it's own stdout.
- chroot "${SDCARD}" /bin/bash -c "dpkg --get-selections" | grep -v deinstall | awk '{print $1}' | cut -f1 -d':' > "${cache_fname}.list"
+ chroot "${SDCARD}" /bin/bash -c "dpkg -l | grep ^ii | awk '{ print \$2\",\"\$3 }' > '${cache_fname}.list'"
# creating xapian index that synaptic runs faster
if [[ $BUILD_DESKTOP == yes ]]; then
@@ -262,7 +249,7 @@ function create_new_rootfs_cache() {
umount_chroot "$SDCARD"
tar cp --xattrs --directory=$SDCARD/ --exclude='./dev/*' --exclude='./proc/*' --exclude='./run/*' --exclude='./tmp/*' \
- --exclude='./sys/*' --exclude='./home/*' --exclude='./root/*' . | pv -p -b -r -s "$(du -sb $SDCARD/ | cut -f1)" -N "$(logging_echo_prefix_for_pv "store_rootfs") $display_name" | zstdmt -5 -c > "${cache_fname}"
+ --exclude='./sys/*' --exclude='./home/*' --exclude='./root/*' . | pv -p -b -r -s "$(du -sb $SDCARD/ | cut -f1)" -N "$(logging_echo_prefix_for_pv "store_rootfs") $cache_name" | zstdmt -5 -c > "${cache_fname}"
# sign rootfs cache archive that it can be used for web cache once. Internal purposes
if [[ -n "${GPG_PASS}" && "${SUDO_USER}" ]]; then
@@ -270,23 +257,43 @@ function create_new_rootfs_cache() {
echo "${GPG_PASS}" | sudo -H -u ${SUDO_USER} bash -c "gpg --passphrase-fd 0 --armor --detach-sign --pinentry-mode loopback --batch --yes ${cache_fname}" || exit 1
fi
+ # needed for backend to keep current only
+ echo "$cache_fname" > $cache_fname.current
+
return 0 # protect against possible future short-circuiting above this
}
# get_package_list_hash
#
# returns md5 hash for current package list and rootfs cache version
-get_package_list_hash() {
+get_package_list_hash()
+{
local package_arr exclude_arr
local list_content
read -ra package_arr <<< "${DEBOOTSTRAP_LIST} ${PACKAGE_LIST}"
read -ra exclude_arr <<< "${PACKAGE_LIST_EXCLUDE}"
(
- (
- printf "%s\n" "${package_arr[@]}"
- printf -- "-%s\n" "${exclude_arr[@]}"
- ) | sort -u
- echo "${1}"
- ) |
- md5sum | cut -d' ' -f 1
+ printf "%s\n" "${package_arr[@]}"
+ printf -- "-%s\n" "${exclude_arr[@]}"
+ ) | sort -u | md5sum | cut -d' ' -f 1
+}
+
+# get_rootfs_cache_list <cache_type> <packages_hash>
+#
+# return a list of versions of all avaiable cache from remote and local.
+get_rootfs_cache_list() {
+ local cache_type=$1
+ local packages_hash=$2
+
+ {
+ # Temportally disable Github API because we don't support to download from it
+ # curl --silent --fail -L "https://api.github.com/repos/armbian/cache/releases?per_page=3" | jq -r '.[].tag_name' \
+ # || curl --silent --fail -L https://cache.armbian.com/rootfs/list
+ curl --silent --fail -L https://cache.armbian.com/rootfs/list
+
+ find ${SRC}/cache/rootfs/ -mtime -7 -name "${ARCH}-${RELEASE}-${cache_type}-${packages_hash}-*.tar.zst" |
+ sed -e 's#^.*/##' |
+ sed -e 's#\..*$##' |
+ awk -F'-' '{print $5}'
+ } | sort | uniq
}
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index 9844d0b39..1c9a0d2f8 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -395,6 +395,15 @@ function install_distribution_agnostic() {
fi
fi
+ # install plymouth-theme-armbian
+ if [[ $PLYMOUTH == yes ]]; then
+ if [[ "${REPOSITORY_INSTALL}" != *plymouth-theme-armbian* ]]; then
+ install_deb_chroot "${DEB_STORAGE}/armbian-plymouth-theme_${REVISION}_all.deb"
+ else
+ install_deb_chroot "armbian-plymouth-theme" "remote"
+ fi
+ fi
+
# install kernel sources
if [[ -f ${DEB_STORAGE}/${CHOSEN_KSRC}_${REVISION}_all.deb && $INSTALL_KSRC == yes ]]; then
install_deb_chroot "${DEB_STORAGE}/${CHOSEN_KSRC}_${REVISION}_all.deb"
@@ -587,6 +596,18 @@ function install_distribution_agnostic() {
# build logo in any case
boot_logo
+ # Show logo
+ if [[ $PLYMOUTH == yes ]]; then
+ if [[ $BOOT_LOGO == yes || $BOOT_LOGO == desktop && $BUILD_DESKTOP == yes ]]; then
+ [[ -f "${SDCARD}"/boot/armbianEnv.txt ]] && grep -q '^bootlogo' "${SDCARD}"/boot/armbianEnv.txt &&
+ sed -i 's/^bootlogo.*/bootlogo=true/' "${SDCARD}"/boot/armbianEnv.txt ||
+ echo 'bootlogo=true' >> "${SDCARD}"/boot/armbianEnv.txt
+
+ [[ -f "${SDCARD}"/boot/boot.ini ]] &&
+ sed -i 's/^setenv bootlogo.*/setenv bootlogo "true"/' "${SDCARD}"/boot/boot.ini
+ fi
+ fi
+
# disable MOTD for first boot - we want as clean 1st run as possible
chmod -x "${SDCARD}"/etc/update-motd.d/*
diff --git a/lib/functions/rootfs/distro-specific.sh b/lib/functions/rootfs/distro-specific.sh
index 3a0b1ec44..86e452777 100644
--- a/lib/functions/rootfs/distro-specific.sh
+++ b/lib/functions/rootfs/distro-specific.sh
@@ -2,11 +2,10 @@ install_distribution_specific() {
display_alert "Applying distribution specific tweaks for" "$RELEASE" "info"
case $RELEASE in
- buster | sid)
- # remove doubled uname from motd
- [[ -f "${SDCARD}"/etc/update-motd.d/10-uname ]] && rm "${SDCARD}"/etc/update-motd.d/10-uname
- # rc.local is not existing but one might need it
- install_rclocal
+ sid)
+ # (temporally) disable broken service
+ chroot_sdcard "systemctl --no-reload disable smartmontools.service"
+
;;
bullseye)
@@ -23,17 +22,7 @@ install_distribution_specific() {
# by using default lz4 initrd compression leads to corruption, go back to proven method
sed -i "s/^COMPRESS=.*/COMPRESS=gzip/" "${SDCARD}"/etc/initramfs-tools/initramfs.conf
- # cleanup motd services and related files
- chroot "${SDCARD}" /bin/bash -c "systemctl disable motd-news.service >/dev/null 2>&1"
- chroot "${SDCARD}" /bin/bash -c "systemctl disable motd-news.timer >/dev/null 2>&1"
-
- rm -f "${SDCARD}"/etc/update-motd.d/{10-uname,10-help-text,50-motd-news,80-esm,80-livepatch,90-updates-available,91-release-upgrade,95-hwe-eol}
-
- # remove motd news from motd.ubuntu.com
- [[ -f "${SDCARD}"/etc/default/motd-news ]] && sed -i "s/^ENABLED=.*/ENABLED=0/" "${SDCARD}"/etc/default/motd-news
-
- # rc.local is not existing but one might need it
- install_rclocal
+ run_host_command_logged rm -fv "${SDCARD}"/etc/update-motd.d/{10-uname,10-help-text,50-motd-news,80-esm,80-livepatch,90-updates-available,91-release-upgrade,95-hwe-eol}
if [ -d "${SDCARD}"/etc/NetworkManager ]; then
local RENDERER=NetworkManager
@@ -41,13 +30,6 @@ install_distribution_specific() {
local RENDERER=networkd
fi
- # Basic Netplan config. Let NetworkManager/networkd manage all devices on this system
- [[ -d "${SDCARD}"/etc/netplan ]] && cat <<- EOF > "${SDCARD}"/etc/netplan/armbian-default.yaml
- network:
- version: 2
- renderer: $RENDERER
- EOF
-
# DNS fix
if [ -n "$NAMESERVER" ]; then
sed -i "s/#DNS=.*/DNS=$NAMESERVER/g" "${SDCARD}"/etc/systemd/resolved.conf
@@ -67,6 +49,26 @@ install_distribution_specific() {
;;
esac
+ # Basic Netplan config. Let NetworkManager/networkd manage all devices on this system
+ [[ -d "${SDCARD}"/etc/netplan ]] && cat <<- EOF > "${SDCARD}"/etc/netplan/armbian-default.yaml
+ network:
+ version: 2
+ renderer: $RENDERER
+ EOF
+
+ # cleanup motd services and related files
+ chroot_sdcard systemctl disable motd-news.service
+ chroot_sdcard systemctl disable motd-news.timer
+
+ # remove motd news from motd.ubuntu.com
+ [[ -f "${SDCARD}"/etc/default/motd-news ]] && sed -i "s/^ENABLED=.*/ENABLED=0/" "${SDCARD}"/etc/default/motd-news
+
+ # remove doubled uname from motd
+ [[ -f "${SDCARD}"/etc/update-motd.d/10-uname ]] && rm "${SDCARD}"/etc/update-motd.d/10-uname
+
+ # rc.local is not existing but one might need it
+ install_rclocal
+
# use list modules INITRAMFS
if [ -f "${SRC}"/config/modules/"${MODULES_INITRD}" ]; then
display_alert "Use file list modules INITRAMFS" "${MODULES_INITRD}"
From dde4db8ee4d9f984b35f8fb909785622316207a8 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 27 Aug 2022 12:52:47 +0200
Subject: [PATCH] armbian-next: manual merge (28) of lib changes between
revisions af6ceee6c55bd4726139fb8b1ad77641d385515a and
38df56fbf39739b48b31b5e393f15261d053b3cd
---
.../compilation/patch/kernel-bootsplash.sh | 10 +++++++++
lib/functions/compilation/patch/kernel-drivers.sh | 26 ++++++++++++++--------
lib/functions/image/fingerprint.sh | 10 ++++-----
lib/functions/image/partitioning.sh | 2 +-
4 files changed, 33 insertions(+), 15 deletions(-)
diff --git a/lib/functions/compilation/patch/kernel-bootsplash.sh b/lib/functions/compilation/patch/kernel-bootsplash.sh
index c5aff9692..3a366234c 100644
--- a/lib/functions/compilation/patch/kernel-bootsplash.sh
+++ b/lib/functions/compilation/patch/kernel-bootsplash.sh
@@ -2,6 +2,11 @@
# Linux splash file
#
function apply_kernel_patches_for_bootsplash() {
+ # disable it.
+ # todo: cleanup logo generation code and bring in plymouth
+ # @TODO: rpardini: so, can we completely remove this?
+ SKIP_BOOTSPLASH=yes
+
# previously: if linux-version compare "${version}" ge 5.10 && [ $SKIP_BOOTSPLASH != yes ]; then
[[ "${SKIP_BOOTSPLASH}" == "yes" ]] && return 0
linux-version compare "${version}" le 5.10 && return 0
@@ -13,6 +18,11 @@ function apply_kernel_patches_for_bootsplash() {
process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0000-Revert-fbcon-Avoid-cap-set-but-not-used-warning.patch" "applying"
fi
+ if (linux-version compare "${version}" ge 5.18.18 && linux-version compare "${version}" lt 5.19) ||
+ (linux-version compare "${version}" ge 5.15.61 && linux-version compare "${version}" lt 5.16); then
+ process_patch_file "${SRC}/patch/misc/0001-Revert-fbcon-Fix-accelerated-fbdev-scrolling-while-logo-is-still-shown.patch" "applying"
+ fi
+
process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0001-Revert-fbcon-Add-option-to-enable-legacy-hardware-ac.patch" "applying"
if linux-version compare "${version}" ge 5.15; then
diff --git a/lib/functions/compilation/patch/kernel-drivers.sh b/lib/functions/compilation/patch/kernel-drivers.sh
index eec269607..505a3a89e 100644
--- a/lib/functions/compilation/patch/kernel-drivers.sh
+++ b/lib/functions/compilation/patch/kernel-drivers.sh
@@ -139,6 +139,9 @@ function prepare_extra_kernel_drivers() {
sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8189es\/Kconfig"' \
"$kerneldir/drivers/net/wireless/Kconfig"
+ # add support for 5.19.2
+ process_patch_file "${SRC}/patch/misc/wireless-rtl8189es-5.19.2.patch" "applying"
+
fi
# Wireless drivers for Realtek 8189FS chipsets
@@ -172,6 +175,9 @@ function prepare_extra_kernel_drivers() {
sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8189fs\/Kconfig"' \
"$kerneldir/drivers/net/wireless/Kconfig"
+ # add support for 5.19.2
+ process_patch_file "${SRC}/patch/misc/wireless-rtl8189fs-5.19.2.patch" "applying"
+
fi
# Wireless drivers for Realtek 8192EU chipsets
@@ -213,7 +219,7 @@ function prepare_extra_kernel_drivers() {
# @TODO: fasthash for this is... ? remote git hash?
# attach to specifics tag or branch
- local rtl8812auver="branch:v5.6.4.2"
+ local rtl8812auver="commit:41532e3b16dcf27f06e6fe5a26314f3aa24d4f87"
display_alert "Adding" "Wireless drivers for Realtek 8811, 8812, 8814 and 8821 chipsets ${rtl8812auver}" "info"
@@ -237,6 +243,9 @@ function prepare_extra_kernel_drivers() {
sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8812au\/Kconfig"' \
"$kerneldir/drivers/net/wireless/Kconfig"
+ # add support for 5.19.2
+ process_patch_file "${SRC}/patch/misc/wireless-rtl8812au-5.19.2.patch" "applying"
+
fi
# Wireless drivers for Xradio XR819 chipsets
@@ -313,6 +322,9 @@ function prepare_extra_kernel_drivers() {
# add support for 5.18.y
process_patch_file "${SRC}/patch/misc/wireless-rtl8821cu.patch" "applying"
+ # add support for 5.19.2
+ process_patch_file "${SRC}/patch/misc/wireless-rtl8811cu-5.19.2.patch" "applying"
+
fi
# Wireless drivers for Realtek 8188EU 8188EUS and 8188ETV chipsets
@@ -365,7 +377,7 @@ function prepare_extra_kernel_drivers() {
# @TODO: fasthash for this is... ? remote git hash?
# attach to specifics tag or branch
- local rtl88x2buver="branch:5.8.7.1_35809.20191129_COEX20191120-7777"
+ local rtl88x2buver="branch:fix-6.0"
display_alert "Adding" "Wireless drivers for Realtek 88x2bu chipsets ${rtl88x2buver}" "info"
@@ -479,6 +491,7 @@ function prepare_extra_kernel_drivers() {
sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8723ds\/Kconfig"' \
"$kerneldir/drivers/net/wireless/Kconfig"
+ process_patch_file "${SRC}/patch/misc/wireless-rtl8723ds-5.19.2.patch" "applying"
fi
# Wireless drivers for Realtek 8723DU chipsets
@@ -486,12 +499,7 @@ function prepare_extra_kernel_drivers() {
if linux-version compare $version ge 5.0 && [ "$EXTRAWIFI" == yes ]; then
# @TODO: fasthash for this is... ? remote git hash?
- # attach to specifics tag or branch
- if linux-version compare $version ge 5.12; then
- local rtl8723duver="branch:v5.13.4"
- else
- local rtl8723duver="branch:master"
- fi
+ local rtl8723duver="branch:master"
display_alert "Adding" "Wireless drivers for Realtek 8723DU chipsets ${rtl8723duver}" "info"
@@ -515,7 +523,7 @@ function prepare_extra_kernel_drivers() {
sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8723du\/Kconfig"' \
$kerneldir/drivers/net/wireless/Kconfig
- process_patch_file "${SRC}/patch/misc/wireless-rtl8723du.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/wireless-rtl8723du-5.19.2.patch" "applying"
fi
# Wireless drivers for Realtek 8822BS chipsets
diff --git a/lib/functions/image/fingerprint.sh b/lib/functions/image/fingerprint.sh
index 6fc7c43fb..bb4fd4c3e 100644
--- a/lib/functions/image/fingerprint.sh
+++ b/lib/functions/image/fingerprint.sh
@@ -27,15 +27,15 @@ fingerprint_image() {
CPU configuration: $CPUMIN - $CPUMAX with $GOVERNOR
--------------------------------------------------------------------------------
Verify GPG signature:
- gpg --verify $2.img.asc
+ gpg --verify $2.img.xz.asc
Verify image file integrity:
- sha256sum --check $2.img.sha
+ sha256sum --check $2.img.xz.sha
- Prepare SD card (four methodes):
- zcat $2.img.gz | pv | dd of=/dev/mmcblkX bs=1M
+ Prepare SD card (four methods):
+ xzcat $2.img.xz | pv | dd of=/dev/mmcblkX bs=1M
dd if=$2.img of=/dev/mmcblkX bs=1M
- balena-etcher $2.img.gz -d /dev/mmcblkX
+ balena-etcher $2.img.xz -d /dev/mmcblkX
balena-etcher $2.img -d /dev/mmcblkX
EOF
fi
diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh
index 2c584ff06..3340db9e9 100644
--- a/lib/functions/image/partitioning.sh
+++ b/lib/functions/image/partitioning.sh
@@ -74,7 +74,7 @@ function prepare_partitions() {
UEFI_MOUNT_POINT=${UEFI_MOUNT_POINT:-/boot/efi}
UEFI_FS_LABEL="${UEFI_FS_LABEL:-ARMBIEFI}" # Should be always uppercase
ROOT_FS_LABEL="${ROOT_FS_LABEL:-armbian_root}"
- BOOT_FS_LABEL="${BOOT_FS_LABEL:-armbian_boot}"
+ BOOT_FS_LABEL="${BOOT_FS_LABEL:-armbianboot}"
call_extension_method "pre_prepare_partitions" "prepare_partitions_custom" <<- 'PRE_PREPARE_PARTITIONS'
*allow custom options for mkfs*
From 0ae75757f23941e025ed29dae1aacf44cd2249ac Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 27 Aug 2022 12:41:42 +0200
Subject: [PATCH] armbian-next: manual merge (28) of sources/families changes
between revisions af6ceee6c55bd4726139fb8b1ad77641d385515a and
38df56fbf39739b48b31b5e393f15261d053b3cd
---
config/sources/families/include/meson_common.inc | 54 ++++++++++++------------
config/sources/families/media.conf | 1 +
config/sources/families/odroidxu4.conf | 4 +-
3 files changed, 30 insertions(+), 29 deletions(-)
diff --git a/config/sources/families/include/meson_common.inc b/config/sources/families/include/meson_common.inc
index 6600b199a..ee515aaaf 100644
--- a/config/sources/families/include/meson_common.inc
+++ b/config/sources/families/include/meson_common.inc
@@ -1,23 +1,36 @@
ARCH=armhf
-BOOTSOURCE='https://github.com/hardkernel/u-boot.git'
-BOOTBRANCH='branch:odroidc-v2011.03'
-BOOTDIR='u-boot-odroidc1'
-UBOOT_COMPILER="arm-linux-gnueabihf-"
-UBOOT_USE_GCC='< 4.9'
-SERIALCON="ttyAML0"
-UBOOT_TARGET_MAP=';;sd_fuse/bl1.bin.hardkernel sd_fuse/u-boot.bin'
-SRC_LOADADDR='LOADADDR=0x00208000'
-KERNEL_IMAGE_TYPE=uImage
LINUXFAMILY=meson
+KERNEL_IMAGE_TYPE=uImage
+SRC_LOADADDR='LOADADDR=0x00208000'
+
+SERIALCON="ttyAML0"
+
CPUMIN=504000
CPUMAX=1632000
GOVERNOR=ondemand
+SKIP_BOOTSPLASH="yes"
+
+case $BOARD in
+ odroidc1)
+
+ BOOTDIR='u-boot-odroidc1'
+ BOOTSOURCE='https://github.com/hardkernel/u-boot.git'
+ BOOTBRANCH='branch:odroidc-v2011.03'
+
+ UBOOT_COMPILER="arm-linux-gnueabihf-"
+ UBOOT_USE_GCC='< 4.9'
+
+ UBOOT_TARGET_MAP=';;sd_fuse/bl1.bin.hardkernel sd_fuse/u-boot.bin'
+
+ ;;
+esac
+
case $BRANCH in
legacy)
- export KERNEL_MAJOR_MINOR="5.11" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.11.y"
+ export KERNEL_MAJOR_MINOR="5.10" # Major and minor versions of this kernel.
+ KERNELBRANCH="branch:linux-5.10.y"
KERNELPATCHDIR='meson-'$BRANCH
BUILD_DESKTOP=no
@@ -25,8 +38,8 @@ case $BRANCH in
;;
current)
- export KERNEL_MAJOR_MINOR="5.14" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.14.y"
+ export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
+ KERNELBRANCH="branch:linux-5.15.y"
KERNELPATCHDIR='meson-'$BRANCH
BUILD_DESKTOP=no
@@ -37,25 +50,12 @@ case $BRANCH in
KERNELDIR='linux-meson'
KERNELSOURCE='https://github.com/xdarklight/linux'
export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:meson-mx-integration-5.18-20220417"
+ KERNELBRANCH="branch:meson-mx-integration-5.18-20220516"
KERNELPATCHDIR='meson-'$BRANCH
;;
esac
-case $BOARD in
- odroidc1)
-
- BOOTSCRIPT="boot-odroid-c1.ini:boot.ini"
-
- ;;
- onecloud)
-
- BOOTSCRIPT="boot-onecloud.cmd:boot.cmd"
-
- ;;
-esac
-
write_uboot_platform() {
dd if=$1/bl1.bin.hardkernel of=$2 bs=1 count=442 conv=fsync > /dev/null 2>&1
dd if=$1/bl1.bin.hardkernel of=$2 bs=512 skip=1 seek=1 conv=fsync > /dev/null 2>&1
diff --git a/config/sources/families/media.conf b/config/sources/families/media.conf
index 0355128ca..eb2711377 100644
--- a/config/sources/families/media.conf
+++ b/config/sources/families/media.conf
@@ -62,6 +62,7 @@ case $BRANCH in
export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
KERNELBRANCH="branch:linux-5.18.y"
LINUXCONFIG='linux-media-'$BRANCH
+ SKIP_BOOTSPLASH="yes"
if [[ $BOARD == station-p2 || $BOARD == station-m2 || $BOARD == quartz64a || $BOARD == bananapir2pro ]]; then
KERNELPATCHDIR='station-p2-'$BRANCH
diff --git a/config/sources/families/odroidxu4.conf b/config/sources/families/odroidxu4.conf
index 75916a25b..1fac905f6 100644
--- a/config/sources/families/odroidxu4.conf
+++ b/config/sources/families/odroidxu4.conf
@@ -26,8 +26,8 @@ case $BRANCH in
edge)
KERNELSOURCE='https://github.com/tobetter/linux'
- export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
- KERNELBRANCH='branch:odroid-5.18.y'
+ export KERNEL_MAJOR_MINOR="5.19" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:odroid-5.19.y'
KERNELDIR='linux-odroidxu4'
;;
From e3e84f5c72e34013ea09dbd556c30870017b43a8 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 13 Aug 2022 13:53:57 +0200
Subject: [PATCH] armbian-next: manual merge (27) of `lib` changes between
revisions 9c52562176390624d33c93634e63a8f91cc0815b and
af6ceee6c55bd4726139fb8b1ad77641d385515a
---
lib/functions/bsp/bsp-cli.sh | 5 +-
.../compilation/patch/kernel-bootsplash.sh | 1 +
lib/functions/compilation/patch/kernel-drivers.sh | 6 +-
lib/functions/general/cleaning.sh | 2 +-
lib/functions/general/downloads.sh | 10 ++-
lib/functions/image/partitioning.sh | 20 ++++--
lib/functions/main/rootfs-image.sh | 2 +-
lib/functions/rootfs/create-cache.sh | 75 +++++++++-------------
lib/functions/rootfs/distro-agnostic.sh | 2 +-
9 files changed, 64 insertions(+), 59 deletions(-)
diff --git a/lib/functions/bsp/bsp-cli.sh b/lib/functions/bsp/bsp-cli.sh
index a20ea1e57..62fa5cfd1 100644
--- a/lib/functions/bsp/bsp-cli.sh
+++ b/lib/functions/bsp/bsp-cli.sh
@@ -12,7 +12,7 @@ create_board_package() {
copy_all_packages_files_for "bsp-cli"
# install copy of boot script & environment file
- if [[ "${BOOTCONFIG}" != "none" ]]; then
+ if [[ -z "${BOOTSCRIPT}" ]]; then # @TODO: used to be: if [[ "${BOOTCONFIG}" != "none" ]]; then
# @TODO: add extension method bsp_prepare_bootloader(), refactor into u-boot extension
local bootscript_src=${BOOTSCRIPT%%:*}
local bootscript_dst=${BOOTSCRIPT##*:}
@@ -29,8 +29,9 @@ create_board_package() {
else
run_host_command_logged cp -pv "${SRC}/config/bootscripts/${bootscript_src}" "${destination}/usr/share/armbian/${bootscript_dst}"
fi
- [[ -n $BOOTENV_FILE && -f $SRC/config/bootenv/$BOOTENV_FILE ]] &&
+ if [[ -n $BOOTENV_FILE && -f $SRC/config/bootenv/$BOOTENV_FILE ]]; then
run_host_command_logged cp -pv "${SRC}/config/bootenv/${BOOTENV_FILE}" "${destination}"/usr/share/armbian/armbianEnv.txt
+ fi
else
display_alert "Using extlinux, regular bootscripts ignored" "SRC_EXTLINUX=${SRC_EXTLINUX}" "warn"
fi
diff --git a/lib/functions/compilation/patch/kernel-bootsplash.sh b/lib/functions/compilation/patch/kernel-bootsplash.sh
index cbd929513..c5aff9692 100644
--- a/lib/functions/compilation/patch/kernel-bootsplash.sh
+++ b/lib/functions/compilation/patch/kernel-bootsplash.sh
@@ -5,6 +5,7 @@ function apply_kernel_patches_for_bootsplash() {
# previously: if linux-version compare "${version}" ge 5.10 && [ $SKIP_BOOTSPLASH != yes ]; then
[[ "${SKIP_BOOTSPLASH}" == "yes" ]] && return 0
linux-version compare "${version}" le 5.10 && return 0
+ linux-version compare "${version}" lt 5.19 && return 0
display_alert "Adding" "Kernel bootsplash patch" "info"
diff --git a/lib/functions/compilation/patch/kernel-drivers.sh b/lib/functions/compilation/patch/kernel-drivers.sh
index 9df0b81ca..eec269607 100644
--- a/lib/functions/compilation/patch/kernel-drivers.sh
+++ b/lib/functions/compilation/patch/kernel-drivers.sh
@@ -31,7 +31,7 @@ function prepare_extra_kernel_drivers() {
#
# Older versions have AUFS support with a patch
- if linux-version compare "${version}" gt 5.11 && linux-version compare "${version}" lt 5.19 && [ "$AUFS" == yes ]; then
+ if linux-version compare "${version}" gt 5.11 && linux-version compare "${version}" lt 5.20 && [ "$AUFS" == yes ]; then
# attach to specifics tag or branch
local aufstag
aufstag=$(echo "${version}" | cut -f 1-2 -d ".")
@@ -240,8 +240,8 @@ function prepare_extra_kernel_drivers() {
fi
# Wireless drivers for Xradio XR819 chipsets
- if linux-version compare "${version}" ge 4.19 && [[ "$LINUXFAMILY" == sunxi* ]] && [[ "$EXTRAWIFI" == yes ]]; then
- # @TODO: fasthash for this is... ? remote git hash?
+ if linux-version compare "${version}" ge 4.19 && linux-version compare "${version}" le 5.19 &&
+ [[ "$LINUXFAMILY" == sunxi* ]] && [[ "$EXTRAWIFI" == yes ]]; then
display_alert "Adding" "Wireless drivers for Xradio XR819 chipsets" "info"
diff --git a/lib/functions/general/cleaning.sh b/lib/functions/general/cleaning.sh
index 72a6f4b1f..833ac4ce7 100644
--- a/lib/functions/general/cleaning.sh
+++ b/lib/functions/general/cleaning.sh
@@ -65,7 +65,7 @@ general_cleaning() {
;;
oldcache) # remove old `cache/rootfs` except for the newest 8 files
- if [[ -d "${SRC}"/cache/rootfs && $(ls -1 "${SRC}"/cache/rootfs/*.lz4 2> /dev/null | wc -l) -gt "${ROOTFS_CACHE_MAX}" ]]; then
+ if [[ -d "${SRC}"/cache/rootfs && $(ls -1 "${SRC}"/cache/rootfs/*.zst* 2> /dev/null | wc -l) -gt "${ROOTFS_CACHE_MAX}" ]]; then
display_alert "Cleaning" "rootfs cache (old)" "info"
(
cd "${SRC}"/cache/rootfs
diff --git a/lib/functions/general/downloads.sh b/lib/functions/general/downloads.sh
index 97afb81a4..5bbd161fe 100644
--- a/lib/functions/general/downloads.sh
+++ b/lib/functions/general/downloads.sh
@@ -4,7 +4,7 @@ function webseed() {
unset text
local CCODE=$(curl -s redirect.armbian.com/geoip | jq '.continent.code' -r)
- if [[ "$2" == "rootfs" ]]; then
+ if [[ "$2" == rootfs* ]]; then
WEBSEED=($(curl -s ${1}mirrors | jq -r '.'${CCODE}' | .[] | values'))
else
WEBSEED=($(curl -s https://redirect.armbian.com/mirrors | jq -r '.'${CCODE}' | .[] | values'))
@@ -67,6 +67,12 @@ function download_and_verify_internal() {
return 0
fi
+ # rootfs has its own infra
+ if [[ "${remotedir}" == "_rootfs" ]]; then
+ local server="https://cache.armbian.com/"
+ remotedir="rootfs/$ROOTFSCACHE_VERSION"
+ fi
+
# switch to china mirror if US timeouts
timeout 10 curl --head --fail --silent "${server}${remotedir}/${filename}"
if [[ $? -ne 7 && $? -ne 22 && $? -ne 0 ]]; then
@@ -124,7 +130,7 @@ function download_and_verify_internal() {
if [[ ! -f "${localdir}/${filename}.complete" ]]; then
if [[ ! $(timeout 10 curl --head --fail --silent ${server}${remotedir}/${filename} 2>&1 > /dev/null) ]]; then
display_alert "downloading from $(echo $server | cut -d'/' -f3 | cut -d':' -f1) using http(s) network" "$filename"
- run_host_command_logged aria2c --download-result=hide --rpc-save-upload-metadata=false --console-log-level=error \
+ run_host_command_logged aria2c --allow-overwrite=true --download-result=hide --rpc-save-upload-metadata=false --console-log-level=error \
--dht-file-path="${SRC}"/cache/.aria2/dht.dat --disable-ipv6=${DISABLE_IPV6} --summary-interval=0 --auto-file-renaming=false --dir="${localdir}" ${server}${remotedir}/${filename} $(webseed "${remotedir}/${filename}") -o "${filename}"
# mark complete
[[ $? -eq 0 ]] && touch "${localdir}/${filename}.complete" && echo ""
diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh
index 471050a30..2c584ff06 100644
--- a/lib/functions/image/partitioning.sh
+++ b/lib/functions/image/partitioning.sh
@@ -18,7 +18,7 @@ function prepare_partitions() {
# array copying in old bash versions is tricky, so having filesystems as arrays
# with attributes as keys is not a good idea
- declare -A parttype mkopts mkfs mountopts
+ declare -A parttype mkopts mkopts_label mkfs mountopts
parttype[ext4]=ext4
parttype[ext2]=ext2
@@ -35,13 +35,21 @@ function prepare_partitions() {
if [[ $HOSTRELEASE =~ buster|bullseye|focal|jammy|sid ]]; then
mkopts[ext4]="-q -m 2 -O ^64bit,^metadata_csum -N $((128 * node_number))"
fi
- mkopts[fat]='-n BOOT'
+ # mkopts[fat] is empty
mkopts[ext2]='-q'
# mkopts[f2fs] is empty
mkopts[btrfs]='-m dup'
# mkopts[xfs] is empty
# mkopts[nfs] is empty
+ mkopts_label[ext4]='-L '
+ mkopts_label[ext2]='-L '
+ mkopts_label[fat]='-n '
+ mkopts_label[f2fs]='-l '
+ mkopts_label[btrfs]='-L '
+ mkopts_label[xfs]='-L '
+ # mkopts_label[nfs] is empty
+
mkfs[ext4]=ext4
mkfs[ext2]=ext2
mkfs[fat]=vfat
@@ -65,6 +73,8 @@ function prepare_partitions() {
BIOSSIZE=${BIOSSIZE:-0}
UEFI_MOUNT_POINT=${UEFI_MOUNT_POINT:-/boot/efi}
UEFI_FS_LABEL="${UEFI_FS_LABEL:-ARMBIEFI}" # Should be always uppercase
+ ROOT_FS_LABEL="${ROOT_FS_LABEL:-armbian_root}"
+ BOOT_FS_LABEL="${BOOT_FS_LABEL:-armbian_boot}"
call_extension_method "pre_prepare_partitions" "prepare_partitions_custom" <<- 'PRE_PREPARE_PARTITIONS'
*allow custom options for mkfs*
@@ -230,7 +240,7 @@ function prepare_partitions() {
check_loop_device "$LOOP"
- run_host_command_logged losetup -P $LOOP ${SDCARD}.raw
+ run_host_command_logged losetup $LOOP ${SDCARD}.raw # @TODO: had a '-P- here, what was it?
# loop device was grabbed here, unlock
flock -u $FD
@@ -254,7 +264,7 @@ function prepare_partitions() {
check_loop_device "$rootdevice"
display_alert "Creating rootfs" "$ROOTFS_TYPE on $rootdevice"
- run_host_command_logged mkfs.${mkfs[$ROOTFS_TYPE]} "${mkopts[$ROOTFS_TYPE]}" "$rootdevice"
+ run_host_command_logged mkfs.${mkfs[$ROOTFS_TYPE]} ${mkopts[$ROOTFS_TYPE]} ${mkopts_label[$ROOTFS_TYPE]:+${mkopts_label[$ROOTFS_TYPE]}"$ROOT_FS_LABEL"} "${rootdevice}"
[[ $ROOTFS_TYPE == ext4 ]] && run_host_command_logged tune2fs -o journal_data_writeback "$rootdevice"
if [[ $ROOTFS_TYPE == btrfs && $BTRFS_COMPRESSION != none ]]; then
local fscreateopt="-o compress-force=${BTRFS_COMPRESSION}"
@@ -275,7 +285,7 @@ function prepare_partitions() {
if [[ -n $bootpart ]]; then
display_alert "Creating /boot" "$bootfs on ${LOOP}p${bootpart}"
check_loop_device "${LOOP}p${bootpart}"
- run_host_command_logged mkfs.${mkfs[$bootfs]} ${mkopts[$bootfs]} ${LOOP}p${bootpart} 2>&1
+ run_host_command_logged mkfs.${mkfs[$bootfs]} ${mkopts[$bootfs]} ${mkopts_label[$bootfs]:+${mkopts_label[$bootfs]}"$BOOT_FS_LABEL"} ${LOOP}p${bootpart}
mkdir -p $MOUNT/boot/
run_host_command_logged mount ${LOOP}p${bootpart} $MOUNT/boot/
echo "UUID=$(blkid -s UUID -o value ${LOOP}p${bootpart}) /boot ${mkfs[$bootfs]} defaults${mountopts[$bootfs]} 0 2" >> $SDCARD/etc/fstab
diff --git a/lib/functions/main/rootfs-image.sh b/lib/functions/main/rootfs-image.sh
index 590ca1f84..dc1c08c16 100644
--- a/lib/functions/main/rootfs-image.sh
+++ b/lib/functions/main/rootfs-image.sh
@@ -9,7 +9,7 @@
# https://github.com/armbian/build/
function build_rootfs_and_image() {
- display_alert "Starting rootfs and image building process for" "${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL}" "info"
+ display_alert "Checking for rootfs cache" "$(echo "${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL}" | tr -s " ")" "info"
[[ $ROOTFS_TYPE != ext4 ]] && display_alert "Assuming ${BOARD} ${BRANCH} kernel supports ${ROOTFS_TYPE}" "" "wrn"
diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh
index 635631232..4ebe8f03f 100644
--- a/lib/functions/rootfs/create-cache.sh
+++ b/lib/functions/rootfs/create-cache.sh
@@ -1,61 +1,48 @@
# this gets from cache or produces a new rootfs, and leaves a mounted chroot "$SDCARD" at the end.
get_or_create_rootfs_cache_chroot_sdcard() {
- if [[ "$ROOT_FS_CREATE_ONLY" == "force" ]]; then
+ if [[ "$ROOT_FS_CREATE_ONLY" == "yes" ]]; then
local cycles=1
else
- local cycles=2
+ local cycles=3
fi
+ # @TODO: this was moved from configuration to this stage, that way configuration can be offline
# if variable not provided, check which is current version in the cache storage in GitHub.
if [[ -z "${ROOTFSCACHE_VERSION}" ]]; then
- display_alert "ROOTFSCACHE_VERSION not set, getting remotely" "https://github.com/armbian/mirror/releases/download/rootfs/rootfscache.version" "debug"
- ROOTFSCACHE_VERSION=$(wget --tries=10 -O - -o /dev/null https://github.com/armbian/mirror/releases/download/rootfs/rootfscache.version || true)
- ROOTFSCACHE_VERSION=${ROOTFSCACHE_VERSION:-"0"}
+ display_alert "ROOTFSCACHE_VERSION not set, getting remotely" "Github API and armbian/mirror " "debug"
+ ROOTFSCACHE_VERSION=$(curl https://api.github.com/repos/armbian/cache/releases/latest -s --fail | jq .tag_name -r || true)
+ # anonymous API access is very limited which is why we need a fallback
+ ROOTFSCACHE_VERSION=${ROOTFSCACHE_VERSION:-$(curl -L --silent https://cache.armbian.com/rootfs/latest --fail)}
fi
+ INITIAL_ROOTFSCACHE_VERSION=$ROOTFSCACHE_VERSION
+
# seek last cache, proceed to previous otherwise build it
for ((n = 0; n < cycles; n++)); do
- FORCED_MONTH_OFFSET=${n}
-
- local packages_hash
- packages_hash=$(get_package_list_hash "$(date -d "$D -${FORCED_MONTH_OFFSET} month" +"%Y-%m-module$ROOTFSCACHE_VERSION" | sed 's/^0*//')")
+ ROOTFSCACHE_VERSION=$(expr $INITIAL_ROOTFSCACHE_VERSION - $n)
+ ROOTFSCACHE_VERSION=$(printf "%04d\n" ${ROOTFSCACHE_VERSION})
+ local packages_hash=$(get_package_list_hash "$ROOTFSCACHE_VERSION")
local cache_type="cli"
- [[ ${BUILD_DESKTOP} == yes ]] && cache_type="xfce-desktop"
- [[ -n ${DESKTOP_ENVIRONMENT} ]] && cache_type="${DESKTOP_ENVIRONMENT}"
- [[ ${BUILD_MINIMAL} == yes ]] && cache_type="minimal"
-
- local cache_name=${RELEASE}-${cache_type}-${ARCH}.${packages_hash}.tar.zst
+ [[ ${BUILD_DESKTOP} == yes ]] && local cache_type="xfce-desktop"
+ [[ -n ${DESKTOP_ENVIRONMENT} ]] && local cache_type="${DESKTOP_ENVIRONMENT}"
+ [[ ${BUILD_MINIMAL} == yes ]] && local cache_type="minimal"
+ local cache_name=${RELEASE}-${cache_type}-${ARCH}.$packages_hash.tar.zst
local cache_fname=${SRC}/cache/rootfs/${cache_name}
local display_name=${RELEASE}-${cache_type}-${ARCH}.${packages_hash:0:3}...${packages_hash:29}.tar.zst
- [[ "$ROOT_FS_CREATE_ONLY" == force ]] && break
+ [[ "$ROOT_FS_CREATE_ONLY" == yes ]] && break
if [[ -f ${cache_fname} && -f ${cache_fname}.aria2 ]]; then
- rm "${cache_fname}"*
+ rm ${cache_fname}*
display_alert "Partially downloaded file. Re-start."
download_and_verify "_rootfs" "$cache_name"
fi
display_alert "Checking local cache" "$display_name" "info"
- if [[ -f ${cache_fname} && -n "$ROOT_FS_CREATE_ONLY" ]]; then
- echo "$cache_fname" > $cache_fname.current
- display_alert "Checking cache integrity" "$display_name" "info"
-
- sudo zstd -tqq "${cache_fname}" || {
- rm -f "${cache_fname}"
- exit_with_error "Cache ${cache_fname} is corrupted and was deleted. Please restart!"
- }
-
- # sign if signature is missing
- if [[ -n "${GPG_PASS}" && "${SUDO_USER}" && ! -f ${cache_fname}.asc ]]; then
- [[ -n ${SUDO_USER} ]] && sudo chown -R ${SUDO_USER}:${SUDO_USER} "${DEST}"/images/
- echo "${GPG_PASS}" | sudo -H -u ${SUDO_USER} bash -c "gpg --passphrase-fd 0 --armor --detach-sign --pinentry-mode loopback --batch --yes ${cache_fname}" || exit 1
- fi
- break
- elif [[ -f ${cache_fname} ]]; then
+ if [[ -f $cache_fname ]]; then
break
else
display_alert "searching on servers"
@@ -69,17 +56,17 @@ get_or_create_rootfs_cache_chroot_sdcard() {
done
- if [[ -f $cache_fname && ! -f $cache_fname.aria2 ]]; then
+ # check if cache exists and we want to make it
+ if [[ -f ${cache_fname} && "$ROOT_FS_CREATE_ONLY" == "yes" ]]; then
+ display_alert "Checking cache integrity" "$display_name" "info"
+ zstd -tqq ${cache_fname} || {
+ rm $cache_fname
+ exit_with_error "Cache $cache_fname is corrupted and was deleted. Please restart!"
+ }
+ fi
- # speed up checking
- if [[ -n "$ROOT_FS_CREATE_ONLY" ]]; then
- echo "$cache_fname" > $cache_fname.current
- umount --lazy "$SDCARD"
- rm -rf $SDCARD
- # remove exit trap
- remove_all_trap_handlers INT TERM EXIT
- exit
- fi
+ # if aria2 file exists download didn't succeeded
+ if [[ -f $cache_fname && ! -f $cache_fname.aria2 ]]; then
local date_diff=$((($(date +%s) - $(stat -c %Y $cache_fname)) / 86400))
display_alert "Extracting $display_name" "$date_diff days old" "info"
@@ -89,7 +76,7 @@ get_or_create_rootfs_cache_chroot_sdcard() {
echo "nameserver $NAMESERVER" >> $SDCARD/etc/resolv.conf
create_sources_list "$RELEASE" "$SDCARD/"
else
- display_alert "... remote not found" "Creating new rootfs cache for $RELEASE" "info"
+ display_alert "Creating new rootfs cache for" "$RELEASE" "info"
create_new_rootfs_cache
@@ -99,7 +86,7 @@ get_or_create_rootfs_cache_chroot_sdcard() {
fi
# used for internal purposes. Faster rootfs cache rebuilding
- if [[ -n "$ROOT_FS_CREATE_ONLY" ]]; then
+ if [[ "$ROOT_FS_CREATE_ONLY" == "yes" ]]; then
umount --lazy "$SDCARD"
rm -rf $SDCARD
# remove exit trap
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index cd3462409..9844d0b39 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -174,7 +174,7 @@ function install_distribution_agnostic() {
fi
else
- if [[ "${BOOTCONFIG}" != "none" ]]; then
+ if [[ -n "${BOOTSCRIPT}" ]]; then # @TODO: this used to check BOOTCONFIG not being 'none'
if [ -f "${USERPATCHES_PATH}/bootscripts/${bootscript_src}" ]; then
run_host_command_logged cp -pv "${USERPATCHES_PATH}/bootscripts/${bootscript_src}" "${SDCARD}/boot/${bootscript_dst}"
else
From d08b0971d93456143e2648b94341fedc5a612049 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 13 Aug 2022 13:24:53 +0200
Subject: [PATCH] armbian-next: manual merge (27) of `sources/families` changes
between revisions 9c52562176390624d33c93634e63a8f91cc0815b and
af6ceee6c55bd4726139fb8b1ad77641d385515a
---
config/sources/families/bcm2711.conf | 4 +--
config/sources/families/imx6.conf | 4 +--
config/sources/families/include/meson64_common.inc | 4 +--
config/sources/families/include/meson_common.inc | 10 +++++++-
.../sources/families/include/rockchip64_common.inc | 30 +++++++++++++++++++---
config/sources/families/include/sunxi64_common.inc | 6 ++---
config/sources/families/include/sunxi_common.inc | 6 ++---
config/sources/families/include/uefi_common.inc | 4 +--
config/sources/families/jethub.conf | 13 +++++-----
config/sources/families/media.conf | 20 ++++++++++++++-
config/sources/families/mvebu64.conf | 4 +--
config/sources/families/rk322x.conf | 4 +--
config/sources/families/rockchip-rk3588.conf | 6 ++---
config/sources/families/rockchip.conf | 4 +--
14 files changed, 83 insertions(+), 36 deletions(-)
diff --git a/config/sources/families/bcm2711.conf b/config/sources/families/bcm2711.conf
index 5ae60578a..d031d7e50 100644
--- a/config/sources/families/bcm2711.conf
+++ b/config/sources/families/bcm2711.conf
@@ -28,8 +28,8 @@ case "${BRANCH}" in
edge)
export RASPI_DISTRO_KERNEL=no
export KERNELSOURCE='https://github.com/raspberrypi/linux'
- export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel. For mainline caching.
- export KERNELBRANCH="branch:rpi-5.18.y"
+ export KERNEL_MAJOR_MINOR="5.19" # Major and minor versions of this kernel. For mainline caching.
+ export KERNELBRANCH="branch:rpi-5.19.y"
export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
;;
diff --git a/config/sources/families/imx6.conf b/config/sources/families/imx6.conf
index 9a7bd9331..843c824f8 100644
--- a/config/sources/families/imx6.conf
+++ b/config/sources/families/imx6.conf
@@ -16,8 +16,8 @@ case $BRANCH in
edge)
- export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
- KERNELBRANCH='branch:linux-5.18.y'
+ export KERNEL_MAJOR_MINOR="5.19" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:linux-5.19.y'
;;
diff --git a/config/sources/families/include/meson64_common.inc b/config/sources/families/include/meson64_common.inc
index d902756e7..2e69f58de 100644
--- a/config/sources/families/include/meson64_common.inc
+++ b/config/sources/families/include/meson64_common.inc
@@ -36,8 +36,8 @@ case $BRANCH in
;;
edge)
- export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel. For mainline caching.
- KERNELBRANCH='branch:linux-5.17.y'
+ export KERNEL_MAJOR_MINOR="5.19" # Major and minor versions of this kernel. For mainline caching.
+ KERNELBRANCH='branch:linux-5.19.y'
KERNELPATCHDIR='meson64-edge'
;;
diff --git a/config/sources/families/include/meson_common.inc b/config/sources/families/include/meson_common.inc
index 5b53ff90c..6600b199a 100644
--- a/config/sources/families/include/meson_common.inc
+++ b/config/sources/families/include/meson_common.inc
@@ -68,5 +68,13 @@ family_tweaks() {
}
family_tweaks_bsp() {
- :
+ mkdir -p "$destination/etc/X11/xorg.conf.d"
+ cat <<- EOF > "$destination/etc/X11/xorg.conf.d/02-driver.conf"
+ Section "OutputClass"
+ Identifier "Amlogic"
+ MatchDriver "meson"
+ Driver "modesetting"
+ Option "PrimaryGPU" "true"
+ EndSection
+ EOF
}
diff --git a/config/sources/families/include/rockchip64_common.inc b/config/sources/families/include/rockchip64_common.inc
index 44d4d22dc..e31b81341 100644
--- a/config/sources/families/include/rockchip64_common.inc
+++ b/config/sources/families/include/rockchip64_common.inc
@@ -88,6 +88,12 @@ elif [[ $BOOT_SOC == rk3568 ]]; then
DDR_BLOB="${DDR_BLOB:=rk35/rk3568_ddr_1560MHz_v1.10.bin}"
BL31_BLOB='rk35/rk3568_bl31_v1.28.elf'
+elif [[ $BOOT_SOC == rk3588 ]]; then
+
+ BOOT_SCENARIO="${BOOT_SCENARIO:=spl-blobs}"
+ DDR_BLOB="${DDR_BLOB:=rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.07.bin}"
+ BL31_BLOB='rk35/rk3588_bl31_v1.25.elf'
+
elif [[ $BOARD == rockpi-s ]]; then
BOOT_SCENARIO="${BOOT_SCENARIO:=only-blobs}"
@@ -117,8 +123,8 @@ case $BRANCH in
edge)
KERNELPATCHDIR='rockchip64-'$BRANCH
- export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.18.y"
+ export KERNEL_MAJOR_MINOR="5.19" # Major and minor versions of this kernel.
+ KERNELBRANCH="branch:linux-5.19.y"
LINUXFAMILY=rockchip64
LINUXCONFIG='linux-rockchip64-'$BRANCH
@@ -162,7 +168,7 @@ prepare_boot_configuration() {
if [[ $BOOT_SUPPORT_SPI == yes ]]; then
- if [[ $BOARD != "rock-3a" ]]; then
+ if [[ $BOARD != "rock-3a" ]] && [[ $BOARD != "rock-5b" ]]; then
UBOOT_TARGET_MAP="BL31=$RKBIN_DIR/$BL31_BLOB tpl/u-boot-tpl.bin spl/u-boot-spl.bin u-boot.itb ${UBOOT_TARGET_MAP} rkspi_loader.img"
else
UBOOT_TARGET_MAP="${UBOOT_TARGET_MAP} rkspi_loader.img"
@@ -193,7 +199,7 @@ uboot_custom_postprocess() {
fi
if [[ $BOOT_SUPPORT_SPI == yes ]]; then
- if [[ $BOARD == "rock-3a" ]]; then
+ if [[ $BOARD == "rock-3a" ]] || [[ $BOARD == "rock-5b" ]]; then
dd if=/dev/zero of=rkspi_loader.img bs=1M count=0 seek=16
/sbin/parted -s rkspi_loader.img mklabel gpt
/sbin/parted -s rkspi_loader.img unit s mkpart idbloader 64 7167
@@ -318,6 +324,22 @@ family_tweaks() {
fi
+ if [[ $BOARD == jetson-nano ]]; then
+ install -m 755 $SRC/packages/blobs/jetson/jetson.sh $SDCARD/etc/initramfs-tools/hooks/jetson.sh
+ if [[ $BRANCH == legacy ]]; then
+ install -m 755 $SRC/packages/blobs/jetson/tegra21x_xusb_firmware $SDCARD/lib/firmware/tegra21x_xusb_firmware
+ install -m 755 $SRC/packages/blobs/jetson/asound.conf.tegrahda $SDCARD/etc/asound.conf.tegrahda
+ install -m 755 $SRC/packages/blobs/jetson/asound.conf.tegrahda $SDCARD/etc/asound.conf
+ install -m 755 $SRC/packages/blobs/jetson/asound.conf.tegrasndt210ref $SDCARD/etc/asound.conf.tegrasndt210ref
+ install -m 755 $SRC/packages/blobs/jetson/tegra-hda.conf $SDCARD/usr/share/alsa/cards/tegra-hda.conf
+ install -m 755 $SRC/packages/blobs/jetson/tegra-snd-t210r.conf $SDCARD/usr/share/alsa/cards/tegra-snd-t210r.conf
+ sed -e 's/exit 0//g' -i $SDCARD/etc/rc.local
+ echo "su -c 'echo 255 > /sys/devices/pwm-fan/target_pwm'" >> $SDCARD/etc/rc.local
+ echo "exit 0" >> $SDCARD/etc/rc.local
+ else
+ cp -R $SRC/packages/blobs/jetson/firmware/* $SDCARD/lib/firmware/
+ fi
+ fi
}
family_tweaks_bsp() {
diff --git a/config/sources/families/include/sunxi64_common.inc b/config/sources/families/include/sunxi64_common.inc
index 299d16253..cb49b4ef0 100644
--- a/config/sources/families/include/sunxi64_common.inc
+++ b/config/sources/families/include/sunxi64_common.inc
@@ -26,9 +26,9 @@ case $BRANCH in
;;
edge)
- export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
- export KERNELBRANCH="branch:linux-5.18.y"
- export KERNELBRANCH_MEGOUS="branch:orange-pi-5.18"
+ export KERNEL_MAJOR_MINOR="5.19" # Major and minor versions of this kernel.
+ export KERNELBRANCH="branch:linux-5.19.y"
+ export KERNELBRANCH_MEGOUS="branch:orange-pi-5.19"
;;
esac
diff --git a/config/sources/families/include/sunxi_common.inc b/config/sources/families/include/sunxi_common.inc
index 9d120c711..6660ec812 100644
--- a/config/sources/families/include/sunxi_common.inc
+++ b/config/sources/families/include/sunxi_common.inc
@@ -27,9 +27,9 @@ case $BRANCH in
;;
edge)
- export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
- export KERNELBRANCH="branch:linux-5.18.y"
- export KERNELBRANCH_MEGOUS="branch:orange-pi-5.18"
+ export KERNEL_MAJOR_MINOR="5.19" # Major and minor versions of this kernel.
+ export KERNELBRANCH="branch:linux-5.19.y"
+ export KERNELBRANCH_MEGOUS="branch:orange-pi-5.19"
;;
esac
diff --git a/config/sources/families/include/uefi_common.inc b/config/sources/families/include/uefi_common.inc
index 699d09e4a..9e8c9deb1 100644
--- a/config/sources/families/include/uefi_common.inc
+++ b/config/sources/families/include/uefi_common.inc
@@ -22,8 +22,8 @@ case "${BRANCH}" in
edge)
export DISTRO_GENERIC_KERNEL=no
export LINUXCONFIG="linux-uefi-${LINUXFAMILY}-${BRANCH}"
- export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel. For mainline caching.
- export KERNELBRANCH="branch:linux-5.18.y" # Branch or tag to build from. It should match MAJOR_MINOR
+ export KERNEL_MAJOR_MINOR="5.19" # Major and minor versions of this kernel. For mainline caching.
+ export KERNELBRANCH="branch:linux-5.19.y" # Branch or tag to build from. It should match MAJOR_MINOR
export KERNELPATCHDIR="uefi-${LINUXFAMILY}-${BRANCH}" # Might be empty.
;;
esac
diff --git a/config/sources/families/jethub.conf b/config/sources/families/jethub.conf
index 16481c176..382f2d796 100644
--- a/config/sources/families/jethub.conf
+++ b/config/sources/families/jethub.conf
@@ -153,24 +153,24 @@ family_tweaks() {
comment_default_rsyslog_rules || display_alert "Unable to comment default rsyslog rules" "${BOARD}" "wrn"
# Hardware init
- chroot "${SDCARD}" /bin/bash -c "systemctl --no-reload enable jethub-initer.service >/dev/null 2>&1"
+ chroot_sdcard systemctl --no-reload enable jethub-initer.service
# AR-1098 userland fix for net interface does not up at boot
- chroot "${SDCARD}" /bin/bash -c "systemctl --no-reload enable jethub-ethreset.service >/dev/null 2>&1"
+ chroot_sdcard systemctl --no-reload enable jethub-ethreset.service
# pip3 packages
- chroot "${SDCARD}" /bin/bash -c "pip3 install pyserial intelhex python-magic" >> "${DEST}"/debug/install.log 2>&1
+ chroot_sdcard pip3 install pyserial intelhex python-magic
# Hostapd
- chroot "${SDCARD}" /bin/bash -c "systemctl --no-reload disable hostapd.service >/dev/null 2>&1"
+ chroot_sdcard systemctl --no-reload disable hostapd.service
if [[ "$BOARD" == jethubj80 ]]; then
# Bluetooth
- chroot "${SDCARD}" /bin/bash -c "systemctl --no-reload enable jethub-rtk-hciattach.service >/dev/null 2>&1"
+ chroot_sdcard systemctl --no-reload enable jethub-rtk-hciattach.service
fi
display_alert "Adding JetHome repository and authentication key" "/etc/apt/sources.list.d/jethome.list" "info"
- cp "${SRC}"/packages/bsp/jethub/jethome.gpg "${SDCARD}/etc/apt/trusted.gpg.d/"
+ run_host_command_logged cp -pv "${SRC}"/packages/bsp/jethub/jethome.gpg "${SDCARD}/etc/apt/trusted.gpg.d/"
echo "deb http://repo.jethome.ru"$([[ $BETA == yes ]] && echo "/beta")" ${RELEASE} jethome-${RELEASE}" \
>> "${SDCARD}"/etc/apt/sources.list.d/jethome.list
@@ -189,7 +189,6 @@ family_tweaks_bsp() {
cp "$SRC/packages/bsp/jethub/jethub-initer.service" "$destination/lib/systemd/system/" || exit_with_error "Unable to copy jethub-initer.service"
cp "$SRC/packages/bsp/jethub/${BOARD}/jethub-init" "$destination/usr/lib/armbian/" || exit_with_error "Unable to copy jethub-init"
-
# AR-1098 userland fix for net interface does not up at boot
cp "$SRC/packages/bsp/jethub/jethub-ethreset.service" "$destination/lib/systemd/system/" || exit_with_error "Unable to copy jethub-ethreset.service"
cp "$SRC/packages/bsp/jethub/jethub-ethreset" "$destination/usr/lib/armbian/" || exit_with_error "Unable to copy jethub-ethreset"
diff --git a/config/sources/families/media.conf b/config/sources/families/media.conf
index 46ae3c100..0355128ca 100644
--- a/config/sources/families/media.conf
+++ b/config/sources/families/media.conf
@@ -27,6 +27,18 @@ case $BRANCH in
LINUXCONFIG='linux-station-p2-'$BRANCH
EXTRAWIFI="no"
WIREGUARD="no"
+ elif [[ $BOARD == jetson-nano ]]; then
+ KERNELDIR='linux-nano'
+ KERNELSOURCE='https://github.com/150balbes/Jetson-Nano'
+ export KERNEL_MAJOR_MINOR="4.9" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:4.9.201'
+ KERNELPATCHDIR='jetson-nano-'$BRANCH
+ LINUXFAMILY=jetson-nano
+ LINUXCONFIG='linux-jetson-nano-'$BRANCH
+ EXTRAWIFI="no"
+ BOOT_FDT_FILE="none"
+ SRC_CMDLINE='console=ttyS0,115200n8 console=tty0 tegraid=21.1.2.0.0 ddr_die=4096M@2048M section=512M memtype=0 vpr_resize usb_port_owner_info=0 lane_owner_info=0 emc_max_dvfs=0 touch_id=0@63 video=tegrafb debug_uartport=lsport,4 earlyprintk=uart8250-32bit,0x70006000 maxcpus=4 usbcore.old_scheme_first=1 lp0_vec=0x1000@0xff780000 core_edp_mv=1075 core_edp_ma=4000 tegra_fbmem=0x800000@0x92ca9000 is_hdmi_initialised=1 earlycon=uart8250,mmio32,0x70006000 fbcon=map:0'
+ MODULES_INITRD="jetson-nano-legacy"
else
if [[ $BOARD == nanopct4 ]]; then
KERNELSOURCE='https://github.com/friendlyarm/kernel-rockchip'
@@ -57,6 +69,9 @@ case $BRANCH in
else
KERNELPATCHDIR='media-'$BRANCH
LINUXFAMILY=media
+ if [[ $BOARD == jetson-nano ]]; then
+ MODULES_INITRD="jetson-nano-current"
+ fi
fi
;;
@@ -64,10 +79,13 @@ case $BRANCH in
edge)
export KERNEL_MAJOR_MINOR="5.19" # Major and minor versions of this kernel.
KERNELPATCHDIR='media-'$BRANCH
- KERNELBRANCH="tag:v5.19-rc6"
+ KERNELBRANCH="branch:linux-5.19.y"
LINUXFAMILY=media
LINUXCONFIG='linux-media-'$BRANCH
SKIP_BOOTSPLASH="yes"
+ if [[ $BOARD == jetson-nano ]]; then
+ MODULES_INITRD="jetson-nano-edge"
+ fi
;;
esac
diff --git a/config/sources/families/mvebu64.conf b/config/sources/families/mvebu64.conf
index 283761378..3c7ab8cf8 100644
--- a/config/sources/families/mvebu64.conf
+++ b/config/sources/families/mvebu64.conf
@@ -49,8 +49,8 @@ case $BRANCH in
;;
edge)
- export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
- KERNELBRANCH='branch:linux-5.18.y'
+ export KERNEL_MAJOR_MINOR="5.19" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:linux-5.19.y'
;;
esac
diff --git a/config/sources/families/rk322x.conf b/config/sources/families/rk322x.conf
index 3c62bbab0..1023d79d0 100644
--- a/config/sources/families/rk322x.conf
+++ b/config/sources/families/rk322x.conf
@@ -27,8 +27,8 @@ case $BRANCH in
edge)
- export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
- KERNELBRANCH='branch:linux-5.18.y'
+ export KERNEL_MAJOR_MINOR="5.19" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:linux-5.19.y'
;;
diff --git a/config/sources/families/rockchip-rk3588.conf b/config/sources/families/rockchip-rk3588.conf
index d794a5626..b58680299 100644
--- a/config/sources/families/rockchip-rk3588.conf
+++ b/config/sources/families/rockchip-rk3588.conf
@@ -14,16 +14,16 @@ case $BRANCH in
BOOTDIR='u-boot-rockchip64'
KERNELDIR='linux-rockchip64'
KERNELSOURCE='https://github.com/radxa/kernel'
+ export KERNEL_MAJOR_MINOR="5.10" # Major and minor versions of this kernel.
KERNELBRANCH='branch:stable-5.10-rock5'
KERNELPATCHDIR='rockchip-rk3588-legacy'
- ;;
+ ;;
esac
prepare_boot_configuration
-family_tweaks_bsp()
-{
+family_tweaks_bsp() {
:
}
diff --git a/config/sources/families/rockchip.conf b/config/sources/families/rockchip.conf
index c971cba34..100210070 100644
--- a/config/sources/families/rockchip.conf
+++ b/config/sources/families/rockchip.conf
@@ -33,8 +33,8 @@ case $BRANCH in
edge)
- export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
- KERNELBRANCH='branch:linux-5.18.y'
+ export KERNEL_MAJOR_MINOR="5.19" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:linux-5.19.y'
;;
From 2306f2c90751a293dfed429819496b1c7cce3ab0 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 29 Jun 2022 10:38:41 +0200
Subject: [PATCH] armbian-next: move `ROOTFSCACHE_VERSION` resolution from
GitHub from `main-config` down to `create-cache`
- this way config does not depend on remote...
---
lib/functions/configuration/main-config.sh | 7 -------
lib/functions/rootfs/create-cache.sh | 7 +++++++
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 87faa24e0..cdae96d38 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -33,13 +33,6 @@ function do_main_configuration() {
[[ -z $HOST ]] && HOST="$BOARD" # set hostname to the board
cd "${SRC}" || exit
- # if variable not provided, check which is current version in the cache storage
- if [[ -z "${ROOTFSCACHE_VERSION}" ]]; then
- display_alert "ROOTFSCACHE_VERSION not set, getting remotely" "https://github.com/armbian/mirror/releases/download/rootfs/rootfscache.version" "warn"
- ROOTFSCACHE_VERSION=$(wget --tries=10 -O - -o /dev/null https://github.com/armbian/mirror/releases/download/rootfs/rootfscache.version || true)
- ROOTFSCACHE_VERSION=${ROOTFSCACHE_VERSION:-"0"}
- fi
-
[[ -z "${CHROOT_CACHE_VERSION}" ]] && CHROOT_CACHE_VERSION=7
BUILD_REPOSITORY_URL=$(git remote get-url "$(git remote | grep origin)")
BUILD_REPOSITORY_COMMIT=$(git describe --match=d_e_a_d_b_e_e_f --always --dirty)
diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh
index 8f060c88a..635631232 100644
--- a/lib/functions/rootfs/create-cache.sh
+++ b/lib/functions/rootfs/create-cache.sh
@@ -6,6 +6,13 @@ get_or_create_rootfs_cache_chroot_sdcard() {
local cycles=2
fi
+ # if variable not provided, check which is current version in the cache storage in GitHub.
+ if [[ -z "${ROOTFSCACHE_VERSION}" ]]; then
+ display_alert "ROOTFSCACHE_VERSION not set, getting remotely" "https://github.com/armbian/mirror/releases/download/rootfs/rootfscache.version" "debug"
+ ROOTFSCACHE_VERSION=$(wget --tries=10 -O - -o /dev/null https://github.com/armbian/mirror/releases/download/rootfs/rootfscache.version || true)
+ ROOTFSCACHE_VERSION=${ROOTFSCACHE_VERSION:-"0"}
+ fi
+
# seek last cache, proceed to previous otherwise build it
for ((n = 0; n < cycles; n++)); do
From dfcfcbc5e08b81d294170bb901900f7772abc0ae Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 29 Jun 2022 13:26:06 +0200
Subject: [PATCH] armbian-next: move `ARMBIAN_MIRROR` selection (network) from
`main-config` to `prepare-host`
- this way CONFIG_DEFS_ONLY can run without touching the network
---
lib/functions/configuration/main-config.sh | 19 -------------------
lib/functions/host/prepare-host.sh | 20 ++++++++++++++++++++
2 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index b8369c436..87faa24e0 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -345,25 +345,6 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
fi
fi
- # don't use mirrors that throws garbage on 404
- if [[ -z ${ARMBIAN_MIRROR} && "${SKIP_ARMBIAN_REPO}" != "yes" ]]; then
- declare -i armbian_mirror_tries=1
- while true; do
- display_alert "Obtaining Armbian mirror" "via https://redirect.armbian.com" "debug"
- ARMBIAN_MIRROR=$(wget -SO- -T 1 -t 1 https://redirect.armbian.com 2>&1 | egrep -i "Location" | awk '{print $2}' | head -1)
- if [[ ${ARMBIAN_MIRROR} != *armbian.hosthatch* ]]; then # @TODO: hosthatch is not good enough. Why?
- display_alert "Obtained Armbian mirror OK" "${ARMBIAN_MIRROR}" "debug"
- break
- else
- display_alert "Obtained Armbian mirror is invalid, retrying..." "${ARMBIAN_MIRROR}" "debug"
- fi
- armbian_mirror_tries=$((armbian_mirror_tries + 1))
- if [[ $armbian_mirror_tries -ge 5 ]]; then
- exit_with_error "Unable to obtain ARMBIAN_MIRROR after ${armbian_mirror_tries} tries. Please set ARMBIAN_MIRROR to a valid mirror manually, or avoid the automatic mirror selection by setting SKIP_ARMBIAN_REPO=yes"
- fi
- done
- fi
-
# Control aria2c's usage of ipv6.
[[ -z $DISABLE_IPV6 ]] && DISABLE_IPV6="true"
diff --git a/lib/functions/host/prepare-host.sh b/lib/functions/host/prepare-host.sh
index 99fbbf787..c91c50c25 100644
--- a/lib/functions/host/prepare-host.sh
+++ b/lib/functions/host/prepare-host.sh
@@ -25,6 +25,26 @@ prepare_host() {
export LC_ALL="en_US.UTF-8"
+ # don't use mirrors that throws garbage on 404
+ if [[ -z ${ARMBIAN_MIRROR} && "${SKIP_ARMBIAN_REPO}" != "yes" ]]; then
+ display_alert "Determining best Armbian mirror to use" "via redirector" "debug"
+ declare -i armbian_mirror_tries=1
+ while true; do
+ display_alert "Obtaining Armbian mirror" "via https://redirect.armbian.com" "debug"
+ ARMBIAN_MIRROR=$(wget -SO- -T 1 -t 1 https://redirect.armbian.com 2>&1 | egrep -i "Location" | awk '{print $2}' | head -1)
+ if [[ ${ARMBIAN_MIRROR} != *armbian.hosthatch* ]]; then # @TODO: hosthatch is not good enough. Why?
+ display_alert "Obtained Armbian mirror OK" "${ARMBIAN_MIRROR}" "debug"
+ break
+ else
+ display_alert "Obtained Armbian mirror is invalid, retrying..." "${ARMBIAN_MIRROR}" "debug"
+ fi
+ armbian_mirror_tries=$((armbian_mirror_tries + 1))
+ if [[ $armbian_mirror_tries -ge 5 ]]; then
+ exit_with_error "Unable to obtain ARMBIAN_MIRROR after ${armbian_mirror_tries} tries. Please set ARMBIAN_MIRROR to a valid mirror manually, or avoid the automatic mirror selection by setting SKIP_ARMBIAN_REPO=yes"
+ fi
+ done
+ fi
+
# packages list for host
# NOTE: please sync any changes here with the Dockerfile and Vagrantfile
declare -a host_dependencies=(
From 8f2922f37b7ccc5c790c77d96bcc25ba5f13118b Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 18 Jul 2022 15:37:15 +0200
Subject: [PATCH] armbian-next: manual merge (26) of MD5-checking via debsums
(3955) re-imagined
- @TODO make sure
---
lib/functions/rootfs/create-cache.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh
index 2a4e42d13..8f060c88a 100644
--- a/lib/functions/rootfs/create-cache.sh
+++ b/lib/functions/rootfs/create-cache.sh
@@ -221,6 +221,12 @@ function create_new_rootfs_cache() {
chroot_sdcard_apt_get install ${apt_desktop_install_flags} $PACKAGE_LIST_DESKTOP
fi
+ # stage: check md5 sum of installed packages. Just in case.
+ display_alert "Check MD5 sum of installed packages" "info"
+ export if_error_detail_message="Check MD5 sum of installed packages failed"
+ # shellcheck disable=SC2154 # this '$' and '\n' syntax is for dpkg-query
+ chroot_sdcard dpkg-query -f '"${binary:Package}\n"' -W "|" xargs debsums --silent || true # @TODO: ignore result for now until we can find all the divergences
+
# Remove packages from packages.uninstall
display_alert "Uninstall packages" "$PACKAGE_LIST_UNINSTALL" "info"
# shellcheck disable=SC2086
From 733b9bfb06ea36373049b98751f42e13905247d5 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 18 Jul 2022 15:26:08 +0200
Subject: [PATCH] armbian-next: manual merge (26) of sources/families changes
between revisions 20ee8c54502f877bfa563e113d67709cb80dc6f9 and
9c52562176390624d33c93634e63a8f91cc0815b
---
config/sources/families/jetson-nano.conf | 10 +++++-----
config/sources/families/media.conf | 27 ++++++++++++++++++---------
2 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/config/sources/families/jetson-nano.conf b/config/sources/families/jetson-nano.conf
index 7f7f07c72..f09f15845 100644
--- a/config/sources/families/jetson-nano.conf
+++ b/config/sources/families/jetson-nano.conf
@@ -22,8 +22,8 @@ case $BRANCH in
;;
current)
- export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.17.y"
+ export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
+ KERNELBRANCH="branch:linux-5.18.y"
KERNELPATCHDIR='media-'$BRANCH
LINUXFAMILY=media
LINUXCONFIG='linux-media-'$BRANCH
@@ -31,9 +31,9 @@ case $BRANCH in
;;
edge)
- #SKIP_BOOTSPLASH="yes"
- export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.18.y"
+ export KERNEL_MAJOR_MINOR="5.19" # Major and minor versions of this kernel.
+ #KERNELBRANCH="branch:linux-5.19.y"
+ KERNELBRANCH="tag:v5.19-rc6"
KERNELPATCHDIR='media-'$BRANCH
LINUXFAMILY=media
LINUXCONFIG='linux-media-'$BRANCH
diff --git a/config/sources/families/media.conf b/config/sources/families/media.conf
index 2b9f4e074..46ae3c100 100644
--- a/config/sources/families/media.conf
+++ b/config/sources/families/media.conf
@@ -3,10 +3,13 @@ source "${BASH_SOURCE%/*}/include/rockchip64_common.inc"
if [[ $BOARD == station-p2 || $BOARD == station-m2 || $BOARD == bananapir2pro ]]; then
BOOTSOURCE='https://github.com/150balbes/u-boot-rk'
BOOTBRANCH='branch:rk356x'
- BOOTPATCHDIR="u-boot-media"
+ BOOTPATCHDIR="u-boot-station-p2"
elif [[ $BOARD == quartz64a ]]; then
BOOTSOURCE='https://github.com/150balbes/u-boot-rk'
BOOTBRANCH='branch:rk35xx'
+ BOOTPATCHDIR="u-boot-station-p2"
+else
+ BOOTBRANCH="tag:v2022.07"
BOOTPATCHDIR="u-boot-media"
fi
@@ -44,21 +47,27 @@ case $BRANCH in
;;
current)
- export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.17.y"
- KERNELBRANCH="tag:v5.17.9"
- KERNELPATCHDIR='media-'$BRANCH
- LINUXFAMILY=media
+ export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
+ KERNELBRANCH="branch:linux-5.18.y"
LINUXCONFIG='linux-media-'$BRANCH
+
+ if [[ $BOARD == station-p2 || $BOARD == station-m2 || $BOARD == quartz64a || $BOARD == bananapir2pro ]]; then
+ KERNELPATCHDIR='station-p2-'$BRANCH
+ LINUXFAMILY=station-p2
+ else
+ KERNELPATCHDIR='media-'$BRANCH
+ LINUXFAMILY=media
+ fi
+
;;
edge)
- export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.18.y"
- KERNELBRANCH="tag:v5.18"
+ export KERNEL_MAJOR_MINOR="5.19" # Major and minor versions of this kernel.
KERNELPATCHDIR='media-'$BRANCH
+ KERNELBRANCH="tag:v5.19-rc6"
LINUXFAMILY=media
LINUXCONFIG='linux-media-'$BRANCH
+ SKIP_BOOTSPLASH="yes"
;;
esac
From 63aa49ecac9c0401f359bb3ad801af6f7618a5ce Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 18 Jul 2022 15:17:50 +0200
Subject: [PATCH] armbian-next: manual merge (26) of lib changes between
revisions 20ee8c54502f877bfa563e113d67709cb80dc6f9 and
9c52562176390624d33c93634e63a8f91cc0815b
- @TODO NOT including the md5/debsums check, that needs further rewrite
---
lib/functions/configuration/interactive.sh | 2 +-
lib/functions/main/config-prepare.sh | 2 +-
lib/functions/rootfs/apt-install.sh | 3 ---
3 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/lib/functions/configuration/interactive.sh b/lib/functions/configuration/interactive.sh
index 325553433..743d8a22b 100644
--- a/lib/functions/configuration/interactive.sh
+++ b/lib/functions/configuration/interactive.sh
@@ -1,5 +1,5 @@
function interactive_config_prepare_terminal() {
- if [[ $BUILD_ALL != "yes" && -z $ROOT_FS_CREATE_ONLY ]]; then
+ if [[ -z $ROOT_FS_CREATE_ONLY ]]; then
if [[ -t 0 ]]; then # "-t fd return True if file descriptor fd is open and refers to a terminal". 0 = stdin, 1 = stdout, 2 = stderr, 3+ custom
# override stty size, if stdin is a terminal.
[[ -n $COLUMNS ]] && stty cols $COLUMNS
diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh
index 0264b0d9e..d39d7c4be 100644
--- a/lib/functions/main/config-prepare.sh
+++ b/lib/functions/main/config-prepare.sh
@@ -117,7 +117,7 @@ function prepare_and_config_main_build_single() {
if [[ $BETA == yes ]]; then
IMAGE_TYPE=nightly
- elif [[ $BETA != "yes" && $BUILD_ALL == yes ]]; then
+ elif [[ $BETA != "yes" ]]; then
IMAGE_TYPE=stable
else
IMAGE_TYPE=user-built
diff --git a/lib/functions/rootfs/apt-install.sh b/lib/functions/rootfs/apt-install.sh
index b2406f339..256d9bec9 100644
--- a/lib/functions/rootfs/apt-install.sh
+++ b/lib/functions/rootfs/apt-install.sh
@@ -25,9 +25,6 @@ install_deb_chroot() {
display_alert "Installing${desc}" "${name/\/root\//}"
- # when building in bulk from remote, lets make sure we have up2date index
- [[ $BUILD_ALL == yes && ${variant} == remote ]] && chroot_sdcard_apt_get update
-
# install in chroot via apt-get, not dpkg, so dependencies are also installed from repo if needed.
export if_error_detail_message="Installation of $name failed ${BOARD} ${RELEASE} ${BUILD_DESKTOP} ${LINUXFAMILY}"
chroot_sdcard_apt_get --no-install-recommends install "${name}"
From a71814dfd278aa138d679c56026f7de1d4d6d892 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 29 Jun 2022 10:06:29 +0200
Subject: [PATCH] armbian-next: manual merge (25) of lib changes between
revisions fe972621c61f339c9b84aaf94fd851fa789882e8 and
20ee8c54502f877bfa563e113d67709cb80dc6f9
- @TODO hmm Igor is now going out to the network for rootfs cache version during configuration phase!!! BAD BAD BAD
---
lib/functions/configuration/main-config.sh | 9 ++++++++-
lib/functions/general/downloads.sh | 16 +++++++++++-----
lib/functions/rootfs/create-cache.sh | 12 +++++++-----
3 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 0fdb35bdd..b8369c436 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -32,7 +32,14 @@ function do_main_configuration() {
[[ -z $EXIT_PATCHING_ERROR ]] && EXIT_PATCHING_ERROR="" # exit patching if failed
[[ -z $HOST ]] && HOST="$BOARD" # set hostname to the board
cd "${SRC}" || exit
- [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=20
+
+ # if variable not provided, check which is current version in the cache storage
+ if [[ -z "${ROOTFSCACHE_VERSION}" ]]; then
+ display_alert "ROOTFSCACHE_VERSION not set, getting remotely" "https://github.com/armbian/mirror/releases/download/rootfs/rootfscache.version" "warn"
+ ROOTFSCACHE_VERSION=$(wget --tries=10 -O - -o /dev/null https://github.com/armbian/mirror/releases/download/rootfs/rootfscache.version || true)
+ ROOTFSCACHE_VERSION=${ROOTFSCACHE_VERSION:-"0"}
+ fi
+
[[ -z "${CHROOT_CACHE_VERSION}" ]] && CHROOT_CACHE_VERSION=7
BUILD_REPOSITORY_URL=$(git remote get-url "$(git remote | grep origin)")
BUILD_REPOSITORY_COMMIT=$(git describe --match=d_e_a_d_b_e_e_f --always --dirty)
diff --git a/lib/functions/general/downloads.sh b/lib/functions/general/downloads.sh
index ecd383e12..97afb81a4 100644
--- a/lib/functions/general/downloads.sh
+++ b/lib/functions/general/downloads.sh
@@ -1,17 +1,22 @@
function webseed() {
+
# list of mirrors that host our files
unset text
- # Hardcoded to EU mirrors since
local CCODE=$(curl -s redirect.armbian.com/geoip | jq '.continent.code' -r)
- WEBSEED=($(curl -s https://redirect.armbian.com/mirrors | jq -r '.'${CCODE}' | .[] | values'))
+
+ if [[ "$2" == "rootfs" ]]; then
+ WEBSEED=($(curl -s ${1}mirrors | jq -r '.'${CCODE}' | .[] | values'))
+ else
+ WEBSEED=($(curl -s https://redirect.armbian.com/mirrors | jq -r '.'${CCODE}' | .[] | values'))
+ fi
+
# remove dead mirrors to suppress download errors
- FILE=".control"
while read -r line; do
REMOVE=$(echo $line | egrep -o 'https?://[^ ]+/')
WEBSEED=("${WEBSEED[@]/$REMOVE/}")
done < <(
for k in ${WEBSEED[@]}; do
- echo "$k$FILE"
+ echo "$k$2/$3"
done | parallel --halt soon,fail=10 --jobs 32 wget -q --spider --timeout=15 --tries=4 --retry-connrefused {} 2>&1 > /dev/null
)
@@ -26,8 +31,9 @@ function webseed() {
https://mirrors.bfsu.edu.cn/armbian-releases/
)
fi
+
for toolchain in ${WEBSEED[@]}; do
- text="${text} ${toolchain}${1}"
+ text="${text} ${toolchain}"$2/"${3}"
done
text="${text:1}"
echo "${text}"
diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh
index fab43781b..2a4e42d13 100644
--- a/lib/functions/rootfs/create-cache.sh
+++ b/lib/functions/rootfs/create-cache.sh
@@ -9,9 +9,10 @@ get_or_create_rootfs_cache_chroot_sdcard() {
# seek last cache, proceed to previous otherwise build it
for ((n = 0; n < cycles; n++)); do
- [[ -z ${FORCED_MONTH_OFFSET} ]] && FORCED_MONTH_OFFSET=${n}
+ FORCED_MONTH_OFFSET=${n}
+
local packages_hash
- packages_hash=$(get_package_list_hash "$(date -d "$D +${FORCED_MONTH_OFFSET} month" +"%Y-%m-module$ROOTFSCACHE_VERSION" | sed 's/^0*//')")
+ packages_hash=$(get_package_list_hash "$(date -d "$D -${FORCED_MONTH_OFFSET} month" +"%Y-%m-module$ROOTFSCACHE_VERSION" | sed 's/^0*//')")
local cache_type="cli"
[[ ${BUILD_DESKTOP} == yes ]] && cache_type="xfce-desktop"
@@ -33,7 +34,7 @@ get_or_create_rootfs_cache_chroot_sdcard() {
display_alert "Checking local cache" "$display_name" "info"
if [[ -f ${cache_fname} && -n "$ROOT_FS_CREATE_ONLY" ]]; then
- touch "${cache_fname}.current"
+ echo "$cache_fname" > $cache_fname.current
display_alert "Checking cache integrity" "$display_name" "info"
sudo zstd -tqq "${cache_fname}" || {
@@ -52,6 +53,7 @@ get_or_create_rootfs_cache_chroot_sdcard() {
else
display_alert "searching on servers"
download_and_verify "_rootfs" "$cache_name"
+ [[ -f ${cache_fname} ]] && break
fi
if [[ ! -f $cache_fname ]]; then
@@ -64,7 +66,7 @@ get_or_create_rootfs_cache_chroot_sdcard() {
# speed up checking
if [[ -n "$ROOT_FS_CREATE_ONLY" ]]; then
- touch $cache_fname.current
+ echo "$cache_fname" > $cache_fname.current
umount --lazy "$SDCARD"
rm -rf $SDCARD
# remove exit trap
@@ -85,7 +87,7 @@ get_or_create_rootfs_cache_chroot_sdcard() {
create_new_rootfs_cache
# needed for backend to keep current only
- touch "${cache_fname}.current"
+ echo "$cache_fname" > $cache_fname.current
fi
From 7b782918ecd066682e15b10a37a076d8ab07c70c Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 29 Jun 2022 09:59:36 +0200
Subject: [PATCH] armbian-next: manual merge (25) of family changes between
revisions fe972621c61f339c9b84aaf94fd851fa789882e8 and
20ee8c54502f877bfa563e113d67709cb80dc6f9
---
config/sources/families/include/rockchip64_common.inc | 10 ++++------
config/sources/families/media.conf | 4 ++--
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/config/sources/families/include/rockchip64_common.inc b/config/sources/families/include/rockchip64_common.inc
index e69a41cf0..44d4d22dc 100644
--- a/config/sources/families/include/rockchip64_common.inc
+++ b/config/sources/families/include/rockchip64_common.inc
@@ -439,12 +439,10 @@ family_tweaks_bsp() {
fi
if [[ $BOARD == rk3318-box ]]; then
-
- # Optional board dtbo selection script
- mkdir -p $destination/usr/local/bin
- install -m 755 $SRC/packages/bsp/rk3318/rk3318-config $destination/usr/sbin
-
- fi
+ # Optional board dtbo selection script
+ mkdir -p $destination/usr/local/bin
+ install -m 755 $SRC/packages/bsp/rk3318/rk3318-config $destination/usr/sbin
+ fi
if [[ $BOARD == pinebook-pro ]]; then
diff --git a/config/sources/families/media.conf b/config/sources/families/media.conf
index 3b5bbe589..2b9f4e074 100644
--- a/config/sources/families/media.conf
+++ b/config/sources/families/media.conf
@@ -1,6 +1,6 @@
source "${BASH_SOURCE%/*}/include/rockchip64_common.inc"
-if [[ $BOARD == station-p2 || $BOARD == station-m2 ]]; then
+if [[ $BOARD == station-p2 || $BOARD == station-m2 || $BOARD == bananapir2pro ]]; then
BOOTSOURCE='https://github.com/150balbes/u-boot-rk'
BOOTBRANCH='branch:rk356x'
BOOTPATCHDIR="u-boot-media"
@@ -15,7 +15,7 @@ case $BRANCH in
legacy)
KERNELDIR='linux-rockchip64'
- if [[ $BOARD == station-p2 || $BOARD == station-m2 ]]; then
+ if [[ $BOARD == station-p2 || $BOARD == station-m2 || $BOARD == bananapir2pro ]]; then
KERNELSOURCE='https://github.com/150balbes/rockchip-kernel'
export KERNEL_MAJOR_MINOR="4.19" # Major and minor versions of this kernel.
KERNELBRANCH='branch:kernel-4.19'
From 35a5ec860a5729794add0bc3f5b71f4dc09cd708 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 22 Jun 2022 20:23:12 +0200
Subject: [PATCH] armbian-next: manual merge (24) of families changes between
revisions 9ca9120420aa2a39b91ab7283a7dafe113de42e8 and
560531a63505eb610d269b26858689307a9483f5
---
config/sources/families/include/meson64_common.inc | 3 +-
.../sources/families/include/rockchip64_common.inc | 46 ++++++++++++++--------
2 files changed, 32 insertions(+), 17 deletions(-)
diff --git a/config/sources/families/include/meson64_common.inc b/config/sources/families/include/meson64_common.inc
index 7d79b6930..d902756e7 100644
--- a/config/sources/families/include/meson64_common.inc
+++ b/config/sources/families/include/meson64_common.inc
@@ -25,7 +25,8 @@ case $BRANCH in
legacy)
KERNELSOURCE='https://github.com/hardkernel/linux'
export KERNEL_MAJOR_MINOR="4.9" # Major and minor versions of this kernel. For mainline caching.
- KERNELBRANCH='branch:odroidg12-4.9.y'
+ #KERNELBRANCH='branch:odroidg12-4.9.y'
+ KERNELBRANCH='tag:4.9.277-122'
;;
current)
diff --git a/config/sources/families/include/rockchip64_common.inc b/config/sources/families/include/rockchip64_common.inc
index be6951bff..e69a41cf0 100644
--- a/config/sources/families/include/rockchip64_common.inc
+++ b/config/sources/families/include/rockchip64_common.inc
@@ -16,8 +16,24 @@ PACKAGE_LIST_FAMILY="ethtool"
RKBIN_DIR="$SRC/cache/sources/rkbin-tools"
+# Common variables:
+# BOOT_SCENARIO - determines which tpl (ddrbin), spl and ATF combination to use
+#
+# Different boot scenario can arrange:
+# * Phase 1: DDR initialization (proprietary rockchip ddrbin or u-boot TPL)
+# * Phase 2: Initial system and clock initialization (proprietary rockchip miniload or u-boot SPL)
+# * Phase 3: Arm Trusted Firmware (proprietary rockchip or mainline opensource)
+# * Phase 4: u-boot proper is always the mainline one
+#
+# Available options for BOOT_SCENARIO are:
+# - only-blobs: proprietary rockchip ddrbin, miniloader and ATF
+# - spl-blobs: proprietary rockchip ddrin and ATF, but uses mainline u-boot SPL in place of rockchip miniloader
+# - tpl-spl-blob: uses mainline u-boot TPL and SPL with proprietary rockchip ATF blob
+# - tpl-blob-atf-mainline: proprietary rockchip ddrbin + mainline u-boot SPL + mainline ATF
+# - blobless: mainline u-boot TPL + mainline u-boot SPL + mainline ATF
+
+#BOOT_SOC=`expr $BOOTCONFIG : '.*\(rk[[:digit:]]\+.*\)_.*'`
BOOT_SOC=${BOOT_SOC:=$(expr $BOOTCONFIG : '.*\(rk[[:digit:]]\+.*\)_.*')}
-display_alert "BOOT_SOC:" "$BOOT_SOC" "debug"
CPUMIN=${CPUMIN:="408000"}
@@ -42,44 +58,41 @@ fi
if [[ $BOOT_SOC == rk3328 ]]; then
BOOT_SCENARIO="${BOOT_SCENARIO:=only-blobs}"
- DDR_BLOB='rk33/rk3328_ddr_333MHz_v1.16.bin'
+ DDR_BLOB="${DDR_BLOB:=rk33/rk3328_ddr_333MHz_v1.16.bin}"
MINILOADER_BLOB='rk33/rk322xh_miniloader_v2.50.bin'
BL31_BLOB='rk33/rk322xh_bl31_v1.44.elf'
elif [[ $BOOT_SOC == rk3399 ]]; then
BOOT_SCENARIO="${BOOT_SCENARIO:=only-blobs}"
- DDR_BLOB='rk33/rk3399_ddr_933MHz_v1.25.bin'
+ DDR_BLOB="${DDR_BLOB:=rk33/rk3399_ddr_933MHz_v1.25.bin}"
MINILOADER_BLOB='rk33/rk3399_miniloader_v1.26.bin'
BL31_BLOB='rk33/rk3399_bl31_v1.35.elf'
elif [[ $BOOT_SOC == rk3399pro ]]; then
BOOT_SCENARIO="${BOOT_SCENARIO:=only-blobs}"
- DDR_BLOB='rk33/rk3399pro_npu_ddr_933MHz_v1.02.bin'
+ DDR_BLOB="${DDR_BLOB:=rk33/rk3399pro_npu_ddr_933MHz_v1.02.bin}"
MINILOADER_BLOB='rk33/rk3399pro_miniloader_v1.26.bin'
BL31_BLOB='rk33/rk3399pro_bl31_v1.35.elf'
elif [[ $BOOT_SOC == rk3566 ]]; then
BOOT_SCENARIO="${BOOT_SCENARIO:=spl-blobs}"
- DDR_BLOB='rk35/rk3566_ddr_1056MHz_v1.10.bin'
+ DDR_BLOB="${DDR_BLOB:=rk35/rk3566_ddr_1056MHz_v1.10.bin}"
BL31_BLOB='rk35/rk3568_bl31_v1.29.elf'
elif [[ $BOOT_SOC == rk3568 ]]; then
BOOT_SCENARIO="${BOOT_SCENARIO:=spl-blobs}"
- DDR_BLOB="${DDR_BLOB:-"rk35/rk3568_ddr_1560MHz_v1.10.bin"}"
- BL31_BLOB="${BL31_BLOB:-"rk35/rk3568_bl31_v1.28.elf"}"
- display_alert "BOOT_SCENARIO:" "$BOOT_SCENARIO" "debug"
- display_alert "DDR_BLOB:" "$DDR_BLOB" "debug"
- display_alert "BL31_BLOB:" "$BL31_BLOB" "debug"
+ DDR_BLOB="${DDR_BLOB:=rk35/rk3568_ddr_1560MHz_v1.10.bin}"
+ BL31_BLOB='rk35/rk3568_bl31_v1.28.elf'
elif [[ $BOARD == rockpi-s ]]; then
BOOT_SCENARIO="${BOOT_SCENARIO:=only-blobs}"
BOOT_SOC=rk3308
- DDR_BLOB='rk33/rk3308_ddr_589MHz_uart2_m1_v1.30.bin'
+ DDR_BLOB="${DDR_BLOB:=rk33/rk3308_ddr_589MHz_uart2_m1_v1.30.bin}"
MINILOADER_BLOB='rk33/rk3308_miniloader_v1.22.bin'
BL31_BLOB='rk33/rk3308_bl31_v2.22.elf'
@@ -114,7 +127,7 @@ case $BRANCH in
esac
prepare_boot_configuration() {
- if [[ $BOOT_SCENARIO == "blobless" ]]; then
+ if [[ $BOOT_SCENARIO == "blobless" || $BOOT_SCENARIO == "tpl-blob-atf-mainline" ]]; then
UBOOT_TARGET_MAP="BL31=bl31.elf idbloader.img u-boot.itb;;idbloader.img u-boot.itb"
ATFSOURCE='https://github.com/ARM-software/arm-trusted-firmware'
@@ -125,6 +138,8 @@ prepare_boot_configuration() {
ATF_TARGET_MAP="M0_CROSS_COMPILE=arm-linux-gnueabi- PLAT=$BOOT_SOC bl31;;build/$BOOT_SOC/release/bl31/bl31.elf:bl31.elf"
ATF_TOOLCHAIN2="arm-linux-gnueabi-:< 10.0"
+ [[ $BOOT_SCENARIO == "tpl-blob-atf-mainline" ]] && UBOOT_TARGET_MAP="BL31=bl31.elf idbloader.img u-boot.itb;;idbloader.img u-boot.itb"
+
elif [[ $BOOT_SCENARIO == "tpl-spl-blob" ]]; then
UBOOT_TARGET_MAP="BL31=$RKBIN_DIR/$BL31_BLOB idbloader.img u-boot.itb;;idbloader.img u-boot.itb"
@@ -133,7 +148,6 @@ prepare_boot_configuration() {
elif [[ $BOOT_SCENARIO == "spl-blobs" ]]; then
- display_alert "BOOT Scenario is" "spl-blobs" "debug"
UBOOT_TARGET_MAP="BL31=$RKBIN_DIR/$BL31_BLOB spl/u-boot-spl.bin u-boot.dtb u-boot.itb;;idbloader.img u-boot.itb"
ATFSOURCE=''
ATF_COMPILE='no'
@@ -161,8 +175,8 @@ uboot_custom_postprocess() {
if [[ $BOOT_SCENARIO == "blobless" || $BOOT_SCENARIO == "tpl-spl-blob" ]]; then
:
- elif [[ $BOOT_SCENARIO == "spl-blobs" ]]; then
- display_alert "mkimage for $BOOT_SOC with $BOOT_SCENARIO" "spl-blobs" "debug"
+ elif [[ $BOOT_SCENARIO == "spl-blobs" || $BOOT_SCENARIO == "tpl-blob-atf-mainline" ]]; then
+ display_alert "mkimage for $BOOT_SOC with $BOOT_SCENARIO" "spl-blobs/tpl-blob-atf-mainline" "debug"
run_host_command_logged tools/mkimage -n $BOOT_SOC -T rksd -d $RKBIN_DIR/$DDR_BLOB:spl/u-boot-spl.bin idbloader.img
elif [[ $BOOT_SCENARIO == "only-blobs" ]]; then
@@ -372,7 +386,7 @@ family_tweaks_bsp() {
fi
if [[ $BOARD == orangepi4-lts ]]; then
-
+
# Bluetooth on orangepi 4 LTS board is handled by a Spreadtrum (sprd) chip and requires
# a custom hciattach_opi binary, plus a systemd service to run it at boot time
install -m 755 $SRC/packages/bsp/rk3399/hciattach_opi $destination/usr/bin
From ac26f77b6eaebec9d11537995eeadb07bf87c54a Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 22 Jun 2022 20:22:08 +0200
Subject: [PATCH] armbian-next: manual merge (24) of lib changes between
revisions 9ca9120420aa2a39b91ab7283a7dafe113de42e8 and
560531a63505eb610d269b26858689307a9483f5
---
lib/functions/configuration/main-config.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 59dcdbe7f..0fdb35bdd 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -32,7 +32,7 @@ function do_main_configuration() {
[[ -z $EXIT_PATCHING_ERROR ]] && EXIT_PATCHING_ERROR="" # exit patching if failed
[[ -z $HOST ]] && HOST="$BOARD" # set hostname to the board
cd "${SRC}" || exit
- [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=19
+ [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=20
[[ -z "${CHROOT_CACHE_VERSION}" ]] && CHROOT_CACHE_VERSION=7
BUILD_REPOSITORY_URL=$(git remote get-url "$(git remote | grep origin)")
BUILD_REPOSITORY_COMMIT=$(git describe --match=d_e_a_d_b_e_e_f --always --dirty)
From d868b7b64ae2da0614078cccefab59804715542c Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 17 Jun 2022 12:19:32 +0200
Subject: [PATCH] armbian-next: manual merge (23) of all changes between
revisions 17b4fb913c76233d1e2126cfd35ecb85acfa5a25 and
9ca9120420aa2a39b91ab7283a7dafe113de42e8
---
config/sources/families/sun50iw6.conf | 12 ++++++++++++
lib/functions/configuration/main-config.sh | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/config/sources/families/sun50iw6.conf b/config/sources/families/sun50iw6.conf
index 874e12e1f..6b05a17b9 100644
--- a/config/sources/families/sun50iw6.conf
+++ b/config/sources/families/sun50iw6.conf
@@ -26,6 +26,11 @@ case $BRANCH in
esac
family_tweaks_s() {
+ if [[ -f $SDCARD/lib/systemd/system/aw859a-bluetooth.service ]]; then
+ # install and enable Bluetooth
+ chroot $SDCARD /bin/bash -c "apt-get -y -qq install rfkill bluetooth bluez bluez-tools >/dev/null 2>&1"
+ chroot $SDCARD /bin/bash -c "systemctl --no-reload enable aw859a-bluetooth.service >/dev/null 2>&1"
+ fi
if [[ $BUILD_DESKTOP == yes && $BOARD == orangepi3-lts ]]; then
@@ -34,5 +39,12 @@ family_tweaks_s() {
echo "load-module module-alsa-sink device=hw:1,0 sink_name=HDMI-Playback sink_properties=\"device.description='HDMI Audio'\"" >> ${SDCARD}/etc/pulse/default.pa
fi
+}
+
+family_tweaks_bsp() {
+ if [[ ${BOARD} == orangepi3-lts ]]; then
+ cp $SRC/packages/bsp/sunxi/aw859a-bluetooth.service $destination/lib/systemd/system/
+ fi
+ install -m 755 $SRC/packages/blobs/bt/hciattach/hciattach_opi_${ARCH} $destination/usr/bin/hciattach_opi
}
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 31c4d6280..59dcdbe7f 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -32,7 +32,7 @@ function do_main_configuration() {
[[ -z $EXIT_PATCHING_ERROR ]] && EXIT_PATCHING_ERROR="" # exit patching if failed
[[ -z $HOST ]] && HOST="$BOARD" # set hostname to the board
cd "${SRC}" || exit
- [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=18
+ [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=19
[[ -z "${CHROOT_CACHE_VERSION}" ]] && CHROOT_CACHE_VERSION=7
BUILD_REPOSITORY_URL=$(git remote get-url "$(git remote | grep origin)")
BUILD_REPOSITORY_COMMIT=$(git describe --match=d_e_a_d_b_e_e_f --always --dirty)
From d4904385fe7e7506638e68638e348d9f0b412bd7 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 12 Jun 2022 14:03:44 +0200
Subject: [PATCH] armbian-next: manual merge (22) of all changes between
revisions 0eb8fe7497aebf341bead2b3b0fb7309fd7bdc14 and
1dddf78cd0ed096edd6506241cfd9aa8cc27ba4e
- @TODO EXCEPT the insanity about locales/eval/VERYSILENT in #3850, requires deep review
---
config/sources/families/bcm2711.conf | 4 +--
config/sources/families/imx6.conf | 4 +--
config/sources/families/include/meson_common.inc | 14 ++++++++-
.../sources/families/include/rockchip64_common.inc | 34 +++++++++++++++++-----
config/sources/families/include/sunxi64_common.inc | 6 ++--
config/sources/families/include/sunxi_common.inc | 6 ++--
config/sources/families/include/uefi_common.inc | 4 +--
config/sources/families/mvebu64.conf | 10 +++----
config/sources/families/odroidxu4.conf | 6 ++--
config/sources/families/rk322x.conf | 4 +--
config/sources/families/rockchip.conf | 8 ++---
lib/functions/compilation/patch/kernel-drivers.sh | 16 +++++-----
lib/functions/compilation/uboot.sh | 5 ++--
lib/functions/extras/buildpkg.sh | 29 +++++++++++++-----
lib/functions/host/prepare-host.sh | 2 +-
lib/functions/image/partitioning.sh | 2 +-
16 files changed, 99 insertions(+), 55 deletions(-)
diff --git a/config/sources/families/bcm2711.conf b/config/sources/families/bcm2711.conf
index 2b19132e2..5ae60578a 100644
--- a/config/sources/families/bcm2711.conf
+++ b/config/sources/families/bcm2711.conf
@@ -28,8 +28,8 @@ case "${BRANCH}" in
edge)
export RASPI_DISTRO_KERNEL=no
export KERNELSOURCE='https://github.com/raspberrypi/linux'
- export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel. For mainline caching.
- export KERNELBRANCH="branch:rpi-5.17.y"
+ export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel. For mainline caching.
+ export KERNELBRANCH="branch:rpi-5.18.y"
export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
;;
diff --git a/config/sources/families/imx6.conf b/config/sources/families/imx6.conf
index f2bcf95a1..9a7bd9331 100644
--- a/config/sources/families/imx6.conf
+++ b/config/sources/families/imx6.conf
@@ -16,8 +16,8 @@ case $BRANCH in
edge)
- export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
- KERNELBRANCH='branch:linux-5.17.y'
+ export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:linux-5.18.y'
;;
diff --git a/config/sources/families/include/meson_common.inc b/config/sources/families/include/meson_common.inc
index e83c382de..5b53ff90c 100644
--- a/config/sources/families/include/meson_common.inc
+++ b/config/sources/families/include/meson_common.inc
@@ -4,7 +4,6 @@ BOOTBRANCH='branch:odroidc-v2011.03'
BOOTDIR='u-boot-odroidc1'
UBOOT_COMPILER="arm-linux-gnueabihf-"
UBOOT_USE_GCC='< 4.9'
-BOOTSCRIPT="boot-odroid-c1.ini:boot.ini"
SERIALCON="ttyAML0"
UBOOT_TARGET_MAP=';;sd_fuse/bl1.bin.hardkernel sd_fuse/u-boot.bin'
SRC_LOADADDR='LOADADDR=0x00208000'
@@ -44,6 +43,19 @@ case $BRANCH in
;;
esac
+case $BOARD in
+ odroidc1)
+
+ BOOTSCRIPT="boot-odroid-c1.ini:boot.ini"
+
+ ;;
+ onecloud)
+
+ BOOTSCRIPT="boot-onecloud.cmd:boot.cmd"
+
+ ;;
+esac
+
write_uboot_platform() {
dd if=$1/bl1.bin.hardkernel of=$2 bs=1 count=442 conv=fsync > /dev/null 2>&1
dd if=$1/bl1.bin.hardkernel of=$2 bs=512 skip=1 seek=1 conv=fsync > /dev/null 2>&1
diff --git a/config/sources/families/include/rockchip64_common.inc b/config/sources/families/include/rockchip64_common.inc
index 7fc026892..be6951bff 100644
--- a/config/sources/families/include/rockchip64_common.inc
+++ b/config/sources/families/include/rockchip64_common.inc
@@ -116,14 +116,14 @@ esac
prepare_boot_configuration() {
if [[ $BOOT_SCENARIO == "blobless" ]]; then
- UBOOT_TARGET_MAP="BL31=bl31.bin idbloader.img u-boot.itb;;idbloader.img u-boot.itb"
+ UBOOT_TARGET_MAP="BL31=bl31.elf idbloader.img u-boot.itb;;idbloader.img u-boot.itb"
ATFSOURCE='https://github.com/ARM-software/arm-trusted-firmware'
ATF_COMPILER='aarch64-linux-gnu-'
ATFDIR='arm-trusted-firmware'
ATFBRANCH='tag:v2.6'
ATF_USE_GCC='> 6.3'
- ATF_TARGET_MAP="M0_CROSS_COMPILE=arm-linux-gnueabi- PLAT=$BOOT_SOC bl31;;build/$BOOT_SOC/release/bl31/bl31.elf:bl31.bin"
- ATF_TOOLCHAIN2="arm-linux-gnueabi-:> 5.0"
+ ATF_TARGET_MAP="M0_CROSS_COMPILE=arm-linux-gnueabi- PLAT=$BOOT_SOC bl31;;build/$BOOT_SOC/release/bl31/bl31.elf:bl31.elf"
+ ATF_TOOLCHAIN2="arm-linux-gnueabi-:< 10.0"
elif [[ $BOOT_SCENARIO == "tpl-spl-blob" ]]; then
@@ -148,7 +148,11 @@ prepare_boot_configuration() {
if [[ $BOOT_SUPPORT_SPI == yes ]]; then
- UBOOT_TARGET_MAP="BL31=$RKBIN_DIR/$BL31_BLOB tpl/u-boot-tpl.bin spl/u-boot-spl.bin u-boot.itb ${UBOOT_TARGET_MAP} rkspi_loader.img"
+ if [[ $BOARD != "rock-3a" ]]; then
+ UBOOT_TARGET_MAP="BL31=$RKBIN_DIR/$BL31_BLOB tpl/u-boot-tpl.bin spl/u-boot-spl.bin u-boot.itb ${UBOOT_TARGET_MAP} rkspi_loader.img"
+ else
+ UBOOT_TARGET_MAP="${UBOOT_TARGET_MAP} rkspi_loader.img"
+ fi
fi
}
@@ -175,10 +179,24 @@ uboot_custom_postprocess() {
fi
if [[ $BOOT_SUPPORT_SPI == yes ]]; then
- tools/mkimage -n $BOOT_SOC -T rkspi -d tpl/u-boot-tpl.bin:spl/u-boot-spl.bin rkspi_tpl_spl.img
- dd if=/dev/zero of=rkspi_loader.img count=8128 status=none
- dd if=rkspi_tpl_spl.img of=rkspi_loader.img conv=notrunc status=none
- dd if=u-boot.itb of=rkspi_loader.img seek=768 conv=notrunc status=none
+ if [[ $BOARD == "rock-3a" ]]; then
+ dd if=/dev/zero of=rkspi_loader.img bs=1M count=0 seek=16
+ /sbin/parted -s rkspi_loader.img mklabel gpt
+ /sbin/parted -s rkspi_loader.img unit s mkpart idbloader 64 7167
+ /sbin/parted -s rkspi_loader.img unit s mkpart vnvm 7168 7679
+ /sbin/parted -s rkspi_loader.img unit s mkpart reserved_space 7680 8063
+ /sbin/parted -s rkspi_loader.img unit s mkpart reserved1 8064 8127
+ /sbin/parted -s rkspi_loader.img unit s mkpart uboot_env 8128 8191
+ /sbin/parted -s rkspi_loader.img unit s mkpart reserved2 8192 16383
+ /sbin/parted -s rkspi_loader.img unit s mkpart uboot 16384 32734
+ dd if=idbloader.img of=rkspi_loader.img seek=64 conv=notrunc
+ dd if=u-boot.itb of=rkspi_loader.img seek=16384 conv=notrunc
+ else
+ tools/mkimage -n $BOOT_SOC -T rkspi -d tpl/u-boot-tpl.bin:spl/u-boot-spl.bin rkspi_tpl_spl.img
+ dd if=/dev/zero of=rkspi_loader.img count=8128 status=none
+ dd if=rkspi_tpl_spl.img of=rkspi_loader.img conv=notrunc status=none
+ dd if=u-boot.itb of=rkspi_loader.img seek=768 conv=notrunc status=none
+ fi
fi
}
diff --git a/config/sources/families/include/sunxi64_common.inc b/config/sources/families/include/sunxi64_common.inc
index 61addb39b..299d16253 100644
--- a/config/sources/families/include/sunxi64_common.inc
+++ b/config/sources/families/include/sunxi64_common.inc
@@ -26,9 +26,9 @@ case $BRANCH in
;;
edge)
- export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
- export KERNELBRANCH="branch:linux-5.17.y"
- export KERNELBRANCH_MEGOUS="branch:orange-pi-5.17"
+ export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
+ export KERNELBRANCH="branch:linux-5.18.y"
+ export KERNELBRANCH_MEGOUS="branch:orange-pi-5.18"
;;
esac
diff --git a/config/sources/families/include/sunxi_common.inc b/config/sources/families/include/sunxi_common.inc
index 8ac7a5551..9d120c711 100644
--- a/config/sources/families/include/sunxi_common.inc
+++ b/config/sources/families/include/sunxi_common.inc
@@ -27,9 +27,9 @@ case $BRANCH in
;;
edge)
- export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
- export KERNELBRANCH="branch:linux-5.17.y"
- export KERNELBRANCH_MEGOUS="branch:orange-pi-5.17"
+ export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
+ export KERNELBRANCH="branch:linux-5.18.y"
+ export KERNELBRANCH_MEGOUS="branch:orange-pi-5.18"
;;
esac
diff --git a/config/sources/families/include/uefi_common.inc b/config/sources/families/include/uefi_common.inc
index 821ed660a..699d09e4a 100644
--- a/config/sources/families/include/uefi_common.inc
+++ b/config/sources/families/include/uefi_common.inc
@@ -22,8 +22,8 @@ case "${BRANCH}" in
edge)
export DISTRO_GENERIC_KERNEL=no
export LINUXCONFIG="linux-uefi-${LINUXFAMILY}-${BRANCH}"
- export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel. For mainline caching.
- export KERNELBRANCH="branch:linux-5.17.y" # Branch or tag to build from. It should match MAJOR_MINOR
+ export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel. For mainline caching.
+ export KERNELBRANCH="branch:linux-5.18.y" # Branch or tag to build from. It should match MAJOR_MINOR
export KERNELPATCHDIR="uefi-${LINUXFAMILY}-${BRANCH}" # Might be empty.
;;
esac
diff --git a/config/sources/families/mvebu64.conf b/config/sources/families/mvebu64.conf
index fe35a0055..283761378 100644
--- a/config/sources/families/mvebu64.conf
+++ b/config/sources/families/mvebu64.conf
@@ -49,8 +49,8 @@ case $BRANCH in
;;
edge)
- export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
- KERNELBRANCH='branch:linux-5.17.y'
+ export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:linux-5.18.y'
;;
esac
@@ -75,14 +75,14 @@ family_tweaks() {
[[ -f $SDCARD/etc/netplan/armbian-default.yaml ]] && sed -i "s/^ renderer.*/ renderer: networkd/" $SDCARD/etc/netplan/armbian-default.yaml
cp $SRC/packages/bsp/mvebu64/networkd/10* $SDCARD/etc/systemd/network/
if [[ $BOARD = "espressobin" ]]; then
- echo "#Marvell Espressobin Console" >> $SDCARD/etc/securetty
- echo "ttyMV0" >> $SDCARD/etc/securetty
+ echo "#Marvell Espressobin Console" >> $SDCARD/etc/securetty
+ echo "ttyMV0" >> $SDCARD/etc/securetty
fi
}
family_tweaks_bsp() {
if [[ $BOARD = "espressobin" ]]; then
- cp "$SRC/packages/bsp/mvebu64/initramfs/99-uboot-fit" "$destination/etc/initramfs/post-update.d/"
+ cp "$SRC/packages/bsp/mvebu64/initramfs/99-uboot-fit" "$destination/etc/initramfs/post-update.d/"
fi
}
diff --git a/config/sources/families/odroidxu4.conf b/config/sources/families/odroidxu4.conf
index 992b2bbb2..75916a25b 100644
--- a/config/sources/families/odroidxu4.conf
+++ b/config/sources/families/odroidxu4.conf
@@ -25,8 +25,10 @@ case $BRANCH in
;;
edge)
- export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
- KERNELBRANCH='branch:linux-5.17.y'
+ KERNELSOURCE='https://github.com/tobetter/linux'
+ export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:odroid-5.18.y'
+ KERNELDIR='linux-odroidxu4'
;;
esac
diff --git a/config/sources/families/rk322x.conf b/config/sources/families/rk322x.conf
index d707d55c8..3c62bbab0 100644
--- a/config/sources/families/rk322x.conf
+++ b/config/sources/families/rk322x.conf
@@ -27,8 +27,8 @@ case $BRANCH in
edge)
- export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
- KERNELBRANCH='branch:linux-5.17.y'
+ export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:linux-5.18.y'
;;
diff --git a/config/sources/families/rockchip.conf b/config/sources/families/rockchip.conf
index a264c669f..c971cba34 100644
--- a/config/sources/families/rockchip.conf
+++ b/config/sources/families/rockchip.conf
@@ -6,9 +6,9 @@ OVERLAY_PREFIX='rockchip'
UBOOT_TARGET_MAP=";;$SRC/packages/blobs/rockchip/rk3288_boot.bin u-boot-rockchip-with-spl.bin"
BOOTDELAY=1
if [[ $BOARD == miqi ]]; then
-BOOTBRANCH='tag:v2017.11'
+ BOOTBRANCH='tag:v2017.11'
else
-BOOTBRANCH='tag:v2022.04'
+ BOOTBRANCH='tag:v2022.04'
fi
SERIALCON=ttyS2
@@ -33,8 +33,8 @@ case $BRANCH in
edge)
- export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
- KERNELBRANCH='branch:linux-5.17.y'
+ export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:linux-5.18.y'
;;
diff --git a/lib/functions/compilation/patch/kernel-drivers.sh b/lib/functions/compilation/patch/kernel-drivers.sh
index 91b5d5070..9df0b81ca 100644
--- a/lib/functions/compilation/patch/kernel-drivers.sh
+++ b/lib/functions/compilation/patch/kernel-drivers.sh
@@ -31,15 +31,14 @@ function prepare_extra_kernel_drivers() {
#
# Older versions have AUFS support with a patch
- if linux-version compare "${version}" ge 5.10 && linux-version compare "${version}" lt 5.15 && [ "$AUFS" == yes ]; then
- # @TODO: Fasthash for this whole block is only the git hash of revision we'd apply from Mr. Okajima
+ if linux-version compare "${version}" gt 5.11 && linux-version compare "${version}" lt 5.19 && [ "$AUFS" == yes ]; then
# attach to specifics tag or branch
local aufstag
aufstag=$(echo "${version}" | cut -f 1-2 -d ".")
# manual overrides
if linux-version compare "${version}" ge 5.10.82 && linux-version compare "${version}" le 5.11; then aufstag="5.10.82"; fi
- if linux-version compare "${version}" ge 5.15.5 && linux-version compare "${version}" le 5.16; then aufstag="5.15.5"; fi
+ if linux-version compare "${version}" ge 5.15.41 && linux-version compare "${version}" le 5.16; then aufstag="5.15.41"; fi
if linux-version compare "${version}" ge 5.17.3 && linux-version compare "${version}" le 5.18; then aufstag="5.17.3"; fi
# check if Mr. Okajima already made a branch for this version
@@ -276,14 +275,13 @@ function prepare_extra_kernel_drivers() {
# Wireless drivers for Realtek RTL8811CU and RTL8821C chipsets
if linux-version compare "${version}" ge 3.14 && [ "$EXTRAWIFI" == yes ]; then
- # @TODO: fasthash for this is... ? remote git hash?
# attach to specifics tag or branch
- local rtl8811cuver="commit:2bebdb9a35c1d9b6e6a928e371fa39d5fcec8a62"
+ local rtl8811cuver="commit:8c2226a74ae718439d56248bd2e44ccf717086d5"
display_alert "Adding" "Wireless drivers for Realtek RTL8811CU and RTL8821C chipsets ${rtl8811cuver}" "info"
- fetch_from_repo "https://github.com/brektrou/rtl8821CU" "rtl8811cu" "${rtl8811cuver}" "yes"
+ fetch_from_repo "$GITHUB_SOURCE/brektrou/rtl8821CU" "rtl8811cu" "${rtl8811cuver}" "yes"
cd "$kerneldir" || exit
rm -rf "$kerneldir/drivers/net/wireless/rtl8811cu"
mkdir -p "$kerneldir/drivers/net/wireless/rtl8811cu/"
@@ -303,7 +301,7 @@ function prepare_extra_kernel_drivers() {
sed -i "s/^CONFIG_RTW_DEBUG.*/CONFIG_RTW_DEBUG = n/" \
"$kerneldir/drivers/net/wireless/rtl8811cu/Makefile"
- # Address ARM related bug https://github.com/aircrack-ng/rtl8812au/issues/233
+ # Address ARM related bug $GITHUB_SOURCE/aircrack-ng/rtl8812au/issues/233
sed -i "s/^CONFIG_MP_VHT_HW_TX_MODE.*/CONFIG_MP_VHT_HW_TX_MODE = n/" \
"$kerneldir/drivers/net/wireless/rtl8811cu/Makefile"
@@ -312,8 +310,8 @@ function prepare_extra_kernel_drivers() {
sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8811cu\/Kconfig"' \
"$kerneldir/drivers/net/wireless/Kconfig"
- # add support for K5.17+
- process_patch_file "${SRC}/patch/misc/wireless-realtek-8811cu-5.17.patch" "applying"
+ # add support for 5.18.y
+ process_patch_file "${SRC}/patch/misc/wireless-rtl8821cu.patch" "applying"
fi
diff --git a/lib/functions/compilation/uboot.sh b/lib/functions/compilation/uboot.sh
index 699946406..af62d3c4d 100644
--- a/lib/functions/compilation/uboot.sh
+++ b/lib/functions/compilation/uboot.sh
@@ -32,8 +32,9 @@ function compile_uboot_target() {
if [[ -n $ATFSOURCE && -d "${atftempdir}" ]]; then
display_alert "Copying over bins from atftempdir" "${atftempdir}" "debug"
- cp -Rv "${atftempdir}"/*.bin .
- rm -rf "${atftempdir}"
+ run_host_command_logged cp -Rv "${atftempdir}"/*.bin .
+ run_host_command_logged cp -Rv "${atftempdir}"/*.elf .
+ run_host_command_logged rm -rf "${atftempdir}"
fi
display_alert "${uboot_prefix}Preparing u-boot config" "${version} ${target_make}" "info"
diff --git a/lib/functions/extras/buildpkg.sh b/lib/functions/extras/buildpkg.sh
index e79924426..8bd4f046f 100644
--- a/lib/functions/extras/buildpkg.sh
+++ b/lib/functions/extras/buildpkg.sh
@@ -36,7 +36,7 @@ create_chroot() {
components['focal']='main,universe,multiverse'
components['jammy']='main,universe,multiverse'
display_alert "Creating build chroot" "$release/$arch" "info"
- local includes="ccache,locales,git,ca-certificates,devscripts,libfile-fcntllock-perl,debhelper,rsync,python3,distcc,apt-utils"
+ local includes="ccache,locales,git,ca-certificates,libfile-fcntllock-perl,rsync,python3,distcc,apt-utils"
# perhaps a temporally workaround
case $release in
@@ -68,9 +68,15 @@ create_chroot() {
mkdir -p "${target_dir}"/usr/share/keyrings/ &&
cp /usr/share/keyrings/debian-archive-keyring.gpg "${target_dir}"/usr/share/keyrings/
- chroot "${target_dir}" /bin/bash -c "/debootstrap/debootstrap --second-stage"
+ eval 'LC_ALL=C LANG=C chroot "${target_dir}" \
+ /bin/bash -c "/debootstrap/debootstrap --second-stage"'
[[ $? -ne 0 || ! -f "${target_dir}"/bin/bash ]] && exit_with_error "Create chroot second stage failed"
+ [[ -f "${target_dir}"/etc/locale.gen ]] &&
+ sed -i '/en_US.UTF-8/s/^# //g' "${target_dir}"/etc/locale.gen
+ eval 'LC_ALL=C LANG=C chroot "${target_dir}" \
+ /bin/bash -c "locale-gen; update-locale --reset LANG=en_US.UTF-8"'
+
create_sources_list "$release" "${target_dir}"
[[ $NO_APT_CACHER != yes ]] &&
echo 'Acquire::http { Proxy "http://localhost:3142"; };' > "${target_dir}"/etc/apt/apt.conf.d/02proxy
@@ -78,9 +84,6 @@ create_chroot() {
APT::Install-Recommends "0";
APT::Install-Suggests "0";
EOF
- [[ -f "${target_dir}"/etc/locale.gen ]] &&
- sed -i "s/^# en_US.UTF-8/en_US.UTF-8/" "${target_dir}"/etc/locale.gen
- chroot "${target_dir}" /bin/bash -c "locale-gen; update-locale LANG=en_US:en LC_ALL=en_US.UTF-8"
printf '#!/bin/sh\nexit 101' > "${target_dir}"/usr/sbin/policy-rc.d
chmod 755 "${target_dir}"/usr/sbin/policy-rc.d
@@ -93,15 +96,25 @@ create_chroot() {
rm -rf "${target_dir}"/var/lock 2> /dev/null
mkdir -p "${target_dir}"/var/lock
fi
- chroot "${target_dir}" /bin/bash -c "/usr/sbin/update-ccache-symlinks"
+ eval 'LC_ALL=C LANG=C chroot "${target_dir}" \
+ /bin/bash -c "/usr/sbin/update-ccache-symlinks"'
display_alert "Upgrading packages in" "${target_dir}" "info"
- chroot "${target_dir}" /bin/bash -c "apt-get -q update; apt-get -q -y upgrade; apt-get clean"
+ eval 'LC_ALL=C LANG=C chroot "${target_dir}" \
+ /bin/bash -c "apt-get -q update; apt-get -q -y upgrade; apt-get clean"'
date +%s > "$target_dir/root/.update-timestamp"
+ # Install some packages with a large list of dependencies after the update.
+ # This optimizes the process and eliminates looping when calculating
+ # dependencies.
+ eval 'LC_ALL=C LANG=C chroot "${target_dir}" \
+ /bin/bash -c "apt-get install \
+ -q -y --no-install-recommends debhelper devscripts"'
+
case $release in
bullseye | focal | hirsute | sid)
- chroot "${target_dir}" /bin/bash -c "apt-get install python-is-python3"
+ eval 'LC_ALL=C LANG=C chroot "${target_dir}" \
+ /bin/bash -c "apt-get install python-is-python3"'
;;
esac
diff --git a/lib/functions/host/prepare-host.sh b/lib/functions/host/prepare-host.sh
index 0acd721b0..99fbbf787 100644
--- a/lib/functions/host/prepare-host.sh
+++ b/lib/functions/host/prepare-host.sh
@@ -34,7 +34,7 @@ prepare_host() {
debian-archive-keyring debian-keyring debootstrap device-tree-compiler
dialog dirmngr dosfstools dwarves f2fs-tools fakeroot flex gawk
gnupg gpg imagemagick jq kmod libbison-dev
- libelf-dev libfdt-dev libfile-fcntllock-perl
+ libelf-dev libfdt-dev libfile-fcntllock-perl libmpc-dev
libfl-dev liblz4-tool libncurses-dev libssl-dev
libusb-1.0-0-dev linux-base locales ncurses-base ncurses-term
ntpdate patchutils
diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh
index e3d2220e0..471050a30 100644
--- a/lib/functions/image/partitioning.sh
+++ b/lib/functions/image/partitioning.sh
@@ -230,7 +230,7 @@ function prepare_partitions() {
check_loop_device "$LOOP"
- run_host_command_logged losetup $LOOP ${SDCARD}.raw
+ run_host_command_logged losetup -P $LOOP ${SDCARD}.raw
# loop device was grabbed here, unlock
flock -u $FD
From 3459a57c661ce495eba407216a8c38f6f297b617 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 28 May 2022 12:44:49 +0200
Subject: [PATCH] armbian-next: manual merge (21) of all changes between
revisions e7d7dab1bb50c1172206629a44f983c1794f8359 and
0eb8fe7497aebf341bead2b3b0fb7309fd7bdc14
---
config/sources/families/include/meson_common.inc | 22 +++---
.../sources/families/include/rockchip64_common.inc | 6 +-
config/sources/families/media.conf | 4 +-
config/sources/families/mvebu64.conf | 8 ++-
config/sources/families/sun50iw9.conf | 2 +-
lib/functions/compilation/debs.sh | 4 +-
lib/functions/compilation/patch/kernel-drivers.sh | 78 ++++++++++++++++------
lib/functions/host/prepare-host.sh | 2 +-
lib/functions/image/partitioning.sh | 2 +-
9 files changed, 88 insertions(+), 40 deletions(-)
diff --git a/config/sources/families/include/meson_common.inc b/config/sources/families/include/meson_common.inc
index d24ac85ee..e83c382de 100644
--- a/config/sources/families/include/meson_common.inc
+++ b/config/sources/families/include/meson_common.inc
@@ -17,23 +17,29 @@ GOVERNOR=ondemand
case $BRANCH in
legacy)
- export KERNEL_MAJOR_MINOR="5.4" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.4.y"
+ export KERNEL_MAJOR_MINOR="5.11" # Major and minor versions of this kernel.
+ KERNELBRANCH="branch:linux-5.11.y"
KERNELPATCHDIR='meson-'$BRANCH
+ BUILD_DESKTOP=no
+
;;
current)
- export KERNEL_MAJOR_MINOR="5.10" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.10.y"
- KERNELPATCHDIR='meson-current'
+ export KERNEL_MAJOR_MINOR="5.14" # Major and minor versions of this kernel.
+ KERNELBRANCH="branch:linux-5.14.y"
+ KERNELPATCHDIR='meson-'$BRANCH
+
+ BUILD_DESKTOP=no
;;
edge)
- export KERNEL_MAJOR_MINOR="5.11" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.11.y"
- KERNELPATCHDIR='meson-current'
+ KERNELDIR='linux-meson'
+ KERNELSOURCE='https://github.com/xdarklight/linux'
+ export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
+ KERNELBRANCH="branch:meson-mx-integration-5.18-20220417"
+ KERNELPATCHDIR='meson-'$BRANCH
;;
esac
diff --git a/config/sources/families/include/rockchip64_common.inc b/config/sources/families/include/rockchip64_common.inc
index 42e028e7d..7fc026892 100644
--- a/config/sources/families/include/rockchip64_common.inc
+++ b/config/sources/families/include/rockchip64_common.inc
@@ -104,8 +104,8 @@ case $BRANCH in
edge)
KERNELPATCHDIR='rockchip64-'$BRANCH
- export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.17.y"
+ export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
+ KERNELBRANCH="branch:linux-5.18.y"
LINUXFAMILY=rockchip64
LINUXCONFIG='linux-rockchip64-'$BRANCH
@@ -278,8 +278,6 @@ family_tweaks() {
cp -R $SRC/packages/blobs/rtl8723bt_fw/* $SDCARD/lib/firmware/rtl_bt/
cp -R $SRC/packages/blobs/station/firmware/* $SDCARD/lib/firmware/
if [[ $BRANCH == legacy && ($BOARD == station-m1) ]]; then
- cp $SRC/packages/blobs/rtl8723bt_fw/rtl8723ds_config.bin $SDCARD/lib/firmware/rtlbt/rtl8723d_config
- cp $SRC/packages/blobs/rtl8723bt_fw/rtl8723ds_fw.bin $SDCARD/lib/firmware/rtlbt/rtl8723d_fw
install -m 755 $SRC/packages/bsp/rk3328/m1/rtk_hciattach $SDCARD/usr/bin/rtk_hciattach
sed -e 's/exit 0//g' -i $SDCARD/etc/rc.local
echo "su -c '/usr/bin/rtk_hciattach -n -s 115200 /dev/ttyS2 rtk_h5 &'" >> $SDCARD/etc/rc.local
diff --git a/config/sources/families/media.conf b/config/sources/families/media.conf
index 747eb86a5..3b5bbe589 100644
--- a/config/sources/families/media.conf
+++ b/config/sources/families/media.conf
@@ -46,7 +46,7 @@ case $BRANCH in
current)
export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
KERNELBRANCH="branch:linux-5.17.y"
- KERNELBRANCH="tag:v5.17.5"
+ KERNELBRANCH="tag:v5.17.9"
KERNELPATCHDIR='media-'$BRANCH
LINUXFAMILY=media
LINUXCONFIG='linux-media-'$BRANCH
@@ -55,7 +55,7 @@ case $BRANCH in
edge)
export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
KERNELBRANCH="branch:linux-5.18.y"
- KERNELBRANCH="tag:v5.18-rc5"
+ KERNELBRANCH="tag:v5.18"
KERNELPATCHDIR='media-'$BRANCH
LINUXFAMILY=media
LINUXCONFIG='linux-media-'$BRANCH
diff --git a/config/sources/families/mvebu64.conf b/config/sources/families/mvebu64.conf
index d9ae12786..fe35a0055 100644
--- a/config/sources/families/mvebu64.conf
+++ b/config/sources/families/mvebu64.conf
@@ -2,7 +2,7 @@ enable_extension "marvell-tools"
ARCH=arm64
BOOTBRANCH='branch:v2022.04'
BOOTENV_FILE='mvebu64.txt'
-BOOTSCRIPT_OUTPUT='boot.scr.uimg'
+BOOTSCRIPT_OUTPUT='boot.scr'
ATFSOURCE='https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git'
ATFDIR='arm-trusted-firmware-espressobin'
ATFBRANCH='branch:master'
@@ -74,12 +74,16 @@ family_tweaks() {
chroot_sdcard_apt_get remove --auto-remove linux-sound-base alsa-base alsa-utils bluez
[[ -f $SDCARD/etc/netplan/armbian-default.yaml ]] && sed -i "s/^ renderer.*/ renderer: networkd/" $SDCARD/etc/netplan/armbian-default.yaml
cp $SRC/packages/bsp/mvebu64/networkd/10* $SDCARD/etc/systemd/network/
+ if [[ $BOARD = "espressobin" ]]; then
echo "#Marvell Espressobin Console" >> $SDCARD/etc/securetty
echo "ttyMV0" >> $SDCARD/etc/securetty
+ fi
}
family_tweaks_bsp() {
+ if [[ $BOARD = "espressobin" ]]; then
cp "$SRC/packages/bsp/mvebu64/initramfs/99-uboot-fit" "$destination/etc/initramfs/post-update.d/"
+ fi
}
atf_custom_postprocess() {
@@ -110,7 +114,7 @@ uboot_custom_postprocess() {
display_alert "Building $FILENAME" "" "info"
# http://wiki.macchiatobin.net/tiki-index.php?page=Build+from+source+-+Bootloader#Building_ATF
run_host_command_logged make distclean
- run_host_command_logged make USE_COHERENT_MEM=0 LOG_LEVEL=20 MV_DDR_PATH=$SRC/cache/sources/marvell-ddr PLAT=a80x0_mcbin CROSS_COMPILE=$ATF1 BL33=$BL33 all fip $CTHREADS
+ run_host_command_logged make USE_COHERENT_MEM=0 LOG_LEVEL=20 MV_DDR_PATH=$SRC/cache/sources/marvell-ddr PLAT=a80x0_mcbin CROSS_COMPILE=$ATF1 BL33=$BL33 mrvl_flash $CTHREADS
run_host_command_logged cp -pv build/a80x0_mcbin/release/flash-image.bin $ubootdir/$FILENAME
else
cd $moxbootdir
diff --git a/config/sources/families/sun50iw9.conf b/config/sources/families/sun50iw9.conf
index c8b311493..c314ea1ee 100644
--- a/config/sources/families/sun50iw9.conf
+++ b/config/sources/families/sun50iw9.conf
@@ -43,7 +43,7 @@ case $BRANCH in
ATFBRANCH='branch:master'
ATF_PLAT="sun50i_h616"
ATF_TARGET_MAP='PLAT=sun50i_h616 DEBUG=1 bl31;;build/sun50i_h616/debug/bl31.bin'
- LINUXCONFIG='linux-sunxi64-edge'
+ BOOTSCRIPT='boot-sun50i-next.cmd:boot.cmd'
;;
esac
diff --git a/lib/functions/compilation/debs.sh b/lib/functions/compilation/debs.sh
index 6e52631c8..3db0c44d4 100644
--- a/lib/functions/compilation/debs.sh
+++ b/lib/functions/compilation/debs.sh
@@ -56,8 +56,8 @@ compile_armbian-zsh() {
armbian_zsh_dir=armbian-zsh_${REVISION}_all
display_alert "Building deb" "armbian-zsh" "info"
- fetch_from_repo "https://github.com/robbyrussell/oh-my-zsh" "oh-my-zsh" "branch:master"
- fetch_from_repo "https://github.com/mroth/evalcache" "evalcache" "branch:master"
+ fetch_from_repo "$GITHUB_SOURCE/ohmyzsh/ohmyzsh" "oh-my-zsh" "branch:master"
+ fetch_from_repo "$GITHUB_SOURCE/mroth/evalcache" "evalcache" "branch:master"
mkdir -p "${tmp_dir}/${armbian_zsh_dir}"/{DEBIAN,etc/skel/,etc/oh-my-zsh/,/etc/skel/.oh-my-zsh/cache}
diff --git a/lib/functions/compilation/patch/kernel-drivers.sh b/lib/functions/compilation/patch/kernel-drivers.sh
index 8529e4ba1..91b5d5070 100644
--- a/lib/functions/compilation/patch/kernel-drivers.sh
+++ b/lib/functions/compilation/patch/kernel-drivers.sh
@@ -31,32 +31,38 @@ function prepare_extra_kernel_drivers() {
#
# Older versions have AUFS support with a patch
- if linux-version compare "${version}" ge 5.1 && linux-version compare "${version}" lt 5.15 && [ "$AUFS" == yes ]; then
+ if linux-version compare "${version}" ge 5.10 && linux-version compare "${version}" lt 5.15 && [ "$AUFS" == yes ]; then
# @TODO: Fasthash for this whole block is only the git hash of revision we'd apply from Mr. Okajima
- local aufs_tag # attach to specifics tag or branch
- aufs_tag=$(echo "${version}" | cut -f 1-2 -d ".")
+ # attach to specifics tag or branch
+ local aufstag
+ aufstag=$(echo "${version}" | cut -f 1-2 -d ".")
# manual overrides
- if linux-version compare "${version}" ge 5.4.3 && linux-version compare "${version}" le 5.5; then aufstag="5.4.3"; fi
if linux-version compare "${version}" ge 5.10.82 && linux-version compare "${version}" le 5.11; then aufstag="5.10.82"; fi
if linux-version compare "${version}" ge 5.15.5 && linux-version compare "${version}" le 5.16; then aufstag="5.15.5"; fi
if linux-version compare "${version}" ge 5.17.3 && linux-version compare "${version}" le 5.18; then aufstag="5.17.3"; fi
- # check if Mr. Okajima already made a branch for this version, otherwise use RC.
- git ls-remote --exit-code --heads https://github.com/sfjro/aufs5-standalone "aufs${aufs_tag}" > /dev/null || {
- aufs_tag="5.x-rcN" # then use rc branch
- git ls-remote --exit-code --heads https://github.com/sfjro/aufs5-standalone "aufs${aufs_tag}" > /dev/null
- }
- display_alert "Adding" "AUFS ${aufs_tag}" "info"
- local aufs_branch="branch:aufs${aufs_tag}"
- fetch_from_repo "https://github.com/sfjro/aufs5-standalone" "aufs5" "branch:${aufs_branch}" "yes"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/cache/sources/aufs5/${aufs_branch#*:}/aufs5-kbuild.patch" "applying"
- process_patch_file "${SRC}/cache/sources/aufs5/${aufs_branch#*:}/aufs5-base.patch" "applying"
- process_patch_file "${SRC}/cache/sources/aufs5/${aufs_branch#*:}/aufs5-mmap.patch" "applying"
- process_patch_file "${SRC}/cache/sources/aufs5/${aufs_branch#*:}/aufs5-standalone.patch" "applying"
- cp -R "${SRC}/cache/sources/aufs5/${aufs_branch#*:}"/{Documentation,fs} .
- cp "${SRC}/cache/sources/aufs5/${aufs_branch#*:}"/include/uapi/linux/aufs_type.h include/uapi/linux/
+ # check if Mr. Okajima already made a branch for this version
+ improved_git ls-remote --exit-code --heads $GITHUB_SOURCE/sfjro/aufs5-standalone "aufs${aufstag}" > /dev/null
+
+ if [ "$?" -ne "0" ]; then
+ # then use rc branch
+ aufstag="5.x-rcN"
+ improved_git ls-remote --exit-code --heads $GITHUB_SOURCE/sfjro/aufs5-standalone "aufs${aufstag}" > /dev/null
+ fi
+
+ if [ "$?" -eq "0" ]; then
+ display_alert "Adding" "AUFS ${aufstag}" "info"
+ local aufsver="branch:aufs${aufstag}"
+ fetch_from_repo "$GITHUB_SOURCE/sfjro/aufs5-standalone" "aufs5" "branch:${aufsver}" "yes"
+ cd "$kerneldir" || exit
+ process_patch_file "${SRC}/cache/sources/aufs5/${aufsver#*:}/aufs5-kbuild.patch" "applying"
+ process_patch_file "${SRC}/cache/sources/aufs5/${aufsver#*:}/aufs5-base.patch" "applying"
+ process_patch_file "${SRC}/cache/sources/aufs5/${aufsver#*:}/aufs5-mmap.patch" "applying"
+ process_patch_file "${SRC}/cache/sources/aufs5/${aufsver#*:}/aufs5-standalone.patch" "applying"
+ cp -R "${SRC}/cache/sources/aufs5/${aufsver#*:}"/{Documentation,fs} .
+ cp "${SRC}/cache/sources/aufs5/${aufsver#*:}"/include/uapi/linux/aufs_type.h include/uapi/linux/
+ fi
fi
# WireGuard VPN for Linux 3.10 - 5.5
@@ -546,6 +552,40 @@ function prepare_extra_kernel_drivers() {
fi
+ # Exfat driver
+
+ if linux-version compare "${version}" ge 4.9 && linux-version compare "${version}" le 5.4; then
+
+ # attach to specifics tag or branch
+ display_alert "Adding" "exfat driver ${exfatsver}" "info"
+
+ local exfatsver="branch:master"
+ fetch_from_repo "$GITHUB_SOURCE/arter97/exfat-linux" "exfat" "${exfatsver}" "yes"
+ cd "$kerneldir" || exit
+ mkdir -p $kerneldir/fs/exfat/
+ cp -R "${SRC}/cache/sources/exfat/${exfatsver#*:}"/{*.c,*.h} \
+ $kerneldir/fs/exfat/
+
+ # Add to section Makefile
+ echo "obj-\$(CONFIG_EXFAT_FS) += exfat/" >> $kerneldir/fs/Makefile
+
+ # Makefile
+ cat <<- EOF > "$kerneldir/fs/exfat/Makefile"
+ # SPDX-License-Identifier: GPL-2.0-or-later
+ #
+ # Makefile for the linux exFAT filesystem support.
+ #
+ obj-\$(CONFIG_EXFAT_FS) += exfat.o
+ exfat-y := inode.o namei.o dir.o super.o fatent.o cache.o nls.o misc.o file.o balloc.o xattr.o
+ EOF
+
+ # Kconfig
+ sed -i '$i\source "fs\/exfat\/Kconfig"' $kerneldir/fs/Kconfig
+ cp "${SRC}/cache/sources/exfat/${exfatsver#*:}/Kconfig" \
+ "$kerneldir/fs/exfat/Kconfig"
+
+ fi
+
if linux-version compare $version ge 4.4 && linux-version compare $version lt 5.8; then
display_alert "Adjusting" "Framebuffer driver for ST7789 IPS display" "info"
process_patch_file "${SRC}/patch/misc/fbtft-st7789v-invert-color.patch" "applying"
diff --git a/lib/functions/host/prepare-host.sh b/lib/functions/host/prepare-host.sh
index c5045e966..0acd721b0 100644
--- a/lib/functions/host/prepare-host.sh
+++ b/lib/functions/host/prepare-host.sh
@@ -40,7 +40,7 @@ prepare_host() {
ntpdate patchutils
pkg-config pv python3-dev python3-distutils qemu-user-static rsync swig
systemd-container u-boot-tools udev uuid-dev whiptail
- zlib1g-dev
+ zlib1g-dev busybox
# python2, including headers, mostly used by some u-boot builds (2017 et al, odroidxu4 and others).
python2 python2-dev
diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh
index b06055335..e3d2220e0 100644
--- a/lib/functions/image/partitioning.sh
+++ b/lib/functions/image/partitioning.sh
@@ -336,7 +336,7 @@ function prepare_partitions() {
# if we have a headless device, set console to DEFAULT_CONSOLE
if [[ -n $DEFAULT_CONSOLE && -f $SDCARD/boot/armbianEnv.txt ]]; then
if grep -lq "^console=" $SDCARD/boot/armbianEnv.txt; then
- sed -i "s/console=.*/console=$DEFAULT_CONSOLE/" $SDCARD/boot/armbianEnv.txt
+ sed -i "s/^console=.*/console=$DEFAULT_CONSOLE/" $SDCARD/boot/armbianEnv.txt
else
echo "console=$DEFAULT_CONSOLE" >> $SDCARD/boot/armbianEnv.txt
fi
From e4d0f9c279b4b8859b23e4828579337ea415f175 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 23 May 2022 20:35:54 +0200
Subject: [PATCH] armbian-next: fix: patching CREATE_PATCHES=yes
- needed to create output dir
---
lib/functions/compilation/patch/patching.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/functions/compilation/patch/patching.sh b/lib/functions/compilation/patch/patching.sh
index 3b7762707..fd7e3e594 100644
--- a/lib/functions/compilation/patch/patching.sh
+++ b/lib/functions/compilation/patch/patching.sh
@@ -148,6 +148,7 @@ userpatch_create() {
git add .
git -c user.name='Armbian User' -c user.email='user@example.org' commit -q -m "Cleaning working copy"
+ mkdir -p "${DEST}/patch"
local patch="$DEST/patch/$1-$LINUXFAMILY-$BRANCH.patch"
# apply previous user debug mode created patches
From 2058ba0f88aa1196667089faedd64e469c7d7f32 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 21 May 2022 21:36:33 +0200
Subject: [PATCH] armbian-next: add `python2-dev` dep for old uboots
- cleanup some comments
---
lib/functions/host/prepare-host.sh | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/lib/functions/host/prepare-host.sh b/lib/functions/host/prepare-host.sh
index 55ae01988..c5045e966 100644
--- a/lib/functions/host/prepare-host.sh
+++ b/lib/functions/host/prepare-host.sh
@@ -42,8 +42,8 @@ prepare_host() {
systemd-container u-boot-tools udev uuid-dev whiptail
zlib1g-dev
- # python2, mostly used by some u-boot builds (2018 et al, odroidxu4 and others).
- python2
+ # python2, including headers, mostly used by some u-boot builds (2017 et al, odroidxu4 and others).
+ python2 python2-dev
# non-mess below?
file ccze colorized-logs tree # logging utilities
@@ -59,10 +59,8 @@ prepare_host() {
if [[ $(dpkg --print-architecture) == amd64 ]]; then
:
- #host_dependencies+=(distcc lib32ncurses-dev lib32stdc++6 libc6-i386)
- #grep -q i386 <(dpkg --print-foreign-architectures) || dpkg --add-architecture i386 # @TODO: WHY?! don't do this! we don't want 32-bit x86 ever
elif [[ $(dpkg --print-architecture) == arm64 ]]; then
- host_dependencies+=(libc6 libc6-amd64-cross qemu) # What?
+ host_dependencies+=(libc6-amd64-cross qemu) # Support for running x86 binaries on ARM64 under qemu.
else
display_alert "Please read documentation to set up proper compilation environment"
display_alert "https://www.armbian.com/using-armbian-tools/"
From 79185a3bad52301322e806a22103922b430f99fc Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 21 May 2022 18:52:18 +0200
Subject: [PATCH] armbian-next: manual merge (20) of all changes between
revisions 6b72ae3c864fc020c6aadea473997ca033a0d8cc and
247c4c45fd18aa370575998443fc837466c02971
---
.../sources/families/include/rockchip64_common.inc | 36 ++++++++++++++++++++--
lib/functions/compilation/debs.sh | 5 +--
lib/functions/extras/buildpkg.sh | 5 ++-
lib/functions/image/fingerprint.sh | 1 +
4 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/config/sources/families/include/rockchip64_common.inc b/config/sources/families/include/rockchip64_common.inc
index 21d07fda2..42e028e7d 100644
--- a/config/sources/families/include/rockchip64_common.inc
+++ b/config/sources/families/include/rockchip64_common.inc
@@ -297,12 +297,44 @@ family_tweaks_bsp() {
cat <<- EOF > "$destination"/etc/X11/xorg.conf.d/02-driver.conf
# set fbdev as default driver.
Section "Device"
- Identifier "NOGPU"
- Driver "fbdev"
+ Identifier "NOGPU"
+ Driver "fbdev"
EndSection
EOF
fi
+ if [[ $BOARD == clockworkpi-a06 ]]; then
+ # rotate screen & disable dpms
+ mkdir -p "$destination"/etc/X11/xorg.conf.d
+ cat <<- EOF > "$destination"/etc/X11/xorg.conf.d/10-monitor.conf
+ # set monitor
+ Section "Monitor"
+ Identifier "DSI-1"
+ Option "Rotate" "right"
+ Option "DPMS" "false"
+ EndSection
+
+ Section "ServerLayout"
+ Identifier "ServerLayout0"
+ Option "BlankTime" "0"
+ Option "StandbyTime" "0"
+ Option "SuspendTime" "0"
+ Option "OffTime" "0"
+ EndSection
+ EOF
+ # fan support
+ install -Dm644 $SRC/packages/bsp/clockworkpi-a06/temp_fan_daemon_a06.py $destination/usr/share/clockworkpi-a06-fan-daemon/bin/temp_fan_daemon_a06.py
+ cp $SRC/packages/bsp/clockworkpi-a06/clockworkpi-a06-fan-daemon.service $destination/lib/systemd/system/
+
+ # alsa-ucm-conf profile for DevTerm A06
+ mkdir -p $destination/usr/share/alsa/ucm2/Rockchip/es8388
+ install -Dm644 $SRC/packages/bsp/clockworkpi-a06/es8388.conf $destination/usr/share/alsa/ucm2/Rockchip/es8388/es8388.conf
+ install -Dm644 $SRC/packages/bsp/clockworkpi-a06/HiFi.conf $destination/usr/share/alsa/ucm2/Rockchip/es8388/HiFi.conf
+ mkdir -p $destination/usr/share/alsa/ucm2/conf.d/simple-card
+ ln -sfv /usr/share/alsa/ucm2/Rockchip/es8388/es8388.conf \
+ $destination/usr/share/alsa/ucm2/conf.d/simple-card/rockchip,es8388-codec.conf
+ fi
+
if [[ $BOARD == z28pro ]]; then
mkdir -p $destination/usr/local/bin
diff --git a/lib/functions/compilation/debs.sh b/lib/functions/compilation/debs.sh
index 8816314af..6e52631c8 100644
--- a/lib/functions/compilation/debs.sh
+++ b/lib/functions/compilation/debs.sh
@@ -105,11 +105,8 @@ compile_armbian-zsh() {
# define theme
sed -i 's/^ZSH_THEME=.*/ZSH_THEME="mrtazz"/' "${tmp_dir}/${armbian_zsh_dir}"/etc/skel/.zshrc
- # disable prompt while update
- sed -i 's/# DISABLE_UPDATE_PROMPT="true"/DISABLE_UPDATE_PROMPT="true"/g' "${tmp_dir}/${armbian_zsh_dir}"/etc/skel/.zshrc
-
# disable auto update since we provide update via package
- sed -i 's/# DISABLE_AUTO_UPDATE="true"/DISABLE_AUTO_UPDATE="true"/g' "${tmp_dir}/${armbian_zsh_dir}"/etc/skel/.zshrc
+ sed -i "s/^# zstyle ':omz:update' mode disabled.*/zstyle ':omz:update' mode disabled/g" "${tmp_dir}/${armbian_zsh_dir}"/etc/skel/.zshrc
# define default plugins
sed -i 's/^plugins=.*/plugins=(evalcache git git-extras debian tmux screen history extract colorize web-search docker)/' "${tmp_dir}/${armbian_zsh_dir}"/etc/skel/.zshrc
diff --git a/lib/functions/extras/buildpkg.sh b/lib/functions/extras/buildpkg.sh
index 09dd5d2e6..e79924426 100644
--- a/lib/functions/extras/buildpkg.sh
+++ b/lib/functions/extras/buildpkg.sh
@@ -351,9 +351,8 @@ create_build_script() {
package_builddeps="$package_builddeps"
if [ -z "\$package_builddeps" ]; then
- # Calculate build dependencies by a standard function and
- # еxclude special comparison characters like "|" "(>= 9)"
- package_builddeps="\$(dpkg-checkbuilddeps |& awk -F":" '{gsub(/[|]|[(].*[)]/, " ", \$0); print \$NF}')"
+ # Calculate build dependencies by a standard dpkg function
+ package_builddeps="\$(dpkg-checkbuilddeps |& awk -F":" '{print \$NF}')"
fi
if [[ -n "\${package_builddeps}" ]]; then
install_pkg_deb \${package_builddeps}
diff --git a/lib/functions/image/fingerprint.sh b/lib/functions/image/fingerprint.sh
index 566f76faf..6fc7c43fb 100644
--- a/lib/functions/image/fingerprint.sh
+++ b/lib/functions/image/fingerprint.sh
@@ -8,6 +8,7 @@ fingerprint_image() {
Title: ${VENDOR} $REVISION ${BOARD^} $BRANCH
Kernel: Linux $VER
Build date: $(date +'%d.%m.%Y')
+ Builder rev: ${BUILD_REPOSITORY_COMMIT}
Maintainer: $MAINTAINER <$MAINTAINERMAIL>
Authors: https://www.armbian.com/authors
Sources: https://github.com/armbian/
From 449ce337d3997a00b867dcb9baae9624983fefdb Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 21 May 2022 16:22:58 +0200
Subject: [PATCH] armbian-next: fix: pass `TERM` to kernel's make, so `make
menuconfig` can work
---
lib/functions/compilation/kernel.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 3ecc4c3d6..ee54c8453 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -7,6 +7,7 @@ function run_kernel_make() {
"PATH=\"${toolchain}:${PATH}\"" # Insert the toolchain first into the PATH.
"DPKG_COLORS=always" # Use colors for dpkg
"XZ_OPT='--threads=0'" # Use parallel XZ compression
+ "TERM='${TERM}'" # Pass the terminal type, so that 'make menuconfig' can work.
)
common_make_params_quoted=(
From 61c3306cdf3f79c318f93aa677b26da072d003bc Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 18 May 2022 11:49:04 +0200
Subject: [PATCH] armbian-next: fix: git: read commit UNIX timestamp/local date
correctly
- `checked_out_revision_ts` was correct; git outputs `%ct` as a UNIX timestamp, UTC-based
- `checked_out_revision_mtime` was incorrect: git output it without converting to local time
- manually convert using `date @xx` so it has correct local time, whatever it is.
- add debugging to `get_file_modification_time()` too
---
lib/functions/compilation/patch/fasthash.sh | 1 +
lib/functions/general/git.sh | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/functions/compilation/patch/fasthash.sh b/lib/functions/compilation/patch/fasthash.sh
index 771837b89..26874517f 100644
--- a/lib/functions/compilation/patch/fasthash.sh
+++ b/lib/functions/compilation/patch/fasthash.sh
@@ -52,6 +52,7 @@ function get_file_modification_time() { # @TODO: This is almost always called fr
# YYYYMMDDhhmm.ss - it is NOT a valid integer, but is what 'touch' wants for its "-t" parameter
# YYYYMMDDhhmmss - IS a valid integer and we can do math to it. 'touch' code will format it later
file_date=$(date +%Y%m%d%H%M%S -r "${1}")
+ display_alert "Read modification date for file" "${1} - ${file_date}" "timestamp"
echo -n "${file_date}"
return 0
}
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index 89b108a86..e5b5bd341 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -180,8 +180,8 @@ fetch_from_repo() {
fi
# should be declared in outside scope, so can be read.
- checked_out_revision_mtime="$(git log --date='format:%Y%m%d%H%M%S' --format='format:%ad' -1 "${checkout_from}")"
- checked_out_revision_ts="$(git log -1 --pretty=%ct "${checkout_from}")"
+ checked_out_revision_ts="$(git log -1 --pretty=%ct "${checkout_from}")" # unix timestamp of the commit date
+ checked_out_revision_mtime="$(date +%Y%m%d%H%M%S -d "@${checked_out_revision_ts}")" # convert timestamp to local date/time
display_alert "checked_out_revision_mtime set!" "${checked_out_revision_mtime} - ${checked_out_revision_ts}" "git"
display_alert "Cleaning git dir" "$(git status -s 2> /dev/null | wc -l) files" # working directory is not clean, show it
From 73dba5953b8b76715005d8f8096040c4d5bcc153 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Tue, 17 May 2022 11:06:22 +0200
Subject: [PATCH] armbian-next: abstract `$QEMU_BINARY` to `qemu-static.sh`:
`deploy_qemu_binary_to_chroot()`/`undeploy_qemu_binary_from_chroot()`
- add hackish logic to avoid removing binary that would be needed if image actually contains `qemu-user-static` package
---
config/sources/amd64.conf | 2 +-
extensions/flash-kernel.sh | 6 +++---
lib/functions/image/initrd.sh | 7 ++++---
lib/functions/rootfs/create-cache.sh | 2 +-
lib/functions/rootfs/post-tweaks.sh | 16 ++++++++++------
lib/functions/rootfs/qemu-static.sh | 28 ++++++++++++++++++++++++++++
lib/library-functions.sh | 9 +++++++++
7 files changed, 56 insertions(+), 14 deletions(-)
diff --git a/config/sources/amd64.conf b/config/sources/amd64.conf
index 8b208bab2..20df57d45 100644
--- a/config/sources/amd64.conf
+++ b/config/sources/amd64.conf
@@ -1,6 +1,6 @@
export ARCH=amd64 # Debian name $(dpkg-architecture -qDEB_HOST_ARCH)
export ARCHITECTURE=x86_64 # "kernel" arch
-export QEMU_BINARY="qemu-x86_64-static" # Hopefully you have this installed.
+export QEMU_BINARY="qemu-x86_64-static" # Installed via 'qemu-user-static'.
export KERNEL_COMPILER=' ' # hack: use single space for host gcc. won't work on arm64 hosts
export KERNEL_USE_GCC=' ' # more hacks.
export KERNEL_IMAGE_TYPE="bzImage" # Passed to kernel's `make`
diff --git a/extensions/flash-kernel.sh b/extensions/flash-kernel.sh
index ab5d308d8..14286cf4d 100644
--- a/extensions/flash-kernel.sh
+++ b/extensions/flash-kernel.sh
@@ -71,7 +71,7 @@ pre_umount_final_image__remove_uboot_initramfs_hook_flash_kernel() {
function pre_update_initramfs__setup_flash_kernel() {
local chroot_target=$MOUNT
- cp /usr/bin/"$QEMU_BINARY" "$chroot_target"/usr/bin/
+ deploy_qemu_binary_to_chroot "${chroot_target}"
mount_chroot "$chroot_target/" # this already handles /boot/firmware which is required for it to work.
# hack, umount the chroot's /sys, otherwise flash-kernel tries to EFI flash due to the build host (!) being EFI
umount "$chroot_target/sys"
@@ -109,8 +109,8 @@ function pre_update_initramfs__setup_flash_kernel() {
chroot_custom "$chroot_target" chmod -v +x "/etc/kernel/postinst.d/initramfs-tools"
chroot_custom "$chroot_target" chmod -v +x "/etc/initramfs/post-update.d/flash-kernel"
- umount_chroot "$chroot_target/"
- rm "$chroot_target"/usr/bin/"$QEMU_BINARY"
+ umount_chroot "${chroot_target}/"
+ undeploy_qemu_binary_from_chroot "${chroot_target}"
display_alert "Disabling Armbian-core update_initramfs, was already done above." "${EXTENSION}"
unset KERNELSOURCE # ugly. sorry. we'll have better mechanism for this soon. this is tested at lib/debootstrap.sh:844
diff --git a/lib/functions/image/initrd.sh b/lib/functions/image/initrd.sh
index 695864a77..2ba34e759 100644
--- a/lib/functions/image/initrd.sh
+++ b/lib/functions/image/initrd.sh
@@ -49,7 +49,8 @@ update_initramfs() {
display_alert "initrd cache hash" "${initrd_hash}" "debug"
display_alert "Mounting chroot for update-initramfs" "update-initramfs" "debug"
- cp "/usr/bin/$QEMU_BINARY" "$chroot_target/usr/bin"/
+ deploy_qemu_binary_to_chroot "${chroot_target}"
+
mount_chroot "$chroot_target/"
if [[ -f "${initrd_cache_file_path}" ]]; then
@@ -96,8 +97,8 @@ update_initramfs() {
chroot_custom "$chroot_target" chmod -v +x /etc/kernel/postinst.d/initramfs-tools
display_alert "Unmounting chroot" "update-initramfs" "debug"
- umount_chroot "$chroot_target/"
- rm "$chroot_target/usr/bin/$QEMU_BINARY"
+ umount_chroot "${chroot_target}/"
+ undeploy_qemu_binary_from_chroot "${chroot_target}"
# no need to remove ${initrd_cache_current_manifest_filepath} manually, since it's under ${WORKDIR}
return 0 # avoid future short-circuit problems
diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh
index 7d7fc87e9..fab43781b 100644
--- a/lib/functions/rootfs/create-cache.sh
+++ b/lib/functions/rootfs/create-cache.sh
@@ -125,7 +125,7 @@ function create_new_rootfs_cache() {
}
[[ ! -f ${SDCARD}/debootstrap/debootstrap ]] && exit_with_error "Debootstrap first stage did not produce marker file"
- run_host_command_logged cp -pv "/usr/bin/$QEMU_BINARY" "$SDCARD/usr/bin/" # @TODO: who cleans this up later?
+ deploy_qemu_binary_to_chroot "${SDCARD}" # this is cleaned-up later by post_debootstrap_tweaks()
mkdir -p "${SDCARD}/usr/share/keyrings/"
run_host_command_logged cp -pv /usr/share/keyrings/*-archive-keyring.gpg "${SDCARD}/usr/share/keyrings/"
diff --git a/lib/functions/rootfs/post-tweaks.sh b/lib/functions/rootfs/post-tweaks.sh
index ec26f46af..4a0db646a 100644
--- a/lib/functions/rootfs/post-tweaks.sh
+++ b/lib/functions/rootfs/post-tweaks.sh
@@ -1,10 +1,14 @@
-post_debootstrap_tweaks() {
+function post_debootstrap_tweaks() {
+ display_alert "Applying post-tweaks" "post_debootstrap_tweaks" "debug"
- # remove service start blockers and QEMU binary
- rm -f "${SDCARD}"/sbin/initctl "${SDCARD}"/sbin/start-stop-daemon
- chroot "${SDCARD}" /bin/bash -c "dpkg-divert --quiet --local --rename --remove /sbin/initctl"
- chroot "${SDCARD}" /bin/bash -c "dpkg-divert --quiet --local --rename --remove /sbin/start-stop-daemon"
- rm -f "${SDCARD}"/usr/sbin/policy-rc.d "${SDCARD}/usr/bin/${QEMU_BINARY}"
+ # remove service start blockers
+ run_host_command_logged rm -fv "${SDCARD}"/sbin/initctl "${SDCARD}"/sbin/start-stop-daemon
+ chroot_sdcard dpkg-divert --quiet --local --rename --remove /sbin/initctl
+ chroot_sdcard dpkg-divert --quiet --local --rename --remove /sbin/start-stop-daemon
+ run_host_command_logged rm -fv "${SDCARD}"/usr/sbin/policy-rc.d
+
+ # remove the qemu static binary
+ undeploy_qemu_binary_from_chroot "${SDCARD}"
call_extension_method "post_post_debootstrap_tweaks" "config_post_debootstrap_tweaks" <<- 'POST_POST_DEBOOTSTRAP_TWEAKS'
*run after removing diversions and qemu with chroot unmounted*
diff --git a/lib/functions/rootfs/qemu-static.sh b/lib/functions/rootfs/qemu-static.sh
new file mode 100644
index 000000000..91569cbe1
--- /dev/null
+++ b/lib/functions/rootfs/qemu-static.sh
@@ -0,0 +1,28 @@
+function deploy_qemu_binary_to_chroot() {
+ local chroot_target="${1}"
+
+ # @TODO: rpardini: Only deploy the binary if we're actually building a different architecture? otherwise unneeded.
+
+ if [[ ! -f "${chroot_target}/usr/bin/${QEMU_BINARY}" ]]; then
+ display_alert "Deploying qemu-user-static binary to chroot" "${QEMU_BINARY}" "debug"
+ run_host_command_logged cp -pv "/usr/bin/${QEMU_BINARY}" "${chroot_target}/usr/bin/"
+ else
+ display_alert "qemu-user-static binary already deployed, skipping" "${QEMU_BINARY}" "debug"
+ fi
+}
+
+function undeploy_qemu_binary_from_chroot() {
+ local chroot_target="${1}"
+
+ # Hack: Check for magic "/usr/bin/qemu-s390x-static" marker; if that exists, it means "qemu-user-static" was installed
+ # in the chroot, and we shouldn't remove the binary, otherwise it's gonna be missing in the final image.
+ if [[ -f "${chroot_target}/usr/bin/qemu-s390x-static" ]]; then
+ display_alert "Not removing qemu binary, qemu-user-static package is installed in the chroot" "${QEMU_BINARY}" "debug"
+ return 0
+ fi
+
+ if [[ -f "${chroot_target}/usr/bin/${QEMU_BINARY}" ]]; then
+ display_alert "Removing qemu-user-static binary from chroot" "${QEMU_BINARY}" "debug"
+ run_host_command_logged rm -fv "${chroot_target}/usr/bin/${QEMU_BINARY}"
+ fi
+}
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index 5bad7883a..ff42ed61f 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -496,6 +496,15 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/rootfs/post-tweaks.sh
source "${SRC}"/lib/functions/rootfs/post-tweaks.sh
+# no errors tolerated. invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/rootfs/qemu-static.sh
+# shellcheck source=lib/functions/rootfs/qemu-static.sh
+source "${SRC}"/lib/functions/rootfs/qemu-static.sh
+
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
From ef945476dee668f7ab3889f0cc2994467613b0d7 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 16 May 2022 18:06:25 +0200
Subject: [PATCH] armbian-next: fix `uuidgen` basic dep check; use fake bash
`$RANDOM` if uuidgen not available
- not good: we need uuidgen to begin logging, but it may not be installed yet. workaround.
---
lib/functions/cli/cli-entrypoint.sh | 8 +++++++-
lib/functions/host/basic-deps.sh | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/functions/cli/cli-entrypoint.sh b/lib/functions/cli/cli-entrypoint.sh
index 65ad2b88e..82026963e 100644
--- a/lib/functions/cli/cli-entrypoint.sh
+++ b/lib/functions/cli/cli-entrypoint.sh
@@ -68,8 +68,14 @@ function cli_entrypoint() {
display_alert "Output directory DEST:" "${DEST}" "debug"
# set unique mounting directory for this build.
+ # basic deps, which include "uuidgen", will be installed _after_ this, so we gotta tolerate it not being there yet.
declare -g ARMBIAN_BUILD_UUID
- ARMBIAN_BUILD_UUID="$(uuidgen)"
+ if [[ -f /usr/bin/uuidgen ]]; then
+ ARMBIAN_BUILD_UUID="$(uuidgen)"
+ else
+ display_alert "uuidgen not found" "uuidgen not installed yet" "info"
+ ARMBIAN_BUILD_UUID="no-uuidgen-yet-${RANDOM}-$((1 + $RANDOM % 10))$((1 + $RANDOM % 10))$((1 + $RANDOM % 10))$((1 + $RANDOM % 10))"
+ fi
display_alert "Build UUID:" "${ARMBIAN_BUILD_UUID}" "debug"
# Super-global variables, used everywhere. The directories are NOT _created_ here, since this very early stage.
diff --git a/lib/functions/host/basic-deps.sh b/lib/functions/host/basic-deps.sh
index 4cce0f8bf..bb46fd155 100644
--- a/lib/functions/host/basic-deps.sh
+++ b/lib/functions/host/basic-deps.sh
@@ -11,7 +11,7 @@ prepare_host_basic() {
"dialog:dialog"
"fuser:psmisc"
"getfacl:acl"
- "uuid:uuid uuid-runtime"
+ "uuidgen:uuid-runtime"
"curl:curl"
"gpg:gnupg"
"gawk:gawk"
From bc644378ffa202f368e6c0bc705d7c3b05709f21 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 11 May 2022 21:15:18 +0200
Subject: [PATCH] armbian-next: retry 3 times download-only also for
`PACKAGE_LIST_BOARD`
- acng is really not helping
---
lib/functions/rootfs/distro-agnostic.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index 4b664acc1..cd3462409 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -255,6 +255,9 @@ function install_distribution_agnostic() {
if [[ -n ${PACKAGE_LIST_BOARD} ]]; then
_pkg_list=${PACKAGE_LIST_BOARD}
display_alert "Installing PACKAGE_LIST_BOARD packages" "${_pkg_list}"
+ # shellcheck disable=SC2086 # we need to expand here. retry 3 times download-only to counter apt-cacher-ng failures.
+ do_with_retries 3 chroot_sdcard_apt_get_install_download_only ${_pkg_list}
+
# shellcheck disable=SC2086 # we need to expand.
chroot_sdcard_apt_get_install ${_pkg_list}
fi
From 37a7eb9cbbf8fdf02054e2c9b5fd9eb924aa2524 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 11 May 2022 16:51:09 +0200
Subject: [PATCH] armbian-next: allow customizing UBUNTU_MIRROR (ports mirror)
with `CUSTOM_UBUNTU_MIRROR_ARM64=host/path`
---
lib/functions/configuration/main-config.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 5100e6d35..31c4d6280 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -331,6 +331,13 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
fi
fi
+ if [[ "${ARCH}" == "arm64" ]]; then
+ if [[ -n ${CUSTOM_UBUNTU_MIRROR_ARM64} ]]; then
+ display_alert "Using custom ports/arm64 mirror" "${CUSTOM_UBUNTU_MIRROR_ARM64}" "info"
+ UBUNTU_MIRROR="${CUSTOM_UBUNTU_MIRROR_ARM64}"
+ fi
+ fi
+
# don't use mirrors that throws garbage on 404
if [[ -z ${ARMBIAN_MIRROR} && "${SKIP_ARMBIAN_REPO}" != "yes" ]]; then
declare -i armbian_mirror_tries=1
From 6533471c376936d076fe884304b27e904af6d54e Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 9 May 2022 20:41:47 +0200
Subject: [PATCH] armbian-next: WiP: kernel make via `env -i` for clean env;
show produced /boot tree
---
lib/functions/compilation/kernel-debs.sh | 3 +++
lib/functions/compilation/kernel.sh | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/functions/compilation/kernel-debs.sh b/lib/functions/compilation/kernel-debs.sh
index dd5a143c7..3cae7845a 100644
--- a/lib/functions/compilation/kernel-debs.sh
+++ b/lib/functions/compilation/kernel-debs.sh
@@ -153,6 +153,9 @@ function kernel_package_callback_linux_image() {
declare installed_image_path="boot/vmlinuz-${kernel_version_family}" # using old mkdebian terminology here.
declare image_name="Image" # for arm64. or, "zImage" for arm, or "vmlinuz" for others. Why? See where u-boot puts them.
+ display_alert "Showing contents of Kbuild produced /boot" "linux-image" "debug"
+ run_host_command_logged tree -C --du -h "${tmp_kernel_install_dirs[INSTALL_PATH]}"
+
run_host_command_logged cp -rp "${tmp_kernel_install_dirs[INSTALL_PATH]}" "${package_directory}/" # /boot stuff
run_host_command_logged cp -rp "${tmp_kernel_install_dirs[INSTALL_MOD_PATH]}/lib" "${package_directory}/" # so "lib" stuff sits at the root
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 86235f767..3ecc4c3d6 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -27,8 +27,8 @@ function run_kernel_make() {
"KGZIP=pigz" "KBZIP2=pbzip2" # Parallel compression, use explicit parallel compressors https://lore.kernel.org/lkml/20200901151002.988547791@linuxfoundation.org/
)
- # last statement, so it passes the result to calling function.
- full_command=("${KERNEL_MAKE_RUNNER:-run_host_command_logged}" "${common_make_envs[@]}"
+ # last statement, so it passes the result to calling function. "env -i" is used for empty env
+ full_command=("${KERNEL_MAKE_RUNNER:-run_host_command_logged}" "env" "-i" "${common_make_envs[@]}"
make "${common_make_params_quoted[@]@Q}" "$@" "${make_filter}")
"${full_command[@]}" # and exit with it's code, since it's the last statement
}
From 514a63ddef96369aa2be85175544eedb000779c5 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 8 May 2022 20:50:42 +0200
Subject: [PATCH] armbian-next: manual merge (19) of all changes between
revisions b23498b94909a855d8b0fda1a95ccfc0ab17c747 and
e621d25adc8ee66b0d14c94605ef462a13464b85
- the ssh firstrun revert stuff mostly
---
lib/functions/main/rootfs-image.sh | 3 ---
1 file changed, 3 deletions(-)
diff --git a/lib/functions/main/rootfs-image.sh b/lib/functions/main/rootfs-image.sh
index 87821d253..590ca1f84 100644
--- a/lib/functions/main/rootfs-image.sh
+++ b/lib/functions/main/rootfs-image.sh
@@ -67,9 +67,6 @@ function build_rootfs_and_image() {
# install from apt.armbian.com # @TODO: armbian-nextify this eventually
[[ $EXTERNAL_NEW == prebuilt ]] && LOG_SECTION="packages_prebuilt" do_with_logging chroot_installpackages "yes"
- # remove existing ssh keys. They will be created in 1st boot process
- rm -f "${SDCARD}"/etc/ssh/ssh_host*
-
# stage: user customization script
# NOTE: installing too many packages may fill tmpfs mount
LOG_SECTION="customize_image" do_with_logging customize_image
From 896c4e78d75f23a8dfa21354773cd8254f34d196 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 7 May 2022 03:55:49 +0200
Subject: [PATCH] armbian-next: *breaking change* remove `LIB_TAG` and
`.ignore_changes` completely
- one day should be replaced with an "update checker" extension, or even "update-enforcer"
- for now this just causes chaos
---
config/templates/config-example.conf | 1 -
lib/functions/cli/cli-entrypoint.sh | 3 --
lib/functions/cli/utils-cli.sh | 71 ------------------------------------
3 files changed, 75 deletions(-)
diff --git a/config/templates/config-example.conf b/config/templates/config-example.conf
index e07496dc8..3a524d1ce 100644
--- a/config/templates/config-example.conf
+++ b/config/templates/config-example.conf
@@ -22,7 +22,6 @@ DEST_LANG="en_US.UTF-8" # sl_SI.UTF-8, en_US.UTF-8
# advanced
EXTERNAL_NEW="prebuilt" # compile and install or install prebuilt additional packages
INSTALL_HEADERS="" # install kernel headers package
-LIB_TAG="master" # change to "branchname" to use any branch currently available.
USE_TORRENT="no" # use torrent network for faster toolchain and cache download
DOWNLOAD_MIRROR="" # set to "china" to use chinese mirrors
CARD_DEVICE="" # device name /dev/sdx of your SD card to burn directly to the card when done
diff --git a/lib/functions/cli/cli-entrypoint.sh b/lib/functions/cli/cli-entrypoint.sh
index c6d0459ed..65ad2b88e 100644
--- a/lib/functions/cli/cli-entrypoint.sh
+++ b/lib/functions/cli/cli-entrypoint.sh
@@ -9,9 +9,6 @@ function cli_entrypoint() {
trap 'echo "${BASH_LINENO[@]}|${BASH_SOURCE[@]}|${FUNCNAME[@]}" >> ${SRC}/output/call-traces/calls.txt ;' RETURN
fi
- check_args "$@"
- do_update_src "$@"
-
if [[ "${EUID}" == "0" ]] || [[ "${1}" == "vagrant" ]]; then
:
elif [[ "${1}" == docker || "${1}" == dockerpurge || "${1}" == docker-shell ]] && grep -q "$(whoami)" <(getent group docker); then
diff --git a/lib/functions/cli/utils-cli.sh b/lib/functions/cli/utils-cli.sh
index a48de5d3a..40764c2d7 100644
--- a/lib/functions/cli/utils-cli.sh
+++ b/lib/functions/cli/utils-cli.sh
@@ -1,76 +1,5 @@
# Misc functions from compile.sh
-# Add the variables needed at the beginning of the path
-check_args() {
- for p in "$@"; do
- case "${p%=*}" in
- LIB_TAG)
- # Take a variable if the branch exists locally
- if [ "${p#*=}" == "$(git branch |
- gawk -v b="${p#*=}" '{if ( $NF == b ) {print $NF}}')" ]; then
- echo -e "[\e[0;35m warn \x1B[0m] Setting $p"
- eval "$p"
- else
- echo -e "[\e[0;35m warn \x1B[0m] Skip $p setting as LIB_TAG=\"\""
- eval LIB_TAG=""
- fi
- ;;
- esac
- done
-}
-
-function do_update_src() {
- TMPFILE=$(mktemp)
- chmod 644 "${TMPFILE}"
- {
- echo SRC="$SRC"
- echo LIB_TAG="$LIB_TAG"
- declare -f update_src # this writes the source of 'update_src' there
- echo "update_src"
- } > "$TMPFILE"
-
- #do not update/checkout git with root privileges to messup files onwership.
- #due to in docker/VM, we can't su to a normal user, so do not update/checkout git.
- if [[ $(systemd-detect-virt) == 'none' ]]; then
- if [[ "${EUID}" == "0" ]]; then
- su "$(stat --format=%U "${SRC}"/.git)" -c "bash ${TMPFILE}"
- else
- bash "${TMPFILE}"
- fi
- fi
- rm "${TMPFILE}"
-}
-
-update_src() {
- cd "${SRC}" || exit
- if [[ ! -f "${SRC}"/.ignore_changes ]]; then
- echo -e "[\e[0;32m o.k. \x1B[0m] This script will try to update"
-
- CHANGED_FILES=$(git diff --name-only)
- if [[ -n "${CHANGED_FILES}" ]]; then
- echo -e "[\e[0;35m warn \x1B[0m] Can't update since you made changes to: \e[0;32m\n${CHANGED_FILES}\x1B[0m"
- while true; do
- echo -e "Press \e[0;33m<Ctrl-C>\x1B[0m or \e[0;33mexit\x1B[0m to abort compilation" \
- ", \e[0;33m<Enter>\x1B[0m to ignore and continue, \e[0;33mdiff\x1B[0m to display changes"
- read -r
- if [[ "${REPLY}" == "diff" ]]; then
- git diff
- elif [[ "${REPLY}" == "exit" ]]; then
- exit 1
- elif [[ "${REPLY}" == "" ]]; then
- break
- else
- echo "Unknown command!"
- fi
- done
- elif [[ $(git branch | grep "*" | awk '{print $2}') != "${LIB_TAG}" && -n "${LIB_TAG}" ]]; then
- git checkout "${LIB_TAG:-master}"
- git pull
- fi
- fi
-
-}
-
function handle_docker_vagrant() {
# Check for Vagrant
if [[ "${1}" == vagrant && -z "$(command -v vagrant)" ]]; then
From d20902020953d75c3f7d1a9c27ec9c553825660a Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 8 May 2022 14:15:32 +0200
Subject: [PATCH] armbian-next: `python2` is required for some u-boot builds
- would be "use `python-is-python2` so /usr/bin/python exists and points to Python 2.x" but Jammy does not have that anymore
- python2 is required for some u-boot builds.
- that said, python 2.x is deprecated for a while and needs work thus @TODO
---
lib/functions/host/prepare-host.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/functions/host/prepare-host.sh b/lib/functions/host/prepare-host.sh
index b48f666b1..55ae01988 100644
--- a/lib/functions/host/prepare-host.sh
+++ b/lib/functions/host/prepare-host.sh
@@ -42,6 +42,9 @@ prepare_host() {
systemd-container u-boot-tools udev uuid-dev whiptail
zlib1g-dev
+ # python2, mostly used by some u-boot builds (2018 et al, odroidxu4 and others).
+ python2
+
# non-mess below?
file ccze colorized-logs tree # logging utilities
unzip zip p7zip-full pigz pixz pbzip2 lzop zstd # compressors et al
From cec6a1b3ebe5c7df20dc8be8f7687416843d5db9 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 8 May 2022 13:45:19 +0200
Subject: [PATCH] armbian-next: bump Python info gatherer to RELEASE=jammy too
---
lib/tools/info.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/tools/info.py b/lib/tools/info.py
index 6319a1427..f452b37ab 100755
--- a/lib/tools/info.py
+++ b/lib/tools/info.py
@@ -119,7 +119,7 @@ common_compile_params = {
}
board_compile_params = {
- "RELEASE": "impish",
+ "RELEASE": "jammy",
"BUILD_DESKTOP": "no"
}
From 75a638f13bfeeb3327510ad9c1ef3ce3adb166bd Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 8 May 2022 13:44:28 +0200
Subject: [PATCH] armbian-next: add `KERNEL_MAJOR_MINOR` info to `media` kernel
(@balbes150)
- 5.18 is not yet released so might be a problem here
---
config/sources/families/media.conf | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/config/sources/families/media.conf b/config/sources/families/media.conf
index ef89b8f07..747eb86a5 100644
--- a/config/sources/families/media.conf
+++ b/config/sources/families/media.conf
@@ -17,6 +17,7 @@ case $BRANCH in
if [[ $BOARD == station-p2 || $BOARD == station-m2 ]]; then
KERNELSOURCE='https://github.com/150balbes/rockchip-kernel'
+ export KERNEL_MAJOR_MINOR="4.19" # Major and minor versions of this kernel.
KERNELBRANCH='branch:kernel-4.19'
KERNELPATCHDIR='station-p2-'$BRANCH
LINUXFAMILY=station-p2
@@ -26,12 +27,14 @@ case $BRANCH in
else
if [[ $BOARD == nanopct4 ]]; then
KERNELSOURCE='https://github.com/friendlyarm/kernel-rockchip'
+ export KERNEL_MAJOR_MINOR="4.4" # Major and minor versions of this kernel.
KERNELBRANCH='branch:nanopi4-linux-v4.4.y'
KERNELPATCHDIR='rk3399-'$BRANCH
LINUXFAMILY=rk3399
LINUXCONFIG='linux-rk3399-'$BRANCH
else
KERNELSOURCE='https://github.com/ayufan-rock64/linux-kernel'
+ export KERNEL_MAJOR_MINOR="4.4" # Major and minor versions of this kernel.
KERNELBRANCH='tag:4.4.202-1237-rockchip-ayufan'
KERNELPATCHDIR='rockchip64-'$BRANCH
LINUXFAMILY=rockchip64
@@ -41,6 +44,7 @@ case $BRANCH in
;;
current)
+ export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
KERNELBRANCH="branch:linux-5.17.y"
KERNELBRANCH="tag:v5.17.5"
KERNELPATCHDIR='media-'$BRANCH
@@ -49,6 +53,7 @@ case $BRANCH in
;;
edge)
+ export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
KERNELBRANCH="branch:linux-5.18.y"
KERNELBRANCH="tag:v5.18-rc5"
KERNELPATCHDIR='media-'$BRANCH
From 91db9e2a305cd385077289363ffe1212a7c614f2 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 8 May 2022 00:18:35 +0200
Subject: [PATCH] armbian-next: allow to skip submodules during
`fetch_from_repo`; introduce hook `fetch_custom_uboot`
- via GIT_SKIP_SUBMODULES=yes, which disables all submodules everywhere
- via UBOOT_GIT_SKIP_SUBMODULES=yes, which disables fetching of submodules during uboot fetch (hidden rkbins anyone?)
- extension hook `fetch_custom_uboot` so we can fetch our own stuff if needed
---
lib/functions/compilation/uboot.sh | 9 ++++++++-
lib/functions/general/git.sh | 34 +++++++++++++++++++---------------
2 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/lib/functions/compilation/uboot.sh b/lib/functions/compilation/uboot.sh
index f87470eb7..699946406 100644
--- a/lib/functions/compilation/uboot.sh
+++ b/lib/functions/compilation/uboot.sh
@@ -107,7 +107,14 @@ function compile_uboot_target() {
compile_uboot() {
if [[ -n $BOOTSOURCE ]] && [[ "${BOOTSOURCE}" != "none" ]]; then
display_alert "Downloading sources" "u-boot" "git"
- fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes" # fetch_from_repo <url> <dir> <ref> <subdir_flag>
+ GIT_SKIP_SUBMODULES="${UBOOT_GIT_SKIP_SUBMODULES}" fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes" # fetch_from_repo <url> <dir> <ref> <subdir_flag>
+
+ display_alert "Extensions: fetch custom uboot" "fetch_custom_uboot" "debug"
+ call_extension_method "fetch_custom_uboot" <<- 'FETCH_CUSTOM_UBOOT'
+ *allow extensions to fetch extra uboot sources*
+ For downstream uboot et al.
+ This is done after `GIT_SKIP_SUBMODULES="${UBOOT_GIT_SKIP_SUBMODULES}" fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes"`
+ FETCH_CUSTOM_UBOOT
fi
# not optimal, but extra cleaning before overlayfs_wrapper should keep sources directory clean
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index c8086f728..89b108a86 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -198,21 +198,25 @@ fetch_from_repo() {
#fasthash_debug "after setting checkout time for $dir $ref_name" #yeah
if [[ -f .gitmodules ]]; then
- display_alert "Updating submodules" "" "ext"
- # FML: http://stackoverflow.com/a/17692710
- for i in $(git config -f .gitmodules --get-regexp path | awk '{ print $2 }'); do
- cd "${git_work_dir}" || exit
- local surl sref
- surl=$(git config -f .gitmodules --get "submodule.$i.url")
- sref=$(git config -f .gitmodules --get "submodule.$i.branch" || true)
- if [[ -n $sref ]]; then
- sref="branch:$sref"
- else
- sref="head"
- fi
- # @TODO: in case of the bundle stuff this will fail terribly
- fetch_from_repo "$surl" "$workdir/$i" "$sref"
- done
+ if [[ "${GIT_SKIP_SUBMODULES}" == "yes" ]]; then
+ display_alert "Skipping submodules" "GIT_SKIP_SUBMODULES=yes" "debug"
+ else
+ display_alert "Updating submodules" "" "ext"
+ # FML: http://stackoverflow.com/a/17692710
+ for i in $(git config -f .gitmodules --get-regexp path | awk '{ print $2 }'); do
+ cd "${git_work_dir}" || exit
+ local surl sref
+ surl=$(git config -f .gitmodules --get "submodule.$i.url")
+ sref=$(git config -f .gitmodules --get "submodule.$i.branch" || true)
+ if [[ -n $sref ]]; then
+ sref="branch:$sref"
+ else
+ sref="head"
+ fi
+ # @TODO: in case of the bundle stuff this will fail terribly
+ fetch_from_repo "$surl" "$workdir/$i" "$sref"
+ done
+ fi
fi
display_alert "Final working copy size" "$(du -h -s | awk '{print $1}')" "git"
From fb3add638441223317735bf5eb826badfe8c0924 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 9 May 2022 12:15:08 +0200
Subject: [PATCH] armbian-next: `initrd` caching fixes (always enable hook; if
cache hit, convert to uImage too)
---
lib/functions/image/initrd.sh | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/lib/functions/image/initrd.sh b/lib/functions/image/initrd.sh
index 817bdf78a..695864a77 100644
--- a/lib/functions/image/initrd.sh
+++ b/lib/functions/image/initrd.sh
@@ -48,6 +48,10 @@ update_initramfs() {
initrd_cache_file_path="${SRC}/cache/initrd/${initrd_cache_key}"
display_alert "initrd cache hash" "${initrd_hash}" "debug"
+ display_alert "Mounting chroot for update-initramfs" "update-initramfs" "debug"
+ cp "/usr/bin/$QEMU_BINARY" "$chroot_target/usr/bin"/
+ mount_chroot "$chroot_target/"
+
if [[ -f "${initrd_cache_file_path}" ]]; then
display_alert "initrd cache hit" "${initrd_cache_key}" "cachehit"
run_host_command_logged cp -pv "${initrd_cache_file_path}" "${initrd_file}"
@@ -55,6 +59,11 @@ update_initramfs() {
if [[ -f "${initrd_cache_last_manifest_filepath}" ]]; then
touch "${initrd_cache_last_manifest_filepath}" # touch the manifest file timestamp; LRU bump.
fi
+
+ # Convert to bootscript expected format, by calling into the script manually.
+ if [[ -f "${chroot_target}"/etc/initramfs/post-update.d/99-uboot ]]; then
+ chroot_custom "$chroot_target" /etc/initramfs/post-update.d/99-uboot "${initrd_kern_ver}" "/boot/initrd.img-${initrd_kern_ver}"
+ fi
else
display_alert "Cache miss for initrd cache" "${initrd_cache_key}" "debug"
@@ -67,9 +76,6 @@ update_initramfs() {
fi
display_alert "Updating initramfs..." "$update_initramfs_cmd" ""
- cp "/usr/bin/$QEMU_BINARY" "$chroot_target/usr/bin"/
- mount_chroot "$chroot_target/"
-
local logging_filter="2>&1 | grep --line-buffered -v -e '.xz' -e 'ORDER ignored' -e 'Adding binary ' -e 'Adding module ' -e 'Adding firmware ' "
chroot_custom_long_running "$chroot_target" "$update_initramfs_cmd" "${logging_filter}"
display_alert "Updated initramfs." "${update_initramfs_cmd}" "info"
@@ -84,13 +90,14 @@ update_initramfs() {
# 60: keep the last 30 initrd + manifest pairs. this should be higher than the total number of kernels we support, otherwise churn will be high
find "${SRC}/cache/initrd" -type f -printf "%T@ %p\\n" | sort -n -r | sed "1,60d" | xargs rm -fv
fi
+ fi
- display_alert "Re-enabling" "initramfs-tools hook for kernel"
- chroot_custom "$chroot_target" chmod -v +x /etc/kernel/postinst.d/initramfs-tools
+ display_alert "Re-enabling" "initramfs-tools hook for kernel"
+ chroot_custom "$chroot_target" chmod -v +x /etc/kernel/postinst.d/initramfs-tools
- umount_chroot "$chroot_target/"
- rm "$chroot_target/usr/bin/$QEMU_BINARY"
- fi
+ display_alert "Unmounting chroot" "update-initramfs" "debug"
+ umount_chroot "$chroot_target/"
+ rm "$chroot_target/usr/bin/$QEMU_BINARY"
# no need to remove ${initrd_cache_current_manifest_filepath} manually, since it's under ${WORKDIR}
return 0 # avoid future short-circuit problems
From a732119d010bf7008caaacf3e50b3659c8dbf472 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 17 Apr 2022 05:19:46 +0200
Subject: [PATCH] armbian-next: introduce `initramfs`/`initrd` caching
- using hashes of (hopefully) all involved files
- cache hits are rewarded with sprinkly hearts.
- why? this proves we got a reproducible kernel modules build!
- also, you just saved yourself 2-10 minutes of pain
---
lib/functions/image/initrd.sh | 87 +++++++++++++++++++++++++++++++++-------
lib/functions/logging/logging.sh | 5 +++
2 files changed, 78 insertions(+), 14 deletions(-)
diff --git a/lib/functions/image/initrd.sh b/lib/functions/image/initrd.sh
index feb4143c8..817bdf78a 100644
--- a/lib/functions/image/initrd.sh
+++ b/lib/functions/image/initrd.sh
@@ -13,26 +13,85 @@
# see: https://github.com/armbian/build/issues/1584
update_initramfs() {
local chroot_target=$1
- local target_dir="$(find "${chroot_target}/lib/modules"/ -maxdepth 1 -type d -name "*${VER}*")"
+ local target_dir="$(find "${chroot_target}/lib/modules"/ -maxdepth 1 -type d -name "*${VER}*")" # @TODO: rpardini: this will break when we add multi-kernel images
+ local initrd_kern_ver initrd_file initrd_cache_key initrd_cache_file_path initrd_hash
+ local initrd_cache_current_manifest_filepath initrd_cache_last_manifest_filepath
if [ "$target_dir" != "" ]; then
- update_initramfs_cmd="update-initramfs -uv -k $(basename "$target_dir")"
+ initrd_kern_ver="$(basename "$target_dir")"
+ initrd_file="${chroot_target}/boot/initrd.img-${initrd_kern_ver}"
+
+ update_initramfs_cmd="update-initramfs -uv -k ${initrd_kern_ver}"
else
exit_with_error "No kernel installed for the version" "${VER}"
fi
- display_alert "Updating initramfs..." "$update_initramfs_cmd" ""
- cp "/usr/bin/$QEMU_BINARY" "$chroot_target/usr/bin"/
- mount_chroot "$chroot_target/"
- local logging_filter="2>&1 | grep --line-buffered -v -e '.xz' -e 'ORDER ignored' -e 'Adding binary ' -e 'Adding module ' -e 'Adding firmware ' "
- chroot_custom_long_running "$chroot_target" "$update_initramfs_cmd" "${logging_filter}" || {
- exit_with_error "Updating initramfs FAILED"
- }
- display_alert "Updated initramfs." "${update_initramfs_cmd}" "info"
+ # Caching.
+ # Find all modules and all firmware in the target.
+ # Find all initramfs configuration in /etc
+ # Find all bash, cpio and gzip binaries in /bin
+ # Hash the contents of them all.
+ # If there's a match, use the cache.
+
+ display_alert "computing initrd cache hash" "${chroot_target}" "debug"
+ mkdir -p "${SRC}/cache/initrd"
+ initrd_cache_current_manifest_filepath="${WORKDIR}/initrd.img-${initrd_kern_ver}.${ARMBIAN_BUILD_UUID}.manifest"
+ initrd_cache_last_manifest_filepath="${SRC}/cache/initrd/initrd.manifest-${initrd_kern_ver}.last.manifest"
+
+ # Find all the affected files; parallel md5sum sum them; invert hash and path, and remove chroot prefix.
+ find "${target_dir}" "${chroot_target}/usr/bin/bash" "${chroot_target}/etc/initramfs" \
+ "${chroot_target}/etc/initramfs-tools" -type f | parallel -X md5sum |
+ awk '{print $2 " - " $1}' |
+ sed -e "s|^${chroot_target}||g" | LC_ALL=C sort > "${initrd_cache_current_manifest_filepath}"
+
+ initrd_hash="$(cat "${initrd_cache_current_manifest_filepath}" | md5sum | cut -d ' ' -f 1)" # hash of the hashes.
+ initrd_cache_key="initrd.img-${initrd_kern_ver}-${initrd_hash}"
+ initrd_cache_file_path="${SRC}/cache/initrd/${initrd_cache_key}"
+ display_alert "initrd cache hash" "${initrd_hash}" "debug"
+
+ if [[ -f "${initrd_cache_file_path}" ]]; then
+ display_alert "initrd cache hit" "${initrd_cache_key}" "cachehit"
+ run_host_command_logged cp -pv "${initrd_cache_file_path}" "${initrd_file}"
+ touch "${initrd_cache_file_path}" # touch cached file timestamp; LRU bump.
+ if [[ -f "${initrd_cache_last_manifest_filepath}" ]]; then
+ touch "${initrd_cache_last_manifest_filepath}" # touch the manifest file timestamp; LRU bump.
+ fi
+ else
+ display_alert "Cache miss for initrd cache" "${initrd_cache_key}" "debug"
+
+ # Show the differences between the last and the current, so we realize why it isn't hit (eg; what changed).
+ if [[ -f "${initrd_cache_last_manifest_filepath}" ]]; then
+ if [[ "${SHOW_DEBUG}" == "yes" ]]; then
+ display_alert "Showing diff between last and current initrd cache manifests" "initrd" "debug"
+ run_host_command_logged diff -u --color=always "${initrd_cache_last_manifest_filepath}" "${initrd_cache_current_manifest_filepath}" "|| true" # no errors please
+ fi
+ fi
+
+ display_alert "Updating initramfs..." "$update_initramfs_cmd" ""
+ cp "/usr/bin/$QEMU_BINARY" "$chroot_target/usr/bin"/
+ mount_chroot "$chroot_target/"
+
+ local logging_filter="2>&1 | grep --line-buffered -v -e '.xz' -e 'ORDER ignored' -e 'Adding binary ' -e 'Adding module ' -e 'Adding firmware ' "
+ chroot_custom_long_running "$chroot_target" "$update_initramfs_cmd" "${logging_filter}"
+ display_alert "Updated initramfs." "${update_initramfs_cmd}" "info"
- display_alert "Re-enabling" "initramfs-tools hook for kernel"
- chroot "$chroot_target" /bin/bash -c "chmod -v +x /etc/kernel/postinst.d/initramfs-tools" 2>&1
+ display_alert "Storing initrd in cache" "${initrd_cache_key}" "debug" # notice there's no -p here: no need to touch LRU
+ run_host_command_logged cp -v "${initrd_file}" "${initrd_cache_file_path}" # store the new initrd in the cache.
+ run_host_command_logged cp -v "${initrd_cache_current_manifest_filepath}" "${initrd_cache_last_manifest_filepath}" # store the current contents in the last file.
- umount_chroot "$chroot_target/"
- rm $chroot_target/usr/bin/$QEMU_BINARY
+ # clean old cache files so they don't pile up forever.
+ if [[ "${SHOW_DEBUG}" == "yes" ]]; then
+ display_alert "Showing which initrd caches would be removed/expired" "initrd" "debug"
+ # 60: keep the last 30 initrd + manifest pairs. this should be higher than the total number of kernels we support, otherwise churn will be high
+ find "${SRC}/cache/initrd" -type f -printf "%T@ %p\\n" | sort -n -r | sed "1,60d" | xargs rm -fv
+ fi
+
+ display_alert "Re-enabling" "initramfs-tools hook for kernel"
+ chroot_custom "$chroot_target" chmod -v +x /etc/kernel/postinst.d/initramfs-tools
+
+ umount_chroot "$chroot_target/"
+ rm "$chroot_target/usr/bin/$QEMU_BINARY"
+ fi
+ # no need to remove ${initrd_cache_current_manifest_filepath} manually, since it's under ${WORKDIR}
+ return 0 # avoid future short-circuit problems
}
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index 6550d714d..6cc1621e7 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -151,6 +151,11 @@ function display_alert() {
inline_logs_color="\e[0;32m"
;;
+ cachehit)
+ level_indicator="💖"
+ inline_logs_color="\e[0;32m"
+ ;;
+
cleanup | trap)
if [[ "${SHOW_TRAPS}" != "yes" ]]; then # enable debug for many, many debugging msgs
skip_screen=1
From 220529f8f779673746843fa55b84d23753f1e037 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 7 May 2022 16:54:00 +0200
Subject: [PATCH] armbian-next: manual merge (18) of changes between revisions
08cf31de73de5f5ba1986348e4556b00d77af09f and
c8855aa08dafaa02c939039e55e01967bad61c28
- heh; most bash code changes are for things already done in -next, or no longer used
- some version bumps, etc
---
config/sources/families/bcm2711.conf | 4 +--
config/sources/families/imx6.conf | 4 +--
config/sources/families/include/meson64_common.inc | 2 --
.../sources/families/include/rockchip64_common.inc | 4 +--
config/sources/families/jetson-nano.conf | 8 ++---
config/sources/families/media.conf | 37 ++++++++++++++--------
config/sources/families/mvebu.conf | 6 ++--
config/sources/families/mvebu64.conf | 14 +++++---
config/sources/families/odroidxu4.conf | 4 +--
config/sources/families/rk35xx.conf | 4 ---
config/sources/families/virtual.conf | 4 +--
lib/functions/bsp/bsp-cli.sh | 2 +-
.../compilation/patch/kernel-bootsplash.sh | 5 ++-
lib/functions/compilation/patch/kernel-drivers.sh | 15 ++++-----
lib/functions/configuration/main-config.sh | 2 +-
lib/functions/general/downloads.sh | 21 ++++++++++--
lib/functions/general/repo.sh | 16 +++++++---
lib/functions/image/partitioning.sh | 8 +++--
lib/functions/main/rootfs-image.sh | 3 ++
lib/functions/rootfs/distro-agnostic.sh | 22 ++++++++-----
20 files changed, 115 insertions(+), 70 deletions(-)
diff --git a/config/sources/families/bcm2711.conf b/config/sources/families/bcm2711.conf
index a6bee376e..2b19132e2 100644
--- a/config/sources/families/bcm2711.conf
+++ b/config/sources/families/bcm2711.conf
@@ -28,8 +28,8 @@ case "${BRANCH}" in
edge)
export RASPI_DISTRO_KERNEL=no
export KERNELSOURCE='https://github.com/raspberrypi/linux'
- export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel. For mainline caching.
- export KERNELBRANCH="branch:rpi-5.16.y"
+ export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel. For mainline caching.
+ export KERNELBRANCH="branch:rpi-5.17.y"
export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
;;
diff --git a/config/sources/families/imx6.conf b/config/sources/families/imx6.conf
index d63f84266..f2bcf95a1 100644
--- a/config/sources/families/imx6.conf
+++ b/config/sources/families/imx6.conf
@@ -16,8 +16,8 @@ case $BRANCH in
edge)
- export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
- KERNELBRANCH='branch:linux-5.16.y'
+ export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:linux-5.17.y'
;;
diff --git a/config/sources/families/include/meson64_common.inc b/config/sources/families/include/meson64_common.inc
index 21c71e5bd..7d79b6930 100644
--- a/config/sources/families/include/meson64_common.inc
+++ b/config/sources/families/include/meson64_common.inc
@@ -245,8 +245,6 @@ write_uboot_platform() {
family_tweaks_bsp() {
mkdir -p $destination/etc/udev/rules.d
mkdir -p $destination/usr/local/bin
- cp $SRC/packages/bsp/rockchip/hdmi.rules $destination/etc/udev/rules.d
- install -m 755 $SRC/packages/bsp/rockchip/hdmi-hotplug $destination/usr/local/bin
mkdir -p "$destination"/etc/X11/xorg.conf.d
case "${BOARD}" in
diff --git a/config/sources/families/include/rockchip64_common.inc b/config/sources/families/include/rockchip64_common.inc
index 688097ae7..21d07fda2 100644
--- a/config/sources/families/include/rockchip64_common.inc
+++ b/config/sources/families/include/rockchip64_common.inc
@@ -104,8 +104,8 @@ case $BRANCH in
edge)
KERNELPATCHDIR='rockchip64-'$BRANCH
- export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.16.y"
+ export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
+ KERNELBRANCH="branch:linux-5.17.y"
LINUXFAMILY=rockchip64
LINUXCONFIG='linux-rockchip64-'$BRANCH
diff --git a/config/sources/families/jetson-nano.conf b/config/sources/families/jetson-nano.conf
index 9001baf0b..7f7f07c72 100644
--- a/config/sources/families/jetson-nano.conf
+++ b/config/sources/families/jetson-nano.conf
@@ -22,8 +22,8 @@ case $BRANCH in
;;
current)
- export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.15.y"
+ export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
+ KERNELBRANCH="branch:linux-5.17.y"
KERNELPATCHDIR='media-'$BRANCH
LINUXFAMILY=media
LINUXCONFIG='linux-media-'$BRANCH
@@ -32,8 +32,8 @@ case $BRANCH in
edge)
#SKIP_BOOTSPLASH="yes"
- export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.16.y"
+ export KERNEL_MAJOR_MINOR="5.18" # Major and minor versions of this kernel.
+ KERNELBRANCH="branch:linux-5.18.y"
KERNELPATCHDIR='media-'$BRANCH
LINUXFAMILY=media
LINUXCONFIG='linux-media-'$BRANCH
diff --git a/config/sources/families/media.conf b/config/sources/families/media.conf
index cd23586ce..ef89b8f07 100644
--- a/config/sources/families/media.conf
+++ b/config/sources/families/media.conf
@@ -3,7 +3,11 @@ source "${BASH_SOURCE%/*}/include/rockchip64_common.inc"
if [[ $BOARD == station-p2 || $BOARD == station-m2 ]]; then
BOOTSOURCE='https://github.com/150balbes/u-boot-rk'
BOOTBRANCH='branch:rk356x'
- BOOTPATCHDIR="u-boot-station-p2"
+ BOOTPATCHDIR="u-boot-media"
+elif [[ $BOARD == quartz64a ]]; then
+ BOOTSOURCE='https://github.com/150balbes/u-boot-rk'
+ BOOTBRANCH='branch:rk35xx'
+ BOOTPATCHDIR="u-boot-media"
fi
case $BRANCH in
@@ -13,35 +17,40 @@ case $BRANCH in
if [[ $BOARD == station-p2 || $BOARD == station-m2 ]]; then
KERNELSOURCE='https://github.com/150balbes/rockchip-kernel'
- export KERNEL_MAJOR_MINOR="4.19" # Major and minor versions of this kernel.
KERNELBRANCH='branch:kernel-4.19'
KERNELPATCHDIR='station-p2-'$BRANCH
- LINUXCONFIG='linux-station-p2-'$BRANCH
LINUXFAMILY=station-p2
+ LINUXCONFIG='linux-station-p2-'$BRANCH
EXTRAWIFI="no"
WIREGUARD="no"
else
- KERNELSOURCE='https://github.com/ayufan-rock64/linux-kernel'
- export KERNEL_MAJOR_MINOR="4.4" # Major and minor versions of this kernel.
- KERNELBRANCH='tag:4.4.202-1237-rockchip-ayufan'
- KERNELPATCHDIR='rockchip64-'$BRANCH
- LINUXCONFIG='linux-rockchip64-'$BRANCH
- LINUXFAMILY=rockchip64
+ if [[ $BOARD == nanopct4 ]]; then
+ KERNELSOURCE='https://github.com/friendlyarm/kernel-rockchip'
+ KERNELBRANCH='branch:nanopi4-linux-v4.4.y'
+ KERNELPATCHDIR='rk3399-'$BRANCH
+ LINUXFAMILY=rk3399
+ LINUXCONFIG='linux-rk3399-'$BRANCH
+ else
+ KERNELSOURCE='https://github.com/ayufan-rock64/linux-kernel'
+ KERNELBRANCH='tag:4.4.202-1237-rockchip-ayufan'
+ KERNELPATCHDIR='rockchip64-'$BRANCH
+ LINUXFAMILY=rockchip64
+ LINUXCONFIG='linux-rockchip64-'$BRANCH
+ fi
fi
;;
current)
- export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.15.y"
+ KERNELBRANCH="branch:linux-5.17.y"
+ KERNELBRANCH="tag:v5.17.5"
KERNELPATCHDIR='media-'$BRANCH
LINUXFAMILY=media
LINUXCONFIG='linux-media-'$BRANCH
;;
edge)
- #SKIP_BOOTSPLASH="yes"
- export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.17.y"
+ KERNELBRANCH="branch:linux-5.18.y"
+ KERNELBRANCH="tag:v5.18-rc5"
KERNELPATCHDIR='media-'$BRANCH
LINUXFAMILY=media
LINUXCONFIG='linux-media-'$BRANCH
diff --git a/config/sources/families/mvebu.conf b/config/sources/families/mvebu.conf
index ad240d6b6..c8a3affb2 100644
--- a/config/sources/families/mvebu.conf
+++ b/config/sources/families/mvebu.conf
@@ -25,9 +25,9 @@ case $BRANCH in
edge)
- export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
- KERNELBRANCH='branch:linux-5.16.y'
-
+ export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:linux-5.17.y'
+
LINUXCONFIG='linux-mvebu-edge'
KERNELPATCHDIR="mvebu-edge"
diff --git a/config/sources/families/mvebu64.conf b/config/sources/families/mvebu64.conf
index 88cc752d4..d9ae12786 100644
--- a/config/sources/families/mvebu64.conf
+++ b/config/sources/families/mvebu64.conf
@@ -2,6 +2,7 @@ enable_extension "marvell-tools"
ARCH=arm64
BOOTBRANCH='branch:v2022.04'
BOOTENV_FILE='mvebu64.txt'
+BOOTSCRIPT_OUTPUT='boot.scr.uimg'
ATFSOURCE='https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git'
ATFDIR='arm-trusted-firmware-espressobin'
ATFBRANCH='branch:master'
@@ -48,8 +49,8 @@ case $BRANCH in
;;
edge)
- export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
- KERNELBRANCH='branch:linux-5.16.y'
+ export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:linux-5.17.y'
;;
esac
@@ -72,11 +73,15 @@ write_uboot_platform() {
family_tweaks() {
chroot_sdcard_apt_get remove --auto-remove linux-sound-base alsa-base alsa-utils bluez
[[ -f $SDCARD/etc/netplan/armbian-default.yaml ]] && sed -i "s/^ renderer.*/ renderer: networkd/" $SDCARD/etc/netplan/armbian-default.yaml
- cp $SRC/packages/bsp/mvebu64/10* $SDCARD/etc/systemd/network/
+ cp $SRC/packages/bsp/mvebu64/networkd/10* $SDCARD/etc/systemd/network/
echo "#Marvell Espressobin Console" >> $SDCARD/etc/securetty
echo "ttyMV0" >> $SDCARD/etc/securetty
}
+family_tweaks_bsp() {
+ cp "$SRC/packages/bsp/mvebu64/initramfs/99-uboot-fit" "$destination/etc/initramfs/post-update.d/"
+}
+
atf_custom_postprocess() {
# prepare compilers for postprocess
ubootdir="$SRC/cache/sources/$BOOTDIR/${BOOTBRANCH##*:}"
@@ -109,11 +114,12 @@ uboot_custom_postprocess() {
run_host_command_logged cp -pv build/a80x0_mcbin/release/flash-image.bin $ubootdir/$FILENAME
else
cd $moxbootdir
+ make clean # @TODO: rpardini: why?
run_host_command_logged make CROSS_CM3=$ATF2 wtmi_app.bin
cd $atfdir
clocks=(600_600 800_800 1000_800 1200_750)
- topology=(512m_1cs_0 512m_2cs_0 1g_2cs_2 1g_1cs_4 2g_2cs_7 1g_1cs_5 2g_2cs_6)
+ topology=(512m_1cs_0 1g_2cs_2 1g_1cs_4 2g_2cs_7 1g_1cs_5 2g_2cs_6)
for i in "${clocks[@]}"; do
for j in "${topology[@]}"; do
if [[ $j = *cs_5 || $j = *cs_6 ]]; then local ddrname="DDR4"; else ddrname="DDR3"; fi
diff --git a/config/sources/families/odroidxu4.conf b/config/sources/families/odroidxu4.conf
index 02a9947a9..992b2bbb2 100644
--- a/config/sources/families/odroidxu4.conf
+++ b/config/sources/families/odroidxu4.conf
@@ -25,8 +25,8 @@ case $BRANCH in
;;
edge)
- export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
- KERNELBRANCH='branch:linux-5.16.y'
+ export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:linux-5.17.y'
;;
esac
diff --git a/config/sources/families/rk35xx.conf b/config/sources/families/rk35xx.conf
index 1a05d42d1..22cc76952 100644
--- a/config/sources/families/rk35xx.conf
+++ b/config/sources/families/rk35xx.conf
@@ -25,12 +25,8 @@ case $BRANCH in
# temporary until kernel 5.16 is well supported for rockchip64
# it has to be its own family too
edge)
- export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.17.y"
- KERNELPATCHDIR='rk35xx-'$BRANCH
SKIP_BOOTSPLASH="yes"
LINUXFAMILY=rk35xx
- LINUXCONFIG='linux-rk35xx-'$BRANCH
;;
diff --git a/config/sources/families/virtual.conf b/config/sources/families/virtual.conf
index 3745afee6..b5be13db8 100644
--- a/config/sources/families/virtual.conf
+++ b/config/sources/families/virtual.conf
@@ -1,7 +1,7 @@
BOOTBRANCH='tag:v2021.04'
-export KERNEL_MAJOR_MINOR="5.10" # Major and minor versions of this kernel.
-KERNELBRANCH='branch:linux-5.10.y'
+export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
+KERNELBRANCH='branch:linux-5.15.y'
ARCH=arm64
#UBOOT_TARGET_MAP=";;u-boot.bin"
diff --git a/lib/functions/bsp/bsp-cli.sh b/lib/functions/bsp/bsp-cli.sh
index 688bd94c3..a20ea1e57 100644
--- a/lib/functions/bsp/bsp-cli.sh
+++ b/lib/functions/bsp/bsp-cli.sh
@@ -242,7 +242,7 @@ create_board_package() {
fi
# Reload services
- systemctl --no-reload enable armbian-hardware-monitor.service armbian-hardware-optimize.service armbian-zram-config.service >/dev/null 2>&1
+ systemctl --no-reload enable armbian-hardware-monitor.service armbian-hardware-optimize.service armbian-zram-config.service armbian-led-state.service >/dev/null 2>&1
exit 0
EOF
diff --git a/lib/functions/compilation/patch/kernel-bootsplash.sh b/lib/functions/compilation/patch/kernel-bootsplash.sh
index f4e078bfb..cbd929513 100644
--- a/lib/functions/compilation/patch/kernel-bootsplash.sh
+++ b/lib/functions/compilation/patch/kernel-bootsplash.sh
@@ -8,7 +8,10 @@ function apply_kernel_patches_for_bootsplash() {
display_alert "Adding" "Kernel bootsplash patch" "info"
- process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0000-Revert-fbcon-Avoid-cap-set-but-not-used-warning.patch" "applying"
+ if linux-version compare "${version}" ge 5.11; then
+ process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0000-Revert-fbcon-Avoid-cap-set-but-not-used-warning.patch" "applying"
+ fi
+
process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0001-Revert-fbcon-Add-option-to-enable-legacy-hardware-ac.patch" "applying"
if linux-version compare "${version}" ge 5.15; then
diff --git a/lib/functions/compilation/patch/kernel-drivers.sh b/lib/functions/compilation/patch/kernel-drivers.sh
index 6631eb445..8529e4ba1 100644
--- a/lib/functions/compilation/patch/kernel-drivers.sh
+++ b/lib/functions/compilation/patch/kernel-drivers.sh
@@ -31,16 +31,16 @@ function prepare_extra_kernel_drivers() {
#
# Older versions have AUFS support with a patch
- if linux-version compare "${version}" ge 5.1 && linux-version compare "${version}" le 5.18 && [ "$AUFS" == yes ]; then
+ if linux-version compare "${version}" ge 5.1 && linux-version compare "${version}" lt 5.15 && [ "$AUFS" == yes ]; then
# @TODO: Fasthash for this whole block is only the git hash of revision we'd apply from Mr. Okajima
local aufs_tag # attach to specifics tag or branch
aufs_tag=$(echo "${version}" | cut -f 1-2 -d ".")
# manual overrides
- if linux-version compare "${version}" ge 5.4.3 && linux-version compare "${version}" le 5.5 ; then aufstag="5.4.3"; fi
- if linux-version compare "${version}" ge 5.10.82 && linux-version compare "${version}" le 5.11 ; then aufstag="5.10.82"; fi
- if linux-version compare "${version}" ge 5.15.5 && linux-version compare "${version}" le 5.16 ; then aufstag="5.15.5"; fi
- if linux-version compare "${version}" ge 5.17.3 && linux-version compare "${version}" le 5.18 ; then aufstag="5.17.3"; fi
+ if linux-version compare "${version}" ge 5.4.3 && linux-version compare "${version}" le 5.5; then aufstag="5.4.3"; fi
+ if linux-version compare "${version}" ge 5.10.82 && linux-version compare "${version}" le 5.11; then aufstag="5.10.82"; fi
+ if linux-version compare "${version}" ge 5.15.5 && linux-version compare "${version}" le 5.16; then aufstag="5.15.5"; fi
+ if linux-version compare "${version}" ge 5.17.3 && linux-version compare "${version}" le 5.18; then aufstag="5.17.3"; fi
# check if Mr. Okajima already made a branch for this version, otherwise use RC.
git ls-remote --exit-code --heads https://github.com/sfjro/aufs5-standalone "aufs${aufs_tag}" > /dev/null || {
@@ -516,7 +516,7 @@ function prepare_extra_kernel_drivers() {
# Wireless drivers for Realtek 8822BS chipsets
- if linux-version compare "${version}" ge 4.4 && [ "$EXTRAWIFI" == yes ]; then
+ if linux-version compare "${version}" ge 4.4 && linux-version compare "${version}" le 5.16 && [ "$EXTRAWIFI" == yes ]; then
# @TODO: fasthash for this is... ? remote git hash?
# attach to specifics tag or branch
@@ -544,9 +544,6 @@ function prepare_extra_kernel_drivers() {
sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8822bs\/Kconfig"' \
$kerneldir/drivers/net/wireless/Kconfig
- # add support for K5.11+
- process_patch_file "${SRC}/patch/misc/wireless-rtl8822bs.patch" "applying"
-
fi
if linux-version compare $version ge 4.4 && linux-version compare $version lt 5.8; then
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 5b83ff600..5100e6d35 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -32,7 +32,7 @@ function do_main_configuration() {
[[ -z $EXIT_PATCHING_ERROR ]] && EXIT_PATCHING_ERROR="" # exit patching if failed
[[ -z $HOST ]] && HOST="$BOARD" # set hostname to the board
cd "${SRC}" || exit
- [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=17
+ [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=18
[[ -z "${CHROOT_CACHE_VERSION}" ]] && CHROOT_CACHE_VERSION=7
BUILD_REPOSITORY_URL=$(git remote get-url "$(git remote | grep origin)")
BUILD_REPOSITORY_COMMIT=$(git describe --match=d_e_a_d_b_e_e_f --always --dirty)
diff --git a/lib/functions/general/downloads.sh b/lib/functions/general/downloads.sh
index e3df91fe8..ecd383e12 100644
--- a/lib/functions/general/downloads.sh
+++ b/lib/functions/general/downloads.sh
@@ -4,14 +4,29 @@ function webseed() {
# Hardcoded to EU mirrors since
local CCODE=$(curl -s redirect.armbian.com/geoip | jq '.continent.code' -r)
WEBSEED=($(curl -s https://redirect.armbian.com/mirrors | jq -r '.'${CCODE}' | .[] | values'))
+ # remove dead mirrors to suppress download errors
+ FILE=".control"
+ while read -r line; do
+ REMOVE=$(echo $line | egrep -o 'https?://[^ ]+/')
+ WEBSEED=("${WEBSEED[@]/$REMOVE/}")
+ done < <(
+ for k in ${WEBSEED[@]}; do
+ echo "$k$FILE"
+ done | parallel --halt soon,fail=10 --jobs 32 wget -q --spider --timeout=15 --tries=4 --retry-connrefused {} 2>&1 > /dev/null
+ )
+
# aria2 simply split chunks based on sources count not depending on download speed
# when selecting china mirrors, use only China mirror, others are very slow there
if [[ $DOWNLOAD_MIRROR == china ]]; then
- WEBSEED=(https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/)
+ WEBSEED=(
+ https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/
+ )
elif [[ $DOWNLOAD_MIRROR == bfsu ]]; then
- WEBSEED=(https://mirrors.bfsu.edu.cn/armbian-releases/)
+ WEBSEED=(
+ https://mirrors.bfsu.edu.cn/armbian-releases/
+ )
fi
- for toolchain in "${WEBSEED[@]}"; do
+ for toolchain in ${WEBSEED[@]}; do
text="${text} ${toolchain}${1}"
done
text="${text:1}"
diff --git a/lib/functions/general/repo.sh b/lib/functions/general/repo.sh
index 155151300..a68424bd1 100644
--- a/lib/functions/general/repo.sh
+++ b/lib/functions/general/repo.sh
@@ -29,6 +29,14 @@ addtorepo() {
for release in "${distributions[@]}"; do
+ ADDING_PACKAGES="false"
+ if [[ -d "config/distributions/${release}/" ]]; then
+ [[ -n "$(cat config/distributions/${release}/support | grep "csc\|supported" 2> /dev/null)" ]] && ADDING_PACKAGES="true"
+ else
+ display_alert "Skipping adding packages (not supported)" "$release" "wrn"
+ continue
+ fi
+
local forceoverwrite=""
# let's drop from publish if exits
@@ -58,7 +66,7 @@ addtorepo() {
# adding main
if find "${DEB_STORAGE}"/ -maxdepth 1 -type f -name "*.deb" 2> /dev/null | grep -q .; then
- adding_packages "$release" "" "main"
+ [[ "${ADDING_PACKAGES}" == true ]] && adding_packages "$release" "" "main"
else
aptly repo add -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}" "${SCRIPTPATH}config/templates/example.deb" > /dev/null
fi
@@ -67,7 +75,7 @@ addtorepo() {
# adding main distribution packages
if find "${DEB_STORAGE}/${release}" -maxdepth 1 -type f -name "*.deb" 2> /dev/null | grep -q .; then
- adding_packages "${release}-utils" "/${release}" "release packages"
+ [[ "${ADDING_PACKAGES}" == true ]] && adding_packages "${release}-utils" "/${release}" "release packages"
else
# workaround - add dummy package to not trigger error
aptly repo add -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}" "${SCRIPTPATH}config/templates/example.deb" > /dev/null
@@ -75,7 +83,7 @@ addtorepo() {
# adding release-specific utils
if find "${DEB_STORAGE}/extra/${release}-utils" -maxdepth 1 -type f -name "*.deb" 2> /dev/null | grep -q .; then
- adding_packages "${release}-utils" "/extra/${release}-utils" "release utils"
+ [[ "${ADDING_PACKAGES}" == true ]] && adding_packages "${release}-utils" "/extra/${release}-utils" "release utils"
else
aptly repo add -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}-utils" "${SCRIPTPATH}config/templates/example.deb" > /dev/null
fi
@@ -83,7 +91,7 @@ addtorepo() {
# adding desktop
if find "${DEB_STORAGE}/extra/${release}-desktop" -maxdepth 1 -type f -name "*.deb" 2> /dev/null | grep -q .; then
- adding_packages "${release}-desktop" "/extra/${release}-desktop" "desktop"
+ [[ "${ADDING_PACKAGES}" == true ]] && adding_packages "${release}-desktop" "/extra/${release}-desktop" "desktop"
else
# workaround - add dummy package to not trigger error
aptly repo add -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}-desktop" "${SCRIPTPATH}config/templates/example.deb" > /dev/null
diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh
index 335ea584d..b06055335 100644
--- a/lib/functions/image/partitioning.sh
+++ b/lib/functions/image/partitioning.sh
@@ -343,8 +343,12 @@ function prepare_partitions() {
fi
# recompile .cmd to .scr if boot.cmd exists
- [[ -f $SDCARD/boot/boot.cmd ]] &&
- run_host_command_logged mkimage -C none -A arm -T script -d $SDCARD/boot/boot.cmd $SDCARD/boot/boot.scr
+ if [[ -f $SDCARD/boot/boot.cmd ]]; then
+ if [ -z $BOOTSCRIPT_OUTPUT ]; then
+ BOOTSCRIPT_OUTPUT=boot.scr
+ fi
+ run_host_command_logged mkimage -C none -A arm -T script -d $SDCARD/boot/boot.cmd $SDCARD/boot/${BOOTSCRIPT_OUTPUT}
+ fi
# complement extlinux config if it exists; remove armbianEnv in this case.
if [[ -f $SDCARD/boot/extlinux/extlinux.conf ]]; then
diff --git a/lib/functions/main/rootfs-image.sh b/lib/functions/main/rootfs-image.sh
index 590ca1f84..87821d253 100644
--- a/lib/functions/main/rootfs-image.sh
+++ b/lib/functions/main/rootfs-image.sh
@@ -67,6 +67,9 @@ function build_rootfs_and_image() {
# install from apt.armbian.com # @TODO: armbian-nextify this eventually
[[ $EXTERNAL_NEW == prebuilt ]] && LOG_SECTION="packages_prebuilt" do_with_logging chroot_installpackages "yes"
+ # remove existing ssh keys. They will be created in 1st boot process
+ rm -f "${SDCARD}"/etc/ssh/ssh_host*
+
# stage: user customization script
# NOTE: installing too many packages may fill tmpfs mount
LOG_SECTION="customize_image" do_with_logging customize_image
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index 02b79eaad..4b664acc1 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -154,17 +154,23 @@ function install_distribution_agnostic() {
if [[ $SRC_EXTLINUX == yes ]]; then
display_alert "Using extlinux, SRC_EXTLINUX: ${SRC_EXTLINUX}" "image will be incompatible with nand-sata-install" "warn"
mkdir -p $SDCARD/boot/extlinux
+ local bootpart_prefix
+ if [[ -n $BOOTFS_TYPE ]]; then
+ bootpart_prefix=/
+ else
+ bootpart_prefix=/boot/
+ fi
cat <<- EOF > "$SDCARD/boot/extlinux/extlinux.conf"
label ${VENDOR}
- kernel /boot/$NAME_KERNEL
- initrd /boot/$NAME_INITRD
+ kernel ${bootpart_prefix}$NAME_KERNEL
+ initrd ${bootpart_prefix}$NAME_INITRD
EOF
if [[ -n $BOOT_FDT_FILE ]]; then
if [[ $BOOT_FDT_FILE != "none" ]]; then
- echo " fdt /boot/dtb/$BOOT_FDT_FILE" >> "$SDCARD/boot/extlinux/extlinux.conf"
+ echo " fdt ${bootpart_prefix}dtb/$BOOT_FDT_FILE" >> "$SDCARD/boot/extlinux/extlinux.conf"
fi
else
- echo " fdtdir /boot/dtb/" >> "$SDCARD/boot/extlinux/extlinux.conf"
+ echo " fdtdir ${bootpart_prefix}dtb/" >> "$SDCARD/boot/extlinux/extlinux.conf"
fi
else
@@ -431,14 +437,13 @@ function install_distribution_agnostic() {
[[ -f "${SDCARD}"/lib/systemd/system/armbian-ramlog.service ]] && chroot_sdcard systemctl --no-reload enable armbian-ramlog.service
[[ -f "${SDCARD}"/lib/systemd/system/armbian-resize-filesystem.service ]] && chroot_sdcard systemctl --no-reload enable armbian-resize-filesystem.service
[[ -f "${SDCARD}"/lib/systemd/system/armbian-hardware-monitor.service ]] && chroot_sdcard systemctl --no-reload enable armbian-hardware-monitor.service
+ [[ -f "${SDCARD}"/lib/systemd/system/armbian-led-state.service ]] && chroot_sdcard systemctl --no-reload enable armbian-led-state.service
# copy "first run automated config, optional user configured"
cp "${SRC}"/packages/bsp/armbian_first_run.txt.template "${SDCARD}"/boot/armbian_first_run.txt.template
# switch to beta repository at this stage if building nightly images
- [[ $IMAGE_TYPE == nightly ]] &&
- echo "deb https://beta.armbian.com $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" \
- > "${SDCARD}"/etc/apt/sources.list.d/armbian.list
+ [[ $IMAGE_TYPE == nightly ]] && sed -i 's/apt/beta/' "${SDCARD}"/etc/apt/sources.list.d/armbian.list
# fix for https://bugs.launchpad.net/ubuntu/+source/blueman/+bug/1542723 @TODO: from ubuntu 15. maybe gone?
chroot "${SDCARD}" /bin/bash -c "chown root:messagebus /usr/lib/dbus-1.0/dbus-daemon-launch-helper"
@@ -457,7 +462,8 @@ function install_distribution_agnostic() {
sed '/daemon\.\*\;mail.*/,/xconsole/ s/.*/#&/' -i "${SDCARD}"/etc/rsyslog.d/50-default.conf
# disable deprecated parameter
- sed '/.*$KLogPermitNonKernelFacility.*/,// s/.*/#&/' -i "${SDCARD}"/etc/rsyslog.conf
+ [[ -f "${SDCARD}"/etc/rsyslog.conf ]] &&
+ sed '/.*$KLogPermitNonKernelFacility.*/,// s/.*/#&/' -i "${SDCARD}"/etc/rsyslog.conf
# enable getty on multiple serial consoles
# and adjust the speed if it is defined and different than 115200
From eb38c77729431d0c89ae1f0546ab56e450429acc Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 7 May 2022 13:09:55 +0200
Subject: [PATCH] armbian-next: cleanup entrypoint and shuffle
`prepare_host_basic()` into logging section
---
lib/functions/cli/cli-entrypoint.sh | 33 +++++++++++++++------------------
lib/functions/host/basic-deps.sh | 4 ++--
2 files changed, 17 insertions(+), 20 deletions(-)
diff --git a/lib/functions/cli/cli-entrypoint.sh b/lib/functions/cli/cli-entrypoint.sh
index 4cd37537d..c6d0459ed 100644
--- a/lib/functions/cli/cli-entrypoint.sh
+++ b/lib/functions/cli/cli-entrypoint.sh
@@ -4,9 +4,9 @@ function cli_entrypoint() {
if [[ "${ARMBIAN_ENABLE_CALL_TRACING}" == "yes" ]]; then
set -T # inherit return/debug traps
- mkdir -p "${SRC}"/output/debug
- echo -n "" > "${SRC}"/output/debug/calls.txt
- trap 'echo "${BASH_LINENO[@]}|${BASH_SOURCE[@]}|${FUNCNAME[@]}" >> ${SRC}/output/debug/calls.txt ;' RETURN
+ mkdir -p "${SRC}"/output/call-traces
+ echo -n "" > "${SRC}"/output/call-traces/calls.txt
+ trap 'echo "${BASH_LINENO[@]}|${BASH_SOURCE[@]}|${FUNCNAME[@]}" >> ${SRC}/output/call-traces/calls.txt ;' RETURN
fi
check_args "$@"
@@ -21,16 +21,6 @@ function cli_entrypoint() {
else
display_alert "This script requires root privileges, trying to use sudo" "" "wrn"
sudo "${SRC}/compile.sh" "$@"
- exit $?
- fi
-
- # The only way to get this is via ENV var...
- if [ "${OFFLINE_WORK}" == "yes" ]; then
- display_alert "* " "You are working offline!"
- display_alert "* " "Sources, time and host will not be checked"
- else
- # check and install the basic utilities here # @TODO: logging?
- prepare_host_basic
fi
# Purge Armbian Docker images
@@ -45,7 +35,6 @@ function cli_entrypoint() {
# Docker shell
if [[ "${1}" == docker-shell ]]; then
shift
- #shellcheck disable=SC2034
SHELL_ONLY=yes
set -- "docker" "$@"
fi
@@ -75,7 +64,6 @@ function cli_entrypoint() {
CONFIG_PATH=$(dirname "${CONFIG_FILE}")
# DEST is the main output dir.
- # destination. # @TODO: logging this is when we can start logging to file. make sure.
declare DEST="${SRC}/output"
if [ -d "$CONFIG_PATH/output" ]; then
DEST="${CONFIG_PATH}/output"
@@ -83,7 +71,8 @@ function cli_entrypoint() {
display_alert "Output directory DEST:" "${DEST}" "debug"
# set unique mounting directory for this build.
- export ARMBIAN_BUILD_UUID="$(uuidgen)"
+ declare -g ARMBIAN_BUILD_UUID
+ ARMBIAN_BUILD_UUID="$(uuidgen)"
display_alert "Build UUID:" "${ARMBIAN_BUILD_UUID}" "debug"
# Super-global variables, used everywhere. The directories are NOT _created_ here, since this very early stage.
@@ -97,6 +86,14 @@ function cli_entrypoint() {
LOG_SECTION=entrypoint start_logging_section # This creates LOGDIR.
add_cleanup_handler trap_handler_cleanup_logging # cleanup handler for logs; it rolls it up from LOGDIR into DEST/logs
+ if [ "${OFFLINE_WORK}" == "yes" ]; then
+ display_alert "* " "You are working offline!"
+ display_alert "* " "Sources, time and host will not be checked"
+ else
+ # check and install the basic utilities.
+ LOG_SECTION="prepare_host_basic" do_with_logging prepare_host_basic
+ fi
+
# Source the extensions manager library at this point, before sourcing the config.
# This allows early calls to enable_extension(), but initialization proper is done later.
# shellcheck source=lib/extensions.sh
@@ -140,12 +137,12 @@ function cli_entrypoint() {
if [[ -z $1 ]]; then
main_default_build_single
else
- # @TODO: check this with extensions usage?
+ # @TODO: rpardini: check this with extensions usage?
eval "$@"
fi
fi
# Build done, run the cleanup handlers explicitly.
- # This zeroes out the list of cleanups, so it's not done again when the main script exits.
+ # This zeroes out the list of cleanups, so it's not done again when the main script exits normally and trap = 0 runs.
run_cleanup_handlers
}
diff --git a/lib/functions/host/basic-deps.sh b/lib/functions/host/basic-deps.sh
index fff94fbad..4cce0f8bf 100644
--- a/lib/functions/host/basic-deps.sh
+++ b/lib/functions/host/basic-deps.sh
@@ -23,8 +23,8 @@ prepare_host_basic() {
if [[ -n $install_pack ]]; then
display_alert "Installing basic packages" "$install_pack"
- # @TODO: wait, why sudo? we should already be sudo'ed when this executes.
- sudo bash -c "apt-get -qq update && apt-get install -qq -y --no-install-recommends $install_pack"
+ run_host_command_logged sudo apt-get -qq update
+ run_host_command_logged sudo apt-get install -qq -y --no-install-recommends $install_pack
fi
}
From 91af44294685e7747b5df793778a1790756e8ce7 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 20 Apr 2022 15:32:16 +0200
Subject: [PATCH] armbian-next: *breaking change* add global extlinux
killswitch `ALLOW_EXTLINUX`
- unless you set `ALLOW_EXTLINUX=yes`, then `SRC_EXTLINUX` will be disabled globally.
- add a bunch of logging regarding extlinux, armbianEnv and bootscripts for clarity during build
- this is due to nand-sata-install problems with extlinux
- some boards _only work_ with extlinux; we'll have to handle it later
---
lib/functions/bsp/bsp-cli.sh | 8 +++++---
lib/functions/configuration/main-config.sh | 10 ++++++++++
lib/functions/image/partitioning.sh | 5 +++--
lib/functions/rootfs/distro-agnostic.sh | 13 +++++++------
4 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/lib/functions/bsp/bsp-cli.sh b/lib/functions/bsp/bsp-cli.sh
index 5ee670582..688bd94c3 100644
--- a/lib/functions/bsp/bsp-cli.sh
+++ b/lib/functions/bsp/bsp-cli.sh
@@ -25,12 +25,14 @@ create_board_package() {
# if not using extlinux, copy armbianEnv from template; prefer userpatches source
if [[ $SRC_EXTLINUX != yes ]]; then
if [ -f "${USERPATCHES_PATH}/bootscripts/${bootscript_src}" ]; then
- cp "${USERPATCHES_PATH}/bootscripts/${bootscript_src}" "${destination}/usr/share/armbian/${bootscript_dst}"
+ run_host_command_logged cp -pv "${USERPATCHES_PATH}/bootscripts/${bootscript_src}" "${destination}/usr/share/armbian/${bootscript_dst}"
else
- cp "${SRC}/config/bootscripts/${bootscript_src}" "${destination}/usr/share/armbian/${bootscript_dst}"
+ run_host_command_logged cp -pv "${SRC}/config/bootscripts/${bootscript_src}" "${destination}/usr/share/armbian/${bootscript_dst}"
fi
[[ -n $BOOTENV_FILE && -f $SRC/config/bootenv/$BOOTENV_FILE ]] &&
- cp "${SRC}/config/bootenv/${BOOTENV_FILE}" "${destination}"/usr/share/armbian/armbianEnv.txt
+ run_host_command_logged cp -pv "${SRC}/config/bootenv/${BOOTENV_FILE}" "${destination}"/usr/share/armbian/armbianEnv.txt
+ else
+ display_alert "Using extlinux, regular bootscripts ignored" "SRC_EXTLINUX=${SRC_EXTLINUX}" "warn"
fi
# add configuration for setting uboot environment from userspace with: fw_setenv fw_printenv
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 77e15b7b8..5b83ff600 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -223,6 +223,16 @@ function do_main_configuration() {
it is often used to in turn override those.
POST_FAMILY_CONFIG
+ # A global killswitch for extlinux.
+ if [[ "${SRC_EXTLINUX}" == "yes" ]]; then
+ if [[ "${ALLOW_EXTLINUX}" != "yes" ]]; then
+ display_alert "Disabling extlinux support" "extlinux global killswitch; set ALLOW_EXTLINUX=yes to avoid" "info"
+ export SRC_EXTLINUX=no
+ else
+ display_alert "Both SRC_EXTLINUX=yes and ALLOW_EXTLINUX=yes" "enabling extlinux, expect breakage" "warn"
+ fi
+ fi
+
interactive_desktop_main_configuration
[[ -n $ATFSOURCE && -z $ATF_USE_GCC ]] && exit_with_error "Error in configuration: ATF_USE_GCC is unset"
diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh
index 108326aaa..335ea584d 100644
--- a/lib/functions/image/partitioning.sh
+++ b/lib/functions/image/partitioning.sh
@@ -346,10 +346,11 @@ function prepare_partitions() {
[[ -f $SDCARD/boot/boot.cmd ]] &&
run_host_command_logged mkimage -C none -A arm -T script -d $SDCARD/boot/boot.cmd $SDCARD/boot/boot.scr
- # create extlinux config
+ # complement extlinux config if it exists; remove armbianEnv in this case.
if [[ -f $SDCARD/boot/extlinux/extlinux.conf ]]; then
echo " append root=$rootfs $SRC_CMDLINE $MAIN_CMDLINE" >> $SDCARD/boot/extlinux/extlinux.conf
- [[ -f $SDCARD/boot/armbianEnv.txt ]] && rm $SDCARD/boot/armbianEnv.txt
+ display_alert "extlinux.conf exists" "removing armbianEnv.txt" "warn"
+ [[ -f $SDCARD/boot/armbianEnv.txt ]] && run_host_command_logged rm -v $SDCARD/boot/armbianEnv.txt
fi
return 0 # there is a shortcircuit above! very tricky btw!
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index 3e8121a7e..02b79eaad 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -152,6 +152,7 @@ function install_distribution_agnostic() {
# create extlinux config file @TODO: refactor into extensions u-boot, extlinux
if [[ $SRC_EXTLINUX == yes ]]; then
+ display_alert "Using extlinux, SRC_EXTLINUX: ${SRC_EXTLINUX}" "image will be incompatible with nand-sata-install" "warn"
mkdir -p $SDCARD/boot/extlinux
cat <<- EOF > "$SDCARD/boot/extlinux/extlinux.conf"
label ${VENDOR}
@@ -169,17 +170,17 @@ function install_distribution_agnostic() {
if [[ "${BOOTCONFIG}" != "none" ]]; then
if [ -f "${USERPATCHES_PATH}/bootscripts/${bootscript_src}" ]; then
- cp "${USERPATCHES_PATH}/bootscripts/${bootscript_src}" "${SDCARD}/boot/${bootscript_dst}"
+ run_host_command_logged cp -pv "${USERPATCHES_PATH}/bootscripts/${bootscript_src}" "${SDCARD}/boot/${bootscript_dst}"
else
- cp "${SRC}/config/bootscripts/${bootscript_src}" "${SDCARD}/boot/${bootscript_dst}"
+ run_host_command_logged cp -pv "${SRC}/config/bootscripts/${bootscript_src}" "${SDCARD}/boot/${bootscript_dst}"
fi
fi
if [[ -n $BOOTENV_FILE ]]; then
if [[ -f $USERPATCHES_PATH/bootenv/$BOOTENV_FILE ]]; then
- cp "$USERPATCHES_PATH/bootenv/${BOOTENV_FILE}" "${SDCARD}"/boot/armbianEnv.txt
+ run_host_command_logged cp -pv "$USERPATCHES_PATH/bootenv/${BOOTENV_FILE}" "${SDCARD}"/boot/armbianEnv.txt
elif [[ -f $SRC/config/bootenv/$BOOTENV_FILE ]]; then
- cp "${SRC}/config/bootenv/${BOOTENV_FILE}" "${SDCARD}"/boot/armbianEnv.txt
+ run_host_command_logged cp -pv "${SRC}/config/bootenv/${BOOTENV_FILE}" "${SDCARD}"/boot/armbianEnv.txt
fi
fi
@@ -188,9 +189,9 @@ function install_distribution_agnostic() {
if [[ $ROOTFS_TYPE == nfs ]]; then
display_alert "Copying NFS boot script template"
if [[ -f $USERPATCHES_PATH/nfs-boot.cmd ]]; then
- cp "$USERPATCHES_PATH"/nfs-boot.cmd "${SDCARD}"/boot/boot.cmd
+ run_host_command_logged cp -pv "$USERPATCHES_PATH"/nfs-boot.cmd "${SDCARD}"/boot/boot.cmd
else
- cp "${SRC}"/config/templates/nfs-boot.cmd.template "${SDCARD}"/boot/boot.cmd
+ run_host_command_logged cp -pv "${SRC}"/config/templates/nfs-boot.cmd.template "${SDCARD}"/boot/boot.cmd
fi
fi
From 03516ad0f6d5fc598f67c896e6dc28eb91b54ddf Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 6 May 2022 10:25:26 +0200
Subject: [PATCH] armbian-next: extensions: `image-output-{qcow2|ovf}`: virtual
output formats
- which use `qemu-utils` for `qemu-img` conversion of the .img
---
extensions/image-output-ovf.sh | 111 +++++++++++++++++++++++++++++++++++++++
extensions/image-output-qcow2.sh | 16 ++++++
2 files changed, 127 insertions(+)
diff --git a/extensions/image-output-ovf.sh b/extensions/image-output-ovf.sh
new file mode 100644
index 000000000..d3b4617e2
--- /dev/null
+++ b/extensions/image-output-ovf.sh
@@ -0,0 +1,111 @@
+enable_extension "image-output-qcow2"
+
+#### *run before installing host dependencies*
+function add_host_dependencies__ovf_host_deps() {
+ export EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} qemu-utils"
+}
+
+#### *allow extensions to prepare their own config, after user config is done*
+function extension_prepare_config__prepare_ovf_config() {
+ export OVF_VM_CPUS="${OVF_VM_CPUS:-4}" # Number of CPUs
+ export OVF_VM_RAM_GB="${OVF_VM_RAM_GB:-4}" # RAM in Gigabytes
+ export OVF_KEEP_QCOW2="${OVF_KEEP_QCOW2:-no}" # keep the qcow2 image after conversion to OVF
+}
+
+#### *custom post build hook*
+function post_build_image__920_create_ovf() {
+ local OVF_VM_NAME="${OVF_VM_NAME:-${version}}" # The name of the VM when imported into Fusion/Player/Workstation; no spaces please
+ local original_qcow2_image="${QCOW2_IMAGE_FILE}" # Original from qcow2 output extension
+ local temp_qcow2_image="${DESTIMG}/${version}_temp.qcow2" # shadow qcow2 for resize
+
+ local base_vmware_dirname="${OVF_VM_NAME}_vmware" # directory for vmx format, name only
+ local full_vmware_dirname="${DESTIMG}/${base_vmware_dirname}" # directory for vmx format, full path
+ local full_vmx_filename="${full_vmware_dirname}/${OVF_VM_NAME}.vmx" # vmx in vmx format dir
+ local base_file_vmdk="${OVF_VM_NAME}-disk1-efi-rootfs.vmdk" # target temp vmdk (filename)
+ local full_file_vmdk="${full_vmware_dirname}/${base_file_vmdk}" # target temp vmdk (full path)
+ local final_vmx_zip_file="${DESTIMG}/${OVF_VM_NAME}.vmware.zip" # final vmx zip artifact - defaults to UEFI boot
+ mkdir -p "${full_vmware_dirname}" # pre-create it
+
+ display_alert "Converting image to OVF-compatible VMDK format" "${EXTENSION}" "info"
+ run_host_command_logged qemu-img create -f qcow2 -F qcow2 -b "${original_qcow2_image}" "${temp_qcow2_image}" # create a new, temporary, qcow2 with the original as backing image
+ run_host_command_logged qemu-img resize "${temp_qcow2_image}" +47G # resize the temporary
+ run_host_command_logged qemu-img convert -f qcow2 -O vmdk "${temp_qcow2_image}" "${full_file_vmdk}" # convert the big temp to vmdk
+ run_host_command_logged rm -vf "${temp_qcow2_image}" # remove the temporary large qcow2, free space
+ if [[ "${OVF_KEEP_QCOW2}" != "yes" ]]; then # check if told to keep the qcow2 image
+ display_alert "Discarding qcow2 image after" "conversion to VMDK" "debug" # debug
+ run_host_command_logged rm -vf "${original_qcow2_image}" # remove the original qcow2, free space
+ fi # /check
+ run_host_command_logged qemu-img info "${full_file_vmdk}" # show info
+
+ display_alert "Creating .vmx file" "${EXTENSION}" "info"
+
+ cat <<- VMX_FILE > "${full_vmx_filename}"
+ .encoding = "UTF-8"
+ displayname = "${OVF_VM_NAME}"
+ guestos = "ubuntu-64"
+ virtualhw.version = "18"
+ config.version = "8"
+ numvcpus = "${OVF_VM_CPUS}"
+ cpuid.coresPerSocket = "${OVF_VM_CPUS}"
+ memsize = "$((OVF_VM_RAM_GB * 1024))"
+ pciBridge0.present = "TRUE"
+ pciBridge4.present = "TRUE"
+ pciBridge4.virtualDev = "pcieRootPort"
+ pciBridge4.functions = "8"
+ pciBridge5.present = "TRUE"
+ pciBridge5.virtualDev = "pcieRootPort"
+ pciBridge5.functions = "8"
+ pciBridge6.present = "TRUE"
+ pciBridge6.virtualDev = "pcieRootPort"
+ pciBridge6.functions = "8"
+ pciBridge7.present = "TRUE"
+ pciBridge7.virtualDev = "pcieRootPort"
+ pciBridge7.functions = "8"
+ vmci0.present = "TRUE"
+ floppy0.present = "FALSE"
+ mks.enable3d = "true"
+ scsi0:0.present = "TRUE"
+ scsi0:0.deviceType = "disk"
+ scsi0:0.fileName = "${base_file_vmdk}"
+ scsi0:0.allowguestconnectioncontrol = "false"
+ scsi0:0.mode = "persistent"
+ scsi0.virtualDev = "pvscsi"
+ scsi0.present = "TRUE"
+ ethernet0.present = "TRUE"
+ ethernet0.virtualDev = "vmxnet3"
+ ethernet0.connectionType = "nat"
+ ethernet0.startConnected = "TRUE"
+ ethernet0.addressType = "generated"
+ ethernet0.wakeonpcktrcv = "false"
+ ethernet0.allowguestconnectioncontrol = "true"
+ sata0.present = "TRUE"
+ vmci0.unrestricted = "false"
+ vcpu.hotadd = "true"
+ mem.hotadd = "true"
+ tools.syncTime = "true"
+ toolscripts.afterpoweron = "true"
+ toolscripts.afterresume = "true"
+ toolscripts.beforepoweroff = "true"
+ toolscripts.beforesuspend = "true"
+ powerType.powerOff = "soft"
+ powerType.reset = "soft"
+ powerType.suspend = "soft"
+ usb.present = "TRUE"
+ ehci.present = "TRUE"
+ usb_xhci.present = "TRUE"
+ hard-disk.hostBuffer = "enabled"
+ ulm.disableMitigations = "TRUE"
+ vhv.enable = "TRUE"
+ vmx.buildType = "release"
+ firmware = "efi"
+ VMX_FILE
+
+ # Now wrap the .vmx in a zip, with minimal compression. (release will .zst it later)
+ display_alert "Zipping/storing vmx" "${EXTENSION}" "info"
+ cd "${DESTIMG}" || false
+ run_host_command_logged zip -0 "${final_vmx_zip_file}" "${base_vmware_dirname}"/*
+ cd - || false
+
+ display_alert "Done, cleaning up" "${EXTENSION}" "info"
+ rm -rf "${full_vmware_dirname}"
+}
diff --git a/extensions/image-output-qcow2.sh b/extensions/image-output-qcow2.sh
new file mode 100644
index 000000000..2633062ed
--- /dev/null
+++ b/extensions/image-output-qcow2.sh
@@ -0,0 +1,16 @@
+add_host_dependencies__ovf_host_deps() {
+ [[ "${SKIP_QCOW2}" == "yes" ]] && return 0
+ export EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} qemu-utils"
+}
+
+function post_build_image__900_convert_to_qcow2_img() {
+ [[ "${SKIP_QCOW2}" == "yes" ]] && return 0
+ display_alert "Converting image to qcow2" "${EXTENSION}" "info"
+ export QCOW2_IMAGE_FILE="${DESTIMG}/${version}.img.qcow2"
+ run_host_command_logged qemu-img convert -f raw -O qcow2 "${DESTIMG}/${version}.img" "${QCOW2_IMAGE_FILE}"
+ run_host_command_logged qemu-img info "${QCOW2_IMAGE_FILE}"
+ if [[ "${QCOW2_RESIZE_AMOUNT}" != "" ]]; then
+ display_alert "Resizing qcow2 image by '${QCOW2_RESIZE_AMOUNT}' " "${EXTENSION}" "info"
+ qemu-img resize "${QCOW2_IMAGE_FILE}" "${QCOW2_RESIZE_AMOUNT}"
+ fi
+}
From 36a2c3741d28a6280af99bcd7d8f9d3a339a7fcb Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 6 May 2022 10:24:10 +0200
Subject: [PATCH] armbian-next: extension: `kernel-localmodconfig`:
faster/slimmer kernel builds with `make localmodconfig`
---
extensions/kernel-localmodconfig.sh | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/extensions/kernel-localmodconfig.sh b/extensions/kernel-localmodconfig.sh
new file mode 100644
index 000000000..40248bafe
--- /dev/null
+++ b/extensions/kernel-localmodconfig.sh
@@ -0,0 +1,21 @@
+function extension_prepare_config__prepare_localmodconfig() {
+ # If defined, ${KERNEL_CONFIG_FROM_LSMOD} can contain a lsmod to apply to the kernel configuration.
+ # to get a file for this run 'lsmod > my_machine.lsmod' and then put it in userpatches/lsmod/
+ export KERNEL_CONFIG_FROM_LSMOD="${KERNEL_CONFIG_FROM_LSMOD:-}"
+ display_alert "localmodconfig INIT lsmod" "${KERNEL_CONFIG_FROM_LSMOD}" "warn"
+
+ # If there, make sure it exists
+ local lsmod_file="${SRC}/userpatches/lsmod/${KERNEL_CONFIG_FROM_LSMOD}.lsmod"
+ if [[ ! -f "${lsmod_file}" ]]; then
+ exit_with_error "Can't find lsmod file ${lsmod_file}, configure with KERNEL_CONFIG_FROM_LSMOD=xxx"
+ fi
+}
+
+# This needs much more love than this. can be used to make "light" versions of kernels, that compile 3x-5x faster or more
+function custom_kernel_config_post_defconfig__apply_localmodconfig() {
+ display_alert "localmodconfig with lsmod" "${KERNEL_CONFIG_FROM_LSMOD}" "warn"
+ if [[ "a${KERNEL_CONFIG_FROM_LSMOD}a" != "aa" ]]; then
+ local lsmod_file="${SRC}/userpatches/lsmod/${KERNEL_CONFIG_FROM_LSMOD}.lsmod"
+ run_kernel_make "LSMOD=${lsmod_file}" localmodconfig
+ fi
+}
From 981a9f5856ba100eaad07c9ffe7e24f578e93003 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 6 May 2022 10:23:29 +0200
Subject: [PATCH] armbian-next: extension: `cleanup-space-final-image`:
zerofree, slim down firmware, show used space
---
extensions/cleanup-space-final-image.sh | 37 +++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/extensions/cleanup-space-final-image.sh b/extensions/cleanup-space-final-image.sh
new file mode 100644
index 000000000..62321285b
--- /dev/null
+++ b/extensions/cleanup-space-final-image.sh
@@ -0,0 +1,37 @@
+add_host_dependencies__ovf_host_deps() {
+ export EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} zerofree"
+}
+
+function post_customize_image__998_cleanup_apt_stuff() {
+ display_alert "Cleaning up apt package lists and cache" "${EXTENSION}" "info"
+ chroot_sdcard "apt-get clean && rm -rf /var/lib/apt/lists"
+
+ declare -a too_big_firmware=("netronome" "qcom" "mrv" "qed" "mellanox") # maybe: "amdgpu" "radeon" but I have an AMD GPU.
+ for big_firm in "${too_big_firmware[@]}"; do
+ local firm_dir="${SDCARD}/usr/lib/firmware/${big_firm}"
+ if [[ -d "${firm_dir}" ]]; then
+ display_alert "Cleaning too-big firmware" "${big_firm}" "info"
+ rm -rf "${firm_dir}"
+ fi
+ done
+}
+
+# Zerofree the image early after umounting it
+function post_umount_final_image__200_zerofree() {
+ display_alert "Zerofreeing image" "${EXTENSION}" "info"
+ for partDev in "${LOOP}"p?; do
+ local partType
+ partType="$(file -s "${partDev}" | awk -F ': ' '{print $2}')"
+ if [[ "${partType}" == *"ext4"* ]]; then
+ display_alert "Zerofreeing ext4 partition ${partDev}" "${EXTENSION}" "info"
+ run_host_command_logged zerofree "${partDev}"
+ else
+ display_alert "Skipping zerofreeing partition ${partDev} of type '${partType}'" "${EXTENSION}" "info"
+ fi
+ done
+}
+
+function pre_umount_final_image__999_show_space_usage() {
+ display_alert "Calculating used space in image" "${EXTENSION}" "info"
+ run_host_command_logged "cd ${MOUNT} && " du -h -d 4 -x "." "| sort -h | tail -20"
+}
From 5d51b5559c28815deb56d27e1ca22765dc22e853 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 23 Apr 2022 16:07:44 +0200
Subject: [PATCH] armbian-next: introduce `do_with_ccache_statistics` and use
it for kernel compile
- some TODOs
- better logging for .config copying
---
lib/functions/compilation/kernel.sh | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index d6dd30920..86235f767 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -3,16 +3,18 @@ function run_kernel_make() {
declare -a common_make_params_quoted common_make_envs full_command
common_make_envs=(
- "CCACHE_BASEDIR=\"$(pwd)\"" # Base directory for ccache, for cache reuse
+ "CCACHE_BASEDIR=\"$(pwd)\"" # Base directory for ccache, for cache reuse # @TODO: experiment with this and the source path to maximize hit rate
"PATH=\"${toolchain}:${PATH}\"" # Insert the toolchain first into the PATH.
"DPKG_COLORS=always" # Use colors for dpkg
"XZ_OPT='--threads=0'" # Use parallel XZ compression
)
common_make_params_quoted=(
+ # @TODO: introduce O=path/to/binaries, so sources and bins are not in the same dir.
+
"$CTHREADS" # Parallel compile, "-j X" for X cpus
"ARCH=${ARCHITECTURE}" # Key param. Everything depends on this.
- "LOCALVERSION=-${LINUXFAMILY}" # Change the internal kernel version to include the family. Changing this causes recompiles
+ "LOCALVERSION=-${LINUXFAMILY}" # Change the internal kernel version to include the family. Changing this causes recompiles # @TODO change to "localversion" file
"CROSS_COMPILE=${CCACHE} ${KERNEL_COMPILER}" # added as prefix to every compiler invocation by make
"KCFLAGS=-fdiagnostics-color=always -Wno-error=misleading-indentation" # Force GCC colored messages, downgrade misleading indentation to warning
@@ -133,6 +135,8 @@ function kernel_prepare_patching() {
cd "${kernel_work_dir}" || exit
# @TODO: why would we delete localversion?
+ # @TODO: it should be the opposite, writing localversion to disk, _instead_ of passing it via make.
+ # @TODO: if it turns out to be the case, do a commit with it... (possibly later, after patching?)
rm -f localversion
# read kernel version
@@ -204,17 +208,17 @@ function kernel_config() {
if [[ $KERNEL_KEEP_CONFIG == yes && -f "${DEST}"/config/$LINUXCONFIG.config ]]; then
display_alert "Using previous kernel config" "${DEST}/config/$LINUXCONFIG.config" "info"
- cp -p "${DEST}/config/${LINUXCONFIG}.config" .config
+ run_host_command_logged cp -pv "${DEST}/config/${LINUXCONFIG}.config" .config
else
if [[ -f $USERPATCHES_PATH/$LINUXCONFIG.config ]]; then
display_alert "Using kernel config provided by user" "userpatches/$LINUXCONFIG.config" "info"
- cp -p "${USERPATCHES_PATH}/${LINUXCONFIG}.config" .config
+ run_host_command_logged cp -pv "${USERPATCHES_PATH}/${LINUXCONFIG}.config" .config
elif [[ -f "${USERPATCHES_PATH}/config/kernel/${LINUXCONFIG}.config" ]]; then
display_alert "Using kernel config provided by user in config/kernel folder" "config/kernel/${LINUXCONFIG}.config" "info"
- cp -p "${USERPATCHES_PATH}/config/kernel/${LINUXCONFIG}.config" .config
+ run_host_command_logged cp -pv "${USERPATCHES_PATH}/config/kernel/${LINUXCONFIG}.config" .config
else
display_alert "Using kernel config file" "config/kernel/$LINUXCONFIG.config" "info"
- cp -p "${SRC}/config/kernel/${LINUXCONFIG}.config" .config
+ run_host_command_logged cp -pv "${SRC}/config/kernel/${LINUXCONFIG}.config" .config
COPY_CONFIG_BACK_TO="${SRC}/config/kernel/${LINUXCONFIG}.config"
fi
fi
@@ -362,6 +366,7 @@ function kernel_build_and_package() {
display_alert "Building kernel" "${LINUXCONFIG} ${build_targets[*]}" "info"
fasthash_debug "build"
make_filter="| grep --line-buffered -v -e 'CC' -e 'LD' -e 'AR' -e 'INSTALL' -e 'SIGN' -e 'XZ' " \
+ do_with_ccache_statistics \
run_kernel_make_long_running "${install_make_params_quoted[@]@Q}" "${build_targets[@]}"
fasthash_debug "build"
@@ -370,3 +375,13 @@ function kernel_build_and_package() {
display_alert "Kernel built and packaged in" "$((SECONDS - ts)) seconds - ${version}-${LINUXFAMILY}" "info"
}
+
+function do_with_ccache_statistics() {
+ display_alert "Clearing ccache statistics" "ccache" "debug"
+ ccache --zero-stats
+
+ "$@"
+
+ display_alert "Display ccache statistics" "ccache" "debug"
+ run_host_command_logged ccache --show-stats
+}
From 0a29ad6f91eae99594e52173724fdf87b5b186d5 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 16 Apr 2022 19:23:13 +0200
Subject: [PATCH] armbian-next: *breaking change* really disable apt sources
for non-desktop builds
---
lib/functions/rootfs/apt-sources.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/functions/rootfs/apt-sources.sh b/lib/functions/rootfs/apt-sources.sh
index bc17a3a9b..a3451e5ed 100644
--- a/lib/functions/rootfs/apt-sources.sh
+++ b/lib/functions/rootfs/apt-sources.sh
@@ -8,7 +8,7 @@ add_apt_sources() {
# @TODO: rpardini: The logic here is meant to be evolved over time. Originally, all of this only ran when BUILD_DESKTOP=yes.
# Igor had bumped it to run on all builds, but that adds external sources to cli and minimal.
# Here I'm tuning it down to 1/4th of the original, eg: no nala on my cli builds, thanks.
- [[ "${BUILD_MINIMAL}" != "yes" ]] && get_all_potential_paths "${DEBOOTSTRAP_SEARCH_RELATIVE_DIRS}" "${sub_dirs_to_check}" "sources/apt"
+ [[ "${BUILD_DESKTOP}" != "yes" ]] && get_all_potential_paths "${DEBOOTSTRAP_SEARCH_RELATIVE_DIRS}" "${sub_dirs_to_check}" "sources/apt"
[[ "${BUILD_DESKTOP}" == "yes" ]] && get_all_potential_paths "${CLI_SEARCH_RELATIVE_DIRS}" "${sub_dirs_to_check}" "sources/apt"
[[ "${BUILD_DESKTOP}" == "yes" ]] && get_all_potential_paths "${DESKTOP_ENVIRONMENTS_SEARCH_RELATIVE_DIRS}" "." "sources/apt"
[[ "${BUILD_DESKTOP}" == "yes" ]] && get_all_potential_paths "${DESKTOP_APPGROUPS_SEARCH_RELATIVE_DIRS}" "${DESKTOP_APPGROUPS_SELECTED}" "sources/apt"
From fc0621decc383f2aed1194f882035b26de49c0aa Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 29 Apr 2022 17:55:47 +0200
Subject: [PATCH] armbian-next: fix: don't manage apt-cacher-ng if told NOT to,
not the other way around
---
lib/functions/host/apt-cacher-ng.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/functions/host/apt-cacher-ng.sh b/lib/functions/host/apt-cacher-ng.sh
index 4801784c7..120c39001 100644
--- a/lib/functions/host/apt-cacher-ng.sh
+++ b/lib/functions/host/apt-cacher-ng.sh
@@ -54,7 +54,7 @@ function acng_configure_and_restart_acng() {
}
function acng_check_status_or_restart() {
- [[ $NO_APT_CACHER != yes ]] && return 0 # don't if told not to
+ [[ $NO_APT_CACHER == yes ]] && return 0 # don't if told not to
[[ "${APT_PROXY_ADDR:-localhost:3142}" != "localhost:3142" ]] && return 0 # also not if acng not local to builder machine
if ! systemctl -q is-active apt-cacher-ng.service; then
From bdb9aba47d9b70cfb04089866bafe176a1e6dab6 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 16 Apr 2022 14:55:43 +0200
Subject: [PATCH] armbian-next: `JUST_UBOOT=yes` + hooks
`build_custom_uboot()`/`post_write_uboot_platform()`
- post_write_uboot_platform()
- only runs during build, for now (not on device)
- build_custom_uboot()
- allow fully custom, extension driven, building of u-boot
- also partial preparation of uboot source combined with default Armbian build
- HACK: u-boot: downgrade some errors to warnings via KCFLAGS
- fix copy of atf bins to uboot, don't do it if atf's not there
---
lib/functions/compilation/uboot.sh | 47 +++++++++++++++++++++++++------------
lib/functions/image/loop.sh | 26 +++++++++++++-------
lib/functions/main/default-build.sh | 17 +++++++++++---
3 files changed, 63 insertions(+), 27 deletions(-)
diff --git a/lib/functions/compilation/uboot.sh b/lib/functions/compilation/uboot.sh
index fd3ae385a..f87470eb7 100644
--- a/lib/functions/compilation/uboot.sh
+++ b/lib/functions/compilation/uboot.sh
@@ -30,7 +30,8 @@ function compile_uboot_target() {
# create patch for manual source changes
[[ $CREATE_PATCHES == yes ]] && userpatch_create "u-boot"
- if [[ -n $ATFSOURCE ]]; then
+ if [[ -n $ATFSOURCE && -d "${atftempdir}" ]]; then
+ display_alert "Copying over bins from atftempdir" "${atftempdir}" "debug"
cp -Rv "${atftempdir}"/*.bin .
rm -rf "${atftempdir}"
fi
@@ -72,7 +73,9 @@ function compile_uboot_target() {
display_alert "${uboot_prefix}Compiling u-boot" "${version} ${target_make}" "info"
export if_error_detail_message="${uboot_prefix}Failed to build u-boot ${version} ${target_make}"
- run_host_command_logged_long_running CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${toolchain2}:${PATH}" make "$target_make" "$CTHREADS" "${cross_compile}" "KCFLAGS=-fdiagnostics-color=always"
+ KCFLAGS="-fdiagnostics-color=always -Wno-error=maybe-uninitialized -Wno-error=misleading-indentation" \
+ run_host_command_logged_long_running CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${toolchain2}:${PATH}" \
+ make "$target_make" "$CTHREADS" "${cross_compile}"
if [[ $(type -t uboot_custom_postprocess) == function ]]; then
display_alert "${uboot_prefix}Postprocessing u-boot" "${version} ${target_make}"
@@ -93,7 +96,7 @@ function compile_uboot_target() {
fi
display_alert "${uboot_prefix}Deploying u-boot binary target" "${version} ${target_make} :: ${f_dst}"
[[ ! -f $f_src ]] && exit_with_error "U-boot artifact not found" "$(basename "${f_src}")"
- run_host_command_logged cp -v "${f_src}" "$uboottempdir/${uboot_name}/usr/lib/${uboot_name}/${f_dst}"
+ run_host_command_logged cp -v "${f_src}" "${uboottempdir}/${uboot_name}/usr/lib/${uboot_name}/${f_dst}"
#display_alert "Done with binary target" "${version} ${target_make} :: ${f_dst}"
done
@@ -151,18 +154,32 @@ compile_uboot() {
chmod 700 "${uboottempdir}"
mkdir -p "$uboottempdir/$uboot_name/usr/lib/u-boot" "$uboottempdir/$uboot_name/usr/lib/$uboot_name" "$uboottempdir/$uboot_name/DEBIAN"
- # Try very hard, to fault even, to avoid using subshells while reading a newline-delimited string.
- # Sorry for the juggling with IFS.
- local _old_ifs="${IFS}" _new_ifs=$'\n' uboot_target_counter=1
- IFS="${_new_ifs}" # split on newlines only
- for target in ${UBOOT_TARGET_MAP}; do
- IFS="${_old_ifs}" # restore for the body of loop
- export target uboot_name uboottempdir toolchain version uboot_target_counter
- compile_uboot_target
- uboot_target_counter=$((uboot_target_counter + 1))
- IFS="${_new_ifs}" # split on newlines only for rest of loop
- done
- IFS="${_old_ifs}"
+ # Allow extension-based u-boot bulding. We call the hook, and if EXTENSION_BUILT_UBOOT="yes" afterwards, we skip our own compilation.
+ # This is to make it easy to build vendor/downstream uboot with their own quirks.
+
+ display_alert "Extensions: build custom uboot" "build_custom_uboot" "debug"
+ call_extension_method "build_custom_uboot" <<- 'BUILD_CUSTOM_UBOOT'
+ *allow extensions to build their own uboot*
+ For downstream uboot et al.
+ Set \`EXTENSION_BUILT_UBOOT=yes\` to then skip the normal compilation.
+ BUILD_CUSTOM_UBOOT
+
+ if [[ "${EXTENSION_BUILT_UBOOT}" != "yes" ]]; then
+ # Try very hard, to fault even, to avoid using subshells while reading a newline-delimited string.
+ # Sorry for the juggling with IFS.
+ local _old_ifs="${IFS}" _new_ifs=$'\n' uboot_target_counter=1
+ IFS="${_new_ifs}" # split on newlines only
+ for target in ${UBOOT_TARGET_MAP}; do
+ IFS="${_old_ifs}" # restore for the body of loop
+ export target uboot_name uboottempdir toolchain version uboot_target_counter
+ compile_uboot_target
+ uboot_target_counter=$((uboot_target_counter + 1))
+ IFS="${_new_ifs}" # split on newlines only for rest of loop
+ done
+ IFS="${_old_ifs}"
+ else
+ display_alert "Extensions: custom uboot built by extension" "not building regular uboot" "debug"
+ fi
display_alert "Preparing u-boot general packaging. all_worked:${all_worked} any_worked:${any_worked} " "${version} ${target_make}"
diff --git a/lib/functions/image/loop.sh b/lib/functions/image/loop.sh
index 97ee1891e..9d79f8139 100644
--- a/lib/functions/image/loop.sh
+++ b/lib/functions/image/loop.sh
@@ -36,9 +36,9 @@ write_uboot_to_loop_image() {
revision=${REVISION}
if [[ -n $UBOOT_REPO_VERSION ]]; then
revision=${UBOOT_REPO_VERSION}
- dpkg -x "${DEB_STORAGE}/linux-u-boot-${BOARD}-${BRANCH}_${revision}_${ARCH}.deb" ${TEMP_DIR}/ 2>&1
+ run_host_command_logged dpkg -x "${DEB_STORAGE}/linux-u-boot-${BOARD}-${BRANCH}_${revision}_${ARCH}.deb" ${TEMP_DIR}/
else
- dpkg -x "${DEB_STORAGE}/${CHOSEN_UBOOT}_${revision}_${ARCH}.deb" ${TEMP_DIR}/ 2>&1
+ run_host_command_logged dpkg -x "${DEB_STORAGE}/${CHOSEN_UBOOT}_${revision}_${ARCH}.deb" ${TEMP_DIR}/
fi
if [[ ! -f "${TEMP_DIR}/usr/lib/u-boot/platform_install.sh" ]]; then
@@ -46,15 +46,23 @@ write_uboot_to_loop_image() {
fi
display_alert "Sourcing u-boot install functions" "$loop" "info"
- source ${TEMP_DIR}/usr/lib/u-boot/platform_install.sh 2>&1
+ source ${TEMP_DIR}/usr/lib/u-boot/platform_install.sh
+ set -e # make sure, we just included something that might disable it
display_alert "Writing u-boot bootloader" "$loop" "info"
- write_uboot_platform "${TEMP_DIR}${DIR}" "$loop" 2>&1
- [[ $? -ne 0 ]] && {
- rm -rf ${TEMP_DIR}
- exit_with_error "U-boot bootloader failed to install" "@host"
- }
- rm -rf ${TEMP_DIR}
+ write_uboot_platform "${TEMP_DIR}${DIR}" "$loop" # @TODO: rpardini: what is ${DIR} ?
+
+ export UBOOT_CHROOT_DIR="${TEMP_DIR}${DIR}"
+
+ call_extension_method "post_write_uboot_platform" <<- 'POST_WRITE_UBOOT_PLATFORM'
+ *allow custom writing of uboot -- only during image build*
+ Called after `write_uboot_platform()`.
+ It receives `UBOOT_CHROOT_DIR` with the full path to the u-boot dir in the chroot.
+ Important: this is only called inside the build system.
+ Consider that `write_uboot_platform()` is also called board-side, when updating uboot, eg: nand-sata-install.
+ POST_WRITE_UBOOT_PLATFORM
+
+ #rm -rf ${TEMP_DIR}
return 0
}
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index 8f051610f..6f0823648 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -29,8 +29,15 @@ function main_default_build_single() {
# Too many things being done. Allow doing only one thing. For core development, mostly.
# Also because "KERNEL_ONLY=yes" should really be spelled "PACKAGES_ONLY=yes"
- local do_build_uboot="yes" do_build_kernel="yes" exit_after_kernel_build="no" do_host_tools="yes"
- if [[ "${JUST_KERNEL}" == "yes" ]]; then
+ local do_build_uboot="yes" do_build_kernel="yes" exit_after_kernel_build="no" exit_after_uboot_build="no" do_host_tools="yes"
+ if [[ "${JUST_UBOOT}" == "yes" && "${JUST_KERNEL}" == "yes" ]]; then
+ exit_with_error "User of build system" "can't make up his mind about JUST_KERNEL or JUST_UBOOT"
+ elif [[ "${JUST_UBOOT}" == "yes" ]]; then
+ display_alert "JUST_KERNEL set to yes" "Building only kernel and exiting after that" "debug"
+ do_build_uboot="yes"
+ do_host_tools="yes" # rkbin, fips, etc.
+ exit_after_uboot_build="yes"
+ elif [[ "${JUST_KERNEL}" == "yes" ]]; then
display_alert "JUST_KERNEL set to yes" "Building only kernel and exiting after that" "debug"
do_build_uboot="no"
exit_after_kernel_build="yes"
@@ -67,6 +74,10 @@ function main_default_build_single() {
fi
fi
fi
+ if [[ "${exit_after_uboot_build}" == "yes" ]]; then
+ display_alert "Exiting after u-boot build" "JUST_UBOOT=yes" "info"
+ exit 0
+ fi
fi
# Compile kernel if packed .deb does not exist or use the one from repository
@@ -78,7 +89,7 @@ function main_default_build_single() {
fi
fi
if [[ "${exit_after_kernel_build}" == "yes" ]]; then
- display_alert "Only building kernel and exiting" "NOW" "debug"
+ display_alert "Only building kernel and exiting" "JUST_KERNEL=yes" "debug"
exit 0
fi
fi
From 893b8615a1a976ee6246e186f59aba468ad1a7b5 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 28 Apr 2022 09:35:26 +0200
Subject: [PATCH] armbian-next: fix: no use testing the host for resolvconf if
we're manipulating the SDCARD
---
lib/functions/rootfs/distro-agnostic.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index 238bdb9d0..3e8121a7e 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -504,7 +504,7 @@ function install_distribution_agnostic() {
cp "${SDCARD}"/etc/armbian-release "${SDCARD}"/etc/armbian-image-release
# DNS fix. package resolvconf is not available everywhere
- if [ -d /etc/resolvconf/resolv.conf.d ] && [ -n "$NAMESERVER" ]; then
+ if [ -d "${SDCARD}"/etc/resolvconf/resolv.conf.d ] && [ -n "$NAMESERVER" ]; then
echo "nameserver $NAMESERVER" > "${SDCARD}"/etc/resolvconf/resolv.conf.d/head
fi
From 25a8de27bb2b240734c1647a71826688b474b0a0 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 24 Apr 2022 09:32:14 +0200
Subject: [PATCH] armbian-next: sunxi_common: avoid shortcircuit error on
family_tweaks_bsp when family_tweaks_bsp_s is not defined
---
config/sources/families/include/sunxi_common.inc | 2 ++
lib/functions/bsp/bsp-cli.sh | 6 +++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/config/sources/families/include/sunxi_common.inc b/config/sources/families/include/sunxi_common.inc
index a16180506..8ac7a5551 100644
--- a/config/sources/families/include/sunxi_common.inc
+++ b/config/sources/families/include/sunxi_common.inc
@@ -52,6 +52,8 @@ family_tweaks() {
family_tweaks_bsp() {
# execute specific tweaks function if present
[[ $(type -t family_tweaks_bsp_s) == function ]] && family_tweaks_bsp_s
+
+ return 0 # short-circuit above, avoid errors on exit.
}
write_uboot_platform() {
diff --git a/lib/functions/bsp/bsp-cli.sh b/lib/functions/bsp/bsp-cli.sh
index c52910403..5ee670582 100644
--- a/lib/functions/bsp/bsp-cli.sh
+++ b/lib/functions/bsp/bsp-cli.sh
@@ -288,9 +288,9 @@ create_board_package() {
# execute $LINUXFAMILY-specific tweaks
if [[ $(type -t family_tweaks_bsp) == function ]]; then
- display_alert "Running family_tweaks_bsp" "${LINUXFAMILY}" "debug"
- family_tweaks_bsp 2>&1
- display_alert "Done with family_tweaks_bsp" "${LINUXFAMILY}" "debug"
+ display_alert "Running family_tweaks_bsp" "${LINUXFAMILY} - ${BOARDFAMILY}" "debug"
+ family_tweaks_bsp
+ display_alert "Done with family_tweaks_bsp" "${LINUXFAMILY} - ${BOARDFAMILY}" "debug"
fi
call_extension_method "post_family_tweaks_bsp" <<- 'POST_FAMILY_TWEAKS_BSP'
From c46418fd00b24879e4a4f18f77c19ccb887a9346 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 22 Apr 2022 12:50:21 +0200
Subject: [PATCH] armbian-next: fix: add `zstd` and `parallel` to hostdeps
---
lib/functions/host/prepare-host.sh | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/functions/host/prepare-host.sh b/lib/functions/host/prepare-host.sh
index da443e4fb..b48f666b1 100644
--- a/lib/functions/host/prepare-host.sh
+++ b/lib/functions/host/prepare-host.sh
@@ -43,11 +43,11 @@ prepare_host() {
zlib1g-dev
# non-mess below?
- file ccze colorized-logs tree # logging utilities
- unzip zip p7zip-full pigz pixz pbzip2 lzop # compressors et al
- parted gdisk # partition tools
- aria2 curl wget # downloaders et al
-
+ file ccze colorized-logs tree # logging utilities
+ unzip zip p7zip-full pigz pixz pbzip2 lzop zstd # compressors et al
+ parted gdisk # partition tools
+ aria2 curl wget # downloaders et al
+ parallel # do things in parallel
# toolchains. NEW: using metapackages, allow us to have same list of all arches; brings both C and C++ compilers
crossbuild-essential-armhf crossbuild-essential-armel # for ARM 32-bit, both HF and EL are needed in some cases.
crossbuild-essential-arm64 # For ARM 64-bit, arm64.
From 6d5a8490804d8427c6f4578389b0ae73c746ed61 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 20 Apr 2022 12:49:20 +0200
Subject: [PATCH] armbian-next: manual merge (17) of all changes between
revisions 64410fb74b44cca82e9affbdf93a59d5692862ff and
08cf31de73de5f5ba1986348e4556b00d77af09f
- changes about `git safe dir` ignored, I've done the same in a different way
- hash calculation changes ignored, fasthash is completely different
---
config/sources/families/include/sunxi64_common.inc | 6 +++---
config/sources/families/include/sunxi_common.inc | 6 +++---
config/sources/families/include/uefi_common.inc | 4 ++--
config/sources/families/mvebu64.conf | 4 ++--
lib/functions/compilation/patch/kernel-drivers.sh | 7 ++++---
lib/functions/host/external-toolchains.sh | 2 ++
6 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/config/sources/families/include/sunxi64_common.inc b/config/sources/families/include/sunxi64_common.inc
index 323d67c1c..61addb39b 100644
--- a/config/sources/families/include/sunxi64_common.inc
+++ b/config/sources/families/include/sunxi64_common.inc
@@ -26,9 +26,9 @@ case $BRANCH in
;;
edge)
- export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
- export KERNELBRANCH="branch:linux-5.16.y"
- export KERNELBRANCH_MEGOUS="branch:orange-pi-5.16"
+ export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
+ export KERNELBRANCH="branch:linux-5.17.y"
+ export KERNELBRANCH_MEGOUS="branch:orange-pi-5.17"
;;
esac
diff --git a/config/sources/families/include/sunxi_common.inc b/config/sources/families/include/sunxi_common.inc
index a9f14f950..a16180506 100644
--- a/config/sources/families/include/sunxi_common.inc
+++ b/config/sources/families/include/sunxi_common.inc
@@ -27,9 +27,9 @@ case $BRANCH in
;;
edge)
- export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
- export KERNELBRANCH="branch:linux-5.16.y"
- export KERNELBRANCH_MEGOUS="branch:orange-pi-5.16"
+ export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
+ export KERNELBRANCH="branch:linux-5.17.y"
+ export KERNELBRANCH_MEGOUS="branch:orange-pi-5.17"
;;
esac
diff --git a/config/sources/families/include/uefi_common.inc b/config/sources/families/include/uefi_common.inc
index 175fcae2f..821ed660a 100644
--- a/config/sources/families/include/uefi_common.inc
+++ b/config/sources/families/include/uefi_common.inc
@@ -22,8 +22,8 @@ case "${BRANCH}" in
edge)
export DISTRO_GENERIC_KERNEL=no
export LINUXCONFIG="linux-uefi-${LINUXFAMILY}-${BRANCH}"
- export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel. For mainline caching.
- export KERNELBRANCH="branch:linux-5.16.y" # Branch or tag to build from. It should match MAJOR_MINOR
+ export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel. For mainline caching.
+ export KERNELBRANCH="branch:linux-5.17.y" # Branch or tag to build from. It should match MAJOR_MINOR
export KERNELPATCHDIR="uefi-${LINUXFAMILY}-${BRANCH}" # Might be empty.
;;
esac
diff --git a/config/sources/families/mvebu64.conf b/config/sources/families/mvebu64.conf
index bc79e1ec6..88cc752d4 100644
--- a/config/sources/families/mvebu64.conf
+++ b/config/sources/families/mvebu64.conf
@@ -1,6 +1,6 @@
enable_extension "marvell-tools"
ARCH=arm64
-BOOTBRANCH='branch:v2022.01'
+BOOTBRANCH='branch:v2022.04'
BOOTENV_FILE='mvebu64.txt'
ATFSOURCE='https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git'
ATFDIR='arm-trusted-firmware-espressobin'
@@ -84,7 +84,7 @@ atf_custom_postprocess() {
if [[ "${SKIP_EXTERNAL_TOOLCHAINS}" == "yes" ]]; then
export TOOLCHAIN_NAME="arm-linux-gnueabi-"
else
- export TOOLCHAIN_NAME="arm-none-eabi-"
+ export TOOLCHAIN_NAME="arm-none-linux-gnueabihf-"
fi
export ATF2=$(find_toolchain "$TOOLCHAIN_NAME" "> 10.0")/$TOOLCHAIN_NAME
export BL33=$ubootdir"/u-boot.bin"
diff --git a/lib/functions/compilation/patch/kernel-drivers.sh b/lib/functions/compilation/patch/kernel-drivers.sh
index 25f78b90c..6631eb445 100644
--- a/lib/functions/compilation/patch/kernel-drivers.sh
+++ b/lib/functions/compilation/patch/kernel-drivers.sh
@@ -37,9 +37,10 @@ function prepare_extra_kernel_drivers() {
aufs_tag=$(echo "${version}" | cut -f 1-2 -d ".")
# manual overrides
- if linux-version compare "${version}" ge 5.4.3 && linux-version compare "${version}" le 5.5; then aufs_tag="5.4.3"; fi
- if linux-version compare "${version}" ge 5.10.82 && linux-version compare "${version}" le 5.11; then aufs_tag="5.10.82"; fi
- if linux-version compare "${version}" ge 5.15.5 && linux-version compare "${version}" le 5.16; then aufs_tag="5.15.5"; fi
+ if linux-version compare "${version}" ge 5.4.3 && linux-version compare "${version}" le 5.5 ; then aufstag="5.4.3"; fi
+ if linux-version compare "${version}" ge 5.10.82 && linux-version compare "${version}" le 5.11 ; then aufstag="5.10.82"; fi
+ if linux-version compare "${version}" ge 5.15.5 && linux-version compare "${version}" le 5.16 ; then aufstag="5.15.5"; fi
+ if linux-version compare "${version}" ge 5.17.3 && linux-version compare "${version}" le 5.18 ; then aufstag="5.17.3"; fi
# check if Mr. Okajima already made a branch for this version, otherwise use RC.
git ls-remote --exit-code --heads https://github.com/sfjro/aufs5-standalone "aufs${aufs_tag}" > /dev/null || {
diff --git a/lib/functions/host/external-toolchains.sh b/lib/functions/host/external-toolchains.sh
index f2db2d6ea..f8733d294 100644
--- a/lib/functions/host/external-toolchains.sh
+++ b/lib/functions/host/external-toolchains.sh
@@ -24,6 +24,8 @@ function download_external_toolchains() {
"${ARMBIAN_MIRROR}/_toolchains/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz"
"${ARMBIAN_MIRROR}/_toolchain/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf.tar.xz"
"${ARMBIAN_MIRROR}/_toolchain/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz"
+ "${ARMBIAN_MIRROR}/_toolchain/gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf.tar.xz"
+ "${ARMBIAN_MIRROR}/_toolchain/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz"
)
USE_TORRENT_STATUS=${USE_TORRENT}
From 8341a778f0a1b9678858904eaddb540f43129b58 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Tue, 19 Apr 2022 13:48:06 +0200
Subject: [PATCH] armbian-next: add `crossbuild-essential-armel` so
`arm-linux-gnueabi-gcc` is available with system toolchains
- need to for some ATF builds, at least.
---
lib/functions/host/prepare-host.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/functions/host/prepare-host.sh b/lib/functions/host/prepare-host.sh
index bae3b3e7c..da443e4fb 100644
--- a/lib/functions/host/prepare-host.sh
+++ b/lib/functions/host/prepare-host.sh
@@ -49,9 +49,9 @@ prepare_host() {
aria2 curl wget # downloaders et al
# toolchains. NEW: using metapackages, allow us to have same list of all arches; brings both C and C++ compilers
- crossbuild-essential-armhf
- crossbuild-essential-arm64
- crossbuild-essential-amd64
+ crossbuild-essential-armhf crossbuild-essential-armel # for ARM 32-bit, both HF and EL are needed in some cases.
+ crossbuild-essential-arm64 # For ARM 64-bit, arm64.
+ crossbuild-essential-amd64 # For AMD 64-bit, x86_64.
)
if [[ $(dpkg --print-architecture) == amd64 ]]; then
From 8fdc420cc001b9ad79784ff486461eb0a2af6be8 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Tue, 19 Apr 2022 00:18:04 +0200
Subject: [PATCH] armbian-next: rockchip64_common: lotsa logging and debugging
- supposedly no practical changes
---
.../sources/families/include/rockchip64_common.inc | 38 ++++++++++++----------
1 file changed, 20 insertions(+), 18 deletions(-)
diff --git a/config/sources/families/include/rockchip64_common.inc b/config/sources/families/include/rockchip64_common.inc
index cd9541c3b..688097ae7 100644
--- a/config/sources/families/include/rockchip64_common.inc
+++ b/config/sources/families/include/rockchip64_common.inc
@@ -17,6 +17,7 @@ PACKAGE_LIST_FAMILY="ethtool"
RKBIN_DIR="$SRC/cache/sources/rkbin-tools"
BOOT_SOC=${BOOT_SOC:=$(expr $BOOTCONFIG : '.*\(rk[[:digit:]]\+.*\)_.*')}
+display_alert "BOOT_SOC:" "$BOOT_SOC" "debug"
CPUMIN=${CPUMIN:="408000"}
@@ -68,8 +69,11 @@ elif [[ $BOOT_SOC == rk3566 ]]; then
elif [[ $BOOT_SOC == rk3568 ]]; then
BOOT_SCENARIO="${BOOT_SCENARIO:=spl-blobs}"
- DDR_BLOB='rk35/rk3568_ddr_1560MHz_v1.10.bin'
- BL31_BLOB='rk35/rk3568_bl31_v1.28.elf'
+ DDR_BLOB="${DDR_BLOB:-"rk35/rk3568_ddr_1560MHz_v1.10.bin"}"
+ BL31_BLOB="${BL31_BLOB:-"rk35/rk3568_bl31_v1.28.elf"}"
+ display_alert "BOOT_SCENARIO:" "$BOOT_SCENARIO" "debug"
+ display_alert "DDR_BLOB:" "$DDR_BLOB" "debug"
+ display_alert "BL31_BLOB:" "$BL31_BLOB" "debug"
elif [[ $BOARD == rockpi-s ]]; then
@@ -129,6 +133,7 @@ prepare_boot_configuration() {
elif [[ $BOOT_SCENARIO == "spl-blobs" ]]; then
+ display_alert "BOOT Scenario is" "spl-blobs" "debug"
UBOOT_TARGET_MAP="BL31=$RKBIN_DIR/$BL31_BLOB spl/u-boot-spl.bin u-boot.dtb u-boot.itb;;idbloader.img u-boot.itb"
ATFSOURCE=''
ATF_COMPILE='no'
@@ -153,13 +158,13 @@ uboot_custom_postprocess() {
if [[ $BOOT_SCENARIO == "blobless" || $BOOT_SCENARIO == "tpl-spl-blob" ]]; then
:
elif [[ $BOOT_SCENARIO == "spl-blobs" ]]; then
-
- tools/mkimage -n $BOOT_SOC -T rksd -d $RKBIN_DIR/$DDR_BLOB:spl/u-boot-spl.bin idbloader.img
+ display_alert "mkimage for $BOOT_SOC with $BOOT_SCENARIO" "spl-blobs" "debug"
+ run_host_command_logged tools/mkimage -n $BOOT_SOC -T rksd -d $RKBIN_DIR/$DDR_BLOB:spl/u-boot-spl.bin idbloader.img
elif [[ $BOOT_SCENARIO == "only-blobs" ]]; then
local tempfile=$(mktemp)
- tools/mkimage -n $BOOT_SOC -T rksd -d $RKBIN_DIR/$DDR_BLOB idbloader.bin
+ run_host_command_logged tools/mkimage -n $BOOT_SOC -T rksd -d $RKBIN_DIR/$DDR_BLOB idbloader.bin
cat $RKBIN_DIR/$MINILOADER_BLOB >> idbloader.bin
run_host_x86_binary_logged $RKBIN_DIR/tools/loaderimage --pack --uboot ./u-boot-dtb.bin uboot.img 0x200000
run_host_x86_binary_logged $RKBIN_DIR/tools/trust_merger --replace bl31.elf $RKBIN_DIR/$BL31_BLOB trust.ini
@@ -178,25 +183,22 @@ uboot_custom_postprocess() {
}
write_uboot_platform() {
- if [[ -f $1/rksd_loader.img ]]; then # legacy rk3399 loader
-
- dd if=$1/rksd_loader.img of=$2 seek=64 conv=notrunc status=none > /dev/null 2>&1
+ # This is run board-side too, so account for the non-existance of run_host_command_logged
+ local logging_prelude=""
+ [[ $(type -t run_host_command_logged) == function ]] && logging_prelude="run_host_command_logged"
+ if [[ -f $1/rksd_loader.img ]]; then # legacy rk3399 loader
+ ${logging_prelude} dd if=$1/rksd_loader.img of=$2 seek=64 conv=notrunc status=none
elif [[ -f $1/u-boot.itb ]]; then # $BOOT_SCENARIO == "blobless" || $BOOT_SCENARIO == "tpl-spl-blob"
-
- dd if=$1/idbloader.img of=$2 seek=64 conv=notrunc status=none > /dev/null 2>&1
- dd if=$1/u-boot.itb of=$2 seek=16384 conv=notrunc status=none > /dev/null 2>&1
-
+ ${logging_prelude} dd if=$1/idbloader.img of=$2 seek=64 conv=notrunc status=none
+ ${logging_prelude} dd if=$1/u-boot.itb of=$2 seek=16384 conv=notrunc status=none
elif [[ -f $1/uboot.img ]]; then # $BOOT_SCENARIO == "only-blobs"
-
- dd if=$1/idbloader.bin of=$2 seek=64 conv=notrunc status=none > /dev/null 2>&1
- dd if=$1/uboot.img of=$2 seek=16384 conv=notrunc status=none > /dev/null 2>&1
- dd if=$1/trust.bin of=$2 seek=24576 conv=notrunc status=none > /dev/null 2>&1
-
+ ${logging_prelude} dd if=$1/idbloader.bin of=$2 seek=64 conv=notrunc status=none
+ ${logging_prelude} dd if=$1/uboot.img of=$2 seek=16384 conv=notrunc status=none
+ ${logging_prelude} dd if=$1/trust.bin of=$2 seek=24576 conv=notrunc status=none
else
echo "Unsupported u-boot processing configuration!"
exit 1
-
fi
}
From 52922a6b105279e73ccb760523e43fa6f7b0d5e0 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 18 Apr 2022 10:56:34 +0200
Subject: [PATCH] armbian-next: grub: better logging
---
extensions/grub.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/extensions/grub.sh b/extensions/grub.sh
index 0ae97ed43..e3eacb955 100644
--- a/extensions/grub.sh
+++ b/extensions/grub.sh
@@ -129,13 +129,14 @@ pre_umount_final_image__900_export_kernel_and_initramfs() {
display_alert "Exporting Kernel and Initrd for" "kexec" "info"
# this writes to ${DESTIMG} directly, since debootstrap.sh will move them later.
# capture the $MOUNT/boot/vmlinuz and initrd and send it out ${DESTIMG}
- cp "$MOUNT"/boot/vmlinuz-* "${DESTIMG}/${version}.kernel"
- cp "$MOUNT"/boot/initrd.img-* "${DESTIMG}/${version}.initrd"
+ run_host_command_logged ls -la "${MOUNT}"/boot/vmlinuz-* "${MOUNT}"/boot/initrd.img-* || true
+ run_host_command_logged cp -pv "${MOUNT}"/boot/vmlinuz-* "${DESTIMG}/${version}.kernel" || true
+ run_host_command_logged cp -pv "${MOUNT}"/boot/initrd.img-* "${DESTIMG}/${version}.initrd" || true
fi
}
configure_grub() {
- display_alert "GRUB EFI kernel cmdline" "console=${SERIALCON} distro=${UEFI_GRUB_DISTRO_NAME} timeout=${UEFI_GRUB_TIMEOUT}" ""
+ display_alert "GRUB EFI kernel cmdline" "console=${SERIALCON} distro=${UEFI_GRUB_DISTRO_NAME} timeout=${UEFI_GRUB_TIMEOUT} grub terminal=${UEFI_GRUB_TERMINAL}" ""
if [[ "_${SERIALCON}_" != "__" ]]; then
cat <<- grubCfgFrag >> "${MOUNT}"/etc/default/grub.d/98-armbian.cfg
From 7bf6574305c5d2b7230225007fa4a62e0f19a817 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 18 Apr 2022 11:23:10 +0200
Subject: [PATCH] armbian-next: fix for chaos caused by git's fix of
CVE-2022-24765 otherwise "fatal: unsafe repository"
- might not be the best solution, but it's the only one I found
---
compile.sh | 4 +++-
lib/functions/compilation/debs.sh | 2 +-
lib/functions/configuration/main-config.sh | 4 ++--
lib/functions/general/git.sh | 9 +++++++++
4 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/compile.sh b/compile.sh
index 2bc765f9f..67de1a20f 100755
--- a/compile.sh
+++ b/compile.sh
@@ -36,7 +36,6 @@ if [[ ! -f "${SRC}"/lib/single.sh ]]; then
exit 255
fi
-
# shellcheck source=lib/single.sh
source "${SRC}"/lib/single.sh
@@ -46,6 +45,9 @@ logging_init
# initialize the traps
traps_init
+# make sure git considers our build system dir as a safe dir (only if actually building)
+[[ "${CONFIG_DEFS_ONLY}" != "yes" ]] && git_ensure_safe_directory "${SRC}"
+
# Execute the main CLI entrypoint.
cli_entrypoint "$@"
diff --git a/lib/functions/compilation/debs.sh b/lib/functions/compilation/debs.sh
index 2af1af793..8816314af 100644
--- a/lib/functions/compilation/debs.sh
+++ b/lib/functions/compilation/debs.sh
@@ -174,7 +174,7 @@ compile_armbian-config() {
compile_xilinx_bootgen() {
# Source code checkout
- (fetch_from_repo "https://github.com/Xilinx/bootgen.git" "xilinx-bootgen" "branch:master")
+ fetch_from_repo "https://github.com/Xilinx/bootgen.git" "xilinx-bootgen" "branch:master"
pushd "${SRC}"/cache/sources/xilinx-bootgen || exit
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 44a23bb66..77e15b7b8 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -34,8 +34,8 @@ function do_main_configuration() {
cd "${SRC}" || exit
[[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=17
[[ -z "${CHROOT_CACHE_VERSION}" ]] && CHROOT_CACHE_VERSION=7
- BUILD_REPOSITORY_URL=$(git remote get-url "$(git remote 2> /dev/null | grep origin)" 2> /dev/null)
- BUILD_REPOSITORY_COMMIT=$(git describe --match=d_e_a_d_b_e_e_f --always --dirty 2> /dev/null)
+ BUILD_REPOSITORY_URL=$(git remote get-url "$(git remote | grep origin)")
+ BUILD_REPOSITORY_COMMIT=$(git describe --match=d_e_a_d_b_e_e_f --always --dirty)
ROOTFS_CACHE_MAX=200 # max number of rootfs cache, older ones will be cleaned up
# .deb compression. xz is standard, but is slow, so if avoided by default if not running in CI. one day, zstd.
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index baf7f54d2..c8086f728 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -27,6 +27,13 @@ function improved_git_fetch() {
improved_git fetch --progress --verbose --no-auto-maintenance "$@"
}
+# workaround new limitations imposed by CVE-2022-24765 fix in git, otherwise "fatal: unsafe repository"
+function git_ensure_safe_directory() {
+ local git_dir="$1"
+ display_alert "git: Marking directory as safe" "$git_dir" "debug"
+ run_host_command_logged git config --global --add safe.directory "$git_dir"
+}
+
# fetch_from_repo <url> <directory> <ref> <ref_subdir>
# <url>: remote repository URL
# <directory>: local directory; subdir for branch/tag will be created
@@ -84,6 +91,8 @@ fetch_from_repo() {
display_alert "Git working dir" "${git_work_dir}" "git"
+ git_ensure_safe_directory "${git_work_dir}"
+
local expected_origin_url actual_origin_url
expected_origin_url="$(echo -n "${url}" | sed 's/^.*@//' | sed 's/^.*\/\///')"
From ad315fb153cd743614eb2d4102ad8a61d8be99aa Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 18 Apr 2022 23:14:20 +0200
Subject: [PATCH] partitioning: fix: don't try fixing a bootscript that's not
there
- this fixes a bug when "rootpart=2" without rootpart 1 being /boot
---
lib/functions/image/partitioning.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh
index 1c9597553..108326aaa 100644
--- a/lib/functions/image/partitioning.sh
+++ b/lib/functions/image/partitioning.sh
@@ -311,7 +311,7 @@ function prepare_partitions() {
You can write to `"${SDCARD}/boot/armbianEnv.txt"` here, it is guaranteed to exist.
IMAGE_SPECIFIC_ARMBIAN_ENV_READY
- elif [[ $rootpart != 1 ]]; then
+ elif [[ $rootpart != 1 && -f "${SDCARD}/boot/${bootscript_dst}" ]]; then
local bootscript_dst=${BOOTSCRIPT##*:}
sed -i 's/mmcblk0p1/mmcblk0p2/' $SDCARD/boot/$bootscript_dst
sed -i -e "s/rootfstype=ext4/rootfstype=$ROOTFS_TYPE/" \
From 1661922e79f34bec964fdd86e278489e28945b4d Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 18 Apr 2022 23:15:29 +0200
Subject: [PATCH] armbian-next: cleanups: umount tmpfs-based $SDCARD during
cleanup too
---
lib/functions/main/rootfs-image.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/functions/main/rootfs-image.sh b/lib/functions/main/rootfs-image.sh
index 1e4f27c20..590ca1f84 100644
--- a/lib/functions/main/rootfs-image.sh
+++ b/lib/functions/main/rootfs-image.sh
@@ -120,6 +120,9 @@ function trap_handler_cleanup_rootfs_and_image() {
umount_chroot_recursive "${SDCARD}" || true
umount_chroot_recursive "${MOUNT}" || true
+ # unmount tmpfs mounted on SDCARD if it exists.
+ mountpoint -q "${SDCARD}" && umount "${SDCARD}"
+
mountpoint -q "${SRC}"/cache/toolchain && umount -l "${SRC}"/cache/toolchain >&2 # @TODO: why does Igor uses lazy umounts? nfs?
mountpoint -q "${SRC}"/cache/rootfs && umount -l "${SRC}"/cache/rootfs >&2
[[ $CRYPTROOT_ENABLE == yes ]] && cryptsetup luksClose "${ROOT_MAPPER}" >&2
From 7253f98a262253eab6094b29640293079b673ab0 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 18 Apr 2022 23:16:32 +0200
Subject: [PATCH] armbian-next: indented heredoc, no functional changes
---
lib/functions/image/rootfs-to-image.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/functions/image/rootfs-to-image.sh b/lib/functions/image/rootfs-to-image.sh
index a8f0796cc..9d128c960 100644
--- a/lib/functions/image/rootfs-to-image.sh
+++ b/lib/functions/image/rootfs-to-image.sh
@@ -70,10 +70,10 @@ create_image_from_sdcard_rootfs() {
# fix wrong / permissions
chmod 755 "${MOUNT}"
- call_extension_method "pre_umount_final_image" "config_pre_umount_final_image" << 'PRE_UMOUNT_FINAL_IMAGE'
-*allow config to hack into the image before the unmount*
-Called before unmounting both `/root` and `/boot`.
-PRE_UMOUNT_FINAL_IMAGE
+ call_extension_method "pre_umount_final_image" "config_pre_umount_final_image" <<- 'PRE_UMOUNT_FINAL_IMAGE'
+ *allow config to hack into the image before the unmount*
+ Called before unmounting both `/root` and `/boot`.
+ PRE_UMOUNT_FINAL_IMAGE
# unmount /boot/efi first, then /boot, rootfs third, image file last
sync
From 1ac36b752e2982dbf59336c3ee857c91080ed8cf Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 16 Apr 2022 19:23:00 +0200
Subject: [PATCH] armbian-next: fix shortcircuit as last statement in case of
extlinux
- yes, I wasted 3 hours on this tiny bit, so *you* don't have to!
- better logging for rootfs `mkfs` et al
- introduce `PRESERVE_SDCARD_MOUNT=yes` to preserve SDCARD, MOUNT, and LOOP for debugging
---
lib/functions/image/partitioning.sh | 14 ++++++++------
lib/functions/main/rootfs-image.sh | 5 +++++
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh
index 76c26a22c..1c9597553 100644
--- a/lib/functions/image/partitioning.sh
+++ b/lib/functions/image/partitioning.sh
@@ -6,7 +6,7 @@
#
# LOGGING: this is run under the log manager. so just redirect unwanted stderr to stdout, and it goes to log.
# this is under the logging manager. so just log to stdout (no redirections), and redirect stderr to stdout unless you want it on screen.
-prepare_partitions() {
+function prepare_partitions() {
display_alert "Preparing image file for rootfs" "$BOARD $RELEASE" "info"
# possible partition combinations
@@ -161,6 +161,7 @@ prepare_partitions() {
display_alert "Creating partitions" "${bootfs:+/boot: $bootfs }root: $ROOTFS_TYPE" "info"
run_host_command_logged parted -s ${SDCARD}.raw -- mklabel ${IMAGE_PARTITION_TABLE}
if [[ "${USE_HOOK_FOR_PARTITION}" == "yes" ]]; then
+ display_alert "Using create_partition_table hook_point" "yes" "debug"
call_extension_method "create_partition_table" <<- 'CREATE_PARTITION_TABLE'
*only called when USE_HOOK_FOR_PARTITION=yes to create the complete partition table*
Finally, we can get our own partition table. You have to partition ${SDCARD}.raw
@@ -253,11 +254,13 @@ prepare_partitions() {
check_loop_device "$rootdevice"
display_alert "Creating rootfs" "$ROOTFS_TYPE on $rootdevice"
- mkfs.${mkfs[$ROOTFS_TYPE]} ${mkopts[$ROOTFS_TYPE]} $rootdevice 2>&1
- [[ $ROOTFS_TYPE == ext4 ]] && tune2fs -o journal_data_writeback $rootdevice > /dev/null
+ run_host_command_logged mkfs.${mkfs[$ROOTFS_TYPE]} "${mkopts[$ROOTFS_TYPE]}" "$rootdevice"
+ [[ $ROOTFS_TYPE == ext4 ]] && run_host_command_logged tune2fs -o journal_data_writeback "$rootdevice"
if [[ $ROOTFS_TYPE == btrfs && $BTRFS_COMPRESSION != none ]]; then
local fscreateopt="-o compress-force=${BTRFS_COMPRESSION}"
fi
+ sync # force writes to be really flushed
+ display_alert "Mounting rootfs" "$rootdevice"
run_host_command_logged mount ${fscreateopt} $rootdevice $MOUNT/
# create fstab (and crypttab) entry
if [[ $CRYPTROOT_ENABLE == yes ]]; then
@@ -308,9 +311,7 @@ prepare_partitions() {
You can write to `"${SDCARD}/boot/armbianEnv.txt"` here, it is guaranteed to exist.
IMAGE_SPECIFIC_ARMBIAN_ENV_READY
- elif
- [[ $rootpart != 1 ]]
- then
+ elif [[ $rootpart != 1 ]]; then
local bootscript_dst=${BOOTSCRIPT##*:}
sed -i 's/mmcblk0p1/mmcblk0p2/' $SDCARD/boot/$bootscript_dst
sed -i -e "s/rootfstype=ext4/rootfstype=$ROOTFS_TYPE/" \
@@ -351,4 +352,5 @@ prepare_partitions() {
[[ -f $SDCARD/boot/armbianEnv.txt ]] && rm $SDCARD/boot/armbianEnv.txt
fi
+ return 0 # there is a shortcircuit above! very tricky btw!
}
diff --git a/lib/functions/main/rootfs-image.sh b/lib/functions/main/rootfs-image.sh
index 86ad03594..1e4f27c20 100644
--- a/lib/functions/main/rootfs-image.sh
+++ b/lib/functions/main/rootfs-image.sh
@@ -124,6 +124,11 @@ function trap_handler_cleanup_rootfs_and_image() {
mountpoint -q "${SRC}"/cache/rootfs && umount -l "${SRC}"/cache/rootfs >&2
[[ $CRYPTROOT_ENABLE == yes ]] && cryptsetup luksClose "${ROOT_MAPPER}" >&2
+ if [[ "${PRESERVE_SDCARD_MOUNT}" == "yes" ]]; then
+ display_alert "Preserving SD card mount" "trap_handler_cleanup_rootfs_and_image" "warn"
+ return 0
+ fi
+
# shellcheck disable=SC2153 # global var.
if [[ -b "${LOOP}" ]]; then
display_alert "Freeing loop" "trap_handler_cleanup_rootfs_and_image ${LOOP}" "wrn"
From ef3709d30ee099523db2ad28e3f65e0d17754f50 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 16 Apr 2022 12:13:07 +0200
Subject: [PATCH] armbian-next: kernel-headers: less verbose, trimmed down
tools a bit (perf and testing)
---
lib/functions/compilation/kernel-debs.sh | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/functions/compilation/kernel-debs.sh b/lib/functions/compilation/kernel-debs.sh
index e0788518d..dd5a143c7 100644
--- a/lib/functions/compilation/kernel-debs.sh
+++ b/lib/functions/compilation/kernel-debs.sh
@@ -280,12 +280,9 @@ function kernel_package_callback_linux_headers() {
find $(find "arch/${SRC_ARCH}" -name include -o -name scripts -type d) -type f
find arch/${SRC_ARCH}/include Module.symvers include scripts -type f
}
- # Include the byteshift utilities shared between kernel proper and the build scripts/tools.
+ # tools/include/tools has the byteshift utilities shared between kernel proper and the build scripts/tools.
# This replaces 'headers-debian-byteshift.patch' which was used for years in Armbian.
- #find tools/include/tools/be_byteshift.h tools/include/tools/le_byteshift.h -type f
- #find tools/objtool -type f
- #find tools/build -type f
- find tools -type f # all tools. all of it? we might get away with a little less. eg: tools/perf and tools/testing
+ find tools -type f # all tools; will trim a bit later
find arch/x86/lib/insn.c # required by objtool stuff...
if is_enabled CONFIG_GCC_PLUGINS; then
@@ -300,8 +297,11 @@ function kernel_package_callback_linux_headers() {
# Now, make the script dirs clean.
# This is run in our _target_ dir, not the source tree, so we're free to make clean as we wish without invalidating the next build's cache.
- run_host_command_logged cd "${headers_target_dir}" "&&" make "ARCH=${SRC_ARCH}" "M=scripts" clean
- run_host_command_logged cd "${headers_target_dir}/tools" "&&" make "ARCH=${SRC_ARCH}" clean
+ run_host_command_logged cd "${headers_target_dir}" "&&" make -s "ARCH=${SRC_ARCH}" "M=scripts" clean
+ run_host_command_logged cd "${headers_target_dir}/tools" "&&" make -s "ARCH=${SRC_ARCH}" clean
+
+ # Trim down on the tools dir a bit after cleaning.
+ rm -rf "${headers_target_dir}/tools/perf" "${headers_target_dir}/tools/testing"
# Hack: after cleaning, copy over the scripts/module.lds file from the source tree. It will only exist on 5.10+
# See https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1906131
From 20c29c1d6e04783ac8e8151f27f57b52b8531342 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 16 Apr 2022 11:23:13 +0200
Subject: [PATCH] khadas-vim3l: add asound.state for Khadas VIM3L
---
config/boards/khadas-vim3l.conf | 1 +
.../blobs/asound.state/asound.state.khadas-vim3l | 780 +++++++++++++++++++++
2 files changed, 781 insertions(+)
diff --git a/config/boards/khadas-vim3l.conf b/config/boards/khadas-vim3l.conf
index e11310414..171e580f4 100644
--- a/config/boards/khadas-vim3l.conf
+++ b/config/boards/khadas-vim3l.conf
@@ -7,3 +7,4 @@ FULL_DESKTOP="yes"
SERIALCON="ttyAML0"
BOOT_LOGO="desktop"
BOOT_FDT_FILE="amlogic/meson-sm1-khadas-vim3l.dtb"
+ASOUND_STATE="asound.state.khadas-vim3l"
diff --git a/packages/blobs/asound.state/asound.state.khadas-vim3l b/packages/blobs/asound.state/asound.state.khadas-vim3l
new file mode 100644
index 000000000..0246c8126
--- /dev/null
+++ b/packages/blobs/asound.state/asound.state.khadas-vim3l
@@ -0,0 +1,780 @@
+state.KHADASVIM3 {
+ control.1 {
+ iface MIXER
+ name 'TDMOUT_A Lane 0 Volume'
+ value.0 0
+ value.1 0
+ comment {
+ access 'read write'
+ type INTEGER
+ count 2
+ range '0 - 255'
+ }
+ }
+ control.2 {
+ iface MIXER
+ name 'TDMOUT_A Lane 1 Volume'
+ value.0 0
+ value.1 0
+ comment {
+ access 'read write'
+ type INTEGER
+ count 2
+ range '0 - 255'
+ }
+ }
+ control.3 {
+ iface MIXER
+ name 'TDMOUT_A Lane 2 Volume'
+ value.0 0
+ value.1 0
+ comment {
+ access 'read write'
+ type INTEGER
+ count 2
+ range '0 - 255'
+ }
+ }
+ control.4 {
+ iface MIXER
+ name 'TDMOUT_A Lane 3 Volume'
+ value.0 0
+ value.1 0
+ comment {
+ access 'read write'
+ type INTEGER
+ count 2
+ range '0 - 255'
+ }
+ }
+ control.5 {
+ iface MIXER
+ name 'TDMOUT_A Gain Enable Switch'
+ value false
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.6 {
+ iface PCM
+ device 5
+ name 'Playback Channel Map'
+ value.0 0
+ value.1 0
+ value.2 0
+ value.3 0
+ value.4 0
+ value.5 0
+ value.6 0
+ value.7 0
+ comment {
+ access read
+ type INTEGER
+ count 8
+ range '0 - 36'
+ }
+ }
+ control.7 {
+ iface PCM
+ device 5
+ name ELD
+ value '100008006a10000100000000000000004cf45601416f58696e5975616e200907070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
+ comment {
+ access 'read volatile'
+ type BYTES
+ count 128
+ }
+ }
+ control.8 {
+ iface MIXER
+ name 'FRDDR_A SRC 1 EN Switch'
+ value true
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.9 {
+ iface MIXER
+ name 'FRDDR_A SRC 2 EN Switch'
+ value false
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.10 {
+ iface MIXER
+ name 'FRDDR_A SRC 3 EN Switch'
+ value false
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.11 {
+ iface MIXER
+ name 'FRDDR_A SINK 1 SEL'
+ value 'OUT 0'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'OUT 0'
+ item.1 'OUT 1'
+ item.2 'OUT 2'
+ item.3 'OUT 3'
+ item.4 'OUT 4'
+ item.5 'OUT 5'
+ item.6 'OUT 6'
+ item.7 'OUT 7'
+ }
+ }
+ control.12 {
+ iface MIXER
+ name 'FRDDR_A SINK 2 SEL'
+ value 'OUT 0'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'OUT 0'
+ item.1 'OUT 1'
+ item.2 'OUT 2'
+ item.3 'OUT 3'
+ item.4 'OUT 4'
+ item.5 'OUT 5'
+ item.6 'OUT 6'
+ item.7 'OUT 7'
+ }
+ }
+ control.13 {
+ iface MIXER
+ name 'FRDDR_A SINK 3 SEL'
+ value 'OUT 0'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'OUT 0'
+ item.1 'OUT 1'
+ item.2 'OUT 2'
+ item.3 'OUT 3'
+ item.4 'OUT 4'
+ item.5 'OUT 5'
+ item.6 'OUT 6'
+ item.7 'OUT 7'
+ }
+ }
+ control.14 {
+ iface MIXER
+ name 'FRDDR_B SRC 1 EN Switch'
+ value true
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.15 {
+ iface MIXER
+ name 'FRDDR_B SRC 2 EN Switch'
+ value false
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.16 {
+ iface MIXER
+ name 'FRDDR_B SRC 3 EN Switch'
+ value false
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.17 {
+ iface MIXER
+ name 'FRDDR_B SINK 1 SEL'
+ value 'OUT 0'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'OUT 0'
+ item.1 'OUT 1'
+ item.2 'OUT 2'
+ item.3 'OUT 3'
+ item.4 'OUT 4'
+ item.5 'OUT 5'
+ item.6 'OUT 6'
+ item.7 'OUT 7'
+ }
+ }
+ control.18 {
+ iface MIXER
+ name 'FRDDR_B SINK 2 SEL'
+ value 'OUT 0'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'OUT 0'
+ item.1 'OUT 1'
+ item.2 'OUT 2'
+ item.3 'OUT 3'
+ item.4 'OUT 4'
+ item.5 'OUT 5'
+ item.6 'OUT 6'
+ item.7 'OUT 7'
+ }
+ }
+ control.19 {
+ iface MIXER
+ name 'FRDDR_B SINK 3 SEL'
+ value 'OUT 0'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'OUT 0'
+ item.1 'OUT 1'
+ item.2 'OUT 2'
+ item.3 'OUT 3'
+ item.4 'OUT 4'
+ item.5 'OUT 5'
+ item.6 'OUT 6'
+ item.7 'OUT 7'
+ }
+ }
+ control.20 {
+ iface MIXER
+ name 'FRDDR_C SRC 1 EN Switch'
+ value true
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.21 {
+ iface MIXER
+ name 'FRDDR_C SRC 2 EN Switch'
+ value false
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.22 {
+ iface MIXER
+ name 'FRDDR_C SRC 3 EN Switch'
+ value false
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.23 {
+ iface MIXER
+ name 'FRDDR_C SINK 1 SEL'
+ value 'OUT 0'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'OUT 0'
+ item.1 'OUT 1'
+ item.2 'OUT 2'
+ item.3 'OUT 3'
+ item.4 'OUT 4'
+ item.5 'OUT 5'
+ item.6 'OUT 6'
+ item.7 'OUT 7'
+ }
+ }
+ control.24 {
+ iface MIXER
+ name 'FRDDR_C SINK 2 SEL'
+ value 'OUT 0'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'OUT 0'
+ item.1 'OUT 1'
+ item.2 'OUT 2'
+ item.3 'OUT 3'
+ item.4 'OUT 4'
+ item.5 'OUT 5'
+ item.6 'OUT 6'
+ item.7 'OUT 7'
+ }
+ }
+ control.25 {
+ iface MIXER
+ name 'FRDDR_C SINK 3 SEL'
+ value 'OUT 0'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'OUT 0'
+ item.1 'OUT 1'
+ item.2 'OUT 2'
+ item.3 'OUT 3'
+ item.4 'OUT 4'
+ item.5 'OUT 5'
+ item.6 'OUT 6'
+ item.7 'OUT 7'
+ }
+ }
+ control.26 {
+ iface MIXER
+ name 'TOHDMITX I2S SRC'
+ value 'I2S A'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'I2S A'
+ item.1 'I2S B'
+ item.2 'I2S C'
+ }
+ }
+ control.27 {
+ iface MIXER
+ name 'TOHDMITX Switch'
+ value true
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.28 {
+ iface MIXER
+ name 'TOHDMITX SPDIF SRC'
+ value 'SPDIF A'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'SPDIF A'
+ item.1 'SPDIF B'
+ }
+ }
+ control.29 {
+ iface MIXER
+ name 'TDMOUT_A SRC SEL'
+ value 'IN 0'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'IN 0'
+ item.1 'IN 1'
+ item.2 'IN 2'
+ }
+ }
+}
+state.G12BKHADASVIM3 {
+ control.1 {
+ iface MIXER
+ name 'TDMOUT_A Lane 0 Volume'
+ value.0 255
+ value.1 255
+ comment {
+ access 'read write'
+ type INTEGER
+ count 2
+ range '0 - 255'
+ }
+ }
+ control.2 {
+ iface MIXER
+ name 'TDMOUT_A Lane 1 Volume'
+ value.0 255
+ value.1 255
+ comment {
+ access 'read write'
+ type INTEGER
+ count 2
+ range '0 - 255'
+ }
+ }
+ control.3 {
+ iface MIXER
+ name 'TDMOUT_A Lane 2 Volume'
+ value.0 255
+ value.1 255
+ comment {
+ access 'read write'
+ type INTEGER
+ count 2
+ range '0 - 255'
+ }
+ }
+ control.4 {
+ iface MIXER
+ name 'TDMOUT_A Lane 3 Volume'
+ value.0 255
+ value.1 255
+ comment {
+ access 'read write'
+ type INTEGER
+ count 2
+ range '0 - 255'
+ }
+ }
+ control.5 {
+ iface MIXER
+ name 'TDMOUT_A Gain Enable Switch'
+ value false
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.6 {
+ iface PCM
+ device 5
+ name 'Playback Channel Map'
+ value.0 0
+ value.1 0
+ value.2 0
+ value.3 0
+ value.4 0
+ value.5 0
+ value.6 0
+ value.7 0
+ comment {
+ access read
+ type INTEGER
+ count 8
+ range '0 - 36'
+ }
+ }
+ control.7 {
+ iface PCM
+ device 5
+ name ELD
+ value '0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
+ comment {
+ access 'read volatile'
+ type BYTES
+ count 128
+ }
+ }
+ control.8 {
+ iface MIXER
+ name 'FRDDR_A SRC 1 EN Switch'
+ value true
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.9 {
+ iface MIXER
+ name 'FRDDR_A SRC 2 EN Switch'
+ value false
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.10 {
+ iface MIXER
+ name 'FRDDR_A SRC 3 EN Switch'
+ value false
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.11 {
+ iface MIXER
+ name 'FRDDR_A SINK 1 SEL'
+ value 'OUT 1'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'OUT 0'
+ item.1 'OUT 1'
+ item.2 'OUT 2'
+ item.3 'OUT 3'
+ item.4 'OUT 4'
+ item.5 'OUT 5'
+ item.6 'OUT 6'
+ item.7 'OUT 7'
+ }
+ }
+ control.12 {
+ iface MIXER
+ name 'FRDDR_A SINK 2 SEL'
+ value 'OUT 1'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'OUT 0'
+ item.1 'OUT 1'
+ item.2 'OUT 2'
+ item.3 'OUT 3'
+ item.4 'OUT 4'
+ item.5 'OUT 5'
+ item.6 'OUT 6'
+ item.7 'OUT 7'
+ }
+ }
+ control.13 {
+ iface MIXER
+ name 'FRDDR_A SINK 3 SEL'
+ value 'OUT 1'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'OUT 0'
+ item.1 'OUT 1'
+ item.2 'OUT 2'
+ item.3 'OUT 3'
+ item.4 'OUT 4'
+ item.5 'OUT 5'
+ item.6 'OUT 6'
+ item.7 'OUT 7'
+ }
+ }
+ control.14 {
+ iface MIXER
+ name 'FRDDR_B SRC 1 EN Switch'
+ value true
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.15 {
+ iface MIXER
+ name 'FRDDR_B SRC 2 EN Switch'
+ value false
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.16 {
+ iface MIXER
+ name 'FRDDR_B SRC 3 EN Switch'
+ value false
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.17 {
+ iface MIXER
+ name 'FRDDR_B SINK 1 SEL'
+ value 'OUT 1'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'OUT 0'
+ item.1 'OUT 1'
+ item.2 'OUT 2'
+ item.3 'OUT 3'
+ item.4 'OUT 4'
+ item.5 'OUT 5'
+ item.6 'OUT 6'
+ item.7 'OUT 7'
+ }
+ }
+ control.18 {
+ iface MIXER
+ name 'FRDDR_B SINK 2 SEL'
+ value 'OUT 1'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'OUT 0'
+ item.1 'OUT 1'
+ item.2 'OUT 2'
+ item.3 'OUT 3'
+ item.4 'OUT 4'
+ item.5 'OUT 5'
+ item.6 'OUT 6'
+ item.7 'OUT 7'
+ }
+ }
+ control.19 {
+ iface MIXER
+ name 'FRDDR_B SINK 3 SEL'
+ value 'OUT 1'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'OUT 0'
+ item.1 'OUT 1'
+ item.2 'OUT 2'
+ item.3 'OUT 3'
+ item.4 'OUT 4'
+ item.5 'OUT 5'
+ item.6 'OUT 6'
+ item.7 'OUT 7'
+ }
+ }
+ control.20 {
+ iface MIXER
+ name 'FRDDR_C SRC 1 EN Switch'
+ value false
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.21 {
+ iface MIXER
+ name 'FRDDR_C SRC 2 EN Switch'
+ value false
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.22 {
+ iface MIXER
+ name 'FRDDR_C SRC 3 EN Switch'
+ value false
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.23 {
+ iface MIXER
+ name 'FRDDR_C SINK 1 SEL'
+ value 'OUT 1'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'OUT 0'
+ item.1 'OUT 1'
+ item.2 'OUT 2'
+ item.3 'OUT 3'
+ item.4 'OUT 4'
+ item.5 'OUT 5'
+ item.6 'OUT 6'
+ item.7 'OUT 7'
+ }
+ }
+ control.24 {
+ iface MIXER
+ name 'FRDDR_C SINK 2 SEL'
+ value 'OUT 1'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'OUT 0'
+ item.1 'OUT 1'
+ item.2 'OUT 2'
+ item.3 'OUT 3'
+ item.4 'OUT 4'
+ item.5 'OUT 5'
+ item.6 'OUT 6'
+ item.7 'OUT 7'
+ }
+ }
+ control.25 {
+ iface MIXER
+ name 'FRDDR_C SINK 3 SEL'
+ value 'OUT 1'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'OUT 0'
+ item.1 'OUT 1'
+ item.2 'OUT 2'
+ item.3 'OUT 3'
+ item.4 'OUT 4'
+ item.5 'OUT 5'
+ item.6 'OUT 6'
+ item.7 'OUT 7'
+ }
+ }
+ control.26 {
+ iface MIXER
+ name 'TOHDMITX I2S SRC'
+ value 'I2S A'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'I2S A'
+ item.1 'I2S B'
+ item.2 'I2S C'
+ }
+ }
+ control.27 {
+ iface MIXER
+ name 'TOHDMITX Switch'
+ value true
+ comment {
+ access 'read write'
+ type BOOLEAN
+ count 1
+ }
+ }
+ control.28 {
+ iface MIXER
+ name 'TOHDMITX SPDIF SRC'
+ value 'SPDIF A'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'SPDIF A'
+ item.1 'SPDIF B'
+ }
+ }
+ control.29 {
+ iface MIXER
+ name 'TDMOUT_A SRC SEL'
+ value 'IN 1'
+ comment {
+ access 'read write'
+ type ENUMERATED
+ count 1
+ item.0 'IN 0'
+ item.1 'IN 1'
+ item.2 'IN 2'
+ }
+ }
+}
From a22979940d28a816571644e92f157fe8e0af431f Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 16 Apr 2022 11:14:23 +0200
Subject: [PATCH] armbian-next: introduce hook `extension_finish_config()` -
late hook for ext configuration
- `extension_finish_config()` is the last thing done in config phase
- use it for determining stuff based on kernel version details, package names, etc
- also tune down some logging which was too verbose
- CI logs with no ANSI escape codes
---
extensions/nvidia.sh | 2 +-
extensions/zfs.sh | 2 +-
lib/functions/logging/logging.sh | 5 ++---
lib/functions/main/config-prepare.sh | 10 +++++++++-
lib/functions/rootfs/apt-sources.sh | 4 ++--
5 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/extensions/nvidia.sh b/extensions/nvidia.sh
index 801d61010..20f979728 100644
--- a/extensions/nvidia.sh
+++ b/extensions/nvidia.sh
@@ -1,4 +1,4 @@
-function extension_prepare_config__build_nvidia_kernel_module() {
+function extension_finish_config__build_nvidia_kernel_module() {
if [[ "${KERNEL_HAS_WORKING_HEADERS}" != "yes" ]]; then
display_alert "Kernel version has no working headers package" "skipping nVidia for kernel v${KERNEL_MAJOR_MINOR}" "warn"
return 0
diff --git a/extensions/zfs.sh b/extensions/zfs.sh
index eb41afd28..f1baa63ed 100644
--- a/extensions/zfs.sh
+++ b/extensions/zfs.sh
@@ -1,4 +1,4 @@
-function extension_prepare_config__build_zfs_kernel_module() {
+function extension_finish_config__build_zfs_kernel_module() {
if [[ "${KERNEL_HAS_WORKING_HEADERS}" != "yes" ]]; then
display_alert "Kernel version has no working headers package" "skipping ZFS for kernel v${KERNEL_MAJOR_MINOR}" "warn"
return 0
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index 66bcda39e..6550d714d 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -144,7 +144,6 @@ function display_alert() {
ext)
level_indicator="✨" # or ✅ ?
inline_logs_color="\e[1;32m"
- ci_log="notice"
;;
info)
@@ -240,9 +239,9 @@ function display_alert() {
[[ -n $2 ]] && extra=" [${inline_logs_color} ${2} ${normal_color}]"
echo -e "${normal_color}${left_marker}${padding}${level_indicator}${padding}${normal_color}${right_marker}${timing_info}${pids_info}${bashopts_info} ${normal_color}${message}${extra}${normal_color}" >&2
- # Now write to CI, if we're running on it
+ # Now write to CI, if we're running on it. Remove ANSI escapes which confuse GitHub Actions.
if [[ "${CI}" == "true" ]] && [[ "${ci_log}" != "" ]]; then
- echo "::${ci_log} ::" "$@" >&2
+ echo -e "::${ci_log} ::" "$@" | sed 's/\x1b\[[0-9;]*m//g' >&2
fi
return 0 # make sure to exit with success, always
diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh
index 6c1570bcd..0264b0d9e 100644
--- a/lib/functions/main/config-prepare.sh
+++ b/lib/functions/main/config-prepare.sh
@@ -99,7 +99,7 @@ function prepare_and_config_main_build_single() {
[[ ${KERNEL_CONFIGURE} == prebuilt ]] && [[ -z ${REPOSITORY_INSTALL} ]] &&
REPOSITORY_INSTALL="u-boot,kernel,bsp,armbian-zsh,armbian-config,armbian-bsp-cli,armbian-firmware${BUILD_DESKTOP:+,armbian-desktop,armbian-bsp-desktop}"
- do_main_configuration # This initializes the extension manager among a lot of other things
+ do_main_configuration # This initializes the extension manager among a lot of other things, and call extension_prepare_config() hook
# @TODO: this does not belong in configuration. it's a compilation thing. move there
# optimize build time with 100% CPU usage
@@ -176,6 +176,14 @@ function prepare_and_config_main_build_single() {
export ARMBIAN_WILL_BUILD_UBOOT=no
fi
+ display_alert "Extensions: finish configuration" "extension_finish_config" "debug"
+ call_extension_method "extension_finish_config" <<- 'EXTENSION_FINISH_CONFIG'
+ *allow extensions a last chance at configuration just before it is done*
+ After kernel versions are set, package names determined, etc.
+ This runs *late*, and is the final step before finishing configuration.
+ Don't change anything not coming from other variables or meant to be configured by the user.
+ EXTENSION_FINISH_CONFIG
+
display_alert "Done with prepare_and_config_main_build_single" "${BOARD}.${BOARD_TYPE}" "info"
}
diff --git a/lib/functions/rootfs/apt-sources.sh b/lib/functions/rootfs/apt-sources.sh
index ff373a98b..bc17a3a9b 100644
--- a/lib/functions/rootfs/apt-sources.sh
+++ b/lib/functions/rootfs/apt-sources.sh
@@ -36,7 +36,7 @@ add_apt_sources() {
if [[ "${new_apt_source}" == ppa* ]]; then
chroot_sdcard add-apt-repository -y -n "${new_apt_source}" # -y -> Assume yes, -n -> no apt-get update
if [[ -f "${apt_source_gpg_filepath}" ]]; then
- display_alert "Adding GPG Key" "via apt-key add (deprecated): ${apt_source_gpg_filename}" "warn"
+ display_alert "Adding GPG Key" "via apt-key add (deprecated): ${apt_source_gpg_filename}"
run_host_command_logged cp -pv "${apt_source_gpg_filepath}" "${SDCARD}/tmp/${apt_source_gpg_filename}"
chroot_sdcard apt-key add "/tmp/${apt_source_gpg_filename}"
fi
@@ -44,7 +44,7 @@ add_apt_sources() {
# installation without software-common-properties, sources.list + key.gpg
echo "${new_apt_source}" > "${SDCARD}/etc/apt/sources.list.d/${apt_source_filename}"
if [[ -f "${apt_source_gpg_filepath}" ]]; then
- display_alert "Adding GPG Key" "via keyrings: ${apt_source_gpg_filename}" "warn"
+ display_alert "Adding GPG Key" "via keyrings: ${apt_source_gpg_filename}"
mkdir -p "${SDCARD}"/usr/share/keyrings/
run_host_command_logged cp -pv "${apt_source_gpg_filepath}" "${SDCARD}"/usr/share/keyrings/
fi
From bedd3aa1a4c661bc177af7dd0db3062296d7ec5f Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 16 Apr 2022 00:45:30 +0200
Subject: [PATCH] armbian-next: shuffle around code and logic of
`add_desktop_package_sources()`
- @TODO: still needs proper asset logging for sources.list(.d)
- @TODO: tunes down adding of sources/packages to CLI builds, check with Igor
---
lib/functions/rootfs/{apt.sh => apt-install.sh} | 2 +-
lib/functions/rootfs/apt-sources.sh | 56 ++++++++++++++++++
lib/functions/rootfs/create-cache.sh | 11 +++-
lib/functions/rootfs/rootfs-desktop.sh | 78 -------------------------
lib/library-functions.sh | 15 ++++-
5 files changed, 77 insertions(+), 85 deletions(-)
diff --git a/lib/functions/rootfs/apt.sh b/lib/functions/rootfs/apt-install.sh
similarity index 93%
rename from lib/functions/rootfs/apt.sh
rename to lib/functions/rootfs/apt-install.sh
index e062d5284..b2406f339 100644
--- a/lib/functions/rootfs/apt.sh
+++ b/lib/functions/rootfs/apt-install.sh
@@ -16,7 +16,7 @@ install_deb_chroot() {
# also won't require cleanup later
name="/root/"$(basename "${package}")
- [[ ! -f "${SDCARD}${name}" ]] && cp "${package}" "${SDCARD}${name}"
+ [[ ! -f "${SDCARD}${name}" ]] && run_host_command_logged cp -pv "${package}" "${SDCARD}${name}"
desc=""
else
name=$1
diff --git a/lib/functions/rootfs/apt-sources.sh b/lib/functions/rootfs/apt-sources.sh
new file mode 100644
index 000000000..ff373a98b
--- /dev/null
+++ b/lib/functions/rootfs/apt-sources.sh
@@ -0,0 +1,56 @@
+add_apt_sources() {
+ local potential_paths=""
+ local sub_dirs_to_check=". "
+ if [[ ! -z "${SELECTED_CONFIGURATION+x}" ]]; then
+ sub_dirs_to_check+="config_${SELECTED_CONFIGURATION}"
+ fi
+
+ # @TODO: rpardini: The logic here is meant to be evolved over time. Originally, all of this only ran when BUILD_DESKTOP=yes.
+ # Igor had bumped it to run on all builds, but that adds external sources to cli and minimal.
+ # Here I'm tuning it down to 1/4th of the original, eg: no nala on my cli builds, thanks.
+ [[ "${BUILD_MINIMAL}" != "yes" ]] && get_all_potential_paths "${DEBOOTSTRAP_SEARCH_RELATIVE_DIRS}" "${sub_dirs_to_check}" "sources/apt"
+ [[ "${BUILD_DESKTOP}" == "yes" ]] && get_all_potential_paths "${CLI_SEARCH_RELATIVE_DIRS}" "${sub_dirs_to_check}" "sources/apt"
+ [[ "${BUILD_DESKTOP}" == "yes" ]] && get_all_potential_paths "${DESKTOP_ENVIRONMENTS_SEARCH_RELATIVE_DIRS}" "." "sources/apt"
+ [[ "${BUILD_DESKTOP}" == "yes" ]] && get_all_potential_paths "${DESKTOP_APPGROUPS_SEARCH_RELATIVE_DIRS}" "${DESKTOP_APPGROUPS_SELECTED}" "sources/apt"
+
+ display_alert "Adding additional apt sources" "add_apt_sources()" "debug"
+
+ for apt_sources_dirpath in ${potential_paths}; do
+ if [[ -d "${apt_sources_dirpath}" ]]; then
+ for apt_source_filepath in "${apt_sources_dirpath}/"*.source; do
+ apt_source_filepath=$(echo "${apt_source_filepath}" | sed -re 's/(^.*[^/])\.[^./]*$/\1/')
+ local new_apt_source
+ local apt_source_gpg_filepath
+ local apt_source_gpg_filename
+ local apt_source_filename
+
+ new_apt_source="$(cat "${apt_source_filepath}.source")"
+ apt_source_gpg_filepath="${apt_source_filepath}.gpg"
+ apt_source_gpg_filename="$(basename "${apt_source_gpg_filepath}")"
+ apt_source_filename="$(basename "${apt_source_filepath}").list"
+
+ display_alert "Adding APT Source" "${new_apt_source}" "info"
+
+ # @TODO: rpardini, why do PPAs get apt-key and others get keyrings GPG?
+
+ if [[ "${new_apt_source}" == ppa* ]]; then
+ chroot_sdcard add-apt-repository -y -n "${new_apt_source}" # -y -> Assume yes, -n -> no apt-get update
+ if [[ -f "${apt_source_gpg_filepath}" ]]; then
+ display_alert "Adding GPG Key" "via apt-key add (deprecated): ${apt_source_gpg_filename}" "warn"
+ run_host_command_logged cp -pv "${apt_source_gpg_filepath}" "${SDCARD}/tmp/${apt_source_gpg_filename}"
+ chroot_sdcard apt-key add "/tmp/${apt_source_gpg_filename}"
+ fi
+ else
+ # installation without software-common-properties, sources.list + key.gpg
+ echo "${new_apt_source}" > "${SDCARD}/etc/apt/sources.list.d/${apt_source_filename}"
+ if [[ -f "${apt_source_gpg_filepath}" ]]; then
+ display_alert "Adding GPG Key" "via keyrings: ${apt_source_gpg_filename}" "warn"
+ mkdir -p "${SDCARD}"/usr/share/keyrings/
+ run_host_command_logged cp -pv "${apt_source_gpg_filepath}" "${SDCARD}"/usr/share/keyrings/
+ fi
+ fi
+
+ done
+ fi
+ done
+}
diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh
index 5e57eabc5..7d7fc87e9 100644
--- a/lib/functions/rootfs/create-cache.sh
+++ b/lib/functions/rootfs/create-cache.sh
@@ -162,7 +162,7 @@ function create_new_rootfs_cache() {
chroot_sdcard LC_ALL=C LANG=C setupcon --save --force
fi
- # stage: create apt-get sources list
+ # stage: create apt-get sources list (basic Debian/Ubuntu apt sources, no external nor PPAS)
create_sources_list "$RELEASE" "$SDCARD/"
# add armhf arhitecture to arm64, unless configured not to do so.
@@ -173,8 +173,13 @@ function create_new_rootfs_cache() {
# this should fix resolvconf installation failure in some cases
chroot_sdcard 'echo "resolvconf resolvconf/linkify-resolvconf boolean false" | debconf-set-selections'
- # TODO change name of the function from "desktop" and move to appropriate location
- add_desktop_package_sources
+ # Add external / PPAs to apt sources; decides internally based on minimal/cli/desktop dir/file structure
+ add_apt_sources
+
+ # uset asset logging for this; actually log contents of the files too
+ run_host_command_logged ls -l "${SDCARD}/usr/share/keyrings"
+ run_host_command_logged ls -l "${SDCARD}/etc/apt/sources.list.d"
+ run_host_command_logged cat "${SDCARD}/etc/apt/sources.list"
# stage: update packages list
display_alert "Updating package list" "$RELEASE" "info"
diff --git a/lib/functions/rootfs/rootfs-desktop.sh b/lib/functions/rootfs/rootfs-desktop.sh
index 208119d4b..edcf9e619 100644
--- a/lib/functions/rootfs/rootfs-desktop.sh
+++ b/lib/functions/rootfs/rootfs-desktop.sh
@@ -1,81 +1,3 @@
-install_ppa_prerequisites() {
-
- # Myy : So... The whole idea is that, a good bunch of external sources
- # are PPA.
- # Adding PPA without add-apt-repository is poorly conveninent since
- # you need to reconstruct the URL by hand, and find the GPG key yourself.
- # add-apt-repository does that automatically, and in a way that allows you
- # to remove it cleanly through the same tool.
-
- # Myy : TODO Try to find a way to install this package only when
- # we encounter a PPA.
- chroot_sdcard_apt_get_install "software-properties-common"
-
-}
-
-add_apt_sources() {
-
- local potential_paths=""
- local sub_dirs_to_check=". "
- if [[ ! -z "${SELECTED_CONFIGURATION+x}" ]]; then
- sub_dirs_to_check+="config_${SELECTED_CONFIGURATION}"
- fi
- get_all_potential_paths "${DEBOOTSTRAP_SEARCH_RELATIVE_DIRS}" "${sub_dirs_to_check}" "sources/apt"
- get_all_potential_paths "${CLI_SEARCH_RELATIVE_DIRS}" "${sub_dirs_to_check}" "sources/apt"
- get_all_potential_paths "${DESKTOP_ENVIRONMENTS_SEARCH_RELATIVE_DIRS}" "." "sources/apt"
- get_all_potential_paths "${DESKTOP_APPGROUPS_SEARCH_RELATIVE_DIRS}" "${DESKTOP_APPGROUPS_SELECTED}" "sources/apt"
-
- display_alert "Adding additional apt sources" "add_apt_sources()" "debug"
-
- for apt_sources_dirpath in ${potential_paths}; do
- if [[ -d "${apt_sources_dirpath}" ]]; then
- for apt_source_filepath in "${apt_sources_dirpath}/"*.source; do
- apt_source_filepath=$(echo "${apt_source_filepath}" | sed -re 's/(^.*[^/])\.[^./]*$/\1/')
- local new_apt_source="$(cat "${apt_source_filepath}.source")"
- local apt_source_gpg_filepath="${apt_source_filepath}.gpg"
-
- # extract filenames
- local apt_source_gpg_filename="$(basename ${apt_source_gpg_filepath})"
- local apt_source_filename="$(basename ${apt_source_filepath}).list"
-
- display_alert "Adding APT Source" "${new_apt_source}" "info"
-
- if [[ "${new_apt_source}" == ppa* ]]; then
- chroot_sdcard "add-apt-repository -y -n \"${new_apt_source}\""
- # add list with apt-add
- # -y -> Assumes yes to all queries
- # -n -> Do not update package cache after adding
- if [[ -f "${apt_source_gpg_filepath}" ]]; then
- display_alert "Adding GPG Key ${apt_source_gpg_filepath}"
- cp "${apt_source_gpg_filepath}" "${SDCARD}/tmp/${apt_source_gpg_filename}"
- chroot_sdcard "apt-key add \"/tmp/${apt_source_gpg_filename}\""
- echo "APT Key returned : $?"
- fi
- else
- # installation without software-common-properties, sources.list + key.gpg
- echo "${new_apt_source}" > "${SDCARD}/etc/apt/sources.list.d/${apt_source_filename}"
- if [[ -f "${apt_source_gpg_filepath}" ]]; then
- display_alert "Adding GPG Key" "${apt_source_gpg_filepath}" "info"
- # local apt_source_gpg_filename="$(basename ${apt_source_gpg_filepath})"
- mkdir -p "${SDCARD}"/usr/share/keyrings/
- cp "${apt_source_gpg_filepath}" "${SDCARD}"/usr/share/keyrings/
- fi
-
- fi
-
- done
- fi
- done
-
-}
-
-add_desktop_package_sources() {
- add_apt_sources
- run_host_command_logged ls -l "${SDCARD}/usr/share/keyrings"
- run_host_command_logged ls -l "${SDCARD}/etc/apt/sources.list.d"
- run_host_command_logged cat "${SDCARD}/etc/apt/sources.list"
-}
-
# a-kind-of-hook, called by install_distribution_agnostic() if it's a desktop build
desktop_postinstall() {
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index a7cfb652b..5bad7883a 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -429,9 +429,18 @@ source "${SRC}"/lib/functions/main/rootfs-image.sh
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/rootfs/apt.sh
-# shellcheck source=lib/functions/rootfs/apt.sh
-source "${SRC}"/lib/functions/rootfs/apt.sh
+### lib/functions/rootfs/apt-install.sh
+# shellcheck source=lib/functions/rootfs/apt-install.sh
+source "${SRC}"/lib/functions/rootfs/apt-install.sh
+
+# no errors tolerated. invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/rootfs/apt-sources.sh
+# shellcheck source=lib/functions/rootfs/apt-sources.sh
+source "${SRC}"/lib/functions/rootfs/apt-sources.sh
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
From 4876e0444f33ea1ce28cb340215638702ef98792 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 15 Apr 2022 22:07:17 +0200
Subject: [PATCH] armbian-next: 4.x can't build objtool in kernel-headers;
allow for handling that later
- 4.x has a lot more obtuse dependencies
- introduce KERNEL_HAS_WORKING_HEADERS calculated based on KERNEL_MAJOR_MINOR
---
extensions/nvidia.sh | 5 +++++
extensions/zfs.sh | 5 +++++
lib/functions/compilation/kernel-debs.sh | 7 ++++++-
lib/functions/main/config-prepare.sh | 8 ++++++--
4 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/extensions/nvidia.sh b/extensions/nvidia.sh
index 57e478c5c..801d61010 100644
--- a/extensions/nvidia.sh
+++ b/extensions/nvidia.sh
@@ -1,10 +1,15 @@
function extension_prepare_config__build_nvidia_kernel_module() {
+ if [[ "${KERNEL_HAS_WORKING_HEADERS}" != "yes" ]]; then
+ display_alert "Kernel version has no working headers package" "skipping nVidia for kernel v${KERNEL_MAJOR_MINOR}" "warn"
+ return 0
+ fi
export INSTALL_HEADERS="yes"
declare -g NVIDIA_DRIVER_VERSION="${NVIDIA_DRIVER_VERSION:-"510"}"
display_alert "Forcing INSTALL_HEADERS=yes; using nVidia driver version ${NVIDIA_DRIVER_VERSION}" "${EXTENSION}" "debug"
}
function post_install_kernel_debs__build_nvidia_kernel_module() {
+ [[ "${INSTALL_HEADERS}" != "yes" ]] || [[ "${KERNEL_HAS_WORKING_HEADERS}" != "yes" ]] && return 0
display_alert "Install nVidia packages, build kernel module in chroot" "${EXTENSION}" "info"
# chroot_sdcard_apt_get_install() is in lib/logging/runners.sh which handles "running" of stuff nicely.
# chroot_sdcard_apt_get_install() -> chroot_sdcard_apt_get() -> chroot_sdcard() -> run_host_command_logged_raw()
diff --git a/extensions/zfs.sh b/extensions/zfs.sh
index 6705b4578..eb41afd28 100644
--- a/extensions/zfs.sh
+++ b/extensions/zfs.sh
@@ -1,9 +1,14 @@
function extension_prepare_config__build_zfs_kernel_module() {
+ if [[ "${KERNEL_HAS_WORKING_HEADERS}" != "yes" ]]; then
+ display_alert "Kernel version has no working headers package" "skipping ZFS for kernel v${KERNEL_MAJOR_MINOR}" "warn"
+ return 0
+ fi
export INSTALL_HEADERS="yes"
display_alert "Forcing INSTALL_HEADERS=yes; for use with ZFS" "${EXTENSION}" "debug"
}
function post_install_kernel_debs__build_zfs_kernel_module() {
+ [[ "${INSTALL_HEADERS}" != "yes" ]] || [[ "${KERNEL_HAS_WORKING_HEADERS}" != "yes" ]] && return 0
display_alert "Install ZFS packages, will build kernel module in chroot" "${EXTENSION}" "info"
declare -agx if_error_find_files_sdcard=("/var/lib/dkms/zfs/*/build/*.log")
# See https://github.com/zfsonlinux/pkg-zfs/issues/69 for a bug with leaking env vars.
diff --git a/lib/functions/compilation/kernel-debs.sh b/lib/functions/compilation/kernel-debs.sh
index e3d3b57dc..e0788518d 100644
--- a/lib/functions/compilation/kernel-debs.sh
+++ b/lib/functions/compilation/kernel-debs.sh
@@ -58,7 +58,12 @@ function prepare_kernel_packaging_debs() {
create_kernel_deb "linux-dtb-${BRANCH}-${LINUXFAMILY}" "${debs_target_dir}" kernel_package_callback_linux_dtb
fi
- create_kernel_deb "linux-headers-${BRANCH}-${LINUXFAMILY}" "${debs_target_dir}" kernel_package_callback_linux_headers
+ # Only recent kernels get linux-headers package; some tuning has to be done for 4.x
+ if [[ "${KERNEL_HAS_WORKING_HEADERS}" == "yes" ]]; then
+ create_kernel_deb "linux-headers-${BRANCH}-${LINUXFAMILY}" "${debs_target_dir}" kernel_package_callback_linux_headers
+ else
+ display_alert "Skipping linux-headers package" "for ${KERNEL_MAJOR_MINOR} kernel version" "warn"
+ fi
}
function create_kernel_deb() {
diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh
index 013b903d4..6c1570bcd 100644
--- a/lib/functions/main/config-prepare.sh
+++ b/lib/functions/main/config-prepare.sh
@@ -150,19 +150,23 @@ function prepare_and_config_main_build_single() {
if [[ "x${KERNEL_MAJOR_MINOR}x" == "xx" ]]; then
exit_with_error "BAD config, missing" "KERNEL_MAJOR_MINOR" "err"
fi
+ export KERNEL_HAS_WORKING_HEADERS="no" # assume the worst, and all surprises will be happy ones
# Parse/validate the the major, bail if no match
- if linux-version compare "${KERNEL_MAJOR_MINOR}" ge "5.4"; then # We support 5.x from 5.4; 5.10+ brings unified packaging.
+ if linux-version compare "${KERNEL_MAJOR_MINOR}" ge "5.4"; then # We support 5.x from 5.4
+ export KERNEL_HAS_WORKING_HEADERS="yes" # We can build working headers for 5.x even when cross compiling.
export KERNEL_MAJOR=5
export KERNEL_MAJOR_SHALLOW_TAG="v${KERNEL_MAJOR_MINOR}-rc1"
elif linux-version compare "${KERNEL_MAJOR_MINOR}" ge "4.4" && linux-version compare "${KERNEL_MAJOR_MINOR}" lt "5.0"; then
- export KERNEL_MAJOR=4 # We support 4.x from 4.4; all require custom packaging.
+ export KERNEL_MAJOR=4 # We support 4.x from 4.4
export KERNEL_MAJOR_SHALLOW_TAG="v${KERNEL_MAJOR_MINOR}-rc1"
else
+ # If you think you can patch packaging to support this, you're probably right. Is _worth_ it though?
exit_with_error "Kernel series unsupported" "'${KERNEL_MAJOR_MINOR}' is unsupported, or bad config"
fi
export LINUXSOURCEDIR="kernel/${ARCH}__${KERNEL_MAJOR_MINOR}__${LINUXFAMILY}"
else
+ export KERNEL_HAS_WORKING_HEADERS="yes" # I assume non-Armbian kernels have working headers, eg: Debian/Ubuntu generic do.
export ARMBIAN_WILL_BUILD_KERNEL=no
fi
From 6b5726444e6be8a935fe758664847184e7642840 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 15 Apr 2022 21:48:22 +0200
Subject: [PATCH] armbian-next: downgrade `error=misleading-indentation` to
warning
- some 4.x kernels patches are really messy
- newer gcc's make that an error now
---
lib/functions/compilation/kernel.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 579400490..d6dd30920 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -14,8 +14,8 @@ function run_kernel_make() {
"ARCH=${ARCHITECTURE}" # Key param. Everything depends on this.
"LOCALVERSION=-${LINUXFAMILY}" # Change the internal kernel version to include the family. Changing this causes recompiles
- "CROSS_COMPILE=${CCACHE} ${KERNEL_COMPILER}" # added as prefix to every compiler invocation by make
- "KCFLAGS=-fdiagnostics-color=always" # Force GCC colored messages.
+ "CROSS_COMPILE=${CCACHE} ${KERNEL_COMPILER}" # added as prefix to every compiler invocation by make
+ "KCFLAGS=-fdiagnostics-color=always -Wno-error=misleading-indentation" # Force GCC colored messages, downgrade misleading indentation to warning
"SOURCE_DATE_EPOCH=${kernel_base_revision_ts}" # https://reproducible-builds.org/docs/source-date-epoch/ and https://www.kernel.org/doc/html/latest/kbuild/reproducible-builds.html
"KBUILD_BUILD_TIMESTAMP=${kernel_base_revision_date}" # https://www.kernel.org/doc/html/latest/kbuild/kbuild.html#kbuild-build-timestamp
From 54cad4f827e14967d692ae4d14426394cc56b4ff Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 15 Apr 2022 17:23:42 +0200
Subject: [PATCH] armbian-next: *allow cross compilation*, even the so-called
"reverse cross-compile" (amd64 on arm64)
---
config/sources/amd64.conf | 6 +++---
lib/functions/compilation/kernel.sh | 4 +---
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/config/sources/amd64.conf b/config/sources/amd64.conf
index cc1b4b256..8b208bab2 100644
--- a/config/sources/amd64.conf
+++ b/config/sources/amd64.conf
@@ -13,9 +13,9 @@ export UBOOT_USE_GCC="none" # required by configuration.sh
[[ -z $KERNELSOURCE ]] && KERNELSOURCE=$MAINLINE_KERNEL_SOURCE
if [[ "$(uname -m)" == "aarch64" ]]; then
- # Explicitly disallow "reverse cross-compile". Go ask @the-Going why ;-)
- display_error "Unsupported cross-compile" "aarch64 -> x86_64" "err"
- exit 39
+ # Allow building amd64 on aarch64, but using system toolchain only
+ export KERNEL_COMPILER="x86_64-linux-gnu-"
+ export SKIP_EXTERNAL_TOOLCHAINS=yes
fi
true # don't fail due to conditional above.
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 83596f603..579400490 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -190,12 +190,10 @@ function kernel_config() {
# if it matches we use the system compiler
if dpkg-architecture -e "${ARCH}"; then
display_alert "Native compilation" "target ${ARCH} on host $(dpkg --print-architecture)"
- elif [[ $(dpkg --print-architecture) == amd64 ]]; then
+ else
display_alert "Cross compilation" "target ${ARCH} on host $(dpkg --print-architecture)"
toolchain=$(find_toolchain "$KERNEL_COMPILER" "$KERNEL_USE_GCC")
[[ -z $toolchain ]] && exit_with_error "Could not find required toolchain" "${KERNEL_COMPILER}gcc $KERNEL_USE_GCC"
- else
- display_alert "Unhandled cross compilation combo" "target ${ARCH} on host $(dpkg --print-architecture) - headers might not work" "warn"
fi
kernel_compiler_version="$(eval env PATH="${toolchain}:${PATH}" "${KERNEL_COMPILER}gcc" -dumpversion)"
From c57535fbcab21c0cf7284e0cbcb614971e6d4bd7 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 15 Apr 2022 13:49:23 +0200
Subject: [PATCH] armbian-next: add `zfs` extension, which installs headers and
builds ZFS via DKMS in chroot
- similar to how `nvidia` extension does it
---
extensions/zfs.sh | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/extensions/zfs.sh b/extensions/zfs.sh
new file mode 100644
index 000000000..6705b4578
--- /dev/null
+++ b/extensions/zfs.sh
@@ -0,0 +1,11 @@
+function extension_prepare_config__build_zfs_kernel_module() {
+ export INSTALL_HEADERS="yes"
+ display_alert "Forcing INSTALL_HEADERS=yes; for use with ZFS" "${EXTENSION}" "debug"
+}
+
+function post_install_kernel_debs__build_zfs_kernel_module() {
+ display_alert "Install ZFS packages, will build kernel module in chroot" "${EXTENSION}" "info"
+ declare -agx if_error_find_files_sdcard=("/var/lib/dkms/zfs/*/build/*.log")
+ # See https://github.com/zfsonlinux/pkg-zfs/issues/69 for a bug with leaking env vars.
+ use_clean_environment="yes" chroot_sdcard_apt_get_install "zfs-dkms zfsutils-linux"
+}
From 82756687f5930a55f413a3f7164b1fb9337bd2b0 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 15 Apr 2022 13:49:56 +0200
Subject: [PATCH] armbian-next: x86: enable `nvidia` extension for all releases
(only desktop)
---
config/sources/families/uefi-x86.conf | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/config/sources/families/uefi-x86.conf b/config/sources/families/uefi-x86.conf
index 7a40a5b00..55923fd7b 100644
--- a/config/sources/families/uefi-x86.conf
+++ b/config/sources/families/uefi-x86.conf
@@ -1,6 +1,5 @@
# Important: LINUXFAMILY and ARCH are defined _before_ including the common family include
-[[ "$BUILD_DESKTOP" == yes && "$RELEASE" == jammy ]] && enable_extension "nvidia"
-export UEFI_GRUB_TERMINAL="gfxterm"
+[[ "$BUILD_DESKTOP" == yes ]] && enable_extension "nvidia"
export LINUXFAMILY="x86"
export ARCH="amd64"
source "${BASH_SOURCE%/*}/include/uefi_common.inc"
From d4ce330682ba9563b1821ae08b8412e9149fec80 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 15 Apr 2022 13:53:14 +0200
Subject: [PATCH] armbian-next: `headers-debian-byteshift.patch` is dead;
long-live cross-compiled source-only kernel-headers
- kernel-headers package now only includes _sources_
- postinst does the compilation and preparation for DKMS compatibility
- `tools` dir is included now, which includes the byteshift utilities
- handle special scripts/module.lds case after 5.10
- tested on a 6 combinations of `x86` / `arm64` / `armhf` (3x targets, 2x hosts)
- @TODO: we might be able to reduce the size of tools a bit (perf/tests/etc)
- @TODO: still missing ARCH vs ARCHITECTURE vs SRC_ARCH clarity elsewhere
---
lib/functions/compilation/kernel-debs.sh | 108 +++++++++++++--------
lib/functions/compilation/kernel.sh | 4 -
patch/misc/headers-debian-byteshift.patch | 156 ------------------------------
3 files changed, 67 insertions(+), 201 deletions(-)
diff --git a/lib/functions/compilation/kernel-debs.sh b/lib/functions/compilation/kernel-debs.sh
index b8eb9d266..e3d3b57dc 100644
--- a/lib/functions/compilation/kernel-debs.sh
+++ b/lib/functions/compilation/kernel-debs.sh
@@ -3,26 +3,20 @@
# We wanna produce Debian/Ubuntu compatible packages so we're able to use their standard tools, like
# `flash-kernel`, `u-boot-menu`, `grub2`, and others, so we gotta stick to their conventions.
-# Headers are important. We wanna be compatible with `dkms` stuff from Ubuntu, like `nvidia-driver-xxx`.
-# This is affected by cross-compilation: Armbian usually builds arm64 on amd64, and the KBUILD tools
-# that would be included in such headers package will be the wrong arch for `dkms`ing on target arm64 machine.
-
# The main difference is that this is NOT invoked from KBUILD's Makefile, but instead
# directly by Armbian, with references to the dirs where KBUILD's
# `make install dtbs_install modules_install headers_install` have already successfully been run.
# This will create a SET of packages. It should always create these:
# image package: vmlinuz and such, config, modules, and dtbs (if exist) in /usr/lib/xxx
-# libc header package: just the libc headers
-# linux-headers package: just the image headers. (what about the binaries? cross compilation?)
+# linux-headers package: just the kernel headers, for building out-of-tree modules, dkms, etc.
# linux-dtbs package: only dtbs, if they exist. in /boot/
# So this will handle
# - Creating .deb package skeleton dir (mktemp)
# - Moving/copying around of KBUILD installed stuff for Debian/Ubuntu/Armbian standard locations, in the correct packages
-# - Separating headers, between image and libc packages.
# - Fixing the symlinks to stuff so they fit a target system.
-# - building the .debs;
+# - building the .debs.
is_enabled() {
grep -q "^$1=y" include/config/auto.conf
@@ -64,11 +58,7 @@ function prepare_kernel_packaging_debs() {
create_kernel_deb "linux-dtb-${BRANCH}-${LINUXFAMILY}" "${debs_target_dir}" kernel_package_callback_linux_dtb
fi
- if dpkg-architecture -e "${ARCH}"; then
- create_kernel_deb "linux-headers-${BRANCH}-${LINUXFAMILY}" "${debs_target_dir}" kernel_package_callback_linux_headers
- else
- display_alert "Cross-compilation" "skip kernel-headers packaging" "warn"
- fi
+ create_kernel_deb "linux-headers-${BRANCH}-${LINUXFAMILY}" "${debs_target_dir}" kernel_package_callback_linux_headers
}
function create_kernel_deb() {
@@ -268,40 +258,33 @@ function kernel_package_callback_linux_headers() {
# how to get SRCARCH? only from the makefile itself. ARCH=amd64 then SRCARCH=x86. How to we know? @TODO
local SRC_ARCH="${ARCH}"
[[ "${SRC_ARCH}" == "amd64" ]] && SRC_ARCH="x86"
+ [[ "${SRC_ARCH}" == "armhf" ]] && SRC_ARCH="arm"
# Create a list of files to include, path-relative to the kernel tree
local temp_file_list="${WORKDIR}/tmp_file_list_${kernel_version_family}.kernel.headers"
- # Source stuff. No binaries. I think.
+ # Find the files we want to include in the package. Those will be later cleaned, etc.
(
cd "${kernel_work_dir}" || exit 2
- #echo "-- Sources: Makefiles and Kconfigs and perl"
find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl
-
- #echo "-- Sources: all arches include, include and scripts both files and symlinks "
find arch/*/include include scripts -type f -o -type l
-
- #echo "-- Sources: security include"
find security/*/include -type f
-
- #echo "-- Sources: arch ${SRC_ARCH} module lds or Kbuild platforms or Platform"
- find "arch/${SRC_ARCH}" -name module.lds -o -name Kbuild.platforms -o -name Platform
-
- #echo "-- Sources: All files somewhere for some reason"
- # shellcheck disable=SC2046 # I need to expand. Thanks.
- find $(find "arch/${SRC_ARCH}" -name include -o -name scripts -type d) -type f
-
- if is_enabled CONFIG_STACK_VALIDATION; then
- #echo "-- Binaries: objtool due to CONFIG_STACK_VALIDATION"
- find tools/objtool -type f -executable
- fi
-
- #echo "-- Binaries: Module.symvers and includes scripts FILES"
- find arch/${SRC_ARCH}/include Module.symvers include scripts -type f
+ [[ -d "arch/${SRC_ARCH}" ]] && {
+ find "arch/${SRC_ARCH}" -name module.lds -o -name Kbuild.platforms -o -name Platform
+ # shellcheck disable=SC2046 # I need to expand. Thanks.
+ find $(find "arch/${SRC_ARCH}" -name include -o -name scripts -type d) -type f
+ find arch/${SRC_ARCH}/include Module.symvers include scripts -type f
+ }
+ # Include the byteshift utilities shared between kernel proper and the build scripts/tools.
+ # This replaces 'headers-debian-byteshift.patch' which was used for years in Armbian.
+ #find tools/include/tools/be_byteshift.h tools/include/tools/le_byteshift.h -type f
+ #find tools/objtool -type f
+ #find tools/build -type f
+ find tools -type f # all tools. all of it? we might get away with a little less. eg: tools/perf and tools/testing
+ find arch/x86/lib/insn.c # required by objtool stuff...
if is_enabled CONFIG_GCC_PLUGINS; then
- #echo "-- Binaries: gcc plugins due to CONFIG_GCC_PLUGINS"
- find scripts/gcc-plugins -name \*.so -o -name gcc-common.h
+ find scripts/gcc-plugins -name gcc-common.h # @TODO something else here too?
fi
) > "${temp_file_list}"
@@ -310,10 +293,21 @@ function kernel_package_callback_linux_headers() {
# ${temp_file_list} is left at WORKDIR for later debugging, will be removed by WORKDIR cleanup trap
- # @TODO: maybe split all binaries to a separate package at this stage; that way cross compile can still produce
- # @TODO: source-only headers, which can then be patched (byteshift?) and compiled client-side later
+ # Now, make the script dirs clean.
+ # This is run in our _target_ dir, not the source tree, so we're free to make clean as we wish without invalidating the next build's cache.
+ run_host_command_logged cd "${headers_target_dir}" "&&" make "ARCH=${SRC_ARCH}" "M=scripts" clean
+ run_host_command_logged cd "${headers_target_dir}/tools" "&&" make "ARCH=${SRC_ARCH}" clean
- # @TODO: cat "${temp_file_list}" | grep -v -e "\.h$" -e ".c$" -e "Makefile$" -e "Kconfig$" -e "Kbuild$" -e "\.cocci$" | xargs file | grep -v -e "ASCII" -e "script text"
+ # Hack: after cleaning, copy over the scripts/module.lds file from the source tree. It will only exist on 5.10+
+ # See https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1906131
+ [[ -f "${kernel_work_dir}/scripts/module.lds" ]] &&
+ run_host_command_logged cp -v "${kernel_work_dir}/scripts/module.lds" "${headers_target_dir}/scripts/module.lds"
+
+ # Check that no binaries are included by now. Expensive... @TODO: remove after me make sure.
+ (
+ cd "${headers_target_dir}" || exit 33
+ find . -type f | grep -v -e "include/config/" -e "\.h$" -e ".c$" -e "Makefile$" -e "Kconfig$" -e "Kbuild$" -e "\.cocci$" | xargs file | grep -v -e "ASCII" -e "script text" -e "empty" -e "Unicode text" -e "symbolic link" -e "CSV text" -e "SAS 7+" || true
+ )
# Generate a control file
cat <<- CONTROL_FILE > "${package_DEBIAN_dir}/control"
@@ -323,12 +317,44 @@ function kernel_package_callback_linux_headers() {
Package: ${package_name}
Architecture: ${ARCH}
Provides: linux-headers, linux-headers-armbian, armbian-$BRANCH
- Depends: make, gcc, libc6-dev, bison, flex, libssl-dev
+ Depends: make, gcc, libc6-dev, bison, flex, libssl-dev, libelf-dev
Description: Linux kernel headers for ${kernel_version_family}
This package provides kernel header files for ${kernel_version_family}
.
This is useful for DKMS and building of external modules.
CONTROL_FILE
- # @TODO: preinst postinst? dependent on split, see todo above
+ # Make sure the target dir is clean/not-existing before installing.
+ kernel_package_hook_helper "preinst" <(
+ cat <<- EOT_PREINST
+ if [[ -d "/usr/src/linux-headers-${kernel_version_family}" ]]; then
+ echo "Cleaning pre-existing directory /usr/src/linux-headers-${kernel_version_family} ..."
+ rm -rf "/usr/src/linux-headers-${kernel_version_family}"
+ fi
+ EOT_PREINST
+ )
+
+ # Make sure the target dir is removed before removing the package; that way we don't leave eventual compilation artifacts over there.
+ kernel_package_hook_helper "prerm" <(
+ cat <<- EOT_PRERM
+ if [[ -d "/usr/src/linux-headers-${kernel_version_family}" ]]; then
+ echo "Cleaning directory /usr/src/linux-headers-${kernel_version_family} ..."
+ rm -rf "/usr/src/linux-headers-${kernel_version_family}"
+ fi
+ EOT_PRERM
+ )
+
+ kernel_package_hook_helper "postinst" <(
+ cat <<- EOT_POSTINST
+ cd "/usr/src/linux-headers-${kernel_version_family}"
+ NCPU=\$(grep -c 'processor' /proc/cpuinfo)
+ echo "Compiling kernel-headers tools (${kernel_version_family}) using \$NCPU CPUs - please wait ..."
+ yes "" | make ARCH="${SRC_ARCH}" oldconfig
+ make ARCH="${SRC_ARCH}" -j\$NCPU scripts
+ make ARCH="${SRC_ARCH}" -j\$NCPU M=scripts/mod/
+ # make ARCH="${SRC_ARCH}" -j\$NCPU modules_prepare # depends on too much other stuff.
+ make ARCH="${SRC_ARCH}" -j\$NCPU tools/objtool
+ echo "Done compiling kernel-headers tools (${kernel_version_family})."
+ EOT_POSTINST
+ )
}
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 118bdd752..83596f603 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -238,10 +238,6 @@ function kernel_config() {
cp -p "${SRC}"/packages/blobs/odroidxu4/*.bin "${kernel_work_dir}/firmware/edid"
fi
- # hack for deb builder. To pack what's missing in headers pack.
- # @TODO: only for legacy builds?
- cp "${SRC}"/patch/misc/headers-debian-byteshift.patch /tmp # @TODO: ok, but why /tmp? It's leaking there.
-
display_alert "Kernel configuration" "${LINUXCONFIG}" "info"
if [[ $KERNEL_CONFIGURE != yes ]]; then
diff --git a/patch/misc/headers-debian-byteshift.patch b/patch/misc/headers-debian-byteshift.patch
deleted file mode 100644
index ef375ff66..000000000
--- a/patch/misc/headers-debian-byteshift.patch
+++ /dev/null
@@ -1,156 +0,0 @@
-Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-Link: http://lkml.kernel.org/r/1330436245-24875-2-git-send-email-matt@console-pimps.org
-Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
-tools/include/tools/be_byteshift.h | 70 +++++++++++++++++++++++++++++++++++++
-tools/include/tools/le_byteshift.h | 70 +++++++++++++++++++++++++++++++++++++
-2 files changed, 140 insertions(+)
-
---- /dev/null
-+++ b/tools/include/tools/be_byteshift.h
-@@ -0,0 +1,70 @@
-+#ifndef _TOOLS_BE_BYTESHIFT_H
-+#define _TOOLS_BE_BYTESHIFT_H
-+
-+#include <linux/types.h>
-+
-+static inline __u16 __get_unaligned_be16(const __u8 *p)
-+{
-+ return p[0] << 8 | p[1];
-+}
-+
-+static inline __u32 __get_unaligned_be32(const __u8 *p)
-+{
-+ return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
-+}
-+
-+static inline __u64 __get_unaligned_be64(const __u8 *p)
-+{
-+ return (__u64)__get_unaligned_be32(p) << 32 |
-+ __get_unaligned_be32(p + 4);
-+}
-+
-+static inline void __put_unaligned_be16(__u16 val, __u8 *p)
-+{
-+ *p++ = val >> 8;
-+ *p++ = val;
-+}
-+
-+static inline void __put_unaligned_be32(__u32 val, __u8 *p)
-+{
-+ __put_unaligned_be16(val >> 16, p);
-+ __put_unaligned_be16(val, p + 2);
-+}
-+
-+static inline void __put_unaligned_be64(__u64 val, __u8 *p)
-+{
-+ __put_unaligned_be32(val >> 32, p);
-+ __put_unaligned_be32(val, p + 4);
-+}
-+
-+static inline __u16 get_unaligned_be16(const void *p)
-+{
-+ return __get_unaligned_be16((const __u8 *)p);
-+}
-+
-+static inline __u32 get_unaligned_be32(const void *p)
-+{
-+ return __get_unaligned_be32((const __u8 *)p);
-+}
-+
-+static inline __u64 get_unaligned_be64(const void *p)
-+{
-+ return __get_unaligned_be64((const __u8 *)p);
-+}
-+
-+static inline void put_unaligned_be16(__u16 val, void *p)
-+{
-+ __put_unaligned_be16(val, p);
-+}
-+
-+static inline void put_unaligned_be32(__u32 val, void *p)
-+{
-+ __put_unaligned_be32(val, p);
-+}
-+
-+static inline void put_unaligned_be64(__u64 val, void *p)
-+{
-+ __put_unaligned_be64(val, p);
-+}
-+
-+#endif /* _TOOLS_BE_BYTESHIFT_H */
---- /dev/null
-+++ b/tools/include/tools/le_byteshift.h
-@@ -0,0 +1,70 @@
-+#ifndef _TOOLS_LE_BYTESHIFT_H
-+#define _TOOLS_LE_BYTESHIFT_H
-+
-+#include <linux/types.h>
-+
-+static inline __u16 __get_unaligned_le16(const __u8 *p)
-+{
-+ return p[0] | p[1] << 8;
-+}
-+
-+static inline __u32 __get_unaligned_le32(const __u8 *p)
-+{
-+ return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
-+}
-+
-+static inline __u64 __get_unaligned_le64(const __u8 *p)
-+{
-+ return (__u64)__get_unaligned_le32(p + 4) << 32 |
-+ __get_unaligned_le32(p);
-+}
-+
-+static inline void __put_unaligned_le16(__u16 val, __u8 *p)
-+{
-+ *p++ = val;
-+ *p++ = val >> 8;
-+}
-+
-+static inline void __put_unaligned_le32(__u32 val, __u8 *p)
-+{
-+ __put_unaligned_le16(val >> 16, p + 2);
-+ __put_unaligned_le16(val, p);
-+}
-+
-+static inline void __put_unaligned_le64(__u64 val, __u8 *p)
-+{
-+ __put_unaligned_le32(val >> 32, p + 4);
-+ __put_unaligned_le32(val, p);
-+}
-+
-+static inline __u16 get_unaligned_le16(const void *p)
-+{
-+ return __get_unaligned_le16((const __u8 *)p);
-+}
-+
-+static inline __u32 get_unaligned_le32(const void *p)
-+{
-+ return __get_unaligned_le32((const __u8 *)p);
-+}
-+
-+static inline __u64 get_unaligned_le64(const void *p)
-+{
-+ return __get_unaligned_le64((const __u8 *)p);
-+}
-+
-+static inline void put_unaligned_le16(__u16 val, void *p)
-+{
-+ __put_unaligned_le16(val, p);
-+}
-+
-+static inline void put_unaligned_le32(__u32 val, void *p)
-+{
-+ __put_unaligned_le32(val, p);
-+}
-+
-+static inline void put_unaligned_le64(__u64 val, void *p)
-+{
-+ __put_unaligned_le64(val, p);
-+}
-+
-+#endif /* _TOOLS_LE_BYTESHIFT_H */
From d797c800c30b6a86f105e511068e545f90b9c825 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 15 Apr 2022 13:37:13 +0200
Subject: [PATCH] armbian-next: allow `use_clean_environment=yes` for
`chroot_sdcard_apt_get()` and descendants
- this causes command to be run under `env -i`, for a clean environment
---
lib/functions/logging/runners.sh | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index e550eba11..d59f6020d 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -16,7 +16,15 @@ function chroot_sdcard_apt_get() {
-o "Acquire::http::Proxy::localhost=\"DIRECT\""
)
apt_params+=(-o "Dpkg::Use-Pty=0") # Please be quiet
- chroot_sdcard DEBIAN_FRONTEND=noninteractive apt-get "${apt_params[@]}" "$@"
+
+ # Allow for clean-environment apt-get
+ local -a prelude_clean_env=()
+ if [[ "${use_clean_environment:-no}" == "yes" ]]; then
+ display_alert "Running with clean environment" "$*" "debug"
+ prelude_clean_env=("env" "-i")
+ fi
+
+ chroot_sdcard "${prelude_clean_env[@]}" DEBIAN_FRONTEND=noninteractive apt-get "${apt_params[@]}" "$@"
}
# please, please, unify around this function.
From 0caf73b8ee67c9f34b6e6d1fce8b86ed4021694c Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 14 Apr 2022 09:58:15 +0200
Subject: [PATCH] armbian-next: manual merge (16) of all changes between
revisions be9b5156a4bdcb3850fbe0e7ada0f4421acde174 and
2a8e1ecac1c4fdbf986034be9d6c05a8f1b6e6fb
- many `traps` ignored: we don't use them anymore
---
config/sources/families/include/meson64_common.inc | 4 ++--
config/sources/families/media.conf | 4 ++--
config/sources/families/rk322x.conf | 6 ++---
config/sources/families/rockchip.conf | 10 ++++----
config/sources/families/sun50iw6.conf | 27 ++++------------------
config/templates/Dockerfile | 7 +++---
lib/functions/compilation/patch/kernel-drivers.sh | 2 +-
lib/functions/configuration/main-config.sh | 11 ++++-----
lib/functions/extras/buildpkg.sh | 13 ++++-------
lib/functions/general/downloads.sh | 7 +++---
lib/functions/image/partitioning.sh | 6 ++---
lib/functions/rootfs/distro-specific.sh | 22 ++++--------------
12 files changed, 39 insertions(+), 80 deletions(-)
diff --git a/config/sources/families/include/meson64_common.inc b/config/sources/families/include/meson64_common.inc
index e3fc577e9..21c71e5bd 100644
--- a/config/sources/families/include/meson64_common.inc
+++ b/config/sources/families/include/meson64_common.inc
@@ -35,8 +35,8 @@ case $BRANCH in
;;
edge)
- export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel. For mainline caching.
- KERNELBRANCH='branch:linux-5.15.y'
+ export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel. For mainline caching.
+ KERNELBRANCH='branch:linux-5.17.y'
KERNELPATCHDIR='meson64-edge'
;;
diff --git a/config/sources/families/media.conf b/config/sources/families/media.conf
index cf1a5603b..cd23586ce 100644
--- a/config/sources/families/media.conf
+++ b/config/sources/families/media.conf
@@ -40,8 +40,8 @@ case $BRANCH in
edge)
#SKIP_BOOTSPLASH="yes"
- export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.16.y"
+ export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
+ KERNELBRANCH="branch:linux-5.17.y"
KERNELPATCHDIR='media-'$BRANCH
LINUXFAMILY=media
LINUXCONFIG='linux-media-'$BRANCH
diff --git a/config/sources/families/rk322x.conf b/config/sources/families/rk322x.conf
index 897a452db..d707d55c8 100644
--- a/config/sources/families/rk322x.conf
+++ b/config/sources/families/rk322x.conf
@@ -3,7 +3,7 @@ BOOTENV_FILE='rk322x.txt'
OVERLAY_PREFIX='rk322x'
UBOOT_TARGET_MAP="all u-boot.itb;;u-boot-rk322x-with-spl.bin"
BOOTDELAY=0
-BOOTBRANCH='tag:v2022.01'
+BOOTBRANCH='tag:v2022.04'
ARCH=armhf
SERIALCON=ttyS2
@@ -27,8 +27,8 @@ case $BRANCH in
edge)
- export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
- KERNELBRANCH='branch:linux-5.16.y'
+ export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:linux-5.17.y'
;;
diff --git a/config/sources/families/rockchip.conf b/config/sources/families/rockchip.conf
index 0f123a848..a264c669f 100644
--- a/config/sources/families/rockchip.conf
+++ b/config/sources/families/rockchip.conf
@@ -6,11 +6,9 @@ OVERLAY_PREFIX='rockchip'
UBOOT_TARGET_MAP=";;$SRC/packages/blobs/rockchip/rk3288_boot.bin u-boot-rockchip-with-spl.bin"
BOOTDELAY=1
if [[ $BOARD == miqi ]]; then
- BOOTBRANCH='tag:v2017.11'
-elif [[ $BOARD == xt-q8l-v10 ]]; then
- BOOTBRANCH='tag:v2021.01'
+BOOTBRANCH='tag:v2017.11'
else
- BOOTBRANCH='tag:v2022.01'
+BOOTBRANCH='tag:v2022.04'
fi
SERIALCON=ttyS2
@@ -35,8 +33,8 @@ case $BRANCH in
edge)
- export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
- KERNELBRANCH='branch:linux-5.16.y'
+ export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:linux-5.17.y'
;;
diff --git a/config/sources/families/sun50iw6.conf b/config/sources/families/sun50iw6.conf
index 3224dadb8..874e12e1f 100644
--- a/config/sources/families/sun50iw6.conf
+++ b/config/sources/families/sun50iw6.conf
@@ -12,27 +12,20 @@ case $BRANCH in
if [[ ${BOARD} == orangepi3-lts ]]; then
ASOUND_STATE='asound.state.sun50iw6-current'
-
+
fi
- ;;
+ ;;
edge)
if [[ ${BOARD} == orangepi3-lts ]]; then
ASOUND_STATE='asound.state.sun50iw6-current'
-
+
fi
- ;;
+ ;;
esac
-family_tweaks_s()
-{
- if [[ -f $SDCARD/lib/systemd/system/aw859a-bluetooth.service ]]; then
-
- # install and enable Bluetooth
- chroot $SDCARD /bin/bash -c "apt-get -y -qq install rfkill bluetooth bluez bluez-tools >/dev/null 2>&1"
- chroot $SDCARD /bin/bash -c "systemctl --no-reload enable aw859a-bluetooth.service >/dev/null 2>&1"
- fi
+family_tweaks_s() {
if [[ $BUILD_DESKTOP == yes && $BOARD == orangepi3-lts ]]; then
@@ -41,15 +34,5 @@ family_tweaks_s()
echo "load-module module-alsa-sink device=hw:1,0 sink_name=HDMI-Playback sink_properties=\"device.description='HDMI Audio'\"" >> ${SDCARD}/etc/pulse/default.pa
fi
-}
-
-family_tweaks_bsp()
-{
- if [[ ${BOARD} == orangepi3-lts ]]; then
-
- cp $SRC/packages/bsp/sunxi/aw859a-bluetooth.service $destination/lib/systemd/system/
-
- fi
- install -m 755 $SRC/packages/blobs/bt/hciattach/hciattach_opi_${ARCH} $destination/usr/bin/hciattach_opi
}
diff --git a/config/templates/Dockerfile b/config/templates/Dockerfile
index b9cfa9640..3666170d1 100644
--- a/config/templates/Dockerfile
+++ b/config/templates/Dockerfile
@@ -1,7 +1,7 @@
ARG BASE_IMAGE=ubuntu:jammy
FROM $BASE_IMAGE as armbian_builder
-ARG ARM_GCC_COMPILER='g++-11-arm-linux-gnueabihf'
-ENV ARM_GCC_COMPILER $ARM_GCC_COMPILER
+ARG CUSTOM_PACKAGES='g++-11-arm-linux-gnueabihf libssl3'
+ENV CUSTOM_PACKAGES $CUSTOM_PACKAGES
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get -y dist-upgrade && apt-get -y install \
joe \
@@ -23,7 +23,7 @@ RUN sh -c " \
RUN apt-get update \
&& apt-get -y dist-upgrade \
&& apt-get install -y --no-install-recommends \
- $ARM_GCC_COMPILER \
+ $CUSTOM_PACKAGES \
acl \
aptly \
aria2 \
@@ -73,7 +73,6 @@ RUN apt-get update \
libpython2.7-dev \
libpython3-dev \
libssl-dev \
- libssl1.1 \
libusb-1.0-0-dev \
linux-base \
libmpc-dev \
diff --git a/lib/functions/compilation/patch/kernel-drivers.sh b/lib/functions/compilation/patch/kernel-drivers.sh
index f921591a7..25f78b90c 100644
--- a/lib/functions/compilation/patch/kernel-drivers.sh
+++ b/lib/functions/compilation/patch/kernel-drivers.sh
@@ -31,7 +31,7 @@ function prepare_extra_kernel_drivers() {
#
# Older versions have AUFS support with a patch
- if linux-version compare "${version}" ge 5.1 && linux-version compare "${version}" le 5.17 && [ "$AUFS" == yes ]; then
+ if linux-version compare "${version}" ge 5.1 && linux-version compare "${version}" le 5.18 && [ "$AUFS" == yes ]; then
# @TODO: Fasthash for this whole block is only the git hash of revision we'd apply from Mr. Okajima
local aufs_tag # attach to specifics tag or branch
aufs_tag=$(echo "${version}" | cut -f 1-2 -d ".")
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index c1a2b03e6..44a23bb66 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -225,12 +225,6 @@ function do_main_configuration() {
interactive_desktop_main_configuration
- # dropbear needs to be configured differently # @TODO: rpardini: yes, and? are you a lost leftover comment from a previous era?
- [[ $CRYPTROOT_ENABLE == yes && $RELEASE == xenial ]] && exit_with_error "Encrypted rootfs is not supported in Xenial"
- [[ $RELEASE == stretch && $CAN_BUILD_STRETCH != yes ]] && exit_with_error "Building Debian Stretch images with selected kernel is not supported"
- [[ $RELEASE == bionic && $CAN_BUILD_STRETCH != yes ]] && exit_with_error "Building Ubuntu Bionic images with selected kernel is not supported"
- [[ $RELEASE == hirsute && $HOSTRELEASE == focal ]] && exit_with_error "Building Ubuntu Hirsute images requires Hirsute build host. Please upgrade your host or select a different target OS"
-
[[ -n $ATFSOURCE && -z $ATF_USE_GCC ]] && exit_with_error "Error in configuration: ATF_USE_GCC is unset"
[[ -z $UBOOT_USE_GCC ]] && exit_with_error "Error in configuration: UBOOT_USE_GCC is unset"
[[ -z $KERNEL_USE_GCC ]] && exit_with_error "Error in configuration: KERNEL_USE_GCC is unset"
@@ -242,7 +236,7 @@ function do_main_configuration() {
[[ -z $ATFPATCHDIR ]] && ATFPATCHDIR="atf-$LINUXFAMILY"
[[ -z $KERNELPATCHDIR ]] && KERNELPATCHDIR="$LINUXFAMILY-$BRANCH"
- if [[ "$RELEASE" =~ ^(xenial|bionic|focal|hirsute|impish|jammy)$ ]]; then
+ if [[ "$RELEASE" =~ ^(focal|jammy)$ ]]; then
DISTRIBUTION="Ubuntu"
else
DISTRIBUTION="Debian"
@@ -346,6 +340,9 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
done
fi
+ # Control aria2c's usage of ipv6.
+ [[ -z $DISABLE_IPV6 ]] && DISABLE_IPV6="true"
+
# For (late) user override.
# Notice: it is too late to define hook functions or add extensions in lib.config, since the extension initialization already ran by now.
# in case the user tries to use them in lib.config, hopefully they'll be detected as "wishful hooking" and the user will be wrn'ed.
diff --git a/lib/functions/extras/buildpkg.sh b/lib/functions/extras/buildpkg.sh
index af92f1b84..09dd5d2e6 100644
--- a/lib/functions/extras/buildpkg.sh
+++ b/lib/functions/extras/buildpkg.sh
@@ -28,25 +28,19 @@ create_chroot() {
qemu_binary['arm64']='qemu-aarch64-static'
apt_mirror['buster']="$DEBIAN_MIRROR"
apt_mirror['bullseye']="$DEBIAN_MIRROR"
- apt_mirror['bionic']="$UBUNTU_MIRROR"
apt_mirror['focal']="$UBUNTU_MIRROR"
- apt_mirror['hirsute']="$UBUNTU_MIRROR"
- apt_mirror['impish']="$UBUNTU_MIRROR"
apt_mirror['jammy']="$UBUNTU_MIRROR"
components['buster']='main,contrib'
components['bullseye']='main,contrib'
components['sid']='main,contrib'
- components['bionic']='main,universe,multiverse'
components['focal']='main,universe,multiverse'
- components['hirsute']='main,universe,multiverse'
- components['impish']='main,universe,multiverse'
components['jammy']='main,universe,multiverse'
display_alert "Creating build chroot" "$release/$arch" "info"
local includes="ccache,locales,git,ca-certificates,devscripts,libfile-fcntllock-perl,debhelper,rsync,python3,distcc,apt-utils"
# perhaps a temporally workaround
case $release in
- buster | bullseye | focal | hirsute | sid)
+ bullseye | focal | jammy | sid)
includes=${includes}",perl-openssl-defaults,libnet-ssleay-perl"
;;
esac
@@ -128,6 +122,7 @@ chroot_prepare_distccd() {
gcc_version['focal']='9.2'
gcc_version['hirsute']='10.2'
gcc_version['sid']='10.2'
+ gcc_version['jammy']='12'
gcc_type['armhf']='arm-linux-gnueabihf-'
gcc_type['arm64']='aarch64-linux-gnu-'
rm -f "${dest}"/cmdlist
@@ -161,8 +156,8 @@ chroot_build_packages() {
target_arch="${ARCH}"
else
# only make packages for recent releases. There are no changes on older
- target_release="bionic buster bullseye focal hirsute jammy sid"
- target_arch="armhf arm64"
+ target_release="bullseye focal jammy sid"
+ target_arch="armhf arm64 amd64"
fi
for release in $target_release; do
diff --git a/lib/functions/general/downloads.sh b/lib/functions/general/downloads.sh
index 1ff476a74..e3df91fe8 100644
--- a/lib/functions/general/downloads.sh
+++ b/lib/functions/general/downloads.sh
@@ -28,6 +28,7 @@ function download_and_verify_internal() {
local filename=$2
local localdir=$SRC/cache/${remotedir//_/}
local dirname=${filename//.tar.xz/}
+ [[ -z $DISABLE_IPV6 ]] && DISABLE_IPV6="true"
local server=${ARMBIAN_MIRROR}
if [[ $DOWNLOAD_MIRROR == china ]]; then
@@ -73,7 +74,7 @@ function download_and_verify_internal() {
else
# download control file
local torrent=${server}$remotedir/${filename}.torrent
- run_host_command_logged aria2c --download-result=hide --disable-ipv6=true --summary-interval=0 --console-log-level=error --auto-file-renaming=false \
+ run_host_command_logged aria2c --download-result=hide --disable-ipv6=${DISABLE_IPV6} --summary-interval=0 --console-log-level=error --auto-file-renaming=false \
--continue=false --allow-overwrite=true --dir="${localdir}" ${server}${remotedir}/${filename}.asc $(webseed "$remotedir/${filename}.asc") -o "${filename}.asc"
[[ $? -ne 0 ]] && display_alert "Failed to download control file" "" "wrn"
fi
@@ -84,7 +85,7 @@ function download_and_verify_internal() {
local ariatorrent="--summary-interval=0 --auto-save-interval=0 --seed-time=0 --bt-stop-timeout=120 --console-log-level=error \
--allow-overwrite=true --download-result=hide --rpc-save-upload-metadata=false --auto-file-renaming=false \
--file-allocation=trunc --continue=true ${torrent} \
- --dht-file-path=${SRC}/cache/.aria2/dht.dat --disable-ipv6=true --stderr --follow-torrent=mem --dir=$localdir"
+ --dht-file-path=${SRC}/cache/.aria2/dht.dat --disable-ipv6=${DISABLE_IPV6} --stderr --follow-torrent=mem --dir=$localdir"
# exception. It throws error if dht.dat file does not exists. Error suppress needed only at first download.
if [[ -f "${SRC}"/cache/.aria2/dht.dat ]]; then
@@ -103,7 +104,7 @@ function download_and_verify_internal() {
if [[ ! $(timeout 10 curl --head --fail --silent ${server}${remotedir}/${filename} 2>&1 > /dev/null) ]]; then
display_alert "downloading from $(echo $server | cut -d'/' -f3 | cut -d':' -f1) using http(s) network" "$filename"
run_host_command_logged aria2c --download-result=hide --rpc-save-upload-metadata=false --console-log-level=error \
- --dht-file-path="${SRC}"/cache/.aria2/dht.dat --disable-ipv6=true --summary-interval=0 --auto-file-renaming=false --dir="${localdir}" ${server}${remotedir}/${filename} $(webseed "${remotedir}/${filename}") -o "${filename}"
+ --dht-file-path="${SRC}"/cache/.aria2/dht.dat --disable-ipv6=${DISABLE_IPV6} --summary-interval=0 --auto-file-renaming=false --dir="${localdir}" ${server}${remotedir}/${filename} $(webseed "${remotedir}/${filename}") -o "${filename}"
# mark complete
[[ $? -eq 0 ]] && touch "${localdir}/${filename}.complete" && echo ""
diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh
index 05b1492bc..76c26a22c 100644
--- a/lib/functions/image/partitioning.sh
+++ b/lib/functions/image/partitioning.sh
@@ -32,10 +32,8 @@ prepare_partitions() {
# add -N number of inodes to keep mount from running out
# create bigger number for desktop builds
if [[ $BUILD_DESKTOP == yes ]]; then local node_number=4096; else local node_number=1024; fi
- if [[ $HOSTRELEASE =~ bionic|buster|bullseye|cosmic|focal|hirsute|impish|jammy|sid ]]; then
- mkopts[ext4]="-q -m 2 -O ^64bit,^metadata_csum -N $((128 * ${node_number}))"
- elif [[ $HOSTRELEASE == xenial ]]; then
- mkopts[ext4]="-q -m 2 -N $((128 * ${node_number}))"
+ if [[ $HOSTRELEASE =~ buster|bullseye|focal|jammy|sid ]]; then
+ mkopts[ext4]="-q -m 2 -O ^64bit,^metadata_csum -N $((128 * node_number))"
fi
mkopts[fat]='-n BOOT'
mkopts[ext2]='-q'
diff --git a/lib/functions/rootfs/distro-specific.sh b/lib/functions/rootfs/distro-specific.sh
index 7c1676f40..3a0b1ec44 100644
--- a/lib/functions/rootfs/distro-specific.sh
+++ b/lib/functions/rootfs/distro-specific.sh
@@ -2,19 +2,7 @@ install_distribution_specific() {
display_alert "Applying distribution specific tweaks for" "$RELEASE" "info"
case $RELEASE in
- xenial)
- # remove legal info from Ubuntu
- [[ -f "${SDCARD}"/etc/legal ]] && rm "${SDCARD}"/etc/legal
-
- # ureadahead needs kernel tracing options that AFAIK are present only in mainline. disable
- chroot "${SDCARD}" /bin/bash -c \
- "systemctl --no-reload mask ondemand.service ureadahead.service >/dev/null 2>&1"
- chroot "${SDCARD}" /bin/bash -c \
- "systemctl --no-reload mask setserial.service etc-setserial.service >/dev/null 2>&1"
-
- ;;
-
- stretch | buster | sid)
+ buster | sid)
# remove doubled uname from motd
[[ -f "${SDCARD}"/etc/update-motd.d/10-uname ]] && rm "${SDCARD}"/etc/update-motd.d/10-uname
# rc.local is not existing but one might need it
@@ -31,7 +19,7 @@ install_distribution_specific() {
[[ $(grep -L "VERSION=" "${SDCARD}"/etc/os-release) ]] && echo 'VERSION="11 (bullseye)"' >> "${SDCARD}"/etc/os-release
;;
- bionic | focal | hirsute | impish | jammy)
+ focal | jammy)
# by using default lz4 initrd compression leads to corruption, go back to proven method
sed -i "s/^COMPRESS=.*/COMPRESS=gzip/" "${SDCARD}"/etc/initramfs-tools/initramfs.conf
@@ -89,7 +77,7 @@ install_distribution_specific() {
# create_sources_list <release> <basedir>
#
-# <release>: buster|bullseye|bionic|focal|hirsute|impish|jammy|sid
+# <release>: bullseye|focal|jammy|sid
# <basedir>: path to root directory
#
create_sources_list() {
@@ -98,7 +86,7 @@ create_sources_list() {
[[ -z $basedir ]] && exit_with_error "No basedir passed to create_sources_list"
case $release in
- stretch | buster)
+ buster)
cat <<- EOF > "${basedir}"/etc/apt/sources.list
deb http://${DEBIAN_MIRROR} $release main contrib non-free
#deb-src http://${DEBIAN_MIRROR} $release main contrib non-free
@@ -137,7 +125,7 @@ create_sources_list() {
EOF
;;
- xenial | bionic | focal | hirsute | impish | jammy)
+ focal | jammy)
cat <<- EOF > "${basedir}"/etc/apt/sources.list
deb http://${UBUNTU_MIRROR} $release main restricted universe multiverse
#deb-src http://${UBUNTU_MIRROR} $release main restricted universe multiverse
From 71addbe3ffd4e9e8015125186d11fc53eac1da25 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 7 Apr 2022 15:56:19 +0200
Subject: [PATCH] armbian-next: fix logging for apt sources/gpg keys
---
lib/functions/rootfs/rootfs-desktop.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/functions/rootfs/rootfs-desktop.sh b/lib/functions/rootfs/rootfs-desktop.sh
index f8c4a12a2..208119d4b 100644
--- a/lib/functions/rootfs/rootfs-desktop.sh
+++ b/lib/functions/rootfs/rootfs-desktop.sh
@@ -38,7 +38,7 @@ add_apt_sources() {
local apt_source_gpg_filename="$(basename ${apt_source_gpg_filepath})"
local apt_source_filename="$(basename ${apt_source_filepath}).list"
- display_alert "Adding APT Source ${new_apt_source}"
+ display_alert "Adding APT Source" "${new_apt_source}" "info"
if [[ "${new_apt_source}" == ppa* ]]; then
chroot_sdcard "add-apt-repository -y -n \"${new_apt_source}\""
@@ -55,7 +55,7 @@ add_apt_sources() {
# installation without software-common-properties, sources.list + key.gpg
echo "${new_apt_source}" > "${SDCARD}/etc/apt/sources.list.d/${apt_source_filename}"
if [[ -f "${apt_source_gpg_filepath}" ]]; then
- display_alert "Adding GPG Key ${apt_source_gpg_filepath}"
+ display_alert "Adding GPG Key" "${apt_source_gpg_filepath}" "info"
# local apt_source_gpg_filename="$(basename ${apt_source_gpg_filepath})"
mkdir -p "${SDCARD}"/usr/share/keyrings/
cp "${apt_source_gpg_filepath}" "${SDCARD}"/usr/share/keyrings/
From 7ca67f8d2669568a654d0fcf11415b24434cfd0b Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 7 Apr 2022 13:54:59 +0200
Subject: [PATCH] armbian-next: don't leak `if_error_xxx` vars across runner
helper invocations; always clean then (even if no error)
- also: fix wireguard-tools install, had a double parameter there
---
lib/functions/logging/runners.sh | 11 +++++++++--
lib/functions/rootfs/distro-agnostic.sh | 2 +-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index 61a9acc3f..e550eba11 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -158,9 +158,18 @@ function run_host_command_logged_raw() {
elif [[ -f "${CURRENT_LOGFILE}" ]]; then
echo "-->--> command run successfully after $((SECONDS - seconds_start)) seconds" >> "${CURRENT_LOGFILE}"
fi
+
+ logging_clear_run_command_error_info # clear the error info vars, always, otherwise they'll leak into the next invocation.
+
return ${exit_code} # exiting with the same error code as the original error
}
+function logging_clear_run_command_error_info() {
+ # Unset those globals; they're only valid for the first invocation of a runner helper function after they're set.
+ unset if_error_detail_message
+ unset if_error_find_files_sdcard # remember, this is global.
+}
+
function logging_enrich_run_command_error_info() {
declare -a found_files=()
@@ -171,7 +180,6 @@ function logging_enrich_run_command_error_info() {
display_alert "Found if_error_find_files_sdcard files" "${sdcard_files[@]}" "debug"
found_files+=("${sdcard_files[@]}") # add to result
done
- unset if_error_find_files_sdcard # remember, this is global.
display_alert "Error-related files found" "${found_files[*]}" "debug"
for found_file in "${found_files[@]}"; do
@@ -187,7 +195,6 @@ function logging_enrich_run_command_error_info() {
### if_error_detail_message, array: messages to display if the command failed.
if [[ -n ${if_error_detail_message} ]]; then
display_alert "Error context msg" "${if_error_detail_message}" "err"
- unset if_error_detail_message
fi
}
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index ed65ec5ac..238bdb9d0 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -392,7 +392,7 @@ function install_distribution_agnostic() {
# install wireguard tools
if [[ $WIREGUARD == yes ]]; then
- install_deb_chroot "wireguard-tools --no-install-recommends" "remote"
+ install_deb_chroot "wireguard-tools" "remote"
fi
# freeze armbian packages
From a057b793478fde9b1e0015d52b711c0442d91789 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 7 Apr 2022 13:53:58 +0200
Subject: [PATCH] bcm2711: rpi4b: add `pi-bluetooth` which provides working
Bluetooth
---
config/sources/families/bcm2711.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/sources/families/bcm2711.conf b/config/sources/families/bcm2711.conf
index 12ba2caae..a6bee376e 100644
--- a/config/sources/families/bcm2711.conf
+++ b/config/sources/families/bcm2711.conf
@@ -65,7 +65,7 @@ extension_prepare_config__prepare_rpi_flash_kernel() {
local usable_releases="focal|hirsute|impish|jammy"
if [[ "$RELEASE" =~ ^(${usable_releases})$ ]]; then
- export FK__EXTRA_PACKAGES="rpi-eeprom linux-firmware linux-firmware-raspi2 libraspberrypi-bin cloud-initramfs-growroot"
+ export FK__EXTRA_PACKAGES="rpi-eeprom linux-firmware linux-firmware-raspi2 pi-bluetooth libraspberrypi-bin cloud-initramfs-growroot"
if [[ "$RELEASE" =~ ^(hirsute|impish|jammy)$ ]]; then # Add raspi-config for those releases that have it; it might be useful.
export FK__EXTRA_PACKAGES="${FK__EXTRA_PACKAGES} raspi-config"
From b0d907082d89474a04a790919fad6e27043bc474 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 7 Apr 2022 12:06:26 +0200
Subject: [PATCH] armbian-next: fixes for (non-)logging when interactively
configuring kernel (`KERNEL_CONFIGURE=yes`)
---
lib/functions/compilation/kernel.sh | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 66d512de5..118bdd752 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -60,7 +60,14 @@ function compile_kernel() {
[[ $CREATE_PATCHES == yes ]] && userpatch_create "kernel" # create patch for manual source changes
local version
local toolchain
- LOG_SECTION="kernel_config" do_with_logging do_with_hooks kernel_config
+
+ # Check if we're gonna do some interactive configuration; if so, don't run kernel_config under logging manager.
+ if [[ $KERNEL_CONFIGURE != yes ]]; then
+ LOG_SECTION="kernel_config" do_with_logging do_with_hooks kernel_config
+ else
+ LOG_SECTION="kernel_config_interactive" do_with_hooks kernel_config
+ fi
+
LOG_SECTION="kernel_package_source" do_with_logging do_with_hooks kernel_package_source
# @TODO: might be interesting to package kernel-headers at this stage.
@@ -240,28 +247,30 @@ function kernel_config() {
if [[ $KERNEL_CONFIGURE != yes ]]; then
run_kernel_make olddefconfig # @TODO: what is this? does it fuck up dates?
else
- display_alert "Starting kernel oldconfig+menuconfig" "${LINUXCONFIG}" "debug"
+ display_alert "Starting (interactive) kernel oldconfig" "${LINUXCONFIG}" "debug"
- run_kernel_make oldconfig
+ run_kernel_make_dialog oldconfig
# No logging for this. this is UI piece
+ display_alert "Starting (interactive) kernel ${KERNEL_MENUCONFIG:-menuconfig}" "${LINUXCONFIG}" "debug"
run_kernel_make_dialog "${KERNEL_MENUCONFIG:-menuconfig}"
# Capture new date. Otherwise changes not detected by make.
kernel_config_mtime=$(get_file_modification_time ".config")
# store kernel config in easily reachable place
+ mkdir -p "${DEST}"/config
display_alert "Exporting new kernel config" "$DEST/config/$LINUXCONFIG.config" "info"
- cp .config "${DEST}/config/${LINUXCONFIG}.config"
+ run_host_command_logged cp -pv .config "${DEST}/config/${LINUXCONFIG}.config"
# store back into original LINUXCONFIG too, if it came from there, so it's pending commits when done.
- [[ "${COPY_CONFIG_BACK_TO}" != "" ]] && cp -v .config "${COPY_CONFIG_BACK_TO}"
+ [[ "${COPY_CONFIG_BACK_TO}" != "" ]] && run_host_command_logged cp -pv .config "${COPY_CONFIG_BACK_TO}"
# export defconfig too if requested
if [[ $KERNEL_EXPORT_DEFCONFIG == yes ]]; then
run_kernel_make savedefconfig
- [[ -f defconfig ]] && cp defconfig "${DEST}/config/${LINUXCONFIG}.defconfig"
+ [[ -f defconfig ]] && run_host_command_logged cp -pv defconfig "${DEST}/config/${LINUXCONFIG}.defconfig"
fi
fi
From e10cb5c51bd77b47ee06ac7c9aaaaa4485646f61 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 3 Apr 2022 11:28:18 +0200
Subject: [PATCH] armbian-next: move `lz4` rootfs caches to `zstd`,
multithreaded
---
lib/functions/rootfs/create-cache.sh | 37 +++++++++++++++++++++---------------
1 file changed, 22 insertions(+), 15 deletions(-)
diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh
index e16d8613f..5e57eabc5 100644
--- a/lib/functions/rootfs/create-cache.sh
+++ b/lib/functions/rootfs/create-cache.sh
@@ -7,22 +7,25 @@ get_or_create_rootfs_cache_chroot_sdcard() {
fi
# seek last cache, proceed to previous otherwise build it
- for ((n = 0; n < ${cycles}; n++)); do
+ for ((n = 0; n < cycles; n++)); do
[[ -z ${FORCED_MONTH_OFFSET} ]] && FORCED_MONTH_OFFSET=${n}
- local packages_hash=$(get_package_list_hash "$(date -d "$D +${FORCED_MONTH_OFFSET} month" +"%Y-%m-module$ROOTFSCACHE_VERSION" | sed 's/^0*//')")
+ local packages_hash
+ packages_hash=$(get_package_list_hash "$(date -d "$D +${FORCED_MONTH_OFFSET} month" +"%Y-%m-module$ROOTFSCACHE_VERSION" | sed 's/^0*//')")
+
local cache_type="cli"
- [[ ${BUILD_DESKTOP} == yes ]] && local cache_type="xfce-desktop"
- [[ -n ${DESKTOP_ENVIRONMENT} ]] && local cache_type="${DESKTOP_ENVIRONMENT}"
- [[ ${BUILD_MINIMAL} == yes ]] && local cache_type="minimal"
- local cache_name=${RELEASE}-${cache_type}-${ARCH}.$packages_hash.tar.lz4
+ [[ ${BUILD_DESKTOP} == yes ]] && cache_type="xfce-desktop"
+ [[ -n ${DESKTOP_ENVIRONMENT} ]] && cache_type="${DESKTOP_ENVIRONMENT}"
+ [[ ${BUILD_MINIMAL} == yes ]] && cache_type="minimal"
+
+ local cache_name=${RELEASE}-${cache_type}-${ARCH}.${packages_hash}.tar.zst
local cache_fname=${SRC}/cache/rootfs/${cache_name}
- local display_name=${RELEASE}-${cache_type}-${ARCH}.${packages_hash:0:3}...${packages_hash:29}.tar.lz4
+ local display_name=${RELEASE}-${cache_type}-${ARCH}.${packages_hash:0:3}...${packages_hash:29}.tar.zst
[[ "$ROOT_FS_CREATE_ONLY" == force ]] && break
if [[ -f ${cache_fname} && -f ${cache_fname}.aria2 ]]; then
- rm ${cache_fname}*
+ rm "${cache_fname}"*
display_alert "Partially downloaded file. Re-start."
download_and_verify "_rootfs" "$cache_name"
fi
@@ -30,10 +33,14 @@ get_or_create_rootfs_cache_chroot_sdcard() {
display_alert "Checking local cache" "$display_name" "info"
if [[ -f ${cache_fname} && -n "$ROOT_FS_CREATE_ONLY" ]]; then
- touch $cache_fname.current
+ touch "${cache_fname}.current"
display_alert "Checking cache integrity" "$display_name" "info"
- sudo lz4 -tqq ${cache_fname}
- [[ $? -ne 0 ]] && rm $cache_fname && exit_with_error "Cache $cache_fname is corrupted and was deleted. Please restart!"
+
+ sudo zstd -tqq "${cache_fname}" || {
+ rm -f "${cache_fname}"
+ exit_with_error "Cache ${cache_fname} is corrupted and was deleted. Please restart!"
+ }
+
# sign if signature is missing
if [[ -n "${GPG_PASS}" && "${SUDO_USER}" && ! -f ${cache_fname}.asc ]]; then
[[ -n ${SUDO_USER} ]] && sudo chown -R ${SUDO_USER}:${SUDO_USER} "${DEST}"/images/
@@ -67,7 +74,7 @@ get_or_create_rootfs_cache_chroot_sdcard() {
local date_diff=$((($(date +%s) - $(stat -c %Y $cache_fname)) / 86400))
display_alert "Extracting $display_name" "$date_diff days old" "info"
- pv -p -b -r -c -N "$(logging_echo_prefix_for_pv "extract_rootfs") $display_name" "$cache_fname" | lz4 -dc | tar xp --xattrs -C $SDCARD/
+ pv -p -b -r -c -N "$(logging_echo_prefix_for_pv "extract_rootfs") $display_name" "$cache_fname" | zstdmt -dc | tar xp --xattrs -C $SDCARD/
[[ $? -ne 0 ]] && rm $cache_fname && exit_with_error "Cache $cache_fname is corrupted and was deleted. Restart."
rm $SDCARD/etc/resolv.conf
echo "nameserver $NAMESERVER" >> $SDCARD/etc/resolv.conf
@@ -78,7 +85,7 @@ get_or_create_rootfs_cache_chroot_sdcard() {
create_new_rootfs_cache
# needed for backend to keep current only
- touch $cache_fname.current
+ touch "${cache_fname}.current"
fi
@@ -91,7 +98,7 @@ get_or_create_rootfs_cache_chroot_sdcard() {
exit
fi
- mount_chroot "$SDCARD"
+ mount_chroot "${SDCARD}"
}
function create_new_rootfs_cache() {
@@ -248,7 +255,7 @@ function create_new_rootfs_cache() {
umount_chroot "$SDCARD"
tar cp --xattrs --directory=$SDCARD/ --exclude='./dev/*' --exclude='./proc/*' --exclude='./run/*' --exclude='./tmp/*' \
- --exclude='./sys/*' --exclude='./home/*' --exclude='./root/*' . | pv -p -b -r -s "$(du -sb $SDCARD/ | cut -f1)" -N "$(logging_echo_prefix_for_pv "store_rootfs") $display_name" | lz4 -5 -c > "$cache_fname"
+ --exclude='./sys/*' --exclude='./home/*' --exclude='./root/*' . | pv -p -b -r -s "$(du -sb $SDCARD/ | cut -f1)" -N "$(logging_echo_prefix_for_pv "store_rootfs") $display_name" | zstdmt -5 -c > "${cache_fname}"
# sign rootfs cache archive that it can be used for web cache once. Internal purposes
if [[ -n "${GPG_PASS}" && "${SUDO_USER}" ]]; then
From 1b602cf8ebae2179b8590126751ce801c976cdfb Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 3 Apr 2022 11:25:50 +0200
Subject: [PATCH] armbian-next: customize.sh: error handling, do not mount
overlay if it doesn't exist
---
lib/functions/rootfs/customize.sh | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/functions/rootfs/customize.sh b/lib/functions/rootfs/customize.sh
index 5405b814f..f517e46cb 100644
--- a/lib/functions/rootfs/customize.sh
+++ b/lib/functions/rootfs/customize.sh
@@ -12,12 +12,17 @@ customize_image() {
cp "$USERPATCHES_PATH"/customize-image.sh "${SDCARD}"/tmp/customize-image.sh
chmod +x "${SDCARD}"/tmp/customize-image.sh
mkdir -p "${SDCARD}"/tmp/overlay
+
# util-linux >= 2.27 required
- mount -o bind,ro "$USERPATCHES_PATH"/overlay "${SDCARD}"/tmp/overlay
+ [[ -d "${USERPATCHES_PATH}"/overlay ]] && mount -o bind,ro "${USERPATCHES_PATH}"/overlay "${SDCARD}"/tmp/overlay
display_alert "Calling image customization script" "customize-image.sh" "info"
- chroot "${SDCARD}" /bin/bash -c "/tmp/customize-image.sh $RELEASE $LINUXFAMILY $BOARD $BUILD_DESKTOP $ARCH"
+
+ set +e # disable error control
+ chroot_sdcard /tmp/customize-image.sh "${RELEASE}" "$LINUXFAMILY" "$BOARD" "$BUILD_DESKTOP" "$ARCH"
CUSTOMIZE_IMAGE_RC=$?
- umount -i "${SDCARD}"/tmp/overlay > /dev/null 2>&1
+ set -e # back to normal error control
+
+ mountpoint -q "${SDCARD}"/tmp/overlay && umount "${SDCARD}"/tmp/overlay
mountpoint -q "${SDCARD}"/tmp/overlay || rm -r "${SDCARD}"/tmp/overlay
if [[ $CUSTOMIZE_IMAGE_RC != 0 ]]; then
exit_with_error "customize-image.sh exited with error (rc: $CUSTOMIZE_IMAGE_RC)"
From 09a55387f126f1907945ee72060cdd42973a8d4b Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 2 Apr 2022 21:15:55 +0200
Subject: [PATCH] armbian-next: extra info for runners;
`if_error_detail_message` and `if_error_find_files_sdcard` globals
- those are unset after running any command
- if error occur, message and/or found files will be included in log, for clarity
---
extensions/nvidia.sh | 1 +
lib/functions/compilation/uboot.sh | 4 ++--
lib/functions/logging/logging.sh | 3 ++-
lib/functions/logging/runners.sh | 38 ++++++++++++++++++++++++++++++++++--
lib/functions/rootfs/apt.sh | 2 +-
lib/functions/rootfs/create-cache.sh | 6 +++---
6 files changed, 45 insertions(+), 9 deletions(-)
diff --git a/extensions/nvidia.sh b/extensions/nvidia.sh
index e329a7458..57e478c5c 100644
--- a/extensions/nvidia.sh
+++ b/extensions/nvidia.sh
@@ -9,5 +9,6 @@ function post_install_kernel_debs__build_nvidia_kernel_module() {
# chroot_sdcard_apt_get_install() is in lib/logging/runners.sh which handles "running" of stuff nicely.
# chroot_sdcard_apt_get_install() -> chroot_sdcard_apt_get() -> chroot_sdcard() -> run_host_command_logged_raw()
# it handles bash-specific quoting issues, apt proxies, logging, and errors.
+ declare -agx if_error_find_files_sdcard=("/var/lib/dkms/nvidia/*/build/make.log")
chroot_sdcard_apt_get_install "nvidia-dkms-${NVIDIA_DRIVER_VERSION}" "nvidia-driver-${NVIDIA_DRIVER_VERSION}" nvidia-settings
}
diff --git a/lib/functions/compilation/uboot.sh b/lib/functions/compilation/uboot.sh
index f6f8279ea..fd3ae385a 100644
--- a/lib/functions/compilation/uboot.sh
+++ b/lib/functions/compilation/uboot.sh
@@ -36,7 +36,7 @@ function compile_uboot_target() {
fi
display_alert "${uboot_prefix}Preparing u-boot config" "${version} ${target_make}" "info"
- export MSG_IF_ERROR="${uboot_prefix}Failed to configure u-boot ${version} $BOOTCONFIG ${target_make}"
+ export if_error_detail_message="${uboot_prefix}Failed to configure u-boot ${version} $BOOTCONFIG ${target_make}"
run_host_command_logged CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${toolchain2}:${PATH}" \
make "$CTHREADS" "$BOOTCONFIG" "CROSS_COMPILE=\"$CCACHE $UBOOT_COMPILER\"" "KCFLAGS=-fdiagnostics-color=always"
@@ -71,7 +71,7 @@ function compile_uboot_target() {
[[ -n $UBOOT_TOOLCHAIN2 ]] && cross_compile="ARMBIAN=foe" # empty parameter is not allowed
display_alert "${uboot_prefix}Compiling u-boot" "${version} ${target_make}" "info"
- export MSG_IF_ERROR="${uboot_prefix}Failed to build u-boot ${version} ${target_make}"
+ export if_error_detail_message="${uboot_prefix}Failed to build u-boot ${version} ${target_make}"
run_host_command_logged_long_running CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${toolchain2}:${PATH}" make "$target_make" "$CTHREADS" "${cross_compile}" "KCFLAGS=-fdiagnostics-color=always"
if [[ $(type -t uboot_custom_postprocess) == function ]]; then
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index 8e98b569a..66bcda39e 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -277,7 +277,6 @@ function logging_echo_prefix_for_pv() {
# Cleanup for logging.
function trap_handler_cleanup_logging() {
[[ ! -d "${LOGDIR}" ]] && return 0
- display_alert "Cleaning up logs from LOGDIR" "${LOGDIR}" "debug"
# Just delete LOGDIR if in CONFIG_DEFS_ONLY mode.
if [[ "${CONFIG_DEFS_ONLY}" == "yes" ]]; then
@@ -305,6 +304,8 @@ function trap_handler_cleanup_logging() {
done
fi
+ display_alert "Preparing HTML log from" "${LOGDIR}" "debug"
+
cat <<- HTML_HEADER > "${target_file}"
<html>
<head>
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index 1b07dc7a0..61a9acc3f 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -144,17 +144,51 @@ function run_host_command_logged_raw() {
exit_code=$?
set -e
- if [[ $exit_code != 0 ]]; then
+ if [[ ${exit_code} != 0 ]]; then
if [[ -f "${CURRENT_LOGFILE}" ]]; then
echo "-->--> command failed with error code ${exit_code} after $((SECONDS - seconds_start)) seconds" >> "${CURRENT_LOGFILE}"
fi
# This is very specific; remove CURRENT_LOGFILE's value when calling display_alert here otherwise logged twice.
CURRENT_LOGFILE="" display_alert "cmd exited with code ${exit_code}" "$*" "wrn"
CURRENT_LOGFILE="" display_alert "stacktrace for failed command" "$(show_caller_full)" "wrn"
+
+ # Obtain extra info about error, eg, log files produced, extra messages set by caller, etc.
+ logging_enrich_run_command_error_info
+
elif [[ -f "${CURRENT_LOGFILE}" ]]; then
echo "-->--> command run successfully after $((SECONDS - seconds_start)) seconds" >> "${CURRENT_LOGFILE}"
fi
- return $exit_code
+ return ${exit_code} # exiting with the same error code as the original error
+}
+
+function logging_enrich_run_command_error_info() {
+ declare -a found_files=()
+
+ for path in "${if_error_find_files_sdcard[@]}"; do
+ declare -a sdcard_files
+ # shellcheck disable=SC2086 # I wanna expand, thank you...
+ mapfile -t sdcard_files < <(find ${SDCARD}/${path} -type f)
+ display_alert "Found if_error_find_files_sdcard files" "${sdcard_files[@]}" "debug"
+ found_files+=("${sdcard_files[@]}") # add to result
+ done
+ unset if_error_find_files_sdcard # remember, this is global.
+
+ display_alert "Error-related files found" "${found_files[*]}" "debug"
+ for found_file in "${found_files[@]}"; do
+ # Log to asset, so it's available in the HTML log
+ LOG_ASSET="chroot_error_context__$(basename "${found_file}")" do_with_log_asset cat "${found_file}"
+
+ display_alert "File contents for error context" "${found_file}" "err"
+ # shellcheck disable=SC2002 # cat is not useless, ccze _only_ takes stdin
+ cat "${found_file}" | ccze -A 1>&2 # to stderr
+ # @TODO: 3x repeated ccze invocation, lets refactor it later
+ done
+
+ ### if_error_detail_message, array: messages to display if the command failed.
+ if [[ -n ${if_error_detail_message} ]]; then
+ display_alert "Error context msg" "${if_error_detail_message}" "err"
+ unset if_error_detail_message
+ fi
}
# @TODO: logging: used by desktop.sh exclusively. let's unify?
diff --git a/lib/functions/rootfs/apt.sh b/lib/functions/rootfs/apt.sh
index 91f81ad95..e062d5284 100644
--- a/lib/functions/rootfs/apt.sh
+++ b/lib/functions/rootfs/apt.sh
@@ -29,7 +29,7 @@ install_deb_chroot() {
[[ $BUILD_ALL == yes && ${variant} == remote ]] && chroot_sdcard_apt_get update
# install in chroot via apt-get, not dpkg, so dependencies are also installed from repo if needed.
- export MSG_IF_ERROR="Installation of $name failed ${BOARD} ${RELEASE} ${BUILD_DESKTOP} ${LINUXFAMILY}"
+ export if_error_detail_message="Installation of $name failed ${BOARD} ${RELEASE} ${BUILD_DESKTOP} ${LINUXFAMILY}"
chroot_sdcard_apt_get --no-install-recommends install "${name}"
# @TODO: mysterious. store installed/downloaded packages in deb storage. only used for u-boot deb. why?
diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh
index c0fdeebaa..e16d8613f 100644
--- a/lib/functions/rootfs/create-cache.sh
+++ b/lib/functions/rootfs/create-cache.sh
@@ -124,7 +124,7 @@ function create_new_rootfs_cache() {
run_host_command_logged cp -pv /usr/share/keyrings/*-archive-keyring.gpg "${SDCARD}/usr/share/keyrings/"
display_alert "Installing base system" "Stage 2/2" "info"
- export MSG_IF_ERROR="Debootstrap second stage failed ${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL}"
+ export if_error_detail_message="Debootstrap second stage failed ${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL}"
chroot_sdcard LC_ALL=C LANG=C /debootstrap/debootstrap --second-stage
[[ ! -f "${SDCARD}/bin/bash" ]] && exit_with_error "Debootstrap first stage did not produce /bin/bash"
@@ -179,7 +179,7 @@ function create_new_rootfs_cache() {
# stage: install additional packages
display_alert "Installing the main packages for" "Armbian" "info"
- export MSG_IF_ERROR="Installation of Armbian main packages for ${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL} failed"
+ export if_error_detail_message="Installation of Armbian main packages for ${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL} failed"
# First, try to download-only up to 3 times, to work around network/proxy problems.
do_with_retries 3 chroot_sdcard_apt_get_install_download_only "$PACKAGE_MAIN_LIST"
@@ -199,11 +199,11 @@ function create_new_rootfs_cache() {
fi
display_alert "Installing the desktop packages for" "Armbian" "info"
- MSG_IF_ERROR="Installation of Armbian desktop packages for ${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL} failed"
# Retry download-only 3 times first.
do_with_retries 3 chroot_sdcard_apt_get_install_download_only ${apt_desktop_install_flags} $PACKAGE_LIST_DESKTOP
# Then do the actual install.
+ export if_error_detail_message="Installation of Armbian desktop packages for ${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL} failed"
chroot_sdcard_apt_get install ${apt_desktop_install_flags} $PACKAGE_LIST_DESKTOP
fi
From 4cbbde478c436b76c883d4ece3a74fc8d0aeb72d Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 2 Apr 2022 16:01:19 +0200
Subject: [PATCH] armbian-next: manual merge (15) of all changes between
revisions 0f7200c7932bb04a34601a25fe30dca0197fbc8b and
101eaec90750f23cae3075d6b5329a33b2bf4685
---
config/sources/families/rk35xx.conf | 4 ++--
lib/functions/configuration/main-config.sh | 2 +-
lib/functions/rootfs/create-cache.sh | 16 +++-------------
lib/functions/rootfs/rootfs-desktop.sh | 8 +++-----
4 files changed, 9 insertions(+), 21 deletions(-)
diff --git a/config/sources/families/rk35xx.conf b/config/sources/families/rk35xx.conf
index d0c5a293e..1a05d42d1 100644
--- a/config/sources/families/rk35xx.conf
+++ b/config/sources/families/rk35xx.conf
@@ -25,8 +25,8 @@ case $BRANCH in
# temporary until kernel 5.16 is well supported for rockchip64
# it has to be its own family too
edge)
- export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.16.y"
+ export KERNEL_MAJOR_MINOR="5.17" # Major and minor versions of this kernel.
+ KERNELBRANCH="branch:linux-5.17.y"
KERNELPATCHDIR='rk35xx-'$BRANCH
SKIP_BOOTSPLASH="yes"
LINUXFAMILY=rk35xx
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 57561089a..c1a2b03e6 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -32,7 +32,7 @@ function do_main_configuration() {
[[ -z $EXIT_PATCHING_ERROR ]] && EXIT_PATCHING_ERROR="" # exit patching if failed
[[ -z $HOST ]] && HOST="$BOARD" # set hostname to the board
cd "${SRC}" || exit
- [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=16
+ [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=17
[[ -z "${CHROOT_CACHE_VERSION}" ]] && CHROOT_CACHE_VERSION=7
BUILD_REPOSITORY_URL=$(git remote get-url "$(git remote 2> /dev/null | grep origin)" 2> /dev/null)
BUILD_REPOSITORY_COMMIT=$(git describe --match=d_e_a_d_b_e_e_f --always --dirty 2> /dev/null)
diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh
index 3dc4feaaf..c0fdeebaa 100644
--- a/lib/functions/rootfs/create-cache.sh
+++ b/lib/functions/rootfs/create-cache.sh
@@ -166,6 +166,9 @@ function create_new_rootfs_cache() {
# this should fix resolvconf installation failure in some cases
chroot_sdcard 'echo "resolvconf resolvconf/linkify-resolvconf boolean false" | debconf-set-selections'
+ # TODO change name of the function from "desktop" and move to appropriate location
+ add_desktop_package_sources
+
# stage: update packages list
display_alert "Updating package list" "$RELEASE" "info"
do_with_retries 3 chroot_sdcard_apt_get update
@@ -174,12 +177,6 @@ function create_new_rootfs_cache() {
display_alert "Upgrading base packages" "Armbian" "info"
do_with_retries 3 chroot_sdcard_apt_get upgrade
- # Myy: Dividing the desktop packages installation steps into multiple
- # ones. We first install the "ADDITIONAL_PACKAGES" in order to get
- # access to software-common-properties installation.
- # THEN we add the APT sources and install the Desktop packages.
- # TODO : Find a way to add APT sources WITHOUT software-common-properties
-
# stage: install additional packages
display_alert "Installing the main packages for" "Armbian" "info"
export MSG_IF_ERROR="Installation of Armbian main packages for ${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL} failed"
@@ -190,13 +187,6 @@ function create_new_rootfs_cache() {
chroot_sdcard_apt_get_install "$PACKAGE_MAIN_LIST"
if [[ $BUILD_DESKTOP == "yes" ]]; then
- # FIXME Myy : Are we keeping this only for Desktop users,
- # or should we extend this to CLI users too ?
- # There might be some clunky boards that require Debian packages from
- # specific repos...
- display_alert "Adding apt sources for Desktop packages"
- add_desktop_package_sources
-
local apt_desktop_install_flags=""
if [[ ! -z ${DESKTOP_APT_FLAGS_SELECTED+x} ]]; then
for flag in ${DESKTOP_APT_FLAGS_SELECTED}; do
diff --git a/lib/functions/rootfs/rootfs-desktop.sh b/lib/functions/rootfs/rootfs-desktop.sh
index 56b9cfc3d..f8c4a12a2 100644
--- a/lib/functions/rootfs/rootfs-desktop.sh
+++ b/lib/functions/rootfs/rootfs-desktop.sh
@@ -25,7 +25,7 @@ add_apt_sources() {
get_all_potential_paths "${DESKTOP_ENVIRONMENTS_SEARCH_RELATIVE_DIRS}" "." "sources/apt"
get_all_potential_paths "${DESKTOP_APPGROUPS_SEARCH_RELATIVE_DIRS}" "${DESKTOP_APPGROUPS_SELECTED}" "sources/apt"
- display_alert "ADDING ADDITIONAL APT SOURCES"
+ display_alert "Adding additional apt sources" "add_apt_sources()" "debug"
for apt_sources_dirpath in ${potential_paths}; do
if [[ -d "${apt_sources_dirpath}" ]]; then
@@ -41,11 +41,10 @@ add_apt_sources() {
display_alert "Adding APT Source ${new_apt_source}"
if [[ "${new_apt_source}" == ppa* ]]; then
-
+ chroot_sdcard "add-apt-repository -y -n \"${new_apt_source}\""
# add list with apt-add
# -y -> Assumes yes to all queries
# -n -> Do not update package cache after adding
- run_on_sdcard "add-apt-repository -y -n \"${new_apt_source}\""
if [[ -f "${apt_source_gpg_filepath}" ]]; then
display_alert "Adding GPG Key ${apt_source_gpg_filepath}"
cp "${apt_source_gpg_filepath}" "${SDCARD}/tmp/${apt_source_gpg_filename}"
@@ -53,7 +52,7 @@ add_apt_sources() {
echo "APT Key returned : $?"
fi
else
- # copy list if its not ppa
+ # installation without software-common-properties, sources.list + key.gpg
echo "${new_apt_source}" > "${SDCARD}/etc/apt/sources.list.d/${apt_source_filename}"
if [[ -f "${apt_source_gpg_filepath}" ]]; then
display_alert "Adding GPG Key ${apt_source_gpg_filepath}"
@@ -72,7 +71,6 @@ add_apt_sources() {
add_desktop_package_sources() {
add_apt_sources
- chroot_sdcard_apt_get "update"
run_host_command_logged ls -l "${SDCARD}/usr/share/keyrings"
run_host_command_logged ls -l "${SDCARD}/etc/apt/sources.list.d"
run_host_command_logged cat "${SDCARD}/etc/apt/sources.list"
From 0023bcce6aaed245b27c031156ba650acbafed3b Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 1 Apr 2022 12:27:19 +0200
Subject: [PATCH] armbian-next: better logging for `rsync` calls everywhere
- make rsync verbose
---
lib/functions/bsp/bsp-cli.sh | 4 ++--
lib/functions/compilation/debs.sh | 6 +++---
lib/functions/compilation/kernel.sh | 2 +-
lib/functions/compilation/uboot.sh | 2 +-
lib/functions/image/rootfs-to-image.sh | 14 ++++----------
lib/functions/rootfs/apt.sh | 2 +-
6 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/lib/functions/bsp/bsp-cli.sh b/lib/functions/bsp/bsp-cli.sh
index 5af25dd82..c52910403 100644
--- a/lib/functions/bsp/bsp-cli.sh
+++ b/lib/functions/bsp/bsp-cli.sh
@@ -252,7 +252,7 @@ create_board_package() {
#EOF
# copy common files from a premade directory structure
- rsync -a ${SRC}/packages/bsp/common/* ${destination}
+ run_host_command_logged rsync -av ${SRC}/packages/bsp/common/* ${destination}
# trigger uInitrd creation after installation, to apply
# /etc/initramfs/post-update.d/99-uboot
@@ -308,7 +308,7 @@ create_board_package() {
# create board DEB file
fakeroot_dpkg_deb_build "${destination}" "${destination}.deb"
mkdir -p "${DEB_STORAGE}/"
- rsync --remove-source-files -rq "${destination}.deb" "${DEB_STORAGE}/" 2>&1
+ run_host_command_logged rsync --remove-source-files -r "${destination}.deb" "${DEB_STORAGE}/"
display_alert "Done building BSP CLI package" "${destination}" "debug"
}
diff --git a/lib/functions/compilation/debs.sh b/lib/functions/compilation/debs.sh
index a48bd3058..2af1af793 100644
--- a/lib/functions/compilation/debs.sh
+++ b/lib/functions/compilation/debs.sh
@@ -43,7 +43,7 @@ compile_firmware() {
display_alert "Building firmware package" "armbian-firmware${FULL}_${REVISION}_all" "info"
fakeroot_dpkg_deb_build "armbian-firmware${FULL}_${REVISION}_all"
mv "armbian-firmware${FULL}_${REVISION}_all" "armbian-firmware${FULL}"
- rsync -rq "armbian-firmware${FULL}_${REVISION}_all.deb" "${DEB_STORAGE}/"
+ run_host_command_logged rsync -rq "armbian-firmware${FULL}_${REVISION}_all.deb" "${DEB_STORAGE}/"
}
@@ -117,7 +117,7 @@ compile_armbian-zsh() {
chmod 755 "${tmp_dir}/${armbian_zsh_dir}"/DEBIAN/postinst
fakeroot_dpkg_deb_build "${tmp_dir}/${armbian_zsh_dir}"
- rsync --remove-source-files -rq "${tmp_dir}/${armbian_zsh_dir}.deb" "${DEB_STORAGE}/"
+ run_host_command_logged rsync --remove-source-files -r "${tmp_dir}/${armbian_zsh_dir}.deb" "${DEB_STORAGE}/"
}
@@ -169,7 +169,7 @@ compile_armbian-config() {
ln -sf /usr/sbin/softy "${tmp_dir}/${armbian_config_dir}"/usr/bin/softy
fakeroot_dpkg_deb_build "${tmp_dir}/${armbian_config_dir}"
- rsync --remove-source-files -rq "${tmp_dir}/${armbian_config_dir}.deb" "${DEB_STORAGE}/"
+ run_host_command_logged rsync --remove-source-files -r "${tmp_dir}/${armbian_config_dir}.deb" "${DEB_STORAGE}/"
}
compile_xilinx_bootgen() {
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 249336e00..66d512de5 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -79,7 +79,7 @@ function compile_kernel() {
display_alert "Done with" "kernel compile" "debug"
cd "${kernel_work_dir}/.." || exit
rm -f linux-firmware-image-*.deb # remove firmware image packages here - easier than patching ~40 packaging scripts at once
- rsync --remove-source-files -rq ./*.deb "${DEB_STORAGE}/" || exit_with_error "Failed moving kernel DEBs"
+ run_host_command_logged rsync --remove-source-files -r ./*.deb "${DEB_STORAGE}/"
return 0
}
diff --git a/lib/functions/compilation/uboot.sh b/lib/functions/compilation/uboot.sh
index 05b8ea629..f6f8279ea 100644
--- a/lib/functions/compilation/uboot.sh
+++ b/lib/functions/compilation/uboot.sh
@@ -229,7 +229,7 @@ compile_uboot() {
[[ ! -f $uboottempdir/${uboot_name}.deb ]] && exit_with_error "Building u-boot package failed"
- rsync --remove-source-files -rq "$uboottempdir/${uboot_name}.deb" "${DEB_STORAGE}/" 2>&1
+ run_host_command_logged rsync --remove-source-files -r "$uboottempdir/${uboot_name}.deb" "${DEB_STORAGE}/"
display_alert "Built u-boot deb OK" "${uboot_name}.deb" "info"
return 0 # success
diff --git a/lib/functions/image/rootfs-to-image.sh b/lib/functions/image/rootfs-to-image.sh
index 85dc86f9c..a8f0796cc 100644
--- a/lib/functions/image/rootfs-to-image.sh
+++ b/lib/functions/image/rootfs-to-image.sh
@@ -1,9 +1,3 @@
-#############################################################################
-
-#############################################################################
-
-#############################################################################
-
# create_image
#
# finishes creation of image from cached rootfs
@@ -125,10 +119,10 @@ PRE_UMOUNT_FINAL_IMAGE
It is the last possible chance to modify `$CARD_DEVICE`.
POST_BUILD_IMAGE
- # move artefacts from temporally directory to its final destination
- [[ -n $compression_type ]] && rm "${DESTIMG}/${version}.img"
- rsync -a --no-owner --no-group --remove-source-files "${DESTIMG}/${version}"* "${FINALDEST}"
- rm -rf --one-file-system "${DESTIMG}"
+ display_alert "Moving artefacts from temporary directory to its final destination" "${version}" "debug"
+ [[ -n $compression_type ]] && run_host_command_logged rm -v "${DESTIMG}/${version}.img"
+ run_host_command_logged rsync -av --no-owner --no-group --remove-source-files "${DESTIMG}/${version}"* "${FINALDEST}"
+ run_host_command_logged rm -rfv --one-file-system "${DESTIMG}"
# write image to SD card
write_image_to_device "${FINALDEST}/${version}.img" "${CARD_DEVICE}"
diff --git a/lib/functions/rootfs/apt.sh b/lib/functions/rootfs/apt.sh
index 768636fc9..91f81ad95 100644
--- a/lib/functions/rootfs/apt.sh
+++ b/lib/functions/rootfs/apt.sh
@@ -33,7 +33,7 @@ install_deb_chroot() {
chroot_sdcard_apt_get --no-install-recommends install "${name}"
# @TODO: mysterious. store installed/downloaded packages in deb storage. only used for u-boot deb. why?
- [[ ${variant} == remote && ${transfer} == yes ]] && rsync -rq "${SDCARD}"/var/cache/apt/archives/*.deb "${DEB_STORAGE}"/
+ [[ ${variant} == remote && ${transfer} == yes ]] && run_host_command_logged rsync -r "${SDCARD}"/var/cache/apt/archives/*.deb "${DEB_STORAGE}"/
# IMPORTANT! Do not use short-circuit above as last statement in a function, since it determines the result of the function.
return 0
From 5aa5cad33ed6ea11af0cb371c0f5a1ef3cce0309 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 1 Apr 2022 00:51:22 +0200
Subject: [PATCH] armbian-next: downloads: skip download if no `ARMBIAN_MIRROR`
nor `DOWNLOAD_MIRROR`; less logs
---
lib/functions/general/downloads.sh | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/lib/functions/general/downloads.sh b/lib/functions/general/downloads.sh
index 6c5171f3c..1ff476a74 100644
--- a/lib/functions/general/downloads.sh
+++ b/lib/functions/general/downloads.sh
@@ -7,22 +7,18 @@ function webseed() {
# aria2 simply split chunks based on sources count not depending on download speed
# when selecting china mirrors, use only China mirror, others are very slow there
if [[ $DOWNLOAD_MIRROR == china ]]; then
- WEBSEED=(
- https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/
- )
+ WEBSEED=(https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/)
elif [[ $DOWNLOAD_MIRROR == bfsu ]]; then
- WEBSEED=(
- https://mirrors.bfsu.edu.cn/armbian-releases/
- )
+ WEBSEED=(https://mirrors.bfsu.edu.cn/armbian-releases/)
fi
- for toolchain in ${WEBSEED[@]}; do
+ for toolchain in "${WEBSEED[@]}"; do
text="${text} ${toolchain}${1}"
done
text="${text:1}"
echo "${text}"
}
-# Non-error handled version @TODO: might be a terrible idea?
+# Terrible idea, this runs download_and_verify_internal() with error handling disabled.
function download_and_verify() {
download_and_verify_internal "${@}" || true
}
@@ -33,26 +29,30 @@ function download_and_verify_internal() {
local localdir=$SRC/cache/${remotedir//_/}
local dirname=${filename//.tar.xz/}
+ local server=${ARMBIAN_MIRROR}
if [[ $DOWNLOAD_MIRROR == china ]]; then
- local server="https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/"
+ server="https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/"
elif [[ $DOWNLOAD_MIRROR == bfsu ]]; then
- local server="https://mirrors.bfsu.edu.cn/armbian-releases/"
- else
- local server=${ARMBIAN_MIRROR}
+ server="https://mirrors.bfsu.edu.cn/armbian-releases/"
+ fi
+
+ if [[ "x${server}x" == "xx" ]]; then
+ display_alert "ARMBIAN_MIRROR is not set, nor valid DOWNLOAD_MIRROR" "not downloading '${filename}'" "debug"
+ return 0
fi
if [[ -f ${localdir}/${dirname}/.download-complete ]]; then
- return
+ return 0
fi
# switch to china mirror if US timeouts
- run_host_command_logged timeout 10 curl --head --fail --silent "${server}${remotedir}/${filename}"
+ timeout 10 curl --head --fail --silent "${server}${remotedir}/${filename}"
if [[ $? -ne 7 && $? -ne 22 && $? -ne 0 ]]; then
display_alert "Timeout from $server" "retrying" "info"
server="https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/"
# switch to another china mirror if tuna timeouts
- run_host_command_logged timeout 10 curl --head --fail --silent ${server}${remotedir}/${filename}
+ timeout 10 curl --head --fail --silent ${server}${remotedir}/${filename}
if [[ $? -ne 7 && $? -ne 22 && $? -ne 0 ]]; then
display_alert "Timeout from $server" "retrying" "info"
server="https://mirrors.bfsu.edu.cn/armbian-releases/"
From fcc2cdc23237549cde54eee47b76776106c29ec0 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 31 Mar 2022 20:02:17 +0200
Subject: [PATCH] armbian-next: update rockchip.conf from master and use
runners
---
config/sources/families/rockchip.conf | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/config/sources/families/rockchip.conf b/config/sources/families/rockchip.conf
index 55f56e492..0f123a848 100644
--- a/config/sources/families/rockchip.conf
+++ b/config/sources/families/rockchip.conf
@@ -10,7 +10,7 @@ if [[ $BOARD == miqi ]]; then
elif [[ $BOARD == xt-q8l-v10 ]]; then
BOOTBRANCH='tag:v2021.01'
else
- BOOTBRANCH='tag:v2018.11'
+ BOOTBRANCH='tag:v2022.01'
fi
SERIALCON=ttyS2
@@ -63,16 +63,17 @@ uboot_custom_postprocess() {
cat spl/u-boot-spl-dtb.bin >> u-boot-rockchip-with-spl.bin
dd if=u-boot-dtb.img of=u-boot-rockchip-with-spl.bin seek=$((0x200 - 0x40)) conv=notrunc
else
- tools/mkimage -n rk3288 -T rksd -d spl/u-boot-spl-dtb.bin u-boot-rockchip-with-spl.bin
- cat u-boot-dtb.bin >> u-boot-rockchip-with-spl.bin
+ tools/mkimage -n rk3288 -T rksd -d tpl/u-boot-tpl.bin u-boot-rockchip-with-spl.bin
+ cat spl/u-boot-spl-dtb.bin >> u-boot-rockchip-with-spl.bin
+ dd if=u-boot-dtb.img of=u-boot-rockchip-with-spl.bin seek=$((0x200 - 0x40)) conv=notrunc
fi
}
family_tweaks() {
if [[ $BOARD == tinkerboard ]]; then
- chroot $SDCARD /bin/bash -c "apt-get -y -qq install rfkill bluetooth bluez bluez-tools" 2>&1
- chroot $SDCARD /bin/bash -c "systemctl --no-reload enable tinker-bluetooth.service" 2>&1
+ chroot_sdcard_apt_get_install rfkill bluetooth bluez bluez-tools
+ [[ $BRANCH == legacy ]] && chroot_sdcard systemctl --no-reload enable tinker-bluetooth.service
if [[ -f "$SDCARD/etc/pulse/default.pa" ]]; then
sed -i -e "/#load-module module-alsa-sink/r $SRC/packages/bsp/rockchip/pulseaudio.txt" "$SDCARD/etc/pulse/default.pa" 2>&1
else
@@ -99,10 +100,12 @@ family_tweaks_bsp() {
cp $SRC/packages/bsp/rockchip/70-gpio.rules $destination/etc/udev/rules.d
cp $SRC/packages/bsp/rockchip/71-i2c.rules $destination/etc/udev/rules.d
- # Bluetooth
- install -m 755 $SRC/packages/bsp/rockchip/rtk_hciattach $destination/usr/bin
- install -m 755 $SRC/packages/bsp/rockchip/start_bt.sh $destination/usr/local/bin
- cp $SRC/packages/bsp/rockchip/tinker-bluetooth.service $destination/lib/systemd/system/
+ # Tinkerboard Bluetooth (only legacy kernel, mainline uses serdev)
+ if [[ $BRANCH == legacy ]]; then
+ install -m 755 $SRC/packages/bsp/rockchip/rtk_hciattach $destination/usr/bin
+ install -m 755 $SRC/packages/bsp/rockchip/start_bt.sh $destination/usr/local/bin
+ cp $SRC/packages/bsp/rockchip/tinker-bluetooth.service $destination/lib/systemd/system/
+ fi
# Sound
cp $SRC/packages/bsp/rockchip/asound.conf $destination/etc/
From 0b7e6c6bb6a744d6b95038e9ab3b1ab7b1aa7027 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 31 Mar 2022 19:33:39 +0200
Subject: [PATCH] armbian-next: update mvebu64.conf from master and use
functions
---
config/sources/families/mvebu64.conf | 57 +++++++++++++++++++++++++-----------
1 file changed, 40 insertions(+), 17 deletions(-)
diff --git a/config/sources/families/mvebu64.conf b/config/sources/families/mvebu64.conf
index 27c4e318a..bc79e1ec6 100644
--- a/config/sources/families/mvebu64.conf
+++ b/config/sources/families/mvebu64.conf
@@ -2,22 +2,27 @@ enable_extension "marvell-tools"
ARCH=arm64
BOOTBRANCH='branch:v2022.01'
BOOTENV_FILE='mvebu64.txt'
-ATFSOURCE='https://github.com/MarvellEmbeddedProcessors/atf-marvell'
+ATFSOURCE='https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git'
ATFDIR='arm-trusted-firmware-espressobin'
-ATFBRANCH='branch:atf-v1.5-armada-18.12'
+ATFBRANCH='branch:master'
ATF_USE_GCC='> 7.2'
-ATF_COMPILER='aarch64-linux-gnu-'
+
+if [[ "${SKIP_EXTERNAL_TOOLCHAINS}" == "yes" ]]; then
+ ATF_COMPILER='aarch64-linux-gnu-'
+else
+ ATF_COMPILER='aarch64-none-linux-gnu-'
+fi
if [[ $BOARD = macchiatobin-doubleshot ]]; then
export SCP_BL2=$SRC/cache/sources/marvell-binaries/mrvl_scp_bl2.img
- ATF_TARGET_MAP="DEBUG=1 USE_COHERENT_MEM=0 LOG_LEVEL=20 MV_DDR_PATH=$SRC/cache/sources/marvell-ddr SECURE=0 PLAT=a80x0_mcbin;;build/a80x0_mcbin/debug/bl31.bin"
+ ATF_TARGET_MAP="USE_COHERENT_MEM=0 LOG_LEVEL=20 MV_DDR_PATH=$SRC/cache/sources/marvell-ddr SECURE=0 PLAT=a80x0_mcbin;;build/a80x0_mcbin/release/bl31.bin"
UBOOT_TARGET_MAP="DEVICE_TREE=armada-8040-mcbin ;;flash-image.bin"
BOOTSCRIPT="boot-macchiatobin-doubleshot.cmd:boot.cmd"
SERIALCON='ttyS0'
else
- ATF_TARGET_MAP="DEBUG=1 USE_COHERENT_MEM=0 LOG_LEVEL=20 SECURE=0 CLOCKSPRESET=CPU_800_DDR_800 DDR_TOPOLOGY=2 BOOTDEV=SPINOR PARTNUM=0 PLAT=a3700;;build/a3700/debug/bl31.bin"
+ ATF_TARGET_MAP="USE_COHERENT_MEM=0 LOG_LEVEL=20 SECURE=0 CLOCKSPRESET=CPU_800_DDR_800 DDR_TOPOLOGY=2 BOOTDEV=SPINOR PARTNUM=0 PLAT=a3700;;build/a3700/release/bl31.bin"
UBOOT_TARGET_MAP="DEVICE_TREE=armada-3720-espressobin ;;flash-image-*.bin"
BOOTSCRIPT="boot-espressobin.cmd:boot.cmd"
@@ -65,7 +70,7 @@ write_uboot_platform() {
}
family_tweaks() {
- chroot $SDCARD /bin/bash -c "apt-get -y -qq remove --auto-remove linux-sound-base alsa-base alsa-utils bluez>/dev/null 2>&1"
+ chroot_sdcard_apt_get remove --auto-remove linux-sound-base alsa-base alsa-utils bluez
[[ -f $SDCARD/etc/netplan/armbian-default.yaml ]] && sed -i "s/^ renderer.*/ renderer: networkd/" $SDCARD/etc/netplan/armbian-default.yaml
cp $SRC/packages/bsp/mvebu64/10* $SDCARD/etc/systemd/network/
echo "#Marvell Espressobin Console" >> $SDCARD/etc/securetty
@@ -76,11 +81,13 @@ atf_custom_postprocess() {
# prepare compilers for postprocess
ubootdir="$SRC/cache/sources/$BOOTDIR/${BOOTBRANCH##*:}"
export ATF1=$toolchain/$ATF_COMPILER
- export ATF2=$(find_toolchain "arm-linux-gnueabi-" "> 7.0")/arm-linux-gnueabi-
+ if [[ "${SKIP_EXTERNAL_TOOLCHAINS}" == "yes" ]]; then
+ export TOOLCHAIN_NAME="arm-linux-gnueabi-"
+ else
+ export TOOLCHAIN_NAME="arm-none-eabi-"
+ fi
+ export ATF2=$(find_toolchain "$TOOLCHAIN_NAME" "> 10.0")/$TOOLCHAIN_NAME
export BL33=$ubootdir"/u-boot.bin"
- # copy extra DDR topology
- sed -i "s@^CUST | \[0-6\])@CUST | [0-7])@" $SRC/cache/sources/marvell-tools/script/buildtim.sh || true
- cp $SRC/packages/blobs/espressobin/DDR* $SRC/cache/sources/marvell-tools/tim/ddr/
}
uboot_custom_postprocess() {
@@ -88,18 +95,23 @@ uboot_custom_postprocess() {
rm $ubootdir/flash-image*
local atfdir="$SRC/cache/sources/$ATFDIR/${ATFBRANCH##*:}"
local ubootdir="$SRC/cache/sources/$BOOTDIR/${BOOTBRANCH##*:}"
+ local moxbootdir="$SRC/cache/sources/mox-boot"
cd $atfdir
if [[ $BOARD = macchiatobin-doubleshot ]]; then
- make distclean >> $DEST/debug/compilation.log 2>&1
+ run_host_command_logged make distclean
FILENAME="flash-image.bin"
display_alert "Building $FILENAME" "" "info"
# http://wiki.macchiatobin.net/tiki-index.php?page=Build+from+source+-+Bootloader#Building_ATF
- make distclean >> $DEST/debug/compilation.log 2>&1
- make USE_COHERENT_MEM=0 LOG_LEVEL=20 MV_DDR_PATH=$SRC/cache/sources/marvell-ddr PLAT=a80x0_mcbin CROSS_COMPILE=$ATF1 BL33=$BL33 all fip $CTHREADS >> $DEST/debug/compilation.log 2>&1
- cp build/a80x0_mcbin/release/flash-image.bin $ubootdir/$FILENAME
+ run_host_command_logged make distclean
+ run_host_command_logged make USE_COHERENT_MEM=0 LOG_LEVEL=20 MV_DDR_PATH=$SRC/cache/sources/marvell-ddr PLAT=a80x0_mcbin CROSS_COMPILE=$ATF1 BL33=$BL33 all fip $CTHREADS
+ run_host_command_logged cp -pv build/a80x0_mcbin/release/flash-image.bin $ubootdir/$FILENAME
else
+ cd $moxbootdir
+ run_host_command_logged make CROSS_CM3=$ATF2 wtmi_app.bin
+ cd $atfdir
+
clocks=(600_600 800_800 1000_800 1200_750)
topology=(512m_1cs_0 512m_2cs_0 1g_2cs_2 1g_1cs_4 2g_2cs_7 1g_1cs_5 2g_2cs_6)
for i in "${clocks[@]}"; do
@@ -109,9 +121,20 @@ uboot_custom_postprocess() {
DDR_TOPOLOGY="${j##*_}"
CLOCKSPRESET="CPU_${i%_*}_DDR_${i##*_}"
display_alert "Building $FILENAME" "" "info"
- make distclean >> $DEST/debug/compilation.log 2>&1
- make MV_DDR_PATH=$SRC/cache/sources/marvell-ddr CROSS_COMPILE=$ATF1 DEBUG=1 USE_COHERENT_MEM=0 LOG_LEVEL=20 SECURE=0 CLOCKSPRESET=$CLOCKSPRESET DDR_TOPOLOGY=$DDR_TOPOLOGY BOOTDEV=SPINOR PARTNUM=0 PLAT=a3700 all fip BL33=$BL33 WTP=$SRC/cache/sources/marvell-tools $CTHREADS CROSS_CM3=$ATF2 >> $DEST/debug/compilation.log 2>&1
- cp build/a3700/debug/flash-image.bin $ubootdir/$FILENAME
+ run_host_command_logged make distclean
+ run_host_command_logged make CROSS_COMPILE=$ATF1 \
+ CROSS_CM3=$ATF2 \
+ USE_COHERENT_MEM=0 \
+ PLAT=a3700 \
+ CLOCKSPRESET=$CLOCKSPRESET DDR_TOPOLOGY=$DDR_TOPOLOGY \
+ MV_DDR_PATH=$SRC/cache/sources/marvell-ddr \
+ WTP=$SRC/cache/sources/marvell-tools \
+ CRYPTOPP_PATH=$SRC/cache/sources/cryptopp \
+ BL33=$BL33 \
+ WTMI_IMG=$moxbootdir/wtmi_app.bin \
+ BOOTDEV=SPINOR PARTNUM=0 \
+ LOG_LEVEL=20 all fip mrvl_flash $CTHREADS
+ run_host_command_logged cp -pv build/a3700/release/flash-image.bin $ubootdir/$FILENAME
done
done
fi
From b1ded35c1baa90f16652299b433410fef216f8f7 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 31 Mar 2022 19:23:33 +0200
Subject: [PATCH] armbian-next: git: fix `fetch_from_repo` with actual
submodules usage
---
lib/functions/general/git.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index 3af8a6b3e..baf7f54d2 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -195,7 +195,7 @@ fetch_from_repo() {
cd "${git_work_dir}" || exit
local surl sref
surl=$(git config -f .gitmodules --get "submodule.$i.url")
- sref=$(git config -f .gitmodules --get "submodule.$i.branch")
+ sref=$(git config -f .gitmodules --get "submodule.$i.branch" || true)
if [[ -n $sref ]]; then
sref="branch:$sref"
else
From 8996fb16048de112e985c9f2a4d5f896623b1cd0 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 31 Mar 2022 16:25:50 +0200
Subject: [PATCH] armbian-next: `armbian-next`ify the `nvidia` extension after
rebase from master
- driver version is configurable via `NVIDIA_DRIVER_VERSION`
- use runner function to log/error-handle/use apt cache/etc
---
extensions/nvidia.sh | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/extensions/nvidia.sh b/extensions/nvidia.sh
index 2e3c55487..e329a7458 100644
--- a/extensions/nvidia.sh
+++ b/extensions/nvidia.sh
@@ -1,13 +1,13 @@
-function pre_install_kernel_debs__build_nvidia_kernel_module() {
-
+function extension_prepare_config__build_nvidia_kernel_module() {
export INSTALL_HEADERS="yes"
-
+ declare -g NVIDIA_DRIVER_VERSION="${NVIDIA_DRIVER_VERSION:-"510"}"
+ display_alert "Forcing INSTALL_HEADERS=yes; using nVidia driver version ${NVIDIA_DRIVER_VERSION}" "${EXTENSION}" "debug"
}
function post_install_kernel_debs__build_nvidia_kernel_module() {
-
- display_alert "Build kernel module" "${EXTENSION}" "info"
- chroot "${SDCARD}" /bin/bash -c "apt -y -qq install nvidia-dkms-510 nvidia-driver-510 nvidia-settings nvidia-common" >>"$DEST"/"${LOG_SUBPATH}"/install.log 2>&1 || {
- exit_with_error "${install_grub_cmdline} failed!"
- }
+ display_alert "Install nVidia packages, build kernel module in chroot" "${EXTENSION}" "info"
+ # chroot_sdcard_apt_get_install() is in lib/logging/runners.sh which handles "running" of stuff nicely.
+ # chroot_sdcard_apt_get_install() -> chroot_sdcard_apt_get() -> chroot_sdcard() -> run_host_command_logged_raw()
+ # it handles bash-specific quoting issues, apt proxies, logging, and errors.
+ chroot_sdcard_apt_get_install "nvidia-dkms-${NVIDIA_DRIVER_VERSION}" "nvidia-driver-${NVIDIA_DRIVER_VERSION}" nvidia-settings
}
From d72e4b69754671ba464882cbca6b68c67e2c7c9a Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 10 Mar 2022 00:00:39 +0100
Subject: [PATCH] rpi4b: there's no legacy branch anymore, remove it from
KERNEL_TARGET
---
config/boards/rpi4b.wip | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/boards/rpi4b.wip b/config/boards/rpi4b.wip
index 3c1926821..7d184e007 100644
--- a/config/boards/rpi4b.wip
+++ b/config/boards/rpi4b.wip
@@ -1,7 +1,7 @@
# Broadcom BCM2711 quad core 1-8Gb RAM SoC USB3 GBE USB-C WiFi/BT
export BOARD_NAME="Raspberry Pi 4"
export BOARDFAMILY="bcm2711"
-export KERNEL_TARGET="legacy,current,edge"
+export KERNEL_TARGET="current,edge"
export FK__MACHINE_MODEL="Raspberry Pi 4 Model B" # flash kernel (FK) configuration
export ASOUND_STATE="asound.state.rpi"
From 1dbe3c33255a6947743bed2c3dd0ba067035208f Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 9 Mar 2022 13:19:20 +0100
Subject: [PATCH] armbian-next: `download_and_verify` non-error handled;
logging is messy [WiP] [HACK]
---
lib/functions/general/downloads.sh | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/lib/functions/general/downloads.sh b/lib/functions/general/downloads.sh
index b51f0d9c4..6c5171f3c 100644
--- a/lib/functions/general/downloads.sh
+++ b/lib/functions/general/downloads.sh
@@ -22,7 +22,12 @@ function webseed() {
echo "${text}"
}
-download_and_verify() {
+# Non-error handled version @TODO: might be a terrible idea?
+function download_and_verify() {
+ download_and_verify_internal "${@}" || true
+}
+
+function download_and_verify_internal() {
local remotedir=$1
local filename=$2
local localdir=$SRC/cache/${remotedir//_/}
@@ -40,25 +45,20 @@ download_and_verify() {
return
fi
- # allow errors here, too hackish to actually handle them
- set +e
-
# switch to china mirror if US timeouts
- timeout 10 curl --head --fail --silent "${server}${remotedir}/${filename}" 2>&1 > /dev/null || true
+ run_host_command_logged timeout 10 curl --head --fail --silent "${server}${remotedir}/${filename}"
if [[ $? -ne 7 && $? -ne 22 && $? -ne 0 ]]; then
display_alert "Timeout from $server" "retrying" "info"
server="https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/"
# switch to another china mirror if tuna timeouts
- timeout 10 curl --head --fail --silent ${server}${remotedir}/${filename} 2>&1 > /dev/null
+ run_host_command_logged timeout 10 curl --head --fail --silent ${server}${remotedir}/${filename}
if [[ $? -ne 7 && $? -ne 22 && $? -ne 0 ]]; then
display_alert "Timeout from $server" "retrying" "info"
server="https://mirrors.bfsu.edu.cn/armbian-releases/"
fi
fi
- set -e # Back to normal
-
# check if file exists on remote server before running aria2 downloader
[[ ! $(timeout 10 curl --head --fail --silent ${server}${remotedir}/${filename}) ]] && return
@@ -73,7 +73,7 @@ download_and_verify() {
else
# download control file
local torrent=${server}$remotedir/${filename}.torrent
- aria2c --download-result=hide --disable-ipv6=true --summary-interval=0 --console-log-level=error --auto-file-renaming=false \
+ run_host_command_logged aria2c --download-result=hide --disable-ipv6=true --summary-interval=0 --console-log-level=error --auto-file-renaming=false \
--continue=false --allow-overwrite=true --dir="${localdir}" ${server}${remotedir}/${filename}.asc $(webseed "$remotedir/${filename}.asc") -o "${filename}.asc"
[[ $? -ne 0 ]] && display_alert "Failed to download control file" "" "wrn"
fi
@@ -102,7 +102,7 @@ download_and_verify() {
if [[ ! -f "${localdir}/${filename}.complete" ]]; then
if [[ ! $(timeout 10 curl --head --fail --silent ${server}${remotedir}/${filename} 2>&1 > /dev/null) ]]; then
display_alert "downloading from $(echo $server | cut -d'/' -f3 | cut -d':' -f1) using http(s) network" "$filename"
- aria2c --download-result=hide --rpc-save-upload-metadata=false --console-log-level=error \
+ run_host_command_logged aria2c --download-result=hide --rpc-save-upload-metadata=false --console-log-level=error \
--dht-file-path="${SRC}"/cache/.aria2/dht.dat --disable-ipv6=true --summary-interval=0 --auto-file-renaming=false --dir="${localdir}" ${server}${remotedir}/${filename} $(webseed "${remotedir}/${filename}") -o "${filename}"
# mark complete
[[ $? -eq 0 ]] && touch "${localdir}/${filename}.complete" && echo ""
@@ -141,10 +141,8 @@ download_and_verify() {
--recv-keys 9F0E78D5)
fi
- gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --verify \
- --trust-model always -q "${localdir}/${filename}.asc"
+ gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --verify --trust-model always -q "${localdir}/${filename}.asc"
[[ ${PIPESTATUS[0]} -eq 0 ]] && verified=true && display_alert "Verified" "PGP" "info"
-
else
md5sum -c --status "${localdir}/${filename}.asc" && verified=true && display_alert "Verified" "MD5" "info"
fi
@@ -160,6 +158,5 @@ download_and_verify() {
else
exit_with_error "verification failed"
fi
-
fi
}
From 30ee27b4fd6d9b578ad19ca9b0b484809242d77f Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 21 Mar 2022 17:21:03 +0100
Subject: [PATCH] armbian-next: logging: let ANSI colors pass to logfile;
CALLER_PID instead of BASHPID in subshell
---
lib/functions/logging/logging.sh | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index cac13b902..8e98b569a 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -209,8 +209,13 @@ function display_alert() {
# Now, log to file. This will be colorized later by ccze and such, so remove any colors it might already have.
# See also the stuff done in runners.sh for logging exact command lines and runtimes.
+ # the "echo" runs in a subshell due to the "sed" pipe (! important !), so we store BASHPID (current subshell) outside the scope
+ # BASHPID is the current subshell; $$ is parent's?; $_ is the current bashopts
+ local CALLER_PID="${BASHPID}"
if [[ -f "${CURRENT_LOGFILE}" ]]; then
- echo -e "--> [${level_indicator} ] $(printf "%4s" "${SECONDS}"): $$ - ${BASHPID}: $-: ${level}: ${1} [ ${2} ]" | sed 's/\x1b\[[0-9;]*m//g' >> "${CURRENT_LOGFILE}"
+ # ANSI-less version
+ #echo -e "--> ${level_indicator} $(printf "%4s" "${SECONDS}"): $$ - ${CALLER_PID} - ${BASHPID}: $-: ${level}: ${1} [ ${2} ]" >> "${CURRENT_LOGFILE}" # | sed 's/\x1b\[[0-9;]*m//g'
+ echo -e "--> ${level_indicator} $(printf "%4s" "${SECONDS}"): $$ - ${CALLER_PID} - ${BASHPID}: $-: ${level}: ${1} [ ${2} ]" >> "${CURRENT_LOGFILE}" # | sed 's/\x1b\[[0-9;]*m//g'
fi
if [[ ${skip_screen} -eq 1 ]]; then
@@ -224,7 +229,7 @@ function display_alert() {
local pids_info=""
if [[ "${SHOW_PIDS}" == "yes" ]]; then
- pids_info="${tool_color}(${normal_color}$$ - ${BASHPID}${tool_color})" # BASHPID is the current subshell; $$ is parent's?
+ pids_info="${tool_color}(${normal_color}$$ - ${CALLER_PID}${tool_color})" # BASHPID is the current subshell (should be equal to CALLER_PID here); $$ is parent's?
fi
local bashopts_info=""
From a63ba98aefbb6ba7998ad8abedc5d239e1520191 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 21 Mar 2022 17:20:17 +0100
Subject: [PATCH] armbian-next: enable HTTPS CONNECT in Armbian-managed
apt-cacher-ng configuration
- PPAs require it
---
lib/functions/host/apt-cacher-ng.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/functions/host/apt-cacher-ng.sh b/lib/functions/host/apt-cacher-ng.sh
index a917f6cb1..4801784c7 100644
--- a/lib/functions/host/apt-cacher-ng.sh
+++ b/lib/functions/host/apt-cacher-ng.sh
@@ -35,8 +35,9 @@ function acng_configure_and_restart_acng() {
RedirMax: 15
ReuseConnections: 1
- # Allow HTTPS CONNECT, although this is not ideal, since packages are not actually cached then. Disabled for now.
- # PassThroughPattern: .*
+ # Allow HTTPS CONNECT, although this is not ideal, since packages are not actually cached.
+ # Enabled, since PPA's require this.
+ PassThroughPattern: .*
ACNG_CONFIG
# Ensure correct permissions on the directories
From d3641a69a60266f3d7a75109fa6e396b20d85700 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 31 Mar 2022 13:41:53 +0200
Subject: [PATCH] armbian-next: don't loop forever if we can't obtain
ARMBIAN_MIRROR from redirector
- also, don't even try to do it if `SKIP_ARMBIAN_REPO=yes`
---
lib/functions/configuration/main-config.sh | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index ba4fe5452..57561089a 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -328,10 +328,21 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
fi
# don't use mirrors that throws garbage on 404
- if [[ -z ${ARMBIAN_MIRROR} ]]; then
+ if [[ -z ${ARMBIAN_MIRROR} && "${SKIP_ARMBIAN_REPO}" != "yes" ]]; then
+ declare -i armbian_mirror_tries=1
while true; do
+ display_alert "Obtaining Armbian mirror" "via https://redirect.armbian.com" "debug"
ARMBIAN_MIRROR=$(wget -SO- -T 1 -t 1 https://redirect.armbian.com 2>&1 | egrep -i "Location" | awk '{print $2}' | head -1)
- [[ ${ARMBIAN_MIRROR} != *armbian.hosthatch* ]] && break
+ if [[ ${ARMBIAN_MIRROR} != *armbian.hosthatch* ]]; then # @TODO: hosthatch is not good enough. Why?
+ display_alert "Obtained Armbian mirror OK" "${ARMBIAN_MIRROR}" "debug"
+ break
+ else
+ display_alert "Obtained Armbian mirror is invalid, retrying..." "${ARMBIAN_MIRROR}" "debug"
+ fi
+ armbian_mirror_tries=$((armbian_mirror_tries + 1))
+ if [[ $armbian_mirror_tries -ge 5 ]]; then
+ exit_with_error "Unable to obtain ARMBIAN_MIRROR after ${armbian_mirror_tries} tries. Please set ARMBIAN_MIRROR to a valid mirror manually, or avoid the automatic mirror selection by setting SKIP_ARMBIAN_REPO=yes"
+ fi
done
fi
From 617e2ef1d6ff85e0bc6d5c24bc391a21e125f2aa Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 31 Mar 2022 12:25:09 +0200
Subject: [PATCH] armbian-next: manual merge (14) of all changes between
revisions 13469fd8a9eda4a53f87b7dfee0f431dbab8db54 and
09e416e31cc01ece4533a65f02a470a4c21b90ea
- also editorconfig and compile.sh (root) changes
---
.editorconfig | 6 +++
.../browsers/armbian/create_desktop_package.sh | 2 +-
.../mate/armbian/create_desktop_package.sh | 46 +++++++++----------
.../browsers/armbian/create_desktop_package.sh | 2 +-
.../cinnamon/armbian/create_desktop_package.sh | 2 +-
.../lxde/armbian/create_desktop_package.sh | 46 +++++++++----------
.../mate/armbian/create_desktop_package.sh | 46 +++++++++----------
.../browsers/armbian/create_desktop_package.sh | 2 +-
.../budgie/armbian/create_desktop_package.sh | 2 +-
.../cinnamon/armbian/create_desktop_package.sh | 2 +-
.../deepin/armbian/create_desktop_package.sh | 2 +-
.../armbian/create_desktop_package.sh | 2 +-
.../gnome/armbian/create_desktop_package.sh | 2 +-
.../mate/armbian/create_desktop_package.sh | 2 +-
.../xfce/debian/armbian-bsp-desktop/prepare.sh | 1 -
.../browsers/armbian/create_desktop_package.sh | 2 +-
.../lxde/armbian/create_desktop_package.sh | 46 +++++++++----------
.../mate/armbian/create_desktop_package.sh | 46 +++++++++----------
.../xfce/armbian/create_desktop_package.sh | 2 +-
.../sources/families/include/rockchip64_common.inc | 4 +-
config/templates/Dockerfile | 10 +++--
lib/functions/cli/utils-cli.sh | 6 ++-
lib/functions/compilation/patch/kernel-drivers.sh | 12 ++---
lib/functions/configuration/main-config.sh | 2 +-
lib/functions/host/prepare-host.sh | 2 +-
lib/functions/rootfs/distro-specific.sh | 32 ++++++++-----
lib/functions/rootfs/rootfs-desktop.sh | 52 +++++++++++++---------
27 files changed, 203 insertions(+), 178 deletions(-)
diff --git a/.editorconfig b/.editorconfig
index f00e1c57a..fe455e4e2 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -16,6 +16,12 @@ indent_style = space
indent_size = 4
insert_final_newline = false
+[*.json]
+indent_style = space
+indent_size = 4
+trim_trailing_whitespace = true
+insert_final_newline = true
+
# Custom Armbian formatting for bash sources and configuration
[*.{sh,inc,conf,eos,wip,tvb,csc}]
indent_style = tab
diff --git a/config/desktop/bullseye/appgroups/browsers/armbian/create_desktop_package.sh b/config/desktop/bullseye/appgroups/browsers/armbian/create_desktop_package.sh
index f3670e815..a1bc70a52 100644
--- a/config/desktop/bullseye/appgroups/browsers/armbian/create_desktop_package.sh
+++ b/config/desktop/bullseye/appgroups/browsers/armbian/create_desktop_package.sh
@@ -1,4 +1,4 @@
# install optimized browser configurations
cp "${SRC}"/packages/blobs/desktop/chromium.conf "${destination}"/etc/armbian
-cp "${SRC}"/packages/blobs/desktop/firefox.conf "${destination}"/etc/armbian
+cp "${SRC}"/packages/blobs/desktop/firefox.conf "${destination}"/etc/armbian
cp -R "${SRC}"/packages/blobs/desktop/chromium "${destination}"/etc/armbian
diff --git a/config/desktop/bullseye/environments/mate/armbian/create_desktop_package.sh b/config/desktop/bullseye/environments/mate/armbian/create_desktop_package.sh
index 6206b92e0..25186ea4e 100644
--- a/config/desktop/bullseye/environments/mate/armbian/create_desktop_package.sh
+++ b/config/desktop/bullseye/environments/mate/armbian/create_desktop_package.sh
@@ -14,30 +14,30 @@ mkdir -p "${destination}"/usr/share/backgrounds/armbian/
cp "${SRC}"/packages/blobs/desktop/wallpapers/armbian*.jpg "${destination}"/usr/share/backgrounds/armbian/
mkdir -p "${destination}"/usr/share/mate-background-properties
-cat <<- EOF > "${destination}"/usr/share/mate-background-properties/armbian.xml
- <?xml version="1.0"?>
- <!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
- <wallpapers>
- <wallpaper deleted="false">
- <name>Armbian light</name>
- <filename>/usr/share/backgrounds/armbian/armbian18-Dre0x-Minum-light-3840x2160.jpg</filename>
- <options>zoom</options>
- <pcolor>#ffffff</pcolor>
- <scolor>#000000</scolor>
- </wallpaper>
- <wallpaper deleted="false">
- <name>Armbian dark</name>
- <filename>/usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg</filename>
- <options>zoom</options>
- <pcolor>#ffffff</pcolor>
- <scolor>#000000</scolor>
- </wallpaper>
- </wallpapers>
+cat <<-EOF > "${destination}"/usr/share/mate-background-properties/armbian.xml
+<?xml version="1.0"?>
+<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
+<wallpapers>
+ <wallpaper deleted="false">
+ <name>Armbian light</name>
+ <filename>/usr/share/backgrounds/armbian/armbian18-Dre0x-Minum-light-3840x2160.jpg</filename>
+ <options>zoom</options>
+ <pcolor>#ffffff</pcolor>
+ <scolor>#000000</scolor>
+ </wallpaper>
+ <wallpaper deleted="false">
+ <name>Armbian dark</name>
+ <filename>/usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg</filename>
+ <options>zoom</options>
+ <pcolor>#ffffff</pcolor>
+ <scolor>#000000</scolor>
+ </wallpaper>
+</wallpapers>
EOF
mkdir -p "${destination}"/usr/share/glib-2.0/schemas
-cat <<- EOF > "${destination}"/usr/share/glib-2.0/schemas/org.gnome.desktop.background.gschema.override
- [org.gnome.desktop.background]
- picture-uri='file:///usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg'
- show-desktop-icons=true
+cat <<-EOF > "${destination}"/usr/share/glib-2.0/schemas/org.gnome.desktop.background.gschema.override
+[org.gnome.desktop.background]
+picture-uri='file:///usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg'
+show-desktop-icons=true
EOF
diff --git a/config/desktop/buster/appgroups/browsers/armbian/create_desktop_package.sh b/config/desktop/buster/appgroups/browsers/armbian/create_desktop_package.sh
index f3670e815..a1bc70a52 100644
--- a/config/desktop/buster/appgroups/browsers/armbian/create_desktop_package.sh
+++ b/config/desktop/buster/appgroups/browsers/armbian/create_desktop_package.sh
@@ -1,4 +1,4 @@
# install optimized browser configurations
cp "${SRC}"/packages/blobs/desktop/chromium.conf "${destination}"/etc/armbian
-cp "${SRC}"/packages/blobs/desktop/firefox.conf "${destination}"/etc/armbian
+cp "${SRC}"/packages/blobs/desktop/firefox.conf "${destination}"/etc/armbian
cp -R "${SRC}"/packages/blobs/desktop/chromium "${destination}"/etc/armbian
diff --git a/config/desktop/buster/environments/cinnamon/armbian/create_desktop_package.sh b/config/desktop/buster/environments/cinnamon/armbian/create_desktop_package.sh
index fe77b28a5..63b8cb05b 100755
--- a/config/desktop/buster/environments/cinnamon/armbian/create_desktop_package.sh
+++ b/config/desktop/buster/environments/cinnamon/armbian/create_desktop_package.sh
@@ -23,7 +23,7 @@ cp "${SRC}"/packages/blobs/desktop/icons/armbian.png "${destination}"/usr/share/
# generate wallpaper list for background changer
mkdir -p "${destination}"/usr/share/cinnamon-background-properties
-cat << EOF > "${destination}"/usr/share/cinnamon-background-properties/armbian.xml
+cat <<EOF > "${destination}"/usr/share/cinnamon-background-properties/armbian.xml
<?xml version="1.0"?>
<!DOCTYPE wallpapers SYSTEM "cinnamon-wp-list.dtd">
<wallpapers>
diff --git a/config/desktop/buster/environments/lxde/armbian/create_desktop_package.sh b/config/desktop/buster/environments/lxde/armbian/create_desktop_package.sh
index 6206b92e0..25186ea4e 100644
--- a/config/desktop/buster/environments/lxde/armbian/create_desktop_package.sh
+++ b/config/desktop/buster/environments/lxde/armbian/create_desktop_package.sh
@@ -14,30 +14,30 @@ mkdir -p "${destination}"/usr/share/backgrounds/armbian/
cp "${SRC}"/packages/blobs/desktop/wallpapers/armbian*.jpg "${destination}"/usr/share/backgrounds/armbian/
mkdir -p "${destination}"/usr/share/mate-background-properties
-cat <<- EOF > "${destination}"/usr/share/mate-background-properties/armbian.xml
- <?xml version="1.0"?>
- <!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
- <wallpapers>
- <wallpaper deleted="false">
- <name>Armbian light</name>
- <filename>/usr/share/backgrounds/armbian/armbian18-Dre0x-Minum-light-3840x2160.jpg</filename>
- <options>zoom</options>
- <pcolor>#ffffff</pcolor>
- <scolor>#000000</scolor>
- </wallpaper>
- <wallpaper deleted="false">
- <name>Armbian dark</name>
- <filename>/usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg</filename>
- <options>zoom</options>
- <pcolor>#ffffff</pcolor>
- <scolor>#000000</scolor>
- </wallpaper>
- </wallpapers>
+cat <<-EOF > "${destination}"/usr/share/mate-background-properties/armbian.xml
+<?xml version="1.0"?>
+<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
+<wallpapers>
+ <wallpaper deleted="false">
+ <name>Armbian light</name>
+ <filename>/usr/share/backgrounds/armbian/armbian18-Dre0x-Minum-light-3840x2160.jpg</filename>
+ <options>zoom</options>
+ <pcolor>#ffffff</pcolor>
+ <scolor>#000000</scolor>
+ </wallpaper>
+ <wallpaper deleted="false">
+ <name>Armbian dark</name>
+ <filename>/usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg</filename>
+ <options>zoom</options>
+ <pcolor>#ffffff</pcolor>
+ <scolor>#000000</scolor>
+ </wallpaper>
+</wallpapers>
EOF
mkdir -p "${destination}"/usr/share/glib-2.0/schemas
-cat <<- EOF > "${destination}"/usr/share/glib-2.0/schemas/org.gnome.desktop.background.gschema.override
- [org.gnome.desktop.background]
- picture-uri='file:///usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg'
- show-desktop-icons=true
+cat <<-EOF > "${destination}"/usr/share/glib-2.0/schemas/org.gnome.desktop.background.gschema.override
+[org.gnome.desktop.background]
+picture-uri='file:///usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg'
+show-desktop-icons=true
EOF
diff --git a/config/desktop/buster/environments/mate/armbian/create_desktop_package.sh b/config/desktop/buster/environments/mate/armbian/create_desktop_package.sh
index 6206b92e0..25186ea4e 100644
--- a/config/desktop/buster/environments/mate/armbian/create_desktop_package.sh
+++ b/config/desktop/buster/environments/mate/armbian/create_desktop_package.sh
@@ -14,30 +14,30 @@ mkdir -p "${destination}"/usr/share/backgrounds/armbian/
cp "${SRC}"/packages/blobs/desktop/wallpapers/armbian*.jpg "${destination}"/usr/share/backgrounds/armbian/
mkdir -p "${destination}"/usr/share/mate-background-properties
-cat <<- EOF > "${destination}"/usr/share/mate-background-properties/armbian.xml
- <?xml version="1.0"?>
- <!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
- <wallpapers>
- <wallpaper deleted="false">
- <name>Armbian light</name>
- <filename>/usr/share/backgrounds/armbian/armbian18-Dre0x-Minum-light-3840x2160.jpg</filename>
- <options>zoom</options>
- <pcolor>#ffffff</pcolor>
- <scolor>#000000</scolor>
- </wallpaper>
- <wallpaper deleted="false">
- <name>Armbian dark</name>
- <filename>/usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg</filename>
- <options>zoom</options>
- <pcolor>#ffffff</pcolor>
- <scolor>#000000</scolor>
- </wallpaper>
- </wallpapers>
+cat <<-EOF > "${destination}"/usr/share/mate-background-properties/armbian.xml
+<?xml version="1.0"?>
+<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
+<wallpapers>
+ <wallpaper deleted="false">
+ <name>Armbian light</name>
+ <filename>/usr/share/backgrounds/armbian/armbian18-Dre0x-Minum-light-3840x2160.jpg</filename>
+ <options>zoom</options>
+ <pcolor>#ffffff</pcolor>
+ <scolor>#000000</scolor>
+ </wallpaper>
+ <wallpaper deleted="false">
+ <name>Armbian dark</name>
+ <filename>/usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg</filename>
+ <options>zoom</options>
+ <pcolor>#ffffff</pcolor>
+ <scolor>#000000</scolor>
+ </wallpaper>
+</wallpapers>
EOF
mkdir -p "${destination}"/usr/share/glib-2.0/schemas
-cat <<- EOF > "${destination}"/usr/share/glib-2.0/schemas/org.gnome.desktop.background.gschema.override
- [org.gnome.desktop.background]
- picture-uri='file:///usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg'
- show-desktop-icons=true
+cat <<-EOF > "${destination}"/usr/share/glib-2.0/schemas/org.gnome.desktop.background.gschema.override
+[org.gnome.desktop.background]
+picture-uri='file:///usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg'
+show-desktop-icons=true
EOF
diff --git a/config/desktop/focal/appgroups/browsers/armbian/create_desktop_package.sh b/config/desktop/focal/appgroups/browsers/armbian/create_desktop_package.sh
index f3670e815..a1bc70a52 100644
--- a/config/desktop/focal/appgroups/browsers/armbian/create_desktop_package.sh
+++ b/config/desktop/focal/appgroups/browsers/armbian/create_desktop_package.sh
@@ -1,4 +1,4 @@
# install optimized browser configurations
cp "${SRC}"/packages/blobs/desktop/chromium.conf "${destination}"/etc/armbian
-cp "${SRC}"/packages/blobs/desktop/firefox.conf "${destination}"/etc/armbian
+cp "${SRC}"/packages/blobs/desktop/firefox.conf "${destination}"/etc/armbian
cp -R "${SRC}"/packages/blobs/desktop/chromium "${destination}"/etc/armbian
diff --git a/config/desktop/focal/environments/budgie/armbian/create_desktop_package.sh b/config/desktop/focal/environments/budgie/armbian/create_desktop_package.sh
index ad93e7d6a..0f5216cfe 100755
--- a/config/desktop/focal/environments/budgie/armbian/create_desktop_package.sh
+++ b/config/desktop/focal/environments/budgie/armbian/create_desktop_package.sh
@@ -23,7 +23,7 @@ cp "${SRC}"/packages/blobs/desktop/icons/armbian.png "${destination}"/usr/share/
#generate wallpaper list for background changer
mkdir -p "${destination}"/usr/share/cinnamon-background-properties
-cat << EOF > "${destination}"/usr/share/cinnamon-background-properties/armbian.xml
+cat <<EOF > "${destination}"/usr/share/cinnamon-background-properties/armbian.xml
<?xml version="1.0"?>
<!DOCTYPE wallpapers SYSTEM "cinnamon-wp-list.dtd">
<wallpapers>
diff --git a/config/desktop/focal/environments/cinnamon/armbian/create_desktop_package.sh b/config/desktop/focal/environments/cinnamon/armbian/create_desktop_package.sh
index fe77b28a5..63b8cb05b 100755
--- a/config/desktop/focal/environments/cinnamon/armbian/create_desktop_package.sh
+++ b/config/desktop/focal/environments/cinnamon/armbian/create_desktop_package.sh
@@ -23,7 +23,7 @@ cp "${SRC}"/packages/blobs/desktop/icons/armbian.png "${destination}"/usr/share/
# generate wallpaper list for background changer
mkdir -p "${destination}"/usr/share/cinnamon-background-properties
-cat << EOF > "${destination}"/usr/share/cinnamon-background-properties/armbian.xml
+cat <<EOF > "${destination}"/usr/share/cinnamon-background-properties/armbian.xml
<?xml version="1.0"?>
<!DOCTYPE wallpapers SYSTEM "cinnamon-wp-list.dtd">
<wallpapers>
diff --git a/config/desktop/focal/environments/deepin/armbian/create_desktop_package.sh b/config/desktop/focal/environments/deepin/armbian/create_desktop_package.sh
index 78f4d23be..aea442e71 100755
--- a/config/desktop/focal/environments/deepin/armbian/create_desktop_package.sh
+++ b/config/desktop/focal/environments/deepin/armbian/create_desktop_package.sh
@@ -23,7 +23,7 @@ cp "${SRC}"/packages/blobs/desktop/icons/armbian.png "${destination}"/usr/share/
#generate wallpaper list for background changer
mkdir -p "${destination}"/usr/share/deepin-background-properties
-cat << EOF > "${destination}"/usr/share/deepin-background-properties/armbian.xml
+cat <<EOF > "${destination}"/usr/share/deepin-background-properties/armbian.xml
<?xml version="1.0"?>
<!DOCTYPE wallpapers SYSTEM "deepin-wp-list.dtd">
<wallpapers>
diff --git a/config/desktop/focal/environments/enlightenment/armbian/create_desktop_package.sh b/config/desktop/focal/environments/enlightenment/armbian/create_desktop_package.sh
index 1f1ede5e5..f1bdc7146 100755
--- a/config/desktop/focal/environments/enlightenment/armbian/create_desktop_package.sh
+++ b/config/desktop/focal/environments/enlightenment/armbian/create_desktop_package.sh
@@ -23,7 +23,7 @@ cp "${SRC}"/packages/blobs/desktop/icons/armbian.png "${destination}"/usr/share/
#generate wallpaper list for background changer
mkdir -p "${destination}"/usr/share/enlightenment-background-properties
-cat << EOF > "${destination}"/usr/share/enlightenment-background-properties/armbian.xml
+cat <<EOF > "${destination}"/usr/share/enlightenment-background-properties/armbian.xml
<?xml version="1.0"?>
<!DOCTYPE wallpapers SYSTEM "enlightenment-wp-list.dtd">
<wallpapers>
diff --git a/config/desktop/focal/environments/gnome/armbian/create_desktop_package.sh b/config/desktop/focal/environments/gnome/armbian/create_desktop_package.sh
index d23a7109c..019868334 100755
--- a/config/desktop/focal/environments/gnome/armbian/create_desktop_package.sh
+++ b/config/desktop/focal/environments/gnome/armbian/create_desktop_package.sh
@@ -23,7 +23,7 @@ cp "${SRC}"/packages/blobs/desktop/icons/armbian.png "${destination}"/usr/share/
#generate wallpaper list for background changer
mkdir -p "${destination}"/usr/share/gnome-background-properties
-cat << EOF > "${destination}"/usr/share/gnome-background-properties/armbian.xml
+cat <<EOF > "${destination}"/usr/share/gnome-background-properties/armbian.xml
<?xml version="1.0"?>
<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
<wallpapers>
diff --git a/config/desktop/focal/environments/mate/armbian/create_desktop_package.sh b/config/desktop/focal/environments/mate/armbian/create_desktop_package.sh
index ce88f653a..ccd978837 100755
--- a/config/desktop/focal/environments/mate/armbian/create_desktop_package.sh
+++ b/config/desktop/focal/environments/mate/armbian/create_desktop_package.sh
@@ -23,7 +23,7 @@ cp "${SRC}"/packages/blobs/desktop/icons/armbian.png "${destination}"/usr/share/
#generate wallpaper list for background changer
mkdir -p "${destination}"/usr/share/mate-background-properties
-cat << EOF > "${destination}"/usr/share/mate-background-properties/armbian.xml
+cat <<EOF > "${destination}"/usr/share/mate-background-properties/armbian.xml
<?xml version="1.0"?>
<!DOCTYPE wallpapers SYSTEM "mate-wp-list.dtd">
<wallpapers>
diff --git a/config/desktop/focal/environments/xfce/debian/armbian-bsp-desktop/prepare.sh b/config/desktop/focal/environments/xfce/debian/armbian-bsp-desktop/prepare.sh
index 8b1378917..e69de29bb 100644
--- a/config/desktop/focal/environments/xfce/debian/armbian-bsp-desktop/prepare.sh
+++ b/config/desktop/focal/environments/xfce/debian/armbian-bsp-desktop/prepare.sh
@@ -1 +0,0 @@
-
diff --git a/config/desktop/sid/appgroups/browsers/armbian/create_desktop_package.sh b/config/desktop/sid/appgroups/browsers/armbian/create_desktop_package.sh
index f3670e815..a1bc70a52 100644
--- a/config/desktop/sid/appgroups/browsers/armbian/create_desktop_package.sh
+++ b/config/desktop/sid/appgroups/browsers/armbian/create_desktop_package.sh
@@ -1,4 +1,4 @@
# install optimized browser configurations
cp "${SRC}"/packages/blobs/desktop/chromium.conf "${destination}"/etc/armbian
-cp "${SRC}"/packages/blobs/desktop/firefox.conf "${destination}"/etc/armbian
+cp "${SRC}"/packages/blobs/desktop/firefox.conf "${destination}"/etc/armbian
cp -R "${SRC}"/packages/blobs/desktop/chromium "${destination}"/etc/armbian
diff --git a/config/desktop/sid/environments/lxde/armbian/create_desktop_package.sh b/config/desktop/sid/environments/lxde/armbian/create_desktop_package.sh
index 6206b92e0..25186ea4e 100644
--- a/config/desktop/sid/environments/lxde/armbian/create_desktop_package.sh
+++ b/config/desktop/sid/environments/lxde/armbian/create_desktop_package.sh
@@ -14,30 +14,30 @@ mkdir -p "${destination}"/usr/share/backgrounds/armbian/
cp "${SRC}"/packages/blobs/desktop/wallpapers/armbian*.jpg "${destination}"/usr/share/backgrounds/armbian/
mkdir -p "${destination}"/usr/share/mate-background-properties
-cat <<- EOF > "${destination}"/usr/share/mate-background-properties/armbian.xml
- <?xml version="1.0"?>
- <!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
- <wallpapers>
- <wallpaper deleted="false">
- <name>Armbian light</name>
- <filename>/usr/share/backgrounds/armbian/armbian18-Dre0x-Minum-light-3840x2160.jpg</filename>
- <options>zoom</options>
- <pcolor>#ffffff</pcolor>
- <scolor>#000000</scolor>
- </wallpaper>
- <wallpaper deleted="false">
- <name>Armbian dark</name>
- <filename>/usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg</filename>
- <options>zoom</options>
- <pcolor>#ffffff</pcolor>
- <scolor>#000000</scolor>
- </wallpaper>
- </wallpapers>
+cat <<-EOF > "${destination}"/usr/share/mate-background-properties/armbian.xml
+<?xml version="1.0"?>
+<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
+<wallpapers>
+ <wallpaper deleted="false">
+ <name>Armbian light</name>
+ <filename>/usr/share/backgrounds/armbian/armbian18-Dre0x-Minum-light-3840x2160.jpg</filename>
+ <options>zoom</options>
+ <pcolor>#ffffff</pcolor>
+ <scolor>#000000</scolor>
+ </wallpaper>
+ <wallpaper deleted="false">
+ <name>Armbian dark</name>
+ <filename>/usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg</filename>
+ <options>zoom</options>
+ <pcolor>#ffffff</pcolor>
+ <scolor>#000000</scolor>
+ </wallpaper>
+</wallpapers>
EOF
mkdir -p "${destination}"/usr/share/glib-2.0/schemas
-cat <<- EOF > "${destination}"/usr/share/glib-2.0/schemas/org.gnome.desktop.background.gschema.override
- [org.gnome.desktop.background]
- picture-uri='file:///usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg'
- show-desktop-icons=true
+cat <<-EOF > "${destination}"/usr/share/glib-2.0/schemas/org.gnome.desktop.background.gschema.override
+[org.gnome.desktop.background]
+picture-uri='file:///usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg'
+show-desktop-icons=true
EOF
diff --git a/config/desktop/sid/environments/mate/armbian/create_desktop_package.sh b/config/desktop/sid/environments/mate/armbian/create_desktop_package.sh
index 6206b92e0..25186ea4e 100644
--- a/config/desktop/sid/environments/mate/armbian/create_desktop_package.sh
+++ b/config/desktop/sid/environments/mate/armbian/create_desktop_package.sh
@@ -14,30 +14,30 @@ mkdir -p "${destination}"/usr/share/backgrounds/armbian/
cp "${SRC}"/packages/blobs/desktop/wallpapers/armbian*.jpg "${destination}"/usr/share/backgrounds/armbian/
mkdir -p "${destination}"/usr/share/mate-background-properties
-cat <<- EOF > "${destination}"/usr/share/mate-background-properties/armbian.xml
- <?xml version="1.0"?>
- <!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
- <wallpapers>
- <wallpaper deleted="false">
- <name>Armbian light</name>
- <filename>/usr/share/backgrounds/armbian/armbian18-Dre0x-Minum-light-3840x2160.jpg</filename>
- <options>zoom</options>
- <pcolor>#ffffff</pcolor>
- <scolor>#000000</scolor>
- </wallpaper>
- <wallpaper deleted="false">
- <name>Armbian dark</name>
- <filename>/usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg</filename>
- <options>zoom</options>
- <pcolor>#ffffff</pcolor>
- <scolor>#000000</scolor>
- </wallpaper>
- </wallpapers>
+cat <<-EOF > "${destination}"/usr/share/mate-background-properties/armbian.xml
+<?xml version="1.0"?>
+<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
+<wallpapers>
+ <wallpaper deleted="false">
+ <name>Armbian light</name>
+ <filename>/usr/share/backgrounds/armbian/armbian18-Dre0x-Minum-light-3840x2160.jpg</filename>
+ <options>zoom</options>
+ <pcolor>#ffffff</pcolor>
+ <scolor>#000000</scolor>
+ </wallpaper>
+ <wallpaper deleted="false">
+ <name>Armbian dark</name>
+ <filename>/usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg</filename>
+ <options>zoom</options>
+ <pcolor>#ffffff</pcolor>
+ <scolor>#000000</scolor>
+ </wallpaper>
+</wallpapers>
EOF
mkdir -p "${destination}"/usr/share/glib-2.0/schemas
-cat <<- EOF > "${destination}"/usr/share/glib-2.0/schemas/org.gnome.desktop.background.gschema.override
- [org.gnome.desktop.background]
- picture-uri='file:///usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg'
- show-desktop-icons=true
+cat <<-EOF > "${destination}"/usr/share/glib-2.0/schemas/org.gnome.desktop.background.gschema.override
+[org.gnome.desktop.background]
+picture-uri='file:///usr/share/backgrounds/armbian/armbian03-Dre0x-Minum-dark-3840x2160.jpg'
+show-desktop-icons=true
EOF
diff --git a/config/desktop/sid/environments/xfce/armbian/create_desktop_package.sh b/config/desktop/sid/environments/xfce/armbian/create_desktop_package.sh
index 3d2f0723d..2da78a2a9 100644
--- a/config/desktop/sid/environments/xfce/armbian/create_desktop_package.sh
+++ b/config/desktop/sid/environments/xfce/armbian/create_desktop_package.sh
@@ -7,7 +7,7 @@ cp -R "${SRC}"/packages/blobs/desktop/skel/. "${destination}"/etc/skel
# using different icon pack. Workaround due to this bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=867779
sed -i 's/<property name="IconThemeName" type="string" value=".*$/<property name="IconThemeName" type="string" value="Humanity-Dark"\/>/g' \
- "${destination}"/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml
+"${destination}"/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml
# install dedicated startup icons
mkdir -p "${destination}"/usr/share/pixmaps/armbian "${destination}"/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/
diff --git a/config/sources/families/include/rockchip64_common.inc b/config/sources/families/include/rockchip64_common.inc
index eb5ab78b2..cd9541c3b 100644
--- a/config/sources/families/include/rockchip64_common.inc
+++ b/config/sources/families/include/rockchip64_common.inc
@@ -16,7 +16,7 @@ PACKAGE_LIST_FAMILY="ethtool"
RKBIN_DIR="$SRC/cache/sources/rkbin-tools"
-BOOT_SOC=$(expr $BOOTCONFIG : '.*\(rk[[:digit:]]\+.*\)_.*')
+BOOT_SOC=${BOOT_SOC:=$(expr $BOOTCONFIG : '.*\(rk[[:digit:]]\+.*\)_.*')}
CPUMIN=${CPUMIN:="408000"}
@@ -69,7 +69,7 @@ elif [[ $BOOT_SOC == rk3568 ]]; then
BOOT_SCENARIO="${BOOT_SCENARIO:=spl-blobs}"
DDR_BLOB='rk35/rk3568_ddr_1560MHz_v1.10.bin'
- BL31_BLOB='rk35/rk3568_bl31_v1.29.elf'
+ BL31_BLOB='rk35/rk3568_bl31_v1.28.elf'
elif [[ $BOARD == rockpi-s ]]; then
diff --git a/config/templates/Dockerfile b/config/templates/Dockerfile
index 9a56ca2e9..b9cfa9640 100644
--- a/config/templates/Dockerfile
+++ b/config/templates/Dockerfile
@@ -1,4 +1,7 @@
-FROM ubuntu:rolling
+ARG BASE_IMAGE=ubuntu:jammy
+FROM $BASE_IMAGE as armbian_builder
+ARG ARM_GCC_COMPILER='g++-11-arm-linux-gnueabihf'
+ENV ARM_GCC_COMPILER $ARM_GCC_COMPILER
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get -y dist-upgrade && apt-get -y install \
joe \
@@ -20,6 +23,7 @@ RUN sh -c " \
RUN apt-get update \
&& apt-get -y dist-upgrade \
&& apt-get install -y --no-install-recommends \
+ $ARM_GCC_COMPILER \
acl \
aptly \
aria2 \
@@ -47,14 +51,11 @@ RUN apt-get update \
fakeroot \
fdisk \
flex \
- g++-arm-linux-gnueabihf \
gawk \
gcc-aarch64-linux-gnu \
gcc-arm-linux-gnueabihf \
gcc-arm-linux-gnueabi \
gcc-arm-none-eabi \
- gcc-aarch64-linux-gnu \
- g++-aarch64-linux-gnu \
gdisk \
git \
imagemagick \
@@ -72,6 +73,7 @@ RUN apt-get update \
libpython2.7-dev \
libpython3-dev \
libssl-dev \
+ libssl1.1 \
libusb-1.0-0-dev \
linux-base \
libmpc-dev \
diff --git a/lib/functions/cli/utils-cli.sh b/lib/functions/cli/utils-cli.sh
index d9f6a571c..a48de5d3a 100644
--- a/lib/functions/cli/utils-cli.sh
+++ b/lib/functions/cli/utils-cli.sh
@@ -111,7 +111,7 @@ function prepare_userpatches() {
mkdir -p "${SRC}"/userpatches
# Create example configs if none found in userpatches
- if ! ls "${SRC}"/userpatches/{config-example.conf,config-docker.conf,config-vagrant.conf} 1> /dev/null 2>&1; then
+ if ! ls "${SRC}"/userpatches/{config-default.conf,config-docker.conf,config-vagrant.conf} 1> /dev/null 2>&1; then
# Migrate old configs
if ls "${SRC}"/*.conf 1> /dev/null 2>&1; then
@@ -126,6 +126,10 @@ function prepare_userpatches() {
# Create example config
if [[ ! -f "${SRC}"/userpatches/config-example.conf ]]; then
cp "${SRC}"/config/templates/config-example.conf "${SRC}"/userpatches/config-example.conf || exit 1
+ fi
+
+ # Link default config to example config
+ if [[ ! -f "${SRC}"/userpatches/config-default.conf ]]; then
ln -fs config-example.conf "${SRC}"/userpatches/config-default.conf || exit 1
fi
diff --git a/lib/functions/compilation/patch/kernel-drivers.sh b/lib/functions/compilation/patch/kernel-drivers.sh
index 0f9d54bfe..f921591a7 100644
--- a/lib/functions/compilation/patch/kernel-drivers.sh
+++ b/lib/functions/compilation/patch/kernel-drivers.sh
@@ -305,12 +305,8 @@ function prepare_extra_kernel_drivers() {
sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8811cu\/Kconfig"' \
"$kerneldir/drivers/net/wireless/Kconfig"
- # add support for K5.11+
- process_patch_file "${SRC}/patch/misc/wireless-rtl8811cu.patch" "applying"
-
- # add support for K5.12+
- process_patch_file "${SRC}/patch/misc/wireless-realtek-8811cu-5.12.patch" "applying"
- process_patch_file "${SRC}/patch/misc/wireless-realtek-8811cu-xxx.patch" "applying"
+ # add support for K5.17+
+ process_patch_file "${SRC}/patch/misc/wireless-realtek-8811cu-5.17.patch" "applying"
fi
@@ -547,8 +543,8 @@ function prepare_extra_kernel_drivers() {
sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8822bs\/Kconfig"' \
$kerneldir/drivers/net/wireless/Kconfig
- # add support for K5.11+
- process_patch_file "${SRC}/patch/misc/wireless-rtl8822bs.patch" "applying"
+ # add support for K5.11+
+ process_patch_file "${SRC}/patch/misc/wireless-rtl8822bs.patch" "applying"
fi
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 6edde8258..ba4fe5452 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -32,7 +32,7 @@ function do_main_configuration() {
[[ -z $EXIT_PATCHING_ERROR ]] && EXIT_PATCHING_ERROR="" # exit patching if failed
[[ -z $HOST ]] && HOST="$BOARD" # set hostname to the board
cd "${SRC}" || exit
- [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=15
+ [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=16
[[ -z "${CHROOT_CACHE_VERSION}" ]] && CHROOT_CACHE_VERSION=7
BUILD_REPOSITORY_URL=$(git remote get-url "$(git remote 2> /dev/null | grep origin)" 2> /dev/null)
BUILD_REPOSITORY_COMMIT=$(git describe --match=d_e_a_d_b_e_e_f --always --dirty 2> /dev/null)
diff --git a/lib/functions/host/prepare-host.sh b/lib/functions/host/prepare-host.sh
index cc7d1d48f..bae3b3e7c 100644
--- a/lib/functions/host/prepare-host.sh
+++ b/lib/functions/host/prepare-host.sh
@@ -73,7 +73,7 @@ prepare_host() {
#
# NO_HOST_RELEASE_CHECK overrides the check for a supported host system
# Disable host OS check at your own risk. Any issues reported with unsupported releases will be closed without discussion
- if [[ -z $HOSTRELEASE || "buster bullseye focal impish hirsute debbie tricia ulyana ulyssa uma" != *"$HOSTRELEASE"* ]]; then
+ if [[ -z $HOSTRELEASE || "buster bullseye focal impish hirsute jammy debbie tricia ulyana ulyssa uma una" != *"$HOSTRELEASE"* ]]; then
if [[ $NO_HOST_RELEASE_CHECK == yes ]]; then
display_alert "You are running on an unsupported system" "${HOSTRELEASE:-(unknown)}" "wrn"
display_alert "Do not report any errors, warnings or other issues encountered beyond this point" "" "wrn"
diff --git a/lib/functions/rootfs/distro-specific.sh b/lib/functions/rootfs/distro-specific.sh
index 4770af4bc..7c1676f40 100644
--- a/lib/functions/rootfs/distro-specific.sh
+++ b/lib/functions/rootfs/distro-specific.sh
@@ -154,17 +154,33 @@ create_sources_list() {
;;
esac
+ display_alert "Adding Armbian repository and authentication key" "/etc/apt/sources.list.d/armbian.list" "info"
+
+ # apt-key add is getting deprecated
+ APT_VERSION=$(chroot "${basedir}" /bin/bash -c "apt --version | cut -d\" \" -f2")
+ if linux-version compare "${APT_VERSION}" ge 2.4.1; then
+ # add armbian key
+ mkdir -p "${basedir}"/usr/share/keyrings
+ # change to binary form
+ gpg --dearmor < "${SRC}"/config/armbian.key > "${basedir}"/usr/share/keyrings/armbian.gpg
+ SIGNED_BY="[signed-by=/usr/share/keyrings/armbian.gpg] "
+ else
+ # use old method for compatibility reasons
+ cp "${SRC}"/config/armbian.key "${basedir}"
+ chroot "${basedir}" /bin/bash -c "cat armbian.key | apt-key add - > /dev/null 2>&1"
+ fi
+
# stage: add armbian repository and install key
if [[ $DOWNLOAD_MIRROR == "china" ]]; then
- echo "deb https://mirrors.tuna.tsinghua.edu.cn/armbian $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${basedir}"/etc/apt/sources.list.d/armbian.list
+ echo "deb ${SIGNED_BY}https://mirrors.tuna.tsinghua.edu.cn/armbian $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${basedir}"/etc/apt/sources.list.d/armbian.list
elif [[ $DOWNLOAD_MIRROR == "bfsu" ]]; then
- echo "deb http://mirrors.bfsu.edu.cn/armbian $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${basedir}"/etc/apt/sources.list.d/armbian.list
+ echo "deb ${SIGNED_BY}http://mirrors.bfsu.edu.cn/armbian $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${basedir}"/etc/apt/sources.list.d/armbian.list
else
- echo "deb http://"$([[ $BETA == yes ]] && echo "beta" || echo "apt")".armbian.com $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${basedir}"/etc/apt/sources.list.d/armbian.list
+ echo "deb ${SIGNED_BY}http://"$([[ $BETA == yes ]] && echo "beta" || echo "apt")".armbian.com $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${basedir}"/etc/apt/sources.list.d/armbian.list
fi
# replace local package server if defined. Suitable for development
- [[ -n $LOCAL_MIRROR ]] && echo "deb http://$LOCAL_MIRROR $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${basedir}"/etc/apt/sources.list.d/armbian.list
+ [[ -n $LOCAL_MIRROR ]] && echo "deb ${SIGNED_BY}http://$LOCAL_MIRROR $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${basedir}"/etc/apt/sources.list.d/armbian.list
# disable repo if SKIP_ARMBIAN_REPO=yes
if [[ "${SKIP_ARMBIAN_REPO}" == "yes" ]]; then
@@ -172,12 +188,4 @@ create_sources_list() {
mv "${SDCARD}"/etc/apt/sources.list.d/armbian.list "${SDCARD}"/etc/apt/sources.list.d/armbian.list.disabled
fi
- display_alert "Adding Armbian repository and authentication key" "/etc/apt/sources.list.d/armbian.list" "info"
- cp "${SRC}"/config/armbian.key "${basedir}"
- chroot "${basedir}" /bin/bash -c "cat armbian.key | apt-key add - > /dev/null 2>&1"
- rm "${basedir}"/armbian.key
}
-#--------------------------------------------------------------------------------------------------------------------------------
-# Create kernel boot logo from packages/blobs/splash/logo.png and packages/blobs/splash/spinner.gif (animated)
-# and place to the file /lib/firmware/bootsplash
-#--------------------------------------------------------------------------------------------------------------------------------
diff --git a/lib/functions/rootfs/rootfs-desktop.sh b/lib/functions/rootfs/rootfs-desktop.sh
index b0785949a..56b9cfc3d 100644
--- a/lib/functions/rootfs/rootfs-desktop.sh
+++ b/lib/functions/rootfs/rootfs-desktop.sh
@@ -30,31 +30,40 @@ add_apt_sources() {
for apt_sources_dirpath in ${potential_paths}; do
if [[ -d "${apt_sources_dirpath}" ]]; then
for apt_source_filepath in "${apt_sources_dirpath}/"*.source; do
- local new_apt_source="$(cat "${apt_source_filepath}")"
- display_alert "Adding APT Source ${new_apt_source}"
- # -y -> Assumes yes to all queries
- # -n -> Do not update package cache after adding
- chroot_sdcard "add-apt-repository -y -n \"${new_apt_source}\""
- display_alert "Return code : $?"
+ apt_source_filepath=$(echo "${apt_source_filepath}" | sed -re 's/(^.*[^/])\.[^./]*$/\1/')
+ local new_apt_source="$(cat "${apt_source_filepath}.source")"
+ local apt_source_gpg_filepath="${apt_source_filepath}.gpg"
- # temporally exception for jammy
- [[ $RELEASE == "jammy" ]] && find "${SDCARD}/etc/apt/sources.list.d/." -type f \( -name "*.list" ! -name "armbian.list" \) -print0 | xargs -0 sed -i 's/jammy/hirsute/g'
+ # extract filenames
+ local apt_source_gpg_filename="$(basename ${apt_source_gpg_filepath})"
+ local apt_source_filename="$(basename ${apt_source_filepath}).list"
- local apt_source_gpg_filepath="${apt_source_filepath}.gpg"
+ display_alert "Adding APT Source ${new_apt_source}"
+
+ if [[ "${new_apt_source}" == ppa* ]]; then
+
+ # add list with apt-add
+ # -y -> Assumes yes to all queries
+ # -n -> Do not update package cache after adding
+ run_on_sdcard "add-apt-repository -y -n \"${new_apt_source}\""
+ if [[ -f "${apt_source_gpg_filepath}" ]]; then
+ display_alert "Adding GPG Key ${apt_source_gpg_filepath}"
+ cp "${apt_source_gpg_filepath}" "${SDCARD}/tmp/${apt_source_gpg_filename}"
+ chroot_sdcard "apt-key add \"/tmp/${apt_source_gpg_filename}\""
+ echo "APT Key returned : $?"
+ fi
+ else
+ # copy list if its not ppa
+ echo "${new_apt_source}" > "${SDCARD}/etc/apt/sources.list.d/${apt_source_filename}"
+ if [[ -f "${apt_source_gpg_filepath}" ]]; then
+ display_alert "Adding GPG Key ${apt_source_gpg_filepath}"
+ # local apt_source_gpg_filename="$(basename ${apt_source_gpg_filepath})"
+ mkdir -p "${SDCARD}"/usr/share/keyrings/
+ cp "${apt_source_gpg_filepath}" "${SDCARD}"/usr/share/keyrings/
+ fi
- # PPA provide GPG keys automatically, it seems.
- # But other repositories (Docker for example) require the
- # user to import GPG keys manually
- # Myy : FIXME We need some automatic Git warnings when someone
- # add a GPG key, since trusting the wrong keys could lead to
- # serious issues.
- if [[ -f "${apt_source_gpg_filepath}" ]]; then
- display_alert "Adding GPG Key ${apt_source_gpg_filepath}"
- local apt_source_gpg_filename="$(basename ${apt_source_gpg_filepath})"
- cp "${apt_source_gpg_filepath}" "${SDCARD}/tmp/${apt_source_gpg_filename}"
- chroot_sdcard "apt-key add \"/tmp/${apt_source_gpg_filename}\""
- echo "APT Key returned : $?"
fi
+
done
fi
done
@@ -64,6 +73,7 @@ add_apt_sources() {
add_desktop_package_sources() {
add_apt_sources
chroot_sdcard_apt_get "update"
+ run_host_command_logged ls -l "${SDCARD}/usr/share/keyrings"
run_host_command_logged ls -l "${SDCARD}/etc/apt/sources.list.d"
run_host_command_logged cat "${SDCARD}/etc/apt/sources.list"
}
From d2d2fa9315f74ec155f209096fe55ead120491c6 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 18 Mar 2022 02:17:01 +0100
Subject: [PATCH] armbian-next: *much* improved logging to HTML; log archiving;
consistency
- keep only current logfile
- log to LOGFILE also if SHOW_LOG=yes
- log cmd runtime and success/error directly in runner
---
lib/functions/cli/cli-entrypoint.sh | 3 ++
lib/functions/logging/logging.sh | 78 ++++++++++++++++++++++++++-----------
lib/functions/logging/runners.sh | 19 ++++-----
3 files changed, 67 insertions(+), 33 deletions(-)
diff --git a/lib/functions/cli/cli-entrypoint.sh b/lib/functions/cli/cli-entrypoint.sh
index 5b905062f..4cd37537d 100644
--- a/lib/functions/cli/cli-entrypoint.sh
+++ b/lib/functions/cli/cli-entrypoint.sh
@@ -1,4 +1,7 @@
function cli_entrypoint() {
+ # array, readonly, global, for future reference, "exported" to shutup shellcheck
+ declare -rg -x -a ARMBIAN_ORIGINAL_ARGV=("${@}")
+
if [[ "${ARMBIAN_ENABLE_CALL_TRACING}" == "yes" ]]; then
set -T # inherit return/debug traps
mkdir -p "${SRC}"/output/debug
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index 296b46ddb..cac13b902 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -47,7 +47,7 @@ function start_logging_section() {
export CURRENT_LOGGING_SECTION=${LOG_SECTION:-early} # default to "early", should be overwritten soon enough
export CURRENT_LOGGING_SECTION_START=${SECONDS}
export CURRENT_LOGGING_DIR="${LOGDIR}" # set in cli-entrypoint.sh
- export CURRENT_LOGFILE="${CURRENT_LOGGING_DIR}/${CURRENT_LOGGING_COUNTER}.${CURRENT_LOGGING_SECTION}.log"
+ export CURRENT_LOGFILE="${CURRENT_LOGGING_DIR}/${CURRENT_LOGGING_COUNTER}.000.${CURRENT_LOGGING_SECTION}.log"
mkdir -p "${CURRENT_LOGGING_DIR}"
touch "${CURRENT_LOGFILE}" # Touch it, make sure it's writable.
@@ -94,10 +94,8 @@ function do_with_logging() {
# Also terrible: don't hold a reference to cwd by changing to SRC always
exec 3> >(
cd "${SRC}" || exit 2
- #grep --line-buffered -v "^$" | \
- # @TODO: tee to CURRENT_LOGFILE. @TODO this is essential. if this does not work whole thing comes down
-
- sed -u -e "${prefix_sed_cmd}"
+ # First, log to file, then add prefix via sed for what goes to screen.
+ tee -a "${CURRENT_LOGFILE}" | sed -u -e "${prefix_sed_cmd}"
)
"$@" >&3
exec 3>&- # close the file descriptor, lest sed keeps running forever.
@@ -115,24 +113,21 @@ function do_with_logging() {
function do_with_log_asset() {
# @TODO: check that CURRENT_LOGGING_COUNTER is set, otherwise crazy?
local ASSET_LOGFILE="${CURRENT_LOGGING_DIR}/${CURRENT_LOGGING_COUNTER}.${LOG_ASSET}"
- display_alert "Logging to asset" "${CURRENT_LOGGING_COUNTER}.0.${LOG_ASSET}" "debug"
+ display_alert "Logging to asset" "${CURRENT_LOGGING_COUNTER}.${LOG_ASSET}" "debug"
"$@" >> "${ASSET_LOGFILE}"
}
function display_alert() {
- # We'll be writing to stderr (" >&2"), so also write the message to the generic logfile, for context.
- if [[ -f "${CURRENT_LOGFILE}" ]]; then
- echo -e "--> A: [" "$@" "]" | sed 's/\x1b\[[0-9;]*m//g' >> "${CURRENT_LOGFILE}"
- fi
-
- # If asked, avoid any fancy ANSI escapes completely.
+ # If asked, avoid any fancy ANSI escapes completely. For python-driven log collection. Formatting could be improved.
+ # If used, also does not write to logfile even if it exists.
if [[ "${ANSI_COLOR}" == "none" ]]; then
echo -e "${@}" | sed 's/\x1b\[[0-9;]*m//g' >&2
return 0
fi
- local message="$1" level="$3" # params
+ local message="${1}" level="${3}" # params
local level_indicator="" inline_logs_color="" extra="" ci_log="" # this log
+ local skip_screen=0 # setting to 1 will write to logfile only
case "${level}" in
err | error)
level_indicator="💥"
@@ -159,7 +154,7 @@ function display_alert() {
cleanup | trap)
if [[ "${SHOW_TRAPS}" != "yes" ]]; then # enable debug for many, many debugging msgs
- return 0
+ skip_screen=1
fi
level_indicator="🧽"
inline_logs_color="\e[1;33m"
@@ -167,7 +162,7 @@ function display_alert() {
debug | deprecation)
if [[ "${SHOW_DEBUG}" != "yes" ]]; then # enable debug for many, many debugging msgs
- return 0
+ skip_screen=1
fi
level_indicator="🐛"
inline_logs_color="\e[1;33m"
@@ -175,7 +170,7 @@ function display_alert() {
group)
if [[ "${SHOW_DEBUG}" != "yes" && "${SHOW_GROUPS}" != "yes" ]]; then # show when debugging, or when specifically requested
- return 0
+ skip_screen=1
fi
level_indicator="🦋"
inline_logs_color="\e[1;34m" # blue; 36 would be cyan
@@ -183,7 +178,7 @@ function display_alert() {
command)
if [[ "${SHOW_COMMAND}" != "yes" ]]; then # enable to log all calls to external cmds
- return 0
+ skip_screen=1
fi
level_indicator="🐸"
inline_logs_color="\e[0;36m" # a dim cyan
@@ -191,7 +186,7 @@ function display_alert() {
timestamp | fasthash)
if [[ "${SHOW_FASTHASH}" != "yes" ]]; then # timestamp-related debugging messages, very very verbose
- return 0
+ skip_screen=1
fi
level_indicator="🐜"
inline_logs_color="${tool_color}" # either gray or normal, a bit subdued.
@@ -199,18 +194,29 @@ function display_alert() {
git)
if [[ "${SHOW_GIT}" != "yes" ]]; then # git-related debugging messages, very very verbose
- return 0
+ skip_screen=1
fi
level_indicator="🔖"
inline_logs_color="${tool_color}" # either gray or normal, a bit subdued.
;;
*)
+ level="${level:-other}" # for file logging.
level_indicator="🌿"
inline_logs_color="\e[1;37m"
;;
esac
+ # Now, log to file. This will be colorized later by ccze and such, so remove any colors it might already have.
+ # See also the stuff done in runners.sh for logging exact command lines and runtimes.
+ if [[ -f "${CURRENT_LOGFILE}" ]]; then
+ echo -e "--> [${level_indicator} ] $(printf "%4s" "${SECONDS}"): $$ - ${BASHPID}: $-: ${level}: ${1} [ ${2} ]" | sed 's/\x1b\[[0-9;]*m//g' >> "${CURRENT_LOGFILE}"
+ fi
+
+ if [[ ${skip_screen} -eq 1 ]]; then
+ return 0
+ fi
+
local timing_info=""
if [[ "${SHOW_TIMING}" == "yes" ]]; then
timing_info="${tool_color}(${normal_color}$(printf "%3s" "${SECONDS}")${tool_color})" # SECONDS is bash builtin for seconds since start of script.
@@ -279,16 +285,44 @@ function trap_handler_cleanup_logging() {
mkdir -p "${target_path}"
local target_file="${target_path}/armbian-logs-${ARMBIAN_BUILD_UUID}.html"
+ # Before writing new logfile, compress and move existing ones to archive folder. Unless running under CI.
+ if [[ "${CI}" != "true" ]]; then
+ declare -a existing_log_files_array
+ mapfile -t existing_log_files_array < <(find "${target_path}" -maxdepth 1 -type f -name "armbian-logs-*.html")
+ declare one_old_logfile old_logfile_fn target_archive_path="${target_path}"/archive
+ for one_old_logfile in "${existing_log_files_array[@]}"; do
+ old_logfile_fn="$(basename "${one_old_logfile}")"
+ display_alert "Archiving old logfile" "${old_logfile_fn}" "debug"
+ mkdir -p "${target_archive_path}"
+ # shellcheck disable=SC2002 # my cat is not useless. a bit whiny. not useless.
+ zstdmt --quiet "${one_old_logfile}" -o "${target_archive_path}/${old_logfile_fn}.zst"
+ rm -f "${one_old_logfile}"
+ done
+ fi
+
cat <<- HTML_HEADER > "${target_file}"
<html>
<head>
<title>Armbian logs for ${ARMBIAN_BUILD_UUID}</title>
<style>
- html { background-color: black !important; color: white !important; font-family: JetBrains Mono, monospace, cursive !important; }
+ html, html pre { background-color: black !important; color: white !important; font-family: JetBrains Mono, monospace, cursive !important; }
hr { border: 0; border-bottom: 1px dashed silver; }
</style>
</head>
<body>
+ <h2>Armbian build at $(LC_ALL=C LANG=C date) on $(hostname || true)</h2>
+ <h2>${ARMBIAN_ORIGINAL_ARGV[@]@Q}</h2>
+ <hr/>
+
+ $(git --git-dir="${SRC}/.git" log -1 --color --format=short --decorate | ansi2html --no-wrap --no-header)
+ <hr/>
+
+ $(git -c color.status=always --work-tree="${SRC}" --git-dir="${SRC}/.git" status | ansi2html --no-wrap --no-header)
+ <hr/>
+
+ $(git --work-tree="${SRC}" --git-dir="${SRC}/.git" diff -u --color | ansi2html --no-wrap --no-header)
+ <hr/>
+
HTML_HEADER
# Find and sort the files there, store in array one per logfile
@@ -301,13 +335,13 @@ function trap_handler_cleanup_logging() {
cat <<- HTML_ONE_LOGFILE_WITH_CCZE >> "${target_file}"
<h3>${logfile_base}</h3>
<div style="padding: 1em">
- $(cat "${logfile_full}" | ccze -o nolookups --raw-ansi | ansi2html --no-wrap --no-header)
+ $(ccze -o nolookups --raw-ansi < "${logfile_full}" | ansi2html --no-wrap --no-header)
</div>
<hr/>
HTML_ONE_LOGFILE_WITH_CCZE
else
cat <<- HTML_ONE_LOGFILE_NO_CCZE >> "${target_file}"
- <h1>${logfile_base}</h1>
+ <h3>${logfile_base}</h3>
<pre>$(cat "${logfile_full}")</pre>
HTML_ONE_LOGFILE_NO_CCZE
fi
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index 42610621d..1b07dc7a0 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -134,28 +134,25 @@ function run_host_command_dialog() {
# do NOT use directly, it does NOT expand the way it should (through bash)
function run_host_command_logged_raw() {
# Log the command to the current logfile, so it has context of what was run.
- if [[ -f "${CURRENT_LOGFILE}" ]]; then
- echo " " >> "${CURRENT_LOGFILE}" # blank line for reader's benefit
- echo "-->" "$*" " <- at $(date --utc)" >> "${CURRENT_LOGFILE}"
- fi
display_alert "Command debug" "$*" "command" # A special 'command' level.
- # uncomment when desperate to understand what's going on
- # echo "cmd about to run" "$@" >&2
-
# In this case I wanna KNOW exactly what failed, thus disable errexit, then re-enable immediately after running.
set +e
local exit_code=666
- "$@" 2>&1 # redirect stderr to stdout. $* is NOT $@!
+ local seconds_start=${SECONDS} # Bash has a builtin SECONDS that is seconds since start of script
+ "$@" 2>&1 # redirect stderr to stdout. $* is NOT $@!
exit_code=$?
set -e
- if [[ -f "${CURRENT_LOGFILE}" ]]; then
- echo "--> cmd exited with code ${exit_code} at $(date --utc)" >> "${CURRENT_LOGFILE}"
- fi
+
if [[ $exit_code != 0 ]]; then
+ if [[ -f "${CURRENT_LOGFILE}" ]]; then
+ echo "-->--> command failed with error code ${exit_code} after $((SECONDS - seconds_start)) seconds" >> "${CURRENT_LOGFILE}"
+ fi
# This is very specific; remove CURRENT_LOGFILE's value when calling display_alert here otherwise logged twice.
CURRENT_LOGFILE="" display_alert "cmd exited with code ${exit_code}" "$*" "wrn"
CURRENT_LOGFILE="" display_alert "stacktrace for failed command" "$(show_caller_full)" "wrn"
+ elif [[ -f "${CURRENT_LOGFILE}" ]]; then
+ echo "-->--> command run successfully after $((SECONDS - seconds_start)) seconds" >> "${CURRENT_LOGFILE}"
fi
return $exit_code
}
From 1b160ce366c31c724346f52a7f7bfa79036a6acf Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 18 Mar 2022 00:34:46 +0100
Subject: [PATCH] armbian-next: *breaking change* use `MemAvailable` (not
including swap) and up requirements for tmpfs
- of course add debugging logs
- rename vars
- should really only use this if we've really a lot of completely free RAM to spare
- otherwise OOM killer comes knocking
- or swapping to disk, that is counter-productive
---
lib/functions/main/rootfs-image.sh | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/lib/functions/main/rootfs-image.sh b/lib/functions/main/rootfs-image.sh
index 02d04797d..86ad03594 100644
--- a/lib/functions/main/rootfs-image.sh
+++ b/lib/functions/main/rootfs-image.sh
@@ -27,25 +27,24 @@ function build_rootfs_and_image() {
fi
# stage: verify tmpfs configuration and mount
- # CLI needs ~1.5GiB, desktop - ~3.5GiB
- # calculate and set tmpfs mount to use 9/10 of available RAM+SWAP
- # @TODO: this does not make sense; swap should not be considered. Actually, only free + cached memory should be considered!
- local phymem=$(((($(awk '/MemTotal/ {print $2}' /proc/meminfo) + $(awk '/SwapTotal/ {print $2}' /proc/meminfo))) / 1024 * 9 / 10)) # MiB
- local tmpfs_max_size=1500 # MiB
- if [[ $BUILD_DESKTOP == yes ]]; then
- tmpfs_max_size=3500
- fi
-
- if [[ $FORCE_USE_RAMDISK == no ]]; then
- local use_tmpfs=no
- elif [[ $FORCE_USE_RAMDISK == yes || $phymem -gt $tmpfs_max_size ]]; then
- local use_tmpfs=yes
+ # CLI needs ~2GiB, desktop ~5GiB
+ # vs 60% of available RAM (free + buffers + magic)
+ local available_physical_memory_mib=$(($(awk '/MemAvailable/ {print $2}' /proc/meminfo) * 6 / 1024 / 10)) # MiB
+ local tmpfs_estimated_size=2000 # MiB
+ [[ $BUILD_DESKTOP == yes ]] && tmpfs_estimated_size=5000 # MiB
+
+ local use_tmpfs=no # by default
+ if [[ ${FORCE_USE_RAMDISK} == no ]]; then # do not use, even if it fits
+ :
+ elif [[ ${FORCE_USE_RAMDISK} == yes || ${available_physical_memory_mib} -gt ${tmpfs_estimated_size} ]]; then # use, either force or fits
+ use_tmpfs=yes
+ display_alert "Using tmpfs for rootfs" "RAM available: ${available_physical_memory_mib}MiB > ${tmpfs_estimated_size}MiB estimated" "debug"
+ else
+ display_alert "Not using tmpfs for rootfs" "RAM available: ${available_physical_memory_mib}MiB < ${tmpfs_estimated_size}MiB estimated" "debug"
fi
- [[ -n $FORCE_TMPFS_SIZE ]] && phymem=$FORCE_TMPFS_SIZE
if [[ $use_tmpfs == yes ]]; then
- display_alert "Using tmpfs for rootfs" "${phymem}M" "debug"
- mount -t tmpfs -o "size=${phymem}M" tmpfs "${SDCARD}"
+ mount -t tmpfs tmpfs "${SDCARD}" # do not specify size; we've calculated above that it should fit, and Linux will try its best if it doesn't.
fi
# stage: prepare basic rootfs: unpack cache or create from scratch
From 04a11cc78f5681dd41e3764ce644c53e7032156b Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 17 Mar 2022 22:46:05 +0100
Subject: [PATCH] armbian-next: *breaking change* `DEB_COMPRESS=none` by
default if not running in CI/GHA
---
lib/functions/configuration/main-config.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 6d2f404b1..6edde8258 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -24,7 +24,6 @@ function do_main_configuration() {
[[ -z $ROOTPWD ]] && ROOTPWD="1234" # Must be changed @first login
[[ -z $MAINTAINER ]] && MAINTAINER="Igor Pecovnik" # deb signature
[[ -z $MAINTAINERMAIL ]] && MAINTAINERMAIL="igor.pecovnik@****l.com" # deb signature
- [[ -z $DEB_COMPRESS ]] && DEB_COMPRESS="xz" # compress .debs with XZ by default. Use 'none' for faster/larger builds
export SKIP_EXTERNAL_TOOLCHAINS="${SKIP_EXTERNAL_TOOLCHAINS:-yes}" # don't use any external toolchains, by default.
TZDATA=$(cat /etc/timezone) # Timezone for target is taken from host or defined here.
USEALLCORES=yes # Use all CPU cores for compiling
@@ -39,6 +38,13 @@ function do_main_configuration() {
BUILD_REPOSITORY_COMMIT=$(git describe --match=d_e_a_d_b_e_e_f --always --dirty 2> /dev/null)
ROOTFS_CACHE_MAX=200 # max number of rootfs cache, older ones will be cleaned up
+ # .deb compression. xz is standard, but is slow, so if avoided by default if not running in CI. one day, zstd.
+ if [[ -z ${DEB_COMPRESS} ]]; then
+ DEB_COMPRESS="none" # none is very fast bug produces big artifacts.
+ [[ "${CI}" == "true" ]] && DEB_COMPRESS="xz" # xz is small and slow
+ fi
+ display_alert ".deb compression" "DEB_COMPRESS=${DEB_COMPRESS}" "debug"
+
if [[ $BETA == yes ]]; then
DEB_STORAGE=$DEST/debs-beta
REPO_STORAGE=$DEST/repository-beta
From 667a8de92b5075c05d2ca67761a13c93b8e8b99d Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 17 Mar 2022 22:21:45 +0100
Subject: [PATCH] armbian-next: *breaking change* `CLEAN_LEVEL=make` is no
more; new `make-kernel`, `make-atf`, `make-uboot`
- allows individual control of what to clean
- this effectively disables `make clean` by default
- rebuilds work and timestamping works for patching, so no reason to clean everytime by default.
---
config/templates/config-example.conf | 20 ++++++++++++--------
lib/functions/compilation/atf.sh | 14 +++++++-------
lib/functions/compilation/kernel.sh | 8 +++++---
lib/functions/compilation/uboot.sh | 30 +++++++++++++++---------------
lib/functions/general/cleaning.sh | 25 +++++++++++++++----------
lib/functions/main/default-build.sh | 7 +++----
6 files changed, 57 insertions(+), 47 deletions(-)
diff --git a/config/templates/config-example.conf b/config/templates/config-example.conf
index b75e4b44b..e07496dc8 100644
--- a/config/templates/config-example.conf
+++ b/config/templates/config-example.conf
@@ -1,13 +1,17 @@
# Read build script documentation https://docs.armbian.com/Developer-Guide_Build-Options/
# for detailed explanation of these options and for additional options not listed here
-KERNEL_ONLY="" # leave empty to select each time, set to "yes" or "no" to skip dialog prompt
-KERNEL_CONFIGURE="" # leave empty to select each time, set to "yes" or "no" to skip dialog prompt
-CLEAN_LEVEL="make,debs,oldcache" # comma-separated list of clean targets: "make" = make clean for selected kernel and u-boot,
-# "debs" = delete packages in "./output/debs" for current branch and family,
-# "alldebs" = delete all packages in "./output/debs", "images" = delete "./output/images",
-# "cache" = delete "./output/cache", "sources" = delete "./sources"
-# "oldcache" = remove old cached rootfs except for the newest 8 files
+KERNEL_ONLY="" # leave empty to select each time, set to "yes" or "no" to skip dialog prompt
+KERNEL_CONFIGURE="" # leave empty to select each time, set to "yes" or "no" to skip dialog prompt
+CLEAN_LEVEL="debs,oldcache" # comma-separated list of clean targets:
+: # "make-atf" = make clean for ATF, if it is built.
+: # "make-uboot" = make clean for uboot, if it is built.
+: # "make-kernel" = make clean for kernel, if it is built. very slow.
+: # *important*: "make" by itself has disabled, since Armbian knows how to handle Make timestamping now.
+: # "debs" = delete packages in "./output/debs" for current branch and family. causes rebuilds, hopefully cached.
+: # "alldebs" = delete all packages in "./output/debs", "images" = delete "./output/images",
+: # "cache" = delete "./output/cache", "sources" = delete "./sources"
+: # "oldcache" = remove old cached rootfs except for the newest 8 files
REPOSITORY_INSTALL="" # comma-separated list of core modules which will be installed from repository
# "u-boot", "kernel", "bsp", "armbian-config", "armbian-firmware"
@@ -20,5 +24,5 @@ EXTERNAL_NEW="prebuilt" # compile and install or install prebuilt additional pac
INSTALL_HEADERS="" # install kernel headers package
LIB_TAG="master" # change to "branchname" to use any branch currently available.
USE_TORRENT="no" # use torrent network for faster toolchain and cache download
-DOWNLOAD_MIRROR="" # set to "china" to use mirrors.tuna.tsinghua.edu.cn
+DOWNLOAD_MIRROR="" # set to "china" to use chinese mirrors
CARD_DEVICE="" # device name /dev/sdx of your SD card to burn directly to the card when done
diff --git a/lib/functions/compilation/atf.sh b/lib/functions/compilation/atf.sh
index b241b5dfa..ff11d7ba8 100644
--- a/lib/functions/compilation/atf.sh
+++ b/lib/functions/compilation/atf.sh
@@ -4,19 +4,19 @@ compile_atf() {
fetch_from_repo "$ATFSOURCE" "$ATFDIR" "$ATFBRANCH" "yes"
fi
- if [[ $CLEAN_LEVEL == *make* ]]; then
- display_alert "Cleaning" "$ATFSOURCEDIR" "info"
+ if [[ $CLEAN_LEVEL == *make-atf* ]]; then
+ display_alert "Cleaning ATF tree - CLEAN_LEVEL contains 'make-atf'" "$ATFSOURCEDIR" "info"
(
- cd "${SRC}/cache/sources/${ATFSOURCEDIR}"
- make distclean 2>&1
+ cd "${SRC}/cache/sources/${ATFSOURCEDIR}" || exit_with_error "crazy about ${ATFSOURCEDIR}"
+ run_host_command_logged make distclean
)
+ else
+ display_alert "Not cleaning ATF tree, use CLEAN_LEVEL=make-atf if needed" "CLEAN_LEVEL=${CLEAN_LEVEL}" "debug"
fi
+ local atfdir="$SRC/cache/sources/$ATFSOURCEDIR"
if [[ $USE_OVERLAYFS == yes ]]; then
- local atfdir
atfdir=$(overlayfs_wrapper "wrap" "$SRC/cache/sources/$ATFSOURCEDIR" "atf_${LINUXFAMILY}_${BRANCH}")
- else
- local atfdir="$SRC/cache/sources/$ATFSOURCEDIR"
fi
cd "$atfdir" || exit
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 571bde957..249336e00 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -106,13 +106,15 @@ function kernel_prepare_git() {
}
function kernel_maybe_clean() {
- if [[ $CLEAN_LEVEL == *make* ]]; then
- display_alert "Cleaning" "$LINUXSOURCEDIR" "info"
+ if [[ $CLEAN_LEVEL == *make-kernel* ]]; then
+ display_alert "Cleaning Kernel tree - CLEAN_LEVEL contains 'make-kernel'" "$LINUXSOURCEDIR" "info"
(
cd "${kernel_work_dir}"
- make ARCH="${ARCHITECTURE}" clean > /dev/null 2>&1
+ run_host_command_logged make ARCH="${ARCHITECTURE}" clean
)
fasthash_debug "post make clean"
+ else
+ display_alert "Not cleaning Kernel tree; use CLEAN_LEVEL=make-kernel if needed" "CLEAN_LEVEL=${CLEAN_LEVEL}" "debug"
fi
}
diff --git a/lib/functions/compilation/uboot.sh b/lib/functions/compilation/uboot.sh
index 33415c2e2..05b8ea629 100644
--- a/lib/functions/compilation/uboot.sh
+++ b/lib/functions/compilation/uboot.sh
@@ -1,3 +1,15 @@
+function maybe_make_clean_uboot() {
+ if [[ $CLEAN_LEVEL == *make-uboot* ]]; then
+ display_alert "${uboot_prefix}Cleaning u-boot tree - CLEAN_LEVEL contains 'make-uboot'" "${BOOTSOURCEDIR}" "info"
+ (
+ cd "${SRC}/cache/sources/${BOOTSOURCEDIR}" || exit_with_error "crazy about ${BOOTSOURCEDIR}"
+ run_host_command_logged make clean
+ )
+ else
+ display_alert "${uboot_prefix}Not cleaning u-boot tree, use CLEAN_LEVEL=make-uboot if needed" "CLEAN_LEVEL=${CLEAN_LEVEL}" "debug"
+ fi
+}
+
# this receives version target uboot_name uboottempdir uboot_target_counter toolchain as variables.
function compile_uboot_target() {
local uboot_prefix="{u-boot:${uboot_target_counter}} "
@@ -9,15 +21,9 @@ function compile_uboot_target() {
# needed for multiple targets and for calling compile_uboot directly
display_alert "${uboot_prefix} Checking out to clean sources" "{$BOOTSOURCEDIR} for ${target_make}"
- git checkout -f -q HEAD
+ git checkout -f -q HEAD # @TODO: this assumes way too much. should call the wrapper again, not directly
- if [[ $CLEAN_LEVEL == *make* ]]; then
- display_alert "${uboot_prefix}Cleaning" "${BOOTSOURCEDIR}" "info"
- (
- cd "${SRC}/cache/sources/${BOOTSOURCEDIR}"
- make clean 2>&1
- )
- fi
+ maybe_make_clean_uboot
advanced_patch "u-boot" "$BOOTPATCHDIR" "$BOARD" "$target_patchdir" "$BRANCH" "${LINUXFAMILY}-${BOARD}-${BRANCH}"
@@ -102,13 +108,7 @@ compile_uboot() {
fi
# not optimal, but extra cleaning before overlayfs_wrapper should keep sources directory clean
- if [[ $CLEAN_LEVEL == *make* ]]; then
- display_alert "Cleaning" "$BOOTSOURCEDIR" "info"
- (
- cd "${SRC}/cache/sources/${BOOTSOURCEDIR}"
- make clean > /dev/null 2>&1
- )
- fi
+ maybe_make_clean_uboot
if [[ $USE_OVERLAYFS == yes ]]; then
local ubootdir
diff --git a/lib/functions/general/cleaning.sh b/lib/functions/general/cleaning.sh
index 4e67b5d52..72a6f4b1f 100644
--- a/lib/functions/general/cleaning.sh
+++ b/lib/functions/general/cleaning.sh
@@ -1,16 +1,21 @@
# cleaning <target>
#
+
# target: what to clean
-# "make" - "make clean" for selected kernel and u-boot
-# "debs" - delete output/debs for board&branch
+# "make-atf" = make clean for ATF, if it is built.
+# "make-uboot" = make clean for uboot, if it is built.
+# "make-kernel" = make clean for kernel, if it is built. very slow.
+# *important*: "make" by itself has disabled, since Armbian knows how to handle Make timestamping now.
+
+# "debs" = delete packages in "./output/debs" for current branch and family. causes rebuilds, hopefully cached.
# "ubootdebs" - delete output/debs for uboot&board&branch
-# "alldebs" - delete output/debs
-# "cache" - delete output/cache
-# "oldcache" - remove old output/cache
-# "images" - delete output/images
-# "sources" - delete output/sources
-#
-cleaning() {
+# "alldebs" = delete all packages in "./output/debs"
+# "images" = delete "./output/images"
+# "cache" = delete "./output/cache"
+# "sources" = delete "./sources"
+# "oldcache" = remove old cached rootfs except for the newest 8 files
+
+general_cleaning() {
case $1 in
debs) # delete ${DEB_STORAGE} for current branch and family
if [[ -d "${DEB_STORAGE}" ]]; then
@@ -55,7 +60,7 @@ cleaning() {
[[ -d "${DEST}"/images ]] && display_alert "Cleaning" "output/images" "info" && rm -rf "${DEST}"/images/*
;;
- sources) # delete output/sources and output/buildpkg
+ sources) # delete cache/sources and output/buildpkg
[[ -d "${SRC}"/cache/sources ]] && display_alert "Cleaning" "sources" "info" && rm -rf "${SRC}"/cache/sources/* "${DEST}"/buildpkg/*
;;
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index aae266091..8f051610f 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -45,10 +45,9 @@ function main_default_build_single() {
LOG_SECTION="fetch_and_build_host_tools" do_with_logging fetch_and_build_host_tools
fi
- for option in $(tr ',' ' ' <<< "${CLEAN_LEVEL}"); do
- if [[ $option != sources ]]; then
- LOG_SECTION="cleaning" do_with_logging cleaning "$option"
- #fasthash_debug "main_cleaning_armbian"
+ for cleaning_fragment in $(tr ',' ' ' <<< "${CLEAN_LEVEL}"); do
+ if [[ $cleaning_fragment != sources ]] && [[ $cleaning_fragment != make* ]]; then
+ LOG_SECTION="cleaning_${cleaning_fragment}" do_with_logging general_cleaning "${cleaning_fragment}"
fi
done
fi
From 39999ad4efc4854213d0b2164d999071684ec1ea Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 17 Mar 2022 21:16:21 +0100
Subject: [PATCH] armbian-next: refactor `prepare_host`, give `apt-cacher-ng`
some much needed attention
- library dir for host-related stuff, pull it out of "general" finally
---
lib/functions/host/apt-cacher-ng.sh | 74 +++++++++
lib/functions/host/basic-deps.sh | 30 ++++
lib/functions/host/external-toolchains.sh | 54 ++++++
lib/functions/host/host-utils.sh | 65 ++++++++
.../{general/host.sh => host/prepare-host.sh} | 185 +++------------------
lib/functions/logging/runners.sh | 3 +-
lib/functions/rootfs/create-cache.sh | 24 ++-
lib/library-functions.sh | 48 +++++-
8 files changed, 303 insertions(+), 180 deletions(-)
diff --git a/lib/functions/host/apt-cacher-ng.sh b/lib/functions/host/apt-cacher-ng.sh
new file mode 100644
index 000000000..a917f6cb1
--- /dev/null
+++ b/lib/functions/host/apt-cacher-ng.sh
@@ -0,0 +1,74 @@
+# Management of apt-cacher-ng aka acng
+
+function acng_configure_and_restart_acng() {
+ [[ $NO_APT_CACHER == yes ]] && return 0 # don't if told not to. NO_something=yes is very confusing, but kept for historical reasons
+ [[ "${APT_PROXY_ADDR:-localhost:3142}" != "localhost:3142" ]] && return 0 # also not if acng not local to builder machine
+
+ display_alert "Preparing acng configuration" "apt-cacher-ng" "info"
+
+ run_host_command_logged systemctl stop apt-cacher-ng || true # ignore errors, it might already be stopped.
+
+ [[ ! -f /etc/apt-cacher-ng/acng.conf.orig.pre.armbian ]] && cp /etc/apt-cacher-ng/acng.conf /etc/apt-cacher-ng/acng.conf.orig.pre.armbian
+
+ cat <<- ACNG_CONFIG > /etc/apt-cacher-ng/acng.conf
+ CacheDir: ${APT_CACHER_NG_CACHE_DIR:-/var/cache/apt-cacher-ng}
+ LogDir: /var/log/apt-cacher-ng
+ SupportDir: /usr/lib/apt-cacher-ng
+ LocalDirs: acng-doc /usr/share/doc/apt-cacher-ng
+ ReportPage: acng-report.html
+ ExThreshold: 4
+
+ # Remapping is disabled, many times we hit broken mirrors due to this.
+ #Remap-debrep: file:deb_mirror*.gz /debian ; file:backends_debian # Debian Archives
+ #Remap-uburep: file:ubuntu_mirrors /ubuntu ; file:backends_ubuntu # Ubuntu Archives
+
+ # Turn debug logging and verbosity
+ Debug: 7
+ VerboseLog: 1
+
+ # Connections tuning.
+ MaxStandbyConThreads: 10
+ DlMaxRetries: 50
+ NetworkTimeout: 60
+ FastTimeout: 20
+ ConnectProto: v4 v6
+ RedirMax: 15
+ ReuseConnections: 1
+
+ # Allow HTTPS CONNECT, although this is not ideal, since packages are not actually cached then. Disabled for now.
+ # PassThroughPattern: .*
+ ACNG_CONFIG
+
+ # Ensure correct permissions on the directories
+ mkdir -p "${APT_CACHER_NG_CACHE_DIR:-/var/cache/apt-cacher-ng}" /var/log/apt-cacher-ng
+ chown apt-cacher-ng:apt-cacher-ng "${APT_CACHER_NG_CACHE_DIR:-/var/cache/apt-cacher-ng}" /var/log/apt-cacher-ng
+
+ if [[ "${APT_CACHER_NG_CLEAR_LOGS}" == "yes" ]]; then
+ display_alert "Clearing acng logs" "apt-cacher-ng logs cleaning" "debug"
+ run_host_command_logged rm -rfv /var/log/apt-cacher-ng/*
+ fi
+
+ run_host_command_logged systemctl start apt-cacher-ng
+ run_host_command_logged systemctl status apt-cacher-ng
+}
+
+function acng_check_status_or_restart() {
+ [[ $NO_APT_CACHER != yes ]] && return 0 # don't if told not to
+ [[ "${APT_PROXY_ADDR:-localhost:3142}" != "localhost:3142" ]] && return 0 # also not if acng not local to builder machine
+
+ if ! systemctl -q is-active apt-cacher-ng.service; then
+ display_alert "ACNG systemd service is not active" "restarting apt-cacher-ng" "warn"
+ acng_configure_and_restart_acng
+ fi
+
+ if ! wget -q --timeout=10 --output-document=/dev/null http://localhost:3142/acng-report.html; then
+ display_alert "ACNG is not correctly listening for requests" "restarting apt-cacher-ng" "warn"
+ acng_configure_and_restart_acng
+ if ! wget -q --timeout=10 --output-document=/dev/null http://localhost:3142/acng-report.html; then
+ exit_with_error "ACNG is not correctly listening for requests" "apt-cacher-ng NOT WORKING"
+ fi
+ fi
+
+ display_alert "apt-cacher-ng running correctly" "apt-cacher-ng OK" "debug"
+
+}
diff --git a/lib/functions/host/basic-deps.sh b/lib/functions/host/basic-deps.sh
new file mode 100644
index 000000000..fff94fbad
--- /dev/null
+++ b/lib/functions/host/basic-deps.sh
@@ -0,0 +1,30 @@
+# prepare_host_basic
+#
+# * installs only basic packages
+#
+prepare_host_basic() {
+
+ # command:package1 package2 ...
+ # list of commands that are neeeded:packages where this command is
+ local check_pack install_pack
+ local checklist=(
+ "dialog:dialog"
+ "fuser:psmisc"
+ "getfacl:acl"
+ "uuid:uuid uuid-runtime"
+ "curl:curl"
+ "gpg:gnupg"
+ "gawk:gawk"
+ )
+
+ for check_pack in "${checklist[@]}"; do
+ if ! which ${check_pack%:*} > /dev/null; then local install_pack+=${check_pack#*:}" "; fi
+ done
+
+ if [[ -n $install_pack ]]; then
+ display_alert "Installing basic packages" "$install_pack"
+ # @TODO: wait, why sudo? we should already be sudo'ed when this executes.
+ sudo bash -c "apt-get -qq update && apt-get install -qq -y --no-install-recommends $install_pack"
+ fi
+
+}
diff --git a/lib/functions/host/external-toolchains.sh b/lib/functions/host/external-toolchains.sh
new file mode 100644
index 000000000..f2db2d6ea
--- /dev/null
+++ b/lib/functions/host/external-toolchains.sh
@@ -0,0 +1,54 @@
+# This is mostly deprecated, since SKIP_EXTERNAL_TOOLCHAINS=yes by default.
+
+function download_external_toolchains() {
+ # build aarch64
+ if [[ $(dpkg --print-architecture) == amd64 ]]; then
+ if [[ "${SKIP_EXTERNAL_TOOLCHAINS}" != "yes" ]]; then
+
+ # bind mount toolchain if defined
+ if [[ -d "${ARMBIAN_CACHE_TOOLCHAIN_PATH}" ]]; then
+ mountpoint -q "${SRC}"/cache/toolchain && umount -l "${SRC}"/cache/toolchain
+ mount --bind "${ARMBIAN_CACHE_TOOLCHAIN_PATH}" "${SRC}"/cache/toolchain
+ fi
+
+ display_alert "Checking for external GCC compilers" "" "info"
+ # download external Linaro compiler and missing special dependencies since they are needed for certain sources
+
+ local toolchains=(
+ "${ARMBIAN_MIRROR}/_toolchain/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz"
+ "${ARMBIAN_MIRROR}/_toolchain/gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz"
+ "${ARMBIAN_MIRROR}/_toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux.tar.xz"
+ "${ARMBIAN_MIRROR}/_toolchain/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi.tar.xz"
+ "${ARMBIAN_MIRROR}/_toolchain/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz"
+ "${ARMBIAN_MIRROR}/_toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz"
+ "${ARMBIAN_MIRROR}/_toolchains/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz"
+ "${ARMBIAN_MIRROR}/_toolchain/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf.tar.xz"
+ "${ARMBIAN_MIRROR}/_toolchain/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz"
+ )
+
+ USE_TORRENT_STATUS=${USE_TORRENT}
+ USE_TORRENT="no"
+ for toolchain in ${toolchains[@]}; do
+ download_and_verify "_toolchain" "${toolchain##*/}"
+ done
+ USE_TORRENT=${USE_TORRENT_STATUS}
+
+ rm -rf "${SRC}"/cache/toolchain/*.tar.xz*
+ local existing_dirs=($(ls -1 "${SRC}"/cache/toolchain))
+ for dir in ${existing_dirs[@]}; do
+ local found=no
+ for toolchain in ${toolchains[@]}; do
+ local filename=${toolchain##*/}
+ local dirname=${filename//.tar.xz/}
+ [[ $dir == $dirname ]] && found=yes
+ done
+ if [[ $found == no ]]; then
+ display_alert "Removing obsolete toolchain" "$dir"
+ rm -rf "${SRC}/cache/toolchain/${dir}"
+ fi
+ done
+ else
+ display_alert "Ignoring toolchains" "SKIP_EXTERNAL_TOOLCHAINS: ${SKIP_EXTERNAL_TOOLCHAINS}" "info"
+ fi
+ fi
+}
diff --git a/lib/functions/host/host-utils.sh b/lib/functions/host/host-utils.sh
new file mode 100644
index 000000000..20b11e49c
--- /dev/null
+++ b/lib/functions/host/host-utils.sh
@@ -0,0 +1,65 @@
+function fetch_and_build_host_tools() {
+ call_extension_method "fetch_sources_tools" <<- 'FETCH_SOURCES_TOOLS'
+ *fetch host-side sources needed for tools and build*
+ Run early to fetch_from_repo or otherwise obtain sources for needed tools.
+ FETCH_SOURCES_TOOLS
+
+ call_extension_method "build_host_tools" <<- 'BUILD_HOST_TOOLS'
+ *build needed tools for the build, host-side*
+ After sources are fetched, build host-side tools needed for the build.
+ BUILD_HOST_TOOLS
+
+}
+
+# wait_for_package_manager
+#
+# * installation will break if we try to install when package manager is running
+#
+wait_for_package_manager() {
+ # exit if package manager is running in the back
+ while true; do
+ if [[ "$(
+ fuser /var/lib/dpkg/lock 2> /dev/null
+ echo $?
+ )" != 1 && "$(
+ fuser /var/lib/dpkg/lock-frontend 2> /dev/null
+ echo $?
+ )" != 1 ]]; then
+ display_alert "Package manager is running in the background." "Please wait! Retrying in 30 sec" "wrn"
+ sleep 30
+ else
+ break
+ fi
+ done
+}
+
+# Install the whitespace-delimited packages listed in the first parameter, in the host (not chroot).
+# It handles correctly the case where all wanted packages are already installed, and in that case does nothing.
+# If packages are to be installed, it does an apt-get update first.
+function install_host_side_packages() {
+ declare wanted_packages_string
+ declare -a currently_installed_packages missing_packages
+ wanted_packages_string=${*}
+ missing_packages=()
+ # shellcheck disable=SC2207 # I wanna split, thanks.
+ currently_installed_packages=($(dpkg-query --show --showformat='${Package} '))
+ for PKG_TO_INSTALL in ${wanted_packages_string}; do
+ # shellcheck disable=SC2076 # I wanna match literally, thanks.
+ if [[ ! " ${currently_installed_packages[*]} " =~ " ${PKG_TO_INSTALL} " ]]; then
+ display_alert "Should install package" "${PKG_TO_INSTALL}"
+ missing_packages+=("${PKG_TO_INSTALL}")
+ fi
+ done
+
+ if [[ ${#missing_packages[@]} -gt 0 ]]; then
+ display_alert "Updating apt host-side for installing packages" "${#missing_packages[@]} packages" "info"
+ host_apt_get update
+ display_alert "Installing host-side packages" "${missing_packages[*]}" "info"
+ host_apt_get_install "${missing_packages[@]}"
+ else
+ display_alert "All host-side dependencies/packages already installed." "Skipping host-hide install" "debug"
+ fi
+
+ unset currently_installed_packages
+ return 0
+}
diff --git a/lib/functions/general/host.sh b/lib/functions/host/prepare-host.sh
similarity index 56%
rename from lib/functions/general/host.sh
rename to lib/functions/host/prepare-host.sh
index 925e0d3aa..cc7d1d48f 100644
--- a/lib/functions/general/host.sh
+++ b/lib/functions/host/prepare-host.sh
@@ -1,33 +1,3 @@
-# prepare_host_basic
-#
-# * installs only basic packages
-#
-prepare_host_basic() {
-
- # command:package1 package2 ...
- # list of commands that are neeeded:packages where this command is
- local check_pack install_pack
- local checklist=(
- "dialog:dialog"
- "fuser:psmisc"
- "getfacl:acl"
- "uuid:uuid uuid-runtime"
- "curl:curl"
- "gpg:gnupg"
- "gawk:gawk"
- )
-
- for check_pack in "${checklist[@]}"; do
- if ! which ${check_pack%:*} > /dev/null; then local install_pack+=${check_pack#*:}" "; fi
- done
-
- if [[ -n $install_pack ]]; then
- display_alert "Installing basic packages" "$install_pack"
- sudo bash -c "apt-get -qq update && apt-get install -qq -y --no-install-recommends $install_pack"
- fi
-
-}
-
# prepare_host
#
# * checks and installs necessary packages
@@ -139,10 +109,11 @@ prepare_host() {
# Skip verification if you are working offline
if ! $offline; then
- # warning: apt-cacher-ng will fail if installed and used both on host and in
- # container/chroot environment with shared network
+ # warning: apt-cacher-ng will fail if installed and used both on host and in container/chroot environment with shared network
# set NO_APT_CACHER=yes to prevent installation errors in such case
- if [[ $NO_APT_CACHER != yes ]]; then host_dependencies+=("apt-cacher-ng"); fi
+ if [[ $NO_APT_CACHER != yes ]]; then
+ host_dependencies+=("apt-cacher-ng")
+ fi
export EXTRA_BUILD_DEPS=""
call_extension_method "add_host_dependencies" <<- 'ADD_HOST_DEPENDENCIES'
@@ -150,17 +121,20 @@ prepare_host() {
you can add packages to install, space separated, to ${EXTRA_BUILD_DEPS} here.
ADD_HOST_DEPENDENCIES
- # shellcheck disable=SC2206 # I wanna expand. later will convert to proper array
- if [ -n "${EXTRA_BUILD_DEPS}" ]; then host_dependencies+=(${EXTRA_BUILD_DEPS}); fi
+ if [ -n "${EXTRA_BUILD_DEPS}" ]; then
+ # shellcheck disable=SC2206 # I wanna expand. @TODO: later will convert to proper array
+ host_dependencies+=(${EXTRA_BUILD_DEPS})
+ fi
display_alert "Installing build dependencies"
- # don't prompt for apt cacher selection
+
+ # don't prompt for apt cacher selection. this is to skip the prompt only, since we'll manage acng config later.
sudo echo "apt-cacher-ng apt-cacher-ng/tunnelenable boolean false" | sudo debconf-set-selections
# This handles the wanted list in $host_dependencies, updates apt only if needed
install_host_side_packages "${host_dependencies[@]}"
- update-ccache-symlinks
+ run_host_command_logged update-ccache-symlinks
export FINAL_HOST_DEPS="${host_dependencies[*]}"
call_extension_method "host_dependencies_ready" <<- 'HOST_DEPENDENCIES_READY'
@@ -170,13 +144,16 @@ prepare_host() {
are installed at this point. The system clock has not yet been synced.
HOST_DEPENDENCIES_READY
+ # Manage apt-cacher-ng
+ acng_configure_and_restart_acng
+
# sync clock
if [[ $SYNC_CLOCK != no ]]; then
display_alert "Syncing clock" "host" "info"
- ntpdate -s "${NTP_SERVER:-pool.ntp.org}"
+ run_host_command_logged ntpdate "${NTP_SERVER:-pool.ntp.org}"
fi
- # create directory structure
+ # create directory structure # @TODO: this should be close to DEST, otherwise super-confusing
mkdir -p "${SRC}"/{cache,output} "${USERPATCHES_PATH}"
if [[ -n $SUDO_USER ]]; then
chgrp --quiet sudo cache output "${USERPATCHES_PATH}"
@@ -189,56 +166,8 @@ prepare_host() {
# @TODO: original: mkdir -p "${DEST}"/debs-beta/extra "${DEST}"/debs/extra "${DEST}"/{config,debug,patch} "${USERPATCHES_PATH}"/overlay "${SRC}"/cache/{sources,hash,hash-beta,toolchain,utility,rootfs} "${SRC}"/.tmp
mkdir -p "${USERPATCHES_PATH}"/overlay "${SRC}"/cache/{sources,hash,hash-beta,toolchain,utility,rootfs} "${SRC}"/.tmp
- # build aarch64
- if [[ $(dpkg --print-architecture) == amd64 ]]; then
- if [[ "${SKIP_EXTERNAL_TOOLCHAINS}" != "yes" ]]; then
-
- # bind mount toolchain if defined
- if [[ -d "${ARMBIAN_CACHE_TOOLCHAIN_PATH}" ]]; then
- mountpoint -q "${SRC}"/cache/toolchain && umount -l "${SRC}"/cache/toolchain
- mount --bind "${ARMBIAN_CACHE_TOOLCHAIN_PATH}" "${SRC}"/cache/toolchain
- fi
-
- display_alert "Checking for external GCC compilers" "" "info"
- # download external Linaro compiler and missing special dependencies since they are needed for certain sources
-
- local toolchains=(
- "${ARMBIAN_MIRROR}/_toolchain/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz"
- "${ARMBIAN_MIRROR}/_toolchain/gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz"
- "${ARMBIAN_MIRROR}/_toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux.tar.xz"
- "${ARMBIAN_MIRROR}/_toolchain/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi.tar.xz"
- "${ARMBIAN_MIRROR}/_toolchain/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz"
- "${ARMBIAN_MIRROR}/_toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz"
- "${ARMBIAN_MIRROR}/_toolchains/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz"
- "${ARMBIAN_MIRROR}/_toolchain/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf.tar.xz"
- "${ARMBIAN_MIRROR}/_toolchain/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz"
- )
-
- USE_TORRENT_STATUS=${USE_TORRENT}
- USE_TORRENT="no"
- for toolchain in ${toolchains[@]}; do
- download_and_verify "_toolchain" "${toolchain##*/}"
- done
- USE_TORRENT=${USE_TORRENT_STATUS}
-
- rm -rf "${SRC}"/cache/toolchain/*.tar.xz*
- local existing_dirs=($(ls -1 "${SRC}"/cache/toolchain))
- for dir in ${existing_dirs[@]}; do
- local found=no
- for toolchain in ${toolchains[@]}; do
- local filename=${toolchain##*/}
- local dirname=${filename//.tar.xz/}
- [[ $dir == $dirname ]] && found=yes
- done
- if [[ $found == no ]]; then
- display_alert "Removing obsolete toolchain" "$dir"
- rm -rf "${SRC}/cache/toolchain/${dir}"
- fi
- done
- else
- display_alert "Ignoring toolchains" "SKIP_EXTERNAL_TOOLCHAINS: ${SKIP_EXTERNAL_TOOLCHAINS}" "info"
- fi
- fi
+ # Mostly deprecated.
+ download_external_toolchains
fi # check offline
@@ -252,8 +181,9 @@ prepare_host() {
fi
fi
- [[ ! -f "${USERPATCHES_PATH}"/customize-image.sh ]] && cp "${SRC}"/config/templates/customize-image.sh.template "${USERPATCHES_PATH}"/customize-image.sh
+ [[ ! -f "${USERPATCHES_PATH}"/customize-image.sh ]] && run_host_command_logged cp -pv "${SRC}"/config/templates/customize-image.sh.template "${USERPATCHES_PATH}"/customize-image.sh
+ # @TODO: what is this, and why?
if [[ ! -f "${USERPATCHES_PATH}"/README ]]; then
rm -f "${USERPATCHES_PATH}"/readme.txt
echo 'Please read documentation about customizing build configuration' > "${USERPATCHES_PATH}"/README
@@ -263,78 +193,13 @@ prepare_host() {
find "${SRC}"/patch -maxdepth 2 -type d ! -name . | sed "s%/.*patch%/$USERPATCHES_PATH%" | xargs mkdir -p
fi
- # check free space (basic)
- local freespace=$(findmnt --target "${SRC}" -n -o AVAIL -b 2> /dev/null) # in bytes
- if [[ -n $freespace && $(($freespace / 1073741824)) -lt 10 ]]; then
- display_alert "Low free space left" "$(($freespace / 1073741824)) GiB" "wrn"
+ # check free space (basic) @TODO probably useful to refactor and implement in multiple spots.
+ local free_space_bytes
+ free_space_bytes=$(findmnt --target "${SRC}" -n -o AVAIL -b 2> /dev/null) # in bytes
+ if [[ -n $free_space_bytes && $((free_space_bytes / 1073741824)) -lt 10 ]]; then
+ display_alert "Low free space left" "$((free_space_bytes / 1073741824)) GiB" "wrn"
# pause here since dialog-based menu will hide this message otherwise
echo -e "Press \e[0;33m<Ctrl-C>\x1B[0m to abort compilation, \e[0;33m<Enter>\x1B[0m to ignore and continue"
read # @TODO: this fails if stdin is not a tty, or just hangs
fi
}
-
-# wait_for_package_manager
-#
-# * installation will break if we try to install when package manager is running
-#
-wait_for_package_manager() {
- # exit if package manager is running in the back
- while true; do
- if [[ "$(
- fuser /var/lib/dpkg/lock 2> /dev/null
- echo $?
- )" != 1 && "$(
- fuser /var/lib/dpkg/lock-frontend 2> /dev/null
- echo $?
- )" != 1 ]]; then
- display_alert "Package manager is running in the background." "Please wait! Retrying in 30 sec" "wrn"
- sleep 30
- else
- break
- fi
- done
-}
-
-function fetch_and_build_host_tools() {
- call_extension_method "fetch_sources_tools" <<- 'FETCH_SOURCES_TOOLS'
- *fetch host-side sources needed for tools and build*
- Run early to fetch_from_repo or otherwise obtain sources for needed tools.
- FETCH_SOURCES_TOOLS
-
- call_extension_method "build_host_tools" <<- 'BUILD_HOST_TOOLS'
- *build needed tools for the build, host-side*
- After sources are fetched, build host-side tools needed for the build.
- BUILD_HOST_TOOLS
-
-}
-
-# Install the whitespace-delimited packages listed in the first parameter, in the host (not chroot).
-# It handles correctly the case where all wanted packages are already installed, and in that case does nothing.
-# If packages are to be installed, it does an apt-get update first.
-function install_host_side_packages() {
- declare wanted_packages_string
- declare -a currently_installed_packages missing_packages
- wanted_packages_string=${*}
- missing_packages=()
- # shellcheck disable=SC2207 # I wanna split, thanks.
- currently_installed_packages=($(dpkg-query --show --showformat='${Package} '))
- for PKG_TO_INSTALL in ${wanted_packages_string}; do
- # shellcheck disable=SC2076 # I wanna match literally, thanks.
- if [[ ! " ${currently_installed_packages[*]} " =~ " ${PKG_TO_INSTALL} " ]]; then
- display_alert "Should install package" "${PKG_TO_INSTALL}"
- missing_packages+=("${PKG_TO_INSTALL}")
- fi
- done
-
- if [[ ${#missing_packages[@]} -gt 0 ]]; then
- display_alert "Updating apt host-side for installing packages" "${#missing_packages[@]} packages" "info"
- host_apt_get update
- display_alert "Installing host-side packages" "${missing_packages[*]}" "info"
- host_apt_get_install "${missing_packages[@]}"
- else
- display_alert "All host-side dependencies/packages already installed." "Skipping host-hide install" "debug"
- fi
-
- unset currently_installed_packages
- return 0
-}
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index d4070c268..42610621d 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -8,13 +8,14 @@ function chroot_sdcard_apt_get_install_download_only() {
}
function chroot_sdcard_apt_get() {
+ acng_check_status_or_restart # make sure apt-cacher-ng is running OK.
+
local -a apt_params=("-${APT_OPTS:-y}")
[[ $NO_APT_CACHER != yes ]] && apt_params+=(
-o "Acquire::http::Proxy=\"http://${APT_PROXY_ADDR:-localhost:3142}\""
-o "Acquire::http::Proxy::localhost=\"DIRECT\""
)
apt_params+=(-o "Dpkg::Use-Pty=0") # Please be quiet
- # IMPORTANT: this function returns the exit code of last statement, in this case chroot (which gets its result from bash which calls apt-get)
chroot_sdcard DEBIAN_FRONTEND=noninteractive apt-get "${apt_params[@]}" "$@"
}
diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh
index 9f526d9b9..3dc4feaaf 100644
--- a/lib/functions/rootfs/create-cache.sh
+++ b/lib/functions/rootfs/create-cache.sh
@@ -92,17 +92,14 @@ get_or_create_rootfs_cache_chroot_sdcard() {
fi
mount_chroot "$SDCARD"
-} #############################################################################
+}
function create_new_rootfs_cache() {
- # @TODO: unify / remove this. distribuitions has the good stuff.
- # stage: debootstrap base system
+ # this is different between debootstrap and regular apt-get; here we use acng as a prefix to the real repo
+ local debootstrap_apt_mirror="http://${APT_MIRROR}"
if [[ $NO_APT_CACHER != yes ]]; then
- # apt-cacher-ng apt-get proxy parameter
- local apt_extra="-o Acquire::http::Proxy=\"http://${APT_PROXY_ADDR:-localhost:3142}\""
- local apt_mirror="http://${APT_PROXY_ADDR:-localhost:3142}/$APT_MIRROR"
- else
- local apt_mirror="http://$APT_MIRROR"
+ local debootstrap_apt_mirror="http://${APT_PROXY_ADDR:-localhost:3142}/${APT_MIRROR}"
+ acng_check_status_or_restart
fi
display_alert "Installing base system" "Stage 1/2" "info"
@@ -113,17 +110,18 @@ function create_new_rootfs_cache() {
${PACKAGE_LIST_EXCLUDE:+ --exclude="${PACKAGE_LIST_EXCLUDE// /,}"} # exclude some
"--arch=${ARCH}" # the arch
"--components=${DEBOOTSTRAP_COMPONENTS}" # from aggregation?
- "--foreign" "${RELEASE}" "${SDCARD}/" "${apt_mirror}" # path and mirror
+ "--foreign" "${RELEASE}" "${SDCARD}/" "${debootstrap_apt_mirror}" # path and mirror
)
- debootstrap "${deboostrap_arguments[@]}" 2>&1 || { # invoke debootstrap, stderr to stdout.
+
+ run_host_command_logged debootstrap "${deboostrap_arguments[@]}" || {
exit_with_error "Debootstrap first stage failed" "${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL}"
}
- [[ ! -f $SDCARD/debootstrap/debootstrap ]] && exit_with_error "Debootstrap first stage did not produce marker file"
+ [[ ! -f ${SDCARD}/debootstrap/debootstrap ]] && exit_with_error "Debootstrap first stage did not produce marker file"
- cp "/usr/bin/$QEMU_BINARY" "$SDCARD/usr/bin/" # @TODO: who cleans this up later?
+ run_host_command_logged cp -pv "/usr/bin/$QEMU_BINARY" "$SDCARD/usr/bin/" # @TODO: who cleans this up later?
mkdir -p "${SDCARD}/usr/share/keyrings/"
- cp /usr/share/keyrings/*-archive-keyring.gpg "${SDCARD}/usr/share/keyrings/"
+ run_host_command_logged cp -pv /usr/share/keyrings/*-archive-keyring.gpg "${SDCARD}/usr/share/keyrings/"
display_alert "Installing base system" "Stage 2/2" "info"
export MSG_IF_ERROR="Debootstrap second stage failed ${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL}"
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index fc06a5e35..a7cfb652b 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -240,18 +240,54 @@ source "${SRC}"/lib/functions/general/git.sh
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/general/host.sh
-# shellcheck source=lib/functions/general/host.sh
-source "${SRC}"/lib/functions/general/host.sh
+### lib/functions/general/repo.sh
+# shellcheck source=lib/functions/general/repo.sh
+source "${SRC}"/lib/functions/general/repo.sh
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/general/repo.sh
-# shellcheck source=lib/functions/general/repo.sh
-source "${SRC}"/lib/functions/general/repo.sh
+### lib/functions/host/apt-cacher-ng.sh
+# shellcheck source=lib/functions/host/apt-cacher-ng.sh
+source "${SRC}"/lib/functions/host/apt-cacher-ng.sh
+
+# no errors tolerated. invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/host/basic-deps.sh
+# shellcheck source=lib/functions/host/basic-deps.sh
+source "${SRC}"/lib/functions/host/basic-deps.sh
+
+# no errors tolerated. invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/host/external-toolchains.sh
+# shellcheck source=lib/functions/host/external-toolchains.sh
+source "${SRC}"/lib/functions/host/external-toolchains.sh
+
+# no errors tolerated. invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/host/host-utils.sh
+# shellcheck source=lib/functions/host/host-utils.sh
+source "${SRC}"/lib/functions/host/host-utils.sh
+
+# no errors tolerated. invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/host/prepare-host.sh
+# shellcheck source=lib/functions/host/prepare-host.sh
+source "${SRC}"/lib/functions/host/prepare-host.sh
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
From 2c4ee50aabed7ad126f7ca80b870077672371a5d Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 9 Mar 2022 13:20:25 +0100
Subject: [PATCH] armbian-next: hostdeps: all toolchains via
`crossbuild-essential-arm64`/`armhf`/`amd64`
- trying to sort out hostdeps for Jammy [WiP]
---
lib/functions/general/host.sh | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/lib/functions/general/host.sh b/lib/functions/general/host.sh
index aefa2d236..925e0d3aa 100644
--- a/lib/functions/general/host.sh
+++ b/lib/functions/general/host.sh
@@ -58,20 +58,30 @@ prepare_host() {
# packages list for host
# NOTE: please sync any changes here with the Dockerfile and Vagrantfile
declare -a host_dependencies=(
- acl aptly aria2 bc binfmt-support bison btrfs-progs
- build-essential ca-certificates ccache cpio cryptsetup curl
+ # big bag of stuff from before
+ acl aptly bc binfmt-support bison btrfs-progs
+ build-essential ca-certificates ccache cpio cryptsetup
debian-archive-keyring debian-keyring debootstrap device-tree-compiler
dialog dirmngr dosfstools dwarves f2fs-tools fakeroot flex gawk
- gcc-arm-linux-gnueabihf
- gcc-arm-linux-gnueabi gcc-arm-none-eabi
- gdisk gnupg1 gpg imagemagick jq kmod libbison-dev
- libc6-dev-armhf-cross libelf-dev libfdt-dev libfile-fcntllock-perl
- libfl-dev liblz4-tool libncurses-dev libpython2.7-dev libssl-dev
- libusb-1.0-0-dev linux-base locales lzop ncurses-base ncurses-term
- nfs-kernel-server ntpdate p7zip-full parted patchutils pigz pixz pbzip2
+ gnupg gpg imagemagick jq kmod libbison-dev
+ libelf-dev libfdt-dev libfile-fcntllock-perl
+ libfl-dev liblz4-tool libncurses-dev libssl-dev
+ libusb-1.0-0-dev linux-base locales ncurses-base ncurses-term
+ ntpdate patchutils
pkg-config pv python3-dev python3-distutils qemu-user-static rsync swig
- systemd-container u-boot-tools udev unzip uuid-dev wget whiptail zip
- zlib1g-dev file ccze colorized-logs tree
+ systemd-container u-boot-tools udev uuid-dev whiptail
+ zlib1g-dev
+
+ # non-mess below?
+ file ccze colorized-logs tree # logging utilities
+ unzip zip p7zip-full pigz pixz pbzip2 lzop # compressors et al
+ parted gdisk # partition tools
+ aria2 curl wget # downloaders et al
+
+ # toolchains. NEW: using metapackages, allow us to have same list of all arches; brings both C and C++ compilers
+ crossbuild-essential-armhf
+ crossbuild-essential-arm64
+ crossbuild-essential-amd64
)
if [[ $(dpkg --print-architecture) == amd64 ]]; then
@@ -86,15 +96,6 @@ prepare_host() {
exit_with_error "Running this tool on non x86_64 or arm64 build host is not supported"
fi
- # Add support for Ubuntu 20.04, 21.04 and Mint 20.x
- if [[ $HOSTRELEASE =~ ^(focal|impish|hirsute|ulyana|ulyssa|bullseye|uma)$ ]]; then
- host_dependencies+=(python2 python3)
- ln -fs /usr/bin/python2.7 /usr/bin/python2
- ln -fs /usr/bin/python2.7 /usr/bin/python
- else
- host_dependencies+=("python" "libpython-dev")
- fi
-
display_alert "Build host OS release" "${HOSTRELEASE:-(unknown)}" "info"
# Ubuntu 21.04.x (Hirsute) x86_64 is the only fully supported host OS release
From c8a9f3aca890ed098b160bd060f11042d21ee711 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 17 Mar 2022 16:19:49 +0100
Subject: [PATCH] armbian-next: remove `eatmydata` usage, leftover from failed
tries to make git faster
---
lib/functions/general/git.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index 2e51752bd..3af8a6b3e 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -8,7 +8,7 @@ improved_git() {
local delay=10
local count=0
while [ $count -lt $retries ]; do
- run_host_command_logged_raw eatmydata "$real_git" --no-pager "$@" && return 0 # this gobbles up errors, but returns if OK, so everything after is error
+ run_host_command_logged_raw "$real_git" --no-pager "$@" && return 0 # this gobbles up errors, but returns if OK, so everything after is error
count=$((count + 1))
display_alert "improved_git try $count failed, retrying in ${delay} seconds" "git $*" "warn"
sleep $delay
@@ -19,7 +19,7 @@ improved_git() {
# Not improved, just regular, but logged "correctly".
regular_git() {
- run_host_command_logged_raw eatmydata -- git --no-pager "$@"
+ run_host_command_logged_raw git --no-pager "$@"
}
# avoid repeating myself too much
From 5d4c5aa9320ab317f540415ddb5403538630bcfb Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 16 Mar 2022 03:13:29 +0100
Subject: [PATCH] armbian-next: fix git origin check, recreate working copy if
origin does not match
- fix cold bundle https download progress reporting
---
lib/functions/general/git.sh | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index 8194e4758..2e51752bd 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -84,20 +84,32 @@ fetch_from_repo() {
display_alert "Git working dir" "${git_work_dir}" "git"
- # "Sanity check" since we only support one "origin"
- if [[ "$(git rev-parse --git-dir)" == ".git" && "$url" != *"$(git remote get-url origin | sed 's/^.*@//' | sed 's/^.*\/\///')" ]]; then
- exit_with_error "Remote URL does not match. Stopping!" "${git_work_dir} $dir $ref_name" "warn"
+ local expected_origin_url actual_origin_url
+ expected_origin_url="$(echo -n "${url}" | sed 's/^.*@//' | sed 's/^.*\/\///')"
+
+ # Make sure the origin matches what is expected. If it doesn't, clean up and start again.
+ if [[ "$(git rev-parse --git-dir)" == ".git" ]]; then
+ actual_origin_url="$(git config remote.origin.url | sed 's/^.*@//' | sed 's/^.*\/\///')"
+ if [[ "${expected_origin_url}" != "${actual_origin_url}" ]]; then
+ display_alert "Remote git URL does not match, deleting working copy" "${git_work_dir} expected: '${expected_origin_url}' actual: '${actual_origin_url}'" "warn"
+ cd "${SRC}" || exit 3 # free up cwd
+ run_host_command_logged rm -rf "${git_work_dir}" # delete the dir
+ mkdir -p "${git_work_dir}" || exit_with_error "No path or no write permission" "${git_work_dir}" # recreate
+ cd "${git_work_dir}" || exit #reset cwd
+ fi
fi
local do_warmup_remote="no" do_cold_bundle="no" do_add_origin="no"
if [[ "$(git rev-parse --git-dir)" != ".git" ]]; then
+ # Dir is not a git working copy. Make it so.
display_alert "Creating local copy" "$dir $ref_name"
regular_git init -q --initial-branch="armbian_unused_initial_branch" .
offline=false # Force online, we'll need to fetch.
do_add_origin="yes" # Just created the repo, it needs an origin later.
do_warmup_remote="yes" # Just created the repo, mark it as ready to receive the warm remote if exists.
do_cold_bundle="yes" # Just created the repo, mark it as ready to receive a cold bundle if that is available.
+ # @TODO: possibly hang a cleanup handler here: if this fails, ${git_work_dir} should be removed.
fi
local changed=false
@@ -166,7 +178,7 @@ fetch_from_repo() {
display_alert "Cleaning git dir" "$(git status -s 2> /dev/null | wc -l) files" # working directory is not clean, show it
#fasthash_debug "before git checkout of $dir $ref_name" # fasthash interested in this
- regular_git checkout -f -q "${checkout_from}" # Return the files that are tracked by git to the initial state.
+ regular_git checkout -f -q "${checkout_from}" # Return the files that are tracked by git to the initial state.
#fasthash_debug "before git clean of $dir $ref_name"
regular_git clean -q -d -f # Files that are not tracked by git and were added when the patch was applied must be removed.
@@ -212,9 +224,9 @@ function git_fetch_from_bundle_file() {
function download_git_bundle_from_http() {
local bundle_file="${1}" bundle_url="${2}"
- if [[ ! -f "${git_cold_bundle_cache_file}" ]]; then # Download the bundle file if it does not exist.
- display_alert "Downloading Git cold bundle via HTTP" "${bundle_url}" "info" # This gonna take a while. And waste bandwidth
- run_host_command_logged wget --continue --progress=giga --output-document="${bundle_file}" "${bundle_url}"
+ if [[ ! -f "${git_cold_bundle_cache_file}" ]]; then # Download the bundle file if it does not exist.
+ display_alert "Downloading Git cold bundle via HTTP" "${bundle_url}" "info" # This gonna take a while. And waste bandwidth
+ run_host_command_logged wget --continue --progress=dot:giga --output-document="${bundle_file}" "${bundle_url}"
else
display_alert "Cold bundle file exists, using it" "${bundle_file}" "git"
fi
@@ -295,7 +307,7 @@ function git_handle_cold_and_warm_bundle_remotes() {
regular_git remote add "${GIT_WARM_REMOTE_NAME}" "${GIT_WARM_REMOTE_URL}" # Add the remote to the warmup source
has_git_warm_remote=1 # mark as done. Will export the bundle!
- improved_git_fetch --no-tags "${GIT_WARM_REMOTE_NAME}" "${GIT_WARM_REMOTE_BRANCH}" # Fetch the remote branch, but no tags
+ improved_git_fetch --no-tags "${GIT_WARM_REMOTE_NAME}" "${GIT_WARM_REMOTE_BRANCH}" # Fetch the remote branch, but no tags
display_alert "After warm bundle, working copy size" "$(du -h -s | awk '{print $1}')" "git" # Show size after bundle pull
# Checkout that to a branch. We wanna have a local reference to what has been fetched.
@@ -304,7 +316,7 @@ function git_handle_cold_and_warm_bundle_remotes() {
regular_git branch "${git_warm_branch_name}" FETCH_HEAD || true
improved_git_fetch "${GIT_WARM_REMOTE_NAME}" "'refs/tags/${GIT_WARM_REMOTE_FETCH_TAGS}:refs/tags/${GIT_WARM_REMOTE_FETCH_TAGS}'" || true # Fetch the remote branch, but no tags
- display_alert "After warm bundle tags, working copy size" "$(du -h -s | awk '{print $1}')" "git" # Show size after bundle pull
+ display_alert "After warm bundle tags, working copy size" "$(du -h -s | awk '{print $1}')" "git" # Show size after bundle pull
# Lookup the tag (at the warm remote directly) to find the rev to shallow to.
if [[ "${GIT_WARM_REMOTE_SHALLOW_AT_TAG}" != "" ]]; then
From 625031cd5797295e14494d7d2c986c7de9b6e15d Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Tue, 15 Mar 2022 14:10:32 +0100
Subject: [PATCH] armbian-next: finally consolidating logs into output/logs;
colorized HTML logs
---
lib/functions/cli/cli-entrypoint.sh | 3 +-
lib/functions/configuration/main-config.sh | 6 +--
lib/functions/general/host.sh | 2 +-
lib/functions/logging/logging.sh | 60 +++++++++++++++++++++++++++++-
4 files changed, 65 insertions(+), 6 deletions(-)
diff --git a/lib/functions/cli/cli-entrypoint.sh b/lib/functions/cli/cli-entrypoint.sh
index 706d9a83a..5b905062f 100644
--- a/lib/functions/cli/cli-entrypoint.sh
+++ b/lib/functions/cli/cli-entrypoint.sh
@@ -91,7 +91,8 @@ function cli_entrypoint() {
export DESTIMG="${SRC}/.tmp/image-${ARMBIAN_BUILD_UUID}" # DESTIMG is where the backing image (raw, huge, sparse file) is kept (not the final destination)
export LOGDIR="${SRC}/.tmp/logs-${ARMBIAN_BUILD_UUID}" # Will be initialized very soon, literally, below.
- LOG_SECTION=entrypoint start_logging_section # This creates LOGDIR. Hopefully.
+ LOG_SECTION=entrypoint start_logging_section # This creates LOGDIR.
+ add_cleanup_handler trap_handler_cleanup_logging # cleanup handler for logs; it rolls it up from LOGDIR into DEST/logs
# Source the extensions manager library at this point, before sourcing the config.
# This allows early calls to enable_extension(), but initialization proper is done later.
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 86a02b15e..6d2f404b1 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -50,10 +50,10 @@ function do_main_configuration() {
fi
# image artefact destination with or without subfolder
- FINALDEST=$DEST/images
+ FINALDEST="${DEST}/images"
if [[ -n "${MAKE_FOLDERS}" ]]; then
- FINALDEST=$DEST/images/"${BOARD}"/"${MAKE_FOLDERS}"
- install -d ${FINALDEST}
+ FINALDEST="${DEST}"/images/"${BOARD}"/"${MAKE_FOLDERS}"
+ install -d "${FINALDEST}"
fi
# TODO: fixed name can't be used for parallel image building
diff --git a/lib/functions/general/host.sh b/lib/functions/general/host.sh
index 6053248b5..aefa2d236 100644
--- a/lib/functions/general/host.sh
+++ b/lib/functions/general/host.sh
@@ -71,7 +71,7 @@ prepare_host() {
nfs-kernel-server ntpdate p7zip-full parted patchutils pigz pixz pbzip2
pkg-config pv python3-dev python3-distutils qemu-user-static rsync swig
systemd-container u-boot-tools udev unzip uuid-dev wget whiptail zip
- zlib1g-dev file ccze tree
+ zlib1g-dev file ccze colorized-logs tree
)
if [[ $(dpkg --print-architecture) == amd64 ]]; then
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index 11db45e61..296b46ddb 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -27,7 +27,7 @@ function logging_error_show_log() {
if [[ -f /usr/bin/ccze ]]; then # use 'ccze' to colorize the log, making errors a lot more obvious.
# shellcheck disable=SC2002 # my cat is great. thank you, shellcheck.
- cat "${logfile_to_show}" | grep -v -e "^$" | /usr/bin/ccze -A | sed -e "${prefix_sed_cmd}" 1>&2 # write it to stderr!!
+ cat "${logfile_to_show}" | grep -v -e "^$" | /usr/bin/ccze -o nolookups -A | sed -e "${prefix_sed_cmd}" 1>&2 # write it to stderr!!
else
# shellcheck disable=SC2002 # my cat is great. thank you, shellcheck.
cat "${logfile_to_show}" | grep -v -e "^$" | sed -e "${prefix_sed_cmd}" 1>&2 # write it to stderr!!
@@ -262,3 +262,61 @@ function logging_echo_prefix_for_pv() {
return 0
}
+
+# Cleanup for logging.
+function trap_handler_cleanup_logging() {
+ [[ ! -d "${LOGDIR}" ]] && return 0
+ display_alert "Cleaning up logs from LOGDIR" "${LOGDIR}" "debug"
+
+ # Just delete LOGDIR if in CONFIG_DEFS_ONLY mode.
+ if [[ "${CONFIG_DEFS_ONLY}" == "yes" ]]; then
+ display_alert "Discarding logs" "CONFIG_DEFS_ONLY=${CONFIG_DEFS_ONLY}" "debug"
+ rm -rf --one-file-system "${LOGDIR}"
+ return 0
+ fi
+
+ local target_path="${DEST}/logs"
+ mkdir -p "${target_path}"
+ local target_file="${target_path}/armbian-logs-${ARMBIAN_BUILD_UUID}.html"
+
+ cat <<- HTML_HEADER > "${target_file}"
+ <html>
+ <head>
+ <title>Armbian logs for ${ARMBIAN_BUILD_UUID}</title>
+ <style>
+ html { background-color: black !important; color: white !important; font-family: JetBrains Mono, monospace, cursive !important; }
+ hr { border: 0; border-bottom: 1px dashed silver; }
+ </style>
+ </head>
+ <body>
+ HTML_HEADER
+
+ # Find and sort the files there, store in array one per logfile
+ declare -a logfiles_array
+ mapfile -t logfiles_array < <(find "${LOGDIR}" -type f | LC_ALL=C sort -h)
+
+ for logfile_full in "${logfiles_array[@]}"; do
+ local logfile_base="$(basename "${logfile_full}")"
+ if [[ -f /usr/bin/ccze ]] && [[ -f /usr/bin/ansi2html ]]; then
+ cat <<- HTML_ONE_LOGFILE_WITH_CCZE >> "${target_file}"
+ <h3>${logfile_base}</h3>
+ <div style="padding: 1em">
+ $(cat "${logfile_full}" | ccze -o nolookups --raw-ansi | ansi2html --no-wrap --no-header)
+ </div>
+ <hr/>
+ HTML_ONE_LOGFILE_WITH_CCZE
+ else
+ cat <<- HTML_ONE_LOGFILE_NO_CCZE >> "${target_file}"
+ <h1>${logfile_base}</h1>
+ <pre>$(cat "${logfile_full}")</pre>
+ HTML_ONE_LOGFILE_NO_CCZE
+ fi
+ done
+
+ cat <<- HTML_FOOTER >> "${target_file}"
+ </body></html>
+ HTML_FOOTER
+
+ rm -rf --one-file-system "${LOGDIR}"
+ display_alert "Build log file" "${target_file}"
+}
From 58e643c14a0b527d25856938bfc219835984e83d Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Tue, 15 Mar 2022 11:30:55 +0100
Subject: [PATCH] armbian-next: introduce `do_with_retries()` and use it for
apt remote operations during image build
---
lib/functions/logging/runners.sh | 15 +++++++++++++++
lib/functions/rootfs/create-cache.sh | 13 +++++++++----
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index a0f396cc7..d4070c268 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -163,3 +163,18 @@ function run_host_command_logged_raw() {
run_on_sdcard() {
chroot_sdcard "${@}"
}
+
+# Auto retries the number of times passed on first argument to run all the other arguments.
+function do_with_retries() {
+ local retries="${1}"
+ shift
+ local counter=0
+ while [[ $counter -lt $retries ]]; do
+ counter=$((counter + 1))
+ "$@" && return 0 # execute and return 0 if success; if not, let it loop;
+ display_alert "Command failed, retrying in 5s" "$*" "warn"
+ sleep 5
+ done
+ display_alert "Command failed ${counter} times, giving up" "$*" "warn"
+ return 1
+}
diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh
index b833ae3c8..9f526d9b9 100644
--- a/lib/functions/rootfs/create-cache.sh
+++ b/lib/functions/rootfs/create-cache.sh
@@ -170,11 +170,11 @@ function create_new_rootfs_cache() {
# stage: update packages list
display_alert "Updating package list" "$RELEASE" "info"
- chroot_sdcard_apt_get update
+ do_with_retries 3 chroot_sdcard_apt_get update
# stage: upgrade base packages from xxx-updates and xxx-backports repository branches
display_alert "Upgrading base packages" "Armbian" "info"
- chroot_sdcard_apt_get upgrade
+ do_with_retries 3 chroot_sdcard_apt_get upgrade
# Myy: Dividing the desktop packages installation steps into multiple
# ones. We first install the "ADDITIONAL_PACKAGES" in order to get
@@ -186,8 +186,9 @@ function create_new_rootfs_cache() {
display_alert "Installing the main packages for" "Armbian" "info"
export MSG_IF_ERROR="Installation of Armbian main packages for ${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL} failed"
# First, try to download-only up to 3 times, to work around network/proxy problems.
- chroot_sdcard_apt_get_install_download_only "$PACKAGE_MAIN_LIST" || chroot_sdcard_apt_get_install_download_only "$PACKAGE_MAIN_LIST" || chroot_sdcard_apt_get_install_download_only "$PACKAGE_MAIN_LIST"
- # Now do the install.
+ do_with_retries 3 chroot_sdcard_apt_get_install_download_only "$PACKAGE_MAIN_LIST"
+
+ # Now do the install, all packages should have been downloaded by now
chroot_sdcard_apt_get_install "$PACKAGE_MAIN_LIST"
if [[ $BUILD_DESKTOP == "yes" ]]; then
@@ -211,6 +212,10 @@ function create_new_rootfs_cache() {
display_alert "Installing the desktop packages for" "Armbian" "info"
MSG_IF_ERROR="Installation of Armbian desktop packages for ${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL} failed"
+ # Retry download-only 3 times first.
+ do_with_retries 3 chroot_sdcard_apt_get_install_download_only ${apt_desktop_install_flags} $PACKAGE_LIST_DESKTOP
+
+ # Then do the actual install.
chroot_sdcard_apt_get install ${apt_desktop_install_flags} $PACKAGE_LIST_DESKTOP
fi
From ff3ccab39db2e364feb16b583c973d6d305c69d5 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 7 Mar 2022 09:42:57 +0100
Subject: [PATCH] armbian-next: another round of logging tuning/fixes; log
assets; git logging
- introduce `do_with_log_asset()` and `LOG_ASSET=xxx`
- separate "git" logging level
- add `trap_handler_cleanup_destimg()` to cleanup DESTIMG
---
lib/functions/cli/cli-entrypoint.sh | 2 +-
lib/functions/compilation/kernel-debs.sh | 32 +++++++++--------
lib/functions/compilation/patch/fasthash.sh | 8 ++---
lib/functions/configuration/main-config.sh | 4 +--
lib/functions/general/git.sh | 55 ++++++++++++++---------------
lib/functions/image/initrd.sh | 2 +-
lib/functions/image/rootfs-to-image.sh | 27 ++++++++++----
lib/functions/logging/logging.sh | 29 +++++++++++----
lib/functions/main/default-build.sh | 2 +-
lib/functions/main/rootfs-image.sh | 4 +--
lib/functions/rootfs/distro-agnostic.sh | 1 +
11 files changed, 99 insertions(+), 67 deletions(-)
diff --git a/lib/functions/cli/cli-entrypoint.sh b/lib/functions/cli/cli-entrypoint.sh
index 3b8c1ad7d..706d9a83a 100644
--- a/lib/functions/cli/cli-entrypoint.sh
+++ b/lib/functions/cli/cli-entrypoint.sh
@@ -88,7 +88,7 @@ function cli_entrypoint() {
export SDCARD="${SRC}/.tmp/rootfs-${ARMBIAN_BUILD_UUID}" # SDCARD (which is NOT an sdcard, but will be, maybe, one day) is where we work the rootfs before final imaging. "rootfs" stage.
export MOUNT="${SRC}/.tmp/mount-${ARMBIAN_BUILD_UUID}" # MOUNT ("mounted on the loop") is the mounted root on final image (via loop). "image" stage
export EXTENSION_MANAGER_TMP_DIR="${SRC}/.tmp/extensions-${ARMBIAN_BUILD_UUID}" # EXTENSION_MANAGER_TMP_DIR used to store extension-composed functions
- export DESTIMG="${SRC}/.tmp/image-${ARMBIAN_BUILD_UUID}" # DESTIMG is where the backing image (raw, huge, sparse file) is kept
+ export DESTIMG="${SRC}/.tmp/image-${ARMBIAN_BUILD_UUID}" # DESTIMG is where the backing image (raw, huge, sparse file) is kept (not the final destination)
export LOGDIR="${SRC}/.tmp/logs-${ARMBIAN_BUILD_UUID}" # Will be initialized very soon, literally, below.
LOG_SECTION=entrypoint start_logging_section # This creates LOGDIR. Hopefully.
diff --git a/lib/functions/compilation/kernel-debs.sh b/lib/functions/compilation/kernel-debs.sh
index 9d1b813d3..b8eb9d266 100644
--- a/lib/functions/compilation/kernel-debs.sh
+++ b/lib/functions/compilation/kernel-debs.sh
@@ -51,10 +51,10 @@ function prepare_kernel_packaging_debs() {
#display_alert "Kernel install dir" "incoming from KBUILD make" "debug"
#run_host_command_logged tree -C --du -h "${kernel_dest_install_dir}" "| grep --line-buffered -v -e '\.ko' -e '\.h' "
- display_alert "tmp_kernel_install_dirs INSTALL_PATH:" "${tmp_kernel_install_dirs[INSTALL_PATH]}" "debug"
- display_alert "tmp_kernel_install_dirs INSTALL_MOD_PATH:" "${tmp_kernel_install_dirs[INSTALL_MOD_PATH]}" "debug"
- display_alert "tmp_kernel_install_dirs INSTALL_HDR_PATH:" "${tmp_kernel_install_dirs[INSTALL_HDR_PATH]}" "debug"
- display_alert "tmp_kernel_install_dirs INSTALL_DTBS_PATH:" "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}" "debug"
+ # display_alert "tmp_kernel_install_dirs INSTALL_PATH:" "${tmp_kernel_install_dirs[INSTALL_PATH]}" "debug"
+ # display_alert "tmp_kernel_install_dirs INSTALL_MOD_PATH:" "${tmp_kernel_install_dirs[INSTALL_MOD_PATH]}" "debug"
+ # display_alert "tmp_kernel_install_dirs INSTALL_HDR_PATH:" "${tmp_kernel_install_dirs[INSTALL_HDR_PATH]}" "debug"
+ # display_alert "tmp_kernel_install_dirs INSTALL_DTBS_PATH:" "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}" "debug"
# package the linux-image (image, modules, dtbs (if present))
create_kernel_deb "linux-image-${BRANCH}-${LINUXFAMILY}" "${debs_target_dir}" kernel_package_callback_linux_image
@@ -77,8 +77,8 @@ function create_kernel_deb() {
declare callback_function="${3}"
declare package_directory
- package_directory=$(mktemp -d "${WORKDIR}/${package_name}.XXXXXXXXX") # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
- display_alert "package_directory" "${package_directory}" "debug"
+ package_directory=$(mktemp -d "${WORKDIR}/${package_name}.XXXXXXXXX") # explicitly created in WORKDIR, so is protected by that cleanup trap already
+ #display_alert "package_directory" "${package_directory}" "debug"
declare package_DEBIAN_dir="${package_directory}/DEBIAN" # DEBIAN dir
mkdir -p "${package_DEBIAN_dir}" # maintainer scripts et al
@@ -105,7 +105,7 @@ function create_kernel_deb() {
COPYRIGHT
# Run the callback.
- display_alert "Running callback" "callback: ${callback_function}" "debug"
+ # display_alert "Running callback" "callback: ${callback_function}" "debug"
"${callback_function}" "${@}"
run_host_command_logged chown -R root:root "${package_directory}" # Fix ownership and permissions
@@ -116,7 +116,7 @@ function create_kernel_deb() {
cd "${package_directory}" || exit_with_error "major failure 774 for ${package_name}"
# create md5sums file
- sh -c "cd '${package_directory}'; find . -type f ! -path './DEBIAN/*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums"
+ # sh -c "cd '${package_directory}'; find . -type f ! -path './DEBIAN/*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums"
declare unpacked_size
unpacked_size="$(du -h -s "${package_directory}" | awk '{print $1}')"
@@ -135,23 +135,25 @@ function kernel_package_hook_helper() {
cat >> "${package_DEBIAN_dir}/${script}" <<- EOT
#!/bin/bash
- echo "Armbian ${package_name} for ${kernel_version_family}: ${script} starting."
+ echo "Armbian '${package_name}' for '${kernel_version_family}': '${script}' starting."
set -e # Error control
set -x # Debugging
$(cat "${contents}")
- echo "Armbian ${package_name} for ${kernel_version_family}: ${script} finishing."
+ set +x # Disable debugging
+ echo "Armbian '${package_name}' for '${kernel_version_family}': '${script}' finishing."
true
EOT
chmod 775 "${package_DEBIAN_dir}/${script}"
- display_alert "Hook debug" "${script} for ${package_name}" "debug"
- run_host_command_logged cat "${package_DEBIAN_dir}/${script}"
+ # produce log asset for script
+ LOG_ASSET="deb-${package_name}-${script}.sh" do_with_log_asset run_host_command_logged cat "${package_DEBIAN_dir}/${script}"
+
}
function kernel_package_callback_linux_image() {
- display_alert "package_directory" "${package_directory}" "debug"
+ display_alert "linux-image deb packaging" "${package_directory}" "debug"
declare installed_image_path="boot/vmlinuz-${kernel_version_family}" # using old mkdebian terminology here.
declare image_name="Image" # for arm64. or, "zImage" for arm, or "vmlinuz" for others. Why? See where u-boot puts them.
@@ -217,7 +219,7 @@ function kernel_package_callback_linux_image() {
}
function kernel_package_callback_linux_dtb() {
- display_alert "package_directory" "${package_directory}" "debug"
+ display_alert "linux-dtb packaging" "${package_directory}" "debug"
mkdir -p "${package_directory}/boot/"
run_host_command_logged cp -rp "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}" "${package_directory}/boot/dtb-${kernel_version_family}"
@@ -251,7 +253,7 @@ function kernel_package_callback_linux_dtb() {
}
function kernel_package_callback_linux_headers() {
- display_alert "package_directory for headers" "${package_directory}" "debug"
+ display_alert "linux-headers packaging" "${package_directory}" "debug"
# targets.
local headers_target_dir="${package_directory}/usr/src/linux-headers-${kernel_version_family}" # headers/tools etc
diff --git a/lib/functions/compilation/patch/fasthash.sh b/lib/functions/compilation/patch/fasthash.sh
index 0e74b1c79..771837b89 100644
--- a/lib/functions/compilation/patch/fasthash.sh
+++ b/lib/functions/compilation/patch/fasthash.sh
@@ -34,13 +34,13 @@ function finish_fasthash() {
}
function fasthash_debug() {
- if [[ "${SHOW_FASTHASH}" != "yes" ]]; then # enable debug for many, many debugging msgs
+ if [[ "${SHOW_FASTHASH}" != "yes" ]]; then
return 0
fi
display_alert "fasthash_debug" "$*" "fasthash"
- find . -type f -printf '%T@ %p\n' |
- grep -v -e "\.ko" -e "\.o" -e "\.cmd" -e "\.mod" -e "\.a" -e "\.tmp" -e "\.dtb" -e ".scr" -e "\.\/debian" |
- sort -n | tail -n 10 1>&2
+ run_host_command_logged find . -type f -printf "'%T@ %p\\n'" "|" \
+ grep -v -e "\.ko" -e "\.o" -e "\.cmd" -e "\.mod" -e "\.a" -e "\.tmp" -e "\.dtb" -e ".scr" -e "\.\/debian" "|" \
+ sort -n "|" tail -n 10
}
function get_file_modification_time() { # @TODO: This is almost always called from a subshell. No use throwing errors?
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index bea0c0efa..86a02b15e 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -417,7 +417,7 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
display_alert "Done with main-config.sh" "do_main_configuration" "debug"
}
-# This is called by main_default_build_single(), which is logged correctly. so just output to stdout here.
+# This is called by main_default_build_single() but declared here for 'convenience'
function write_config_summary_output_file() {
local debug_dpkg_arch debug_uname debug_virt debug_src_mount debug_src_perms debug_src_temp_perms
debug_dpkg_arch="$(dpkg --print-architecture)"
@@ -428,7 +428,7 @@ function write_config_summary_output_file() {
debug_src_temp_perms="$(getfacl -p "${SRC}"/.tmp 2> /dev/null)"
display_alert "Writing build config summary to" "debug log" "debug"
- run_host_command_logged cat <<- EOF
+ LOG_ASSET="build.summary.txt" do_with_log_asset run_host_command_logged cat <<- EOF
## BUILD SCRIPT ENVIRONMENT
Repository: $REPOSITORY_URL
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index 85dd4470f..8194e4758 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -41,7 +41,7 @@ function improved_git_fetch() {
# <ref_subdir>: "yes" to create subdirectory for tag or branch name
#
fetch_from_repo() {
- display_alert "fetch_from_repo" "$*" "debug"
+ display_alert "fetch_from_repo" "$*" "git"
local url=$1
local dir=$2
local ref=$3
@@ -74,7 +74,7 @@ fetch_from_repo() {
# if GIT_FIXED_WORKDIR has something, ignore above logic and use that directly.
if [[ "${GIT_FIXED_WORKDIR}" != "" ]]; then
- display_alert "GIT_FIXED_WORKDIR is set to" "${GIT_FIXED_WORKDIR}" "debug"
+ display_alert "GIT_FIXED_WORKDIR is set to" "${GIT_FIXED_WORKDIR}" "git"
git_work_dir="${SRC}/cache/sources/${GIT_FIXED_WORKDIR}"
fi
@@ -82,7 +82,7 @@ fetch_from_repo() {
cd "${git_work_dir}" || exit
- display_alert "Git working dir" "${git_work_dir}" "debug"
+ display_alert "Git working dir" "${git_work_dir}" "git"
# "Sanity check" since we only support one "origin"
if [[ "$(git rev-parse --git-dir)" == ".git" && "$url" != *"$(git remote get-url origin | sed 's/^.*@//' | sed 's/^.*\/\///')" ]]; then
@@ -134,7 +134,7 @@ fetch_from_repo() {
;;
esac
- display_alert "Git local_hash vs remote_hash" "${local_hash} vs ${remote_hash}" "debug"
+ display_alert "Git local_hash vs remote_hash" "${local_hash} vs ${remote_hash}" "git"
fi # offline
@@ -154,21 +154,21 @@ fetch_from_repo() {
tag) improved_git_fetch --no-tags origin tags/"${ref_name}" ;;
head) improved_git_fetch --no-tags origin HEAD ;;
esac
- display_alert "Origin fetch completed, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size again
+ display_alert "Origin fetch completed, working copy size" "$(du -h -s | awk '{print $1}')" "git"
checkout_from="FETCH_HEAD"
fi
# should be declared in outside scope, so can be read.
checked_out_revision_mtime="$(git log --date='format:%Y%m%d%H%M%S' --format='format:%ad' -1 "${checkout_from}")"
checked_out_revision_ts="$(git log -1 --pretty=%ct "${checkout_from}")"
- display_alert "checked_out_revision_mtime set!" "${checked_out_revision_mtime} - ${checked_out_revision_ts}" "debug"
+ display_alert "checked_out_revision_mtime set!" "${checked_out_revision_mtime} - ${checked_out_revision_ts}" "git"
display_alert "Cleaning git dir" "$(git status -s 2> /dev/null | wc -l) files" # working directory is not clean, show it
- fasthash_debug "before git checkout of $dir $ref_name" # fasthash interested in this
+ #fasthash_debug "before git checkout of $dir $ref_name" # fasthash interested in this
regular_git checkout -f -q "${checkout_from}" # Return the files that are tracked by git to the initial state.
- fasthash_debug "before git clean of $dir $ref_name"
+ #fasthash_debug "before git clean of $dir $ref_name"
regular_git clean -q -d -f # Files that are not tracked by git and were added when the patch was applied must be removed.
# set the checkout date on all the versioned files.
@@ -194,8 +194,8 @@ fetch_from_repo() {
done
fi
- display_alert "Final working copy size" "$(du -h -s | awk '{print $1}')" "debug"
- fasthash_debug "at the end of fetch_from_repo $dir $ref_name"
+ display_alert "Final working copy size" "$(du -h -s | awk '{print $1}')" "git"
+ #fasthash_debug "at the end of fetch_from_repo $dir $ref_name"
}
function git_fetch_from_bundle_file() {
@@ -203,20 +203,20 @@ function git_fetch_from_bundle_file() {
regular_git bundle verify "${bundle_file}" # Make sure bundle is valid.
regular_git remote add "${remote_name}" "${bundle_file}" # Add the remote pointing to the cold bundle file
if [[ -f "${shallow_file}" ]]; then
- display_alert "Bundle is shallow" "${shallow_file}" "debug"
+ display_alert "Bundle is shallow" "${shallow_file}" "git"
cp -p "${shallow_file}" ".git/shallow"
fi
improved_git_fetch --tags "${remote_name}" # Fetch it! (including tags!)
- display_alert "Bundle fetch '${remote_name}' completed, working copy size" "$(du -h -s | awk '{print $1}')" "debug"
+ display_alert "Bundle fetch '${remote_name}' completed, working copy size" "$(du -h -s | awk '{print $1}')" "git"
}
function download_git_bundle_from_http() {
local bundle_file="${1}" bundle_url="${2}"
if [[ ! -f "${git_cold_bundle_cache_file}" ]]; then # Download the bundle file if it does not exist.
- display_alert "Downloading cold bundle from remote server" "${bundle_url}" "debug" # This gonna take a while. And waste bandwidth
- run_host_command_logged wget --continue --output-document="${bundle_file}" "${bundle_url}" # @TODO: progress giga?
+ display_alert "Downloading Git cold bundle via HTTP" "${bundle_url}" "info" # This gonna take a while. And waste bandwidth
+ run_host_command_logged wget --continue --progress=giga --output-document="${bundle_file}" "${bundle_url}"
else
- display_alert "Cold bundle file exists, using it" "${bundle_file}" "debug"
+ display_alert "Cold bundle file exists, using it" "${bundle_file}" "git"
fi
}
@@ -254,13 +254,13 @@ function git_handle_cold_and_warm_bundle_remotes() {
git_warm_remote_bundle_file="${git_warm_remote_bundle_cache_dir}/${GIT_WARM_REMOTE_BUNDLE}${git_warm_remote_bundle_extra_fn}.gitbundle" # final filename of bundle
git_warm_remote_bundle_file_shallowfile="${git_warm_remote_bundle_file}.shallow" # it can be there's a shallow revision
if [[ -f "${git_warm_remote_bundle_file}" ]]; then
- display_alert "Fetching from Warm git bundle, wait" "${GIT_WARM_REMOTE_BUNDLE}" "info" # This is gonna take a long while...
+ display_alert "Fetching from warm git bundle, wait" "${GIT_WARM_REMOTE_BUNDLE}" "info" # This is gonna take a long while...
git_fetch_from_bundle_file "${git_warm_remote_bundle_file}" "${GIT_WARM_REMOTE_NAME}" "${git_warm_remote_bundle_file_shallowfile}"
do_cold_bundle="no" # Skip the cold bundle, below.
do_warmup_remote="no" # Skip the warm bundle creation, below, too.
has_git_warm_remote=1 # mark warm remote as added.
else
- display_alert "Could not find warm bundle file" "${git_warm_remote_bundle_file}" "debug"
+ display_alert "Could not find warm bundle file" "${git_warm_remote_bundle_file}" "git"
fi
fi
fi
@@ -272,7 +272,6 @@ function git_handle_cold_and_warm_bundle_remotes() {
# - do nothing else with this, it'll be used internally by git to avoid a huge fetch later.
# - but, after this, the wanted branch will be fetched. signal has_git_cold_remote=1 for later.
if [[ "${GIT_COLD_BUNDLE_URL}" != "" ]]; then
- display_alert "There's a " "${GIT_COLD_BUNDLE_URL} -- ${git_cold_bundle_id} -- file: ${git_cold_bundle_cache_file}" "debug" # @TODO: remove
local git_cold_bundle_id git_cold_bundle_cache_dir git_cold_bundle_cache_file git_cold_bundle_remote_name
git_cold_bundle_cache_dir="${SRC}/cache/gitbundles/cold" # calculate the id, dir and name of local file and remote
git_cold_bundle_id="$(echo -n "${GIT_COLD_BUNDLE_URL}" | md5sum | awk '{print $1}')" # md5 of the URL.
@@ -292,12 +291,12 @@ function git_handle_cold_and_warm_bundle_remotes() {
if [[ "${do_warmup_remote}" == "yes" ]]; then
if [[ "${GIT_WARM_REMOTE_NAME}" != "" ]] && [[ "${GIT_WARM_REMOTE_URL}" != "" ]] && [[ "${GIT_WARM_REMOTE_BRANCH}" != "" ]]; then
- display_alert "Using Warmup Remote before origin fetch" "${GIT_WARM_REMOTE_NAME} - ${GIT_WARM_REMOTE_BRANCH}" "debug"
+ display_alert "Using Warmup Remote before origin fetch" "${GIT_WARM_REMOTE_NAME} - ${GIT_WARM_REMOTE_BRANCH}" "git"
regular_git remote add "${GIT_WARM_REMOTE_NAME}" "${GIT_WARM_REMOTE_URL}" # Add the remote to the warmup source
has_git_warm_remote=1 # mark as done. Will export the bundle!
improved_git_fetch --no-tags "${GIT_WARM_REMOTE_NAME}" "${GIT_WARM_REMOTE_BRANCH}" # Fetch the remote branch, but no tags
- display_alert "After warm bundle, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after bundle pull
+ display_alert "After warm bundle, working copy size" "$(du -h -s | awk '{print $1}')" "git" # Show size after bundle pull
# Checkout that to a branch. We wanna have a local reference to what has been fetched.
# @TODO: could be a param instead of FETCH_HEAD; would drop commits after that rev
@@ -305,18 +304,18 @@ function git_handle_cold_and_warm_bundle_remotes() {
regular_git branch "${git_warm_branch_name}" FETCH_HEAD || true
improved_git_fetch "${GIT_WARM_REMOTE_NAME}" "'refs/tags/${GIT_WARM_REMOTE_FETCH_TAGS}:refs/tags/${GIT_WARM_REMOTE_FETCH_TAGS}'" || true # Fetch the remote branch, but no tags
- display_alert "After warm bundle tags, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after bundle pull
+ display_alert "After warm bundle tags, working copy size" "$(du -h -s | awk '{print $1}')" "git" # Show size after bundle pull
# Lookup the tag (at the warm remote directly) to find the rev to shallow to.
if [[ "${GIT_WARM_REMOTE_SHALLOW_AT_TAG}" != "" ]]; then
- display_alert "GIT_WARM_REMOTE_SHALLOW_AT_TAG" "${GIT_WARM_REMOTE_SHALLOW_AT_TAG}" "debug"
+ display_alert "GIT_WARM_REMOTE_SHALLOW_AT_TAG" "${GIT_WARM_REMOTE_SHALLOW_AT_TAG}" "git"
GIT_WARM_REMOTE_SHALLOW_AT_DATE="$(git tag --list --format="%(creatordate)" "${GIT_WARM_REMOTE_SHALLOW_AT_TAG}")"
- display_alert "GIT_WARM_REMOTE_SHALLOW_AT_TAG ${GIT_WARM_REMOTE_SHALLOW_AT_TAG} resulted in GIT_WARM_REMOTE_SHALLOW_AT_DATE" "Date: ${GIT_WARM_REMOTE_SHALLOW_AT_DATE}" "debug"
+ display_alert "GIT_WARM_REMOTE_SHALLOW_AT_TAG ${GIT_WARM_REMOTE_SHALLOW_AT_TAG} resulted in GIT_WARM_REMOTE_SHALLOW_AT_DATE" "Date: ${GIT_WARM_REMOTE_SHALLOW_AT_DATE}" "git"
fi
# At this stage, we might wanna make the local copy shallow and re-pack it.
if [[ "${GIT_WARM_REMOTE_SHALLOW_AT_DATE}" != "" ]]; then
- display_alert "Making working copy shallow" "before date ${GIT_WARM_REMOTE_SHALLOW_AT_DATE}" "debug"
+ display_alert "Making working copy shallow" "before date ${GIT_WARM_REMOTE_SHALLOW_AT_DATE}" "info"
# 'git clone' is the only consistent, usable thing we can do to do this.
# it does require a temporary dir, though. use one.
@@ -329,7 +328,7 @@ function git_handle_cold_and_warm_bundle_remotes() {
--tags --shallow-since="${GIT_WARM_REMOTE_SHALLOW_AT_DATE}" \
"file://${git_work_dir}" "${temp_git_dir}"
- display_alert "After shallow clone, temp_git_dir" "$(du -h -s "${temp_git_dir}" | awk '{print $1}')" "debug" # Show size after shallow
+ display_alert "After shallow clone, temp_git_dir" "$(du -h -s "${temp_git_dir}" | awk '{print $1}')" "git" # Show size after shallow
# Get rid of original, replace with new. Move cwd so no warnings are produced.
cd "${SRC}" || exit_with_error "Failed to move cwd away so we can remove" "${git_work_dir}"
@@ -342,18 +341,18 @@ function git_handle_cold_and_warm_bundle_remotes() {
has_git_cold_remote=0
has_git_warm_remote=0
- display_alert "After shallow, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after shallow
+ display_alert "After shallow, working copy size" "$(du -h -s | awk '{print $1}')" "git" # Show size after shallow
fi
# Now git working copy has a precious state we might wanna preserve (export the bundle).
if [[ "${GIT_WARM_REMOTE_BUNDLE}" != "" ]]; then
mkdir -p "${git_warm_remote_bundle_cache_dir}"
- display_alert "Exporting warm remote bundle" "${git_warm_remote_bundle_file}" "debug"
+ display_alert "Exporting warm remote bundle" "${git_warm_remote_bundle_file}" "info"
regular_git bundle create "${git_warm_remote_bundle_file}" --all
rm -f "${git_warm_remote_bundle_file_shallowfile}" # not shallow at first...
if [[ -f ".git/shallow" ]]; then
- display_alert "Exported bundle is shallow" "Will copy to ${git_warm_remote_bundle_file_shallowfile}" "debug"
+ display_alert "Exported bundle is shallow" "Will copy to ${git_warm_remote_bundle_file_shallowfile}" "git"
cp -p ".git/shallow" "${git_warm_remote_bundle_file_shallowfile}"
fi
diff --git a/lib/functions/image/initrd.sh b/lib/functions/image/initrd.sh
index de431cbbc..feb4143c8 100644
--- a/lib/functions/image/initrd.sh
+++ b/lib/functions/image/initrd.sh
@@ -23,7 +23,7 @@ update_initramfs() {
cp "/usr/bin/$QEMU_BINARY" "$chroot_target/usr/bin"/
mount_chroot "$chroot_target/"
- local logging_filter="2>&1 | grep --line-buffered -v -e '.xz' -e 'ORDER ignored' -e 'Adding binary ' -e 'Adding module ' "
+ local logging_filter="2>&1 | grep --line-buffered -v -e '.xz' -e 'ORDER ignored' -e 'Adding binary ' -e 'Adding module ' -e 'Adding firmware ' "
chroot_custom_long_running "$chroot_target" "$update_initramfs_cmd" "${logging_filter}" || {
exit_with_error "Updating initramfs FAILED"
}
diff --git a/lib/functions/image/rootfs-to-image.sh b/lib/functions/image/rootfs-to-image.sh
index d38a14ad1..85dc86f9c 100644
--- a/lib/functions/image/rootfs-to-image.sh
+++ b/lib/functions/image/rootfs-to-image.sh
@@ -10,9 +10,13 @@
#
create_image_from_sdcard_rootfs() {
# create DESTIMG, hooks might put stuff there early.
- mkdir -p $DESTIMG
+ mkdir -p "${DESTIMG}"
+
+ # add a cleanup trap hook do make sure we don't leak it if stuff fails
+ add_cleanup_handler trap_handler_cleanup_destimg
# stage: create file name
+ # @TODO: rpardini: determine the image file name produced. a bit late in the game, since it uses VER which is from the kernel package.
local version="${VENDOR}_${REVISION}_${BOARD^}_${RELEASE}_${BRANCH}_${VER/-$LINUXFAMILY/}${DESKTOP_ENVIRONMENT:+_$DESKTOP_ENVIRONMENT}"
[[ $BUILD_DESKTOP == yes ]] && version=${version}_desktop
[[ $BUILD_MINIMAL == yes ]] && version=${version}_minimal
@@ -66,11 +70,11 @@ create_image_from_sdcard_rootfs() {
# stage: write u-boot, unless the deb is not there, which would happen if BOOTCONFIG=none
# exception: if we use the one from repository, install version which was downloaded from repo
if [[ -f "${DEB_STORAGE}"/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb ]] || [[ -n $UBOOT_REPO_VERSION ]]; then
- write_uboot_to_loop_image $LOOP
+ write_uboot_to_loop_image "${LOOP}"
fi
# fix wrong / permissions
- chmod 755 $MOUNT
+ chmod 755 "${MOUNT}"
call_extension_method "pre_umount_final_image" "config_pre_umount_final_image" << 'PRE_UMOUNT_FINAL_IMAGE'
*allow config to hack into the image before the unmount*
@@ -95,10 +99,13 @@ PRE_UMOUNT_FINAL_IMAGE
losetup -d "${LOOP}"
unset LOOP # unset so cleanup handler does not try it again
- # Don't delete $DESTIMG here, extensions might have put nice things there already.
+ # We're done with ${MOUNT} by now, remove it.
rm -rf --one-file-system "${MOUNT}"
+ unset MOUNT
mkdir -p "${DESTIMG}"
+ # @TODO: misterious cwd, who sets it?
+
mv "${SDCARD}.raw" "${DESTIMG}/${version}.img"
# custom post_build_image_modify hook to run before fingerprinting and compression
@@ -119,11 +126,17 @@ PRE_UMOUNT_FINAL_IMAGE
POST_BUILD_IMAGE
# move artefacts from temporally directory to its final destination
- [[ -n $compression_type ]] && rm $DESTIMG/${version}.img
- rsync -a --no-owner --no-group --remove-source-files $DESTIMG/${version}* ${FINALDEST}
- rm -rf --one-file-system $DESTIMG
+ [[ -n $compression_type ]] && rm "${DESTIMG}/${version}.img"
+ rsync -a --no-owner --no-group --remove-source-files "${DESTIMG}/${version}"* "${FINALDEST}"
+ rm -rf --one-file-system "${DESTIMG}"
# write image to SD card
write_image_to_device "${FINALDEST}/${version}.img" "${CARD_DEVICE}"
}
+
+function trap_handler_cleanup_destimg() {
+ [[ ! -d "${DESTIMG}" ]] && return 0
+ display_alert "Cleaning up temporary DESTIMG" "${DESTIMG}" "debug"
+ rm -rf --one-file-system "${DESTIMG}"
+}
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index 2ead6b949..11db45e61 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -87,7 +87,7 @@ function do_with_logging() {
if [[ "${SHOW_LOG}" == "yes" ]]; then
local prefix_sed_contents
- prefix_sed_contents="$(logging_echo_prefix_for_pv "tool") $(echo -n -e "${tool_color}")"
+ prefix_sed_contents="$(logging_echo_prefix_for_pv "tool") $(echo -n -e "${tool_color}")" # spaces are significant
local prefix_sed_cmd="s/^/${prefix_sed_contents}/;"
# This is sick. Create a 3rd file descriptor sending it to sed. https://unix.stackexchange.com/questions/174849/redirecting-stdout-to-terminal-and-file-without-using-a-pipe
@@ -95,7 +95,8 @@ function do_with_logging() {
exec 3> >(
cd "${SRC}" || exit 2
#grep --line-buffered -v "^$" | \
- # @TODO: tee to CURRENT_LOGFILE.
+ # @TODO: tee to CURRENT_LOGFILE. @TODO this is essential. if this does not work whole thing comes down
+
sed -u -e "${prefix_sed_cmd}"
)
"$@" >&3
@@ -110,6 +111,14 @@ function do_with_logging() {
return 0
}
+# This takes LOG_ASSET, which can and should include an extension.
+function do_with_log_asset() {
+ # @TODO: check that CURRENT_LOGGING_COUNTER is set, otherwise crazy?
+ local ASSET_LOGFILE="${CURRENT_LOGGING_DIR}/${CURRENT_LOGGING_COUNTER}.${LOG_ASSET}"
+ display_alert "Logging to asset" "${CURRENT_LOGGING_COUNTER}.0.${LOG_ASSET}" "debug"
+ "$@" >> "${ASSET_LOGFILE}"
+}
+
function display_alert() {
# We'll be writing to stderr (" >&2"), so also write the message to the generic logfile, for context.
if [[ -f "${CURRENT_LOGFILE}" ]]; then
@@ -138,7 +147,7 @@ function display_alert() {
;;
ext)
- level_indicator="✅"
+ level_indicator="✨" # or ✅ ?
inline_logs_color="\e[1;32m"
ci_log="notice"
;;
@@ -160,7 +169,7 @@ function display_alert() {
if [[ "${SHOW_DEBUG}" != "yes" ]]; then # enable debug for many, many debugging msgs
return 0
fi
- level_indicator="✨"
+ level_indicator="🐛"
inline_logs_color="\e[1;33m"
;;
@@ -177,14 +186,22 @@ function display_alert() {
return 0
fi
level_indicator="🐸"
- inline_logs_color="${tool_color}" # either gray or normal, a bit subdued.
+ inline_logs_color="\e[0;36m" # a dim cyan
;;
timestamp | fasthash)
if [[ "${SHOW_FASTHASH}" != "yes" ]]; then # timestamp-related debugging messages, very very verbose
return 0
fi
- level_indicator="⏱"
+ level_indicator="🐜"
+ inline_logs_color="${tool_color}" # either gray or normal, a bit subdued.
+ ;;
+
+ git)
+ if [[ "${SHOW_GIT}" != "yes" ]]; then # git-related debugging messages, very very verbose
+ return 0
+ fi
+ level_indicator="🔖"
inline_logs_color="${tool_color}" # either gray or normal, a bit subdued.
;;
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index 5933d9a27..aae266091 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -13,7 +13,7 @@ function main_default_build_single() {
start=$(date +%s)
- ### Write config summary to its own logging section.
+ ### Write config summary
LOG_SECTION="config_summary" do_with_logging write_config_summary_output_file
# Check and install dependencies, directory structure and settings
diff --git a/lib/functions/main/rootfs-image.sh b/lib/functions/main/rootfs-image.sh
index bca09eca0..02d04797d 100644
--- a/lib/functions/main/rootfs-image.sh
+++ b/lib/functions/main/rootfs-image.sh
@@ -109,8 +109,8 @@ function build_rootfs_and_image() {
}
function list_installed_packages() {
- display_alert "Recording list of installed packages" "debug log" "debug"
- chroot_sdcard dpkg --get-selections "| grep -v deinstall | awk '{print \$1}' | cut -f1 -d':' | column -c 80"
+ display_alert "Recording list of installed packages" "asset log" "debug"
+ LOG_ASSET="installed_packages.txt" do_with_log_asset chroot_sdcard dpkg --get-selections "| grep -v deinstall | awk '{print \$1}' | cut -f1 -d':'"
}
function trap_handler_cleanup_rootfs_and_image() {
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index 4f363a696..ed65ec5ac 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -422,6 +422,7 @@ function install_distribution_agnostic() {
FAMILY_TWEAKS
# enable additional services, if they exist.
+ display_alert "Enabling Armbian services" "systemd" "info"
[[ -f "${SDCARD}"/lib/systemd/system/armbian-firstrun.service ]] && chroot_sdcard systemctl --no-reload enable armbian-firstrun.service
[[ -f "${SDCARD}"/lib/systemd/system/armbian-firstrun-config.service ]] && chroot_sdcard systemctl --no-reload enable armbian-firstrun-config.service
[[ -f "${SDCARD}"/lib/systemd/system/armbian-zram-config.service ]] && chroot_sdcard systemctl --no-reload enable armbian-zram-config.service
From fb943e2aa891513456e76a07a32351f04d2b1fe2 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 14 Mar 2022 18:51:39 +0100
Subject: [PATCH] armbian-next: kernel: use parallel compressors; reproducible
kernel builds
- also remove leftover mkdebian/builddeb parameters in make invocation
- add pbzip2 to hostdeps
---
lib/functions/compilation/kernel.sh | 37 +++++++++++++++++++++++--------------
lib/functions/general/host.sh | 2 +-
2 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 3922030ee..571bde957 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -6,6 +6,7 @@ function run_kernel_make() {
"CCACHE_BASEDIR=\"$(pwd)\"" # Base directory for ccache, for cache reuse
"PATH=\"${toolchain}:${PATH}\"" # Insert the toolchain first into the PATH.
"DPKG_COLORS=always" # Use colors for dpkg
+ "XZ_OPT='--threads=0'" # Use parallel XZ compression
)
common_make_params_quoted=(
@@ -13,15 +14,15 @@ function run_kernel_make() {
"ARCH=${ARCHITECTURE}" # Key param. Everything depends on this.
"LOCALVERSION=-${LINUXFAMILY}" # Change the internal kernel version to include the family. Changing this causes recompiles
- "BRANCH=${BRANCH}" # For mkdebian/builddep packaging only
- "KBUILD_DEBARCH=${ARCH}" # For mkdebian/builddep packaging only
- "KDEB_PKGVERSION=${REVISION}" # For mkdebian/builddep packaging only
- "KDEB_COMPRESS=${DEB_COMPRESS}" # For mkdebian/builddep packaging only
- "DEBFULLNAME=${MAINTAINER}" # For mkdebian/builddep packaging only
- "DEBEMAIL=${MAINTAINERMAIL}" # For mkdebian/builddep packaging only
-
"CROSS_COMPILE=${CCACHE} ${KERNEL_COMPILER}" # added as prefix to every compiler invocation by make
"KCFLAGS=-fdiagnostics-color=always" # Force GCC colored messages.
+
+ "SOURCE_DATE_EPOCH=${kernel_base_revision_ts}" # https://reproducible-builds.org/docs/source-date-epoch/ and https://www.kernel.org/doc/html/latest/kbuild/reproducible-builds.html
+ "KBUILD_BUILD_TIMESTAMP=${kernel_base_revision_date}" # https://www.kernel.org/doc/html/latest/kbuild/kbuild.html#kbuild-build-timestamp
+ "KBUILD_BUILD_USER=armbian-build" # https://www.kernel.org/doc/html/latest/kbuild/kbuild.html#kbuild-build-user-kbuild-build-host
+ "KBUILD_BUILD_HOST=armbian-bm" # https://www.kernel.org/doc/html/latest/kbuild/kbuild.html#kbuild-build-user-kbuild-build-host
+
+ "KGZIP=pigz" "KBZIP2=pbzip2" # Parallel compression, use explicit parallel compressors https://lore.kernel.org/lkml/20200901151002.988547791@linuxfoundation.org/
)
# last statement, so it passes the result to calling function.
@@ -43,9 +44,15 @@ function run_kernel_make_long_running() {
function compile_kernel() {
local kernel_work_dir="${SRC}/cache/sources/${LINUXSOURCEDIR}"
display_alert "Kernel build starting" "${LINUXSOURCEDIR}" "info"
- declare checked_out_revision_mtime="" # set by fetch_from_repo
+ declare checked_out_revision_mtime="" checked_out_revision_ts="" # set by fetch_from_repo
LOG_SECTION="kernel_prepare_git" do_with_logging do_with_hooks kernel_prepare_git
+
+ # Capture date variables set by fetch_from_repo; it's the date of the last kernel revision
+ declare kernel_base_revision_date
declare kernel_base_revision_mtime="${checked_out_revision_mtime}"
+ declare kernel_base_revision_ts="${checked_out_revision_ts}"
+ kernel_base_revision_date="$(LC_ALL=C date -d "@${kernel_base_revision_ts}")"
+
LOG_SECTION="kernel_maybe_clean" do_with_logging do_with_hooks kernel_maybe_clean
local version hash pre_patch_version
LOG_SECTION="kernel_prepare_patching" do_with_logging do_with_hooks kernel_prepare_patching
@@ -315,6 +322,8 @@ function kernel_package_source() {
}
function kernel_build_and_package() {
+ local ts=${SECONDS}
+
cd "${kernel_work_dir}"
local -a build_targets=("all") # "All" builds the vmlinux/Image/Image.gz default for the ${ARCH}
@@ -323,12 +332,12 @@ function kernel_build_and_package() {
# define dict with vars passed and target directories
declare -A kernel_install_dirs=(
- ["INSTALL_PATH"]="${kernel_dest_install_dir}/image/boot" # Used by `make install`
- ["INSTALL_MOD_PATH"]="${kernel_dest_install_dir}/modules" # Used by `make modules_install`
- ["INSTALL_HDR_PATH"]="${kernel_dest_install_dir}/libc_headers" # Used by `make headers_install`
+ ["INSTALL_PATH"]="${kernel_dest_install_dir}/image/boot" # Used by `make install`
+ ["INSTALL_MOD_PATH"]="${kernel_dest_install_dir}/modules" # Used by `make modules_install`
+ #["INSTALL_HDR_PATH"]="${kernel_dest_install_dir}/libc_headers" # Used by `make headers_install` - disabled, only used for libc headers
)
- build_targets+=(install modules_install headers_install)
+ build_targets+=(install modules_install) # headers_install disabled, only used for libc headers
if [[ "${KERNEL_BUILD_DTBS:-yes}" == "yes" ]]; then
display_alert "Kernel build will produce DTBs!" "DTBs YES" "debug"
build_targets+=("dtbs_install")
@@ -342,7 +351,6 @@ function kernel_build_and_package() {
local dir="${kernel_install_dirs["${dir_key}"]}"
local value="${dir_key}=${dir}"
mkdir -p "${dir}"
- display_alert "Adding kernel packaging param" "${value}" "debug"
install_make_params_quoted+=("${value}")
done
@@ -354,5 +362,6 @@ function kernel_build_and_package() {
cd "${kernel_work_dir}"
prepare_kernel_packaging_debs "${kernel_work_dir}" "${kernel_dest_install_dir}" "${version}" kernel_install_dirs
- display_alert "Package building done" "${LINUXCONFIG}" "info"
+
+ display_alert "Kernel built and packaged in" "$((SECONDS - ts)) seconds - ${version}-${LINUXFAMILY}" "info"
}
diff --git a/lib/functions/general/host.sh b/lib/functions/general/host.sh
index c2eb63578..6053248b5 100644
--- a/lib/functions/general/host.sh
+++ b/lib/functions/general/host.sh
@@ -68,7 +68,7 @@ prepare_host() {
libc6-dev-armhf-cross libelf-dev libfdt-dev libfile-fcntllock-perl
libfl-dev liblz4-tool libncurses-dev libpython2.7-dev libssl-dev
libusb-1.0-0-dev linux-base locales lzop ncurses-base ncurses-term
- nfs-kernel-server ntpdate p7zip-full parted patchutils pigz pixz
+ nfs-kernel-server ntpdate p7zip-full parted patchutils pigz pixz pbzip2
pkg-config pv python3-dev python3-distutils qemu-user-static rsync swig
systemd-container u-boot-tools udev unzip uuid-dev wget whiptail zip
zlib1g-dev file ccze tree
From fcba106dae815e6d90fea84cc538239030fde9ac Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 14 Mar 2022 18:50:13 +0100
Subject: [PATCH] armbian-next: tuning logging for timestamp/fasthash related
stuff which is very verbose
- idea is to not completely overwhelm `SHOW_DEBUG=yes` case
- make patching quieter and use file instead of stdin
- set checked_out_revision_ts during git checkout (timestamp version of _mtime)
- timestamp | fasthash logging level (via `SHOW_FASTHASH=yes`)
---
lib/functions/compilation/patch/fasthash.sh | 14 +++++++-------
lib/functions/compilation/patch/patching.sh | 7 +++----
lib/functions/general/git.sh | 3 ++-
lib/functions/logging/logging.sh | 8 ++++++++
4 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/lib/functions/compilation/patch/fasthash.sh b/lib/functions/compilation/patch/fasthash.sh
index 8158ab477..0e74b1c79 100644
--- a/lib/functions/compilation/patch/fasthash.sh
+++ b/lib/functions/compilation/patch/fasthash.sh
@@ -5,7 +5,7 @@ function report_fashtash_should_execute() {
}
function mark_fasthash_done() {
- display_alert "mark_fasthash_done" "$*" "debug"
+ display_alert "mark_fasthash_done" "$*" "fasthash"
return 0
}
@@ -13,23 +13,23 @@ function report_fasthash() {
local type="${1}"
local obj="${2}"
local desc="${3}"
- display_alert "report_fasthash" "${type}: ${desc}" "debug"
+ display_alert "report_fasthash" "${type}: ${desc}" "fasthash"
return 0
}
function initialize_fasthash() {
- display_alert "initialize_fasthash" "$*" "debug"
+ display_alert "initialize_fasthash" "$*" "fasthash"
return 0
declare -a fast_hash_list=() # @TODO: declaring here won't do it any good, this is a shared var
}
function fasthash_branch() {
- display_alert "fasthash_branch" "$*" "debug"
+ display_alert "fasthash_branch" "$*" "fasthash"
return 0
}
function finish_fasthash() {
- display_alert "finish_fasthash" "$*" "debug"
+ display_alert "finish_fasthash" "$*" "fasthash"
return 0
}
@@ -37,7 +37,7 @@ function fasthash_debug() {
if [[ "${SHOW_FASTHASH}" != "yes" ]]; then # enable debug for many, many debugging msgs
return 0
fi
- display_alert "fasthash_debug" "$*" "debug"
+ display_alert "fasthash_debug" "$*" "fasthash"
find . -type f -printf '%T@ %p\n' |
grep -v -e "\.ko" -e "\.o" -e "\.cmd" -e "\.mod" -e "\.a" -e "\.tmp" -e "\.dtb" -e ".scr" -e "\.\/debian" |
sort -n | tail -n 10 1>&2
@@ -61,7 +61,7 @@ function set_files_modification_time() {
local -i mtime="${1}"
local formatted_mtime
shift
- display_alert "Setting date ${mtime}" "${*} (no newer check)" "debug"
+ display_alert "Setting date ${mtime}" "${*} (no newer check)" "timestamp"
formatted_mtime="${mtime:0:12}.${mtime:12}"
touch --no-create -m -t "${formatted_mtime}" "${@}"
}
diff --git a/lib/functions/compilation/patch/patching.sh b/lib/functions/compilation/patch/patching.sh
index df253d969..3b7762707 100644
--- a/lib/functions/compilation/patch/patching.sh
+++ b/lib/functions/compilation/patch/patching.sh
@@ -94,7 +94,7 @@ process_patch_file() {
# shellcheck disable=SC2154 # patch_minimum_target_mtime can be declared in outer scope
if [[ "${patch_minimum_target_mtime}" != "" ]]; then
if [[ ${patch_date} -lt ${patch_minimum_target_mtime} ]]; then
- display_alert "Patch before minimum date" "${patch_date} -lt ${patch_minimum_target_mtime}" "debug"
+ display_alert "Patch before minimum date" "${patch_date} -lt ${patch_minimum_target_mtime}" "timestamp"
patch_date=${patch_minimum_target_mtime}
fi
fi
@@ -108,10 +108,9 @@ process_patch_file() {
# @TODO: try patching with `git am` first, so git contains the patch commit info/msg. -- For future git-based hashing.
# shellcheck disable=SC2015 # noted, thanks. I need to handle exit code here.
- patch --batch -p1 -N < "${patch}" && {
- # Fix the dates.
+ patch --batch -p1 -N --input="${patch}" --quiet --reject-file=- && { # "-" discards rejects
+ # Fix the dates on the patched files
set_files_modification_time "${patch_date}" "${patched_files[@]}"
-
display_alert "* $status ${relative_patch}" "" "info"
} || {
display_alert "* $status ${relative_patch}" "failed" "wrn"
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index f096a39ac..85dd4470f 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -160,7 +160,8 @@ fetch_from_repo() {
# should be declared in outside scope, so can be read.
checked_out_revision_mtime="$(git log --date='format:%Y%m%d%H%M%S' --format='format:%ad' -1 "${checkout_from}")"
- display_alert "checked_out_revision_mtime set!" "${checked_out_revision_mtime}" "debug"
+ checked_out_revision_ts="$(git log -1 --pretty=%ct "${checkout_from}")"
+ display_alert "checked_out_revision_mtime set!" "${checked_out_revision_mtime} - ${checked_out_revision_ts}" "debug"
display_alert "Cleaning git dir" "$(git status -s 2> /dev/null | wc -l) files" # working directory is not clean, show it
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index 519cb5031..2ead6b949 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -180,6 +180,14 @@ function display_alert() {
inline_logs_color="${tool_color}" # either gray or normal, a bit subdued.
;;
+ timestamp | fasthash)
+ if [[ "${SHOW_FASTHASH}" != "yes" ]]; then # timestamp-related debugging messages, very very verbose
+ return 0
+ fi
+ level_indicator="⏱"
+ inline_logs_color="${tool_color}" # either gray or normal, a bit subdued.
+ ;;
+
*)
level_indicator="🌿"
inline_logs_color="\e[1;37m"
From dab49a9133741fce7b40bdeff1e6cccf6becc180 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 14 Mar 2022 15:02:20 +0100
Subject: [PATCH] armbian-next: completely remove
mkdebian/builddeb/general-packaging kernel packaging stuff
---
lib/functions/compilation/kernel.sh | 126 +------
lib/functions/compilation/patch/kernel-pkg.sh | 95 -----
lib/library-functions.sh | 9 -
packages/armbian/builddeb | 398 ---------------------
packages/armbian/mkdebian | 257 -------------
patch/misc/general-packaging-4.14.y.patch | 213 -----------
patch/misc/general-packaging-4.19.y-rk35xx.patch | 236 ------------
patch/misc/general-packaging-4.19.y.patch | 249 -------------
patch/misc/general-packaging-4.4.y-rk3399.patch | 216 -----------
.../misc/general-packaging-4.4.y-rockchip64.patch | 216 -----------
patch/misc/general-packaging-4.4.y.patch | 230 ------------
patch/misc/general-packaging-4.9.y.patch | 199 -----------
patch/misc/general-packaging-5.10.y.patch | 367 -------------------
patch/misc/general-packaging-5.3.y.patch | 262 --------------
patch/misc/general-packaging-5.6.y.patch | 263 --------------
patch/misc/general-packaging-5.8-9.y.patch | 265 --------------
16 files changed, 12 insertions(+), 3589 deletions(-)
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index b77739827..3922030ee 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -11,17 +11,17 @@ function run_kernel_make() {
common_make_params_quoted=(
"$CTHREADS" # Parallel compile, "-j X" for X cpus
"ARCH=${ARCHITECTURE}" # Key param. Everything depends on this.
- "LOCALVERSION=-${LINUXFAMILY}" # Change the internal kernel version to include the family.?
+ "LOCALVERSION=-${LINUXFAMILY}" # Change the internal kernel version to include the family. Changing this causes recompiles
- "BRANCH=${BRANCH}" # For mkdebian/builddep packaging only
- "KBUILD_DEBARCH=${ARCH}" # For mkdebian/builddep packaging only
- "KDEB_PKGVERSION=${REVISION}" # For mkdebian/builddep packaging only
- "KDEB_COMPRESS=${DEB_COMPRESS}" # For mkdebian/builddep packaging only
- "DEBFULLNAME=${MAINTAINER}" # For mkdebian/builddep packaging only
- "DEBEMAIL=${MAINTAINERMAIL}" # For mkdebian/builddep packaging only
- "CROSS_COMPILE=${CCACHE} ${KERNEL_COMPILER}" # For mkdebian/builddep packaging only
+ "BRANCH=${BRANCH}" # For mkdebian/builddep packaging only
+ "KBUILD_DEBARCH=${ARCH}" # For mkdebian/builddep packaging only
+ "KDEB_PKGVERSION=${REVISION}" # For mkdebian/builddep packaging only
+ "KDEB_COMPRESS=${DEB_COMPRESS}" # For mkdebian/builddep packaging only
+ "DEBFULLNAME=${MAINTAINER}" # For mkdebian/builddep packaging only
+ "DEBEMAIL=${MAINTAINERMAIL}" # For mkdebian/builddep packaging only
- "KCFLAGS=-fdiagnostics-color=always" # Force GCC colored messages.
+ "CROSS_COMPILE=${CCACHE} ${KERNEL_COMPILER}" # added as prefix to every compiler invocation by make
+ "KCFLAGS=-fdiagnostics-color=always" # Force GCC colored messages.
)
# last statement, so it passes the result to calling function.
@@ -48,7 +48,6 @@ function compile_kernel() {
declare kernel_base_revision_mtime="${checked_out_revision_mtime}"
LOG_SECTION="kernel_maybe_clean" do_with_logging do_with_hooks kernel_maybe_clean
local version hash pre_patch_version
- local kernel_packaging_target
LOG_SECTION="kernel_prepare_patching" do_with_logging do_with_hooks kernel_prepare_patching
LOG_SECTION="kernel_patching" do_with_logging do_with_hooks kernel_patching
[[ $CREATE_PATCHES == yes ]] && userpatch_create "kernel" # create patch for manual source changes
@@ -68,14 +67,7 @@ function compile_kernel() {
# @TODO: some users/maintainers do a lot of their work on "DTS/DTB only changes", which do require the kernel tree
# @TODO: but the only testable artifacts are the .dtb themselves. Allow for a `DTB_ONLY=yes` might be useful.
- if [[ "a" == "b" ]]; then
- # Do it individually
- LOG_SECTION="kernel_make_headers_dtbs_image_modules" do_with_logging do_with_hooks kernel_make_headers_dtbs_image_modules
- LOG_SECTION="kernel_package" do_with_logging do_with_hooks kernel_package
- else
- # Do it all together
- LOG_SECTION="kernel_build_and_package" do_with_logging do_with_hooks kernel_build_and_package
- fi
+ LOG_SECTION="kernel_build_and_package" do_with_logging do_with_hooks kernel_build_and_package
display_alert "Done with" "kernel compile" "debug"
cd "${kernel_work_dir}/.." || exit
@@ -118,8 +110,7 @@ function kernel_maybe_clean() {
}
function kernel_prepare_patching() {
-
- if [[ $USE_OVERLAYFS == yes ]]; then
+ if [[ $USE_OVERLAYFS == yes ]]; then # @TODO: when is this set to yes?
display_alert "Using overlayfs_wrapper" "kernel_${LINUXFAMILY}_${BRANCH}" "debug"
kernel_work_dir=$(overlayfs_wrapper "wrap" "$SRC/cache/sources/$LINUXSOURCEDIR" "kernel_${LINUXFAMILY}_${BRANCH}")
fi
@@ -133,12 +124,6 @@ function kernel_prepare_patching() {
pre_patch_version="${version}"
display_alert "Pre-patch kernel version" "${pre_patch_version}" "debug"
- # different packaging for 4.3+
- kernel_packaging_target="deb-pkg"
- if linux-version compare "${version}" ge 4.3; then
- kernel_packaging_target="bindeb-pkg"
- fi
-
# read kernel git hash
hash=$(git --git-dir="$kernel_work_dir"/.git rev-parse HEAD)
}
@@ -163,10 +148,6 @@ function kernel_patching() {
apply_patch_series "${kernel_work_dir}" "${series_conf}" # applies a series of patches, read from a file. calls process_patch_file
fi
- # mostly local-based packaging fixes.
- fasthash_branch "packaging-patches"
- apply_kernel_patches_for_packaging "${kernel_work_dir}" "${version}" # calls process_patch_file and other stuff.
-
# applies a humongous amount of patches coming from github repos.
# it's mostly conditional, and very complex.
# @TODO: re-enable after finishing converting it with fasthash magic
@@ -333,89 +314,6 @@ function kernel_package_source() {
display_alert "$(basename "${sources_pkg_dir}.deb" ".deb") packaged" "$((SECONDS - ts)) seconds, ${tarball_size} tarball, ${package_size} .deb" "info"
}
-function kernel_make_headers_dtbs_image_modules() {
- local -a build_targets=("headers")
- [[ "${KERNEL_BUILD_DTBS:-yes}" == "yes" ]] && build_targets+=("dtbs")
- build_targets+=("${KERNEL_IMAGE_TYPE}" modules)
-
- display_alert "Compiling Kernel" "${LINUXCONFIG} ${KERNEL_IMAGE_TYPE}" "info"
- fasthash_debug "pre-compile"
- make_filter="| grep --line-buffered -v -e 'CC' -e 'LD' -e 'AR'" run_kernel_make_long_running "${build_targets[@]}"
- fasthash_debug "post-compile"
-
- if [[ "${DOUBLE_COMPILE_KERNEL}" == "yes" ]]; then
- display_alert "DOUBLE Compiling Kernel" "${LINUXCONFIG} ${KERNEL_IMAGE_TYPE}" "info"
- fasthash_debug "pre-double-compile"
- run_kernel_make_long_running "${build_targets[@]}"
- fasthash_debug "post-double-compile"
- fi
-
- # Check for built kernel image file file; can override default with KERNEL_IMAGE_TYPE_PATH
- local check_built_kernel_file="${kernel_work_dir}/${KERNEL_IMAGE_TYPE_PATH:-"arch/${ARCHITECTURE}/boot/${KERNEL_IMAGE_TYPE}"}"
- if [[ ! -f "${check_built_kernel_file}" ]]; then
- exit_with_error "Kernel was not built" "${check_built_kernel_file}"
- fi
-}
-
-function kernel_package() {
- cd "${kernel_work_dir}"
-
- declare kernel_dest_install_dir
- kernel_dest_install_dir=$(mktemp -d "${WORKDIR}/kernel.temp.install.target.XXXXXXXXX") # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
-
- # define dict with vars passed and target directories
- declare -A kernel_install_dirs=(
- ["INSTALL_PATH"]="${kernel_dest_install_dir}/image/boot" # Used by `make install`
- ["INSTALL_MOD_PATH"]="${kernel_dest_install_dir}/modules" # Used by `make modules_install`
- ["INSTALL_HDR_PATH"]="${kernel_dest_install_dir}/libc_headers" # Used by `make headers_install`
- )
-
- local -a prepackage_targets=(install modules_install headers_install)
- if [[ "${KERNEL_BUILD_DTBS:-yes}" == "yes" ]]; then
- display_alert "Kernel build will produce DTBs!" "DTBs YES" "debug"
- prepackage_targets+=("dtbs_install")
- kernel_install_dirs+=(["INSTALL_DTBS_PATH"]="${kernel_dest_install_dir}/dtbs") # Used by `make dtbs_install`
- fi
-
- display_alert "Packaging Kernel" "${LINUXCONFIG} $kernel_packaging_target at ${kernel_dest_install_dir}" "info"
-
- # loop over the keys above, get the value, create param value in array; also mkdir the dir
- declare -a install_make_params_quoted
- local dir_key
- for dir_key in "${!kernel_install_dirs[@]}"; do
- local dir="${kernel_install_dirs["${dir_key}"]}"
- local value="${dir_key}=${dir}"
- mkdir -p "${dir}"
- display_alert "Adding kernel packaging param" "${value}" "debug"
- install_make_params_quoted+=("${value}")
- done
-
- # See https://www.kernel.org/doc/Documentation/kbuild/headers_install.txt
- # Prepare for packaging, using the exact same options as original compile.
- display_alert "Installing kernel headers and modules for packaging" "${LINUXCONFIG} ${prepackage_targets[*]}" "info"
- fasthash_debug "pre-prepackage"
- make_filter="| grep --line-buffered -v -e 'INSTALL' -e 'SIGN' -e 'XZ'" run_kernel_make_long_running "${install_make_params_quoted[@]@Q}" "${prepackage_targets[@]}"
- fasthash_debug "post-prepackage"
-
- cd "${kernel_work_dir}"
- prepare_kernel_packaging_debs "${kernel_work_dir}" "${kernel_dest_install_dir}" "${version}" kernel_install_dirs
-
- ### # produce deb packages: image, headers, firmware, dtb
- ### # This mostly only does
- ### fasthash_debug "pre-packaging"
- ### run_kernel_make_long_running "${install_make_params_quoted[@]@Q}" $kernel_packaging_target
- ### fasthash_debug "post-packaging"
- ###
- ### if [[ "${DOUBLE_COMPILE_KERNEL}" == "yes" ]]; then
- ### display_alert "DOUBLE Packaging Kernel, Headers and DTBs" "${LINUXCONFIG} $kernel_packaging_target" "info"
- ### fasthash_debug "pre-double-packaging"
- ### run_kernel_make_long_running $kernel_packaging_target
- ### fasthash_debug "post-double-packaging"
- ### fi
-
- display_alert "Package building done" "${LINUXCONFIG} $kernel_packaging_target" "info"
-}
-
function kernel_build_and_package() {
cd "${kernel_work_dir}"
@@ -456,5 +354,5 @@ function kernel_build_and_package() {
cd "${kernel_work_dir}"
prepare_kernel_packaging_debs "${kernel_work_dir}" "${kernel_dest_install_dir}" "${version}" kernel_install_dirs
- display_alert "Package building done" "${LINUXCONFIG} $kernel_packaging_target" "info"
+ display_alert "Package building done" "${LINUXCONFIG}" "info"
}
diff --git a/lib/functions/compilation/patch/kernel-pkg.sh b/lib/functions/compilation/patch/kernel-pkg.sh
deleted file mode 100644
index 51e163b1e..000000000
--- a/lib/functions/compilation/patch/kernel-pkg.sh
+++ /dev/null
@@ -1,95 +0,0 @@
-function apply_kernel_patches_for_packaging() {
- local kerneldir="${1}"
- local version="${2}"
- # Packaging patch for modern kernels should be one for all.
- # Currently we have it per kernel family since we can't have one
- # Maintaining one from central location starting with 5.3+
- # Temporally set for new "default->legacy,next->current" family naming
-
- if linux-version compare "${version}" ge 5.10; then
- display_alert "NOT using old packaging mkdebian etc" "skipping mkdebian patching" "warn"
- return 0 # Not anymore for new packaging.
-
- # This case is special: it does not use process_patch_file. fasthash manually.
- local builddeb="packages/armbian/builddeb"
- local mkdebian="packages/armbian/mkdebian"
- local kernel_package_dir="${kerneldir}/scripts/package"
- if report_fashtash_should_execute text "$(cat "${SRC}/${builddeb}" "${SRC}/${mkdebian}")" "armbian builddeb and mkdebian replace"; then
- # Read mtime, then sed, then restore it
- local arm64_makefile="${kerneldir}/arch/arm64/Makefile" arm64_makefile_mtime
- arm64_makefile_mtime="$(get_file_modification_time "${arm64_makefile}")"
- # shellcheck disable=SC2016 # this should be a .patch?
- sed -i -e 's/^KBUILD_IMAGE := \$(boot)\/Image\.gz$/KBUILD_IMAGE := \$(boot)\/Image/' "${arm64_makefile}"
- set_files_modification_time "${arm64_makefile_mtime}" "${arm64_makefile}"
-
- # cp with -p to preserve the original dates
- cp -pv "${SRC}/${builddeb}" "${kernel_package_dir}/builddeb"
- cp -pv "${SRC}/${mkdebian}" "${kernel_package_dir}/mkdebian"
-
- chmod 755 "${kernel_package_dir}/builddeb" "${kernel_package_dir}/mkdebian"
- mark_fasthash_done # will do git commit, associate fasthash to real hash.
- fi
-
- elif linux-version compare "${version}" ge 5.8.17 &&
- linux-version compare "${version}" le 5.9 ||
- linux-version compare "${version}" ge 5.9.2; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-5.8-9.y.patch" "applying"
- elif linux-version compare "${version}" ge 5.6; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-5.6.y.patch" "applying"
- elif linux-version compare "${version}" ge 5.3; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-5.3.y.patch" "applying"
- fi
-
- if [[ "${version}" == "4.19."* ]] && [[ "$LINUXFAMILY" == sunxi* || "$LINUXFAMILY" == meson64 ||
- "$LINUXFAMILY" == mvebu64 || "$LINUXFAMILY" == mt7623 || "$LINUXFAMILY" == mvebu ]]; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-4.19.y.patch" "applying"
- fi
-
- if [[ "${version}" == "4.19."* ]] && [[ "$LINUXFAMILY" == rk35xx ]]; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-4.19.y-rk35xx.patch" "applying"
- fi
-
- if [[ "${version}" == "4.14."* ]] && [[ "$LINUXFAMILY" == s5p6818 || "$LINUXFAMILY" == mvebu64 ||
- "$LINUXFAMILY" == imx7d || "$LINUXFAMILY" == odroidxu4 || "$LINUXFAMILY" == mvebu ]]; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-4.14.y.patch" "applying"
- fi
-
- if [[ "${version}" == "4.4."* || "${version}" == "4.9."* ]] &&
- [[ "$LINUXFAMILY" == rockpis || "$LINUXFAMILY" == rk3399 ]]; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-4.4.y-rk3399.patch" "applying"
- fi
-
- if [[ "${version}" == "4.4."* ]] &&
- [[ "$LINUXFAMILY" == rockchip64 || "$LINUXFAMILY" == station* ]]; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-4.4.y-rockchip64.patch" "applying"
- fi
-
- if [[ "${version}" == "4.4."* ]] && [[ "$LINUXFAMILY" == rockchip || "$LINUXFAMILY" == rk322x ]]; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-4.4.y.patch" "applying"
- fi
-
- if [[ "${version}" == "4.9."* ]] && [[ "$LINUXFAMILY" == meson64 || "$LINUXFAMILY" == odroidc4 ]]; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-4.9.y.patch" "applying"
- fi
-
-}
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index dc62374e0..fc06a5e35 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -109,15 +109,6 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/compilation/patch/kernel-drivers.sh
source "${SRC}"/lib/functions/compilation/patch/kernel-drivers.sh
-# no errors tolerated. invoked before each sourced file to make sure.
-#set -o pipefail # trace ERR through pipes - will be enabled "soon"
-#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
-set -o errtrace # trace ERR through - enabled
-set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/compilation/patch/kernel-pkg.sh
-# shellcheck source=lib/functions/compilation/patch/kernel-pkg.sh
-source "${SRC}"/lib/functions/compilation/patch/kernel-pkg.sh
-
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
diff --git a/packages/armbian/builddeb b/packages/armbian/builddeb
deleted file mode 100755
index 0163d401a..000000000
--- a/packages/armbian/builddeb
+++ /dev/null
@@ -1,398 +0,0 @@
-#!/bin/sh
-#
-# builddeb 1.3
-# Copyright 2003 Wichert Akkerman <wichert@wiggy.net>
-#
-# Simple script to generate a deb package for a Linux kernel. All the
-# complexity of what to do with a kernel after it is installed or removed
-# is left to other scripts and packages: they can install scripts in the
-# /etc/kernel/{pre,post}{inst,rm}.d/ directories (or an alternative location
-# specified in KDEB_HOOKDIR) that will be called on package install and
-# removal.
-#
-# armbian/bulddeb 0.1
-# Copyright 2021 Leonid Gasheev (The-going <48602507+The-going@users.noreply.github.com>)
-#
-# In order to make a choice, it is enough for us to check the value
-# of the variable in the kernel configuration file and Debian's own variables.
-#
-# Uncomment the next line to see all the current values.
-# echo "$(dpkg-architecture -l)" >&2
-
-set -e
-
-is_enabled() {
- grep -q "^$1=y" include/config/auto.conf
-}
-
-if_enabled_echo() {
- if is_enabled "$1"; then
- echo -n "$2"
- elif [ $# -ge 3 ]; then
- echo -n "$3"
- fi
-}
-
-is_native() {
- dpkg-architecture -qDEB_BUILD_ARCH | grep -q "$(dpkg-architecture -qDEB_HOST_ARCH)"
-}
-
-is_build_on_amd64() {
- dpkg-architecture -qDEB_BUILD_ARCH | grep -q amd64
-}
-
-create_package() {
- local pname="$1" pdir="$2"
- local dpkg_deb_opts
-
- mkdir -m 755 -p "$pdir/DEBIAN"
- mkdir -p "$pdir/usr/share/doc/$pname"
- cp debian/copyright "$pdir/usr/share/doc/$pname/"
- cp debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian"
- gzip -9 "$pdir/usr/share/doc/$pname/changelog.Debian"
- sh -c "cd '$pdir'; find . -type f ! -path './DEBIAN/*' -printf '%P\0' \
- | xargs -r0 md5sum > DEBIAN/md5sums"
-
- # Fix ownership and permissions
- if [ "$DEB_RULES_REQUIRES_ROOT" = "no" ]; then
- dpkg_deb_opts="--root-owner-group"
- else
- chown -R root:root "$pdir"
- fi
- chmod -R go-w "$pdir"
- # in case we are in a restrictive umask environment like 0077
- chmod -R a+rX "$pdir"
- # in case we build in a setuid/setgid directory
- chmod -R ug-s "$pdir"
-
- # Create preinstall and post install script to remove dtb
- if [ "$3" = "dtb" ]; then
-
- cat >> $pdir/DEBIAN/preinst <<- EOT
- rm -rf /boot/dtb
- rm -rf /boot/dtb-$version
- exit 0
- EOT
-
- cat >> $pdir/DEBIAN/postinst <<- EOT
- cd /boot
- ln -sfT dtb-$version dtb 2> /dev/null || mv dtb-$version dtb
- exit 0
- EOT
-
- chmod 775 $pdir/DEBIAN/preinst
- chmod 775 $pdir/DEBIAN/postinst
- fi
-
- # Create postinst prerm script for headers
- if [ "$3" = "headers" ]; then
-
- # Set the time for all files to the current time.
- # And build them for the current architecture.
- cat >> $pdir/DEBIAN/postinst <<- EOT
- cd /usr/src/linux-headers-$version
- echo "Compiling headers - please wait ..."
- NCPU=\$(grep -c 'processor' /proc/cpuinfo)
- find -type f -exec touch {} +
- yes "" | make oldconfig >/dev/null
- make -j\$NCPU -s scripts >/dev/null
- make -j\$NCPU -s M=scripts/mod/ >/dev/null
- exit 0
- EOT
-
- # After the configuration and compilation processes, new files
- # appear that the package manager does not know anything about.
- # Just clear all the files in the target directory.
- cat >> $pdir/DEBIAN/prerm <<- EOT
- rm -rf /usr/src/linux-headers-$version
- exit 0
- EOT
-
- chmod 775 $pdir/DEBIAN/postinst
- chmod 775 $pdir/DEBIAN/prerm
- fi
-
- # Create the package
- dpkg-gencontrol -p$pname -P"$pdir"
- dpkg-deb ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir" ..
-}
-
-deploy_kernel_headers() {
- pdir=$1
-
- rm -rf $pdir
-
- destdir=$pdir/usr/src/linux-headers-$version
- mkdir -p $destdir
-
- (
- cd $srctree
- find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl
- find arch/*/include include scripts -type f -o -type l
- find security/*/include -type f
- find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform
- find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f
- ) > debian/hdrsrcfiles
-
- {
- if is_enabled CONFIG_STACK_VALIDATION; then
- # echo tools/objtool/objtool
- find tools/objtool -type f -executable
- fi
-
- find arch/$SRCARCH/include Module.symvers include scripts -type f
-
- if is_enabled CONFIG_GCC_PLUGINS; then
- find scripts/gcc-plugins -name \*.so -o -name gcc-common.h
- fi
- } > debian/hdrobjfiles
-
- if is_native; then
- echo "info: Build native: Skip headers-debian-byteshift.patch" >&2
- elif is_build_on_amd64; then
- (
- cd $destdir
- patch -p1 < /tmp/headers-debian-byteshift.patch
- )
- fi
-
- tar -c -f - -C $srctree -T debian/hdrsrcfiles | tar -xf - -C $destdir
- tar -c -f - -T debian/hdrobjfiles | tar -xf - -C $destdir
- rm -f debian/hdrsrcfiles debian/hdrobjfiles
-
- # copy .config manually to be where it's expected to be
- cp $KCONFIG_CONFIG $destdir/.config
-
- mkdir -p $pdir/lib/modules/$version/
- ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build
-}
-
-deploy_libc_headers() {
- pdir=$1
-
- rm -rf $pdir
-
- $MAKE -f $srctree/Makefile headers
- $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH=$pdir/usr
-
- # move asm headers to /usr/include/<libc-machine>/asm to match the structure
- # used by Debian-based distros (to support multi-arch)
- host_arch=$(dpkg-architecture -a$(cat debian/arch) -qDEB_HOST_MULTIARCH)
- mkdir $pdir/usr/include/$host_arch
- mv $pdir/usr/include/asm $pdir/usr/include/$host_arch/
-}
-
-version=$KERNELRELEASE
-tmpdir="debian/tmp"
-kernel_headers_dir="debian/hdrtmp"
-libc_headers_dir="debian/headertmp"
-dbg_dir="debian/dbgtmp"
-dtb_dir="debian/dtbtmp"
-packagename=linux-image-"$BRANCH$LOCALVERSION"
-kernel_headers_packagename=linux-headers-"$BRANCH$LOCALVERSION"
-dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
-libc_headers_packagename=linux-libc-dev
-dbg_packagename=$packagename-dbg
-
-if [ "$ARCH" = "um" ]; then
- packagename=user-mode-linux-$version
-fi
-
-# Not all arches have the same installed path in debian
-# XXX: have each arch Makefile export a variable of the canonical image install
-# path instead
-case $ARCH in
- ++aarch64|arm64)
- image_name=Image
- installed_image_path="boot/vmlinuz-$version"
- ;;
- arm*)
- image_name=zImage
- installed_image_path="boot/vmlinuz-$version"
- ;;
- um)
- installed_image_path="usr/bin/linux-$version"
- ;;
- parisc|mips|powerpc)
- installed_image_path="boot/vmlinux-$version"
- ;;
- *)
- image_name=vmlinuz
- installed_image_path="boot/vmlinuz-$version"
- ;;
-esac
-
-BUILD_DEBUG=$(if_enabled_echo CONFIG_DEBUG_INFO Yes)
-
-# Setup the directory structure
-rm -rf "$tmpdir" "$dbg_dir" "$dtb_dir" debian/files
-mkdir -m 755 -p "$tmpdir/DEBIAN"
-mkdir -p "$tmpdir/lib" "$tmpdir/boot"
-mkdir -m 755 -p "$dtb_dir/DEBIAN"
-mkdir -p "$dtb_dir/boot/dtb-$version" "$dtb_dir/usr/share/doc/$dtb_packagename"
-mkdir -m 755 -p "$kernel_headers_dir/lib/modules/$version/"
-mkdir -m 755 -p "$libc_headers_dir/DEBIAN"
-
-# Install the kernel
-if [ "$ARCH" = "um" ]; then
- mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" "$tmpdir/usr/share/doc/$packagename"
- $MAKE linux
- cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
- cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config"
- gzip "$tmpdir/usr/share/doc/$packagename/config"
-else
- cp System.map "$tmpdir/boot/System.map-$version"
- cp $KCONFIG_CONFIG "$tmpdir/boot/config-$version"
-fi
-cp "$($MAKE -s -f $srctree/Makefile image_name)" "$tmpdir/$installed_image_path"
-
-if is_enabled CONFIG_OF_EARLY_FLATTREE; then
- # Only some architectures with OF support have this target
- if [ -d "${srctree}/arch/$SRCARCH/boot/dts" ]; then
- $MAKE -f $srctree/Makefile INSTALL_DTBS_PATH="$tmpdir/usr/lib/linux-image-$version" dtbs_install
- fi
-fi
-
-if grep -q '^CONFIG_OF=y' $KCONFIG_CONFIG; then
- #mkdir -p "$tmpdir/boot/dtb"
- INSTALL_DTBS_PATH="$dtb_dir/boot/dtb-$version" $MAKE KBUILD_SRC= dtbs_install
-fi
-
-if is_enabled CONFIG_MODULES; then
- INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_install
- rm -f "$tmpdir/lib/modules/$version/build"
- rm -f "$tmpdir/lib/modules/$version/source"
-
- if [ "$ARCH" = "um" ]; then
- mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/"
- rmdir "$tmpdir/lib/modules/$version"
- fi
-
- if [ -n "$BUILD_DEBUG" ]; then
- for module in $(find $tmpdir/lib/modules/ -name *.ko -printf '%P\n'); do
- module=lib/modules/$module
- mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module)
- # only keep debug symbols in the debug file
- $OBJCOPY --only-keep-debug $tmpdir/$module $dbg_dir/usr/lib/debug/$module
- # strip original module from debug symbols
- $OBJCOPY --strip-debug $tmpdir/$module
- # then add a link to those
- $OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $tmpdir/$module
- done
-
- # resign stripped modules
- if is_enabled CONFIG_MODULE_SIG_ALL; then
- INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_sign
- fi
- fi
-fi
-
-# Install the maintainer scripts
-# Note: hook scripts under /etc/kernel are also executed by official Debian
-# kernel packages, as well as kernel packages built using make-kpkg.
-# make-kpkg sets $INITRD to indicate whether an initramfs is wanted, and
-# so do we; recent versions of dracut and initramfs-tools will obey this.
-debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
-for script in postinst postrm preinst prerm; do
- mkdir -p "$tmpdir$debhookdir/$script.d"
- cat <<- EOF > "$tmpdir/DEBIAN/$script"
- #!/bin/bash
-
- set -e
-
- # Pass maintainer script parameters to hook scripts
- export DEB_MAINT_PARAMS="\$*"
-
- # Tell initramfs builder whether it's wanted
- export INITRD=$(if_enabled_echo CONFIG_BLK_DEV_INITRD Yes No)
-
- test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d
- exit 0
- EOF
- chmod 755 "$tmpdir/DEBIAN/$script"
-done
-
-##
-## Create sym link to kernel image
-##
-sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/postinst
-cat >> $tmpdir/DEBIAN/postinst <<- EOT
- ln -sf $(basename $installed_image_path) /boot/$image_name 2> /dev/null || mv /$installed_image_path /boot/$image_name
- touch /boot/.next
- exit 0
-EOT
-
-##
-## FAT install workaround
-##
-sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/preinst
-cat >> $tmpdir/DEBIAN/preinst <<- EOT
- # exit if we are running chroot
- if [ "\$(stat -c %d:%i /)" != "\$(stat -c %d:%i /proc/1/root/.)" ]; then exit 0; fi
-
- check_boot_dev (){
- boot_device=\$(mountpoint -d /boot)
-
- for file in /dev/* ; do
- CURRENT_DEVICE=\$(printf "%d:%d" \$(stat --printf="0x%t 0x%T" \$file))
- if [[ "\$CURRENT_DEVICE" = "\$boot_device" ]]; then
- boot_partition=\$file
- break
- fi
- done
-
- bootfstype=\$(blkid -s TYPE -o value \$boot_partition)
- if [ "\$bootfstype" = "vfat" ]; then
- rm -f /boot/System.map* /boot/config* /boot/vmlinuz* /boot/$image_name /boot/uImage
- fi
- }
- mountpoint -q /boot && check_boot_dev
- exit 0
-EOT
-
-create_package "$packagename" "$tmpdir"
-
-if [ "$ARCH" != "um" ]; then
-
- if [ "$(cat debian/arch)" != "amd64" ]; then # No DTB for amd64 target
- create_package "$dtb_packagename" "$dtb_dir" "dtb"
- fi
-
- deploy_libc_headers $libc_headers_dir
- create_package $libc_headers_packagename $libc_headers_dir
-
- if is_enabled CONFIG_MODULES; then
- if is_native; then
- # echo "Skip scripts folder cleaning" >&2
- # echo "Skip creating postinst prerm scripts for headers" >&2
- deploy_kernel_headers $kernel_headers_dir
- create_package $kernel_headers_packagename $kernel_headers_dir
- else
- # Clean up the executables that are left over from
- # cross-compilation for a different host architecture.
- (
- cd $srctree
- make M=scripts clean
- )
- deploy_kernel_headers $kernel_headers_dir
- create_package $kernel_headers_packagename $kernel_headers_dir "headers"
- fi
- fi
-
-fi
-
-if [ -n "$BUILD_DEBUG" ]; then
- # Build debug package
- # Different tools want the image in different locations
- # perf
- mkdir -p $dbg_dir/usr/lib/debug/lib/modules/$version/
- cp vmlinux $dbg_dir/usr/lib/debug/lib/modules/$version/
- # systemtap
- mkdir -p $dbg_dir/usr/lib/debug/boot/
- ln -s ../lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/boot/vmlinux-$version
- # kdump-tools
- ln -s lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/vmlinux-$version
- create_package "$dbg_packagename" "$dbg_dir"
-fi
-
-exit 0
diff --git a/packages/armbian/mkdebian b/packages/armbian/mkdebian
deleted file mode 100755
index 003195372..000000000
--- a/packages/armbian/mkdebian
+++ /dev/null
@@ -1,257 +0,0 @@
-#!/bin/sh
-#
-# Copyright 2003 Wichert Akkerman <wichert@wiggy.net>
-#
-# Simple script to generate a debian/ directory for a Linux kernel.
-
-set -e
-
-is_enabled() {
- grep -q "^$1=y" include/config/auto.conf
-}
-
-if_enabled_echo() {
- if is_enabled "$1"; then
- echo -n "$2"
- elif [ $# -ge 3 ]; then
- echo -n "$3"
- fi
-}
-
-set_debarch() {
- if [ -n "$KBUILD_DEBARCH" ] ; then
- debarch="$KBUILD_DEBARCH"
- return
- fi
-
- # Attempt to find the correct Debian architecture
- case "$UTS_MACHINE" in
- i386|ia64|alpha|m68k|riscv*)
- debarch="$UTS_MACHINE" ;;
- x86_64)
- debarch=amd64 ;;
- sparc*)
- debarch=sparc$(if_enabled_echo CONFIG_64BIT 64) ;;
- s390*)
- debarch=s390x ;;
- ppc*)
- if is_enabled CONFIG_64BIT; then
- debarch=ppc64$(if_enabled_echo CONFIG_CPU_LITTLE_ENDIAN el)
- else
- debarch=powerpc$(if_enabled_echo CONFIG_SPE spe)
- fi
- ;;
- parisc*)
- debarch=hppa ;;
- mips*)
- if is_enabled CONFIG_CPU_LITTLE_ENDIAN; then
- debarch=mips$(if_enabled_echo CONFIG_64BIT 64)$(if_enabled_echo CONFIG_CPU_MIPSR6 r6)el
- elif is_enabled CONFIG_CPU_MIPSR6; then
- debarch=mips$(if_enabled_echo CONFIG_64BIT 64)r6
- else
- debarch=mips
- fi
- ;;
- aarch64|arm64)
- debarch=arm64 ;;
- arm*)
- if is_enabled CONFIG_AEABI; then
- debarch=arm$(if_enabled_echo CONFIG_VFP hf el)
- else
- debarch=arm
- fi
- ;;
- openrisc)
- debarch=or1k ;;
- sh)
- if is_enabled CONFIG_CPU_SH3; then
- debarch=sh3$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
- elif is_enabled CONFIG_CPU_SH4; then
- debarch=sh4$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
- fi
- ;;
- esac
- if [ -z "$debarch" ]; then
- debarch=$(dpkg-architecture -qDEB_HOST_ARCH)
- echo "" >&2
- echo "** ** ** WARNING ** ** **" >&2
- echo "" >&2
- echo "Your architecture doesn't have its equivalent" >&2
- echo "Debian userspace architecture defined!" >&2
- echo "Falling back to the current host architecture ($debarch)." >&2
- echo "Please add support for $UTS_MACHINE to ${0} ..." >&2
- echo "" >&2
- fi
-}
-
-# Some variables and settings used throughout the script
-KDEB_SOURCENAME=linux-$KERNELRELEASE
-version=$KERNELRELEASE
-if [ -n "$KDEB_PKGVERSION" ]; then
- packageversion=$KDEB_PKGVERSION
- revision=${packageversion##*-}
-else
- revision=$(cat .version 2>/dev/null||echo 1)
- packageversion=$version-$revision
-fi
-sourcename=$KDEB_SOURCENAME
-packagename=linux-image-"$BRANCH$LOCALVERSION"
-kernel_headers_packagename=linux-headers-"$BRANCH$LOCALVERSION"
-libc_headers_packagename=linux-libc-dev
-dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
-dbg_packagename=$packagename-dbg
-
-if [ "$ARCH" = "um" ] ; then
- packagename=user-mode-linux-$version
-fi
-
-debarch=
-set_debarch
-
-email=${DEBEMAIL-$EMAIL}
-
-# use email string directly if it contains <email>
-if echo $email | grep -q '<.*>'; then
- maintainer=$email
-else
- # or construct the maintainer string
- user=${KBUILD_BUILD_USER-$(id -nu)}
- name=${DEBFULLNAME-$user}
- if [ -z "$email" ]; then
- buildhost=${KBUILD_BUILD_HOST-$(hostname -f 2>/dev/null || hostname)}
- email="$user@$buildhost"
- fi
- maintainer="$name <$email>"
-fi
-
-# Try to determine distribution
-if [ -n "$KDEB_CHANGELOG_DIST" ]; then
- distribution=$KDEB_CHANGELOG_DIST
-# In some cases lsb_release returns the codename as n/a, which breaks dpkg-parsechangelog
-elif distribution=$(lsb_release -cs 2>/dev/null) && [ -n "$distribution" ] && [ "$distribution" != "n/a" ]; then
- : # nothing to do in this case
-else
- distribution="unstable"
- echo >&2 "Using default distribution of 'unstable' in the changelog"
- echo >&2 "Install lsb-release or set \$KDEB_CHANGELOG_DIST explicitly"
-fi
-
-mkdir -p debian/source/
-echo "1.0" > debian/source/format
-
-echo $debarch > debian/arch
-extra_build_depends=", $(if_enabled_echo CONFIG_UNWINDER_ORC libelf-dev:native)"
-extra_build_depends="$extra_build_depends, $(if_enabled_echo CONFIG_SYSTEM_TRUSTED_KEYRING libssl-dev:native)"
-
-# Generate a simple changelog template
-cat <<EOF > debian/changelog
-$sourcename ($packageversion) $distribution; urgency=low
-
- * Armbian built Linux kernel. $BRANCH
-
- -- $maintainer $(date -R)
-EOF
-
-# Generate copyright file
-cat <<EOF > debian/copyright
-This is a packacked armbian patches version of the Linux kernel.
-
-The sources may be found at most Linux archive sites, including:
-https://www.kernel.org/pub/linux/kernel
-
-Copyright: 1991 - 2018 Linus Torvalds and others.
-
-The git repository for mainline kernel development is at:
-git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 dated June, 1991.
-
-On Debian GNU/Linux systems, the complete text of the GNU General Public
-License version 2 can be found in \`/usr/share/common-licenses/GPL-2'.
-EOF
-
-# Generate a control file
-cat <<EOF > debian/control
-Source: $sourcename
-Section: kernel
-Priority: optional
-Maintainer: $maintainer
-Build-Depends: bc, rsync, kmod, cpio, bison, flex | flex:native $extra_build_depends
-Homepage: https://www.kernel.org/
-
-Package: $packagename
-Architecture: $debarch
-Provides: linux-image, linux-image-armbian, armbian-$BRANCH
-Description: Linux kernel, armbian version $version $BRANCH
- This package contains the Linux kernel, modules and corresponding other
- files, version: $version.
-
-Package: $libc_headers_packagename
-Section: devel
-Provides: linux-kernel-headers
-Conflicts: linux-kernel-headers
-Replaces: linux-kernel-headers
-Architecture: $debarch
-Description: Armbian Linux support headers for userspace development
- This package provides userspaces headers from the Linux kernel. These headers
- are used by the installed headers for GNU glibc and other system libraries.
-Multi-Arch: same
-
-Package: $dtb_packagename
-Architecture: $debarch
-Provides: linux-dtb, linux-dtb-armbian, armbian-$BRANCH
-Description: Armbian Linux DTB, version $version $BRANCH
- This package contains device blobs from the Linux kernel, version $version
-EOF
-
-if is_enabled CONFIG_MODULES; then
-cat <<EOF >> debian/control
-
-Package: $kernel_headers_packagename
-Section: devel
-Architecture: $debarch
-Provides: linux-headers, linux-headers-armbian, armbian-$BRANCH
-Depends: make, gcc, libc6-dev, bison, flex, libssl-dev
-Description: Linux kernel headers for $version on $debarch $BRANCH
- This package provides kernel header files for $version on $debarch
- .
- This is useful for people who need to build external modules
-EOF
-fi
-
-if is_enabled CONFIG_DEBUG_INFO; then
-cat <<EOF >> debian/control
-
-Package: $dbg_packagename
-Section: debug
-Architecture: $debarch
-Description: Linux kernel debugging symbols for $version
- This package will come in handy if you need to debug the kernel. It provides
- all the necessary debug symbols for the kernel and its modules.
-EOF
-fi
-
-cat <<EOF > debian/rules
-#!$(command -v $MAKE) -f
-
-srctree ?= .
-
-build:
- \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
- KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile
-
-binary-arch:
- \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
- KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile intdeb-pkg
-
-clean:
- rm -rf debian/*tmp debian/files
- \$(MAKE) clean
-
-binary: binary-arch
-EOF
-chmod +x debian/rules
-
-exit 0
diff --git a/patch/misc/general-packaging-4.14.y.patch b/patch/misc/general-packaging-4.14.y.patch
deleted file mode 100644
index 6a1eea7f7..000000000
--- a/patch/misc/general-packaging-4.14.y.patch
+++ /dev/null
@@ -1,213 +0,0 @@
-diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
-index 8c4bc5a2c..30bc0cffb 100644
---- a/arch/arm64/Makefile
-+++ b/arch/arm64/Makefile
-@@ -114,7 +114,7 @@ core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
-
- # Default target when executing plain make
- boot := arch/arm64/boot
--KBUILD_IMAGE := $(boot)/Image.gz
-+KBUILD_IMAGE := $(boot)/Image
- KBUILD_DTBS := dtbs
-
- all: Image.gz $(KBUILD_DTBS)
---- a/scripts/package/builddeb
-+++ b/scripts/package/builddeb
-@@ -29,6 +29,27 @@ create_package() {
- # in case we are in a restrictive umask environment like 0077
- chmod -R a+rX "$pdir"
-
-+ # Create preinstall and post install script to remove dtb
-+ if [[ "$1" == *dtb* ]]; then
-+ echo "if [ -d /boot/dtb-$version ]; then mv /boot/dtb-$version /boot/dtb-$version.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "if [ -d /boot/dtb.old ]; then rm -rf /boot/dtb.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "if [ -d /boot/dtb ]; then mv /boot/dtb /boot/dtb.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "exit 0" >> $pdir/DEBIAN/preinst
-+ chmod 775 $pdir/DEBIAN/preinst
-+ #
-+ echo "if [ -d /boot/dtb-$version.old ]; then rm -rf /boot/dtb-$version.old; fi" >> $pdir/DEBIAN/postinst
-+ echo "ln -sf dtb-$version /boot/dtb > /dev/null 2>&1 || mv /boot/dtb-$version /boot/dtb" >> $pdir/DEBIAN/postinst
-+ echo "exit 0" >> $pdir/DEBIAN/postinst
-+ chmod 775 $pdir/DEBIAN/postinst
-+ fi
-+
-+ # Create postinstall script for headers
-+ if [[ "$1" == *headers* ]]; then
-+ echo "cd /usr/src/linux-headers-$version; echo \"Compiling headers - please wait ...\"; find -type f -exec touch {} +;yes "" | make oldconfig >/dev/null;make -j\$(grep -c 'processor' /proc/cpuinfo) -s scripts >/dev/null; make -s M=scripts/mod/ >/dev/null" >> $pdir/DEBIAN/postinst
-+ echo "exit 0" >> $pdir/DEBIAN/postinst
-+ chmod 775 $pdir/DEBIAN/postinst
-+ fi
-+
- # Create the package
- dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch}" -p$pname -P"$pdir"
- dpkg --build "$pdir" ..
-@@ -52,7 +73,9 @@ set_debarch() {
- mips*)
- debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el || true) ;;
- aarch64|arm64)
-- debarch=arm64 ;;
-+ debarch=arm64
-+ image_name=Image
-+ ;;
- arm*)
- if grep -q CONFIG_AEABI=y $KCONFIG_CONFIG; then
- if grep -q CONFIG_VFP=y $KCONFIG_CONFIG; then
-@@ -63,6 +86,7 @@ set_debarch() {
- else
- debarch=arm
- fi
-+ image_name=zImage
- ;;
- *)
- debarch=$(dpkg --print-architecture)
-@@ -95,12 +119,15 @@ tmpdir="$objtree/debian/tmp"
- kernel_headers_dir="$objtree/debian/hdrtmp"
- libc_headers_dir="$objtree/debian/headertmp"
- dbg_dir="$objtree/debian/dbgtmp"
--packagename=linux-image-$version
--kernel_headers_packagename=linux-headers-$version
--libc_headers_packagename=linux-libc-dev
-+dtb_dir="$objtree/debian/dtbtmp"
-+packagename=linux-image-"$BRANCH$LOCALVERSION"
-+kernel_headers_packagename=linux-headers-"$BRANCH$LOCALVERSION"
-+dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
-+libc_headers_packagename=linux-libc-dev-"$BRANCH$LOCALVERSION"
- dbg_packagename=$packagename-dbg
- debarch=
- forcearch=
-+image_name=
- set_debarch
-
- if [ "$ARCH" = "um" ] ; then
-@@ -124,7 +151,9 @@ esac
- BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)"
-
- # Setup the directory structure
--rm -rf "$tmpdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" $objtree/debian/files
-+rm -rf "$tmpdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" "$dtb_dir" $objtree/debian/files
-+mkdir -m 755 -p "$dtb_dir/DEBIAN"
-+mkdir -p "$dtb_dir/boot/dtb-$version" "$dtb_dir/usr/share/doc/$dtb_packagename"
- mkdir -m 755 -p "$tmpdir/DEBIAN"
- mkdir -p "$tmpdir/lib" "$tmpdir/boot"
- mkdir -p "$kernel_headers_dir/lib/modules/$version/"
-@@ -177,6 +206,11 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
- fi
- fi
-
-+if grep -q '^CONFIG_OF=y' $KCONFIG_CONFIG ; then
-+ #mkdir -p "$tmpdir/boot/dtb"
-+ INSTALL_DTBS_PATH="$dtb_dir/boot/dtb-$version" $MAKE KBUILD_SRC= dtbs_install
-+fi
-+
- if [ "$ARCH" != "um" ]; then
- $MAKE headers_check KBUILD_SRC=
- $MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr"
-@@ -196,7 +230,7 @@ fi
- for script in postinst postrm preinst prerm ; do
- mkdir -p "$tmpdir$debhookdir/$script.d"
- cat <<EOF > "$tmpdir/DEBIAN/$script"
--#!/bin/sh
-+#!/bin/bash
-
- set -e
-
-@@ -212,6 +246,44 @@ EOF
- chmod 755 "$tmpdir/DEBIAN/$script"
- done
-
-+##
-+## Create sym link to kernel image
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/postinst
-+cat >> $tmpdir/DEBIAN/postinst <<EOT
-+ln -sf $(basename $installed_image_path) /boot/$image_name 2> /dev/null || mv /$installed_image_path /boot/$image_name
-+touch /boot/.next
-+exit 0
-+EOT
-+##
-+## FAT install workaround
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/preinst
-+cat >> $tmpdir/DEBIAN/preinst <<EOT
-+# exit if we are running chroot
-+if [ "\$(stat -c %d:%i /)" != "\$(stat -c %d:%i /proc/1/root/.)" ]; then exit 0; fi
-+
-+check_and_unmount (){
-+boot_device=\$(mountpoint -d /boot)
-+
-+for file in /dev/* ; do
-+ CURRENT_DEVICE=\$(printf "%d:%d" \$(stat --printf="0x%t 0x%T" \$file))
-+ if [[ "\$CURRENT_DEVICE" = "\$boot_device" ]]; then
-+ boot_partition=\$file
-+ break;
-+ fi
-+done
-+
-+bootfstype=\$(blkid -s TYPE -o value \$boot_partition)
-+if [ "\$bootfstype" = "vfat" ]; then
-+# we have to keep it mounted! umount /boot
-+rm -f /boot/System.map* /boot/config* /boot/vmlinuz* /boot/$image_name /boot/uImage
-+fi
-+}
-+mountpoint -q /boot && check_and_unmount
-+EOT
-+echo "exit 0" >> $tmpdir/DEBIAN/preinst
-+
- # Try to determine maintainer and email values
- if [ -n "$DEBEMAIL" ]; then
- email=$DEBEMAIL
-@@ -314,6 +395,7 @@ fi
- # Build kernel header package
- (cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl) > "$objtree/debian/hdrsrcfiles"
- (cd $srctree; find arch/*/include include scripts -type f -o -type l) >> "$objtree/debian/hdrsrcfiles"
-+(cd $srctree; find security/*/include -type f) >> "$objtree/debian/hdrsrcfiles"
- (cd $srctree; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> "$objtree/debian/hdrsrcfiles"
- (cd $srctree; find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> "$objtree/debian/hdrsrcfiles"
- if grep -q '^CONFIG_STACK_VALIDATION=y' $KCONFIG_CONFIG ; then
-@@ -325,16 +407,20 @@ if grep -q '^CONFIG_GCC_PLUGINS=y' $KCONFIG_CONFIG ; then
- fi
- destdir=$kernel_headers_dir/usr/src/linux-headers-$version
- mkdir -p "$destdir"
-+(cd $destdir; patch -p1 < /tmp/headers-debian-byteshift.patch)
- (cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -)
- (cd $objtree; tar -c -f - -T -) < "$objtree/debian/hdrobjfiles" | (cd $destdir; tar -xf -)
- (cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be
- ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
- rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
-
-+(cd $destdir; make M=scripts clean)
-+
- cat <<EOF >> debian/control
-
- Package: $kernel_headers_packagename
- Architecture: any
-+Depends: make, gcc, libc6-dev, libssl-dev
- Description: Linux kernel headers for $KERNELRELEASE on \${kernel:debarch}
- This package provides kernel header files for $KERNELRELEASE on \${kernel:debarch}
- .
-@@ -343,6 +429,16 @@ EOF
-
- cat <<EOF >> debian/control
-
-+Package: $dtb_packagename
-+Architecture: any
-+Description: Linux DTB, version $version
-+ This package contains device blobs from the Linux kernel, version $version.
-+EOF
-+
-+create_package "$dtb_packagename" "$dtb_dir"
-+
-+cat <<EOF >> debian/control
-+
- Package: $libc_headers_packagename
- Section: devel
- Provides: $libc_headers_packagename
-@@ -354,7 +450,7 @@ EOF
-
- if [ "$ARCH" != "um" ]; then
- create_package "$kernel_headers_packagename" "$kernel_headers_dir"
-- create_package "$libc_headers_packagename" "$libc_headers_dir"
-+# create_package "$libc_headers_packagename" "$libc_headers_dir"
- fi
-
- create_package "$packagename" "$tmpdir"
diff --git a/patch/misc/general-packaging-4.19.y-rk35xx.patch b/patch/misc/general-packaging-4.19.y-rk35xx.patch
deleted file mode 100644
index f94b1a110..000000000
--- a/patch/misc/general-packaging-4.19.y-rk35xx.patch
+++ /dev/null
@@ -1,236 +0,0 @@
-diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
-index 5b3908880..7a0869261 100644
---- a/arch/arm64/Makefile
-+++ b/arch/arm64/Makefile
-@@ -126,7 +126,7 @@ core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
-
- # Default target when executing plain make
- boot := arch/arm64/boot
--KBUILD_IMAGE := $(boot)/Image.gz
-+KBUILD_IMAGE := $(boot)/Image
- KBUILD_DTBS := dtbs
-
- all: Image.gz $(KBUILD_DTBS)
-diff --git a/scripts/package/builddeb b/scripts/package/builddeb
-index 4c2b84132..1d51c17cd 100755
---- a/scripts/package/builddeb
-+++ b/scripts/package/builddeb
-@@ -29,6 +29,44 @@ create_package() {
- # in case we are in a restrictive umask environment like 0077
- chmod -R a+rX "$pdir"
-
-+ # Create preinstall and post install script to remove dtb
-+ if [[ "$1" == *dtb* ]]; then
-+
-+ cat >> $pdir/DEBIAN/preinst <<EOT
-+rm -rf /boot/dtb-$version; rm -rf /boot/dtb
-+exit 0
-+EOT
-+
-+ cat >> $pdir/DEBIAN/postinst <<EOT
-+cd /boot
-+ln -sfT dtb-$version dtb 2> /dev/null || mv dtb-$version dtb
-+exit 0
-+EOT
-+
-+ chmod 775 $pdir/DEBIAN/preinst ; chmod 775 $pdir/DEBIAN/postinst
-+ fi
-+
-+ # Create postinst prerm scripts for headers
-+ if [[ "$1" == *headers* ]]; then
-+
-+cat >> $pdir/DEBIAN/postinst << EOT
-+cd /usr/src/linux-headers-$version
-+echo "Compiling headers - please wait ..."
-+find -type f -exec touch {} +
-+make -s scripts >/dev/null
-+make -s M=scripts/mod/ >/dev/null
-+exit 0
-+EOT
-+
-+cat >> $pdir/DEBIAN/prerm << EOT
-+cd /usr/src/linux-headers-$version
-+rm -rf scripts .config.old
-+exit 0
-+EOT
-+
-+ chmod 775 $pdir/DEBIAN/postinst ; chmod 775 $pdir/DEBIAN/prerm
-+ fi
-+
- # Create the package
- dpkg-gencontrol -p$pname -P"$pdir"
- dpkg --build "$pdir" ..
-@@ -39,9 +77,11 @@ tmpdir="$objtree/debian/tmp"
- kernel_headers_dir="$objtree/debian/hdrtmp"
- libc_headers_dir="$objtree/debian/headertmp"
- dbg_dir="$objtree/debian/dbgtmp"
--packagename=linux-image-$version
--kernel_headers_packagename=linux-headers-$version
--libc_headers_packagename=linux-libc-dev
-+dtb_dir="$objtree/debian/dtbtmp"
-+packagename=linux-image-"$BRANCH$LOCALVERSION"
-+kernel_headers_packagename=linux-headers-"$BRANCH$LOCALVERSION"
-+dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
-+libc_headers_packagename=linux-libc-dev-"$BRANCH$LOCALVERSION"
- dbg_packagename=$packagename-dbg
-
- if [ "$ARCH" = "um" ] ; then
-@@ -52,6 +92,15 @@ fi
- # XXX: have each arch Makefile export a variable of the canonical image install
- # path instead
- case $ARCH in
-+aarch64|arm64)
-+ image_name=Image
-+ installed_image_path="boot/vmlinuz-$version"
-+
-+ ;;
-+arm*)
-+ image_name=zImage
-+ installed_image_path="boot/vmlinuz-$version"
-+ ;;
- um)
- installed_image_path="usr/bin/linux-$version"
- ;;
-@@ -65,7 +114,9 @@ esac
- BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)"
-
- # Setup the directory structure
--rm -rf "$tmpdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" $objtree/debian/files
-+rm -rf "$tmpdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" "$dtb_dir" $objtree/debian/files
-+mkdir -m 755 -p "$dtb_dir/DEBIAN"
-+mkdir -p "$dtb_dir/boot/dtb-$version" "$dtb_dir/usr/share/doc/$dtb_packagename"
- mkdir -m 755 -p "$tmpdir/DEBIAN"
- mkdir -p "$tmpdir/lib" "$tmpdir/boot"
- mkdir -p "$kernel_headers_dir/lib/modules/$version/"
-@@ -118,6 +169,11 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
- fi
- fi
-
-+if grep -q '^CONFIG_OF=y' $KCONFIG_CONFIG ; then
-+ #mkdir -p "$tmpdir/boot/dtb"
-+ INSTALL_DTBS_PATH="$dtb_dir/boot/dtb-$version" $MAKE KBUILD_SRC= dtbs_install
-+fi
-+
- if [ "$ARCH" != "um" ]; then
- $MAKE headers_check KBUILD_SRC=
- $MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr"
-@@ -137,7 +193,7 @@ fi
- for script in postinst postrm preinst prerm ; do
- mkdir -p "$tmpdir$debhookdir/$script.d"
- cat <<EOF > "$tmpdir/DEBIAN/$script"
--#!/bin/sh
-+#!/bin/bash
-
- set -e
-
-@@ -153,10 +209,50 @@ EOF
- chmod 755 "$tmpdir/DEBIAN/$script"
- done
-
-+##
-+## Create sym link to kernel image
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/postinst
-+cat >> $tmpdir/DEBIAN/postinst <<EOT
-+ln -sf $(basename $installed_image_path) /boot/$image_name 2> /dev/null || mv /$installed_image_path /boot/$image_name
-+touch /boot/.next
-+exit 0
-+EOT
-+
-+##
-+## FAT install workaround
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/preinst
-+cat >> $tmpdir/DEBIAN/preinst <<EOT
-+# exit if we are running chroot
-+if [ "\$(stat -c %d:%i /)" != "\$(stat -c %d:%i /proc/1/root/.)" ]; then exit 0; fi
-+
-+check_and_unmount (){
-+ boot_device=\$(mountpoint -d /boot)
-+
-+ for file in /dev/* ; do
-+ CURRENT_DEVICE=\$(printf "%d:%d" \$(stat --printf="0x%t 0x%T" \$file))
-+ if [[ "\$CURRENT_DEVICE" = "\$boot_device" ]]; then
-+ boot_partition=\$file
-+ break
-+ fi
-+ done
-+
-+ bootfstype=\$(blkid -s TYPE -o value \$boot_partition)
-+ if [ "\$bootfstype" = "vfat" ]; then
-+ # we have to keep it mounted! umount /boot
-+ rm -f /boot/System.map* /boot/config* /boot/vmlinuz* /boot/$image_name /boot/uImage
-+ fi
-+}
-+mountpoint -q /boot && check_and_unmount
-+EOT
-+echo "exit 0" >> $tmpdir/DEBIAN/preinst
-+
- # Build kernel header package
- (cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl) > "$objtree/debian/hdrsrcfiles"
- (cd $srctree; find arch/*/include tools/include include scripts -type f -o -type l) >> "$objtree/debian/hdrsrcfiles"
- (cd $srctree; find security/selinux/include tools/include include scripts -type f) >> "$objtree/debian/hdrsrcfiles"
-+(cd $srctree; find security/*/include -type f) >> "$objtree/debian/hdrsrcfiles"
- (cd $srctree; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> "$objtree/debian/hdrsrcfiles"
- (cd $srctree; find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> "$objtree/debian/hdrsrcfiles"
- if grep -q '^CONFIG_STACK_VALIDATION=y' $KCONFIG_CONFIG ; then
-@@ -168,15 +264,19 @@ if grep -q '^CONFIG_GCC_PLUGINS=y' $KCONFIG_CONFIG ; then
- fi
- destdir=$kernel_headers_dir/usr/src/linux-headers-$version
- mkdir -p "$destdir"
-+(cd $destdir; patch -p1 < /tmp/headers-debian-byteshift.patch)
- (cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -)
- (cd $objtree; tar -c -f - -T -) < "$objtree/debian/hdrobjfiles" | (cd $destdir; tar -xf -)
- (cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be
- ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
- rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
-
-+(cd $destdir; make M=scripts clean)
-+
- if [ "$ARCH" != "um" ]; then
- create_package "$kernel_headers_packagename" "$kernel_headers_dir"
-- create_package "$libc_headers_packagename" "$libc_headers_dir"
-+ # create_package "$libc_headers_packagename" "$libc_headers_dir"
-+ create_package "$dtb_packagename" "$dtb_dir"
- fi
-
- create_package "$packagename" "$tmpdir"
-diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
-index edcad61fe..8a49f4329 100755
---- a/scripts/package/mkdebian
-+++ b/scripts/package/mkdebian
-@@ -94,10 +94,12 @@ else
- packageversion=$version-$revision
- fi
- sourcename=$KDEB_SOURCENAME
--packagename=linux-image-$version
--kernel_headers_packagename=linux-headers-$version
-+packagename=linux-image-"$BRANCH$LOCALVERSION"
-+kernel_headers_packagename=linux-headers-"$BRANCH$LOCALVERSION"
-+dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
- dbg_packagename=$packagename-dbg
- debarch=
-+image_name=
- set_debarch
-
- if [ "$ARCH" = "um" ] ; then
-@@ -181,6 +183,7 @@ Description: Linux kernel, version $version
-
- Package: $kernel_headers_packagename
- Architecture: $debarch
-+Depends: make, gcc, libc6-dev, flex, bison, libssl-dev
- Description: Linux kernel headers for $version on $debarch
- This package provides kernel header files for $version on $debarch
- .
-@@ -200,6 +203,11 @@ Architecture: $debarch
- Description: Linux kernel debugging symbols for $version
- This package will come in handy if you need to debug the kernel. It provides
- all the necessary debug symbols for the kernel and its modules.
-+
-+Package: $dtb_packagename
-+Architecture: $debarch
-+Description: Linux DTB, version $version
-+ This package contains device blobs from the Linux kernel, version $version
- EOF
-
- cat <<EOF > debian/rules
diff --git a/patch/misc/general-packaging-4.19.y.patch b/patch/misc/general-packaging-4.19.y.patch
deleted file mode 100644
index 0c58947f5..000000000
--- a/patch/misc/general-packaging-4.19.y.patch
+++ /dev/null
@@ -1,249 +0,0 @@
-From 2b73935784b88ef50fc4be16254a4962b5f70383 Mon Sep 17 00:00:00 2001
-From: The-going <48602507+The-going@users.noreply.github.com>
-Date: Tue, 10 Mar 2020 16:44:18 +0300
-Subject: [PATCH] general packaging 4.19.y
-
----
- arch/arm64/Makefile | 2 +-
- scripts/package/builddeb | 121 ++++++++++++++++++++++++++++++++++++++++++++---
- scripts/package/mkdebian | 12 ++++-
- 3 files changed, 126 insertions(+), 9 deletions(-)
-
-diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
-index 9a5e28141211..851e646169ba 100644
---- a/arch/arm64/Makefile
-+++ b/arch/arm64/Makefile
-@@ -113,7 +113,7 @@ core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
-
- # Default target when executing plain make
- boot := arch/arm64/boot
--KBUILD_IMAGE := $(boot)/Image.gz
-+KBUILD_IMAGE := $(boot)/Image
- KBUILD_DTBS := dtbs
-
- all: Image.gz $(KBUILD_DTBS)
-diff --git a/scripts/package/builddeb b/scripts/package/builddeb
-index 0b31f4f1f92c..f6b96d8507f4 100755
---- a/scripts/package/builddeb
-+++ b/scripts/package/builddeb
-@@ -29,6 +29,44 @@ create_package() {
- # in case we are in a restrictive umask environment like 0077
- chmod -R a+rX "$pdir"
-
-+ # Create preinstall and post install script to remove dtb
-+ if [[ "$1" == *dtb* ]]; then
-+
-+ cat >> $pdir/DEBIAN/preinst <<EOT
-+rm -rf /boot/dtb-$version; rm -rf /boot/dtb
-+exit 0
-+EOT
-+
-+ cat >> $pdir/DEBIAN/postinst <<EOT
-+cd /boot
-+ln -sfT dtb-$version dtb 2> /dev/null || mv dtb-$version dtb
-+exit 0
-+EOT
-+
-+ chmod 775 $pdir/DEBIAN/preinst ; chmod 775 $pdir/DEBIAN/postinst
-+ fi
-+
-+ # Create postinst prerm scripts for headers
-+ if [[ "$1" == *headers* ]]; then
-+
-+cat >> $pdir/DEBIAN/postinst << EOT
-+cd /usr/src/linux-headers-$version
-+echo "Compiling headers - please wait ..."
-+find -type f -exec touch {} +
-+make -s scripts >/dev/null
-+make -s M=scripts/mod/ >/dev/null
-+exit 0
-+EOT
-+
-+cat >> $pdir/DEBIAN/prerm << EOT
-+cd /usr/src/linux-headers-$version
-+rm -rf scripts .config.old
-+exit 0
-+EOT
-+
-+ chmod 775 $pdir/DEBIAN/postinst ; chmod 775 $pdir/DEBIAN/prerm
-+ fi
-+
- # Create the package
- dpkg-gencontrol -p$pname -P"$pdir"
- dpkg --build "$pdir" ..
-@@ -39,9 +77,11 @@ tmpdir="$objtree/debian/tmp"
- kernel_headers_dir="$objtree/debian/hdrtmp"
- libc_headers_dir="$objtree/debian/headertmp"
- dbg_dir="$objtree/debian/dbgtmp"
--packagename=linux-image-$version
--kernel_headers_packagename=linux-headers-$version
--libc_headers_packagename=linux-libc-dev
-+dtb_dir="$objtree/debian/dtbtmp"
-+packagename=linux-image-"$BRANCH$LOCALVERSION"
-+kernel_headers_packagename=linux-headers-"$BRANCH$LOCALVERSION"
-+dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
-+libc_headers_packagename=linux-libc-dev-"$BRANCH$LOCALVERSION"
- dbg_packagename=$packagename-dbg
-
- if [ "$ARCH" = "um" ] ; then
-@@ -52,6 +92,15 @@ fi
- # XXX: have each arch Makefile export a variable of the canonical image install
- # path instead
- case $ARCH in
-+aarch64|arm64)
-+ image_name=Image
-+ installed_image_path="boot/vmlinuz-$version"
-+
-+ ;;
-+arm*)
-+ image_name=zImage
-+ installed_image_path="boot/vmlinuz-$version"
-+ ;;
- um)
- installed_image_path="usr/bin/linux-$version"
- ;;
-@@ -65,7 +114,9 @@ esac
- BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)"
-
- # Setup the directory structure
--rm -rf "$tmpdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" $objtree/debian/files
-+rm -rf "$tmpdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" "$dtb_dir" $objtree/debian/files
-+mkdir -m 755 -p "$dtb_dir/DEBIAN"
-+mkdir -p "$dtb_dir/boot/dtb-$version" "$dtb_dir/usr/share/doc/$dtb_packagename"
- mkdir -m 755 -p "$tmpdir/DEBIAN"
- mkdir -p "$tmpdir/lib" "$tmpdir/boot"
- mkdir -p "$kernel_headers_dir/lib/modules/$version/"
-@@ -118,6 +169,11 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
- fi
- fi
-
-+if grep -q '^CONFIG_OF=y' $KCONFIG_CONFIG ; then
-+ #mkdir -p "$tmpdir/boot/dtb"
-+ INSTALL_DTBS_PATH="$dtb_dir/boot/dtb-$version" $MAKE KBUILD_SRC= dtbs_install
-+fi
-+
- if [ "$ARCH" != "um" ]; then
- $MAKE headers_check KBUILD_SRC=
- $MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr"
-@@ -137,7 +193,7 @@ fi
- for script in postinst postrm preinst prerm ; do
- mkdir -p "$tmpdir$debhookdir/$script.d"
- cat <<EOF > "$tmpdir/DEBIAN/$script"
--#!/bin/sh
-+#!/bin/bash
-
- set -e
-
-@@ -153,9 +209,49 @@ EOF
- chmod 755 "$tmpdir/DEBIAN/$script"
- done
-
-+##
-+## Create sym link to kernel image
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/postinst
-+cat >> $tmpdir/DEBIAN/postinst <<EOT
-+ln -sf $(basename $installed_image_path) /boot/$image_name 2> /dev/null || mv /$installed_image_path /boot/$image_name
-+touch /boot/.next
-+exit 0
-+EOT
-+
-+##
-+## FAT install workaround
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/preinst
-+cat >> $tmpdir/DEBIAN/preinst <<EOT
-+# exit if we are running chroot
-+if [ "\$(stat -c %d:%i /)" != "\$(stat -c %d:%i /proc/1/root/.)" ]; then exit 0; fi
-+
-+check_and_unmount (){
-+ boot_device=\$(mountpoint -d /boot)
-+
-+ for file in /dev/* ; do
-+ CURRENT_DEVICE=\$(printf "%d:%d" \$(stat --printf="0x%t 0x%T" \$file))
-+ if [[ "\$CURRENT_DEVICE" = "\$boot_device" ]]; then
-+ boot_partition=\$file
-+ break
-+ fi
-+ done
-+
-+ bootfstype=\$(blkid -s TYPE -o value \$boot_partition)
-+ if [ "\$bootfstype" = "vfat" ]; then
-+ # we have to keep it mounted! umount /boot
-+ rm -f /boot/System.map* /boot/config* /boot/vmlinuz* /boot/$image_name /boot/uImage
-+ fi
-+}
-+mountpoint -q /boot && check_and_unmount
-+EOT
-+echo "exit 0" >> $tmpdir/DEBIAN/preinst
-+
- # Build kernel header package
- (cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl) > "$objtree/debian/hdrsrcfiles"
- (cd $srctree; find arch/*/include include scripts -type f -o -type l) >> "$objtree/debian/hdrsrcfiles"
-+(cd $srctree; find security/*/include -type f) >> "$objtree/debian/hdrsrcfiles"
- (cd $srctree; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> "$objtree/debian/hdrsrcfiles"
- (cd $srctree; find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> "$objtree/debian/hdrsrcfiles"
- if grep -q '^CONFIG_STACK_VALIDATION=y' $KCONFIG_CONFIG ; then
-@@ -167,15 +272,19 @@ if grep -q '^CONFIG_GCC_PLUGINS=y' $KCONFIG_CONFIG ; then
- fi
- destdir=$kernel_headers_dir/usr/src/linux-headers-$version
- mkdir -p "$destdir"
-+(cd $destdir; patch -p1 < /tmp/headers-debian-byteshift.patch)
- (cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -)
- (cd $objtree; tar -c -f - -T -) < "$objtree/debian/hdrobjfiles" | (cd $destdir; tar -xf -)
- (cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be
- ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
- rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
-
-+(cd $destdir; make M=scripts clean)
-+
- if [ "$ARCH" != "um" ]; then
- create_package "$kernel_headers_packagename" "$kernel_headers_dir"
-- create_package "$libc_headers_packagename" "$libc_headers_dir"
-+ # create_package "$libc_headers_packagename" "$libc_headers_dir"
-+ create_package "$dtb_packagename" "$dtb_dir"
- fi
-
- create_package "$packagename" "$tmpdir"
-diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
-index edcad61fe3cd..8a49f432921f 100755
---- a/scripts/package/mkdebian
-+++ b/scripts/package/mkdebian
-@@ -94,10 +94,12 @@ else
- packageversion=$version-$revision
- fi
- sourcename=$KDEB_SOURCENAME
--packagename=linux-image-$version
--kernel_headers_packagename=linux-headers-$version
-+packagename=linux-image-"$BRANCH$LOCALVERSION"
-+kernel_headers_packagename=linux-headers-"$BRANCH$LOCALVERSION"
-+dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
- dbg_packagename=$packagename-dbg
- debarch=
-+image_name=
- set_debarch
-
- if [ "$ARCH" = "um" ] ; then
-@@ -181,6 +183,7 @@ Description: Linux kernel, version $version
-
- Package: $kernel_headers_packagename
- Architecture: $debarch
-+Depends: make, gcc, libc6-dev, flex, bison, libssl-dev
- Description: Linux kernel headers for $version on $debarch
- This package provides kernel header files for $version on $debarch
- .
-@@ -200,6 +203,11 @@ Architecture: $debarch
- Description: Linux kernel debugging symbols for $version
- This package will come in handy if you need to debug the kernel. It provides
- all the necessary debug symbols for the kernel and its modules.
-+
-+Package: $dtb_packagename
-+Architecture: $debarch
-+Description: Linux DTB, version $version
-+ This package contains device blobs from the Linux kernel, version $version
- EOF
-
- cat <<EOF > debian/rules
---
-2.16.4
-
diff --git a/patch/misc/general-packaging-4.4.y-rk3399.patch b/patch/misc/general-packaging-4.4.y-rk3399.patch
deleted file mode 100644
index bb0c925e7..000000000
--- a/patch/misc/general-packaging-4.4.y-rk3399.patch
+++ /dev/null
@@ -1,216 +0,0 @@
-diff --git a/scripts/package/builddeb b/scripts/package/builddeb
-index 6c3b038e..f4166fbe 100755
---- a/scripts/package/builddeb
-+++ b/scripts/package/builddeb
-@@ -27,6 +27,28 @@ create_package() {
- chown -R root:root "$pdir"
- chmod -R go-w "$pdir"
-
-+ # Create preinstall and post install script to remove dtb
-+ if [[ "$1" == *dtb* ]]; then
-+ echo "if [ -d /boot/dtb-$version ]; then mv /boot/dtb-$version /boot/dtb-$version.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "if [ -d /boot/dtb.old ]; then rm -rf /boot/dtb.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "if [ -d /dtb ]; then mv /dtb /dtb.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "if [ -d /boot/dtb ]; then mv /boot/dtb /boot/dtb.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "exit 0" >> $pdir/DEBIAN/preinst
-+ chmod 775 $pdir/DEBIAN/preinst
-+ #
-+ echo "if [ -d /boot/dtb-$version.old ]; then rm -rf /boot/dtb-$version.old; fi" >> $pdir/DEBIAN/postinst
-+ echo "ln -sf dtb-$version /boot/dtb > /dev/null 2>&1 || mv /boot/dtb-$version /boot/dtb" >> $pdir/DEBIAN/postinst
-+ echo "exit 0" >> $pdir/DEBIAN/postinst
-+ chmod 775 $pdir/DEBIAN/postinst
-+ fi
-+
-+ # Create postinstall script for headers
-+ if [[ "$1" == *headers* ]]; then
-+ echo "cd /usr/src/linux-headers-$version; echo \"Compiling headers - please wait ...\"; find -type f -exec touch {} +;yes "" | make oldconfig >/dev/null;make -j\$(grep -c 'processor' /proc/cpuinfo) -s scripts >/dev/null; make -s M=scripts/mod/ >/dev/null" >> $pdir/DEBIAN/postinst
-+ echo "exit 0" >> $pdir/DEBIAN/postinst
-+ chmod 775 $pdir/DEBIAN/postinst
-+ fi
-+
- # Create the package
- dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch}" -p$pname -P"$pdir"
- dpkg --build "$pdir" ..
-@@ -93,11 +115,13 @@ tmpdir="$objtree/debian/tmp"
- fwdir="$objtree/debian/fwtmp"
- kernel_headers_dir="$objtree/debian/hdrtmp"
- libc_headers_dir="$objtree/debian/headertmp"
-+dtb_dir="$objtree/debian/dtbtmp"
- dbg_dir="$objtree/debian/dbgtmp"
--packagename=linux-image-$version
--fwpackagename=linux-firmware-image-$version
--kernel_headers_packagename=linux-headers-$version
--libc_headers_packagename=linux-libc-dev
-+packagename=linux-image-"$BRANCH$LOCALVERSION"
-+fwpackagename=linux-firmware-image-"$BRANCH$LOCALVERSION"
-+kernel_headers_packagename=linux-headers-"$BRANCH$LOCALVERSION"
-+dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
-+libc_headers_packagename=linux-libc-dev-"$BRANCH$LOCALVERSION"
- dbg_packagename=$packagename-dbg
- debarch=
- forcearch=
-@@ -114,7 +138,7 @@ case $ARCH in
- um)
- installed_image_path="usr/bin/linux-$version"
- ;;
--parisc|mips|powerpc)
-+parisc|mips|powerpc|arm64)
- installed_image_path="boot/vmlinux-$version"
- ;;
- *)
-@@ -124,7 +148,9 @@ esac
- BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)"
-
- # Setup the directory structure
--rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" $objtree/debian/files
-+rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" "$dtb_dir" $objtree/debian/files
-+mkdir -m 755 -p "$dtb_dir/DEBIAN"
-+mkdir -p "$dtb_dir/boot/dtb-$version" "$dtb_dir/usr/share/doc/$dtb_packagename"
- mkdir -m 755 -p "$tmpdir/DEBIAN"
- mkdir -p "$tmpdir/lib" "$tmpdir/boot"
- mkdir -p "$fwdir/lib/firmware/$version/"
-@@ -143,9 +169,10 @@ else
- fi
- # Not all arches include the boot path in KBUILD_IMAGE
- if [ -e $KBUILD_IMAGE ]; then
-- cp $KBUILD_IMAGE "$tmpdir/$installed_image_path"
-+#Forcing KBUILD_MAGE reference to Image instead of zImage.. Armbian LINUX_KERNEL_TYPE=Image not being honored
-+ cp Image "$tmpdir/$installed_image_path"
- else
-- cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/$installed_image_path"
-+ cp arch/$ARCH/boot/Image "$tmpdir/$installed_image_path"
- fi
-
- if grep -q "^CONFIG_OF=y" $KCONFIG_CONFIG ; then
-@@ -183,6 +210,11 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
- fi
- fi
-
-+if grep -q '^CONFIG_OF=y' $KCONFIG_CONFIG ; then
-+ #mkdir -p "$tmpdir/boot/dtb"
-+ INSTALL_DTBS_PATH="$dtb_dir/boot/dtb-$version" $MAKE KBUILD_SRC= dtbs_install
-+fi
-+
- if [ "$ARCH" != "um" ]; then
- $MAKE headers_check KBUILD_SRC=
- $MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr"
-@@ -195,7 +227,7 @@ fi
- # so do we; recent versions of dracut and initramfs-tools will obey this.
- debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
- if grep -q '^CONFIG_BLK_DEV_INITRD=y' $KCONFIG_CONFIG; then
-- want_initrd=Yes
-+ want_initrd=Yes
- else
- want_initrd=No
- fi
-@@ -207,9 +239,11 @@ for script in postinst postrm preinst prerm ; do
- set -e
-
- # Pass maintainer script parameters to hook scripts
-+
- export DEB_MAINT_PARAMS="\$*"
-
- # Tell initramfs builder whether it's wanted
-+
- export INITRD=$want_initrd
-
- test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d
-@@ -218,6 +252,44 @@ EOF
- chmod 755 "$tmpdir/DEBIAN/$script"
- done
-
-+##
-+## Create sym link to kernel image
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/postinst
-+cat >> $tmpdir/DEBIAN/postinst <<EOT
-+ln -sf $(basename $installed_image_path) /boot/Image > /dev/null 2>&1 || mv /$installed_image_path /boot/Image
-+touch /boot/.next
-+exit 0
-+EOT
-+##
-+## FAT install workaround
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/preinst
-+cat >> $tmpdir/DEBIAN/preinst <<EOT
-+# exit if we are running chroot
-+if [ "\$(stat -c %d:%i /)" != "\$(stat -c %d:%i /proc/1/root/.)" ]; then exit 0; fi
-+
-+check_and_unmount (){
-+boot_device=\$(mountpoint -d /boot)
-+
-+for file in /dev/* ; do
-+ CURRENT_DEVICE=\$(printf "%d:%d" \$(stat --printf="0x%t 0x%T" \$file))
-+ if [ "\$CURRENT_DEVICE" = "\$boot_device" ]; then
-+ boot_partition=\$file
-+ break;
-+ fi
-+done
-+
-+bootfstype=\$(blkid -s TYPE -o value \$boot_partition)
-+if [ "\$bootfstype" = "vfat" ]; then
-+# we have to keep it mounted! umount /boot
-+rm -f /boot/System.map* /boot/config* /boot/vmlinuz* /boot/zImage /boot/uImage /boot/Image
-+fi
-+}
-+mountpoint -q /boot && check_and_unmount
-+EOT
-+echo "exit 0" >> $tmpdir/DEBIAN/preinst
-+
- # Try to determine maintainer and email values
- if [ -n "$DEBEMAIL" ]; then
- email=$DEBEMAIL
-@@ -328,17 +412,26 @@ fi
- (cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles"
- destdir=$kernel_headers_dir/usr/src/linux-headers-$version
- mkdir -p "$destdir"
-+######################## headers patch
-+ZACNI=$(pwd)
-+cd $destdir
-+patch -p1 < /tmp/headers-debian-byteshift.patch
-+cd $ZACNI
-+######################## headers patch
- (cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -)
- (cd $objtree; tar -c -f - -T -) < "$objtree/debian/hdrobjfiles" | (cd $destdir; tar -xf -)
- (cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be
- ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
- rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
-
-+(cd "$destdir"; make M=scripts clean)
-+
- cat <<EOF >> debian/control
-
- Package: $kernel_headers_packagename
--Provides: linux-headers, linux-headers-2.6
-+Provides: $kernel_headers_packagename
- Architecture: any
-+Depends: make, gcc, libc6-dev, libssl-dev
- Description: Linux kernel headers for $KERNELRELEASE on \${kernel:debarch}
- This package provides kernel header files for $KERNELRELEASE on \${kernel:debarch}
- .
-@@ -363,6 +456,16 @@ fi
-
- cat <<EOF >> debian/control
-
-+Package: $dtb_packagename
-+Architecture: any
-+Description: Linux DTB, version $version
-+ This package contains device blobs from the Linux kernel, version $version.
-+EOF
-+
-+create_package "$dtb_packagename" "$dtb_dir"
-+
-+cat <<EOF >> debian/control
-+
- Package: $libc_headers_packagename
- Section: devel
- Provides: $libc_headers_packagename
-@@ -374,7 +477,7 @@ EOF
-
- if [ "$ARCH" != "um" ]; then
- create_package "$kernel_headers_packagename" "$kernel_headers_dir"
-- create_package "$libc_headers_packagename" "$libc_headers_dir"
-+# create_package "$libc_headers_packagename" "$libc_headers_dir"
- fi
-
- create_package "$packagename" "$tmpdir"
diff --git a/patch/misc/general-packaging-4.4.y-rockchip64.patch b/patch/misc/general-packaging-4.4.y-rockchip64.patch
deleted file mode 100644
index c5bfe253c..000000000
--- a/patch/misc/general-packaging-4.4.y-rockchip64.patch
+++ /dev/null
@@ -1,216 +0,0 @@
-diff --git a/scripts/package/builddeb b/scripts/package/builddeb
-index 6c3b038e..f4166fbe 100755
---- a/scripts/package/builddeb
-+++ b/scripts/package/builddeb
-@@ -27,6 +27,28 @@ create_package() {
- chown -R root:root "$pdir"
- chmod -R go-w "$pdir"
-
-+ # Create preinstall and post install script to remove dtb
-+ if [[ "$1" == *dtb* ]]; then
-+ echo "if [ -d /boot/dtb-$version ]; then mv /boot/dtb-$version /boot/dtb-$version.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "if [ -d /boot/dtb.old ]; then rm -rf /boot/dtb.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "if [ -d /dtb ]; then mv /dtb /dtb.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "if [ -d /boot/dtb ]; then mv /boot/dtb /boot/dtb.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "exit 0" >> $pdir/DEBIAN/preinst
-+ chmod 775 $pdir/DEBIAN/preinst
-+ #
-+ echo "if [ -d /boot/dtb-$version.old ]; then rm -rf /boot/dtb-$version.old; fi" >> $pdir/DEBIAN/postinst
-+ echo "ln -sf dtb-$version /boot/dtb > /dev/null 2>&1 || mv /boot/dtb-$version /boot/dtb" >> $pdir/DEBIAN/postinst
-+ echo "exit 0" >> $pdir/DEBIAN/postinst
-+ chmod 775 $pdir/DEBIAN/postinst
-+ fi
-+
-+ # Create postinstall script for headers
-+ if [[ "$1" == *headers* ]]; then
-+ echo "cd /usr/src/linux-headers-$version; echo \"Compiling headers - please wait ...\"; find -type f -exec touch {} +;yes "" | make oldconfig >/dev/null;make -j\$(grep -c 'processor' /proc/cpuinfo) -s scripts >/dev/null; make -s M=scripts/mod/ >/dev/null" >> $pdir/DEBIAN/postinst
-+ echo "exit 0" >> $pdir/DEBIAN/postinst
-+ chmod 775 $pdir/DEBIAN/postinst
-+ fi
-+
- # Create the package
- dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch}" -p$pname -P"$pdir"
- dpkg --build "$pdir" ..
-@@ -93,11 +115,13 @@ tmpdir="$objtree/debian/tmp"
- fwdir="$objtree/debian/fwtmp"
- kernel_headers_dir="$objtree/debian/hdrtmp"
- libc_headers_dir="$objtree/debian/headertmp"
-+dtb_dir="$objtree/debian/dtbtmp"
- dbg_dir="$objtree/debian/dbgtmp"
--packagename=linux-image-$version
--fwpackagename=linux-firmware-image-$version
--kernel_headers_packagename=linux-headers-$version
--libc_headers_packagename=linux-libc-dev
-+packagename=linux-image-"$BRANCH$LOCALVERSION"
-+fwpackagename=linux-firmware-image-"$BRANCH$LOCALVERSION"
-+kernel_headers_packagename=linux-headers-"$BRANCH$LOCALVERSION"
-+dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
-+libc_headers_packagename=linux-libc-dev-"$BRANCH$LOCALVERSION"
- dbg_packagename=$packagename-dbg
- debarch=
- forcearch=
-@@ -114,7 +138,7 @@ case $ARCH in
- um)
- installed_image_path="usr/bin/linux-$version"
- ;;
--parisc|mips|powerpc)
-+parisc|mips|powerpc|arm64)
- installed_image_path="boot/vmlinux-$version"
- ;;
- *)
-@@ -124,7 +148,9 @@ esac
- BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)"
-
- # Setup the directory structure
--rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" $objtree/debian/files
-+rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" "$dtb_dir" $objtree/debian/files
-+mkdir -m 755 -p "$dtb_dir/DEBIAN"
-+mkdir -p "$dtb_dir/boot/dtb-$version" "$dtb_dir/usr/share/doc/$dtb_packagename"
- mkdir -m 755 -p "$tmpdir/DEBIAN"
- mkdir -p "$tmpdir/lib" "$tmpdir/boot"
- mkdir -p "$fwdir/lib/firmware/$version/"
-@@ -143,9 +169,10 @@ else
- fi
- # Not all arches include the boot path in KBUILD_IMAGE
- if [ -e $KBUILD_IMAGE ]; then
-- cp $KBUILD_IMAGE "$tmpdir/$installed_image_path"
-+#Forcing KBUILD_MAGE reference to Image instead of zImage.. Armbian LINUX_KERNEL_TYPE=Image not being honored
-+ cp Image "$tmpdir/$installed_image_path"
- else
-- cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/$installed_image_path"
-+ cp arch/$ARCH/boot/Image "$tmpdir/$installed_image_path"
- fi
-
- if grep -q "^CONFIG_OF=y" $KCONFIG_CONFIG ; then
-@@ -183,6 +210,11 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
- fi
- fi
-
-+if grep -q '^CONFIG_OF=y' $KCONFIG_CONFIG ; then
-+ #mkdir -p "$tmpdir/boot/dtb"
-+ INSTALL_DTBS_PATH="$dtb_dir/boot/dtb-$version" $MAKE KBUILD_SRC= dtbs_install
-+fi
-+
- if [ "$ARCH" != "um" ]; then
- $MAKE headers_check KBUILD_SRC=
- $MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr"
-@@ -195,7 +227,7 @@ fi
- # so do we; recent versions of dracut and initramfs-tools will obey this.
- debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
- if grep -q '^CONFIG_BLK_DEV_INITRD=y' $KCONFIG_CONFIG; then
-- want_initrd=Yes
-+ want_initrd=Yes
- else
- want_initrd=No
- fi
-@@ -207,9 +239,11 @@ for script in postinst postrm preinst prerm ; do
- set -e
-
- # Pass maintainer script parameters to hook scripts
-+
- export DEB_MAINT_PARAMS="\$*"
-
- # Tell initramfs builder whether it's wanted
-+
- export INITRD=$want_initrd
-
- test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d
-@@ -218,6 +252,44 @@ EOF
- chmod 755 "$tmpdir/DEBIAN/$script"
- done
-
-+##
-+## Create sym link to kernel image
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/postinst
-+cat >> $tmpdir/DEBIAN/postinst <<EOT
-+ln -sf $(basename $installed_image_path) /boot/Image > /dev/null 2>&1 || mv /$installed_image_path /boot/Image
-+touch /boot/.next
-+exit 0
-+EOT
-+##
-+## FAT install workaround
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/preinst
-+cat >> $tmpdir/DEBIAN/preinst <<EOT
-+# exit if we are running chroot
-+if [ "\$(stat -c %d:%i /)" != "\$(stat -c %d:%i /proc/1/root/.)" ]; then exit 0; fi
-+
-+check_and_unmount (){
-+boot_device=\$(mountpoint -d /boot)
-+
-+for file in /dev/* ; do
-+ CURRENT_DEVICE=\$(printf "%d:%d" \$(stat --printf="0x%t 0x%T" \$file))
-+ if [[ "\$CURRENT_DEVICE" = "\$boot_device" ]]; then
-+ boot_partition=\$file
-+ break;
-+ fi
-+done
-+
-+bootfstype=\$(blkid -s TYPE -o value \$boot_partition)
-+if [ "\$bootfstype" = "vfat" ]; then
-+# we have to keep it mounted! umount /boot
-+rm -f /boot/System.map* /boot/config* /boot/vmlinuz* /boot/zImage /boot/uImage /boot/Image
-+fi
-+}
-+mountpoint -q /boot && check_and_unmount
-+EOT
-+echo "exit 0" >> $tmpdir/DEBIAN/preinst
-+
- # Try to determine maintainer and email values
- if [ -n "$DEBEMAIL" ]; then
- email=$DEBEMAIL
-@@ -328,17 +412,26 @@ fi
- (cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles"
- destdir=$kernel_headers_dir/usr/src/linux-headers-$version
- mkdir -p "$destdir"
-+######################## headers patch
-+ZACNI=$(pwd)
-+cd $destdir
-+patch -p1 < /tmp/headers-debian-byteshift.patch
-+cd $ZACNI
-+######################## headers patch
- (cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -)
- (cd $objtree; tar -c -f - -T -) < "$objtree/debian/hdrobjfiles" | (cd $destdir; tar -xf -)
- (cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be
- ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
- rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
-
-+(cd "$destdir"; make M=scripts clean)
-+
- cat <<EOF >> debian/control
-
- Package: $kernel_headers_packagename
--Provides: linux-headers, linux-headers-rockchip, linux-headers-rockchip-4.4
-+Provides: $kernel_headers_packagename
- Architecture: any
-+Depends: make, gcc, libc6-dev, libssl-dev
- Description: Linux kernel headers for $KERNELRELEASE on \${kernel:debarch}
- This package provides kernel header files for $KERNELRELEASE on \${kernel:debarch}
- .
-@@ -363,6 +456,16 @@ fi
-
- cat <<EOF >> debian/control
-
-+Package: $dtb_packagename
-+Architecture: any
-+Description: Linux DTB, version $version
-+ This package contains device blobs from the Linux kernel, version $version.
-+EOF
-+
-+create_package "$dtb_packagename" "$dtb_dir"
-+
-+cat <<EOF >> debian/control
-+
- Package: $libc_headers_packagename
- Section: devel
- Provides: $libc_headers_packagename
-@@ -374,7 +477,7 @@ EOF
-
- if [ "$ARCH" != "um" ]; then
- create_package "$kernel_headers_packagename" "$kernel_headers_dir"
-- create_package "$libc_headers_packagename" "$libc_headers_dir"
-+# create_package "$libc_headers_packagename" "$libc_headers_dir"
- fi
-
- create_package "$packagename" "$tmpdir"
diff --git a/patch/misc/general-packaging-4.4.y.patch b/patch/misc/general-packaging-4.4.y.patch
deleted file mode 100644
index f6d351a7e..000000000
--- a/patch/misc/general-packaging-4.4.y.patch
+++ /dev/null
@@ -1,230 +0,0 @@
-diff --git a/scripts/package/builddeb b/scripts/package/builddeb
-index 6c3b038e..977a0624 100755
---- a/scripts/package/builddeb
-+++ b/scripts/package/builddeb
-@@ -27,6 +27,28 @@
- chown -R root:root "$pdir"
- chmod -R go-w "$pdir"
-
-+ # Create preinstall and post install script to remove dtb
-+ if [[ "$1" == *dtb* ]]; then
-+ echo "if [ -d /boot/dtb-$version ]; then mv /boot/dtb-$version /boot/dtb-$version.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "if [ -d /boot/dtb.old ]; then rm -rf /boot/dtb.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "if [ -d /dtb ]; then mv /dtb /dtb.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "if [ -d /boot/dtb ]; then mv /boot/dtb /boot/dtb.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "exit 0" >> $pdir/DEBIAN/preinst
-+ chmod 775 $pdir/DEBIAN/preinst
-+ #
-+ echo "if [ -d /boot/dtb-$version.old ]; then rm -rf /boot/dtb-$version.old; fi" >> $pdir/DEBIAN/postinst
-+ echo "ln -sf dtb-$version /boot/dtb > /dev/null 2>&1 || mv /boot/dtb-$version /boot/dtb" >> $pdir/DEBIAN/postinst
-+ echo "exit 0" >> $pdir/DEBIAN/postinst
-+ chmod 775 $pdir/DEBIAN/postinst
-+ fi
-+
-+ # Create postinstall script for headers
-+ if [[ "$1" == *headers* ]]; then
-+ echo "cd /usr/src/linux-headers-$version; echo \"Compiling headers - please wait ...\"; find -type f -exec touch {} +;yes "" | make oldconfig >/dev/null;make -j\$(grep -c 'processor' /proc/cpuinfo) -s scripts >/dev/null; make -s M=scripts/mod/ >/dev/null" >> $pdir/DEBIAN/postinst
-+ echo "exit 0" >> $pdir/DEBIAN/postinst
-+ chmod 775 $pdir/DEBIAN/postinst
-+ fi
-+
- # Create the package
- dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch}" -p$pname -P"$pdir"
- dpkg --build "$pdir" ..
-@@ -50,8 +72,11 @@
- mips*)
- debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el || true) ;;
- arm64)
-- debarch=arm64 ;;
-+ debarch=arm64
-+ image_name=Image
-+ ;;
- arm*)
-+ image_name=zImage
- if grep -q CONFIG_AEABI=y $KCONFIG_CONFIG; then
- if grep -q CONFIG_VFP=y $KCONFIG_CONFIG; then
- debarch=armhf
-@@ -93,11 +118,13 @@
- fwdir="$objtree/debian/fwtmp"
- kernel_headers_dir="$objtree/debian/hdrtmp"
- libc_headers_dir="$objtree/debian/headertmp"
-+dtb_dir="$objtree/debian/dtbtmp"
- dbg_dir="$objtree/debian/dbgtmp"
--packagename=linux-image-$version
--fwpackagename=linux-firmware-image-$version
--kernel_headers_packagename=linux-headers-$version
--libc_headers_packagename=linux-libc-dev
-+packagename=linux-image-"$BRANCH$LOCALVERSION"
-+fwpackagename=linux-firmware-image-"$BRANCH$LOCALVERSION"
-+kernel_headers_packagename=linux-headers-"$BRANCH$LOCALVERSION"
-+dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
-+libc_headers_packagename=linux-libc-dev-"$BRANCH$LOCALVERSION"
- dbg_packagename=$packagename-dbg
- debarch=
- forcearch=
-@@ -124,7 +151,9 @@
- BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)"
-
- # Setup the directory structure
--rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" $objtree/debian/files
-+rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" "$dtb_dir" $objtree/debian/files
-+mkdir -m 755 -p "$dtb_dir/DEBIAN"
-+mkdir -p "$dtb_dir/boot/dtb-$version" "$dtb_dir/usr/share/doc/$dtb_packagename"
- mkdir -m 755 -p "$tmpdir/DEBIAN"
- mkdir -p "$tmpdir/lib" "$tmpdir/boot"
- mkdir -p "$fwdir/lib/firmware/$version/"
-@@ -183,6 +212,11 @@
- fi
- fi
-
-+if grep -q '^CONFIG_OF=y' $KCONFIG_CONFIG ; then
-+ #mkdir -p "$tmpdir/boot/dtb"
-+ INSTALL_DTBS_PATH="$dtb_dir/boot/dtb-$version" $MAKE KBUILD_SRC= dtbs_install
-+fi
-+
- if [ "$ARCH" != "um" ]; then
- $MAKE headers_check KBUILD_SRC=
- $MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr"
-@@ -195,21 +229,23 @@
- # so do we; recent versions of dracut and initramfs-tools will obey this.
- debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
- if grep -q '^CONFIG_BLK_DEV_INITRD=y' $KCONFIG_CONFIG; then
-- want_initrd=Yes
-+ want_initrd=Yes
- else
- want_initrd=No
- fi
- for script in postinst postrm preinst prerm ; do
- mkdir -p "$tmpdir$debhookdir/$script.d"
- cat <<EOF > "$tmpdir/DEBIAN/$script"
--#!/bin/sh
-+#!/bin/bash
-
- set -e
-
- # Pass maintainer script parameters to hook scripts
-+
- export DEB_MAINT_PARAMS="\$*"
-
- # Tell initramfs builder whether it's wanted
-+
- export INITRD=$want_initrd
-
- test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d
-@@ -218,6 +254,44 @@
- chmod 755 "$tmpdir/DEBIAN/$script"
- done
-
-+##
-+## Create sym link to kernel image
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/postinst
-+cat >> $tmpdir/DEBIAN/postinst <<EOT
-+ln -sf $(basename $installed_image_path) /boot/$image_name > /dev/null 2>&1 || mv /$installed_image_path /boot/$image_name
-+touch /boot/.next
-+exit 0
-+EOT
-+##
-+## FAT install workaround
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/preinst
-+cat >> $tmpdir/DEBIAN/preinst <<EOT
-+# exit if we are running chroot
-+if [ "\$(stat -c %d:%i /)" != "\$(stat -c %d:%i /proc/1/root/.)" ]; then exit 0; fi
-+
-+check_and_unmount (){
-+boot_device=\$(mountpoint -d /boot)
-+
-+for file in /dev/* ; do
-+ CURRENT_DEVICE=\$(printf "%d:%d" \$(stat --printf="0x%t 0x%T" \$file))
-+ if [[ "\$CURRENT_DEVICE" = "\$boot_device" ]]; then
-+ boot_partition=\$file
-+ break;
-+ fi
-+done
-+
-+bootfstype=\$(blkid -s TYPE -o value \$boot_partition)
-+if [ "\$bootfstype" = "vfat" ]; then
-+# we have to keep it mounted! umount /boot
-+rm -f /boot/System.map* /boot/config* /boot/vmlinuz* /boot/$image_name /boot/uImage
-+fi
-+}
-+mountpoint -q /boot && check_and_unmount
-+EOT
-+echo "exit 0" >> $tmpdir/DEBIAN/preinst
-+
- # Try to determine maintainer and email values
- if [ -n "$DEBEMAIL" ]; then
- email=$DEBEMAIL
-@@ -293,7 +376,7 @@
- cat <<EOF >> debian/control
-
- Package: $packagename
--Provides: linux-image, linux-image-2.6, linux-modules-$version
-+Provides: $packagename
- Architecture: any
- Description: User Mode Linux kernel, version $version
- User-mode Linux is a port of the Linux kernel to its own system call
-@@ -310,7 +393,7 @@
- cat <<EOF >> debian/control
-
- Package: $packagename
--Provides: linux-image, linux-image-2.6, linux-modules-$version
-+Provides: $packagename
- Suggests: $fwpackagename
- Architecture: any
- Description: Linux kernel, version $version
-@@ -328,17 +411,26 @@
- (cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles"
- destdir=$kernel_headers_dir/usr/src/linux-headers-$version
- mkdir -p "$destdir"
-+######################## headers patch
-+ZACNI=$(pwd)
-+cd $destdir
-+patch -p1 < /tmp/headers-debian-byteshift.patch
-+cd $ZACNI
-+######################## headers patch
- (cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -)
- (cd $objtree; tar -c -f - -T -) < "$objtree/debian/hdrobjfiles" | (cd $destdir; tar -xf -)
- (cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be
- ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
- rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
-
-+(cd "$destdir"; make M=scripts clean)
-+
- cat <<EOF >> debian/control
-
- Package: $kernel_headers_packagename
--Provides: linux-headers, linux-headers-2.6
-+Provides: $kernel_headers_packagename
- Architecture: any
-+Depends: make, gcc, libc6-dev, libssl-dev
- Description: Linux kernel headers for $KERNELRELEASE on \${kernel:debarch}
- This package provides kernel header files for $KERNELRELEASE on \${kernel:debarch}
- .
-@@ -363,6 +457,16 @@
-
- cat <<EOF >> debian/control
-
-+Package: $dtb_packagename
-+Architecture: any
-+Description: Linux DTB, version $version
-+ This package contains device blobs from the Linux kernel, version $version.
-+EOF
-+
-+create_package "$dtb_packagename" "$dtb_dir"
-+
-+cat <<EOF >> debian/control
-+
- Package: $libc_headers_packagename
- Section: devel
- Provides: linux-kernel-headers
-@@ -374,7 +478,7 @@
-
- if [ "$ARCH" != "um" ]; then
- create_package "$kernel_headers_packagename" "$kernel_headers_dir"
-- create_package "$libc_headers_packagename" "$libc_headers_dir"
-+# create_package "$libc_headers_packagename" "$libc_headers_dir"
- fi
-
- create_package "$packagename" "$tmpdir"
diff --git a/patch/misc/general-packaging-4.9.y.patch b/patch/misc/general-packaging-4.9.y.patch
deleted file mode 100644
index 1db057cc1..000000000
--- a/patch/misc/general-packaging-4.9.y.patch
+++ /dev/null
@@ -1,199 +0,0 @@
-diff --git a/scripts/package/builddeb b/scripts/package/builddeb
-index 0a2a7372..87edac65 100755
---- a/scripts/package/builddeb
-+++ b/scripts/package/builddeb
-@@ -29,6 +29,28 @@ create_package() {
- # in case we are in a restrictive umask environment like 0077
- chmod -R a+rX "$pdir"
-
-+ # Create preinstall and post install script to remove dtb
-+ if [[ "$1" == *dtb* ]]; then
-+ echo "if [ -d /boot/dtb-$version ]; then mv /boot/dtb-$version /boot/dtb-$version.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "if [ -d /boot/dtb.old ]; then rm -rf /boot/dtb.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "if [ -d /dtb ]; then mv /dtb /dtb.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "if [ -d /boot/dtb ]; then mv /boot/dtb /boot/dtb.old; fi" >> $pdir/DEBIAN/preinst
-+ echo "exit 0" >> $pdir/DEBIAN/preinst
-+ chmod 775 $pdir/DEBIAN/preinst
-+ #
-+ echo "if [ -d /boot/dtb-$version.old ]; then rm -rf /boot/dtb-$version.old; fi" >> $pdir/DEBIAN/postinst
-+ echo "ln -sf dtb-$version /boot/dtb > /dev/null 2>&1 || mv /boot/dtb-$version /boot/dtb" >> $pdir/DEBIAN/postinst
-+ echo "exit 0" >> $pdir/DEBIAN/postinst
-+ chmod 775 $pdir/DEBIAN/postinst
-+ fi
-+
-+ # Create postinstall script for headers
-+ if [[ "$1" == *headers* ]]; then
-+ echo "cd /usr/src/linux-headers-$version; echo \"Compiling headers - please wait ...\"; find -type f -exec touch {} +;yes "" | make oldconfig >/dev/null;make -j\$(grep -c 'processor' /proc/cpuinfo) -s scripts >/dev/null; make -s M=scripts/mod/ >/dev/null" >> $pdir/DEBIAN/postinst
-+ echo "exit 0" >> $pdir/DEBIAN/postinst
-+ chmod 775 $pdir/DEBIAN/postinst
-+ fi
-+
- # Create the package
- dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch}" -p$pname -P"$pdir"
- dpkg --build "$pdir" ..
-@@ -95,11 +117,13 @@ tmpdir="$objtree/debian/tmp"
- fwdir="$objtree/debian/fwtmp"
- kernel_headers_dir="$objtree/debian/hdrtmp"
- libc_headers_dir="$objtree/debian/headertmp"
-+dtb_dir="$objtree/debian/dtbtmp"
- dbg_dir="$objtree/debian/dbgtmp"
--packagename=linux-image-$version
--fwpackagename=linux-firmware-image-$version
--kernel_headers_packagename=linux-headers-$version
--libc_headers_packagename=linux-libc-dev
-+packagename=linux-image-"$BRANCH$LOCALVERSION"
-+fwpackagename=linux-firmware-image-"$BRANCH$LOCALVERSION"
-+kernel_headers_packagename=linux-headers-"$BRANCH$LOCALVERSION"
-+dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
-+libc_headers_packagename=linux-libc-dev-"$BRANCH$LOCALVERSION"
- dbg_packagename=$packagename-dbg
- debarch=
- forcearch=
-@@ -126,7 +150,9 @@ esac
- BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)"
-
- # Setup the directory structure
--rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" $objtree/debian/files
-+rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" "$dtb_dir" $objtree/debian/files
-+mkdir -m 755 -p "$dtb_dir/DEBIAN"
-+mkdir -p "$dtb_dir/boot/dtb-$version" "$dtb_dir/usr/share/doc/$dtb_packagename"
- mkdir -m 755 -p "$tmpdir/DEBIAN"
- mkdir -p "$tmpdir/lib" "$tmpdir/boot"
- mkdir -p "$fwdir/lib/firmware/$version/"
-@@ -185,6 +211,11 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
- fi
- fi
-
-+if grep -q '^CONFIG_OF=y' $KCONFIG_CONFIG ; then
-+ #mkdir -p "$tmpdir/boot/dtb"
-+ INSTALL_DTBS_PATH="$dtb_dir/boot/dtb-$version" $MAKE KBUILD_SRC= dtbs_install
-+fi
-+
- if [ "$ARCH" != "um" ]; then
- $MAKE headers_check KBUILD_SRC=
- $MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr"
-@@ -197,21 +228,23 @@ fi
- # so do we; recent versions of dracut and initramfs-tools will obey this.
- debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
- if grep -q '^CONFIG_BLK_DEV_INITRD=y' $KCONFIG_CONFIG; then
-- want_initrd=Yes
-+ want_initrd=Yes
- else
- want_initrd=No
- fi
- for script in postinst postrm preinst prerm ; do
- mkdir -p "$tmpdir$debhookdir/$script.d"
- cat <<EOF > "$tmpdir/DEBIAN/$script"
--#!/bin/sh
-+#!/bin/bash
-
- set -e
-
- # Pass maintainer script parameters to hook scripts
-+
- export DEB_MAINT_PARAMS="\$*"
-
- # Tell initramfs builder whether it's wanted
-+
- export INITRD=$want_initrd
-
- test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d
-@@ -220,6 +253,44 @@ EOF
- chmod 755 "$tmpdir/DEBIAN/$script"
- done
-
-+##
-+## Create sym link to kernel image
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/postinst
-+cat >> $tmpdir/DEBIAN/postinst <<EOT
-+ln -sf $(basename $installed_image_path) /boot/zImage > /dev/null 2>&1 || mv /$installed_image_path /boot/zImage
-+touch /boot/.next
-+exit 0
-+EOT
-+##
-+## FAT install workaround
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/preinst
-+cat >> $tmpdir/DEBIAN/preinst <<EOT
-+# exit if we are running chroot
-+if [ "\$(stat -c %d:%i /)" != "\$(stat -c %d:%i /proc/1/root/.)" ]; then exit 0; fi
-+
-+check_and_unmount (){
-+boot_device=\$(mountpoint -d /boot)
-+
-+for file in /dev/* ; do
-+ CURRENT_DEVICE=\$(printf "%d:%d" \$(stat --printf="0x%t 0x%T" \$file))
-+ if [[ "\$CURRENT_DEVICE" = "\$boot_device" ]]; then
-+ boot_partition=\$file
-+ break;
-+ fi
-+done
-+
-+bootfstype=\$(blkid -s TYPE -o value \$boot_partition)
-+if [ "\$bootfstype" = "vfat" ]; then
-+# we have to keep it mounted! umount /boot
-+rm -f /boot/System.map* /boot/config* /boot/vmlinuz* /boot/zImage /boot/uImage
-+fi
-+}
-+mountpoint -q /boot && check_and_unmount
-+EOT
-+echo "exit 0" >> $tmpdir/DEBIAN/preinst
-+
- # Try to determine maintainer and email values
- if [ -n "$DEBEMAIL" ]; then
- email=$DEBEMAIL
-@@ -337,17 +417,26 @@ if grep -q '^CONFIG_GCC_PLUGINS=y' $KCONFIG_CONFIG ; then
- fi
- destdir=$kernel_headers_dir/usr/src/linux-headers-$version
- mkdir -p "$destdir"
-+######################## headers patch
-+ZACNI=$(pwd)
-+cd $destdir
-+patch -p1 < /tmp/headers-debian-byteshift.patch
-+cd $ZACNI
-+######################## headers patch
- (cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -)
- (cd $objtree; tar -c -f - -T -) < "$objtree/debian/hdrobjfiles" | (cd $destdir; tar -xf -)
- (cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be
- ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
- rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
-
-+(cd "$destdir"; make M=scripts clean)
-+
- cat <<EOF >> debian/control
-
- Package: $kernel_headers_packagename
--Provides: linux-headers, linux-headers-2.6
-+Provides: $kernel_headers_packagename
- Architecture: any
-+Depends: make, gcc, libc6-dev, libssl-dev
- Description: Linux kernel headers for $KERNELRELEASE on \${kernel:debarch}
- This package provides kernel header files for $KERNELRELEASE on \${kernel:debarch}
- .
-@@ -372,6 +461,16 @@ fi
-
- cat <<EOF >> debian/control
-
-+Package: $dtb_packagename
-+Architecture: any
-+Description: Linux DTB, version $version
-+ This package contains device blobs from the Linux kernel, version $version.
-+EOF
-+
-+create_package "$dtb_packagename" "$dtb_dir"
-+
-+cat <<EOF >> debian/control
-+
- Package: $libc_headers_packagename
- Section: devel
- Provides: $libc_headers_packagename
-@@ -383,7 +482,7 @@ EOF
-
- if [ "$ARCH" != "um" ]; then
- create_package "$kernel_headers_packagename" "$kernel_headers_dir"
-- create_package "$libc_headers_packagename" "$libc_headers_dir"
-+# create_package "$libc_headers_packagename" "$libc_headers_dir"
- fi
-
- create_package "$packagename" "$tmpdir"
diff --git a/patch/misc/general-packaging-5.10.y.patch b/patch/misc/general-packaging-5.10.y.patch
deleted file mode 100644
index 67f8d3595..000000000
--- a/patch/misc/general-packaging-5.10.y.patch
+++ /dev/null
@@ -1,367 +0,0 @@
-diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
-index 5858d6e44..e81b8a6fc 100644
---- a/arch/arm64/Makefile
-+++ b/arch/arm64/Makefile
-@@ -142,7 +142,7 @@ core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
-
- # Default target when executing plain make
- boot := arch/arm64/boot
--KBUILD_IMAGE := $(boot)/Image.gz
-+KBUILD_IMAGE := $(boot)/Image
-
- all: Image.gz
-
-diff --git a/scripts/package/builddeb b/scripts/package/builddeb
-index 1b11f8993..c21d931ea 100755
---- a/scripts/package/builddeb
-+++ b/scripts/package/builddeb
-@@ -26,31 +26,62 @@
-
- create_package() {
- local pname="$1" pdir="$2"
-- local dpkg_deb_opts
-
- mkdir -m 755 -p "$pdir/DEBIAN"
- mkdir -p "$pdir/usr/share/doc/$pname"
- cp debian/copyright "$pdir/usr/share/doc/$pname/"
- cp debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian"
-- gzip -n -9 "$pdir/usr/share/doc/$pname/changelog.Debian"
-+ gzip -9 "$pdir/usr/share/doc/$pname/changelog.Debian"
- sh -c "cd '$pdir'; find . -type f ! -path './DEBIAN/*' -printf '%P\0' \
- | xargs -r0 md5sum > DEBIAN/md5sums"
-
- # Fix ownership and permissions
-- if [ "$DEB_RULES_REQUIRES_ROOT" = "no" ]; then
-- dpkg_deb_opts="--root-owner-group"
-- else
-- chown -R root:root "$pdir"
-- fi
-+ chown -R root:root "$pdir"
- chmod -R go-w "$pdir"
- # in case we are in a restrictive umask environment like 0077
- chmod -R a+rX "$pdir"
-- # in case we build in a setuid/setgid directory
-- chmod -R ug-s "$pdir"
-+
-+ # Create preinstall and post install script to remove dtb
-+ if [ "$3" = "dtb" ]; then
-+
-+ cat >> $pdir/DEBIAN/preinst <<EOT
-+rm -rf /boot/dtb-$version; rm -rf /boot/dtb
-+exit 0
-+EOT
-+
-+ cat >> $pdir/DEBIAN/postinst <<EOT
-+cd /boot
-+ln -sfT dtb-$version dtb 2> /dev/null || mv dtb-$version dtb
-+exit 0
-+EOT
-+
-+ chmod 775 $pdir/DEBIAN/preinst ; chmod 775 $pdir/DEBIAN/postinst
-+ fi
-+
-+ # Create postinst prerm scripts for headers
-+ if [ "$3" = "headers" ]; then
-+
-+cat >> $pdir/DEBIAN/postinst << EOT
-+cd /usr/src/linux-headers-$version
-+echo "Compiling headers - please wait ..."
-+find -type f -exec touch {} +
-+yes "" | make oldconfig >/dev/null
-+make -j\$(grep -c 'processor' /proc/cpuinfo) -s scripts >/dev/null
-+make -j\$(grep -c 'processor' /proc/cpuinfo) -s M=scripts/mod/ >/dev/null
-+exit 0
-+EOT
-+
-+cat >> $pdir/DEBIAN/prerm << EOT
-+cd /usr/src/linux-headers-$version
-+rm -rf scripts .config.old
-+EOT
-+
-+ chmod 775 $pdir/DEBIAN/postinst ; chmod 775 $pdir/DEBIAN/prerm
-+ fi
-
- # Create the package
- dpkg-gencontrol -p$pname -P"$pdir"
-- dpkg-deb $dpkg_deb_opts ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir" ..
-+ dpkg-deb ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir" ..
- }
-
- deploy_kernel_headers () {
-@@ -62,7 +92,7 @@
- cd $srctree
- find . arch/$SRCARCH -maxdepth 1 -name Makefile\*
- find include scripts -type f -o -type l
-- find arch/$SRCARCH -name Kbuild.platforms -o -name Platform
-+ find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform
- find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f
- ) > debian/hdrsrcfiles
-
-@@ -107,9 +137,15 @@
- }
-
- version=$KERNELRELEASE
--tmpdir=debian/linux-image
--dbg_dir=debian/linux-image-dbg
--packagename=linux-image-$version
-+tmpdir="$objtree/debian/tmp"
-+kernel_headers_dir="$objtree/debian/hdrtmp"
-+libc_headers_dir="$objtree/debian/headertmp"
-+dbg_dir="$objtree/debian/dbgtmp"
-+dtb_dir="$objtree/debian/dtbtmp"
-+packagename=linux-image-"$BRANCH$LOCALVERSION"
-+kernel_headers_packagename=linux-headers-"$BRANCH$LOCALVERSION"
-+dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
-+libc_headers_packagename=linux-libc-dev-"$BRANCH$LOCALVERSION"
- dbg_packagename=$packagename-dbg
-
- if [ "$ARCH" = "um" ] ; then
-@@ -120,6 +156,15 @@
- # XXX: have each arch Makefile export a variable of the canonical image install
- # path instead
- case $ARCH in
-+aarch64|arm64)
-+ image_name=Image
-+ installed_image_path="boot/vmlinuz-$version"
-+
-+ ;;
-+arm*)
-+ image_name=zImage
-+ installed_image_path="boot/vmlinuz-$version"
-+ ;;
- um)
- installed_image_path="usr/bin/linux-$version"
- ;;
-@@ -133,13 +178,17 @@
- BUILD_DEBUG=$(if_enabled_echo CONFIG_DEBUG_INFO Yes)
-
- # Setup the directory structure
--rm -rf "$tmpdir" "$dbg_dir" debian/files
-+rm -rf "$tmpdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" "$dtb_dir" $objtree/debian/files
-+mkdir -m 755 -p "$dtb_dir/DEBIAN"
-+mkdir -p "$dtb_dir/boot/dtb-$version" "$dtb_dir/usr/share/doc/$dtb_packagename"
- mkdir -m 755 -p "$tmpdir/DEBIAN"
- mkdir -p "$tmpdir/lib" "$tmpdir/boot"
-+mkdir -p "$kernel_headers_dir/lib/modules/$version/"
-
--# Install the kernel
-+# Build and install the kernel
- if [ "$ARCH" = "um" ] ; then
- mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" "$tmpdir/usr/share/doc/$packagename"
-+ $MAKE linux
- cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
- cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config"
- gzip "$tmpdir/usr/share/doc/$packagename/config"
-@@ -183,6 +232,21 @@
- fi
- fi
-
-+if grep -q '^CONFIG_OF=y' $KCONFIG_CONFIG ; then
-+ #mkdir -p "$tmpdir/boot/dtb"
-+ INSTALL_DTBS_PATH="$dtb_dir/boot/dtb-$version" $MAKE KBUILD_SRC= dtbs_install
-+fi
-+
-+if [ "$ARCH" != "um" ]; then
-+ $MAKE -f $srctree/Makefile headers
-+ $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
-+ # move asm headers to /usr/include/<libc-machine>/asm to match the structure
-+ # used by Debian-based distros (to support multi-arch)
-+ host_arch=$(dpkg-architecture -a$(cat debian/arch) -qDEB_HOST_MULTIARCH)
-+ mkdir $libc_headers_dir/usr/include/$host_arch
-+ mv $libc_headers_dir/usr/include/asm $libc_headers_dir/usr/include/$host_arch/
-+fi
-+
- # Install the maintainer scripts
- # Note: hook scripts under /etc/kernel are also executed by official Debian
- # kernel packages, as well as kernel packages built using make-kpkg.
-@@ -192,7 +256,7 @@
- for script in postinst postrm preinst prerm ; do
- mkdir -p "$tmpdir$debhookdir/$script.d"
- cat <<EOF > "$tmpdir/DEBIAN/$script"
--#!/bin/sh
-+#!/bin/bash
-
- set -e
-
-@@ -208,14 +272,73 @@
- chmod 755 "$tmpdir/DEBIAN/$script"
- done
-
--if [ "$ARCH" != "um" ]; then
-- if is_enabled CONFIG_MODULES; then
-- deploy_kernel_headers debian/linux-headers
-- create_package linux-headers-$version debian/linux-headers
-+##
-+## Create sym link to kernel image
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/postinst
-+cat >> $tmpdir/DEBIAN/postinst <<EOT
-+ln -sf $(basename $installed_image_path) /boot/$image_name 2> /dev/null || cp /$installed_image_path /boot/$image_name
-+touch /boot/.next
-+exit 0
-+EOT
-+
-+##
-+## FAT install workaround
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/preinst
-+cat >> $tmpdir/DEBIAN/preinst <<EOT
-+# exit if we are running chroot
-+if [ "\$(stat -c %d:%i /)" != "\$(stat -c %d:%i /proc/1/root/.)" ]; then exit 0; fi
-+
-+check_and_unmount (){
-+ boot_device=\$(mountpoint -d /boot)
-+
-+ for file in /dev/* ; do
-+ CURRENT_DEVICE=\$(printf "%d:%d" \$(stat --printf="0x%t 0x%T" \$file))
-+ if [[ "\$CURRENT_DEVICE" = "\$boot_device" ]]; then
-+ boot_partition=\$file
-+ break
-+ fi
-+ done
-+
-+ bootfstype=\$(blkid -s TYPE -o value \$boot_partition)
-+ if [ "\$bootfstype" = "vfat" ]; then
-+ # we have to keep it mounted! umount /boot
-+ rm -f /boot/System.map* /boot/config* /boot/vmlinuz* /boot/$image_name /boot/uImage
- fi
-+}
-+mountpoint -q /boot && check_and_unmount
-+EOT
-+echo "exit 0" >> $tmpdir/DEBIAN/preinst
-+
-+# Build kernel header package
-+(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl) > "$objtree/debian/hdrsrcfiles"
-+(cd $srctree; find arch/*/include include scripts -type f -o -type l) >> "$objtree/debian/hdrsrcfiles"
-+(cd $srctree; find security/*/include -type f) >> "$objtree/debian/hdrsrcfiles"
-+(cd $srctree; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> "$objtree/debian/hdrsrcfiles"
-+(cd $srctree; find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> "$objtree/debian/hdrsrcfiles"
-+ldstemp=$(mktemp);cp scripts/module.lds $ldstemp
-+(cd $objtree; make M=scripts clean;)
-+if is_enabled CONFIG_STACK_VALIDATION; then
-+ (cd $objtree; find tools/objtool -type f -executable) >> "$objtree/debian/hdrobjfiles"
-+fi
-+(cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles"
-+if is_enabled CONFIG_GCC_PLUGINS; then
-+ (cd $objtree; find scripts/gcc-plugins -name \*.so -o -name gcc-common.h) >> "$objtree/debian/hdrobjfiles"
-+fi
-+destdir=$kernel_headers_dir/usr/src/linux-headers-$version
-+mkdir -p "$destdir"
-+(cd $destdir; patch -p1 < /tmp/headers-debian-byteshift.patch)
-+(cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -)
-+(cd $objtree; tar -c -f - -T -) < "$objtree/debian/hdrobjfiles" | (cd $destdir; tar -xf -)
-+(cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be
-+mv ${ldstemp} $destdir/scripts/module.lds
-+ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
-+rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
-
-- deploy_libc_headers debian/linux-libc-dev
-- create_package linux-libc-dev debian/linux-libc-dev
-+if [ "$ARCH" != "um" ]; then
-+ create_package "$kernel_headers_packagename" "$kernel_headers_dir" "headers"
-+ create_package "$dtb_packagename" "$dtb_dir" "dtb"
- fi
-
- create_package "$packagename" "$tmpdir"
-diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
-index 60a2a63a5..7c6197efa 100755
---- a/scripts/package/mkdebian
-+++ b/scripts/package/mkdebian
-@@ -94,16 +94,18 @@ else
- packageversion=$version-$revision
- fi
- sourcename=$KDEB_SOURCENAME
-+packagename=linux-image-$BRANCH$LOCALVERSION
-+kernel_headers_packagename=linux-headers-$BRANCH$LOCALVERSION
-+dtb_packagename=linux-dtb-$BRANCH$LOCALVERSION
-+dbg_packagename=$packagename-dbg
-+debarch=
-+image_name=
-+set_debarch
-
- if [ "$ARCH" = "um" ] ; then
-- packagename=user-mode-linux
--else
-- packagename=linux-image
-+ packagename=user-mode-linux-$version
- fi
-
--debarch=
--set_debarch
--
- email=${DEBEMAIL-$EMAIL}
-
- # use email string directly if it contains <email>
-@@ -174,16 +176,28 @@ Source: $sourcename
- Section: kernel
- Priority: optional
- Maintainer: $maintainer
--Rules-Requires-Root: no
- Build-Depends: bc, rsync, kmod, cpio, bison, flex | flex:native $extra_build_depends
- Homepage: https://www.kernel.org/
-
--Package: $packagename-$version
-+Package: $packagename
- Architecture: $debarch
- Description: Linux kernel, version $version
- This package contains the Linux kernel, modules and corresponding other
- files, version: $version.
-
-+Package: $dtb_packagename
-+Architecture: $debarch
-+Description: Linux DTB, version $version
-+ This package contains device blobs from the Linux kernel, version $version
-+
-+Package: $kernel_headers_packagename
-+Architecture: $debarch
-+Depends: make, gcc, libc6-dev, bison, flex, libssl-dev
-+Description: Linux kernel headers for $version on $debarch
-+ This package provides kernel header files for $version on $debarch
-+ .
-+ This is useful for people who need to build external modules
-+
- Package: linux-libc-dev
- Section: devel
- Provides: linux-kernel-headers
-@@ -194,22 +208,10 @@ Description: Linux support headers for userspace development
- Multi-Arch: same
- EOF
-
--if is_enabled CONFIG_MODULES; then
--cat <<EOF >> debian/control
--
--Package: linux-headers-$version
--Architecture: $debarch
--Description: Linux kernel headers for $version on $debarch
-- This package provides kernel header files for $version on $debarch
-- .
-- This is useful for people who need to build external modules
--EOF
--fi
--
- if is_enabled CONFIG_DEBUG_INFO; then
- cat <<EOF >> debian/control
-
--Package: linux-image-$version-dbg
-+Package: $dbg_packagename
- Section: debug
- Architecture: $debarch
- Description: Linux kernel debugging symbols for $version
-@@ -223,15 +225,11 @@ cat <<EOF > debian/rules
-
- srctree ?= .
-
--build-indep:
--build-arch:
-+build:
- \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
- KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile
-
--build: build-arch
--
--binary-indep:
--binary-arch: build-arch
-+binary-arch:
- \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
- KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile intdeb-pkg
-
diff --git a/patch/misc/general-packaging-5.3.y.patch b/patch/misc/general-packaging-5.3.y.patch
deleted file mode 100644
index 97c8f3c6d..000000000
--- a/patch/misc/general-packaging-5.3.y.patch
+++ /dev/null
@@ -1,262 +0,0 @@
-From 87395a5fca108473ae5b4124fe1611d0493701ac Mon Sep 17 00:00:00 2001
-From: The-going <48602507+The-going@users.noreply.github.com>
-Date: Tue, 10 Mar 2020 17:16:41 +0300
-Subject: [PATCH] general packaging 5.3.y
-
----
- arch/arm64/Makefile | 2 +-
- scripts/package/builddeb | 116 ++++++++++++++++++++++++++++++++++++---
- scripts/package/mkdebian | 15 ++++-
- 3 files changed, 121 insertions(+), 12 deletions(-)
-
-diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
-index d227cf87c..2ccca81a1 100644
---- a/arch/arm64/Makefile
-+++ b/arch/arm64/Makefile
-@@ -133,7 +133,7 @@ core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
-
- # Default target when executing plain make
- boot := arch/arm64/boot
--KBUILD_IMAGE := $(boot)/Image.gz
-+KBUILD_IMAGE := $(boot)/Image
-
- all: Image.gz
-
-diff --git a/scripts/package/builddeb b/scripts/package/builddeb
-index c4c580f54..3d10f513d 100755
---- a/scripts/package/builddeb
-+++ b/scripts/package/builddeb
-@@ -41,9 +41,47 @@ create_package() {
- # in case we are in a restrictive umask environment like 0077
- chmod -R a+rX "$pdir"
-
-+ # Create preinstall and post install script to remove dtb
-+ if [ "$3" = "dtb" ]; then
-+
-+ cat >> $pdir/DEBIAN/preinst <<EOT
-+rm -rf /boot/dtb-$version; rm -rf /boot/dtb
-+exit 0
-+EOT
-+
-+ cat >> $pdir/DEBIAN/postinst <<EOT
-+cd /boot
-+ln -sfT dtb-$version dtb 2> /dev/null || mv dtb-$version dtb
-+exit 0
-+EOT
-+
-+ chmod 775 $pdir/DEBIAN/preinst ; chmod 775 $pdir/DEBIAN/postinst
-+ fi
-+
-+ # Create postinst prerm scripts for headers
-+ if [ "$3" = "headers" ]; then
-+
-+cat >> $pdir/DEBIAN/postinst << EOT
-+cd /usr/src/linux-headers-$version
-+echo "Compiling headers - please wait ..."
-+find -type f -exec touch {} +
-+yes "" | make oldconfig >/dev/null
-+make -j\$(grep -c 'processor' /proc/cpuinfo) -s scripts >/dev/null
-+make -j\$(grep -c 'processor' /proc/cpuinfo) -s M=scripts/mod/ >/dev/null
-+exit 0
-+EOT
-+
-+cat >> $pdir/DEBIAN/prerm << EOT
-+cd /usr/src/linux-headers-$version
-+rm -rf scripts .config.old
-+EOT
-+
-+ chmod 775 $pdir/DEBIAN/postinst ; chmod 775 $pdir/DEBIAN/prerm
-+ fi
-+
- # Create the package
- dpkg-gencontrol -p$pname -P"$pdir"
-- dpkg --build "$pdir" ..
-+ dpkg-deb ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir" ..
- }
-
- version=$KERNELRELEASE
-@@ -51,9 +89,11 @@ tmpdir="$objtree/debian/tmp"
- kernel_headers_dir="$objtree/debian/hdrtmp"
- libc_headers_dir="$objtree/debian/headertmp"
- dbg_dir="$objtree/debian/dbgtmp"
--packagename=linux-image-$version
--kernel_headers_packagename=linux-headers-$version
--libc_headers_packagename=linux-libc-dev
-+dtb_dir="$objtree/debian/dtbtmp"
-+packagename=linux-image-"$BRANCH$LOCALVERSION"
-+kernel_headers_packagename=linux-headers-"$BRANCH$LOCALVERSION"
-+dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
-+libc_headers_packagename=linux-libc-dev-"$BRANCH$LOCALVERSION"
- dbg_packagename=$packagename-dbg
-
- if [ "$ARCH" = "um" ] ; then
-@@ -64,6 +104,15 @@ fi
- # XXX: have each arch Makefile export a variable of the canonical image install
- # path instead
- case $ARCH in
-+aarch64|arm64)
-+ image_name=Image
-+ installed_image_path="boot/vmlinuz-$version"
-+
-+ ;;
-+arm*)
-+ image_name=zImage
-+ installed_image_path="boot/vmlinuz-$version"
-+ ;;
- um)
- installed_image_path="usr/bin/linux-$version"
- ;;
-@@ -77,7 +126,9 @@ esac
- BUILD_DEBUG=$(if_enabled_echo CONFIG_DEBUG_INFO Yes)
-
- # Setup the directory structure
--rm -rf "$tmpdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" $objtree/debian/files
-+rm -rf "$tmpdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" "$dtb_dir" $objtree/debian/files
-+mkdir -m 755 -p "$dtb_dir/DEBIAN"
-+mkdir -p "$dtb_dir/boot/dtb-$version" "$dtb_dir/usr/share/doc/$dtb_packagename"
- mkdir -m 755 -p "$tmpdir/DEBIAN"
- mkdir -p "$tmpdir/lib" "$tmpdir/boot"
- mkdir -p "$kernel_headers_dir/lib/modules/$version/"
-@@ -129,6 +180,11 @@ if is_enabled CONFIG_MODULES; then
- fi
- fi
-
-+if grep -q '^CONFIG_OF=y' $KCONFIG_CONFIG ; then
-+ #mkdir -p "$tmpdir/boot/dtb"
-+ INSTALL_DTBS_PATH="$dtb_dir/boot/dtb-$version" $MAKE KBUILD_SRC= dtbs_install
-+fi
-+
- if [ "$ARCH" != "um" ]; then
- $MAKE -f $srctree/Makefile headers
- $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
-@@ -148,7 +204,7 @@ debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
- for script in postinst postrm preinst prerm ; do
- mkdir -p "$tmpdir$debhookdir/$script.d"
- cat <<EOF > "$tmpdir/DEBIAN/$script"
--#!/bin/sh
-+#!/bin/bash
-
- set -e
-
-@@ -164,9 +220,49 @@ EOF
- chmod 755 "$tmpdir/DEBIAN/$script"
- done
-
-+##
-+## Create sym link to kernel image
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/postinst
-+cat >> $tmpdir/DEBIAN/postinst <<EOT
-+ln -sf $(basename $installed_image_path) /boot/$image_name || mv /$installed_image_path /boot/$image_name
-+touch /boot/.next
-+exit 0
-+EOT
-+
-+##
-+## FAT install workaround
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/preinst
-+cat >> $tmpdir/DEBIAN/preinst <<EOT
-+# exit if we are running chroot
-+if [ "\$(stat -c %d:%i /)" != "\$(stat -c %d:%i /proc/1/root/.)" ]; then exit 0; fi
-+
-+check_and_unmount (){
-+ boot_device=\$(mountpoint -d /boot)
-+
-+ for file in /dev/* ; do
-+ CURRENT_DEVICE=\$(printf "%d:%d" \$(stat --printf="0x%t 0x%T" \$file))
-+ if [[ "\$CURRENT_DEVICE" = "\$boot_device" ]]; then
-+ boot_partition=\$file
-+ break
-+ fi
-+ done
-+
-+ bootfstype=\$(blkid -s TYPE -o value \$boot_partition)
-+ if [ "\$bootfstype" = "vfat" ]; then
-+ # we have to keep it mounted! umount /boot
-+ rm -f /boot/System.map* /boot/config* /boot/vmlinuz* /boot/$image_name /boot/uImage
-+ fi
-+}
-+mountpoint -q /boot && check_and_unmount
-+EOT
-+echo "exit 0" >> $tmpdir/DEBIAN/preinst
-+
- # Build kernel header package
- (cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl) > "$objtree/debian/hdrsrcfiles"
- (cd $srctree; find arch/*/include include scripts -type f -o -type l) >> "$objtree/debian/hdrsrcfiles"
-+(cd $srctree; find security/*/include -type f) >> "$objtree/debian/hdrsrcfiles"
- (cd $srctree; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> "$objtree/debian/hdrsrcfiles"
- (cd $srctree; find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> "$objtree/debian/hdrsrcfiles"
- if is_enabled CONFIG_STACK_VALIDATION; then
-@@ -178,15 +274,19 @@ if is_enabled CONFIG_GCC_PLUGINS; then
- fi
- destdir=$kernel_headers_dir/usr/src/linux-headers-$version
- mkdir -p "$destdir"
-+(cd $destdir; patch -p1 < /tmp/headers-debian-byteshift.patch)
- (cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -)
- (cd $objtree; tar -c -f - -T -) < "$objtree/debian/hdrobjfiles" | (cd $destdir; tar -xf -)
- (cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be
- ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
- rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
-
-+(cd $destdir; make M=scripts clean)
-+
- if [ "$ARCH" != "um" ]; then
-- create_package "$kernel_headers_packagename" "$kernel_headers_dir"
-- create_package "$libc_headers_packagename" "$libc_headers_dir"
-+ create_package "$kernel_headers_packagename" "$kernel_headers_dir" "headers"
-+#UNCOMENT create_package "$libc_headers_packagename" "$libc_headers_dir"
-+ create_package "$dtb_packagename" "$dtb_dir" "dtb"
- fi
-
- create_package "$packagename" "$tmpdir"
-diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
-index 357dc56bc..602e709bc 100755
---- a/scripts/package/mkdebian
-+++ b/scripts/package/mkdebian
-@@ -94,10 +94,13 @@ else
- packageversion=$version-$revision
- fi
- sourcename=$KDEB_SOURCENAME
--packagename=linux-image-$version
--kernel_headers_packagename=linux-headers-$version
-+packagename=linux-image-$BRANCH$LOCALVERSION
-+kernel_headers_packagename=linux-headers-$BRANCH$LOCALVERSION
-+libc_headers_packagename=linux-libc-dev-$BRANCH$LOCALVERSION
-+dtb_packagename=linux-dtb-$BRANCH$LOCALVERSION
- dbg_packagename=$packagename-dbg
- debarch=
-+image_name=
- set_debarch
-
- if [ "$ARCH" = "um" ] ; then
-@@ -185,12 +188,13 @@ Description: Linux kernel, version $version
-
- Package: $kernel_headers_packagename
- Architecture: $debarch
-+Depends: make, gcc, libc6-dev, bison, flex, libssl-dev
- Description: Linux kernel headers for $version on $debarch
- This package provides kernel header files for $version on $debarch
- .
- This is useful for people who need to build external modules
-
--Package: linux-libc-dev
-+Package: $libc_headers_packagename
- Section: devel
- Provides: linux-kernel-headers
- Architecture: $debarch
-@@ -205,6 +209,11 @@ Architecture: $debarch
- Description: Linux kernel debugging symbols for $version
- This package will come in handy if you need to debug the kernel. It provides
- all the necessary debug symbols for the kernel and its modules.
-+
-+Package: $dtb_packagename
-+Architecture: $debarch
-+Description: Linux DTB, version $version
-+ This package contains device blobs from the Linux kernel, version $version
- EOF
-
- cat <<EOF > debian/rules
---
-2.34.1
-
diff --git a/patch/misc/general-packaging-5.6.y.patch b/patch/misc/general-packaging-5.6.y.patch
deleted file mode 100644
index b1350ee43..000000000
--- a/patch/misc/general-packaging-5.6.y.patch
+++ /dev/null
@@ -1,263 +0,0 @@
-diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
-index 5858d6e44..e81b8a6fc 100644
---- a/arch/arm64/Makefile
-+++ b/arch/arm64/Makefile
-@@ -142,7 +142,7 @@ core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
-
- # Default target when executing plain make
- boot := arch/arm64/boot
--KBUILD_IMAGE := $(boot)/Image.gz
-+KBUILD_IMAGE := $(boot)/Image
-
- all: Image.gz
-
-diff --git a/scripts/package/builddeb b/scripts/package/builddeb
-index 6df3c9f..d33e1f3 100755
---- a/scripts/package/builddeb
-+++ b/scripts/package/builddeb
-@@ -41,9 +41,47 @@ create_package() {
- # in case we are in a restrictive umask environment like 0077
- chmod -R a+rX "$pdir"
-
-+ # Create preinstall and post install script to remove dtb
-+ if [ "$3" = "dtb" ]; then
-+
-+ cat >> $pdir/DEBIAN/preinst <<EOT
-+rm -rf /boot/dtb-$version; rm -rf /boot/dtb
-+exit 0
-+EOT
-+
-+ cat >> $pdir/DEBIAN/postinst <<EOT
-+cd /boot
-+ln -sfT dtb-$version dtb 2> /dev/null || mv dtb-$version dtb
-+exit 0
-+EOT
-+
-+ chmod 775 $pdir/DEBIAN/preinst ; chmod 775 $pdir/DEBIAN/postinst
-+ fi
-+
-+ # Create postinst prerm scripts for headers
-+ if [ "$3" = "headers" ]; then
-+
-+cat >> $pdir/DEBIAN/postinst << EOT
-+cd /usr/src/linux-headers-$version
-+echo "Compiling headers - please wait ..."
-+yes "" | make oldconfig >/dev/null
-+find -type f -exec touch {} +
-+make -j\$(grep -c 'processor' /proc/cpuinfo) -s scripts >/dev/null
-+make -j\$(grep -c 'processor' /proc/cpuinfo) -s M=scripts/mod/ >/dev/null
-+exit 0
-+EOT
-+
-+cat >> $pdir/DEBIAN/prerm << EOT
-+cd /usr/src/linux-headers-$version
-+rm -rf scripts .config.old
-+EOT
-+
-+ chmod 775 $pdir/DEBIAN/postinst ; chmod 775 $pdir/DEBIAN/prerm
-+ fi
-+
- # Create the package
-- dpkg-gencontrol -p$pname -P"$pdir"
-- dpkg-deb ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir" ..
-+ dpkg-gencontrol -p$pname -P"$pdir"
-+ dpkg-deb ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir" ..
- }
-
- deploy_kernel_headers () {
-@@ -100,9 +122,15 @@ deploy_libc_headers () {
- }
-
- version=$KERNELRELEASE
--tmpdir=debian/linux-image
--dbg_dir=debian/linux-image-dbg
--packagename=linux-image-$version
-+tmpdir="$objtree/debian/tmp"
-+kernel_headers_dir="$objtree/debian/hdrtmp"
-+libc_headers_dir="$objtree/debian/headertmp"
-+dbg_dir="$objtree/debian/dbgtmp"
-+dtb_dir="$objtree/debian/dtbtmp"
-+packagename=linux-image-"$BRANCH$LOCALVERSION"
-+kernel_headers_packagename=linux-headers-"$BRANCH$LOCALVERSION"
-+dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
-+libc_headers_packagename=linux-libc-dev-"$BRANCH$LOCALVERSION"
- dbg_packagename=$packagename-dbg
-
- if [ "$ARCH" = "um" ] ; then
-@@ -113,6 +141,15 @@ fi
- # XXX: have each arch Makefile export a variable of the canonical image install
- # path instead
- case $ARCH in
-+aarch64|arm64)
-+ image_name=Image
-+ installed_image_path="boot/vmlinuz-$version"
-+
-+ ;;
-+arm*)
-+ image_name=zImage
-+ installed_image_path="boot/vmlinuz-$version"
-+ ;;
- um)
- installed_image_path="usr/bin/linux-$version"
- ;;
-@@ -126,13 +163,17 @@ esac
- BUILD_DEBUG=$(if_enabled_echo CONFIG_DEBUG_INFO Yes)
-
- # Setup the directory structure
--rm -rf "$tmpdir" "$dbg_dir" debian/files
-+rm -rf "$tmpdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" "$dtb_dir" $objtree/debian/files
-+mkdir -m 755 -p "$dtb_dir/DEBIAN"
-+mkdir -p "$dtb_dir/boot/dtb-$version" "$dtb_dir/usr/share/doc/$dtb_packagename"
- mkdir -m 755 -p "$tmpdir/DEBIAN"
- mkdir -p "$tmpdir/lib" "$tmpdir/boot"
-+mkdir -p "$kernel_headers_dir/lib/modules/$version/"
-
--# Install the kernel
-+# Build and install the kernel
- if [ "$ARCH" = "um" ] ; then
- mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" "$tmpdir/usr/share/doc/$packagename"
-+ $MAKE linux
- cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
- cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config"
- gzip "$tmpdir/usr/share/doc/$packagename/config"
-@@ -176,6 +217,21 @@ if is_enabled CONFIG_MODULES; then
- fi
- fi
-
-+if grep -q '^CONFIG_OF=y' $KCONFIG_CONFIG ; then
-+ #mkdir -p "$tmpdir/boot/dtb"
-+ INSTALL_DTBS_PATH="$dtb_dir/boot/dtb-$version" $MAKE KBUILD_SRC= dtbs_install
-+fi
-+
-+if [ "$ARCH" != "um" ]; then
-+ $MAKE -f $srctree/Makefile headers
-+ $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
-+ # move asm headers to /usr/include/<libc-machine>/asm to match the structure
-+ # used by Debian-based distros (to support multi-arch)
-+ host_arch=$(dpkg-architecture -a$(cat debian/arch) -qDEB_HOST_MULTIARCH)
-+ mkdir $libc_headers_dir/usr/include/$host_arch
-+ mv $libc_headers_dir/usr/include/asm $libc_headers_dir/usr/include/$host_arch/
-+fi
-+
- # Install the maintainer scripts
- # Note: hook scripts under /etc/kernel are also executed by official Debian
- # kernel packages, as well as kernel packages built using make-kpkg.
-@@ -185,7 +241,7 @@ debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
- for script in postinst postrm preinst prerm ; do
- mkdir -p "$tmpdir$debhookdir/$script.d"
- cat <<EOF > "$tmpdir/DEBIAN/$script"
--#!/bin/sh
-+#!/bin/bash
-
- set -e
-
-@@ -201,12 +257,72 @@ EOF
- chmod 755 "$tmpdir/DEBIAN/$script"
- done
-
--if [ "$ARCH" != "um" ]; then
-- deploy_kernel_headers debian/linux-headers
-- create_package linux-headers-$version debian/linux-headers
-+##
-+## Create sym link to kernel image
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/postinst
-+cat >> $tmpdir/DEBIAN/postinst <<EOT
-+ln -sf $(basename $installed_image_path) /boot/$image_name 2> /dev/null || mv /$installed_image_path /boot/$image_name
-+touch /boot/.next
-+exit 0
-+EOT
-+
-+##
-+## FAT install workaround
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/preinst
-+cat >> $tmpdir/DEBIAN/preinst <<EOT
-+# exit if we are running chroot
-+if [ "\$(stat -c %d:%i /)" != "\$(stat -c %d:%i /proc/1/root/.)" ]; then exit 0; fi
-+
-+check_and_unmount (){
-+ boot_device=\$(mountpoint -d /boot)
-+
-+ for file in /dev/* ; do
-+ CURRENT_DEVICE=\$(printf "%d:%d" \$(stat --printf="0x%t 0x%T" \$file))
-+ if [[ "\$CURRENT_DEVICE" = "\$boot_device" ]]; then
-+ boot_partition=\$file
-+ break
-+ fi
-+ done
-
-- deploy_libc_headers debian/linux-libc-dev
-- create_package linux-libc-dev debian/linux-libc-dev
-+ bootfstype=\$(blkid -s TYPE -o value \$boot_partition)
-+ if [ "\$bootfstype" = "vfat" ]; then
-+ # we have to keep it mounted! umount /boot
-+ rm -f /boot/System.map* /boot/config* /boot/vmlinuz* /boot/$image_name /boot/uImage
-+ fi
-+}
-+mountpoint -q /boot && check_and_unmount
-+EOT
-+echo "exit 0" >> $tmpdir/DEBIAN/preinst
-+
-+# Build kernel header package
-+(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl) > "$objtree/debian/hdrsrcfiles"
-+(cd $srctree; find arch/*/include include scripts -type f -o -type l) >> "$objtree/debian/hdrsrcfiles"
-+(cd $srctree; find security/*/include -type f) >> "$objtree/debian/hdrsrcfiles"
-+(cd $srctree; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> "$objtree/debian/hdrsrcfiles"
-+(cd $srctree; find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> "$objtree/debian/hdrsrcfiles"
-+if is_enabled CONFIG_STACK_VALIDATION; then
-+ (cd $objtree; find tools/objtool -type f -executable) >> "$objtree/debian/hdrobjfiles"
-+fi
-+(cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles"
-+if is_enabled CONFIG_GCC_PLUGINS; then
-+ (cd $objtree; find scripts/gcc-plugins -name \*.so -o -name gcc-common.h) >> "$objtree/debian/hdrobjfiles"
-+fi
-+destdir=$kernel_headers_dir/usr/src/linux-headers-$version
-+mkdir -p "$destdir"
-+(cd $destdir; patch -p1 < /tmp/headers-debian-byteshift.patch)
-+(cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -)
-+(cd $objtree; tar -c -f - -T -) < "$objtree/debian/hdrobjfiles" | (cd $destdir; tar -xf -)
-+(cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be
-+ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
-+rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
-+
-+(cd $destdir; make M=scripts clean)
-+
-+if [ "$ARCH" != "um" ]; then
-+ create_package "$kernel_headers_packagename" "$kernel_headers_dir" "headers"
-+ create_package "$dtb_packagename" "$dtb_dir" "dtb"
- fi
-
- create_package "$packagename" "$tmpdir"
---- a/scripts/package/mkdebian
-+++ b/scripts/package/mkdebian
-@@ -94,10 +94,12 @@ else
- packageversion=$version-$revision
- fi
- sourcename=$KDEB_SOURCENAME
--packagename=linux-image-$version
--kernel_headers_packagename=linux-headers-$version
-+packagename=linux-image-$BRANCH$LOCALVERSION
-+kernel_headers_packagename=linux-headers-$BRANCH$LOCALVERSION
-+dtb_packagename=linux-dtb-$BRANCH$LOCALVERSION
- dbg_packagename=$packagename-dbg
- debarch=
-+image_name=
- set_debarch
-
- if [ "$ARCH" = "um" ] ; then
-@@ -183,8 +185,14 @@ Description: Linux kernel, version $version
- This package contains the Linux kernel, modules and corresponding other
- files, version: $version.
-
-+Package: $dtb_packagename
-+Architecture: $debarch
-+Description: Linux DTB, version $version
-+ This package contains device blobs from the Linux kernel, version $version
-+
- Package: $kernel_headers_packagename
- Architecture: $debarch
-+Depends: make, gcc, libc6-dev, bison, flex, libssl-dev
- Description: Linux kernel headers for $version on $debarch
- This package provides kernel header files for $version on $debarch
- .
diff --git a/patch/misc/general-packaging-5.8-9.y.patch b/patch/misc/general-packaging-5.8-9.y.patch
deleted file mode 100644
index 0ed5ed3ee..000000000
--- a/patch/misc/general-packaging-5.8-9.y.patch
+++ /dev/null
@@ -1,265 +0,0 @@
-diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
-index 5858d6e44..e81b8a6fc 100644
---- a/arch/arm64/Makefile
-+++ b/arch/arm64/Makefile
-@@ -142,7 +142,7 @@ core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
-
- # Default target when executing plain make
- boot := arch/arm64/boot
--KBUILD_IMAGE := $(boot)/Image.gz
-+KBUILD_IMAGE := $(boot)/Image
-
- all: Image.gz
-
-diff --git a/scripts/package/builddeb b/scripts/package/builddeb
-index 6df3c9f..d33e1f3 100755
---- a/scripts/package/builddeb
-+++ b/scripts/package/builddeb
-@@ -41,9 +41,47 @@ create_package() {
- # in case we are in a restrictive umask environment like 0077
- chmod -R a+rX "$pdir"
-
-+ # Create preinstall and post install script to remove dtb
-+ if [ "$3" = "dtb" ]; then
-+
-+ cat >> $pdir/DEBIAN/preinst <<EOT
-+rm -rf /boot/dtb-$version; rm -rf /boot/dtb
-+exit 0
-+EOT
-+
-+ cat >> $pdir/DEBIAN/postinst <<EOT
-+cd /boot
-+ln -sfT dtb-$version dtb 2> /dev/null || mv dtb-$version dtb
-+exit 0
-+EOT
-+
-+ chmod 775 $pdir/DEBIAN/preinst ; chmod 775 $pdir/DEBIAN/postinst
-+ fi
-+
-+ # Create postinst prerm scripts for headers
-+ if [ "$3" = "headers" ]; then
-+
-+cat >> $pdir/DEBIAN/postinst << EOT
-+cd /usr/src/linux-headers-$version
-+echo "Compiling headers - please wait ..."
-+find -type f -exec touch {} +
-+yes "" | make oldconfig >/dev/null
-+make -j\$(grep -c 'processor' /proc/cpuinfo) -s scripts >/dev/null
-+make -j\$(grep -c 'processor' /proc/cpuinfo) -s M=scripts/mod/ >/dev/null
-+exit 0
-+EOT
-+
-+cat >> $pdir/DEBIAN/prerm << EOT
-+cd /usr/src/linux-headers-$version
-+rm -rf scripts .config.old
-+EOT
-+
-+ chmod 775 $pdir/DEBIAN/postinst ; chmod 775 $pdir/DEBIAN/prerm
-+ fi
-+
- # Create the package
-- dpkg-gencontrol -p$pname -P"$pdir"
-- dpkg-deb ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir" ..
-+ dpkg-gencontrol -p$pname -P"$pdir"
-+ dpkg-deb --build "$pdir" ..
- }
-
- deploy_kernel_headers () {
-@@ -100,9 +122,15 @@ deploy_libc_headers () {
- }
-
- version=$KERNELRELEASE
--tmpdir=debian/linux-image
--dbg_dir=debian/linux-image-dbg
--packagename=linux-image-$version
-+tmpdir="$objtree/debian/tmp"
-+kernel_headers_dir="$objtree/debian/hdrtmp"
-+libc_headers_dir="$objtree/debian/headertmp"
-+dbg_dir="$objtree/debian/dbgtmp"
-+dtb_dir="$objtree/debian/dtbtmp"
-+packagename=linux-image-"$BRANCH$LOCALVERSION"
-+kernel_headers_packagename=linux-headers-"$BRANCH$LOCALVERSION"
-+dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
-+libc_headers_packagename=linux-libc-dev-"$BRANCH$LOCALVERSION"
- dbg_packagename=$packagename-dbg
-
- if [ "$ARCH" = "um" ] ; then
-@@ -113,6 +141,15 @@ fi
- # XXX: have each arch Makefile export a variable of the canonical image install
- # path instead
- case $ARCH in
-+aarch64|arm64)
-+ image_name=Image
-+ installed_image_path="boot/vmlinuz-$version"
-+
-+ ;;
-+arm*)
-+ image_name=zImage
-+ installed_image_path="boot/vmlinuz-$version"
-+ ;;
- um)
- installed_image_path="usr/bin/linux-$version"
- ;;
-@@ -126,13 +163,17 @@ esac
- BUILD_DEBUG=$(if_enabled_echo CONFIG_DEBUG_INFO Yes)
-
- # Setup the directory structure
--rm -rf "$tmpdir" "$dbg_dir" debian/files
-+rm -rf "$tmpdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" "$dtb_dir" $objtree/debian/files
-+mkdir -m 755 -p "$dtb_dir/DEBIAN"
-+mkdir -p "$dtb_dir/boot/dtb-$version" "$dtb_dir/usr/share/doc/$dtb_packagename"
- mkdir -m 755 -p "$tmpdir/DEBIAN"
- mkdir -p "$tmpdir/lib" "$tmpdir/boot"
-+mkdir -p "$kernel_headers_dir/lib/modules/$version/"
-
--# Install the kernel
-+# Build and install the kernel
- if [ "$ARCH" = "um" ] ; then
- mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" "$tmpdir/usr/share/doc/$packagename"
-+ $MAKE linux
- cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
- cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config"
- gzip "$tmpdir/usr/share/doc/$packagename/config"
-@@ -176,6 +217,21 @@ if is_enabled CONFIG_MODULES; then
- fi
- fi
-
-+if grep -q '^CONFIG_OF=y' $KCONFIG_CONFIG ; then
-+ #mkdir -p "$tmpdir/boot/dtb"
-+ INSTALL_DTBS_PATH="$dtb_dir/boot/dtb-$version" $MAKE KBUILD_SRC= dtbs_install
-+fi
-+
-+if [ "$ARCH" != "um" ]; then
-+ $MAKE -f $srctree/Makefile headers
-+ $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
-+ # move asm headers to /usr/include/<libc-machine>/asm to match the structure
-+ # used by Debian-based distros (to support multi-arch)
-+ host_arch=$(dpkg-architecture -a$(cat debian/arch) -qDEB_HOST_MULTIARCH)
-+ mkdir $libc_headers_dir/usr/include/$host_arch
-+ mv $libc_headers_dir/usr/include/asm $libc_headers_dir/usr/include/$host_arch/
-+fi
-+
- # Install the maintainer scripts
- # Note: hook scripts under /etc/kernel are also executed by official Debian
- # kernel packages, as well as kernel packages built using make-kpkg.
-@@ -185,7 +241,7 @@ debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
- for script in postinst postrm preinst prerm ; do
- mkdir -p "$tmpdir$debhookdir/$script.d"
- cat <<EOF > "$tmpdir/DEBIAN/$script"
--#!/bin/sh
-+#!/bin/bash
-
- set -e
-
-@@ -201,14 +257,72 @@ EOF
- chmod 755 "$tmpdir/DEBIAN/$script"
- done
-
--if [ "$ARCH" != "um" ]; then
-- if is_enabled CONFIG_MODULES; then
-- deploy_kernel_headers debian/linux-headers
-- create_package linux-headers-$version debian/linux-headers
-- fi
-+##
-+## Create sym link to kernel image
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/postinst
-+cat >> $tmpdir/DEBIAN/postinst <<EOT
-+ln -sf $(basename $installed_image_path) /boot/$image_name 2> /dev/null || mv /$installed_image_path /boot/$image_name
-+touch /boot/.next
-+exit 0
-+EOT
-+
-+##
-+## FAT install workaround
-+##
-+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/preinst
-+cat >> $tmpdir/DEBIAN/preinst <<EOT
-+# exit if we are running chroot
-+if [ "\$(stat -c %d:%i /)" != "\$(stat -c %d:%i /proc/1/root/.)" ]; then exit 0; fi
-+
-+check_and_unmount (){
-+ boot_device=\$(mountpoint -d /boot)
-+
-+ for file in /dev/* ; do
-+ CURRENT_DEVICE=\$(printf "%d:%d" \$(stat --printf="0x%t 0x%T" \$file))
-+ if [[ "\$CURRENT_DEVICE" = "\$boot_device" ]]; then
-+ boot_partition=\$file
-+ break
-+ fi
-+ done
-
-- deploy_libc_headers debian/linux-libc-dev
-- create_package linux-libc-dev debian/linux-libc-dev
-+ bootfstype=\$(blkid -s TYPE -o value \$boot_partition)
-+ if [ "\$bootfstype" = "vfat" ]; then
-+ # we have to keep it mounted! umount /boot
-+ rm -f /boot/System.map* /boot/config* /boot/vmlinuz* /boot/$image_name /boot/uImage
-+ fi
-+}
-+mountpoint -q /boot && check_and_unmount
-+EOT
-+echo "exit 0" >> $tmpdir/DEBIAN/preinst
-+
-+# Build kernel header package
-+(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl) > "$objtree/debian/hdrsrcfiles"
-+(cd $srctree; find arch/*/include include scripts -type f -o -type l) >> "$objtree/debian/hdrsrcfiles"
-+(cd $srctree; find security/*/include -type f) >> "$objtree/debian/hdrsrcfiles"
-+(cd $srctree; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> "$objtree/debian/hdrsrcfiles"
-+(cd $srctree; find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> "$objtree/debian/hdrsrcfiles"
-+if is_enabled CONFIG_STACK_VALIDATION; then
-+ (cd $objtree; find tools/objtool -type f -executable) >> "$objtree/debian/hdrobjfiles"
-+fi
-+(cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles"
-+if is_enabled CONFIG_GCC_PLUGINS; then
-+ (cd $objtree; find scripts/gcc-plugins -name \*.so -o -name gcc-common.h) >> "$objtree/debian/hdrobjfiles"
-+fi
-+destdir=$kernel_headers_dir/usr/src/linux-headers-$version
-+mkdir -p "$destdir"
-+(cd $destdir; patch -p1 < /tmp/headers-debian-byteshift.patch)
-+(cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -)
-+(cd $objtree; tar -c -f - -T -) < "$objtree/debian/hdrobjfiles" | (cd $destdir; tar -xf -)
-+(cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be
-+ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
-+rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
-+
-+(cd $destdir; make M=scripts clean)
-+
-+if [ "$ARCH" != "um" ]; then
-+ create_package "$kernel_headers_packagename" "$kernel_headers_dir" "headers"
-+ create_package "$dtb_packagename" "$dtb_dir" "dtb"
- fi
-
- create_package "$packagename" "$tmpdir"
---- a/scripts/package/mkdebian
-+++ b/scripts/package/mkdebian
-@@ -94,10 +94,12 @@ else
- packageversion=$version-$revision
- fi
- sourcename=$KDEB_SOURCENAME
--packagename=linux-image-$version
--kernel_headers_packagename=linux-headers-$version
-+packagename=linux-image-$BRANCH$LOCALVERSION
-+kernel_headers_packagename=linux-headers-$BRANCH$LOCALVERSION
-+dtb_packagename=linux-dtb-$BRANCH$LOCALVERSION
- dbg_packagename=$packagename-dbg
- debarch=
-+image_name=
- set_debarch
-
- if [ "$ARCH" = "um" ] ; then
-@@ -183,8 +185,14 @@ Description: Linux kernel, version $version
- This package contains the Linux kernel, modules and corresponding other
- files, version: $version.
-
-+Package: $dtb_packagename
-+Architecture: $debarch
-+Description: Linux DTB, version $version
-+ This package contains device blobs from the Linux kernel, version $version
-+
- Package: $kernel_headers_packagename
- Architecture: $debarch
-+Depends: make, gcc, libc6-dev, bison, flex, libssl-dev
- Description: Linux kernel headers for $version on $debarch
- This package provides kernel header files for $version on $debarch
- .
From 134bb92d95726ae56da8734bc9c39552c4821e4c Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 9 Mar 2022 23:43:39 +0100
Subject: [PATCH] armbian-next: manual merge (12) of all changes between
revisions 34d4be6b7b346507af58133125cef0bc8ff5aef1 and
5fe0f36aa832ac64d1db05adc4eb09a4df4b5509
---
config/sources/families/rk35xx.conf | 2 ++
lib/functions/configuration/main-config.sh | 8 ++++----
lib/functions/general/git.sh | 2 +-
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/config/sources/families/rk35xx.conf b/config/sources/families/rk35xx.conf
index 3744e6e5f..d0c5a293e 100644
--- a/config/sources/families/rk35xx.conf
+++ b/config/sources/families/rk35xx.conf
@@ -23,11 +23,13 @@ case $BRANCH in
;;
# temporary until kernel 5.16 is well supported for rockchip64
+ # it has to be its own family too
edge)
export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
KERNELBRANCH="branch:linux-5.16.y"
KERNELPATCHDIR='rk35xx-'$BRANCH
SKIP_BOOTSPLASH="yes"
+ LINUXFAMILY=rk35xx
LINUXCONFIG='linux-rk35xx-'$BRANCH
;;
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 5bf904f58..bea0c0efa 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -85,7 +85,7 @@ function do_main_configuration() {
china)
[[ -z $USE_MAINLINE_GOOGLE_MIRROR ]] && [[ -z $MAINLINE_MIRROR ]] && MAINLINE_MIRROR=tuna
[[ -z $USE_GITHUB_UBOOT_MIRROR ]] && [[ -z $UBOOT_MIRROR ]] && UBOOT_MIRROR=gitee
- [[ -z $GITHUB_MIRROR ]] && GITHUB_MIRROR=cnpmjs
+ [[ -z $GITHUB_MIRROR ]] && GITHUB_MIRROR=gitclone
[[ -z $DOWNLOAD_MIRROR ]] && DOWNLOAD_MIRROR=china
;;
*) ;;
@@ -139,13 +139,13 @@ function do_main_configuration() {
case $GITHUB_MIRROR in
fastgit)
- GITHUB_SOURCE='https://hub.fastgit.xyz/'
+ GITHUB_SOURCE='https://hub.fastgit.xyz'
;;
gitclone)
- GITHUB_SOURCE='https://gitclone.com/github.com/'
+ GITHUB_SOURCE='https://gitclone.com/github.com'
;;
*)
- GITHUB_SOURCE='https://github.com/'
+ GITHUB_SOURCE='https://github.com'
;;
esac
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index 8330b3fe4..f096a39ac 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -49,7 +49,7 @@ fetch_from_repo() {
local git_work_dir
# Set GitHub mirror before anything else touches $url
- url=${url//'https://github.com/'/$GITHUB_SOURCE}
+ url=${url//'https://github.com/'/$GITHUB_SOURCE'/'}
# The 'offline' variable must always be set to 'true' or 'false'
local offline=false
From 6058f580ae03c4c197ea60789128edca73046758 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 9 Mar 2022 18:41:30 +0100
Subject: [PATCH] armbian-next: introduce `PRESERVE_WORKDIR=yes` for heavy
debugging
---
lib/functions/main/default-build.sh | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index 2e40456c0..5933d9a27 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -185,7 +185,11 @@ function trap_handler_cleanup_workdir() {
display_alert "Cleanup WORKDIR: $WORKDIR" "trap_handler_cleanup_workdir" "cleanup"
unset TMPDIR
if [[ -d "${WORKDIR}" ]]; then
- display_alert "Cleaning up WORKDIR" "$(du -h -s "$WORKDIR")" "debug"
- rm -rf "${WORKDIR}"
+ if [[ "${PRESERVE_WORKDIR}" != "yes" ]]; then
+ display_alert "Cleaning up WORKDIR" "$(du -h -s "$WORKDIR")" "debug"
+ rm -rf "${WORKDIR}"
+ else
+ display_alert "Preserving WORKDIR due to PRESERVE_WORKDIR=yes" "$(du -h -s "$WORKDIR")" "warn"
+ fi
fi
}
From 87c808d5d398dc51a1fabe97b732d94d3094b8b9 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 9 Mar 2022 14:39:21 +0100
Subject: [PATCH] armbian-next: packaging linux-headers again
- do NOT use any output from `make headers_install` - that's for libc headers
- grabs "headers" (and binary tools) directly from the kernel build tree, not install target
- does not produce headers if cross compiling, for now
- produces kernel-headers package for the architecture on which it was built
- doing a single make invocation with build and install for packaging
- using 'make all' in place of vmlinuz/bzImage/image/zImage
---
lib/functions/compilation/kernel-debs.sh | 99 ++++++++++++++++++++++++++++++--
lib/functions/compilation/kernel.sh | 82 ++++++++++++++++++++++++--
2 files changed, 169 insertions(+), 12 deletions(-)
diff --git a/lib/functions/compilation/kernel-debs.sh b/lib/functions/compilation/kernel-debs.sh
index f02bb4dde..9d1b813d3 100644
--- a/lib/functions/compilation/kernel-debs.sh
+++ b/lib/functions/compilation/kernel-debs.sh
@@ -48,8 +48,8 @@ function prepare_kernel_packaging_debs() {
declare package_version="${REVISION}"
# show incoming tree
- display_alert "Kernel install dir" "incoming from KBUILD make" "debug"
- run_host_command_logged tree -C --du -h "${kernel_dest_install_dir}" "| grep --line-buffered -v -e '\.ko' -e '\.h' "
+ #display_alert "Kernel install dir" "incoming from KBUILD make" "debug"
+ #run_host_command_logged tree -C --du -h "${kernel_dest_install_dir}" "| grep --line-buffered -v -e '\.ko' -e '\.h' "
display_alert "tmp_kernel_install_dirs INSTALL_PATH:" "${tmp_kernel_install_dirs[INSTALL_PATH]}" "debug"
display_alert "tmp_kernel_install_dirs INSTALL_MOD_PATH:" "${tmp_kernel_install_dirs[INSTALL_MOD_PATH]}" "debug"
@@ -64,8 +64,11 @@ function prepare_kernel_packaging_debs() {
create_kernel_deb "linux-dtb-${BRANCH}-${LINUXFAMILY}" "${debs_target_dir}" kernel_package_callback_linux_dtb
fi
- # @TODO: package headers. probably in 3 phases: common per-version (libc headers), common per-arch (arch-specific, with binary tools), and kernel specific (kernel-headers, no tools)
-
+ if dpkg-architecture -e "${ARCH}"; then
+ create_kernel_deb "linux-headers-${BRANCH}-${LINUXFAMILY}" "${debs_target_dir}" kernel_package_callback_linux_headers
+ else
+ display_alert "Cross-compilation" "skip kernel-headers packaging" "warn"
+ fi
}
function create_kernel_deb() {
@@ -120,8 +123,8 @@ function create_kernel_deb() {
display_alert "Unpacked ${package_name} tree" "${unpacked_size}" "debug"
# Show it
- display_alert "Package dir" "for package ${package_name}" "debug"
- run_host_command_logged tree -C -h -d --du "${package_directory}"
+ #display_alert "Package dir" "for package ${package_name}" "debug"
+ #run_host_command_logged tree -C -h -d --du "${package_directory}"
run_host_command_logged dpkg-deb ${DEB_COMPRESS:+-Z$DEB_COMPRESS} --build "${package_directory}" "${deb_output_dir}" # not KDEB compress, we're not under a Makefile
}
@@ -156,6 +159,9 @@ function kernel_package_callback_linux_image() {
run_host_command_logged cp -rp "${tmp_kernel_install_dirs[INSTALL_PATH]}" "${package_directory}/" # /boot stuff
run_host_command_logged cp -rp "${tmp_kernel_install_dirs[INSTALL_MOD_PATH]}/lib" "${package_directory}/" # so "lib" stuff sits at the root
+ # Clean up symlinks in lib/modules/${kernel_version_family}/build and lib/modules/${kernel_version_family}/source; will be in the headers package
+ run_host_command_logged rm -v -f "${package_directory}/lib/modules/${kernel_version_family}/build" "${package_directory}/lib/modules/${kernel_version_family}/source"
+
if [[ -d "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}" ]]; then
# /usr/lib/linux-image-${kernel_version_family} is wanted by flash-kernel
# /lib/firmware/${kernel_version_family}/device-tree/ would also be acceptable
@@ -243,3 +249,84 @@ function kernel_package_callback_linux_dtb() {
)
}
+
+function kernel_package_callback_linux_headers() {
+ display_alert "package_directory for headers" "${package_directory}" "debug"
+
+ # targets.
+ local headers_target_dir="${package_directory}/usr/src/linux-headers-${kernel_version_family}" # headers/tools etc
+ local modules_target_dir="${package_directory}/lib/modules/${kernel_version_family}" # symlink to above later
+
+ mkdir -p "${headers_target_dir}" "${modules_target_dir}" # create both dirs
+ run_host_command_logged ln -v -s "/usr/src/linux-headers-${kernel_version_family}" "${modules_target_dir}/build" # Symlink in modules so builds find the headers
+ run_host_command_logged cp -vp "${kernel_work_dir}"/.config "${headers_target_dir}"/.config # copy .config manually to be where it's expected to be
+
+ # gather stuff from the linux source tree: ${kernel_work_dir} (NOT the make install destination)
+ # those can be source files or object (binary/compiled) stuff
+ # how to get SRCARCH? only from the makefile itself. ARCH=amd64 then SRCARCH=x86. How to we know? @TODO
+ local SRC_ARCH="${ARCH}"
+ [[ "${SRC_ARCH}" == "amd64" ]] && SRC_ARCH="x86"
+
+ # Create a list of files to include, path-relative to the kernel tree
+ local temp_file_list="${WORKDIR}/tmp_file_list_${kernel_version_family}.kernel.headers"
+
+ # Source stuff. No binaries. I think.
+ (
+ cd "${kernel_work_dir}" || exit 2
+ #echo "-- Sources: Makefiles and Kconfigs and perl"
+ find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl
+
+ #echo "-- Sources: all arches include, include and scripts both files and symlinks "
+ find arch/*/include include scripts -type f -o -type l
+
+ #echo "-- Sources: security include"
+ find security/*/include -type f
+
+ #echo "-- Sources: arch ${SRC_ARCH} module lds or Kbuild platforms or Platform"
+ find "arch/${SRC_ARCH}" -name module.lds -o -name Kbuild.platforms -o -name Platform
+
+ #echo "-- Sources: All files somewhere for some reason"
+ # shellcheck disable=SC2046 # I need to expand. Thanks.
+ find $(find "arch/${SRC_ARCH}" -name include -o -name scripts -type d) -type f
+
+ if is_enabled CONFIG_STACK_VALIDATION; then
+ #echo "-- Binaries: objtool due to CONFIG_STACK_VALIDATION"
+ find tools/objtool -type f -executable
+ fi
+
+ #echo "-- Binaries: Module.symvers and includes scripts FILES"
+ find arch/${SRC_ARCH}/include Module.symvers include scripts -type f
+
+ if is_enabled CONFIG_GCC_PLUGINS; then
+ #echo "-- Binaries: gcc plugins due to CONFIG_GCC_PLUGINS"
+ find scripts/gcc-plugins -name \*.so -o -name gcc-common.h
+ fi
+ ) > "${temp_file_list}"
+
+ # Now include/copy those, using tar as intermediary. Just like builddeb does it.
+ tar -c -f - -C "${kernel_work_dir}" -T "${temp_file_list}" | tar -xf - -C "${headers_target_dir}"
+
+ # ${temp_file_list} is left at WORKDIR for later debugging, will be removed by WORKDIR cleanup trap
+
+ # @TODO: maybe split all binaries to a separate package at this stage; that way cross compile can still produce
+ # @TODO: source-only headers, which can then be patched (byteshift?) and compiled client-side later
+
+ # @TODO: cat "${temp_file_list}" | grep -v -e "\.h$" -e ".c$" -e "Makefile$" -e "Kconfig$" -e "Kbuild$" -e "\.cocci$" | xargs file | grep -v -e "ASCII" -e "script text"
+
+ # Generate a control file
+ cat <<- CONTROL_FILE > "${package_DEBIAN_dir}/control"
+ Version: ${package_version}
+ Maintainer: ${MAINTAINER} <${MAINTAINERMAIL}>
+ Section: devel
+ Package: ${package_name}
+ Architecture: ${ARCH}
+ Provides: linux-headers, linux-headers-armbian, armbian-$BRANCH
+ Depends: make, gcc, libc6-dev, bison, flex, libssl-dev
+ Description: Linux kernel headers for ${kernel_version_family}
+ This package provides kernel header files for ${kernel_version_family}
+ .
+ This is useful for DKMS and building of external modules.
+ CONTROL_FILE
+
+ # @TODO: preinst postinst? dependent on split, see todo above
+}
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 3a167b17a..b77739827 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -56,12 +56,30 @@ function compile_kernel() {
local toolchain
LOG_SECTION="kernel_config" do_with_logging do_with_hooks kernel_config
LOG_SECTION="kernel_package_source" do_with_logging do_with_hooks kernel_package_source
- LOG_SECTION="kernel_make_headers_dtbs_image_modules" do_with_logging do_with_hooks kernel_make_headers_dtbs_image_modules
- LOG_SECTION="kernel_package" do_with_logging do_with_hooks kernel_package
+
+ # @TODO: might be interesting to package kernel-headers at this stage.
+ # @TODO: would allow us to have a "HEADERS_ONLY=yes" that can prepare arm64 headers on arm64 without building the whole kernel
+ # @TODO: also it makes sense, logically, to package headers after configuration, since that's all what's needed; it's the same
+ # @TODO: stage at which `dkms` would run (a configured, tool-built, kernel tree).
+
+ # @TODO: might also be interesting to do the same for DTBs.
+ # @TODO: those get packaged twice (once in linux-dtb and once in linux-image)
+ # @TODO: but for the u-boot bootloader, only the linux-dtb is what matters.
+ # @TODO: some users/maintainers do a lot of their work on "DTS/DTB only changes", which do require the kernel tree
+ # @TODO: but the only testable artifacts are the .dtb themselves. Allow for a `DTB_ONLY=yes` might be useful.
+
+ if [[ "a" == "b" ]]; then
+ # Do it individually
+ LOG_SECTION="kernel_make_headers_dtbs_image_modules" do_with_logging do_with_hooks kernel_make_headers_dtbs_image_modules
+ LOG_SECTION="kernel_package" do_with_logging do_with_hooks kernel_package
+ else
+ # Do it all together
+ LOG_SECTION="kernel_build_and_package" do_with_logging do_with_hooks kernel_build_and_package
+ fi
+
display_alert "Done with" "kernel compile" "debug"
cd "${kernel_work_dir}/.." || exit
rm -f linux-firmware-image-*.deb # remove firmware image packages here - easier than patching ~40 packaging scripts at once
- #run_host_command_logged dpkg-deb --contents ./*.deb || true
rsync --remove-source-files -rq ./*.deb "${DEB_STORAGE}/" || exit_with_error "Failed moving kernel DEBs"
return 0
}
@@ -188,6 +206,7 @@ function kernel_config() {
# copy kernel config
local COPY_CONFIG_BACK_TO=""
+
if [[ $KERNEL_KEEP_CONFIG == yes && -f "${DEST}"/config/$LINUXCONFIG.config ]]; then
display_alert "Using previous kernel config" "${DEST}/config/$LINUXCONFIG.config" "info"
cp -p "${DEST}/config/${LINUXCONFIG}.config" .config
@@ -223,6 +242,7 @@ function kernel_config() {
fi
# hack for deb builder. To pack what's missing in headers pack.
+ # @TODO: only for legacy builds?
cp "${SRC}"/patch/misc/headers-debian-byteshift.patch /tmp # @TODO: ok, but why /tmp? It's leaking there.
display_alert "Kernel configuration" "${LINUXCONFIG}" "info"
@@ -255,6 +275,13 @@ function kernel_config() {
fi
fi
+ call_extension_method "custom_kernel_config_post_defconfig" <<- 'CUSTOM_KERNEL_CONFIG_POST_DEFCONFIG'
+ *Kernel .config is in place, already processed by Armbian*
+ Called after ${LINUXCONFIG}.config is put in place (.config).
+ After all olddefconfig any Kconfig make is called.
+ A good place to customize the .config last-minute.
+ CUSTOM_KERNEL_CONFIG_POST_DEFCONFIG
+
# Restore the date of .config. Above delta is a pure function, theoretically.
set_files_modification_time "${kernel_config_mtime}" ".config"
}
@@ -338,9 +365,9 @@ function kernel_package() {
# define dict with vars passed and target directories
declare -A kernel_install_dirs=(
- ["INSTALL_PATH"]="${kernel_dest_install_dir}/image/boot" # Used by `make install`
- ["INSTALL_MOD_PATH"]="${kernel_dest_install_dir}/modules" # Used by `make modules_install`
- ["INSTALL_HDR_PATH"]="${kernel_dest_install_dir}/headers" # Used by `make headers_install`
+ ["INSTALL_PATH"]="${kernel_dest_install_dir}/image/boot" # Used by `make install`
+ ["INSTALL_MOD_PATH"]="${kernel_dest_install_dir}/modules" # Used by `make modules_install`
+ ["INSTALL_HDR_PATH"]="${kernel_dest_install_dir}/libc_headers" # Used by `make headers_install`
)
local -a prepackage_targets=(install modules_install headers_install)
@@ -388,3 +415,46 @@ function kernel_package() {
display_alert "Package building done" "${LINUXCONFIG} $kernel_packaging_target" "info"
}
+
+function kernel_build_and_package() {
+ cd "${kernel_work_dir}"
+
+ local -a build_targets=("all") # "All" builds the vmlinux/Image/Image.gz default for the ${ARCH}
+ declare kernel_dest_install_dir
+ kernel_dest_install_dir=$(mktemp -d "${WORKDIR}/kernel.temp.install.target.XXXXXXXXX") # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
+
+ # define dict with vars passed and target directories
+ declare -A kernel_install_dirs=(
+ ["INSTALL_PATH"]="${kernel_dest_install_dir}/image/boot" # Used by `make install`
+ ["INSTALL_MOD_PATH"]="${kernel_dest_install_dir}/modules" # Used by `make modules_install`
+ ["INSTALL_HDR_PATH"]="${kernel_dest_install_dir}/libc_headers" # Used by `make headers_install`
+ )
+
+ build_targets+=(install modules_install headers_install)
+ if [[ "${KERNEL_BUILD_DTBS:-yes}" == "yes" ]]; then
+ display_alert "Kernel build will produce DTBs!" "DTBs YES" "debug"
+ build_targets+=("dtbs_install")
+ kernel_install_dirs+=(["INSTALL_DTBS_PATH"]="${kernel_dest_install_dir}/dtbs") # Used by `make dtbs_install`
+ fi
+
+ # loop over the keys above, get the value, create param value in array; also mkdir the dir
+ declare -a install_make_params_quoted
+ local dir_key
+ for dir_key in "${!kernel_install_dirs[@]}"; do
+ local dir="${kernel_install_dirs["${dir_key}"]}"
+ local value="${dir_key}=${dir}"
+ mkdir -p "${dir}"
+ display_alert "Adding kernel packaging param" "${value}" "debug"
+ install_make_params_quoted+=("${value}")
+ done
+
+ display_alert "Building kernel" "${LINUXCONFIG} ${build_targets[*]}" "info"
+ fasthash_debug "build"
+ make_filter="| grep --line-buffered -v -e 'CC' -e 'LD' -e 'AR' -e 'INSTALL' -e 'SIGN' -e 'XZ' " \
+ run_kernel_make_long_running "${install_make_params_quoted[@]@Q}" "${build_targets[@]}"
+ fasthash_debug "build"
+
+ cd "${kernel_work_dir}"
+ prepare_kernel_packaging_debs "${kernel_work_dir}" "${kernel_dest_install_dir}" "${version}" kernel_install_dirs
+ display_alert "Package building done" "${LINUXCONFIG} $kernel_packaging_target" "info"
+}
From 8cfda3dcc398e3abb11f05f76509b4a165e402d3 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 9 Mar 2022 13:20:05 +0100
Subject: [PATCH] armbian-next: apt download-only retried 3 times before
installing main packages
---
lib/functions/logging/runners.sh | 4 ++++
lib/functions/rootfs/create-cache.sh | 3 +++
2 files changed, 7 insertions(+)
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index 0d0c887ed..a0f396cc7 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -3,6 +3,10 @@ function chroot_sdcard_apt_get_install() {
chroot_sdcard_apt_get --no-install-recommends install "$@"
}
+function chroot_sdcard_apt_get_install_download_only() {
+ chroot_sdcard_apt_get --no-install-recommends --download-only install "$@"
+}
+
function chroot_sdcard_apt_get() {
local -a apt_params=("-${APT_OPTS:-y}")
[[ $NO_APT_CACHER != yes ]] && apt_params+=(
diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh
index eec9f2fa3..b833ae3c8 100644
--- a/lib/functions/rootfs/create-cache.sh
+++ b/lib/functions/rootfs/create-cache.sh
@@ -185,6 +185,9 @@ function create_new_rootfs_cache() {
# stage: install additional packages
display_alert "Installing the main packages for" "Armbian" "info"
export MSG_IF_ERROR="Installation of Armbian main packages for ${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL} failed"
+ # First, try to download-only up to 3 times, to work around network/proxy problems.
+ chroot_sdcard_apt_get_install_download_only "$PACKAGE_MAIN_LIST" || chroot_sdcard_apt_get_install_download_only "$PACKAGE_MAIN_LIST" || chroot_sdcard_apt_get_install_download_only "$PACKAGE_MAIN_LIST"
+ # Now do the install.
chroot_sdcard_apt_get_install "$PACKAGE_MAIN_LIST"
if [[ $BUILD_DESKTOP == "yes" ]]; then
From 4b82345a588df2d9214b1ace097599ad42ee3463 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Tue, 8 Mar 2022 12:56:04 +0100
Subject: [PATCH] armbian-next: fix `VER=` read from kernel-image package, also
add `linux` default
---
lib/functions/compilation/kernel-debs.sh | 1 +
lib/functions/rootfs/distro-agnostic.sh | 3 +++
2 files changed, 4 insertions(+)
diff --git a/lib/functions/compilation/kernel-debs.sh b/lib/functions/compilation/kernel-debs.sh
index fe16d37af..f02bb4dde 100644
--- a/lib/functions/compilation/kernel-debs.sh
+++ b/lib/functions/compilation/kernel-debs.sh
@@ -169,6 +169,7 @@ function kernel_package_callback_linux_image() {
cat <<- CONTROL_FILE > "${package_DEBIAN_dir}/control"
Package: ${package_name}
Version: ${package_version}
+ Source: linux-${kernel_version}
Architecture: ${ARCH}
Maintainer: ${MAINTAINER} <${MAINTAINERMAIL}>
Section: kernel
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index a22338da3..4f363a696 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -292,6 +292,9 @@ function install_distribution_agnostic() {
It is not too late to `unset KERNELSOURCE` here and avoid kernel install.
PRE_INSTALL_KERNEL_DEBS
+ # default VER, will be parsed from Kernel version in the installed deb package.
+ VER="linux"
+
# install kernel
[[ -n $KERNELSOURCE ]] && {
if [[ "${REPOSITORY_INSTALL}" != *kernel* ]]; then
From 5d2a41313f02fd2e651c911984ae6b6f803154c7 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 7 Mar 2022 10:24:52 +0100
Subject: [PATCH] armbian-next: some logging for atf compilation
---
lib/functions/compilation/atf.sh | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/lib/functions/compilation/atf.sh b/lib/functions/compilation/atf.sh
index 7f20028da..b241b5dfa 100644
--- a/lib/functions/compilation/atf.sh
+++ b/lib/functions/compilation/atf.sh
@@ -54,11 +54,8 @@ compile_atf() {
# ENABLE_BACKTRACE="0" has been added to workaround a regression in ATF.
# Check: https://github.com/armbian/build/issues/1157
- CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${toolchain2}:${PATH}" \
- make ENABLE_BACKTRACE="0" $target_make $CTHREADS \
- CROSS_COMPILE="$CCACHE $ATF_COMPILER" 2>&1 || { # HANDLED SHORTCIRCUIT: direct command invocation; @TODO: replace with runner
- exit_with_error "ATF compilation failed"
- }
+ run_host_command_logged CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${toolchain2}:${PATH}" \
+ make ENABLE_BACKTRACE="0" $target_make "${CTHREADS}" "CROSS_COMPILE='$CCACHE $ATF_COMPILER'"
[[ $(type -t atf_custom_postprocess) == function ]] && atf_custom_postprocess 2>&1
From 779e9978e01f5d1706d85acc3f0182046cebcfbd Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 7 Mar 2022 10:09:29 +0100
Subject: [PATCH] armbian-next: rewrite hostdeps as array, add armhf toolchains
---
lib/functions/general/host.sh | 59 +++++++++++++++++++++----------------------
1 file changed, 29 insertions(+), 30 deletions(-)
diff --git a/lib/functions/general/host.sh b/lib/functions/general/host.sh
index 818541c6c..c2eb63578 100644
--- a/lib/functions/general/host.sh
+++ b/lib/functions/general/host.sh
@@ -57,44 +57,42 @@ prepare_host() {
# packages list for host
# NOTE: please sync any changes here with the Dockerfile and Vagrantfile
-
- local hostdeps="acl aptly aria2 bc binfmt-support bison btrfs-progs \
- build-essential ca-certificates ccache cpio cryptsetup curl \
- debian-archive-keyring debian-keyring debootstrap device-tree-compiler \
- dialog dirmngr dosfstools dwarves f2fs-tools fakeroot flex gawk \
- gcc-arm-linux-gnueabihf gdisk gnupg1 gpg imagemagick jq kmod libbison-dev \
- libc6-dev-armhf-cross libelf-dev libfdt-dev libfile-fcntllock-perl \
- libfl-dev liblz4-tool libncurses-dev libpython2.7-dev libssl-dev \
- libusb-1.0-0-dev linux-base locales lzop ncurses-base ncurses-term \
- nfs-kernel-server ntpdate p7zip-full parted patchutils pigz pixz \
- pkg-config pv python3-dev python3-distutils qemu-user-static rsync swig \
- systemd-container u-boot-tools udev unzip uuid-dev wget whiptail zip \
- zlib1g-dev file ccze"
+ declare -a host_dependencies=(
+ acl aptly aria2 bc binfmt-support bison btrfs-progs
+ build-essential ca-certificates ccache cpio cryptsetup curl
+ debian-archive-keyring debian-keyring debootstrap device-tree-compiler
+ dialog dirmngr dosfstools dwarves f2fs-tools fakeroot flex gawk
+ gcc-arm-linux-gnueabihf
+ gcc-arm-linux-gnueabi gcc-arm-none-eabi
+ gdisk gnupg1 gpg imagemagick jq kmod libbison-dev
+ libc6-dev-armhf-cross libelf-dev libfdt-dev libfile-fcntllock-perl
+ libfl-dev liblz4-tool libncurses-dev libpython2.7-dev libssl-dev
+ libusb-1.0-0-dev linux-base locales lzop ncurses-base ncurses-term
+ nfs-kernel-server ntpdate p7zip-full parted patchutils pigz pixz
+ pkg-config pv python3-dev python3-distutils qemu-user-static rsync swig
+ systemd-container u-boot-tools udev unzip uuid-dev wget whiptail zip
+ zlib1g-dev file ccze tree
+ )
if [[ $(dpkg --print-architecture) == amd64 ]]; then
-
- hostdeps+=" distcc lib32ncurses-dev lib32stdc++6 libc6-i386"
- grep -q i386 <(dpkg --print-foreign-architectures) || dpkg --add-architecture i386
-
+ :
+ #host_dependencies+=(distcc lib32ncurses-dev lib32stdc++6 libc6-i386)
+ #grep -q i386 <(dpkg --print-foreign-architectures) || dpkg --add-architecture i386 # @TODO: WHY?! don't do this! we don't want 32-bit x86 ever
elif [[ $(dpkg --print-architecture) == arm64 ]]; then
-
- hostdeps+=" gcc-arm-linux-gnueabi gcc-arm-none-eabi libc6 libc6-amd64-cross qemu"
-
+ host_dependencies+=(libc6 libc6-amd64-cross qemu) # What?
else
-
display_alert "Please read documentation to set up proper compilation environment"
display_alert "https://www.armbian.com/using-armbian-tools/"
- exit_with_error "Running this tool on non x86_64 build host is not supported"
-
+ exit_with_error "Running this tool on non x86_64 or arm64 build host is not supported"
fi
# Add support for Ubuntu 20.04, 21.04 and Mint 20.x
if [[ $HOSTRELEASE =~ ^(focal|impish|hirsute|ulyana|ulyssa|bullseye|uma)$ ]]; then
- hostdeps+=" python2 python3"
+ host_dependencies+=(python2 python3)
ln -fs /usr/bin/python2.7 /usr/bin/python2
ln -fs /usr/bin/python2.7 /usr/bin/python
else
- hostdeps+=" python libpython-dev"
+ host_dependencies+=("python" "libpython-dev")
fi
display_alert "Build host OS release" "${HOSTRELEASE:-(unknown)}" "info"
@@ -143,7 +141,7 @@ prepare_host() {
# warning: apt-cacher-ng will fail if installed and used both on host and in
# container/chroot environment with shared network
# set NO_APT_CACHER=yes to prevent installation errors in such case
- if [[ $NO_APT_CACHER != yes ]]; then hostdeps+=" apt-cacher-ng"; fi
+ if [[ $NO_APT_CACHER != yes ]]; then host_dependencies+=("apt-cacher-ng"); fi
export EXTRA_BUILD_DEPS=""
call_extension_method "add_host_dependencies" <<- 'ADD_HOST_DEPENDENCIES'
@@ -151,18 +149,19 @@ prepare_host() {
you can add packages to install, space separated, to ${EXTRA_BUILD_DEPS} here.
ADD_HOST_DEPENDENCIES
- if [ -n "${EXTRA_BUILD_DEPS}" ]; then hostdeps+=" ${EXTRA_BUILD_DEPS}"; fi
+ # shellcheck disable=SC2206 # I wanna expand. later will convert to proper array
+ if [ -n "${EXTRA_BUILD_DEPS}" ]; then host_dependencies+=(${EXTRA_BUILD_DEPS}); fi
display_alert "Installing build dependencies"
# don't prompt for apt cacher selection
sudo echo "apt-cacher-ng apt-cacher-ng/tunnelenable boolean false" | sudo debconf-set-selections
- # This handles the wanted list in $hostdeps, updates apt only if needed
- install_host_side_packages "$hostdeps"
+ # This handles the wanted list in $host_dependencies, updates apt only if needed
+ install_host_side_packages "${host_dependencies[@]}"
update-ccache-symlinks
- export FINAL_HOST_DEPS="$hostdeps ${EXTRA_BUILD_DEPS}"
+ export FINAL_HOST_DEPS="${host_dependencies[*]}"
call_extension_method "host_dependencies_ready" <<- 'HOST_DEPENDENCIES_READY'
*run after all host dependencies are installed*
At this point we can read `${FINAL_HOST_DEPS}`, but changing won't have any effect.
From 3a8770b0a1e28eaa7009964d6ebc3ba494de8010 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 7 Mar 2022 06:20:17 +0100
Subject: [PATCH] armbian-next: distro-agnostic: cleanups
---
lib/functions/rootfs/distro-agnostic.sh | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index 4188a6a48..a22338da3 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -435,15 +435,7 @@ function install_distribution_agnostic() {
echo "deb https://beta.armbian.com $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" \
> "${SDCARD}"/etc/apt/sources.list.d/armbian.list
- # Cosmetic fix [FAILED] Failed to start Set console font and keymap at first boot
- [[ -f "${SDCARD}"/etc/console-setup/cached_setup_font.sh ]] &&
- sed -i "s/^printf '.*/printf '\\\033\%\%G'/g" "${SDCARD}"/etc/console-setup/cached_setup_font.sh
- [[ -f "${SDCARD}"/etc/console-setup/cached_setup_terminal.sh ]] &&
- sed -i "s/^printf '.*/printf '\\\033\%\%G'/g" "${SDCARD}"/etc/console-setup/cached_setup_terminal.sh
- [[ -f "${SDCARD}"/etc/console-setup/cached_setup_keyboard.sh ]] &&
- sed -i "s/-u/-x'/g" "${SDCARD}"/etc/console-setup/cached_setup_keyboard.sh
-
- # fix for https://bugs.launchpad.net/ubuntu/+source/blueman/+bug/1542723
+ # fix for https://bugs.launchpad.net/ubuntu/+source/blueman/+bug/1542723 @TODO: from ubuntu 15. maybe gone?
chroot "${SDCARD}" /bin/bash -c "chown root:messagebus /usr/lib/dbus-1.0/dbus-daemon-launch-helper"
chroot "${SDCARD}" /bin/bash -c "chmod u+s /usr/lib/dbus-1.0/dbus-daemon-launch-helper"
@@ -522,15 +514,16 @@ function install_distribution_agnostic() {
# configure network manager
sed "s/managed=\(.*\)/managed=true/g" -i "${SDCARD}"/etc/NetworkManager/NetworkManager.conf
- # remove network manager defaults to handle eth by default
+ ## remove network manager defaults to handle eth by default @TODO: why?
rm -f "${SDCARD}"/usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf
# most likely we don't need to wait for nm to get online
chroot_sdcard systemctl disable NetworkManager-wait-online.service
- # Just regular DNS and maintain /etc/resolv.conf as a file
+ # Just regular DNS and maintain /etc/resolv.conf as a file @TODO: this does not apply as of impish at least
sed "/dns/d" -i "${SDCARD}"/etc/NetworkManager/NetworkManager.conf
sed "s/\[main\]/\[main\]\ndns=default\nrc-manager=file/g" -i "${SDCARD}"/etc/NetworkManager/NetworkManager.conf
+
if [[ -n $NM_IGNORE_DEVICES ]]; then
mkdir -p "${SDCARD}"/etc/NetworkManager/conf.d/
cat <<- EOF > "${SDCARD}"/etc/NetworkManager/conf.d/10-ignore-interfaces.conf
From 4d47d22489538006f32464dc9a0058a77810536b Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 5 Mar 2022 02:24:29 +0100
Subject: [PATCH] armbian-next: armbianEnv hooks/debugs (bsp / image)
---
lib/functions/bsp/bsp-cli.sh | 6 +++++-
lib/functions/image/partitioning.sh | 20 +++++++++++++++-----
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/lib/functions/bsp/bsp-cli.sh b/lib/functions/bsp/bsp-cli.sh
index ee557963c..5af25dd82 100644
--- a/lib/functions/bsp/bsp-cli.sh
+++ b/lib/functions/bsp/bsp-cli.sh
@@ -18,7 +18,11 @@ create_board_package() {
local bootscript_dst=${BOOTSCRIPT##*:}
mkdir -p "${destination}"/usr/share/armbian/
- # create extlinux config file
+ display_alert "BOOTSCRIPT" "${BOOTSCRIPT}" "debug"
+ display_alert "bootscript_src" "${bootscript_src}" "debug"
+ display_alert "bootscript_dst" "${bootscript_dst}" "debug"
+
+ # if not using extlinux, copy armbianEnv from template; prefer userpatches source
if [[ $SRC_EXTLINUX != yes ]]; then
if [ -f "${USERPATCHES_PATH}/bootscripts/${bootscript_src}" ]; then
cp "${USERPATCHES_PATH}/bootscripts/${bootscript_src}" "${destination}/usr/share/armbian/${bootscript_dst}"
diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh
index ef4714757..05b1492bc 100644
--- a/lib/functions/image/partitioning.sh
+++ b/lib/functions/image/partitioning.sh
@@ -297,13 +297,22 @@ prepare_partitions() {
# stage: adjust boot script or boot environment
if [[ -f $SDCARD/boot/armbianEnv.txt ]]; then
+ display_alert "Found armbianEnv.txt" "${SDCARD}/boot/armbianEnv.txt" "debug"
if [[ $CRYPTROOT_ENABLE == yes ]]; then
- echo "rootdev=$rootdevice cryptdevice=UUID=$(blkid -s UUID -o value ${LOOP}p${rootpart}):$ROOT_MAPPER" >> $SDCARD/boot/armbianEnv.txt
+ echo "rootdev=$rootdevice cryptdevice=UUID=$(blkid -s UUID -o value ${LOOP}p${rootpart}):$ROOT_MAPPER" >> "${SDCARD}/boot/armbianEnv.txt"
else
- echo "rootdev=$rootfs" >> $SDCARD/boot/armbianEnv.txt
+ echo "rootdev=$rootfs" >> "${SDCARD}/boot/armbianEnv.txt"
fi
- echo "rootfstype=$ROOTFS_TYPE" >> $SDCARD/boot/armbianEnv.txt
- elif [[ $rootpart != 1 ]]; then
+ echo "rootfstype=$ROOTFS_TYPE" >> "${SDCARD}/boot/armbianEnv.txt"
+
+ call_extension_method "image_specific_armbian_env_ready" <<- 'IMAGE_SPECIFIC_ARMBIAN_ENV_READY'
+ *during image build, armbianEnv.txt is ready for image-specific customization (not in BSP)*
+ You can write to `"${SDCARD}/boot/armbianEnv.txt"` here, it is guaranteed to exist.
+ IMAGE_SPECIFIC_ARMBIAN_ENV_READY
+
+ elif
+ [[ $rootpart != 1 ]]
+ then
local bootscript_dst=${BOOTSCRIPT##*:}
sed -i 's/mmcblk0p1/mmcblk0p2/' $SDCARD/boot/$bootscript_dst
sed -i -e "s/rootfstype=ext4/rootfstype=$ROOTFS_TYPE/" \
@@ -312,6 +321,7 @@ prepare_partitions() {
# if we have boot.ini = remove armbianEnv.txt and add UUID there if enabled
if [[ -f $SDCARD/boot/boot.ini ]]; then
+ display_alert "Found boot.ini" "${SDCARD}/boot/boot.ini" "debug"
sed -i -e "s/rootfstype \"ext4\"/rootfstype \"$ROOTFS_TYPE\"/" $SDCARD/boot/boot.ini
if [[ $CRYPTROOT_ENABLE == yes ]]; then
local rootpart="UUID=$(blkid -s UUID -o value ${LOOP}p${rootpart})"
@@ -319,7 +329,7 @@ prepare_partitions() {
else
sed -i 's/^setenv rootdev .*/setenv rootdev "'$rootfs'"/' $SDCARD/boot/boot.ini
fi
- if [[ $LINUXFAMILY != meson64 ]]; then
+ if [[ $LINUXFAMILY != meson64 ]]; then # @TODO: why only for meson64?
[[ -f $SDCARD/boot/armbianEnv.txt ]] && rm $SDCARD/boot/armbianEnv.txt
fi
fi
From 1afd681bab297b9441fe9e65104ba52d1a3d96ce Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 4 Mar 2022 04:16:50 +0100
Subject: [PATCH] armbian-next: rpi: completely remove dtb hacks, allowing
flash-kernel to work again
---
config/sources/families/bcm2711.conf | 17 +----------------
1 file changed, 1 insertion(+), 16 deletions(-)
diff --git a/config/sources/families/bcm2711.conf b/config/sources/families/bcm2711.conf
index 8a4eb060d..12ba2caae 100644
--- a/config/sources/families/bcm2711.conf
+++ b/config/sources/families/bcm2711.conf
@@ -49,27 +49,12 @@ pre_initramfs_flash_kernel__write_raspi_cmdline() {
pre_flash_kernel__symlink_dtb_and_kernel() {
if [[ "${RASPI_DISTRO_KERNEL}" != "yes" ]]; then # and firmware.
- display_alert "Preparing DTBs and Kernel..." "bcm2711" "info"
- mkdir -p "${MOUNT}"/etc/flash-kernel/dtbs
-
+ display_alert "Configuring flash-kernel DB..." "bcm2711" "info"
cat <<- EOD >> "${MOUNT}"/etc/flash-kernel/db
# Armbian kernels don't have a 'flavour'. Ignore flavors for all rpi revisions.
Machine: Raspberry Pi *
Kernel-Flavors: any
EOD
-
- ## @TODO: rpardini: a horrible hack. I'll sort this out together with overlays, later.
- local oneDTB dtbBase
- for oneDTB in "${MOUNT}"/boot/dtb/broadcom/*.dtb; do
- dtbBase=$(basename "${oneDTB}")
- cp "${MOUNT}"/boot/dtb/broadcom/"${dtbBase}" "${MOUNT}"/etc/flash-kernel/dtbs/"${dtbBase}"
- done
-
- rm -rf "${MOUNT}"/boot/dtb* || true
-
- # @TODO: rpardini: packaging could maybe already use the correct names? I can't figure out how.
- ln -s ./Image "${MOUNT}"/boot/vmlinuz
- ln -s ./Image "${MOUNT}"/boot/vmlinuz-
fi
}
From 33beb042960cbf7ab66271a44b53b79dafa01642 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 4 Mar 2022 01:09:55 +0100
Subject: [PATCH] armbian-next: refactor new kernel packaging; add linux-dtb
package back in finally, upgrades untested
---
lib/functions/compilation/kernel-debs.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/functions/compilation/kernel-debs.sh b/lib/functions/compilation/kernel-debs.sh
index e4c78c73c..fe16d37af 100644
--- a/lib/functions/compilation/kernel-debs.sh
+++ b/lib/functions/compilation/kernel-debs.sh
@@ -212,7 +212,7 @@ function kernel_package_callback_linux_image() {
function kernel_package_callback_linux_dtb() {
display_alert "package_directory" "${package_directory}" "debug"
- mkdir -p "${package_directory}/boot/dtb-${kernel_version_family}"
+ mkdir -p "${package_directory}/boot/"
run_host_command_logged cp -rp "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}" "${package_directory}/boot/dtb-${kernel_version_family}"
# Generate a control file
From 5cd4b7a471267aaf8a1336629a65a6df4b81b087 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 3 Mar 2022 23:31:08 +0100
Subject: [PATCH] armbian-next: refactor new kernel packaging; extract hook
helper, fix kernel symlink
---
lib/functions/compilation/kernel-debs.sh | 97 +++++++++++++++++---------------
1 file changed, 53 insertions(+), 44 deletions(-)
diff --git a/lib/functions/compilation/kernel-debs.sh b/lib/functions/compilation/kernel-debs.sh
index c8a3e0377..e4c78c73c 100644
--- a/lib/functions/compilation/kernel-debs.sh
+++ b/lib/functions/compilation/kernel-debs.sh
@@ -126,6 +126,27 @@ function create_kernel_deb() {
run_host_command_logged dpkg-deb ${DEB_COMPRESS:+-Z$DEB_COMPRESS} --build "${package_directory}" "${deb_output_dir}" # not KDEB compress, we're not under a Makefile
}
+function kernel_package_hook_helper() {
+ declare script="${1}"
+ declare contents="${2}"
+
+ cat >> "${package_DEBIAN_dir}/${script}" <<- EOT
+ #!/bin/bash
+ echo "Armbian ${package_name} for ${kernel_version_family}: ${script} starting."
+ set -e # Error control
+ set -x # Debugging
+
+ $(cat "${contents}")
+
+ echo "Armbian ${package_name} for ${kernel_version_family}: ${script} finishing."
+ true
+ EOT
+ chmod 775 "${package_DEBIAN_dir}/${script}"
+
+ display_alert "Hook debug" "${script} for ${package_name}" "debug"
+ run_host_command_logged cat "${package_DEBIAN_dir}/${script}"
+}
+
function kernel_package_callback_linux_image() {
display_alert "package_directory" "${package_directory}" "debug"
@@ -165,33 +186,27 @@ function kernel_package_callback_linux_image() {
declare debian_kernel_hook_dir="/etc/kernel"
for script in "postinst" "postrm" "preinst" "prerm"; do
mkdir -p "${package_directory}${debian_kernel_hook_dir}/${script}.d" # create kernel hook dir, make sure.
- cat <<- KERNEL_HOOK_DELEGATION > "${package_DEBIAN_dir}/${script}"
- #!/bin/bash
- set -e
- set -x
-
- # Pass maintainer script parameters to hook scripts
- export DEB_MAINT_PARAMS="\$*"
-
- # Tell initramfs builder whether it's wanted
- export INITRD=$(if_enabled_echo CONFIG_BLK_DEV_INITRD Yes No)
- test -d ${debian_kernel_hook_dir}/${script}.d && run-parts --arg="${kernel_version_family}" --arg="/${installed_image_path}" ${debian_kernel_hook_dir}/${script}.d
-
- true
- KERNEL_HOOK_DELEGATION
- chmod 755 "${package_DEBIAN_dir}/${script}"
+ kernel_package_hook_helper "${script}" <(
+ cat <<- KERNEL_HOOK_DELEGATION
+ export DEB_MAINT_PARAMS="\$*" # Pass maintainer script parameters to hook scripts
+ export INITRD=$(if_enabled_echo CONFIG_BLK_DEV_INITRD Yes No) # Tell initramfs builder whether it's wanted
+ # Run the same hooks Debian/Ubuntu would for their kernel packages.
+ test -d ${debian_kernel_hook_dir}/${script}.d && run-parts --arg="${kernel_version_family}" --arg="/${installed_image_path}" ${debian_kernel_hook_dir}/${script}.d
+ KERNEL_HOOK_DELEGATION
+
+ # @TODO: only if u-boot, only for postinst. Gotta find a hook scheme for these...
+ if [[ "${script}" == "postinst" ]]; then
+ if [[ "yes" == "yes" ]]; then
+ cat <<- HOOK_FOR_LINK_TO_LAST_INSTALLED_KERNEL
+ echo "Armbian: update last-installed kernel symlink..."
+ ln -sf $(basename "${installed_image_path}") /boot/$image_name || mv /${installed_image_path} /boot/${image_name}
+ touch /boot/.next
+ HOOK_FOR_LINK_TO_LAST_INSTALLED_KERNEL
+ fi
+ fi
+ )
done
-
- # @TODO: only if u-boot
- if [[ "yes" == "yes" ]]; then
- cat <<- HOOK_FOR_LINK_TO_LAST_INSTALLED_KERNEL >> "${package_DEBIAN_dir}/postinst"
- echo "Armbian: update last-installed kernel symlink..."
- ln -sf $(basename "${installed_image_path}") /boot/$image_name || mv /${installed_image_path} /boot/${image_name}
- touch /boot/.next
- HOOK_FOR_LINK_TO_LAST_INSTALLED_KERNEL
- fi
-
}
function kernel_package_callback_linux_dtb() {
@@ -212,24 +227,18 @@ function kernel_package_callback_linux_dtb() {
This package contains device blobs from the Linux kernel, version ${kernel_version_family}
CONTROL_FILE
- cat >> "${package_DEBIAN_dir}/preinst" <<- EOT
- #!/bin/bash
- set -e
- set -x
- rm -rf /boot/dtb
- rm -rf /boot/dtb-${kernel_version_family}
- exit 0
- EOT
- chmod 775 "${package_DEBIAN_dir}/preinst"
-
- cat >> "${package_DEBIAN_dir}/postinst" <<- EOT
- #!/bin/bash
- set -e
- set -x
- cd /boot
- ln -sfT dtb-${kernel_version_family} dtb || mv dtb-${kernel_version_family} dtb
- exit 0
- EOT
- chmod 775 "${package_DEBIAN_dir}/postinst"
+ kernel_package_hook_helper "preinst" <(
+ cat <<- EOT
+ rm -rf /boot/dtb
+ rm -rf /boot/dtb-${kernel_version_family}
+ EOT
+ )
+
+ kernel_package_hook_helper "postinst" <(
+ cat <<- EOT
+ cd /boot
+ ln -sfT dtb-${kernel_version_family} dtb || mv dtb-${kernel_version_family} dtb
+ EOT
+ )
}
From c2259116c1728595802cf29aae7f29098a4a5c99 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 3 Mar 2022 21:49:24 +0100
Subject: [PATCH] armbian-next: refactor new kernel packaging; add linux-dtb
package back in finally, all hooks untested
---
lib/functions/compilation/kernel-debs.sh | 199 ++++++++++++++++++++++---------
lib/functions/compilation/kernel.sh | 4 +-
2 files changed, 142 insertions(+), 61 deletions(-)
diff --git a/lib/functions/compilation/kernel-debs.sh b/lib/functions/compilation/kernel-debs.sh
index 26a9bc3cd..c8a3e0377 100644
--- a/lib/functions/compilation/kernel-debs.sh
+++ b/lib/functions/compilation/kernel-debs.sh
@@ -38,23 +38,51 @@ if_enabled_echo() {
function prepare_kernel_packaging_debs() {
declare kernel_work_dir="${1}"
- declare kernel_version="${2}"
- declare -n tmp_kernel_install_dirs="${3}" # nameref to declare -n kernel_install_dirs dictionary
- declare kernel_package_dir
-
- kernel_package_dir=$(mktemp -d "${WORKDIR}/kernel.image.package.XXXXXXXXX") # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
- display_alert "kernel_package_dir" "${kernel_package_dir}" "debug"
+ declare kernel_dest_install_dir="${2}"
+ declare kernel_version="${3}"
+ declare -n tmp_kernel_install_dirs="${4}" # nameref to declare -n kernel_install_dirs dictionary
+ declare debs_target_dir="${kernel_work_dir}/.."
# Some variables and settings used throughout the script
declare kernel_version_family="${kernel_version}-${LINUXFAMILY}"
- declare packageversion="${REVISION}"
- declare linux_image_package_name="linux-image-${BRANCH}-${LINUXFAMILY}"
+ declare package_version="${REVISION}"
+
+ # show incoming tree
+ display_alert "Kernel install dir" "incoming from KBUILD make" "debug"
+ run_host_command_logged tree -C --du -h "${kernel_dest_install_dir}" "| grep --line-buffered -v -e '\.ko' -e '\.h' "
+
+ display_alert "tmp_kernel_install_dirs INSTALL_PATH:" "${tmp_kernel_install_dirs[INSTALL_PATH]}" "debug"
+ display_alert "tmp_kernel_install_dirs INSTALL_MOD_PATH:" "${tmp_kernel_install_dirs[INSTALL_MOD_PATH]}" "debug"
+ display_alert "tmp_kernel_install_dirs INSTALL_HDR_PATH:" "${tmp_kernel_install_dirs[INSTALL_HDR_PATH]}" "debug"
+ display_alert "tmp_kernel_install_dirs INSTALL_DTBS_PATH:" "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}" "debug"
+
+ # package the linux-image (image, modules, dtbs (if present))
+ create_kernel_deb "linux-image-${BRANCH}-${LINUXFAMILY}" "${debs_target_dir}" kernel_package_callback_linux_image
+
+ # if dtbs present, package those too separately, for u-boot usage.
+ if [[ -d "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}" ]]; then
+ create_kernel_deb "linux-dtb-${BRANCH}-${LINUXFAMILY}" "${debs_target_dir}" kernel_package_callback_linux_dtb
+ fi
+
+ # @TODO: package headers. probably in 3 phases: common per-version (libc headers), common per-arch (arch-specific, with binary tools), and kernel specific (kernel-headers, no tools)
+
+}
+
+function create_kernel_deb() {
+ declare package_name="${1}"
+ declare deb_output_dir="${2}"
+ declare callback_function="${3}"
- mkdir -p "${kernel_package_dir}/DEBIAN"
+ declare package_directory
+ package_directory=$(mktemp -d "${WORKDIR}/${package_name}.XXXXXXXXX") # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
+ display_alert "package_directory" "${package_directory}" "debug"
+
+ declare package_DEBIAN_dir="${package_directory}/DEBIAN" # DEBIAN dir
+ mkdir -p "${package_DEBIAN_dir}" # maintainer scripts et al
# Generate copyright file
- mkdir -p "${kernel_package_dir}/usr/share/doc/${linux_image_package_name}"
- cat <<- EOF > "${kernel_package_dir}/usr/share/doc/${linux_image_package_name}/copyright"
+ mkdir -p "${package_directory}/usr/share/doc/${package_name}"
+ cat <<- COPYRIGHT > "${package_directory}/usr/share/doc/${package_name}/copyright"
This is a packaged Armbian patched version of the Linux kernel.
The sources may be found at most Linux archive sites, including:
@@ -71,12 +99,55 @@ function prepare_kernel_packaging_debs() {
On Debian GNU/Linux systems, the complete text of the GNU General Public
License version 2 can be found in \`/usr/share/common-licenses/GPL-2'.
- EOF
+ COPYRIGHT
+
+ # Run the callback.
+ display_alert "Running callback" "callback: ${callback_function}" "debug"
+ "${callback_function}" "${@}"
+
+ run_host_command_logged chown -R root:root "${package_directory}" # Fix ownership and permissions
+ run_host_command_logged chmod -R go-w "${package_directory}" # Fix ownership and permissions
+ run_host_command_logged chmod -R a+rX "${package_directory}" # in case we are in a restrictive umask environment like 0077
+ run_host_command_logged chmod -R ug-s "${package_directory}" # in case we build in a setuid/setgid directory
+
+ cd "${package_directory}" || exit_with_error "major failure 774 for ${package_name}"
+
+ # create md5sums file
+ sh -c "cd '${package_directory}'; find . -type f ! -path './DEBIAN/*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums"
+
+ declare unpacked_size
+ unpacked_size="$(du -h -s "${package_directory}" | awk '{print $1}')"
+ display_alert "Unpacked ${package_name} tree" "${unpacked_size}" "debug"
+
+ # Show it
+ display_alert "Package dir" "for package ${package_name}" "debug"
+ run_host_command_logged tree -C -h -d --du "${package_directory}"
+
+ run_host_command_logged dpkg-deb ${DEB_COMPRESS:+-Z$DEB_COMPRESS} --build "${package_directory}" "${deb_output_dir}" # not KDEB compress, we're not under a Makefile
+}
+
+function kernel_package_callback_linux_image() {
+ display_alert "package_directory" "${package_directory}" "debug"
+
+ declare installed_image_path="boot/vmlinuz-${kernel_version_family}" # using old mkdebian terminology here.
+ declare image_name="Image" # for arm64. or, "zImage" for arm, or "vmlinuz" for others. Why? See where u-boot puts them.
+
+ run_host_command_logged cp -rp "${tmp_kernel_install_dirs[INSTALL_PATH]}" "${package_directory}/" # /boot stuff
+ run_host_command_logged cp -rp "${tmp_kernel_install_dirs[INSTALL_MOD_PATH]}/lib" "${package_directory}/" # so "lib" stuff sits at the root
+
+ if [[ -d "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}" ]]; then
+ # /usr/lib/linux-image-${kernel_version_family} is wanted by flash-kernel
+ # /lib/firmware/${kernel_version_family}/device-tree/ would also be acceptable
+
+ display_alert "DTBs present on kernel output" "DTBs ${package_name}: /usr/lib/linux-image-${kernel_version_family}" "debug"
+ mkdir -p "${package_directory}/usr/lib"
+ run_host_command_logged cp -rp "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}" "${package_directory}/usr/lib/linux-image-${kernel_version_family}"
+ fi
# Generate a control file
- cat <<- EOF > "${kernel_package_dir}/DEBIAN/control"
- Package: ${linux_image_package_name}
- Version: ${packageversion}
+ cat <<- CONTROL_FILE > "${package_DEBIAN_dir}/control"
+ Package: ${package_name}
+ Version: ${package_version}
Architecture: ${ARCH}
Maintainer: ${MAINTAINER} <${MAINTAINERMAIL}>
Section: kernel
@@ -84,20 +155,20 @@ function prepare_kernel_packaging_debs() {
Description: Linux kernel, armbian version $kernel_version_family $BRANCH
This package contains the Linux kernel, modules and corresponding other
files, kernel_version_family: $kernel_version_family.
- EOF
+ CONTROL_FILE
# Install the maintainer scripts
# Note: hook scripts under /etc/kernel are also executed by official Debian
# kernel packages, as well as kernel packages built using make-kpkg.
# make-kpkg sets $INITRD to indicate whether an initramfs is wanted, and
# so do we; recent versions of dracut and initramfs-tools will obey this.
- declare debhookdir="/etc/kernel"
- for script in postinst postrm preinst prerm; do
- mkdir -p "${kernel_package_dir}${debhookdir}/${script}.d"
- cat <<- EOF > "${kernel_package_dir}/DEBIAN/${script}"
+ declare debian_kernel_hook_dir="/etc/kernel"
+ for script in "postinst" "postrm" "preinst" "prerm"; do
+ mkdir -p "${package_directory}${debian_kernel_hook_dir}/${script}.d" # create kernel hook dir, make sure.
+ cat <<- KERNEL_HOOK_DELEGATION > "${package_DEBIAN_dir}/${script}"
#!/bin/bash
- set -x
set -e
+ set -x
# Pass maintainer script parameters to hook scripts
export DEB_MAINT_PARAMS="\$*"
@@ -105,50 +176,60 @@ function prepare_kernel_packaging_debs() {
# Tell initramfs builder whether it's wanted
export INITRD=$(if_enabled_echo CONFIG_BLK_DEV_INITRD Yes No)
- test -d $debhookdir/$script.d && run-parts --arg="$kernel_version_family" --arg="/$installed_image_path" $debhookdir/$script.d
- exit 0
- EOF
- chmod 755 "${kernel_package_dir}/DEBIAN/${script}"
- done
-
- display_alert "tmp_kernel_install_dirs INSTALL_PATH:" "${tmp_kernel_install_dirs[INSTALL_PATH]}" "debug"
- display_alert "tmp_kernel_install_dirs INSTALL_MOD_PATH:" "${tmp_kernel_install_dirs[INSTALL_MOD_PATH]}" "debug"
- display_alert "tmp_kernel_install_dirs INSTALL_HDR_PATH:" "${tmp_kernel_install_dirs[INSTALL_HDR_PATH]}" "debug"
-
- display_alert "Kernel install dir" "tree 1" "debug"
- run_host_command_logged tree -C -h --du -d -L 3 "${tmp_kernel_install_dirs[INSTALL_PATH]}/../.."
+ test -d ${debian_kernel_hook_dir}/${script}.d && run-parts --arg="${kernel_version_family}" --arg="/${installed_image_path}" ${debian_kernel_hook_dir}/${script}.d
- run_host_command_logged cp -rp "${tmp_kernel_install_dirs[INSTALL_PATH]}" "${kernel_package_dir}/" # /boot stuff
- run_host_command_logged cp -rp "${tmp_kernel_install_dirs[INSTALL_MOD_PATH]}/lib" "${kernel_package_dir}/" # so "lib" stuff sits at the root
-
- if [[ -d "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}" ]]; then
- display_alert "tmp_kernel_install_dirs INSTALL_DTBS_PATH:" "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}" "debug"
- display_alert "Kernel build will produce DTBs package!" "DTBs YES PACKAGE" "debug"
+ true
+ KERNEL_HOOK_DELEGATION
+ chmod 755 "${package_DEBIAN_dir}/${script}"
+ done
- # /usr/lib/linux-image-${kernel_version_family} is wanted by flash-kernel
- # /lib/firmware/${kernel_version_family}/device-tree/ would also be acceptable
- mkdir -p "${kernel_package_dir}/usr/lib"
- run_host_command_logged cp -rp "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}" "${kernel_package_dir}/usr/lib/linux-image-${kernel_version_family}"
+ # @TODO: only if u-boot
+ if [[ "yes" == "yes" ]]; then
+ cat <<- HOOK_FOR_LINK_TO_LAST_INSTALLED_KERNEL >> "${package_DEBIAN_dir}/postinst"
+ echo "Armbian: update last-installed kernel symlink..."
+ ln -sf $(basename "${installed_image_path}") /boot/$image_name || mv /${installed_image_path} /boot/${image_name}
+ touch /boot/.next
+ HOOK_FOR_LINK_TO_LAST_INSTALLED_KERNEL
fi
- run_host_command_logged chown -R root:root "${kernel_package_dir}" # Fix ownership and permissions
- run_host_command_logged chmod -R go-w "${kernel_package_dir}" # Fix ownership and permissions
- run_host_command_logged chmod -R a+rX "${kernel_package_dir}" # in case we are in a restrictive umask environment like 0077
- run_host_command_logged chmod -R ug-s "${kernel_package_dir}" # in case we build in a setuid/setgid directory
-
- cd "${kernel_package_dir}" || exit_with_error "major failure 774"
-
- # create md5sums file. needed? @TODO: convert to subshell?
- sh -c "cd '${kernel_package_dir}'; find . -type f ! -path './DEBIAN/*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums"
+}
- declare unpacked_size
- unpacked_size="$(du -h -s "${kernel_package_dir}" | awk '{print $1}')"
- display_alert "Unpacked linux-kernel image" "${unpacked_size}" "debug"
+function kernel_package_callback_linux_dtb() {
+ display_alert "package_directory" "${package_directory}" "debug"
- # Show it
- display_alert "Package dir" "tree 2" "debug"
- run_host_command_logged tree -C -h --du -d -L 3 "${kernel_package_dir}"
+ mkdir -p "${package_directory}/boot/dtb-${kernel_version_family}"
+ run_host_command_logged cp -rp "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}" "${package_directory}/boot/dtb-${kernel_version_family}"
- run_host_command_logged dpkg-deb ${DEB_COMPRESS:+-Z$DEB_COMPRESS} --build "${kernel_package_dir}" "${kernel_work_dir}/.." # not KDEB compress, we're not under a Makefile
+ # Generate a control file
+ cat <<- CONTROL_FILE > "${package_DEBIAN_dir}/control"
+ Version: ${package_version}
+ Maintainer: ${MAINTAINER} <${MAINTAINERMAIL}>
+ Section: kernel
+ Package: ${package_name}
+ Architecture: ${ARCH}
+ Provides: linux-dtb, linux-dtb-armbian, armbian-$BRANCH
+ Description: Armbian Linux DTB, version ${kernel_version_family} $BRANCH
+ This package contains device blobs from the Linux kernel, version ${kernel_version_family}
+ CONTROL_FILE
+
+ cat >> "${package_DEBIAN_dir}/preinst" <<- EOT
+ #!/bin/bash
+ set -e
+ set -x
+ rm -rf /boot/dtb
+ rm -rf /boot/dtb-${kernel_version_family}
+ exit 0
+ EOT
+ chmod 775 "${package_DEBIAN_dir}/preinst"
+
+ cat >> "${package_DEBIAN_dir}/postinst" <<- EOT
+ #!/bin/bash
+ set -e
+ set -x
+ cd /boot
+ ln -sfT dtb-${kernel_version_family} dtb || mv dtb-${kernel_version_family} dtb
+ exit 0
+ EOT
+ chmod 775 "${package_DEBIAN_dir}/postinst"
}
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index e663e0265..3a167b17a 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -339,8 +339,8 @@ function kernel_package() {
# define dict with vars passed and target directories
declare -A kernel_install_dirs=(
["INSTALL_PATH"]="${kernel_dest_install_dir}/image/boot" # Used by `make install`
- ["INSTALL_HDR_PATH"]="${kernel_dest_install_dir}/headers" # Used by `make headers_install`
["INSTALL_MOD_PATH"]="${kernel_dest_install_dir}/modules" # Used by `make modules_install`
+ ["INSTALL_HDR_PATH"]="${kernel_dest_install_dir}/headers" # Used by `make headers_install`
)
local -a prepackage_targets=(install modules_install headers_install)
@@ -371,7 +371,7 @@ function kernel_package() {
fasthash_debug "post-prepackage"
cd "${kernel_work_dir}"
- prepare_kernel_packaging_debs "${kernel_work_dir}" "${version}" kernel_install_dirs
+ prepare_kernel_packaging_debs "${kernel_work_dir}" "${kernel_dest_install_dir}" "${version}" kernel_install_dirs
### # produce deb packages: image, headers, firmware, dtb
### # This mostly only does
From 7cd425e1c3c2efa14c7fb7a13a9b24f9bb5cfc38 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 2 Mar 2022 20:31:44 +0100
Subject: [PATCH] flash-kernel: fix short-circuits as last statement in
functions
---
extensions/flash-kernel.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/extensions/flash-kernel.sh b/extensions/flash-kernel.sh
index 847eb37b7..ab5d308d8 100644
--- a/extensions/flash-kernel.sh
+++ b/extensions/flash-kernel.sh
@@ -50,6 +50,8 @@ function post_install_kernel_debs__install_kernel_and_flash_packages() {
# Remove fake /sys/firmware (/efi) directory
rm -rf "${SDCARD}"/sys/firmware
+
+ return 0 # prevent future shortcircuits exiting with error
}
# @TODO: extract u-boot into an extension, so that core bsps don't have this stuff in there to begin with.
@@ -64,6 +66,7 @@ post_family_tweaks_bsp__remove_uboot_flash_kernel() {
pre_umount_final_image__remove_uboot_initramfs_hook_flash_kernel() {
# even if BSP still contained this (cached .deb), make sure by removing from ${MOUNT}
[[ -f "$MOUNT"/etc/initramfs/post-update.d/99-uboot ]] && rm -v "$MOUNT"/etc/initramfs/post-update.d/99-uboot
+ return 0 # shortcircuit above
}
function pre_update_initramfs__setup_flash_kernel() {
From b459fb3af894ae4315e8416fee62d77c2a1a191b Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 2 Mar 2022 13:28:37 +0100
Subject: [PATCH] armbian-next: do not force `SHOW_LOG=yes` if `CI=true`; let's
_trust_ logging and error handling works
---
compile.sh | 4 ----
1 file changed, 4 deletions(-)
diff --git a/compile.sh b/compile.sh
index 0c35c5fd6..2bc765f9f 100755
--- a/compile.sh
+++ b/compile.sh
@@ -36,10 +36,6 @@ if [[ ! -f "${SRC}"/lib/single.sh ]]; then
exit 255
fi
-# Most CI runners, GitHub Actions included, pass env var "CI=true". In this case, force full logging.
-if [[ "${CI}" == "true" ]]; then
- export SHOW_LOG=yes
-fi
# shellcheck source=lib/single.sh
source "${SRC}"/lib/single.sh
From a0ed264825785655fba53d67de525ddebbb48090 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 2 Mar 2022 13:26:56 +0100
Subject: [PATCH] armbian-next: back out of setting mtime to the revision time
during git checkout.
- of course this causes huge recompiles when wanted revision moves forward
---
lib/functions/general/git.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index c4477ca0a..8330b3fe4 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -171,9 +171,9 @@ fetch_from_repo() {
regular_git clean -q -d -f # Files that are not tracked by git and were added when the patch was applied must be removed.
# set the checkout date on all the versioned files.
- git ls-tree -r -z --name-only "${checkout_from}" | xargs -0 -- touch -m -t "${checked_out_revision_mtime:0:12}.${checked_out_revision_mtime:12}"
-
- fasthash_debug "after setting checkout time for $dir $ref_name" #yeah
+ # @TODO: this is contentious. disable for now. patches will still use the mininum date set by checked_out_revision_mtime above
+ #git ls-tree -r -z --name-only "${checkout_from}" | xargs -0 -- touch -m -t "${checked_out_revision_mtime:0:12}.${checked_out_revision_mtime:12}"
+ #fasthash_debug "after setting checkout time for $dir $ref_name" #yeah
if [[ -f .gitmodules ]]; then
display_alert "Updating submodules" "" "ext"
From 4d1d62558c4cf4f670fae821f7629a01a1f2c35e Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 2 Mar 2022 13:16:04 +0100
Subject: [PATCH] armbian-next: sync 'config' dir from master revision
ed589b248aef675cb5e845fcb55c12dfbcc5e925
- this is _also_ getting out of hand... gotta merge soon
---
config/boards/rpi4b.wip | 16 +++++++++++++++-
config/boards/uefi-arm64.conf | 2 +-
config/boards/uefi-x86.conf | 2 +-
config/sources/families/bcm2711.conf | 2 +-
config/sources/families/include/meson64_common.inc | 2 +-
config/sources/families/include/rockchip64_common.inc | 10 +++++-----
config/sources/families/include/uefi_common.inc | 2 +-
config/sources/families/jetson-nano.conf | 6 +-----
config/sources/families/media.conf | 2 +-
9 files changed, 27 insertions(+), 17 deletions(-)
diff --git a/config/boards/rpi4b.wip b/config/boards/rpi4b.wip
index c78b14060..3c1926821 100644
--- a/config/boards/rpi4b.wip
+++ b/config/boards/rpi4b.wip
@@ -2,7 +2,7 @@
export BOARD_NAME="Raspberry Pi 4"
export BOARDFAMILY="bcm2711"
export KERNEL_TARGET="legacy,current,edge"
-export FK__MACHINE_MODEL="Raspberry Pi 4 Model B" # this is passed to flash-kernel.
+export FK__MACHINE_MODEL="Raspberry Pi 4 Model B" # flash kernel (FK) configuration
export ASOUND_STATE="asound.state.rpi"
# configure stuff at the appropriate time in flash-kernel
@@ -12,6 +12,8 @@ pre_initramfs_flash_kernel__write_raspi_config() {
cat <<- EOD > "${FIRMWARE_DIR}/config.txt"
[pi4]
max_framebuffers=2
+ over_voltage=2
+ arm_freq=1800
[all]
kernel=vmlinuz
@@ -20,10 +22,22 @@ pre_initramfs_flash_kernel__write_raspi_config() {
disable_overscan=1
hdmi_drive=2
arm_64bit=1
+ disable_splash=1
+
+ # enable audio (loads snd_bcm2835)
+ dtparam=audio=on
# bootloader logs to serial, second stage
# enable_uart=1
+ # overclock. requires decent thermals. COMMENT OUT IF DON'T USE A GREAT COOLER OR HEATSINK.
+ # over_voltage=6
+ # arm_freq=2000
+
+ # uncomment to disable wifi or bt.
+ #dtoverlay=disable-wifi
+ #dtoverlay=disable-bt
+
# gpu and 3d stuff.
gpu_mem=256
dtoverlay=vc4-fkms-v3d
diff --git a/config/boards/uefi-arm64.conf b/config/boards/uefi-arm64.conf
index 8f5e201f7..3da87e459 100644
--- a/config/boards/uefi-arm64.conf
+++ b/config/boards/uefi-arm64.conf
@@ -1,4 +1,4 @@
# aarch64 via UEFI for all UEFI-enabled boards
export BOARD_NAME="UEFI arm64"
export BOARDFAMILY="uefi-arm64"
-export KERNEL_TARGET="legacy,current,edge"
+export KERNEL_TARGET="current,edge"
diff --git a/config/boards/uefi-x86.conf b/config/boards/uefi-x86.conf
index 7ff375bb8..0188da545 100644
--- a/config/boards/uefi-x86.conf
+++ b/config/boards/uefi-x86.conf
@@ -1,4 +1,4 @@
# x86_64 via UEFI/BIOS for all boards
export BOARD_NAME="UEFI x86"
export BOARDFAMILY="uefi-x86"
-export KERNEL_TARGET="legacy,current,edge"
+export KERNEL_TARGET="current,edge"
diff --git a/config/sources/families/bcm2711.conf b/config/sources/families/bcm2711.conf
index a5a0bff7f..8a4eb060d 100644
--- a/config/sources/families/bcm2711.conf
+++ b/config/sources/families/bcm2711.conf
@@ -12,7 +12,7 @@ export GOVERNOR=ondemand
case "${BRANCH}" in
- legacy | ddk)
+ ddk)
export RASPI_DISTRO_KERNEL=yes # This will cause board to include distro's prebuilt kernel, not from source
;;
diff --git a/config/sources/families/include/meson64_common.inc b/config/sources/families/include/meson64_common.inc
index ea4363e81..e3fc577e9 100644
--- a/config/sources/families/include/meson64_common.inc
+++ b/config/sources/families/include/meson64_common.inc
@@ -270,7 +270,7 @@ family_tweaks_bsp() {
EndSection
EOF
;;
- "odroidn2" | "odroidc4" | "khadas-vim2" | "odroidhc4" | "khadas-vim3" | "khadas-vim3l" | "radxa-zero")
+ "odroidn2" | "odroidc4" | "khadas-vim2" | "odroidhc4" | "khadas-vim3" | "khadas-vim3l" | "radxa-zero" | "radxa-zero2")
cat <<- EOF > "$destination"/etc/X11/xorg.conf
Section "Device"
Identifier "DRM Graphics Acclerated"
diff --git a/config/sources/families/include/rockchip64_common.inc b/config/sources/families/include/rockchip64_common.inc
index 815e87b26..eb5ab78b2 100644
--- a/config/sources/families/include/rockchip64_common.inc
+++ b/config/sources/families/include/rockchip64_common.inc
@@ -90,8 +90,8 @@ case $BRANCH in
current)
- export KERNEL_MAJOR_MINOR="5.10" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.10.y"
+ export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
+ KERNELBRANCH="branch:linux-5.15.y"
KERNELPATCHDIR='rockchip64-'$BRANCH
LINUXFAMILY=rockchip64
LINUXCONFIG='linux-rockchip64-'$BRANCH
@@ -100,8 +100,8 @@ case $BRANCH in
edge)
KERNELPATCHDIR='rockchip64-'$BRANCH
- export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
- KERNELBRANCH="branch:linux-5.15.y"
+ export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
+ KERNELBRANCH="branch:linux-5.16.y"
LINUXFAMILY=rockchip64
LINUXCONFIG='linux-rockchip64-'$BRANCH
@@ -234,7 +234,7 @@ family_tweaks() {
chroot $SDCARD /bin/bash -c "systemctl --no-reload enable z28pro-bluetooth.service >/dev/null 2>&1"
- elif [[ $BOARD == nanopi-r2s || $BOARD == nanopi-r2c || $BOARD == orangepi-r1plus ]]; then
+ elif [[ $BOARD == nanopi-r2s || $BOARD == nanopi-r2c || $BOARD == orangepi-r1plus || $BOARD == orangepi-r1plus-lts ]]; then
# rename USB based network to lan0
mkdir -p $SDCARD/etc/udev/rules.d/
diff --git a/config/sources/families/include/uefi_common.inc b/config/sources/families/include/uefi_common.inc
index b362bcba0..175fcae2f 100644
--- a/config/sources/families/include/uefi_common.inc
+++ b/config/sources/families/include/uefi_common.inc
@@ -5,7 +5,7 @@ export UEFI_GRUB_TIMEOUT=${UEFI_GRUB_TIMEOUT:-3} # Default 3-seconds timeout for
export BOARD_FIRMWARE_INSTALL="-full" # Install full firmware for UEFI boards
case "${BRANCH}" in
- legacy | ddk)
+ ddk)
# This will force `unset KERNELSOURCE` later; no kernel will be built.
# Instead, the distro's default linux-generic kernel will be installed.
export DISTRO_GENERIC_KERNEL=yes
diff --git a/config/sources/families/jetson-nano.conf b/config/sources/families/jetson-nano.conf
index 77b83e479..9001baf0b 100644
--- a/config/sources/families/jetson-nano.conf
+++ b/config/sources/families/jetson-nano.conf
@@ -31,7 +31,7 @@ case $BRANCH in
;;
edge)
- SKIP_BOOTSPLASH="yes"
+ #SKIP_BOOTSPLASH="yes"
export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
KERNELBRANCH="branch:linux-5.16.y"
KERNELPATCHDIR='media-'$BRANCH
@@ -42,10 +42,6 @@ case $BRANCH in
esac
-write_uboot_platform() {
- dd if=$1/u-boot.bin of=$2 bs=32k seek=1 status=noxfer > /dev/null 2>&1
-}
-
family_tweaks() {
install -m 755 $SRC/packages/blobs/jetson/jetson.sh $SDCARD/etc/initramfs-tools/hooks/jetson.sh
diff --git a/config/sources/families/media.conf b/config/sources/families/media.conf
index 07529a634..cf1a5603b 100644
--- a/config/sources/families/media.conf
+++ b/config/sources/families/media.conf
@@ -39,7 +39,7 @@ case $BRANCH in
;;
edge)
- SKIP_BOOTSPLASH="yes"
+ #SKIP_BOOTSPLASH="yes"
export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
KERNELBRANCH="branch:linux-5.16.y"
KERNELPATCHDIR='media-'$BRANCH
From b4c137bdb097e7cbba7bfc22795fa1223ea2bc7d Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 2 Mar 2022 12:57:31 +0100
Subject: [PATCH] armbian-next: sync 'packages' dir from master revision
ed589b248aef675cb5e845fcb55c12dfbcc5e925
---
packages/armbian/builddeb | 217 +++++++-----
packages/armbian/mkdebian | 268 +++++++--------
.../armbian-activate-profile-sync-daemon.sh | 8 +-
.../profile.d/armbian-check-first-login-reboot.sh | 8 +-
.../bsp/common/etc/profile.d/armbian-ssh-title.sh | 12 +-
packages/bsp/jethub/jethub-remove-log-file.sh | 12 +-
packages/bsp/nanopim4/nanopim4-pwm-fan.sh | 380 ++++++++++-----------
packages/bsp/odroid/c1_init.sh | 123 ++-----
packages/bsp/odroid/c2_init.sh | 255 +++++++-------
packages/bsp/rk3328/z28pro/start_bt.sh | 1 +
packages/bsp/rockchip/start_bt.sh | 17 +-
packages/bsp/sunxi/zeroplus2-bt.sh | 5 +-
.../hostapd-realtek/debian/ifupdown/hostapd.sh | 22 +-
.../hostapd/debian/ifupdown/hostapd.sh | 22 +-
14 files changed, 680 insertions(+), 670 deletions(-)
diff --git a/packages/armbian/builddeb b/packages/armbian/builddeb
index 631380a0c..0163d401a 100755
--- a/packages/armbian/builddeb
+++ b/packages/armbian/builddeb
@@ -1,4 +1,4 @@
-#!/usr/bin/bash
+#!/bin/sh
#
# builddeb 1.3
# Copyright 2003 Wichert Akkerman <wichert@wiggy.net>
@@ -45,13 +45,11 @@ create_package() {
local pname="$1" pdir="$2"
local dpkg_deb_opts
- echo "Armbian kernel packaging: ${pname} ${pdir}"
-
mkdir -m 755 -p "$pdir/DEBIAN"
mkdir -p "$pdir/usr/share/doc/$pname"
- cp -pv debian/copyright "$pdir/usr/share/doc/$pname/"
- cp -pv debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian"
- gzip --force -9 "$pdir/usr/share/doc/$pname/changelog.Debian"
+ cp debian/copyright "$pdir/usr/share/doc/$pname/"
+ cp debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian"
+ gzip -9 "$pdir/usr/share/doc/$pname/changelog.Debian"
sh -c "cd '$pdir'; find . -type f ! -path './DEBIAN/*' -printf '%P\0' \
| xargs -r0 md5sum > DEBIAN/md5sums"
@@ -116,14 +114,13 @@ create_package() {
# Create the package
dpkg-gencontrol -p$pname -P"$pdir"
- echo "Building deb package with compression '$KDEB_COMPRESS'" 1>&2
dpkg-deb ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir" ..
}
deploy_kernel_headers() {
- pdir=$1 # kernel_headers_dir
+ pdir=$1
- echo "Armbian deploy_kernel_headers: ${pdir}"
+ rm -rf $pdir
destdir=$pdir/usr/src/linux-headers-$version
mkdir -p $destdir
@@ -131,14 +128,15 @@ deploy_kernel_headers() {
(
cd $srctree
find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl
- find arch/*/include include scripts -type f -o -type l # @TODO: could strip off some stuff?
+ find arch/*/include include scripts -type f -o -type l
find security/*/include -type f
find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform
find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f
- ) | grep -v "^\/debian" > debian/hdrsrcfiles
+ ) > debian/hdrsrcfiles
{
if is_enabled CONFIG_STACK_VALIDATION; then
+ # echo tools/objtool/objtool
find tools/objtool -type f -executable
fi
@@ -147,77 +145,147 @@ deploy_kernel_headers() {
if is_enabled CONFIG_GCC_PLUGINS; then
find scripts/gcc-plugins -name \*.so -o -name gcc-common.h
fi
- } | grep -v "^\/debian" > debian/hdrobjfiles
-
- echo "Headers copying over..."
- tar -c -f - -C $srctree -T debian/hdrsrcfiles | tar -xf - -C $destdir # Copy over using tar pipes, sources
- tar -c -f - -T debian/hdrobjfiles | tar -xf - -C $destdir # Copy over using tar pipes, object files
- rm -f debian/hdrsrcfiles debian/hdrobjfiles # remove file lists
+ } > debian/hdrobjfiles
- # After copying over, apply patch;
if is_native; then
echo "info: Build native: Skip headers-debian-byteshift.patch" >&2
elif is_build_on_amd64; then
(
cd $destdir
- # detect and remove files which patch will create
- lsdiff -s --strip=1 "/tmp/headers-debian-byteshift.patch" | grep '^+' | awk '{print $2}' | xargs -I % sh -c 'rm -f %'
- patch --batch -p1 < "/tmp/headers-debian-byteshift.patch"
+ patch -p1 < /tmp/headers-debian-byteshift.patch
)
fi
+ tar -c -f - -C $srctree -T debian/hdrsrcfiles | tar -xf - -C $destdir
+ tar -c -f - -T debian/hdrobjfiles | tar -xf - -C $destdir
+ rm -f debian/hdrsrcfiles debian/hdrobjfiles
+
# copy .config manually to be where it's expected to be
- cp -pv $KCONFIG_CONFIG $destdir/.config
+ cp $KCONFIG_CONFIG $destdir/.config
mkdir -p $pdir/lib/modules/$version/
- rm -f $pdir/lib/modules/$version/build
ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build
}
deploy_libc_headers() {
pdir=$1
+
+ rm -rf $pdir
+
+ $MAKE -f $srctree/Makefile headers
+ $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH=$pdir/usr
+
# move asm headers to /usr/include/<libc-machine>/asm to match the structure
# used by Debian-based distros (to support multi-arch)
host_arch=$(dpkg-architecture -a$(cat debian/arch) -qDEB_HOST_MULTIARCH)
- mkdir -p $pdir/usr/include/$host_arch
- [ -d $pdir/usr/include/asm ] && cp -rv $pdir/usr/include/asm $pdir/usr/include/$host_arch/
- return 0
+ mkdir $pdir/usr/include/$host_arch
+ mv $pdir/usr/include/asm $pdir/usr/include/$host_arch/
}
-# set -x
-echo "Armbian builddeb starting: ${KERNELRELEASE}..."
-
-version=${KERNELRELEASE}
+version=$KERNELRELEASE
tmpdir="debian/tmp"
kernel_headers_dir="debian/hdrtmp"
-libc_headers_dir="debian/libc_header_tmp"
+libc_headers_dir="debian/headertmp"
dbg_dir="debian/dbgtmp"
dtb_dir="debian/dtbtmp"
-packagename=linux-image-"${BRANCH}${LOCALVERSION}"
-kernel_headers_packagename=linux-headers-"${BRANCH}${LOCALVERSION}"
-dtb_packagename=linux-dtb-"${BRANCH}${LOCALVERSION}"
+packagename=linux-image-"$BRANCH$LOCALVERSION"
+kernel_headers_packagename=linux-headers-"$BRANCH$LOCALVERSION"
+dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
libc_headers_packagename=linux-libc-dev
-dbg_packagename=${packagename}-dbg
-installed_image_path="boot/vmlinuz-$version" # for all arches
+dbg_packagename=$packagename-dbg
+
+if [ "$ARCH" = "um" ]; then
+ packagename=user-mode-linux-$version
+fi
+
+# Not all arches have the same installed path in debian
+# XXX: have each arch Makefile export a variable of the canonical image install
+# path instead
+case $ARCH in
+ ++aarch64|arm64)
+ image_name=Image
+ installed_image_path="boot/vmlinuz-$version"
+ ;;
+ arm*)
+ image_name=zImage
+ installed_image_path="boot/vmlinuz-$version"
+ ;;
+ um)
+ installed_image_path="usr/bin/linux-$version"
+ ;;
+ parisc|mips|powerpc)
+ installed_image_path="boot/vmlinux-$version"
+ ;;
+ *)
+ image_name=vmlinuz
+ installed_image_path="boot/vmlinuz-$version"
+ ;;
+esac
BUILD_DEBUG=$(if_enabled_echo CONFIG_DEBUG_INFO Yes)
-# Complement the directory structure
+# Setup the directory structure
+rm -rf "$tmpdir" "$dbg_dir" "$dtb_dir" debian/files
mkdir -m 755 -p "$tmpdir/DEBIAN"
mkdir -p "$tmpdir/lib" "$tmpdir/boot"
mkdir -m 755 -p "$dtb_dir/DEBIAN"
-mkdir -p "$dtb_dir/usr/share/doc/$dtb_packagename"
+mkdir -p "$dtb_dir/boot/dtb-$version" "$dtb_dir/usr/share/doc/$dtb_packagename"
mkdir -m 755 -p "$kernel_headers_dir/lib/modules/$version/"
mkdir -m 755 -p "$libc_headers_dir/DEBIAN"
-# Install the kernel's System.map and config
-cp -pv System.map "$tmpdir/boot/System.map-$version"
-cp -pv $KCONFIG_CONFIG "$tmpdir/boot/config-$version"
+# Install the kernel
+if [ "$ARCH" = "um" ]; then
+ mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" "$tmpdir/usr/share/doc/$packagename"
+ $MAKE linux
+ cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
+ cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config"
+ gzip "$tmpdir/usr/share/doc/$packagename/config"
+else
+ cp System.map "$tmpdir/boot/System.map-$version"
+ cp $KCONFIG_CONFIG "$tmpdir/boot/config-$version"
+fi
+cp "$($MAKE -s -f $srctree/Makefile image_name)" "$tmpdir/$installed_image_path"
+
+if is_enabled CONFIG_OF_EARLY_FLATTREE; then
+ # Only some architectures with OF support have this target
+ if [ -d "${srctree}/arch/$SRCARCH/boot/dts" ]; then
+ $MAKE -f $srctree/Makefile INSTALL_DTBS_PATH="$tmpdir/usr/lib/linux-image-$version" dtbs_install
+ fi
+fi
-# Get the image from the makefile and install it as vmlinuz
-image_name_from_makefile="$($MAKE -s -f "$srctree/Makefile" image_name)"
-cp -pv "${image_name_from_makefile}" "$tmpdir/$installed_image_path"
-image_name="$(basename "${image_name_from_makefile}")" # Just the file name
+if grep -q '^CONFIG_OF=y' $KCONFIG_CONFIG; then
+ #mkdir -p "$tmpdir/boot/dtb"
+ INSTALL_DTBS_PATH="$dtb_dir/boot/dtb-$version" $MAKE KBUILD_SRC= dtbs_install
+fi
+
+if is_enabled CONFIG_MODULES; then
+ INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_install
+ rm -f "$tmpdir/lib/modules/$version/build"
+ rm -f "$tmpdir/lib/modules/$version/source"
+
+ if [ "$ARCH" = "um" ]; then
+ mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/"
+ rmdir "$tmpdir/lib/modules/$version"
+ fi
+
+ if [ -n "$BUILD_DEBUG" ]; then
+ for module in $(find $tmpdir/lib/modules/ -name *.ko -printf '%P\n'); do
+ module=lib/modules/$module
+ mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module)
+ # only keep debug symbols in the debug file
+ $OBJCOPY --only-keep-debug $tmpdir/$module $dbg_dir/usr/lib/debug/$module
+ # strip original module from debug symbols
+ $OBJCOPY --strip-debug $tmpdir/$module
+ # then add a link to those
+ $OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $tmpdir/$module
+ done
+
+ # resign stripped modules
+ if is_enabled CONFIG_MODULE_SIG_ALL; then
+ INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_sign
+ fi
+ fi
+fi
# Install the maintainer scripts
# Note: hook scripts under /etc/kernel are also executed by official Debian
@@ -229,7 +297,7 @@ for script in postinst postrm preinst prerm; do
mkdir -p "$tmpdir$debhookdir/$script.d"
cat <<- EOF > "$tmpdir/DEBIAN/$script"
#!/bin/bash
- set -x
+
set -e
# Pass maintainer script parameters to hook scripts
@@ -262,12 +330,12 @@ cat >> $tmpdir/DEBIAN/preinst <<- EOT
# exit if we are running chroot
if [ "\$(stat -c %d:%i /)" != "\$(stat -c %d:%i /proc/1/root/.)" ]; then exit 0; fi
- check_and_unmount (){
+ check_boot_dev (){
boot_device=\$(mountpoint -d /boot)
for file in /dev/* ; do
CURRENT_DEVICE=\$(printf "%d:%d" \$(stat --printf="0x%t 0x%T" \$file))
- if [ "\$CURRENT_DEVICE" = "\$boot_device" ]; then
+ if [[ "\$CURRENT_DEVICE" = "\$boot_device" ]]; then
boot_partition=\$file
break
fi
@@ -275,43 +343,40 @@ cat >> $tmpdir/DEBIAN/preinst <<- EOT
bootfstype=\$(blkid -s TYPE -o value \$boot_partition)
if [ "\$bootfstype" = "vfat" ]; then
- umount /boot
rm -f /boot/System.map* /boot/config* /boot/vmlinuz* /boot/$image_name /boot/uImage
fi
}
- mountpoint -q /boot && check_and_unmount
+ mountpoint -q /boot && check_boot_dev
exit 0
EOT
create_package "$packagename" "$tmpdir"
-# Put the DTBs, installed by kernel make at "$dtb_dir/boot/dtbs_install", at "$dtb_dir/boot/dtb-$version"
-if [ -d "$dtb_dir/boot/dtbs_install" ]; then
- echo "Armbian: DTB " "$dtb_dir/boot/dtbs_install" "exists, moving to" "$dtb_dir/boot/dtb-$version"
- [ -d "$dtb_dir/boot/dtb-$version" ] && rm -rf "$dtb_dir/boot/dtb-$version"
- mv -v "$dtb_dir/boot/dtbs_install" "$dtb_dir/boot/dtb-$version"
- create_package "$dtb_packagename" "$dtb_dir" "dtb"
-fi
+if [ "$ARCH" != "um" ]; then
-deploy_libc_headers ${libc_headers_dir}
-create_package $libc_headers_packagename $libc_headers_dir
+ if [ "$(cat debian/arch)" != "amd64" ]; then # No DTB for amd64 target
+ create_package "$dtb_packagename" "$dtb_dir" "dtb"
+ fi
-if is_enabled CONFIG_MODULES; then
- if is_native; then
- # echo "Skip scripts folder cleaning" >&2
- # echo "Skip creating postinst prerm scripts for headers" >&2
- deploy_kernel_headers $kernel_headers_dir
- create_package $kernel_headers_packagename $kernel_headers_dir # no "headers" here, no postinst
- else
- # Clean up the executables that are left over from
- # cross-compilation for a different host architecture.
- #(
- # cd $srctree
- # make M=scripts clean
- #)
- echo "-- NOT CLEANING before packaging headers. " 1>&2
- deploy_kernel_headers $kernel_headers_dir
- create_package $kernel_headers_packagename $kernel_headers_dir "headers"
+ deploy_libc_headers $libc_headers_dir
+ create_package $libc_headers_packagename $libc_headers_dir
+
+ if is_enabled CONFIG_MODULES; then
+ if is_native; then
+ # echo "Skip scripts folder cleaning" >&2
+ # echo "Skip creating postinst prerm scripts for headers" >&2
+ deploy_kernel_headers $kernel_headers_dir
+ create_package $kernel_headers_packagename $kernel_headers_dir
+ else
+ # Clean up the executables that are left over from
+ # cross-compilation for a different host architecture.
+ (
+ cd $srctree
+ make M=scripts clean
+ )
+ deploy_kernel_headers $kernel_headers_dir
+ create_package $kernel_headers_packagename $kernel_headers_dir "headers"
+ fi
fi
fi
@@ -321,7 +386,7 @@ if [ -n "$BUILD_DEBUG" ]; then
# Different tools want the image in different locations
# perf
mkdir -p $dbg_dir/usr/lib/debug/lib/modules/$version/
- cp -pv vmlinux $dbg_dir/usr/lib/debug/lib/modules/$version/
+ cp vmlinux $dbg_dir/usr/lib/debug/lib/modules/$version/
# systemtap
mkdir -p $dbg_dir/usr/lib/debug/boot/
ln -s ../lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/boot/vmlinux-$version
diff --git a/packages/armbian/mkdebian b/packages/armbian/mkdebian
index 83a37b99d..003195372 100755
--- a/packages/armbian/mkdebian
+++ b/packages/armbian/mkdebian
@@ -1,4 +1,4 @@
-#!/usr/bin/bash
+#!/bin/sh
#
# Copyright 2003 Wichert Akkerman <wichert@wiggy.net>
#
@@ -19,64 +19,57 @@ if_enabled_echo() {
}
set_debarch() {
- if [ -n "$KBUILD_DEBARCH" ]; then
+ if [ -n "$KBUILD_DEBARCH" ] ; then
debarch="$KBUILD_DEBARCH"
return
fi
# Attempt to find the correct Debian architecture
case "$UTS_MACHINE" in
- i386 | ia64 | alpha | m68k | riscv*)
- debarch="$UTS_MACHINE"
- ;;
- x86_64)
- debarch=amd64
- ;;
- sparc*)
- debarch=sparc$(if_enabled_echo CONFIG_64BIT 64)
- ;;
- s390*)
- debarch=s390x
- ;;
- ppc*)
- if is_enabled CONFIG_64BIT; then
- debarch=ppc64$(if_enabled_echo CONFIG_CPU_LITTLE_ENDIAN el)
- else
- debarch=powerpc$(if_enabled_echo CONFIG_SPE spe)
- fi
- ;;
- parisc*)
- debarch=hppa
- ;;
- mips*)
- if is_enabled CONFIG_CPU_LITTLE_ENDIAN; then
- debarch=mips$(if_enabled_echo CONFIG_64BIT 64)$(if_enabled_echo CONFIG_CPU_MIPSR6 r6)el
- elif is_enabled CONFIG_CPU_MIPSR6; then
- debarch=mips$(if_enabled_echo CONFIG_64BIT 64)r6
- else
- debarch=mips
- fi
- ;;
- aarch64 | arm64)
- debarch=arm64
- ;;
- arm*)
- if is_enabled CONFIG_AEABI; then
- debarch=arm$(if_enabled_echo CONFIG_VFP hf el)
- else
- debarch=arm
- fi
- ;;
- openrisc)
- debarch=or1k
- ;;
- sh)
- if is_enabled CONFIG_CPU_SH3; then
- debarch=sh3$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
- elif is_enabled CONFIG_CPU_SH4; then
- debarch=sh4$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
- fi
- ;;
+ i386|ia64|alpha|m68k|riscv*)
+ debarch="$UTS_MACHINE" ;;
+ x86_64)
+ debarch=amd64 ;;
+ sparc*)
+ debarch=sparc$(if_enabled_echo CONFIG_64BIT 64) ;;
+ s390*)
+ debarch=s390x ;;
+ ppc*)
+ if is_enabled CONFIG_64BIT; then
+ debarch=ppc64$(if_enabled_echo CONFIG_CPU_LITTLE_ENDIAN el)
+ else
+ debarch=powerpc$(if_enabled_echo CONFIG_SPE spe)
+ fi
+ ;;
+ parisc*)
+ debarch=hppa ;;
+ mips*)
+ if is_enabled CONFIG_CPU_LITTLE_ENDIAN; then
+ debarch=mips$(if_enabled_echo CONFIG_64BIT 64)$(if_enabled_echo CONFIG_CPU_MIPSR6 r6)el
+ elif is_enabled CONFIG_CPU_MIPSR6; then
+ debarch=mips$(if_enabled_echo CONFIG_64BIT 64)r6
+ else
+ debarch=mips
+ fi
+ ;;
+ aarch64|arm64)
+ debarch=arm64 ;;
+ arm*)
+ if is_enabled CONFIG_AEABI; then
+ debarch=arm$(if_enabled_echo CONFIG_VFP hf el)
+ else
+ debarch=arm
+ fi
+ ;;
+ openrisc)
+ debarch=or1k ;;
+ sh)
+ if is_enabled CONFIG_CPU_SH3; then
+ debarch=sh3$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
+ elif is_enabled CONFIG_CPU_SH4; then
+ debarch=sh4$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
+ fi
+ ;;
esac
if [ -z "$debarch" ]; then
debarch=$(dpkg-architecture -qDEB_HOST_ARCH)
@@ -91,9 +84,6 @@ set_debarch() {
fi
}
-#set -x
-echo "Armbian mkdebian starting..."
-
# Some variables and settings used throughout the script
KDEB_SOURCENAME=linux-$KERNELRELEASE
version=$KERNELRELEASE
@@ -101,7 +91,7 @@ if [ -n "$KDEB_PKGVERSION" ]; then
packageversion=$KDEB_PKGVERSION
revision=${packageversion##*-}
else
- revision=$(cat .version 2> /dev/null || echo 1)
+ revision=$(cat .version 2>/dev/null||echo 1)
packageversion=$version-$revision
fi
sourcename=$KDEB_SOURCENAME
@@ -111,6 +101,10 @@ libc_headers_packagename=linux-libc-dev
dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
dbg_packagename=$packagename-dbg
+if [ "$ARCH" = "um" ] ; then
+ packagename=user-mode-linux-$version
+fi
+
debarch=
set_debarch
@@ -124,7 +118,7 @@ else
user=${KBUILD_BUILD_USER-$(id -nu)}
name=${DEBFULLNAME-$user}
if [ -z "$email" ]; then
- buildhost=${KBUILD_BUILD_HOST-$(hostname -f 2> /dev/null || hostname)}
+ buildhost=${KBUILD_BUILD_HOST-$(hostname -f 2>/dev/null || hostname)}
email="$user@$buildhost"
fi
maintainer="$name <$email>"
@@ -132,14 +126,14 @@ fi
# Try to determine distribution
if [ -n "$KDEB_CHANGELOG_DIST" ]; then
- distribution=$KDEB_CHANGELOG_DIST
+ distribution=$KDEB_CHANGELOG_DIST
# In some cases lsb_release returns the codename as n/a, which breaks dpkg-parsechangelog
-elif distribution=$(lsb_release -cs 2> /dev/null) && [ -n "$distribution" ] && [ "$distribution" != "n/a" ]; then
- : # nothing to do in this case
+elif distribution=$(lsb_release -cs 2>/dev/null) && [ -n "$distribution" ] && [ "$distribution" != "n/a" ]; then
+ : # nothing to do in this case
else
- distribution="unstable"
- echo >&2 "Using default distribution of 'unstable' in the changelog"
- echo >&2 "Install lsb-release or set \$KDEB_CHANGELOG_DIST explicitly"
+ distribution="unstable"
+ echo >&2 "Using default distribution of 'unstable' in the changelog"
+ echo >&2 "Install lsb-release or set \$KDEB_CHANGELOG_DIST explicitly"
fi
mkdir -p debian/source/
@@ -150,109 +144,111 @@ extra_build_depends=", $(if_enabled_echo CONFIG_UNWINDER_ORC libelf-dev:native)"
extra_build_depends="$extra_build_depends, $(if_enabled_echo CONFIG_SYSTEM_TRUSTED_KEYRING libssl-dev:native)"
# Generate a simple changelog template
-cat <<- EOF > debian/changelog
- $sourcename ($packageversion) $distribution; urgency=low
+cat <<EOF > debian/changelog
+$sourcename ($packageversion) $distribution; urgency=low
- * Armbian built Linux kernel. $BRANCH
+ * Armbian built Linux kernel. $BRANCH
- -- $maintainer $(date -R)
+ -- $maintainer $(date -R)
EOF
# Generate copyright file
-cat <<- EOF > debian/copyright
- This is a packacked armbian patches version of the Linux kernel.
+cat <<EOF > debian/copyright
+This is a packacked armbian patches version of the Linux kernel.
- The sources may be found at most Linux archive sites, including:
- https://www.kernel.org/pub/linux/kernel
+The sources may be found at most Linux archive sites, including:
+https://www.kernel.org/pub/linux/kernel
- Copyright: 1991 - 2018 Linus Torvalds and others.
+Copyright: 1991 - 2018 Linus Torvalds and others.
- The git repository for mainline kernel development is at:
- git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
+The git repository for mainline kernel development is at:
+git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 dated June, 1991.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 dated June, 1991.
- On Debian GNU/Linux systems, the complete text of the GNU General Public
- License version 2 can be found in \`/usr/share/common-licenses/GPL-2'.
+On Debian GNU/Linux systems, the complete text of the GNU General Public
+License version 2 can be found in \`/usr/share/common-licenses/GPL-2'.
EOF
# Generate a control file
-cat <<- EOF > debian/control
- Source: $sourcename
- Section: kernel
- Priority: optional
- Maintainer: $maintainer
- Build-Depends: bc, rsync, kmod, cpio, bison, flex | flex:native $extra_build_depends
- Homepage: https://www.kernel.org/
-
- Package: $packagename
- Architecture: $debarch
- Provides: linux-image, linux-image-armbian, armbian-$BRANCH
- Description: Linux kernel, armbian version $version $BRANCH
- This package contains the Linux kernel, modules and corresponding other
- files, version: $version.
-
- Package: $libc_headers_packagename
- Section: devel
- Provides: linux-kernel-headers
- Conflicts: linux-kernel-headers
- Replaces: linux-kernel-headers
- Architecture: $debarch
- Description: Armbian Linux support headers for userspace development
- This package provides userspaces headers from the Linux kernel. These headers
- are used by the installed headers for GNU glibc and other system libraries.
- Multi-Arch: same
-
- Package: $dtb_packagename
- Architecture: $debarch
- Provides: linux-dtb, linux-dtb-armbian, armbian-$BRANCH
- Description: Armbian Linux DTB, version $version $BRANCH
- This package contains device blobs from the Linux kernel, version $version
+cat <<EOF > debian/control
+Source: $sourcename
+Section: kernel
+Priority: optional
+Maintainer: $maintainer
+Build-Depends: bc, rsync, kmod, cpio, bison, flex | flex:native $extra_build_depends
+Homepage: https://www.kernel.org/
+
+Package: $packagename
+Architecture: $debarch
+Provides: linux-image, linux-image-armbian, armbian-$BRANCH
+Description: Linux kernel, armbian version $version $BRANCH
+ This package contains the Linux kernel, modules and corresponding other
+ files, version: $version.
+
+Package: $libc_headers_packagename
+Section: devel
+Provides: linux-kernel-headers
+Conflicts: linux-kernel-headers
+Replaces: linux-kernel-headers
+Architecture: $debarch
+Description: Armbian Linux support headers for userspace development
+ This package provides userspaces headers from the Linux kernel. These headers
+ are used by the installed headers for GNU glibc and other system libraries.
+Multi-Arch: same
+
+Package: $dtb_packagename
+Architecture: $debarch
+Provides: linux-dtb, linux-dtb-armbian, armbian-$BRANCH
+Description: Armbian Linux DTB, version $version $BRANCH
+ This package contains device blobs from the Linux kernel, version $version
EOF
if is_enabled CONFIG_MODULES; then
- cat <<- EOF >> debian/control
-
- Package: $kernel_headers_packagename
- Section: devel
- Architecture: $debarch
- Provides: linux-headers, linux-headers-armbian, armbian-$BRANCH
- Depends: make, gcc, libc6-dev, bison, flex, libssl-dev
- Description: Linux kernel headers for $version on $debarch $BRANCH
- This package provides kernel header files for $version on $debarch
- .
- This is useful for people who need to build external modules
- EOF
+cat <<EOF >> debian/control
+
+Package: $kernel_headers_packagename
+Section: devel
+Architecture: $debarch
+Provides: linux-headers, linux-headers-armbian, armbian-$BRANCH
+Depends: make, gcc, libc6-dev, bison, flex, libssl-dev
+Description: Linux kernel headers for $version on $debarch $BRANCH
+ This package provides kernel header files for $version on $debarch
+ .
+ This is useful for people who need to build external modules
+EOF
fi
if is_enabled CONFIG_DEBUG_INFO; then
- cat <<- EOF >> debian/control
-
- Package: $dbg_packagename
- Section: debug
- Architecture: $debarch
- Description: Linux kernel debugging symbols for $version
- This package will come in handy if you need to debug the kernel. It provides
- all the necessary debug symbols for the kernel and its modules.
- EOF
+cat <<EOF >> debian/control
+
+Package: $dbg_packagename
+Section: debug
+Architecture: $debarch
+Description: Linux kernel debugging symbols for $version
+ This package will come in handy if you need to debug the kernel. It provides
+ all the necessary debug symbols for the kernel and its modules.
+EOF
fi
-cat << EOF > debian/rules
+cat <<EOF > debian/rules
#!$(command -v $MAKE) -f
srctree ?= .
build:
- echo "Kernel should be built, headers and modules installed before calling this."
+ \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
+ KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile
binary-arch:
- echo "Armbian: Calling builddep via make intdeb-pkg"
- \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile intdeb-pkg
+ \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
+ KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile intdeb-pkg
clean:
rm -rf debian/*tmp debian/files
+ \$(MAKE) clean
binary: binary-arch
EOF
diff --git a/packages/bsp/common/etc/profile.d/armbian-activate-profile-sync-daemon.sh b/packages/bsp/common/etc/profile.d/armbian-activate-profile-sync-daemon.sh
index 3cfd5c451..9f0b86523 100644
--- a/packages/bsp/common/etc/profile.d/armbian-activate-profile-sync-daemon.sh
+++ b/packages/bsp/common/etc/profile.d/armbian-activate-profile-sync-daemon.sh
@@ -10,13 +10,13 @@
if [ -f "${HOME}/.activate_psd" ]; then
rm -f ${HOME}/.activate_psd
- /usr/bin/psd > /dev/null 2>&1
+ /usr/bin/psd >/dev/null 2>&1
config_file="${HOME}/.config/psd/psd.conf"
if [ -f "${config_file}" ]; then
# test for overlayfs
# TODO: don't enable on btrfs
sed -i 's/#USE_OVERLAYFS=.*/USE_OVERLAYFS="yes"/' "${config_file}"
- case $(/usr/bin/psd p 2> /dev/null | grep Overlayfs) in
+ case $(/usr/bin/psd p 2>/dev/null | grep Overlayfs) in
*active*)
echo -e "\nConfigured profile sync daemon with overlayfs."
;;
@@ -26,6 +26,6 @@ if [ -f "${HOME}/.activate_psd" ]; then
;;
esac
fi
- systemctl --user enable psd.service > /dev/null 2>&1
- systemctl --user start psd.service > /dev/null 2>&1
+ systemctl --user enable psd.service >/dev/null 2>&1
+ systemctl --user start psd.service >/dev/null 2>&1
fi
diff --git a/packages/bsp/common/etc/profile.d/armbian-check-first-login-reboot.sh b/packages/bsp/common/etc/profile.d/armbian-check-first-login-reboot.sh
index 2e4d6e1ae..8d4ce0b3c 100644
--- a/packages/bsp/common/etc/profile.d/armbian-check-first-login-reboot.sh
+++ b/packages/bsp/common/etc/profile.d/armbian-check-first-login-reboot.sh
@@ -8,17 +8,17 @@
# only do this for interactive shells
if [ "$-" != "${-#*i}" ]; then
- OutstandingPackages="$(egrep -v "linux-base|linux-image" /var/run/reboot-required.pkgs 2> /dev/null)"
+ OutstandingPackages="$(egrep -v "linux-base|linux-image" /var/run/reboot-required.pkgs 2>/dev/null)"
if [ -f "/var/run/.reboot_required" ]; then
printf "\n[\e[0;91m Kernel was updated, please reboot\x1B[0m ]\n\n"
elif [ "X${OutstandingPackages}" != "X" ]; then
# No kernel update involved, just regular packages like e.g. dbus require a reboot
Packages="$(egrep -v "linux-base|linux-image" /var/run/reboot-required.pkgs | sort | uniq | tr '\n' ',' | sed -e 's/,/, /g' -e 's/,\ $//')"
OlderThanOneDay=$(find /var/run/reboot-required -mtime +1)
- if [ "X${OlderThanOneDay}" = "X" ]; then
+ if [ "X${OlderThanOneDay}" = "X" ]; then
printf "\n[\e[0;92m some packages require a reboot (${Packages})\x1B[0m ]\n\n"
- else
+ else
printf "\n[\e[0;91m some packages require a reboot since more than 1 day (${Packages})\x1B[0m ]\n\n"
- fi
+ fi
fi
fi
diff --git a/packages/bsp/common/etc/profile.d/armbian-ssh-title.sh b/packages/bsp/common/etc/profile.d/armbian-ssh-title.sh
index 9932ec62e..c3b1822cb 100644
--- a/packages/bsp/common/etc/profile.d/armbian-ssh-title.sh
+++ b/packages/bsp/common/etc/profile.d/armbian-ssh-title.sh
@@ -6,9 +6,9 @@
# License version 2. This program is licensed "as is" without any
# warranty of any kind, whether express or implied.
-if [ -n "$PS1" ] && ([ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]); then
- tput tsl > /dev/null
- if [ "$?" -eq 0 ]; then
- echo $(tput tsl) $(whoami)@$(hostname) $(tput fsl)
- fi
-fi
+if [ -n "$PS1" ] && ( [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] ); then
+ tput tsl > /dev/null
+ if [ "$?" -eq 0 ]; then
+ echo `tput tsl` `whoami`@`hostname` `tput fsl`
+ fi
+fi
\ No newline at end of file
diff --git a/packages/bsp/jethub/jethub-remove-log-file.sh b/packages/bsp/jethub/jethub-remove-log-file.sh
index 0384825c3..62086cd40 100755
--- a/packages/bsp/jethub/jethub-remove-log-file.sh
+++ b/packages/bsp/jethub/jethub-remove-log-file.sh
@@ -8,10 +8,10 @@ LOGS_ROTATE_DEBUG_FILE=/tmp/$(basename "$0").log
LOG_FILE=$1
if [ -f "$LOG_FILE" ]; then
- if [ -n "$LOGS_ROTATE_DEBUG" ]; then
- date > "$LOGS_ROTATE_DEBUG_FILE"
- rm -fv "$LOG_FILE" >> "$LOGS_ROTATE_DEBUG_FILE"
- else
- rm -f "$LOG_FILE"
- fi
+ if [ -n "$LOGS_ROTATE_DEBUG" ]; then
+ date > "$LOGS_ROTATE_DEBUG_FILE"
+ rm -fv "$LOG_FILE" >> "$LOGS_ROTATE_DEBUG_FILE"
+ else
+ rm -f "$LOG_FILE"
+ fi
fi
diff --git a/packages/bsp/nanopim4/nanopim4-pwm-fan.sh b/packages/bsp/nanopim4/nanopim4-pwm-fan.sh
index 33c913d25..6040a3109 100644
--- a/packages/bsp/nanopim4/nanopim4-pwm-fan.sh
+++ b/packages/bsp/nanopim4/nanopim4-pwm-fan.sh
@@ -10,7 +10,7 @@
# This is free. There is NO WARRANTY. Use at your own risk.
###############################################################################
-cache() {
+cache () {
if [[ -z "$1" ]]; then
echo '[pwm-fan] Cache file was not specified. Assuming generic.'
local FILENAME='generic'
@@ -30,7 +30,7 @@ cache() {
fi
}
-check_requisites() {
+check_requisites () {
local REQUISITES=('bc' 'cat' 'echo' 'mkdir' 'touch' 'trap' 'sleep')
echo '[pwm-fan] Checking requisites: '${REQUISITES[@]}
for cmd in ${REQUISITES[@]}; do
@@ -43,7 +43,7 @@ check_requisites() {
echo '[pwm-fan] All commands are accesible.'
}
-cleanup() {
+cleanup () {
echo '---- cleaning up ----'
# disable the channel
unexport_pwmchip_channel
@@ -54,7 +54,7 @@ cleanup() {
echo '--------------------'
}
-config() {
+config () {
pwmchip
export_pwmchip_channel
fan_startup
@@ -63,7 +63,7 @@ config() {
}
# takes message and status as argument
-end() {
+end () {
cleanup
echo '####################################################'
echo '# END OF THE PWM-FAN SCRIPT'
@@ -72,39 +72,39 @@ end() {
exit $2
}
-export_pwmchip_channel() {
+export_pwmchip_channel () {
if [[ ! -d "$CHANNEL_FOLDER" ]]; then
- local EXPORT=$PWMCHIP_FOLDER'export'
- cache 'export'
- local EXPORT_SET=$(echo 0 2> "$CACHE" > "$EXPORT")
- if [[ ! -z $(cat "$CACHE") ]]; then
- # on error, parse output
- if [[ $(cat "$CACHE") =~ (P|p)ermission\ denied ]]; then
- echo '[pwm-fan] This user does not have permission to use channel '$CHANNEL'.'
- if [[ ! -z $(command -v stat) ]]; then
- echo '[pwm-fan] Export is owned by user: '$(stat -c '%U' "$EXPORT")'.'
- echo '[pwm-fan] Export is owned by group: '$(stat -c '%G' "$EXPORT")'.'
- fi
- local ERR_MSG='User permission error while setting channel.'
- elif [[ $(cat "$CACHE") =~ (D|d)evice\ or\ resource\ busy ]]; then
- echo '[pwm-fan] It seems the pin is already in use. Cannot write to export.'
- local ERR_MSG=$PWMCHIP' was busy while setting channel.'
- else
- echo '[pwm-fan] There was an unknown error while setting the channel '$CHANNEL'.'
- if [[ $(cat "$CACHE") =~ \ ([^\:]+)$ ]]; then
- echo '[pwm-fan] Error: '${BASH_REMATCH[1]}'.'
- fi
- local ERR_MSG='Unknown error while setting channel.'
- fi
- end "$ERR_MSG" 1
- fi
- sleep 1
+ local EXPORT=$PWMCHIP_FOLDER'export'
+ cache 'export'
+ local EXPORT_SET=$(echo 0 2> "$CACHE" > "$EXPORT")
+ if [[ ! -z $(cat "$CACHE") ]]; then
+ # on error, parse output
+ if [[ $(cat "$CACHE") =~ (P|p)ermission\ denied ]]; then
+ echo '[pwm-fan] This user does not have permission to use channel '$CHANNEL'.'
+ if [[ ! -z $(command -v stat) ]]; then
+ echo '[pwm-fan] Export is owned by user: '$(stat -c '%U' "$EXPORT")'.'
+ echo '[pwm-fan] Export is owned by group: '$(stat -c '%G' "$EXPORT")'.'
+ fi
+ local ERR_MSG='User permission error while setting channel.'
+ elif [[ $(cat "$CACHE") =~ (D|d)evice\ or\ resource\ busy ]]; then
+ echo '[pwm-fan] It seems the pin is already in use. Cannot write to export.'
+ local ERR_MSG=$PWMCHIP' was busy while setting channel.'
+ else
+ echo '[pwm-fan] There was an unknown error while setting the channel '$CHANNEL'.'
+ if [[ $(cat "$CACHE") =~ \ ([^\:]+)$ ]]; then
+ echo '[pwm-fan] Error: '${BASH_REMATCH[1]}'.'
+ fi
+ local ERR_MSG='Unknown error while setting channel.'
+ fi
+ end "$ERR_MSG" 1
+ fi
+ sleep 1
elif [[ -d "$CHANNEL_FOLDER" ]]; then
echo '[pwm-fan] '$CHANNEL' channel is already accessible.'
fi
}
-fan_initialization() {
+fan_initialization () {
if [[ -z "$TIME_STARTUP" ]]; then
TIME_STARTUP=10
fi
@@ -113,7 +113,7 @@ fan_initialization() {
echo $READ_MAX_DUTY_CYCLE 2> $CACHE > $CHANNEL_FOLDER'duty_cycle'
# on error, try setting duty_cycle to a lower value
if [[ ! -z $(cat $CACHE) ]]; then
- local READ_MAX_DUTY_CYCLE=$(($(cat $CHANNEL_FOLDER'period') - 100))
+ local READ_MAX_DUTY_CYCLE=$(($(cat $CHANNEL_FOLDER'period')-100))
> $CACHE
echo $READ_MAX_DUTY_CYCLE 2> $CACHE > $CHANNEL_FOLDER'duty_cycle'
if [[ ! -z $(cat $CACHE) ]]; then
@@ -124,12 +124,12 @@ fan_initialization() {
echo '[pwm-fan] Running fan at full speed for the next '$TIME_STARTUP' seconds...'
echo 1 > $CHANNEL_FOLDER'enable'
sleep $TIME_STARTUP
- echo $((MAX_DUTY_CYCLE / 2)) > $CHANNEL_FOLDER'duty_cycle'
- echo '[pwm-fan] Initialization done. Duty cycle at 50% now: '$((MAX_DUTY_CYCLE / 2))' ns.'
+ echo $((MAX_DUTY_CYCLE/2)) > $CHANNEL_FOLDER'duty_cycle'
+ echo '[pwm-fan] Initialization done. Duty cycle at 50% now: '$((MAX_DUTY_CYCLE/2))' ns.'
sleep 1
}
-fan_run() {
+fan_run () {
if [[ $THERMAL_STATUS -eq 0 ]]; then
fan_run_max
else
@@ -137,7 +137,7 @@ fan_run() {
fi
}
-fan_run_max() {
+fan_run_max () {
echo '[pwm-fan] Running fan at full speed until stopped (Ctrl+C or kill '$$')...'
while true; do
echo $MAX_DUTY_CYCLE > $CHANNEL_FOLDER'duty_cycle'
@@ -146,7 +146,7 @@ fan_run_max() {
done
}
-fan_run_thermal() {
+fan_run_thermal () {
echo '[pwm-fan] Running fan in temp monitor mode until stopped (Ctrl+C or kill '$$')...'
if [[ -z $THERMAL_ABS_THRESH_LOW ]]; then
THERMAL_ABS_THRESH_LOW=25
@@ -161,7 +161,7 @@ fan_run_thermal() {
if [[ -z $DC_PERCENT_MAX ]]; then
DC_PERCENT_MAX=100
fi
- DC_ABS_THRESH=($(((DC_PERCENT_MIN * MAX_DUTY_CYCLE) / 100)) $(((DC_PERCENT_MAX * MAX_DUTY_CYCLE) / 100)))
+ DC_ABS_THRESH=($(((DC_PERCENT_MIN*MAX_DUTY_CYCLE)/100)) $(((DC_PERCENT_MAX*MAX_DUTY_CYCLE)/100)))
if [[ -z $TEMPS_SIZE ]]; then
TEMPS_SIZE=6
fi
@@ -183,9 +183,9 @@ fan_run_thermal() {
for TEMP in ${TEMPS[@]}; do
let TEMPS_SUM+=$TEMP
done
- # moving mid-point
- MEAN_TEMP=$((TEMPS_SUM / ${#TEMPS[@]}))
- DEV_MEAN_CRITICAL=$((MEAN_TEMP - 100))
+ # moving mid-point
+ MEAN_TEMP=$((TEMPS_SUM/${#TEMPS[@]}))
+ DEV_MEAN_CRITICAL=$((MEAN_TEMP-100))
X0=${DEV_MEAN_CRITICAL#-}
# args: x, x0, L, a, b (k=a/b)
MODEL=$(function_logistic ${TEMPS[-1]} $X0 ${DC_ABS_THRESH[-1]} 1 10)
@@ -201,7 +201,7 @@ fan_run_thermal() {
done
}
-fan_startup() {
+fan_startup () {
if [[ -z $PERIOD ]]; then
PERIOD=25000000
fi
@@ -222,25 +222,25 @@ fan_startup() {
done
}
-function_logistic() {
- # https://en.wikipedia.org/wiki/Logistic_function
- local x=$1
- local x0=$2
- local L=$3
- # k=a/b
- local a=$4
- local b=$5
- local equation="output=$L/(1+e(-($a/$b)*($x-$x0)));scale=0;output/1"
- local result=$(echo $equation | bc -lq)
- echo $result
+function_logistic () {
+ # https://en.wikipedia.org/wiki/Logistic_function
+ local x=$1
+ local x0=$2
+ local L=$3
+ # k=a/b
+ local a=$4
+ local b=$5
+ local equation="output=$L/(1+e(-($a/$b)*($x-$x0)));scale=0;output/1"
+ local result=$(echo $equation | bc -lq)
+ echo $result
}
-interrupt() {
+interrupt () {
echo '!! ATTENTION !!'
end 'Received a signal to stop the script.' 0
}
-pwmchip() {
+pwmchip () {
if [[ -z $PWMCHIP ]]; then
PWMCHIP='pwmchip1'
fi
@@ -257,7 +257,7 @@ pwmchip() {
CHANNEL_FOLDER="$PWMCHIP_FOLDER""$CHANNEL"'/'
}
-set_default() {
+set_default () {
cache 'set_default_duty_cycle'
echo 0 2> $CACHE > $CHANNEL_FOLDER'duty_cycle'
if [[ ! -z $(cat $CACHE) ]]; then
@@ -273,13 +273,13 @@ set_default() {
local decrement=100
local rate=$decrement
until [[ $PERIOD_NEW -le 200 ]]; do
- local PERIOD_NEW=$((PERIOD - rate))
+ local PERIOD_NEW=$((PERIOD-rate))
> $CACHE
echo $PERIOD_NEW 2> $CACHE > $CHANNEL_FOLDER'period'
if [[ -z $(cat $CACHE) ]]; then
break
fi
- local rate=$((rate + decrement))
+ local rate=$((rate+decrement))
done
PERIOD=$PERIOD_NEW
if [[ $PERIOD -le 100 ]]; then
@@ -292,7 +292,7 @@ set_default() {
echo '[pwm-fan] Default duty cycle: '$(cat $CHANNEL_FOLDER'duty_cycle')' ns'
}
-start() {
+start () {
echo '####################################################'
echo '# STARTING PWM-FAN SCRIPT'
echo '# Date and time: '$(date)
@@ -300,15 +300,15 @@ start() {
check_requisites
}
-thermal_meter() {
+thermal_meter () {
if [[ -f $TEMP_FILE ]]; then
local TEMP=$(cat $TEMP_FILE 2> /dev/null)
# TEMP is in millidegrees, so convert to degrees
- echo $((TEMP / 1000))
+ echo $((TEMP/1000))
fi
}
-thermal_monit() {
+thermal_monit () {
if [[ -z $MONIT_DEVICE ]]; then
# soc for legacy Kernel or cpu for latest Kernel
MONIT_DEVICE='(soc|cpu)'
@@ -333,7 +333,7 @@ thermal_monit() {
THERMAL_STATUS=0
}
-unexport_pwmchip_channel() {
+unexport_pwmchip_channel () {
if [[ -d "$CHANNEL_FOLDER" ]]; then
echo '[pwm-fan] Freeing up the channel '$CHANNEL' controlled by the '$PWMCHIP'.'
echo 0 > $CHANNEL_FOLDER'enable'
@@ -351,135 +351,135 @@ unexport_pwmchip_channel() {
}
usage() {
- echo ''
- echo 'Usage:'
- echo ''
- echo "$0" '[OPTIONS]'
- echo ''
- echo ' Options:'
- echo ' -c str Name of the PWM CHANNEL (e.g., pwm0, pwm1). Default: pwm0'
- echo ' -C str Name of the PWM CONTROLLER (e.g., pwmchip0, pwmchip1). Default: pwmchip1'
- echo ' -d int Lowest DUTY CYCLE threshold (in percentage of the period). Default: 25'
- echo ' -D int Highest DUTY CYCLE threshold (in percentage of the period). Default: 100'
- echo ' -f Fan runs at FULL SPEED all the time. If omitted (default), speed depends on temperature.'
- echo ' -F int TIME (in seconds) to run the fan at full speed during STARTUP. Default: 60'
- echo ' -h Show this HELP message.'
- echo ' -l int TIME (in seconds) to LOOP thermal reads. Lower means higher resolution but uses ever more resources. Default: 10'
- echo ' -m str Name of the DEVICE to MONITOR the temperature in the thermal sysfs interface. Default: (soc|cpu)'
- echo ' -p int The fan PERIOD (in nanoseconds). Default (25kHz): 25000000.'
- echo ' -s int The MAX SIZE of the TEMPERATURE ARRAY. Interval between data points is set by -l. Default (store last 1min data): 6.'
- echo ' -t int Lowest TEMPERATURE threshold (in Celsius). Lower temps set the fan speed to min. Default: 25'
- echo ' -T int Highest TEMPERATURE threshold (in Celsius). Higher temps set the fan speed to max. Default: 75'
- echo ''
- echo ' If no options are provided, the script will run with default values.'
- echo ' Defaults have been tested and optimized for the following hardware:'
- echo ' - NanoPi-M4 v2'
- echo ' - M4 SATA hat'
- echo ' - Fan 12V (.08A and .2A)'
- echo ' And software:'
- echo ' - Kernel: Linux 4.4.231-rk3399'
- echo ' - OS: Armbian Buster (20.08.9) stable'
- echo ' - GNU bash v5.0.3'
- echo ' - bc v1.07.1'
- echo ''
- echo 'Author: cgomesu'
- echo 'Repo: https://github.com/cgomesu/nanopim4-satahat-fan'
- echo ''
- echo 'This is free. There is NO WARRANTY. Use at your own risk.'
- echo ''
+ echo ''
+ echo 'Usage:'
+ echo ''
+ echo "$0" '[OPTIONS]'
+ echo ''
+ echo ' Options:'
+ echo ' -c str Name of the PWM CHANNEL (e.g., pwm0, pwm1). Default: pwm0'
+ echo ' -C str Name of the PWM CONTROLLER (e.g., pwmchip0, pwmchip1). Default: pwmchip1'
+ echo ' -d int Lowest DUTY CYCLE threshold (in percentage of the period). Default: 25'
+ echo ' -D int Highest DUTY CYCLE threshold (in percentage of the period). Default: 100'
+ echo ' -f Fan runs at FULL SPEED all the time. If omitted (default), speed depends on temperature.'
+ echo ' -F int TIME (in seconds) to run the fan at full speed during STARTUP. Default: 60'
+ echo ' -h Show this HELP message.'
+ echo ' -l int TIME (in seconds) to LOOP thermal reads. Lower means higher resolution but uses ever more resources. Default: 10'
+ echo ' -m str Name of the DEVICE to MONITOR the temperature in the thermal sysfs interface. Default: (soc|cpu)'
+ echo ' -p int The fan PERIOD (in nanoseconds). Default (25kHz): 25000000.'
+ echo ' -s int The MAX SIZE of the TEMPERATURE ARRAY. Interval between data points is set by -l. Default (store last 1min data): 6.'
+ echo ' -t int Lowest TEMPERATURE threshold (in Celsius). Lower temps set the fan speed to min. Default: 25'
+ echo ' -T int Highest TEMPERATURE threshold (in Celsius). Higher temps set the fan speed to max. Default: 75'
+ echo ''
+ echo ' If no options are provided, the script will run with default values.'
+ echo ' Defaults have been tested and optimized for the following hardware:'
+ echo ' - NanoPi-M4 v2'
+ echo ' - M4 SATA hat'
+ echo ' - Fan 12V (.08A and .2A)'
+ echo ' And software:'
+ echo ' - Kernel: Linux 4.4.231-rk3399'
+ echo ' - OS: Armbian Buster (20.08.9) stable'
+ echo ' - GNU bash v5.0.3'
+ echo ' - bc v1.07.1'
+ echo ''
+ echo 'Author: cgomesu'
+ echo 'Repo: https://github.com/cgomesu/nanopim4-satahat-fan'
+ echo ''
+ echo 'This is free. There is NO WARRANTY. Use at your own risk.'
+ echo ''
}
while getopts 'c:C:d:D:fF:hl:m:p:s:t:T:' OPT; do
- case ${OPT} in
- c)
- CHANNEL="$OPTARG"
- if [[ ! $CHANNEL =~ ^pwm[0-9]+$ ]]; then
- echo 'The name of the pwm channel must contain pwm and at least a number (pwm0).'
- exit 1
- fi
- ;;
- C)
- PWMCHIP="$OPTARG"
- if [[ ! $PWMCHIP =~ ^pwmchip[0-9]+$ ]]; then
- echo 'The name of the pwm controller must contain pwmchip and at least a number (pwmchip1).'
- exit 1
- fi
- ;;
- d)
- DC_PERCENT_MIN="$OPTARG"
- if [[ ! $DC_PERCENT_MIN =~ ^([0-6][0-9]?|70)$ ]]; then
- echo 'The lowest duty cycle threshold must be an integer between 0 and 70.'
- exit 1
- fi
- ;;
- D)
- DC_PERCENT_MAX="$OPTARG"
- if [[ ! $DC_PERCENT_MAX =~ ^([8-9][0-9]?|100)$ ]]; then
- echo 'The highest duty cycle threshold must be an integer between 80 and 100.'
- exit 1
- fi
- ;;
- f)
- SKIP_THERMAL=1
- ;;
- F)
- TIME_STARTUP="$OPTARG"
- if [[ ! $TIME_STARTUP =~ ^[0-9]+$ ]]; then
- echo 'The time to run the fan at full speed during startup must be an integer.'
- exit 1
- fi
- ;;
- h)
- usage
- exit 0
- ;;
- l)
- TIME_LOOP="$OPTARG"
- if [[ ! $TIME_LOOP =~ ^[0-9]+$ ]]; then
- echo 'The time to loop thermal reads must be an integer.'
- exit 1
- fi
- ;;
- m)
- MONIT_DEVICE="$OPTARG"
- ;;
- p)
- PERIOD="$OPTARG"
- if [[ ! $PERIOD =~ ^[0-9]+$ ]]; then
- echo 'The period must be an integer.'
- exit 1
- fi
- ;;
- s)
- TEMPS_SIZE="$OPTARG"
- if [[ ! $TEMPS_SIZE =~ ^[0-9]+$ ]]; then
- echo 'The max size of the temperature array must be an integer.'
- exit 1
- fi
- ;;
- t)
- THERMAL_ABS_THRESH_LOW="$OPTARG"
- if [[ ! $THERMAL_ABS_THRESH_LOW =~ ^[0-4][0-9]?$ ]]; then
- echo 'The lowest temperature threshold must be an integer between 0 and 49.'
- exit 1
- fi
- ;;
- T)
- THERMAL_ABS_THRESH_HIGH="$OPTARG"
- if [[ ! $THERMAL_ABS_THRESH_HIGH =~ ^([5-9][0-9]?|1[0-1][0-9]?|120)$ ]]; then
- echo 'The highest temperature threshold must be an integer between 50 and 120.'
- exit 1
- fi
- ;;
- \?)
- echo '!! ATTENTION !!'
- echo '................................'
- echo 'Detected an invalid option.'
- echo 'Try: '"$0"' -h'
- echo '................................'
- exit 1
- ;;
- esac
+ case ${OPT} in
+ c)
+ CHANNEL="$OPTARG"
+ if [[ ! $CHANNEL =~ ^pwm[0-9]+$ ]]; then
+ echo 'The name of the pwm channel must contain pwm and at least a number (pwm0).'
+ exit 1
+ fi
+ ;;
+ C)
+ PWMCHIP="$OPTARG"
+ if [[ ! $PWMCHIP =~ ^pwmchip[0-9]+$ ]]; then
+ echo 'The name of the pwm controller must contain pwmchip and at least a number (pwmchip1).'
+ exit 1
+ fi
+ ;;
+ d)
+ DC_PERCENT_MIN="$OPTARG"
+ if [[ ! $DC_PERCENT_MIN =~ ^([0-6][0-9]?|70)$ ]]; then
+ echo 'The lowest duty cycle threshold must be an integer between 0 and 70.'
+ exit 1
+ fi
+ ;;
+ D)
+ DC_PERCENT_MAX="$OPTARG"
+ if [[ ! $DC_PERCENT_MAX =~ ^([8-9][0-9]?|100)$ ]]; then
+ echo 'The highest duty cycle threshold must be an integer between 80 and 100.'
+ exit 1
+ fi
+ ;;
+ f)
+ SKIP_THERMAL=1
+ ;;
+ F)
+ TIME_STARTUP="$OPTARG"
+ if [[ ! $TIME_STARTUP =~ ^[0-9]+$ ]]; then
+ echo 'The time to run the fan at full speed during startup must be an integer.'
+ exit 1
+ fi
+ ;;
+ h)
+ usage
+ exit 0
+ ;;
+ l)
+ TIME_LOOP="$OPTARG"
+ if [[ ! $TIME_LOOP =~ ^[0-9]+$ ]]; then
+ echo 'The time to loop thermal reads must be an integer.'
+ exit 1
+ fi
+ ;;
+ m)
+ MONIT_DEVICE="$OPTARG"
+ ;;
+ p)
+ PERIOD="$OPTARG"
+ if [[ ! $PERIOD =~ ^[0-9]+$ ]]; then
+ echo 'The period must be an integer.'
+ exit 1
+ fi
+ ;;
+ s)
+ TEMPS_SIZE="$OPTARG"
+ if [[ ! $TEMPS_SIZE =~ ^[0-9]+$ ]]; then
+ echo 'The max size of the temperature array must be an integer.'
+ exit 1
+ fi
+ ;;
+ t)
+ THERMAL_ABS_THRESH_LOW="$OPTARG"
+ if [[ ! $THERMAL_ABS_THRESH_LOW =~ ^[0-4][0-9]?$ ]]; then
+ echo 'The lowest temperature threshold must be an integer between 0 and 49.'
+ exit 1
+ fi
+ ;;
+ T)
+ THERMAL_ABS_THRESH_HIGH="$OPTARG"
+ if [[ ! $THERMAL_ABS_THRESH_HIGH =~ ^([5-9][0-9]?|1[0-1][0-9]?|120)$ ]]; then
+ echo 'The highest temperature threshold must be an integer between 50 and 120.'
+ exit 1
+ fi
+ ;;
+ \?)
+ echo '!! ATTENTION !!'
+ echo '................................'
+ echo 'Detected an invalid option.'
+ echo 'Try: '"$0"' -h'
+ echo '................................'
+ exit 1
+ ;;
+ esac
done
start
diff --git a/packages/bsp/odroid/c1_init.sh b/packages/bsp/odroid/c1_init.sh
index 2b7b7e6f7..0192d68bb 100644
--- a/packages/bsp/odroid/c1_init.sh
+++ b/packages/bsp/odroid/c1_init.sh
@@ -11,9 +11,9 @@ HPD_STATE=/sys/class/amhdmitx/amhdmitx0/hpd_state
DISP_CAP=/sys/class/amhdmitx/amhdmitx0/disp_cap
DISP_MODE=/sys/class/display/mode
-hdmi=$(cat $HPD_STATE)
+hdmi=`cat $HPD_STATE`
if [ $hdmi -eq 1 ]; then
- echo $mode > $DISP_MODE
+ echo $mode > $DISP_MODE
fi
outputmode=$mode
@@ -26,20 +26,20 @@ common_display_setup() {
echo 1 > /sys/class/graphics/fb0/freescale_mode
case $outputmode in
- 800x480*) M="0 0 799 479" ;;
- vga*) M="0 0 639 749" ;;
- 800x600p60*) M="0 0 799 599" ;;
- 1024x600p60h*) M="0 0 1023 599" ;;
- 1024x768p60h*) M="0 0 1023 767" ;;
- sxga*) M="0 0 1279 1023" ;;
- 1440x900p60*) M="0 0 1439 899" ;;
- 480*) M="0 0 719 479" ;;
- 576*) M="0 0 719 575" ;;
- 720*) M="0 0 1279 719" ;;
- 800*) M="0 0 1279 799" ;;
- 1080*) M="0 0 1919 1079" ;;
- 1920x1200*) M="0 0 1919 1199" ;;
- 1680x1050p60*) M="0 0 1679 1049" ;;
+ 800x480*) M="0 0 799 479" ;;
+ vga*) M="0 0 639 749" ;;
+ 800x600p60*) M="0 0 799 599" ;;
+ 1024x600p60h*) M="0 0 1023 599" ;;
+ 1024x768p60h*) M="0 0 1023 767" ;;
+ sxga*) M="0 0 1279 1023" ;;
+ 1440x900p60*) M="0 0 1439 899" ;;
+ 480*) M="0 0 719 479" ;;
+ 576*) M="0 0 719 575" ;;
+ 720*) M="0 0 1279 719" ;;
+ 800*) M="0 0 1279 799" ;;
+ 1080*) M="0 0 1919 1079" ;;
+ 1920x1200*) M="0 0 1919 1199" ;;
+ 1680x1050p60*) M="0 0 1679 1049" ;;
1360x768p60*) M="0 0 1359 767" ;;
1366x768p60*) M="0 0 1365 767" ;;
1600x900p60*) M="0 0 1599 899" ;;
@@ -52,81 +52,32 @@ common_display_setup() {
}
case $mode in
- 800x480*)
- fbset -fb /dev/fb0 -g 800 480 800 960 $bpp
- common_display_setup
- ;;
- vga*)
- fbset -fb /dev/fb0 -g 640 480 640 960 $bpp
- common_display_setup
- ;;
- 480*)
- fbset -fb /dev/fb0 -g 720 480 720 960 $bpp
- common_display_setup
- ;;
- 800x600p60*)
- fbset -fb /dev/fb0 -g 800 600 800 1200 $bpp
- common_display_setup
- ;;
- 576*)
- fbset -fb /dev/fb0 -g 720 576 720 1152 $bpp
- common_display_setup
- ;;
- 1024x600p60h*)
- fbset -fb /dev/fb0 -g 1024 600 1024 1200 $bpp
- common_display_setup
- ;;
- 1024x768p60h*)
- fbset -fb /dev/fb0 -g 1024 768 1024 1536 $bpp
- common_display_setup
- ;;
- 720*)
- fbset -fb /dev/fb0 -g 1280 720 1280 1440 $bpp
- common_display_setup
- ;;
- 800*)
- fbset -fb /dev/fb0 -g 1280 800 1280 1600 $bpp
- common_display_setup
- ;;
- sxga*)
- fbset -fb /dev/fb0 -g 1280 1024 1280 2048 $bpp
- common_display_setup
- ;;
- 1440x900p60*)
- fbset -fb /dev/fb0 -g 1440 900 1440 1800 $bpp
- common_display_setup
- ;;
- 1080*)
- fbset -fb /dev/fb0 -g 1920 1080 1920 2160 $bpp
- common_display_setup
- ;;
- 1920x1200*)
- fbset -fb /dev/fb0 -g 1920 1200 1920 2400 $bpp
- common_display_setup
- ;;
- 1360x768p60*)
- fbset -fb /dev/fb0 -g 1360 768 1360 1536 $bpp
- common_display_setup
- ;;
- 1366x768p60*)
- fbset -fb /dev/fb0 -g 1366 768 1366 1536 $bpp
- common_display_setup
- ;;
- 1600x900p60*)
- fbset -fb /dev/fb0 -g 1600 900 1600 1800 $bpp
- common_display_setup
- ;;
- 1680x1050p60*)
- fbset -fb /dev/fb0 -g 1680 1050 1680 2100 $bpp
- common_display_setup
- ;;
-
+ 800x480*) fbset -fb /dev/fb0 -g 800 480 800 960 $bpp; common_display_setup ;;
+ vga*) fbset -fb /dev/fb0 -g 640 480 640 960 $bpp; common_display_setup ;;
+ 480*) fbset -fb /dev/fb0 -g 720 480 720 960 $bpp; common_display_setup ;;
+ 800x600p60*) fbset -fb /dev/fb0 -g 800 600 800 1200 $bpp; common_display_setup ;;
+ 576*) fbset -fb /dev/fb0 -g 720 576 720 1152 $bpp; common_display_setup ;;
+ 1024x600p60h*) fbset -fb /dev/fb0 -g 1024 600 1024 1200 $bpp; common_display_setup ;;
+ 1024x768p60h*) fbset -fb /dev/fb0 -g 1024 768 1024 1536 $bpp; common_display_setup ;;
+ 720*) fbset -fb /dev/fb0 -g 1280 720 1280 1440 $bpp; common_display_setup ;;
+ 800*) fbset -fb /dev/fb0 -g 1280 800 1280 1600 $bpp; common_display_setup ;;
+ sxga*) fbset -fb /dev/fb0 -g 1280 1024 1280 2048 $bpp; common_display_setup ;;
+ 1440x900p60*) fbset -fb /dev/fb0 -g 1440 900 1440 1800 $bpp; common_display_setup ;;
+ 1080*) fbset -fb /dev/fb0 -g 1920 1080 1920 2160 $bpp; common_display_setup ;;
+ 1920x1200*) fbset -fb /dev/fb0 -g 1920 1200 1920 2400 $bpp; common_display_setup ;;
+ 1360x768p60*) fbset -fb /dev/fb0 -g 1360 768 1360 1536 $bpp; common_display_setup ;;
+ 1366x768p60*) fbset -fb /dev/fb0 -g 1366 768 1366 1536 $bpp; common_display_setup ;;
+ 1600x900p60*) fbset -fb /dev/fb0 -g 1600 900 1600 1800 $bpp; common_display_setup ;;
+ 1680x1050p60*) fbset -fb /dev/fb0 -g 1680 1050 1680 2100 $bpp; common_display_setup ;;
+
esac
+
# Console unblack
echo 0 > /sys/class/graphics/fb0/blank
echo 0 > /sys/class/graphics/fb1/blank
+
# Network Tweaks. Thanks to mlinuxguy
echo 32768 > /proc/sys/net/core/rps_sock_flow_entries
echo 2048 > /sys/class/net/eth0/queues/rx-0/rps_flow_cnt
@@ -137,7 +88,7 @@ echo 7 > /sys/class/net/eth0/queues/tx-0/xps_cpus
echo 1,2 > /proc/irq/40/smp_affinity_list
# Workaround for a cron issue
-DT=$(date +%Y)
+DT=`date +%Y`
if [ "$DT" -lt "1980" ]; then
date -s "1/1/1980"
fi
diff --git a/packages/bsp/odroid/c2_init.sh b/packages/bsp/odroid/c2_init.sh
index 2cf93a21d..3465c042b 100644
--- a/packages/bsp/odroid/c2_init.sh
+++ b/packages/bsp/odroid/c2_init.sh
@@ -4,11 +4,11 @@
[ -f /boot/.next ] && exit
for x in $(cat /proc/cmdline); do
- case ${x} in
- m_bpp=*) export bpp=${x#*=} ;;
- hdmimode=*) export mode=${x#*=} ;;
- modeline=*) export modeline=${x#*=} ;;
- esac
+ case ${x} in
+ m_bpp=*) export bpp=${x#*=} ;;
+ hdmimode=*) export mode=${x#*=} ;;
+ modeline=*) export modeline=${x#*=} ;;
+ esac
done
HPD_STATE=/sys/class/amhdmitx/amhdmitx0/hpd_state
@@ -23,128 +23,127 @@ fi
echo $mode > $DISP_MODE
common_display_setup() {
- M="0 0 $(($X - 1)) $(($Y - 1))"
- Y_VIRT=$(($Y * 2))
- fbset -fb /dev/fb0 -g $X $Y $X $Y_VIRT $bpp
- fbset -fb /dev/fb1 -g 32 32 32 32 32
- echo $mode > /sys/class/display/mode
- echo 0 > /sys/class/graphics/fb0/free_scale
- echo 1 > /sys/class/graphics/fb0/freescale_mode
- echo $M > /sys/class/graphics/fb0/free_scale_axis
- echo $M > /sys/class/graphics/fb0/window_axis
- echo 0 > /sys/class/graphics/fb1/free_scale
- echo 1 > /sys/class/graphics/fb1/freescale_mode
+ M="0 0 $(($X - 1)) $(($Y - 1))"
+ Y_VIRT=$(($Y * 2))
+ fbset -fb /dev/fb0 -g $X $Y $X $Y_VIRT $bpp
+ fbset -fb /dev/fb1 -g 32 32 32 32 32
+ echo $mode > /sys/class/display/mode
+ echo 0 > /sys/class/graphics/fb0/free_scale
+ echo 1 > /sys/class/graphics/fb0/freescale_mode
+ echo $M > /sys/class/graphics/fb0/free_scale_axis
+ echo $M > /sys/class/graphics/fb0/window_axis
+ echo 0 > /sys/class/graphics/fb1/free_scale
+ echo 1 > /sys/class/graphics/fb1/freescale_mode
}
case $mode in
- custombuilt*)
- export X=$(echo $modeline | cut -f1 -d",")
- export Y=$(echo $modeline | cut -f2 -d",")
- ;;
- 480x320*)
- export X=480
- export Y=320
- ;;
- 480x800*)
- export X=480
- export Y=800
- ;;
- 480i* | 480p*)
- export X=720
- export Y=480
- ;;
- 576*)
- export X=720
- export Y=576
- ;;
- 720p*)
- export X=1280
- export Y=720
- ;;
- 1080*)
- export X=1920
- export Y=1080
- ;;
- 2160p*)
- export X=3840
- export Y=2160
- ;;
- smpte24hz*)
- export X=3840
- export Y=2160
- ;;
- 640x480p60hz*)
- export X=640
- export Y=480
- ;;
- 800x480p60hz*)
- export X=800
- export Y=480
- ;;
- 800x600p60hz*)
- export X=800
- export Y=600
- ;;
- 1024x600p60hz*)
- export X=1024
- export Y=600
- ;;
- 1024x768p60hz*)
- export X=1024
- export Y=768
- ;;
- 1280x800p60hz*)
- export X=1280
- export Y=800
- ;;
- 1280x1024p60hz*)
- export X=1280
- export Y=1024
- ;;
- 1360x768p60hz*)
- export X=1360
- export Y=768
- ;;
- 1366x768p60hz*)
- export X=1366
- export Y=768
- ;;
- 1440x900p60hz*)
- export X=1440
- export Y=900
- ;;
- 1600x900p60hz*)
- export X=1600
- export Y=900
- ;;
- 1680x1050p60hz*)
- export X=1680
- export Y=1050
- ;;
- 1600x1200p60hz*)
- export X=1600
- export Y=1200
- ;;
- 1920x1200p60hz*)
- export X=1920
- export Y=1200
- ;;
- 2560x1080p60hz*)
- export X=2560
- export Y=1080
- ;;
- 2560x1440p60hz*)
- export X=2560
- export Y=1440
- ;;
- 2560x1600p60hz*)
- export X=2560
- export Y=1600
- ;;
- 3440x1440p60hz*)
- export X=3440
- export Y=1440
- ;;
+ custombuilt*)
+ export X=`echo $modeline | cut -f1 -d","`
+ export Y=`echo $modeline | cut -f2 -d","`
+ ;;
+ 480x320*)
+ export X=480
+ export Y=320
+ ;;
+ 480x800*)
+ export X=480
+ export Y=800
+ ;;
+ 480i*|480p*)
+ export X=720
+ export Y=480
+ ;;
+ 576*)
+ export X=720
+ export Y=576
+ ;;
+ 720p*)
+ export X=1280
+ export Y=720
+ ;;
+ 1080*)
+ export X=1920
+ export Y=1080
+ ;;
+ 2160p*)
+ export X=3840
+ export Y=2160
+ ;;
+ smpte24hz*)
+ export X=3840
+ export Y=2160
+ ;;
+ 640x480p60hz*)
+ export X=640
+ export Y=480
+ ;;
+ 800x480p60hz*)
+ export X=800
+ export Y=480
+ ;;
+ 800x600p60hz*)
+ export X=800
+ export Y=600
+ ;;
+ 1024x600p60hz*)
+ export X=1024
+ export Y=600
+ ;;
+ 1024x768p60hz*)
+ export X=1024
+ export Y=768
+ ;;
+ 1280x800p60hz*)
+ export X=1280
+ export Y=800
+ ;;
+ 1280x1024p60hz*)
+ export X=1280
+ export Y=1024
+ ;;
+ 1360x768p60hz*)
+ export X=1360
+ export Y=768
+ ;;
+ 1366x768p60hz*)
+ export X=1366
+ export Y=768
+ ;;
+ 1440x900p60hz*)
+ export X=1440
+ export Y=900
+ ;;
+ 1600x900p60hz*)
+ export X=1600
+ export Y=900
+ ;;
+ 1680x1050p60hz*)
+ export X=1680
+ export Y=1050
+ ;;
+ 1600x1200p60hz*)
+ export X=1600
+ export Y=1200
+ ;;
+ 1920x1200p60hz*)
+ export X=1920
+ export Y=1200
+ ;;
+ 2560x1080p60hz*)
+ export X=2560
+ export Y=1080
+ ;;
+ 2560x1440p60hz*)
+ export X=2560
+ export Y=1440
+ ;;
+ 2560x1600p60hz*)
+ export X=2560
+ export Y=1600
+ ;;
+ 3440x1440p60hz*)
+ export X=3440
+ export Y=1440
esac
# force 16bpp for 4k
@@ -154,12 +153,12 @@ common_display_setup
# Console unblack
case $mode in
- *cvbs* | 480i* | 576i* | 1080i*)
+ *cvbs*|480i*|576i*|1080i*)
echo 0 > /sys/class/graphics/fb0/blank
echo 1 > /sys/class/graphics/fb1/blank
;;
- *)
+ *)
echo 0 > /sys/class/graphics/fb0/blank
- echo 0 > /sys/class/graphics/fb1/blank
+ echo 0 > /sys/class/graphics/fb1/blank
;;
-esac
+esac
\ No newline at end of file
diff --git a/packages/bsp/rk3328/z28pro/start_bt.sh b/packages/bsp/rk3328/z28pro/start_bt.sh
index 0fbb36499..31dbb369b 100644
--- a/packages/bsp/rk3328/z28pro/start_bt.sh
+++ b/packages/bsp/rk3328/z28pro/start_bt.sh
@@ -7,6 +7,7 @@ function die_on_error {
fi
}
+
# Kill any rtk_hciattach actually running.
# Do not complain if we didn't kill anything.
killall -q -SIGTERM 8822b_hciattach
diff --git a/packages/bsp/rockchip/start_bt.sh b/packages/bsp/rockchip/start_bt.sh
index 25e4a36a4..ca9335b90 100644
--- a/packages/bsp/rockchip/start_bt.sh
+++ b/packages/bsp/rockchip/start_bt.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-GPIO_CONFIGURED_CHECK_DIRECTORY="/var/run/rtk_bt"
+GPIO_CONFIGURED_CHECK_DIRECTORY="/var/run/rtk_bt"
GPIO_CONFIGURED_CHECK_FILE="/var/run/rtk_bt/gpio_configured"
function die_on_error {
@@ -14,8 +14,9 @@ function die_on_error {
# Do not complain if we didn't kill anything.
killall -q -SIGTERM rtk_hciattach
-# If the GPIO are not yet configured
-if [ ! -f "$GPIO_CONFIGURED_CHECK_FILE" ]; then
+# If the GPIO are not yet configured
+if [ ! -f "$GPIO_CONFIGURED_CHECK_FILE" ];
+then
# We'll create the directory first
# So that, if the user is not root
# he'll get a user permission error
@@ -40,11 +41,11 @@ fi
echo "Resetting the Bluetooth chip"
echo 0 > /sys/class/gpio/gpio149/value &&
- echo -e "\tBluetooth chip power down..." &&
- sleep 1 &&
- echo 1 > /sys/class/gpio/gpio149/value &&
- echo -e "\tBluetooth chip power up..." &&
- sleep 1
+echo -e "\tBluetooth chip power down..." &&
+sleep 1 &&
+echo 1 > /sys/class/gpio/gpio149/value &&
+echo -e "\tBluetooth chip power up..." &&
+sleep 1
echo -e "\tResetting done"
/usr/bin/rtk_hciattach -n -s 115200 /dev/ttyS0 rtk_h5 || die_on_error "Could not create hci0 through rtk_hciattach"
diff --git a/packages/bsp/sunxi/zeroplus2-bt.sh b/packages/bsp/sunxi/zeroplus2-bt.sh
index e99daa74f..87631908b 100755
--- a/packages/bsp/sunxi/zeroplus2-bt.sh
+++ b/packages/bsp/sunxi/zeroplus2-bt.sh
@@ -1,9 +1,6 @@
#!/bin/bash
-MAC=$(
- echo -n 1c:1b
- dd bs=1 count=4 if=/dev/random 2> /dev/null | hexdump -v -e '/1 ":%02X"'
-)
+MAC=$(echo -n 1c:1b; dd bs=1 count=4 if=/dev/random 2>/dev/null | hexdump -v -e '/1 ":%02X"')
rfkill unblock all
echo "0" > /sys/class/rfkill/rfkill0/state
diff --git a/packages/extras-buildpkgs/hostapd-realtek/debian/ifupdown/hostapd.sh b/packages/extras-buildpkgs/hostapd-realtek/debian/ifupdown/hostapd.sh
index ce578818a..c5d235776 100644
--- a/packages/extras-buildpkgs/hostapd-realtek/debian/ifupdown/hostapd.sh
+++ b/packages/extras-buildpkgs/hostapd-realtek/debian/ifupdown/hostapd.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2006-2009 Debian hostapd maintainers
+# Copyright (C) 2006-2009 Debian hostapd maintainers
# Faidon Liambotis <paravoid@debian.org>
# Kel Modderman <kel@otaku42.de>
#
@@ -43,7 +43,7 @@ else
TO_NULL="/dev/null"
fi
-hostapd_msg() {
+hostapd_msg () {
case "$1" in
verbose)
shift
@@ -53,12 +53,12 @@ hostapd_msg() {
shift
echo "$HOSTAPD_PNAME: $@" > /dev/stderr
;;
- *) ;;
-
+ *)
+ ;;
esac
}
-test_hostapd_pidfile() {
+test_hostapd_pidfile () {
if [ -n "$1" ] && [ -f "$2" ]; then
if start-stop-daemon --stop --quiet --signal 0 \
--exec "$1" --pidfile "$2"; then
@@ -72,10 +72,10 @@ test_hostapd_pidfile() {
fi
}
-init_hostapd() {
+init_hostapd () {
HOSTAPD_OPTIONS="-B -P $HOSTAPD_PIDFILE $HOSTAPD_CONF"
HOSTAPD_MESSAGE="$HOSTAPD_BIN $HOSTAPD_OPTIONS"
-
+
test_hostapd_pidfile "$HOSTAPD_BIN" "$HOSTAPD_PIDFILE" && return 0
hostapd_msg verbose "$HOSTAPD_MESSAGE"
@@ -102,19 +102,19 @@ init_hostapd() {
return 0
}
-kill_hostapd() {
+kill_hostapd () {
HOSTAPD_MESSAGE="stopping $HOSTAPD_PNAME via pidfile: $HOSTAPD_PIDFILE"
test_hostapd_pidfile "$HOSTAPD_BIN" "$HOSTAPD_PIDFILE" || return 0
-
+
hostapd_msg verbose "$HOSTAPD_MESSAGE"
start-stop-daemon --stop --oknodo --quiet --exec "$HOSTAPD_BIN" \
--pidfile "$HOSTAPD_PIDFILE" > "$TO_NULL"
-
+
[ "$HOSTAPD_OMIT_PIDFILE" ] && rm -f "$HOSTAPD_OMIT_PIDFILE"
}
-case "$MODE" in
+case "$MODE" in
start)
case "$PHASE" in
pre-up)
diff --git a/packages/extras-buildpkgs/hostapd/debian/ifupdown/hostapd.sh b/packages/extras-buildpkgs/hostapd/debian/ifupdown/hostapd.sh
index ce578818a..c5d235776 100644
--- a/packages/extras-buildpkgs/hostapd/debian/ifupdown/hostapd.sh
+++ b/packages/extras-buildpkgs/hostapd/debian/ifupdown/hostapd.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2006-2009 Debian hostapd maintainers
+# Copyright (C) 2006-2009 Debian hostapd maintainers
# Faidon Liambotis <paravoid@debian.org>
# Kel Modderman <kel@otaku42.de>
#
@@ -43,7 +43,7 @@ else
TO_NULL="/dev/null"
fi
-hostapd_msg() {
+hostapd_msg () {
case "$1" in
verbose)
shift
@@ -53,12 +53,12 @@ hostapd_msg() {
shift
echo "$HOSTAPD_PNAME: $@" > /dev/stderr
;;
- *) ;;
-
+ *)
+ ;;
esac
}
-test_hostapd_pidfile() {
+test_hostapd_pidfile () {
if [ -n "$1" ] && [ -f "$2" ]; then
if start-stop-daemon --stop --quiet --signal 0 \
--exec "$1" --pidfile "$2"; then
@@ -72,10 +72,10 @@ test_hostapd_pidfile() {
fi
}
-init_hostapd() {
+init_hostapd () {
HOSTAPD_OPTIONS="-B -P $HOSTAPD_PIDFILE $HOSTAPD_CONF"
HOSTAPD_MESSAGE="$HOSTAPD_BIN $HOSTAPD_OPTIONS"
-
+
test_hostapd_pidfile "$HOSTAPD_BIN" "$HOSTAPD_PIDFILE" && return 0
hostapd_msg verbose "$HOSTAPD_MESSAGE"
@@ -102,19 +102,19 @@ init_hostapd() {
return 0
}
-kill_hostapd() {
+kill_hostapd () {
HOSTAPD_MESSAGE="stopping $HOSTAPD_PNAME via pidfile: $HOSTAPD_PIDFILE"
test_hostapd_pidfile "$HOSTAPD_BIN" "$HOSTAPD_PIDFILE" || return 0
-
+
hostapd_msg verbose "$HOSTAPD_MESSAGE"
start-stop-daemon --stop --oknodo --quiet --exec "$HOSTAPD_BIN" \
--pidfile "$HOSTAPD_PIDFILE" > "$TO_NULL"
-
+
[ "$HOSTAPD_OMIT_PIDFILE" ] && rm -f "$HOSTAPD_OMIT_PIDFILE"
}
-case "$MODE" in
+case "$MODE" in
start)
case "$PHASE" in
pre-up)
From c216282d323014ca365a1539a305911ca835906b Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 2 Mar 2022 12:44:36 +0100
Subject: [PATCH] armbian-next: manual merge (11) of all lib/*.sh changes
between revisions 3305d45b8175dbdd647dc1dc53fa6f0a522920c7 and
ed589b248aef675cb5e845fcb55c12dfbcc5e925
---
lib/functions/compilation/patch/kernel-bootsplash.sh | 2 ++
lib/functions/compilation/patch/kernel-drivers.sh | 2 +-
lib/functions/configuration/main-config.sh | 14 +++-----------
lib/functions/main/config-prepare.sh | 2 +-
4 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/lib/functions/compilation/patch/kernel-bootsplash.sh b/lib/functions/compilation/patch/kernel-bootsplash.sh
index e5d279110..f4e078bfb 100644
--- a/lib/functions/compilation/patch/kernel-bootsplash.sh
+++ b/lib/functions/compilation/patch/kernel-bootsplash.sh
@@ -8,11 +8,13 @@ function apply_kernel_patches_for_bootsplash() {
display_alert "Adding" "Kernel bootsplash patch" "info"
+ process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0000-Revert-fbcon-Avoid-cap-set-but-not-used-warning.patch" "applying"
process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0001-Revert-fbcon-Add-option-to-enable-legacy-hardware-ac.patch" "applying"
if linux-version compare "${version}" ge 5.15; then
process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0002-Revert-vgacon-drop-unused-vga_init_done.patch" "applying"
fi
+
process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0003-Revert-vgacon-remove-software-scrollback-support.patch" "applying"
process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0004-Revert-drivers-video-fbcon-fix-NULL-dereference-in-f.patch" "applying"
process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0005-Revert-fbcon-remove-no-op-fbcon_set_origin.patch" "applying"
diff --git a/lib/functions/compilation/patch/kernel-drivers.sh b/lib/functions/compilation/patch/kernel-drivers.sh
index 61f1cb630..0f9d54bfe 100644
--- a/lib/functions/compilation/patch/kernel-drivers.sh
+++ b/lib/functions/compilation/patch/kernel-drivers.sh
@@ -31,7 +31,7 @@ function prepare_extra_kernel_drivers() {
#
# Older versions have AUFS support with a patch
- if linux-version compare "${version}" ge 5.1 && linux-version compare "${version}" le 5.12 && [ "$AUFS" == yes ]; then
+ if linux-version compare "${version}" ge 5.1 && linux-version compare "${version}" le 5.17 && [ "$AUFS" == yes ]; then
# @TODO: Fasthash for this whole block is only the git hash of revision we'd apply from Mr. Okajima
local aufs_tag # attach to specifics tag or branch
aufs_tag=$(echo "${version}" | cut -f 1-2 -d ".")
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index d96938dd0..5bf904f58 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -33,7 +33,7 @@ function do_main_configuration() {
[[ -z $EXIT_PATCHING_ERROR ]] && EXIT_PATCHING_ERROR="" # exit patching if failed
[[ -z $HOST ]] && HOST="$BOARD" # set hostname to the board
cd "${SRC}" || exit
- [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=14
+ [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=15
[[ -z "${CHROOT_CACHE_VERSION}" ]] && CHROOT_CACHE_VERSION=7
BUILD_REPOSITORY_URL=$(git remote get-url "$(git remote 2> /dev/null | grep origin)" 2> /dev/null)
BUILD_REPOSITORY_COMMIT=$(git describe --match=d_e_a_d_b_e_e_f --always --dirty 2> /dev/null)
@@ -51,16 +51,8 @@ function do_main_configuration() {
# image artefact destination with or without subfolder
FINALDEST=$DEST/images
- if [[ "${MAKE_FOLDERS}" == yes ]]; then
-
- if [[ "$RC" == yes ]]; then
- FINALDEST=$DEST/images/"${BOARD}"/rc
- elif [[ "$BETA" == yes ]]; then
- FINALDEST=$DEST/images/"${BOARD}"/nightly
- else
- FINALDEST=$DEST/images/"${BOARD}"/archive
- fi
-
+ if [[ -n "${MAKE_FOLDERS}" ]]; then
+ FINALDEST=$DEST/images/"${BOARD}"/"${MAKE_FOLDERS}"
install -d ${FINALDEST}
fi
diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh
index 7984e3c1b..013b903d4 100644
--- a/lib/functions/main/config-prepare.sh
+++ b/lib/functions/main/config-prepare.sh
@@ -117,7 +117,7 @@ function prepare_and_config_main_build_single() {
if [[ $BETA == yes ]]; then
IMAGE_TYPE=nightly
- elif [[ $BETA != "yes" && $BUILD_ALL == yes && -n $GPG_PASS ]]; then
+ elif [[ $BETA != "yes" && $BUILD_ALL == yes ]]; then
IMAGE_TYPE=stable
else
IMAGE_TYPE=user-built
From c2871d87a4237f167e274f9ec38442e6ff4e0934 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 2 Mar 2022 02:31:37 +0100
Subject: [PATCH] armbian-next: more refactorings, general logging; fixes;
split image stuff
- logging flowing correct to LOGDIR, still needs packaging
---
lib/extensions.sh | 14 ++-
lib/functions/compilation/kernel.sh | 9 +-
lib/functions/configuration/main-config.sh | 6 +-
lib/functions/general/chroot-helpers.sh | 23 ++---
lib/functions/image/compress-checksum.sh | 72 ++++++++++++++
lib/functions/{general => image}/fingerprint.sh | 0
lib/functions/image/partitioning.sh | 2 +-
lib/functions/image/rootfs-to-image.sh | 122 ++----------------------
lib/functions/image/write-device.sh | 41 ++++++++
lib/functions/logging/logging.sh | 11 ++-
lib/functions/logging/traps.sh | 6 ++
lib/functions/main/default-build.sh | 8 +-
lib/functions/main/rootfs-image.sh | 70 ++++++++------
lib/library-functions.sh | 36 +++++--
14 files changed, 237 insertions(+), 183 deletions(-)
diff --git a/lib/extensions.sh b/lib/extensions.sh
index 12a86fcfe..2bec020ce 100644
--- a/lib/extensions.sh
+++ b/lib/extensions.sh
@@ -336,15 +336,19 @@ enable_extension() {
local extension_dir extension_file extension_file_in_dir extension_floating_file
local stacktrace
- # capture the stack leading to this, possibly with a hint in front.
- stacktrace="${ENABLE_EXTENSION_TRACE_HINT}$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}")"
-
# if LOG_ENABLE_EXTENSION, output useful stack, so user can figure out which extensions are being added where
- [[ "${LOG_ENABLE_EXTENSION}" == "yes" ]] &&
- display_alert "Extension being added" "${extension_name} :: added by ${stacktrace}" ""
+ if [[ "${LOG_ENABLE_EXTENSION}" == "yes" ]]; then
+ if [[ "${SHOW_DEBUG}" == "yes" ]]; then
+ stacktrace="${ENABLE_EXTENSION_TRACE_HINT}$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}")"
+ display_alert "Enabling extension" "${extension_name} :: added by ${stacktrace}" "debug"
+ else
+ display_alert "Enabling extension" "${extension_name}" ""
+ fi
+ fi
# first a check, has the extension manager already initialized? then it is too late to enable_extension(). bail.
if [[ ${initialize_extension_manager_counter} -gt 0 ]]; then
+ stacktrace="${ENABLE_EXTENSION_TRACE_HINT}$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}")"
display_alert "Extension problem" "already initialized -- too late to add '${extension_name}' (trace: ${stacktrace})" "err"
exit 2
fi
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 68a748d46..e663e0265 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -68,7 +68,7 @@ function compile_kernel() {
function kernel_prepare_git() {
if [[ -n $KERNELSOURCE ]]; then
- [[ -d "${kernel_work_dir}" ]] && "${kernel_work_dir}" && fasthash_debug "pre git, existing tree"
+ [[ -d "${kernel_work_dir}" ]] && cd "${kernel_work_dir}" && fasthash_debug "pre git, existing tree"
display_alert "Downloading sources" "kernel" "git"
@@ -268,7 +268,8 @@ function kernel_package_source() {
local sources_pkg_dir tmp_src_dir tarball_size package_size
tmp_src_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
- sources_pkg_dir=${tmp_src_dir}/${CHOSEN_KSRC}_${REVISION}_all
+ sources_pkg_dir="${tmp_src_dir}/${CHOSEN_KSRC}_${REVISION}_all"
+
mkdir -p "${sources_pkg_dir}"/usr/src/ \
"${sources_pkg_dir}/usr/share/doc/linux-source-${version}-${LINUXFAMILY}" \
"${sources_pkg_dir}"/DEBIAN
@@ -287,7 +288,7 @@ function kernel_package_source() {
tarball_size="$(du -h -s "${output_tarball}" | awk '{print $1}')"
cat <<- EOF > "${sources_pkg_dir}"/DEBIAN/control
- Package: linux-source-${version}-${BRANCH}-${LINUXFAMILY}
+ Package: linux-source-${BRANCH}-${LINUXFAMILY}
Version: ${version}-${BRANCH}-${LINUXFAMILY}+${REVISION}
Architecture: all
Maintainer: ${MAINTAINER} <${MAINTAINERMAIL}>
@@ -302,7 +303,7 @@ function kernel_package_source() {
fakeroot_dpkg_deb_build -Znone -z0 "${sources_pkg_dir}" "${sources_pkg_dir}.deb" # do not compress .deb, it already contains a zstd compressed tarball! ignores ${KDEB_COMPRESS} on purpose
package_size="$(du -h -s "${sources_pkg_dir}.deb" | awk '{print $1}')"
run_host_command_logged rsync --remove-source-files -r "${sources_pkg_dir}.deb" "${DEB_STORAGE}/"
- display_alert "linux-source-${version}-${BRANCH}-${LINUXFAMILY} packaged" "$((SECONDS - ts)) seconds, ${tarball_size} tarball, ${package_size} .deb" "info"
+ display_alert "$(basename "${sources_pkg_dir}.deb" ".deb") packaged" "$((SECONDS - ts)) seconds, ${tarball_size} tarball, ${package_size} .deb" "info"
}
function kernel_make_headers_dtbs_image_modules() {
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 8fc63c032..d96938dd0 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -422,12 +422,10 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
to confirm or change any packages.
POST_AGGREGATE_PACKAGES
- # If not only capturing defs, write the output file. This an early write to disk, and @TODO: should be moved later into the configuration phase
- [[ "${CONFIG_DEFS_ONLY}" == "yes" ]] || write_config_summary_output_file
-
display_alert "Done with main-config.sh" "do_main_configuration" "debug"
}
+# This is called by main_default_build_single(), which is logged correctly. so just output to stdout here.
function write_config_summary_output_file() {
local debug_dpkg_arch debug_uname debug_virt debug_src_mount debug_src_perms debug_src_temp_perms
debug_dpkg_arch="$(dpkg --print-architecture)"
@@ -438,7 +436,7 @@ function write_config_summary_output_file() {
debug_src_temp_perms="$(getfacl -p "${SRC}"/.tmp 2> /dev/null)"
display_alert "Writing build config summary to" "debug log" "debug"
- run_host_command_logged cat "1>&2" <<- EOF
+ run_host_command_logged cat <<- EOF
## BUILD SCRIPT ENVIRONMENT
Repository: $REPOSITORY_URL
diff --git a/lib/functions/general/chroot-helpers.sh b/lib/functions/general/chroot-helpers.sh
index fcd092993..8c90cc578 100644
--- a/lib/functions/general/chroot-helpers.sh
+++ b/lib/functions/general/chroot-helpers.sh
@@ -28,30 +28,31 @@ umount_chroot() {
}
# demented recursive version, for final umount.
-umount_chroot_recursive() {
- set +e # really, ignore errors. we wanna unmount everything and will try very hard.
- local target="$1"
+function umount_chroot_recursive() {
+ local target="${1}/"
- if [[ ! -d "${target}" ]]; then # only even try if target is a directory
- return 0 # success, nothing to do.
+ if [[ ! -d "${target}" ]]; then # only even try if target is a directory
+ return 0 # success, nothing to do.
+ elif [[ "${target}" == "/" ]]; then # make sure we're not trying to umount root itself.
+ return 0
fi
- display_alert "Unmounting recursively" "$target" ""
+ display_alert "Unmounting recursively" "${target}" ""
sync # sync. coalesce I/O. wait for writes to flush to disk. it might take a second.
# First, try to umount some well-known dirs, in a certain order. for speed.
local -a well_known_list=("dev/pts" "dev" "proc" "sys" "boot/efi" "boot/firmware" "boot" "tmp" ".")
for well_known in "${well_known_list[@]}"; do
- umount --recursive "${target}${well_known}" &> /dev/null && sync
+ umount --recursive "${target}${well_known}" &> /dev/null || true # ignore errors
done
# now try in a loop to unmount all that's still mounted under the target
- local -i tries=1 # the first try above
- mapfile -t current_mount_list < <(cut -d " " -f 2 "/proc/mounts" | grep "^${target}")
+ local -i tries=1 # the first try above
+ mapfile -t current_mount_list < <(cut -d " " -f 2 "/proc/mounts" | grep "^${target}" || true) # don't let grep error out.
while [[ ${#current_mount_list[@]} -gt 0 ]]; do
if [[ $tries -gt 10 ]]; then
display_alert "${#current_mount_list[@]} dirs still mounted after ${tries} tries:" "${current_mount_list[*]}" "wrn"
fi
- cut -d " " -f 2 "/proc/mounts" | grep "^${target}" | xargs -n1 umount --recursive &> /dev/null
- sync # wait for fsync, then count again for next loop.
+ cut -d " " -f 2 "/proc/mounts" | grep "^${target}" | xargs -n1 umount --recursive &> /dev/null || true # ignore errors
+ sync # wait for fsync, then count again for next loop.
mapfile -t current_mount_list < <(cut -d " " -f 2 "/proc/mounts" | grep "^${target}")
tries=$((tries + 1))
done
diff --git a/lib/functions/image/compress-checksum.sh b/lib/functions/image/compress-checksum.sh
new file mode 100644
index 000000000..0a9e5898c
--- /dev/null
+++ b/lib/functions/image/compress-checksum.sh
@@ -0,0 +1,72 @@
+function image_compress_and_checksum() {
+ [[ -n $SEND_TO_SERVER ]] && return 0
+
+ if [[ $COMPRESS_OUTPUTIMAGE == "" || $COMPRESS_OUTPUTIMAGE == no ]]; then
+ COMPRESS_OUTPUTIMAGE="sha,gpg,img"
+ elif [[ $COMPRESS_OUTPUTIMAGE == yes ]]; then
+ COMPRESS_OUTPUTIMAGE="sha,gpg,7z"
+ fi
+
+ if [[ $COMPRESS_OUTPUTIMAGE == *gz* ]]; then
+ display_alert "Compressing" "${DESTIMG}/${version}.img.gz" "info"
+ pigz -3 < $DESTIMG/${version}.img > $DESTIMG/${version}.img.gz
+ compression_type=".gz"
+ fi
+
+ if [[ $COMPRESS_OUTPUTIMAGE == *xz* ]]; then
+ # @TODO: rpardini: I'd just move to zstd and be done with it. It does it right.
+
+ display_alert "Compressing" "${DESTIMG}/${version}.img.xz" "info"
+ # compressing consumes a lot of memory we don't have. Waiting for previous packing job to finish helps to run a lot more builds in parallel
+ available_cpu=$(grep -c 'processor' /proc/cpuinfo)
+ [[ ${available_cpu} -gt 16 ]] && available_cpu=16 # using more cpu cores for compressing is pointless
+ available_mem=$(LC_ALL=c free | grep Mem | awk '{print $4/$2 * 100.0}' | awk '{print int($1)}') # in percentage
+ # build optimisations when memory drops below 5%
+ if [[ ${BUILD_ALL} == yes && (${available_mem} -lt 15 || $(ps -uax | grep "pixz" | wc -l) -gt 4) ]]; then
+ while [[ $(ps -uax | grep "pixz" | wc -l) -gt 2 ]]; do
+ echo -en "#"
+ sleep 20
+ done
+ fi
+ pixz -7 -p ${available_cpu} -f $(expr ${available_cpu} + 2) < $DESTIMG/${version}.img > ${DESTIMG}/${version}.img.xz
+ compression_type=".xz"
+ fi
+
+ if [[ $COMPRESS_OUTPUTIMAGE == *img* || $COMPRESS_OUTPUTIMAGE == *7z* ]]; then
+ # mv $DESTIMG/${version}.img ${FINALDEST}/${version}.img || exit 1
+ compression_type=""
+ fi
+
+ if [[ $COMPRESS_OUTPUTIMAGE == *sha* ]]; then
+ cd ${DESTIMG}
+ display_alert "SHA256 calculating" "${version}.img${compression_type}" "info"
+ sha256sum -b ${version}.img${compression_type} > ${version}.img${compression_type}.sha
+ fi
+
+ if [[ $COMPRESS_OUTPUTIMAGE == *gpg* ]]; then
+ cd ${DESTIMG}
+ if [[ -n $GPG_PASS ]]; then
+ display_alert "GPG signing" "${version}.img${compression_type}" "info"
+ if [[ -n $SUDO_USER ]]; then
+ sudo chown -R ${SUDO_USER}:${SUDO_USER} "${DESTIMG}"/
+ SUDO_PREFIX="sudo -H -u ${SUDO_USER}"
+ else
+ SUDO_PREFIX=""
+ fi
+ echo "${GPG_PASS}" | $SUDO_PREFIX bash -c "gpg --passphrase-fd 0 --armor --detach-sign --pinentry-mode loopback --batch --yes ${DESTIMG}/${version}.img${compression_type}" || exit 1
+ else
+ display_alert "GPG signing skipped - no GPG_PASS" "${version}.img" "wrn"
+ fi
+ fi
+
+ fingerprint_image "${DESTIMG}/${version}.img${compression_type}.txt" "${version}"
+
+ if [[ $COMPRESS_OUTPUTIMAGE == *7z* ]]; then
+ display_alert "Compressing" "${DESTIMG}/${version}.7z" "info"
+ 7za a -t7z -bd -m0=lzma2 -mx=3 -mfb=64 -md=32m -ms=on \
+ ${DESTIMG}/${version}.7z ${version}.key ${version}.img* > /dev/null 2>&1
+ find ${DESTIMG}/ -type \
+ f \( -name "${version}.img" -o -name "${version}.img.asc" -o -name "${version}.img.txt" -o -name "${version}.img.sha" \) -print0 |
+ xargs -0 rm > /dev/null 2>&1
+ fi
+}
diff --git a/lib/functions/general/fingerprint.sh b/lib/functions/image/fingerprint.sh
similarity index 100%
rename from lib/functions/general/fingerprint.sh
rename to lib/functions/image/fingerprint.sh
diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh
index 2aa7c6f7b..ef4714757 100644
--- a/lib/functions/image/partitioning.sh
+++ b/lib/functions/image/partitioning.sh
@@ -227,7 +227,7 @@ prepare_partitions() {
export LOOP
LOOP=$(losetup -f) || exit_with_error "Unable to find free loop device"
- display_alert "Allocated loop device" "LOOP=${LOOP}" "wrn"
+ display_alert "Allocated loop device" "LOOP=${LOOP}"
check_loop_device "$LOOP"
diff --git a/lib/functions/image/rootfs-to-image.sh b/lib/functions/image/rootfs-to-image.sh
index 8c6e26081..d38a14ad1 100644
--- a/lib/functions/image/rootfs-to-image.sh
+++ b/lib/functions/image/rootfs-to-image.sh
@@ -84,101 +84,28 @@ PRE_UMOUNT_FINAL_IMAGE
[[ $ROOTFS_TYPE != nfs ]] && umount "${MOUNT}"
[[ $CRYPTROOT_ENABLE == yes ]] && cryptsetup luksClose $ROOT_MAPPER
+ umount_chroot_recursive "${MOUNT}" # @TODO: wait. NFS is not really unmounted above.
+
call_extension_method "post_umount_final_image" "config_post_umount_final_image" <<- 'POST_UMOUNT_FINAL_IMAGE'
*allow config to hack into the image after the unmount*
Called after unmounting both `/root` and `/boot`.
POST_UMOUNT_FINAL_IMAGE
- # @TODO: this is simply wrong and never does anything. we should use the recursive unmounter here
- while grep -Eq '(${MOUNT}|${DESTIMG})' /proc/mounts; do
- display_alert "Wait for unmount" "${MOUNT}" "info"
- sleep 5
- done
-
- display_alert "Freeing loop device" "${LOOP}" "wrn"
+ display_alert "Freeing loop device" "${LOOP}"
losetup -d "${LOOP}"
unset LOOP # unset so cleanup handler does not try it again
# Don't delete $DESTIMG here, extensions might have put nice things there already.
- rm -rf --one-file-system $MOUNT
+ rm -rf --one-file-system "${MOUNT}"
- mkdir -p $DESTIMG
- mv ${SDCARD}.raw $DESTIMG/${version}.img
+ mkdir -p "${DESTIMG}"
+ mv "${SDCARD}.raw" "${DESTIMG}/${version}.img"
# custom post_build_image_modify hook to run before fingerprinting and compression
[[ $(type -t post_build_image_modify) == function ]] && display_alert "Custom Hook Detected" "post_build_image_modify" "info" && post_build_image_modify "${DESTIMG}/${version}.img"
- if [[ -z $SEND_TO_SERVER ]]; then
-
- if [[ $COMPRESS_OUTPUTIMAGE == "" || $COMPRESS_OUTPUTIMAGE == no ]]; then
- COMPRESS_OUTPUTIMAGE="sha,gpg,img"
- elif [[ $COMPRESS_OUTPUTIMAGE == yes ]]; then
- COMPRESS_OUTPUTIMAGE="sha,gpg,7z"
- fi
-
- if [[ $COMPRESS_OUTPUTIMAGE == *gz* ]]; then
- display_alert "Compressing" "${DESTIMG}/${version}.img.gz" "info"
- pigz -3 < $DESTIMG/${version}.img > $DESTIMG/${version}.img.gz
- compression_type=".gz"
- fi
-
- if [[ $COMPRESS_OUTPUTIMAGE == *xz* ]]; then
- display_alert "Compressing" "${DESTIMG}/${version}.img.xz" "info"
- # compressing consumes a lot of memory we don't have. Waiting for previous packing job to finish helps to run a lot more builds in parallel
- available_cpu=$(grep -c 'processor' /proc/cpuinfo)
- #[[ ${BUILD_ALL} == yes ]] && available_cpu=$(( $available_cpu * 30 / 100 )) # lets use 20% of resources in case of build-all
- [[ ${available_cpu} -gt 16 ]] && available_cpu=16 # using more cpu cores for compressing is pointless
- available_mem=$(LC_ALL=c free | grep Mem | awk '{print $4/$2 * 100.0}' | awk '{print int($1)}') # in percentage
- # build optimisations when memory drops below 5%
- if [[ ${BUILD_ALL} == yes && (${available_mem} -lt 15 || $(ps -uax | grep "pixz" | wc -l) -gt 4) ]]; then
- while [[ $(ps -uax | grep "pixz" | wc -l) -gt 2 ]]; do
- echo -en "#"
- sleep 20
- done
- fi
- pixz -7 -p ${available_cpu} -f $(expr ${available_cpu} + 2) < $DESTIMG/${version}.img > ${DESTIMG}/${version}.img.xz
- compression_type=".xz"
- fi
-
- if [[ $COMPRESS_OUTPUTIMAGE == *img* || $COMPRESS_OUTPUTIMAGE == *7z* ]]; then
- # mv $DESTIMG/${version}.img ${FINALDEST}/${version}.img || exit 1
- compression_type=""
- fi
-
- if [[ $COMPRESS_OUTPUTIMAGE == *sha* ]]; then
- cd ${DESTIMG}
- display_alert "SHA256 calculating" "${version}.img${compression_type}" "info"
- sha256sum -b ${version}.img${compression_type} > ${version}.img${compression_type}.sha
- fi
-
- if [[ $COMPRESS_OUTPUTIMAGE == *gpg* ]]; then
- cd ${DESTIMG}
- if [[ -n $GPG_PASS ]]; then
- display_alert "GPG signing" "${version}.img${compression_type}" "info"
- if [[ -n $SUDO_USER ]]; then
- sudo chown -R ${SUDO_USER}:${SUDO_USER} "${DESTIMG}"/
- SUDO_PREFIX="sudo -H -u ${SUDO_USER}"
- else
- SUDO_PREFIX=""
- fi
- echo "${GPG_PASS}" | $SUDO_PREFIX bash -c "gpg --passphrase-fd 0 --armor --detach-sign --pinentry-mode loopback --batch --yes ${DESTIMG}/${version}.img${compression_type}" || exit 1
- else
- display_alert "GPG signing skipped - no GPG_PASS" "${version}.img" "wrn"
- fi
- fi
-
- fingerprint_image "${DESTIMG}/${version}.img${compression_type}.txt" "${version}"
-
- if [[ $COMPRESS_OUTPUTIMAGE == *7z* ]]; then
- display_alert "Compressing" "${DESTIMG}/${version}.7z" "info"
- 7za a -t7z -bd -m0=lzma2 -mx=3 -mfb=64 -md=32m -ms=on \
- ${DESTIMG}/${version}.7z ${version}.key ${version}.img* > /dev/null 2>&1
- find ${DESTIMG}/ -type \
- f \( -name "${version}.img" -o -name "${version}.img.asc" -o -name "${version}.img.txt" -o -name "${version}.img.sha" \) -print0 |
- xargs -0 rm > /dev/null 2>&1
- fi
+ image_compress_and_checksum
- fi
display_alert "Done building" "${FINALDEST}/${version}.img" "info" # A bit predicting the future, since it's still in DESTIMG at this point.
# Previously, post_build_image passed the .img path as an argument to the hook. Now its an ENV var.
@@ -197,39 +124,6 @@ PRE_UMOUNT_FINAL_IMAGE
rm -rf --one-file-system $DESTIMG
# write image to SD card
- if [[ $(lsblk "$CARD_DEVICE" 2> /dev/null) && -f ${FINALDEST}/${version}.img ]]; then
-
- # make sha256sum if it does not exists. we need it for comparisson
- if [[ -f "${FINALDEST}/${version}".img.sha ]]; then
- local ifsha=$(cat ${FINALDEST}/${version}.img.sha | awk '{print $1}')
- else
- local ifsha=$(sha256sum -b "${FINALDEST}/${version}".img | awk '{print $1}')
- fi
-
- display_alert "Writing image" "$CARD_DEVICE ${readsha}" "info"
-
- # write to SD card
- pv -p -b -r -c -N "$(logging_echo_prefix_for_pv "write_device") dd" ${FINALDEST}/${version}.img | dd of=$CARD_DEVICE bs=1M iflag=fullblock oflag=direct status=none
-
- call_extension_method "post_write_sdcard" <<- 'POST_BUILD_IMAGE'
- *run after writing img to sdcard*
- After the image is written to `$CARD_DEVICE`, but before verifying it.
- You can still set SKIP_VERIFY=yes to skip verification.
- POST_BUILD_IMAGE
-
- if [[ "${SKIP_VERIFY}" != "yes" ]]; then
- # read and compare
- display_alert "Verifying. Please wait!"
- local ofsha=$(dd if=$CARD_DEVICE count=$(du -b ${FINALDEST}/${version}.img | cut -f1) status=none iflag=count_bytes oflag=direct | sha256sum | awk '{print $1}')
- if [[ $ifsha == $ofsha ]]; then
- display_alert "Writing verified" "${version}.img" "info"
- else
- display_alert "Writing failed" "${version}.img" "err"
- fi
- fi
- elif [[ $(systemd-detect-virt) == 'docker' && -n $CARD_DEVICE ]]; then
- # display warning when we want to write sd card under Docker
- display_alert "Can't write to $CARD_DEVICE" "Enable docker privileged mode in config-docker.conf" "wrn"
- fi
+ write_image_to_device "${FINALDEST}/${version}.img" "${CARD_DEVICE}"
}
diff --git a/lib/functions/image/write-device.sh b/lib/functions/image/write-device.sh
new file mode 100644
index 000000000..7aefbd2fc
--- /dev/null
+++ b/lib/functions/image/write-device.sh
@@ -0,0 +1,41 @@
+# @TODO: make usable as a separate tool as well
+function write_image_to_device() {
+ local image_file="${1}"
+ local device="${2}"
+ if [[ $(lsblk "${device}" 2> /dev/null) && -f "${image_file}" ]]; then
+ # create sha256sum if it does not exist. we need it for comparison, later.
+ local if_sha=""
+ if [[ -f "${image_file}.img.sha" ]]; then
+ # shellcheck disable=SC2002 # cat most definitely is useful. she purrs.
+ if_sha=$(cat "${image_file}.sha" | awk '{print $1}')
+ else
+ if_sha=$(sha256sum -b "${image_file}" | awk '{print $1}')
+ fi
+
+ display_alert "Writing image" "${device} ${if_sha}" "info"
+
+ # write to SD card
+ pv -p -b -r -c -N "$(logging_echo_prefix_for_pv "write_device") dd" "${image_file}" | dd "of=${device}" bs=1M iflag=fullblock oflag=direct status=none
+
+ call_extension_method "post_write_sdcard" <<- 'POST_BUILD_IMAGE'
+ *run after writing img to sdcard*
+ After the image is written to `${device}`, but before verifying it.
+ You can still set SKIP_VERIFY=yes to skip verification.
+ POST_BUILD_IMAGE
+
+ if [[ "${SKIP_VERIFY}" != "yes" ]]; then
+ # read and compare
+ display_alert "Verifying. Please wait!"
+ local of_sha=""
+ of_sha=$(dd "if=${device}" "count=$(du -b "${image_file}" | cut -f1)" status=none iflag=count_bytes oflag=direct | sha256sum | awk '{print $1}')
+ if [[ "$if_sha" == "$of_sha" ]]; then
+ display_alert "Writing verified" "${image_file}" "info"
+ else
+ display_alert "Writing failed" "${image_file}" "err"
+ fi
+ fi
+ elif [[ $(systemd-detect-virt) == 'docker' && -n ${device} ]]; then
+ # display warning when we want to write sd card under Docker
+ display_alert "Can't write to ${device}" "Enable docker privileged mode in config-docker.conf" "wrn"
+ fi
+}
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index 64001b013..519cb5031 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -45,7 +45,8 @@ function start_logging_section() {
export CURRENT_LOGGING_COUNTER
CURRENT_LOGGING_COUNTER="$(printf "%03d" "$logging_section_counter")"
export CURRENT_LOGGING_SECTION=${LOG_SECTION:-early} # default to "early", should be overwritten soon enough
- export CURRENT_LOGGING_DIR="${LOGDIR}" # set in cli-entrypoint.sh
+ export CURRENT_LOGGING_SECTION_START=${SECONDS}
+ export CURRENT_LOGGING_DIR="${LOGDIR}" # set in cli-entrypoint.sh
export CURRENT_LOGFILE="${CURRENT_LOGGING_DIR}/${CURRENT_LOGGING_COUNTER}.${CURRENT_LOGGING_SECTION}.log"
mkdir -p "${CURRENT_LOGGING_DIR}"
touch "${CURRENT_LOGFILE}" # Touch it, make sure it's writable.
@@ -54,7 +55,7 @@ function start_logging_section() {
if [[ "${CI}" == "true" ]]; then # On CI, this has special meaning.
echo "::group::[🥑] Group ${CURRENT_LOGGING_SECTION}"
else
- display_alert "start group" "<${CURRENT_LOGGING_SECTION}>" "group"
+ display_alert "" "<${CURRENT_LOGGING_SECTION}>" "group"
fi
return 0
}
@@ -62,9 +63,10 @@ function start_logging_section() {
function finish_logging_section() {
# Close opened CI group.
if [[ "${CI}" == "true" ]]; then
+ echo "Section '${CURRENT_LOGGING_SECTION}' took $((SECONDS - CURRENT_LOGGING_SECTION_START))s to execute." 1>&2 # write directly to stderr
echo "::endgroup::"
else
- display_alert "finish group" "</${CURRENT_LOGGING_SECTION}>" "group"
+ display_alert "" "</${CURRENT_LOGGING_SECTION}> in $((SECONDS - CURRENT_LOGGING_SECTION_START))s" "group"
fi
}
@@ -93,6 +95,7 @@ function do_with_logging() {
exec 3> >(
cd "${SRC}" || exit 2
#grep --line-buffered -v "^$" | \
+ # @TODO: tee to CURRENT_LOGFILE.
sed -u -e "${prefix_sed_cmd}"
)
"$@" >&3
@@ -166,7 +169,7 @@ function display_alert() {
return 0
fi
level_indicator="🦋"
- inline_logs_color="\e[1;36m" # cyan
+ inline_logs_color="\e[1;34m" # blue; 36 would be cyan
;;
command)
diff --git a/lib/functions/logging/traps.sh b/lib/functions/logging/traps.sh
index 7c3eb97cd..c6279cabc 100644
--- a/lib/functions/logging/traps.sh
+++ b/lib/functions/logging/traps.sh
@@ -94,6 +94,12 @@ function add_cleanup_handler() {
trap_manager_cleanup_handlers+=("$callback")
}
+function execute_and_remove_cleanup_handler() {
+ local callback="$1"
+ display_alert "Execute and remove cleanup handler" "${callback}" "cleanup"
+ # @TODO implement!
+}
+
function remove_all_trap_handlers() {
display_alert "Will remove ALL trap handlers, for a clean exit..." "" "cleanup"
}
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index e2882082b..2e40456c0 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -1,6 +1,6 @@
# This does NOT run under the logging manager. We should invoke the do_with_logging wrapper for
# strategic parts of this. Attention: rootfs does it's own logging, so just let that be.
-main_default_build_single() {
+function main_default_build_single() {
# Starting work. Export TMPDIR, which will be picked up by all `mktemp` invocations hopefully.
# Runner functions in logging/runners.sh will explicitly unset TMPDIR before invoking chroot.
@@ -12,6 +12,10 @@ main_default_build_single() {
export TMPDIR="${WORKDIR}"
start=$(date +%s)
+
+ ### Write config summary to its own logging section.
+ LOG_SECTION="config_summary" do_with_logging write_config_summary_output_file
+
# Check and install dependencies, directory structure and settings
LOG_SECTION="prepare_host" do_with_logging prepare_host
@@ -103,7 +107,7 @@ main_default_build_single() {
FULL="" REPLACE="-full" LOG_SECTION="compile_firmware" do_with_logging compile_firmware
# Build the full version of firmware package
- FULL="-full" REPLACE="" LOG_SECTION="compile_firmware" do_with_logging compile_firmware
+ FULL="-full" REPLACE="" LOG_SECTION="compile_firmware_full" do_with_logging compile_firmware
fi
fi
diff --git a/lib/functions/main/rootfs-image.sh b/lib/functions/main/rootfs-image.sh
index 270145b04..bca09eca0 100644
--- a/lib/functions/main/rootfs-image.sh
+++ b/lib/functions/main/rootfs-image.sh
@@ -11,26 +11,31 @@
function build_rootfs_and_image() {
display_alert "Starting rootfs and image building process for" "${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL}" "info"
- [[ $ROOTFS_TYPE != ext4 ]] && display_alert "Assuming $BOARD $BRANCH kernel supports $ROOTFS_TYPE" "" "wrn"
+ [[ $ROOTFS_TYPE != ext4 ]] && display_alert "Assuming ${BOARD} ${BRANCH} kernel supports ${ROOTFS_TYPE}" "" "wrn"
# add handler to cleanup when done or if something fails or is interrupted.
add_cleanup_handler trap_handler_cleanup_rootfs_and_image
# stage: clean and create directories
- rm -rf $SDCARD $MOUNT
- mkdir -p $SDCARD $MOUNT $DEST/images $SRC/cache/rootfs
+ rm -rf "${SDCARD}" "${MOUNT}"
+ mkdir -p "${SDCARD}" "${MOUNT}" "${DEST}/images" "${SRC}/cache/rootfs"
# bind mount rootfs if defined
if [[ -d "${ARMBIAN_CACHE_ROOTFS_PATH}" ]]; then
- mountpoint -q "${SRC}"/cache/rootfs && umount -l "${SRC}"/cache/toolchain
- mount --bind "${ARMBIAN_CACHE_ROOTFS_PATH}" "${SRC}"/cache/rootfs
+ mountpoint -q "${SRC}"/cache/rootfs && umount "${SRC}"/cache/toolchain
+ mount --bind "${ARMBIAN_CACHE_ROOTFS_PATH}" "${SRC}/cache/rootfs"
fi
# stage: verify tmpfs configuration and mount
# CLI needs ~1.5GiB, desktop - ~3.5GiB
# calculate and set tmpfs mount to use 9/10 of available RAM+SWAP
+ # @TODO: this does not make sense; swap should not be considered. Actually, only free + cached memory should be considered!
local phymem=$(((($(awk '/MemTotal/ {print $2}' /proc/meminfo) + $(awk '/SwapTotal/ {print $2}' /proc/meminfo))) / 1024 * 9 / 10)) # MiB
- if [[ $BUILD_DESKTOP == yes ]]; then local tmpfs_max_size=3500; else local tmpfs_max_size=1500; fi # MiB
+ local tmpfs_max_size=1500 # MiB
+ if [[ $BUILD_DESKTOP == yes ]]; then
+ tmpfs_max_size=3500
+ fi
+
if [[ $FORCE_USE_RAMDISK == no ]]; then
local use_tmpfs=no
elif [[ $FORCE_USE_RAMDISK == yes || $phymem -gt $tmpfs_max_size ]]; then
@@ -38,7 +43,10 @@ function build_rootfs_and_image() {
fi
[[ -n $FORCE_TMPFS_SIZE ]] && phymem=$FORCE_TMPFS_SIZE
- [[ $use_tmpfs == yes ]] && mount -t tmpfs -o size=${phymem}M tmpfs $SDCARD
+ if [[ $use_tmpfs == yes ]]; then
+ display_alert "Using tmpfs for rootfs" "${phymem}M" "debug"
+ mount -t tmpfs -o "size=${phymem}M" tmpfs "${SDCARD}"
+ fi
# stage: prepare basic rootfs: unpack cache or create from scratch
LOG_SECTION="get_or_create_rootfs_cache_chroot_sdcard" do_with_logging get_or_create_rootfs_cache_chroot_sdcard
@@ -51,25 +59,24 @@ function build_rootfs_and_image() {
# stage: install kernel and u-boot packages
# install distribution and board specific applications
- LOG_SECTION="distro" do_with_logging install_distribution_specific
+ LOG_SECTION="install_distribution_specific_${RELEASE}" do_with_logging install_distribution_specific
LOG_SECTION="install_distribution_agnostic" do_with_logging install_distribution_agnostic
- # install locally built packages
+ # install locally built packages # @TODO: armbian-nextify this eventually
[[ $EXTERNAL_NEW == compile ]] && LOG_SECTION="packages_local" do_with_logging chroot_installpackages_local
- # install from apt.armbian.com
+ # install from apt.armbian.com # @TODO: armbian-nextify this eventually
[[ $EXTERNAL_NEW == prebuilt ]] && LOG_SECTION="packages_prebuilt" do_with_logging chroot_installpackages "yes"
# stage: user customization script
# NOTE: installing too many packages may fill tmpfs mount
- LOG_SECTION="custom" do_with_logging customize_image
+ LOG_SECTION="customize_image" do_with_logging customize_image
# remove packages that are no longer needed. rootfs cache + uninstall might have leftovers.
- LOG_SECTION="rootfs_apt_get_autoremove" do_with_logging apt_purge_unneeded_packages
+ LOG_SECTION="apt_purge_unneeded_packages" do_with_logging apt_purge_unneeded_packages
- # create list of installed packages for debug purposes
- display_alert "Recording list of installed packages" "debug log" "debug"
- chroot_sdcard dpkg --get-selections "| grep -v deinstall | awk '{print \$1}' | cut -f1 -d':' 1>&2"
+ # for reference, debugging / sanity checking
+ LOG_SECTION="list_installed_packages" do_with_logging list_installed_packages
# clean up / prepare for making the image
umount_chroot "$SDCARD"
@@ -85,31 +92,34 @@ function build_rootfs_and_image() {
display_alert "Starting FEL boot" "$BOARD" "info"
start_fel_boot
else
- LOG_SECTION="partitioning" do_with_logging prepare_partitions
- LOG_SECTION="image" do_with_logging create_image_from_sdcard_rootfs
+ LOG_SECTION="prepare_partitions" do_with_logging prepare_partitions
+ LOG_SECTION="create_image_from_sdcard_rootfs" do_with_logging create_image_from_sdcard_rootfs
fi
- # stage: unmount tmpfs
- umount $SDCARD 2>&1
- if [[ $use_tmpfs = yes ]]; then
- while grep -qs "$SDCARD" /proc/mounts; do
- umount $SDCARD
- sleep 5
- done
- fi
- rm -rf $SDCARD
+ # Completely and recursively unmount the directory. This will remove the tmpfs mount too
+ umount_chroot_recursive "${SDCARD}"
+
+ # Remove the dir
+ [[ -d "${SDCARD}" ]] && rm -rf --one-file-system "${SDCARD}"
+
+ # Run the cleanup handler. @TODO: this already does the above, so can be simpler.
+ execute_and_remove_cleanup_handler trap_handler_cleanup_rootfs_and_image
- # No need to remove the cleanup handler here, it's automatic.
return 0
}
+function list_installed_packages() {
+ display_alert "Recording list of installed packages" "debug log" "debug"
+ chroot_sdcard dpkg --get-selections "| grep -v deinstall | awk '{print \$1}' | cut -f1 -d':' | column -c 80"
+}
+
function trap_handler_cleanup_rootfs_and_image() {
display_alert "Cleanup for rootfs and image" "trap_handler_cleanup_rootfs_and_image" "cleanup"
cd "${SRC}" || echo "Failed to cwd to ${SRC}" # Move pwd away, so unmounts work
# those will loop until they're unmounted.
- umount_chroot_recursive "${SDCARD}/" || true
- umount_chroot_recursive "${MOUNT}/" || true
+ umount_chroot_recursive "${SDCARD}" || true
+ umount_chroot_recursive "${MOUNT}" || true
mountpoint -q "${SRC}"/cache/toolchain && umount -l "${SRC}"/cache/toolchain >&2 # @TODO: why does Igor uses lazy umounts? nfs?
mountpoint -q "${SRC}"/cache/rootfs && umount -l "${SRC}"/cache/rootfs >&2
@@ -123,4 +133,6 @@ function trap_handler_cleanup_rootfs_and_image() {
[[ -d "${SDCARD}" ]] && rm -rf --one-file-system "${SDCARD}"
[[ -d "${MOUNT}" ]] && rm -rf --one-file-system "${MOUNT}"
+
+ return 0 # short-circuit above, so exit clean here
}
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index 75771db01..dc62374e0 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -235,15 +235,6 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/general/downloads.sh
source "${SRC}"/lib/functions/general/downloads.sh
-# no errors tolerated. invoked before each sourced file to make sure.
-#set -o pipefail # trace ERR through pipes - will be enabled "soon"
-#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
-set -o errtrace # trace ERR through - enabled
-set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/general/fingerprint.sh
-# shellcheck source=lib/functions/general/fingerprint.sh
-source "${SRC}"/lib/functions/general/fingerprint.sh
-
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
@@ -271,6 +262,24 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/general/repo.sh
source "${SRC}"/lib/functions/general/repo.sh
+# no errors tolerated. invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/image/compress-checksum.sh
+# shellcheck source=lib/functions/image/compress-checksum.sh
+source "${SRC}"/lib/functions/image/compress-checksum.sh
+
+# no errors tolerated. invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/image/fingerprint.sh
+# shellcheck source=lib/functions/image/fingerprint.sh
+source "${SRC}"/lib/functions/image/fingerprint.sh
+
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
@@ -307,6 +316,15 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/image/rootfs-to-image.sh
source "${SRC}"/lib/functions/image/rootfs-to-image.sh
+# no errors tolerated. invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/image/write-device.sh
+# shellcheck source=lib/functions/image/write-device.sh
+source "${SRC}"/lib/functions/image/write-device.sh
+
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
From c7862c7c5e2807060ead176597998270256faff9 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Tue, 1 Mar 2022 11:44:32 +0100
Subject: [PATCH] armbian-next: complete removal of usages of `LOG_SUBPATH`;
100% error handled
- loose ends, use new LOGDIR
- remove the last shortcircuit in extensions execution, now it's 100% error handled
- many logging fixes
- still missing: final log consolidation/cleanup
---
extensions/gen-sample-extension-docs.sh | 2 +-
extensions/grub.sh | 1 +
lib/extensions.sh | 15 ++++----
lib/functions/bsp/bsp-desktop.sh | 14 +++-----
lib/functions/cli/cli-entrypoint.sh | 41 +++++++++++----------
lib/functions/configuration/main-config.sh | 15 ++------
lib/functions/general/downloads.sh | 35 +++++++++---------
lib/functions/general/host.sh | 3 +-
lib/functions/image/initrd.sh | 2 +-
lib/functions/image/partitioning.sh | 57 +++++++++++++++---------------
lib/functions/image/rootfs-to-image.sh | 23 ++++++------
lib/functions/logging/logging.sh | 12 +++++--
lib/functions/logging/runners.sh | 10 ++++--
lib/functions/main/config-prepare.sh | 32 -----------------
lib/functions/main/rootfs-image.sh | 3 +-
lib/functions/rootfs/distro-agnostic.sh | 2 +-
lib/functions/rootfs/rootfs-desktop.sh | 8 ++---
17 files changed, 116 insertions(+), 159 deletions(-)
diff --git a/extensions/gen-sample-extension-docs.sh b/extensions/gen-sample-extension-docs.sh
index ea78631f7..728585c76 100644
--- a/extensions/gen-sample-extension-docs.sh
+++ b/extensions/gen-sample-extension-docs.sh
@@ -4,7 +4,7 @@ function extension_metadata_ready__499_display_docs_generation_start_info() {
}
function extension_metadata_ready__docs_markdown() {
- generate_markdown_docs_to_stdout > "${DEST}/"${LOG_SUBPATH}"/hooks.auto.docs.md"
+ generate_markdown_docs_to_stdout > "${EXTENSION_MANAGER_TMP_DIR}/hooks.auto.docs.md"
}
function extension_metadata_ready__docs_sample_extension() {
diff --git a/extensions/grub.sh b/extensions/grub.sh
index e1b20a87e..0ae97ed43 100644
--- a/extensions/grub.sh
+++ b/extensions/grub.sh
@@ -75,6 +75,7 @@ post_family_tweaks_bsp__remove_uboot_grub() {
pre_umount_final_image__remove_uboot_initramfs_hook_grub() {
# even if BSP still contained this (cached .deb), make sure by removing from ${MOUNT}
[[ -f "$MOUNT"/etc/initramfs/post-update.d/99-uboot ]] && rm -v "$MOUNT"/etc/initramfs/post-update.d/99-uboot
+ return 0 # shortcircuit above
}
pre_umount_final_image__install_grub() {
diff --git a/lib/extensions.sh b/lib/extensions.sh
index ad215bdf0..12a86fcfe 100644
--- a/lib/extensions.sh
+++ b/lib/extensions.sh
@@ -20,7 +20,7 @@ export LOG_ENABLE_EXTENSION=yes # colorful logs with stacktrace when enable_exte
# notice: this is not involved in how the hook functions came to be. read below for that.
call_extension_method() {
# First, consume the stdin and write metadata about the call.
- write_hook_point_metadata "$@" || true
+ write_hook_point_metadata "$@"
# @TODO: hack to handle stdin again, possibly with '< /dev/tty'
@@ -36,9 +36,9 @@ call_extension_method() {
# Then call the hooks, if they are defined.
for hook_name in "$@"; do
echo "-- Extension Method being called: ${hook_name}" >> "${EXTENSION_MANAGER_LOG_FILE}"
- # shellcheck disable=SC2086
- # shellcheck disable=SC2015
- [[ $(type -t ${hook_name} || true) == function ]] && { ${hook_name}; } || true
+ if [[ $(type -t ${hook_name} || true) == function ]]; then
+ ${hook_name}
+ fi
done
}
@@ -66,7 +66,7 @@ initialize_extension_manager() {
mkdir -p "${EXTENSION_MANAGER_TMP_DIR}"
# Log destination.
- export EXTENSION_MANAGER_LOG_FILE="${EXTENSION_MANAGER_TMP_DIR}/extensions.log"
+ export EXTENSION_MANAGER_LOG_FILE="${LOGDIR}/999.extensions.log"
[[ "${WRITE_EXTENSIONS_METADATA:-yes}" == "no" ]] && echo -n "" > "${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt"
# Add trap handler to cleanup and not leave garbage behind when exiting.
@@ -270,10 +270,7 @@ function cleanup_handler_extensions() {
display_alert "yeah the extensions trap handler..." "cleanup_handler_extensions" "cleanup"
cleanup_extension_manager
- # Move temporary log file over to final destination.
- if [[ -f "${EXTENSION_MANAGER_LOG_FILE}" ]]; then
- mv "${EXTENSION_MANAGER_LOG_FILE}" "${DEST}/${LOG_SUBPATH:-debug}/extensions.log"
- fi
+ # Stop logging.
unset EXTENSION_MANAGER_LOG_FILE
# cleanup our tmpdir.
diff --git a/lib/functions/bsp/bsp-desktop.sh b/lib/functions/bsp/bsp-desktop.sh
index 54259fc4a..8ebc53738 100644
--- a/lib/functions/bsp/bsp-desktop.sh
+++ b/lib/functions/bsp/bsp-desktop.sh
@@ -10,10 +10,7 @@
# https://github.com/armbian/build/
create_desktop_package() {
-
- echo "Showing PACKAGE_LIST_DESKTOP before postprocessing" >> "${DEST}"/${LOG_SUBPATH}/output.log
- # Use quotes to show leading and trailing spaces
- echo "\"$PACKAGE_LIST_DESKTOP\"" >> "${DEST}"/${LOG_SUBPATH}/output.log
+ display_alert "bsp-desktop: PACKAGE_LIST_DESKTOP" "'${PACKAGE_LIST_DESKTOP}'" "debug"
# Remove leading and trailing spaces with some bash monstruosity
# https://stackoverflow.com/questions/369758/how-to-trim-whitespace-from-a-bash-variable#12973694
@@ -24,7 +21,7 @@ create_desktop_package() {
# Remove others 'spacing characters' (like tabs)
DEBIAN_RECOMMENDS=${DEBIAN_RECOMMENDS//[[:space:]]/}
- echo "DEBIAN_RECOMMENDS : ${DEBIAN_RECOMMENDS}" >> "${DEST}"/${LOG_SUBPATH}/output.log
+ display_alert "bsp-desktop: DEBIAN_RECOMMENDS" "'${DEBIAN_RECOMMENDS}'" "debug"
# Replace whitespace characters by commas
PACKAGE_LIST_PREDEPENDS=${PACKAGE_LIST_PREDEPENDS// /,}
@@ -37,7 +34,7 @@ create_desktop_package() {
rm -rf "${destination}"
mkdir -p "${destination}"/DEBIAN
- echo "${PACKAGE_LIST_PREDEPENDS}" >> "${DEST}"/${LOG_SUBPATH}/output.log
+ display_alert "bsp-desktop: PACKAGE_LIST_PREDEPENDS" "'${PACKAGE_LIST_PREDEPENDS}'" "debug"
# set up control file
cat <<- EOF > "${destination}"/DEBIAN/control
@@ -65,9 +62,6 @@ create_desktop_package() {
chmod 755 "${destination}"/DEBIAN/postinst
- #display_alert "Showing ${destination}/DEBIAN/postinst"
- cat "${destination}/DEBIAN/postinst" >> "${DEST}/${LOG_SUBPATH}/bsp_postinst.log"
-
# Armbian create_desktop_package scripts
unset aggregated_content
@@ -138,7 +132,7 @@ create_bsp_desktop_package() {
local aggregated_content=""
aggregate_all_desktop "debian/armbian-bsp-desktop/prepare.sh" $'\n'
eval "${aggregated_content}"
- [[ $? -ne 0 ]] && display_alert "prepare.sh exec error" "" "wrn"
+ [[ $? -ne 0 ]] && display_alert "prepare.sh exec error" "" "wrn" # @TODO: this is a fantasy, error would be thrown in line above
mkdir -p "${DEB_STORAGE}/${RELEASE}"
cd "${destination}"
diff --git a/lib/functions/cli/cli-entrypoint.sh b/lib/functions/cli/cli-entrypoint.sh
index 22de78eb4..3b8c1ad7d 100644
--- a/lib/functions/cli/cli-entrypoint.sh
+++ b/lib/functions/cli/cli-entrypoint.sh
@@ -1,22 +1,3 @@
-function bla_cleanup1() {
- echo "-- bla cleanup1" 1>&2
-}
-function bla_cleanup2() {
- echo "-- bla cleanup2" 1>&2
-}
-
-function bla() {
- display_alert "bla starting" "bla is here! PID: $$ - BASHPID: $BASHPID" "debug"
- add_cleanup_handler bla_cleanup1
- add_cleanup_handler bla_cleanup2
-
- #sleep 10
- #explode_here
- #exit 66 # exit with error
- exit_with_error "something" "wrong"
- #exit 0 # exit without error
-}
-
function cli_entrypoint() {
if [[ "${ARMBIAN_ENABLE_CALL_TRACING}" == "yes" ]]; then
set -T # inherit return/debug traps
@@ -90,6 +71,28 @@ function cli_entrypoint() {
CONFIG_PATH=$(dirname "${CONFIG_FILE}")
+ # DEST is the main output dir.
+ # destination. # @TODO: logging this is when we can start logging to file. make sure.
+ declare DEST="${SRC}/output"
+ if [ -d "$CONFIG_PATH/output" ]; then
+ DEST="${CONFIG_PATH}/output"
+ fi
+ display_alert "Output directory DEST:" "${DEST}" "debug"
+
+ # set unique mounting directory for this build.
+ export ARMBIAN_BUILD_UUID="$(uuidgen)"
+ display_alert "Build UUID:" "${ARMBIAN_BUILD_UUID}" "debug"
+
+ # Super-global variables, used everywhere. The directories are NOT _created_ here, since this very early stage.
+ export WORKDIR="${SRC}/.tmp/work-${ARMBIAN_BUILD_UUID}" # WORKDIR at this stage. It will become TMPDIR later. It has special significance to `mktemp` and others!
+ export SDCARD="${SRC}/.tmp/rootfs-${ARMBIAN_BUILD_UUID}" # SDCARD (which is NOT an sdcard, but will be, maybe, one day) is where we work the rootfs before final imaging. "rootfs" stage.
+ export MOUNT="${SRC}/.tmp/mount-${ARMBIAN_BUILD_UUID}" # MOUNT ("mounted on the loop") is the mounted root on final image (via loop). "image" stage
+ export EXTENSION_MANAGER_TMP_DIR="${SRC}/.tmp/extensions-${ARMBIAN_BUILD_UUID}" # EXTENSION_MANAGER_TMP_DIR used to store extension-composed functions
+ export DESTIMG="${SRC}/.tmp/image-${ARMBIAN_BUILD_UUID}" # DESTIMG is where the backing image (raw, huge, sparse file) is kept
+ export LOGDIR="${SRC}/.tmp/logs-${ARMBIAN_BUILD_UUID}" # Will be initialized very soon, literally, below.
+
+ LOG_SECTION=entrypoint start_logging_section # This creates LOGDIR. Hopefully.
+
# Source the extensions manager library at this point, before sourcing the config.
# This allows early calls to enable_extension(), but initialization proper is done later.
# shellcheck source=lib/extensions.sh
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index b5b2e9ca5..8fc63c032 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -10,16 +10,6 @@
# https://github.com/armbian/build/
function do_main_configuration() {
- # set unique mounting directory for this build.
- MOUNT_UUID=$(uuidgen)
-
- # Super-global variables, used everywhere. The directories are NOT _created_ here, since this is config stage, not build.
- export WORKDIR="${SRC}/.tmp/work-${MOUNT_UUID}" # WORKDIR at this stage. It will become TMPDIR later. It has special significance to `mktemp` and others!
- export SDCARD="${SRC}/.tmp/rootfs-${MOUNT_UUID}" # SDCARD (which is NOT an sdcard, but will be, maybe, one day) is where we work the rootfs before final imaging. "rootfs" stage.
- export MOUNT="${SRC}/.tmp/mount-${MOUNT_UUID}" # MOUNT ("mounted on the loop") is the mounted root on final image (via loop). "image" stage
- export EXTENSION_MANAGER_TMP_DIR="${SRC}/.tmp/extensions-${MOUNT_UUID}" # EXTENSION_MANAGER_TMP_DIR used to store extension-composed functions
- export DESTIMG="${SRC}/.tmp/image-${MOUNT_UUID}" # DESTIMG is where the backing image (raw, huge, sparse file) is kept
-
display_alert "Starting main configuration" "${MOUNT_UUID}" "info"
# common options
@@ -439,7 +429,6 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
}
function write_config_summary_output_file() {
- local build_script_env_file="${DEST}/${LOG_SUBPATH}/output.log"
local debug_dpkg_arch debug_uname debug_virt debug_src_mount debug_src_perms debug_src_temp_perms
debug_dpkg_arch="$(dpkg --print-architecture)"
debug_uname="$(uname -a)"
@@ -448,8 +437,8 @@ function write_config_summary_output_file() {
debug_src_perms="$(getfacl -p "${SRC}")"
debug_src_temp_perms="$(getfacl -p "${SRC}"/.tmp 2> /dev/null)"
- display_alert "Writing build config summary to" "${build_script_env_file}" "debug"
- cat <<- EOF >> "${build_script_env_file}"
+ display_alert "Writing build config summary to" "debug log" "debug"
+ run_host_command_logged cat "1>&2" <<- EOF
## BUILD SCRIPT ENVIRONMENT
Repository: $REPOSITORY_URL
diff --git a/lib/functions/general/downloads.sh b/lib/functions/general/downloads.sh
index 5d36282c0..b51f0d9c4 100644
--- a/lib/functions/general/downloads.sh
+++ b/lib/functions/general/downloads.sh
@@ -80,7 +80,6 @@ download_and_verify() {
# download torrent first
if [[ ${USE_TORRENT} == "yes" ]]; then
-
display_alert "downloading using torrent network" "$filename"
local ariatorrent="--summary-interval=0 --auto-save-interval=0 --seed-time=0 --bt-stop-timeout=120 --console-log-level=error \
--allow-overwrite=true --download-result=hide --rpc-save-upload-metadata=false --auto-file-renaming=false \
@@ -90,14 +89,13 @@ download_and_verify() {
# exception. It throws error if dht.dat file does not exists. Error suppress needed only at first download.
if [[ -f "${SRC}"/cache/.aria2/dht.dat ]]; then
# shellcheck disable=SC2086
- aria2c ${ariatorrent}
+ run_host_command_logged aria2c ${ariatorrent}
else
# shellcheck disable=SC2035
- aria2c ${ariatorrent} &> "${DEST}"/${LOG_SUBPATH}/torrent.log
+ run_host_command_logged aria2c ${ariatorrent}
fi
# mark complete
- [[ $? -eq 0 ]] && touch "${localdir}/${filename}.complete"
-
+ touch "${localdir}/${filename}.complete"
fi
# direct download if torrent fails
@@ -126,39 +124,38 @@ download_and_verify() {
# Verify archives with Linaro and Armbian GPG keys
if [ x"" != x"${http_proxy}" ]; then
- (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 8F427EAF >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1 || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \
+ (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 8F427EAF || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \
--keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options http-proxy="${http_proxy}" \
- --recv-keys 8F427EAF >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1)
+ --recv-keys 8F427EAF)
- (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 9F0E78D5 >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1 || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \
+ (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 9F0E78D5 || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \
--keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options http-proxy="${http_proxy}" \
- --recv-keys 9F0E78D5 >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1)
+ --recv-keys 9F0E78D5)
else
- (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 8F427EAF >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1 || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \
+ (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 8F427EAF || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \
--keyserver hkp://keyserver.ubuntu.com:80 \
- --recv-keys 8F427EAF >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1)
+ --recv-keys 8F427EAF)
- (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 9F0E78D5 >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1 || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \
+ (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 9F0E78D5 || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \
--keyserver hkp://keyserver.ubuntu.com:80 \
- --recv-keys 9F0E78D5 >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1)
+ --recv-keys 9F0E78D5)
fi
gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --verify \
- --trust-model always -q "${localdir}/${filename}.asc" >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1
+ --trust-model always -q "${localdir}/${filename}.asc"
[[ ${PIPESTATUS[0]} -eq 0 ]] && verified=true && display_alert "Verified" "PGP" "info"
else
-
md5sum -c --status "${localdir}/${filename}.asc" && verified=true && display_alert "Verified" "MD5" "info"
-
fi
if [[ $verified == true ]]; then
if [[ "${filename:(-6)}" == "tar.xz" ]]; then
-
display_alert "decompressing"
- pv -p -b -r -c -N "$(logging_echo_prefix_for_pv "decompress") ${filename}" "${filename}" | xz -dc | tar xp --xattrs --no-same-owner --overwrite
- [[ $? -eq 0 ]] && touch "${localdir}/${dirname}/.download-complete"
+ pv -p -b -r -c -N "$(logging_echo_prefix_for_pv "decompress") ${filename}" "${filename}" |
+ xz -dc |
+ tar xp --xattrs --no-same-owner --overwrite &&
+ touch "${localdir}/${dirname}/.download-complete"
fi
else
exit_with_error "verification failed"
diff --git a/lib/functions/general/host.sh b/lib/functions/general/host.sh
index 2af993dc9..818541c6c 100644
--- a/lib/functions/general/host.sh
+++ b/lib/functions/general/host.sh
@@ -186,7 +186,8 @@ prepare_host() {
find "${SRC}"/output "${USERPATCHES_PATH}" -type d ! -group sudo -exec chgrp --quiet sudo {} \;
find "${SRC}"/output "${USERPATCHES_PATH}" -type d ! -perm -g+w,g+s -exec chmod --quiet g+w,g+s {} \;
fi
- mkdir -p "${DEST}"/debs-beta/extra "${DEST}"/debs/extra "${DEST}"/{config,debug,patch} "${USERPATCHES_PATH}"/overlay "${SRC}"/cache/{sources,hash,hash-beta,toolchain,utility,rootfs} "${SRC}"/.tmp
+ # @TODO: original: mkdir -p "${DEST}"/debs-beta/extra "${DEST}"/debs/extra "${DEST}"/{config,debug,patch} "${USERPATCHES_PATH}"/overlay "${SRC}"/cache/{sources,hash,hash-beta,toolchain,utility,rootfs} "${SRC}"/.tmp
+ mkdir -p "${USERPATCHES_PATH}"/overlay "${SRC}"/cache/{sources,hash,hash-beta,toolchain,utility,rootfs} "${SRC}"/.tmp
# build aarch64
if [[ $(dpkg --print-architecture) == amd64 ]]; then
diff --git a/lib/functions/image/initrd.sh b/lib/functions/image/initrd.sh
index a3ea4b186..de431cbbc 100644
--- a/lib/functions/image/initrd.sh
+++ b/lib/functions/image/initrd.sh
@@ -23,7 +23,7 @@ update_initramfs() {
cp "/usr/bin/$QEMU_BINARY" "$chroot_target/usr/bin"/
mount_chroot "$chroot_target/"
- local logging_filter="| grep --line-buffered -v -e '.xz' -e 'ORDER ignored' -e 'Adding binary' "
+ local logging_filter="2>&1 | grep --line-buffered -v -e '.xz' -e 'ORDER ignored' -e 'Adding binary ' -e 'Adding module ' "
chroot_custom_long_running "$chroot_target" "$update_initramfs_cmd" "${logging_filter}" || {
exit_with_error "Updating initramfs FAILED"
}
diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh
index 2387f37e0..2aa7c6f7b 100644
--- a/lib/functions/image/partitioning.sh
+++ b/lib/functions/image/partitioning.sh
@@ -161,7 +161,7 @@ prepare_partitions() {
# stage: create partition table
display_alert "Creating partitions" "${bootfs:+/boot: $bootfs }root: $ROOTFS_TYPE" "info"
- parted -s ${SDCARD}.raw -- mklabel ${IMAGE_PARTITION_TABLE}
+ run_host_command_logged parted -s ${SDCARD}.raw -- mklabel ${IMAGE_PARTITION_TABLE}
if [[ "${USE_HOOK_FOR_PARTITION}" == "yes" ]]; then
call_extension_method "create_partition_table" <<- 'CREATE_PARTITION_TABLE'
*only called when USE_HOOK_FOR_PARTITION=yes to create the complete partition table*
@@ -170,7 +170,7 @@ prepare_partitions() {
CREATE_PARTITION_TABLE
elif [[ $ROOTFS_TYPE == nfs ]]; then
# single /boot partition
- parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$bootfs]} ${bootstart}s "100%"
+ run_host_command_logged parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$bootfs]} ${bootstart}s "100%"
elif [[ $UEFISIZE -gt 0 ]]; then
# uefi partition + root partition
if [[ "${IMAGE_PARTITION_TABLE}" == "gpt" ]]; then
@@ -182,38 +182,38 @@ prepare_partitions() {
local rootstart=$(($uefistart + ($UEFISIZE * 2048)))
local biosend=$(($uefistart - 1))
local uefiend=$(($rootstart - 1))
- parted -s ${SDCARD}.raw -- mkpart bios fat32 ${biosstart}s ${biosend}s
- parted -s ${SDCARD}.raw -- mkpart efi fat32 ${uefistart}s ${uefiend}s
- parted -s ${SDCARD}.raw -- mkpart rootfs ${parttype[$ROOTFS_TYPE]} ${rootstart}s "100%"
+ run_host_command_logged parted -s ${SDCARD}.raw -- mkpart bios fat32 ${biosstart}s ${biosend}s
+ run_host_command_logged parted -s ${SDCARD}.raw -- mkpart efi fat32 ${uefistart}s ${uefiend}s
+ run_host_command_logged parted -s ${SDCARD}.raw -- mkpart rootfs ${parttype[$ROOTFS_TYPE]} ${rootstart}s "100%"
# transpose so BIOS is in sda14; EFI is in sda15 and root in sda1; requires sgdisk, parted cant do numbers
- sgdisk --transpose 1:14 ${SDCARD}.raw
- sgdisk --transpose 2:15 ${SDCARD}.raw
- sgdisk --transpose 3:1 ${SDCARD}.raw
+ run_host_command_logged sgdisk --transpose 1:14 ${SDCARD}.raw
+ run_host_command_logged sgdisk --transpose 2:15 ${SDCARD}.raw
+ run_host_command_logged sgdisk --transpose 3:1 ${SDCARD}.raw
# set the ESP (efi) flag on 15
- parted -s ${SDCARD}.raw -- set 14 bios_grub on
- parted -s ${SDCARD}.raw -- set 15 esp on
+ run_host_command_logged parted -s ${SDCARD}.raw -- set 14 bios_grub on
+ run_host_command_logged parted -s ${SDCARD}.raw -- set 15 esp on
else
display_alert "Creating partitions" "UEFI+rootfs (no BIOS)" "info"
# Simple EFI + root partition on GPT, no BIOS.
- parted -s ${SDCARD}.raw -- mkpart efi fat32 ${bootstart}s ${bootend}s
- parted -s ${SDCARD}.raw -- mkpart rootfs ${parttype[$ROOTFS_TYPE]} ${rootstart}s "100%"
+ run_host_command_logged parted -s ${SDCARD}.raw -- mkpart efi fat32 ${bootstart}s ${bootend}s
+ run_host_command_logged parted -s ${SDCARD}.raw -- mkpart rootfs ${parttype[$ROOTFS_TYPE]} ${rootstart}s "100%"
# transpose so EFI is in sda15 and root in sda1; requires sgdisk, parted cant do numbers
- sgdisk --transpose 1:15 ${SDCARD}.raw
- sgdisk --transpose 2:1 ${SDCARD}.raw
+ run_host_command_logged sgdisk --transpose 1:15 ${SDCARD}.raw
+ run_host_command_logged sgdisk --transpose 2:1 ${SDCARD}.raw
# set the ESP (efi) flag on 15
- parted -s ${SDCARD}.raw -- set 15 esp on
+ run_host_command_logged parted -s ${SDCARD}.raw -- set 15 esp on
fi
else
- parted -s ${SDCARD}.raw -- mkpart primary fat32 ${bootstart}s ${bootend}s
- parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$ROOTFS_TYPE]} ${rootstart}s "100%"
+ run_host_command_logged parted -s ${SDCARD}.raw -- mkpart primary fat32 ${bootstart}s ${bootend}s
+ run_host_command_logged parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$ROOTFS_TYPE]} ${rootstart}s "100%"
fi
elif [[ $BOOTSIZE == 0 ]]; then
# single root partition
- parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$ROOTFS_TYPE]} ${rootstart}s "100%"
+ run_host_command_logged parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$ROOTFS_TYPE]} ${rootstart}s "100%"
else
# /boot partition + root partition
- parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$bootfs]} ${bootstart}s ${bootend}s
- parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$ROOTFS_TYPE]} ${rootstart}s "100%"
+ run_host_command_logged parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$bootfs]} ${bootstart}s ${bootend}s
+ run_host_command_logged parted -s ${SDCARD}.raw -- mkpart primary ${parttype[$ROOTFS_TYPE]} ${rootstart}s "100%"
fi
call_extension_method "post_create_partitions" <<- 'POST_CREATE_PARTITIONS'
@@ -231,12 +231,13 @@ prepare_partitions() {
check_loop_device "$LOOP"
- losetup $LOOP ${SDCARD}.raw
+ run_host_command_logged losetup $LOOP ${SDCARD}.raw
# loop device was grabbed here, unlock
flock -u $FD
- partprobe $LOOP
+ display_alert "Running partprobe" "${LOOP}" "debug"
+ run_host_command_logged partprobe $LOOP
# stage: create fs, mount partitions, create fstab
rm -f $SDCARD/etc/fstab
@@ -259,7 +260,7 @@ prepare_partitions() {
if [[ $ROOTFS_TYPE == btrfs && $BTRFS_COMPRESSION != none ]]; then
local fscreateopt="-o compress-force=${BTRFS_COMPRESSION}"
fi
- mount ${fscreateopt} $rootdevice $MOUNT/
+ run_host_command_logged mount ${fscreateopt} $rootdevice $MOUNT/
# create fstab (and crypttab) entry
if [[ $CRYPTROOT_ENABLE == yes ]]; then
# map the LUKS container partition via its UUID to be the 'cryptroot' device
@@ -273,17 +274,17 @@ prepare_partitions() {
if [[ -n $bootpart ]]; then
display_alert "Creating /boot" "$bootfs on ${LOOP}p${bootpart}"
check_loop_device "${LOOP}p${bootpart}"
- mkfs.${mkfs[$bootfs]} ${mkopts[$bootfs]} ${LOOP}p${bootpart} 2>&1
+ run_host_command_logged mkfs.${mkfs[$bootfs]} ${mkopts[$bootfs]} ${LOOP}p${bootpart} 2>&1
mkdir -p $MOUNT/boot/
- mount ${LOOP}p${bootpart} $MOUNT/boot/
+ run_host_command_logged mount ${LOOP}p${bootpart} $MOUNT/boot/
echo "UUID=$(blkid -s UUID -o value ${LOOP}p${bootpart}) /boot ${mkfs[$bootfs]} defaults${mountopts[$bootfs]} 0 2" >> $SDCARD/etc/fstab
fi
if [[ -n $uefipart ]]; then
display_alert "Creating EFI partition" "FAT32 ${UEFI_MOUNT_POINT} on ${LOOP}p${uefipart} label ${UEFI_FS_LABEL}"
check_loop_device "${LOOP}p${uefipart}"
- mkfs.fat -F32 -n "${UEFI_FS_LABEL^^}" ${LOOP}p${uefipart} 2>&1 # "^^" makes variable UPPERCASE, required for FAT32.
+ run_host_command_logged mkfs.fat -F32 -n "${UEFI_FS_LABEL^^}" ${LOOP}p${uefipart} 2>&1 # "^^" makes variable UPPERCASE, required for FAT32.
mkdir -p "${MOUNT}${UEFI_MOUNT_POINT}"
- mount ${LOOP}p${uefipart} "${MOUNT}${UEFI_MOUNT_POINT}"
+ run_host_command_logged mount ${LOOP}p${uefipart} "${MOUNT}${UEFI_MOUNT_POINT}"
echo "UUID=$(blkid -s UUID -o value ${LOOP}p${uefipart}) ${UEFI_MOUNT_POINT} vfat defaults 0 2" >> $SDCARD/etc/fstab
fi
[[ $ROOTFS_TYPE == nfs ]] && echo "/dev/nfs / nfs defaults 0 0" >> $SDCARD/etc/fstab
@@ -334,7 +335,7 @@ prepare_partitions() {
# recompile .cmd to .scr if boot.cmd exists
[[ -f $SDCARD/boot/boot.cmd ]] &&
- mkimage -C none -A arm -T script -d $SDCARD/boot/boot.cmd $SDCARD/boot/boot.scr > /dev/null 2>&1
+ run_host_command_logged mkimage -C none -A arm -T script -d $SDCARD/boot/boot.cmd $SDCARD/boot/boot.scr
# create extlinux config
if [[ -f $SDCARD/boot/extlinux/extlinux.conf ]]; then
diff --git a/lib/functions/image/rootfs-to-image.sh b/lib/functions/image/rootfs-to-image.sh
index 77d61fc2c..8c6e26081 100644
--- a/lib/functions/image/rootfs-to-image.sh
+++ b/lib/functions/image/rootfs-to-image.sh
@@ -19,7 +19,7 @@ create_image_from_sdcard_rootfs() {
[[ $ROOTFS_TYPE == nfs ]] && version=${version}_nfsboot
if [[ $ROOTFS_TYPE != nfs ]]; then
- display_alert "Copying files via rsync to" "/"
+ display_alert "Copying files via rsync to" "/ at ${MOUNT}"
run_host_command_logged rsync -aHWXh \
--exclude="/boot/*" \
--exclude="/dev/*" \
@@ -38,7 +38,7 @@ create_image_from_sdcard_rootfs() {
fi
# stage: rsync /boot
- display_alert "Copying files to" "/boot"
+ display_alert "Copying files to" "/boot at ${MOUNT}"
if [[ $(findmnt --target $MOUNT/boot -o FSTYPE -n) == vfat ]]; then
# fat32
run_host_command_logged rsync -rLtWh --info=progress0,stats1 "$SDCARD/boot" "$MOUNT"
@@ -58,11 +58,10 @@ create_image_from_sdcard_rootfs() {
}
# DEBUG: print free space
- local freespace=$(LC_ALL=C df -h)
- # @TODO: this is very specific; we don't want it on screen ever?
- #echo $freespace >> $DEST/${LOG_SUBPATH}/debootstrap.log
- display_alert "Free SD cache" "$(echo -e "$freespace" | grep $SDCARD | awk '{print $5}')" "info"
- display_alert "Mount point" "$(echo -e "$freespace" | grep $MOUNT | head -1 | awk '{print $5}')" "info"
+ local freespace
+ freespace=$(LC_ALL=C df -h)
+ display_alert "Free SD cache" "$(echo -e "$freespace" | grep "${SDCARD}" | awk '{print $5}')" "info"
+ display_alert "Mount point" "$(echo -e "$freespace" | grep "${MOUNT}" | head -1 | awk '{print $5}')" "info"
# stage: write u-boot, unless the deb is not there, which would happen if BOOTCONFIG=none
# exception: if we use the one from repository, install version which was downloaded from repo
@@ -78,11 +77,11 @@ create_image_from_sdcard_rootfs() {
Called before unmounting both `/root` and `/boot`.
PRE_UMOUNT_FINAL_IMAGE
- # unmount /boot/efi first, then /boot, rootfs third, image file last # @TODO: why using lazy unmount?
+ # unmount /boot/efi first, then /boot, rootfs third, image file last
sync
- [[ $UEFISIZE != 0 ]] && umount -l "${MOUNT}${UEFI_MOUNT_POINT}"
- [[ $BOOTSIZE != 0 ]] && umount -l $MOUNT/boot
- [[ $ROOTFS_TYPE != nfs ]] && umount -l $MOUNT
+ [[ $UEFISIZE != 0 ]] && umount "${MOUNT}${UEFI_MOUNT_POINT}"
+ [[ $BOOTSIZE != 0 ]] && umount "${MOUNT}/boot"
+ [[ $ROOTFS_TYPE != nfs ]] && umount "${MOUNT}"
[[ $CRYPTROOT_ENABLE == yes ]] && cryptsetup luksClose $ROOT_MAPPER
call_extension_method "post_umount_final_image" "config_post_umount_final_image" <<- 'POST_UMOUNT_FINAL_IMAGE'
@@ -90,7 +89,7 @@ PRE_UMOUNT_FINAL_IMAGE
Called after unmounting both `/root` and `/boot`.
POST_UMOUNT_FINAL_IMAGE
- # to make sure its unmounted # @TODO: maybe use the recursive unmount we have now
+ # @TODO: this is simply wrong and never does anything. we should use the recursive unmounter here
while grep -Eq '(${MOUNT}|${DESTIMG})' /proc/mounts; do
display_alert "Wait for unmount" "${MOUNT}" "info"
sleep 5
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index e73a6e2d5..64001b013 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -44,10 +44,11 @@ function start_logging_section() {
export logging_section_counter=$((logging_section_counter + 1)) # increment counter, used in filename
export CURRENT_LOGGING_COUNTER
CURRENT_LOGGING_COUNTER="$(printf "%03d" "$logging_section_counter")"
- export CURRENT_LOGGING_SECTION=${LOG_SECTION:-build} # default to "build"
- export CURRENT_LOGGING_DIR="${DEST}/${LOG_SUBPATH}" # origin: build-all-ng - @TODO: rpardini: lets revisit this later
+ export CURRENT_LOGGING_SECTION=${LOG_SECTION:-early} # default to "early", should be overwritten soon enough
+ export CURRENT_LOGGING_DIR="${LOGDIR}" # set in cli-entrypoint.sh
export CURRENT_LOGFILE="${CURRENT_LOGGING_DIR}/${CURRENT_LOGGING_COUNTER}.${CURRENT_LOGGING_SECTION}.log"
mkdir -p "${CURRENT_LOGGING_DIR}"
+ touch "${CURRENT_LOGFILE}" # Touch it, make sure it's writable.
# Markers for CI (GitHub Actions); CI env var comes predefined as true there.
if [[ "${CI}" == "true" ]]; then # On CI, this has special meaning.
@@ -192,8 +193,13 @@ function display_alert() {
pids_info="${tool_color}(${normal_color}$$ - ${BASHPID}${tool_color})" # BASHPID is the current subshell; $$ is parent's?
fi
+ local bashopts_info=""
+ if [[ "${SHOW_BASHOPTS}" == "yes" ]]; then
+ bashopts_info="${tool_color}(${normal_color}$-${tool_color})" # $- is the currently active bashopts
+ fi
+
[[ -n $2 ]] && extra=" [${inline_logs_color} ${2} ${normal_color}]"
- echo -e "${normal_color}${left_marker}${padding}${level_indicator}${padding}${normal_color}${right_marker}${timing_info}${pids_info} ${normal_color}${message}${extra}${normal_color}" >&2
+ echo -e "${normal_color}${left_marker}${padding}${level_indicator}${padding}${normal_color}${right_marker}${timing_info}${pids_info}${bashopts_info} ${normal_color}${message}${extra}${normal_color}" >&2
# Now write to CI, if we're running on it
if [[ "${CI}" == "true" ]] && [[ "${ci_log}" != "" ]]; then
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index 3ef7071c8..0d0c887ed 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -14,11 +14,16 @@ function chroot_sdcard_apt_get() {
chroot_sdcard DEBIAN_FRONTEND=noninteractive apt-get "${apt_params[@]}" "$@"
}
-# please, please, unify around this function. if SDCARD is not enough, I'll make a mount version.
+# please, please, unify around this function.
function chroot_sdcard() {
TMPDIR="" run_host_command_logged_raw chroot "${SDCARD}" /bin/bash -e -o pipefail -c "$*"
}
+# please, please, unify around this function.
+function chroot_mount() {
+ TMPDIR="" run_host_command_logged_raw chroot "${MOUNT}" /bin/bash -e -o pipefail -c "$*"
+}
+
# This should be used if you need to capture the stdout produced by the command. It is NOT logged, and NOT run thru bash, and NOT quoted.
function chroot_sdcard_with_stdout() {
TMPDIR="" chroot "${SDCARD}" "$@"
@@ -127,9 +132,8 @@ function run_host_command_logged_raw() {
if [[ -f "${CURRENT_LOGFILE}" ]]; then
echo " " >> "${CURRENT_LOGFILE}" # blank line for reader's benefit
echo "-->" "$*" " <- at $(date --utc)" >> "${CURRENT_LOGFILE}"
- else
- display_alert "Command debug" "$*" "command" # A special 'command' level.
fi
+ display_alert "Command debug" "$*" "command" # A special 'command' level.
# uncomment when desperate to understand what's going on
# echo "cmd about to run" "$@" >&2
diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh
index cd795ccd2..7984e3c1b 100644
--- a/lib/functions/main/config-prepare.sh
+++ b/lib/functions/main/config-prepare.sh
@@ -3,44 +3,12 @@ function prepare_and_config_main_build_single() {
# this is used instead of making the chmod in prepare_host() recursive
umask 002
- # destination. # @TODO: logging this is when we can start logging to file. make sure.
- if [ -d "$CONFIG_PATH/output" ]; then
- DEST="${CONFIG_PATH}"/output
- else
- DEST="${SRC}"/output
- fi
- display_alert "Determined DEST:" "${DEST}" "debug"
-
interactive_config_prepare_terminal
# Warnings mitigation
[[ -z $LANGUAGE ]] && export LANGUAGE="en_US:en" # set to english if not set
[[ -z $CONSOLE_CHAR ]] && export CONSOLE_CHAR="UTF-8" # set console to UTF-8 if not set
- # @TODO: rpardini: this definitely should NOT be done during config preparation. move outside
- if [[ "${CONFIG_DEFS_ONLY}" != "yes" ]]; then
- # set log path
- LOG_SUBPATH=${LOG_SUBPATH:=debug}
- mkdir -p "${DEST}/${LOG_SUBPATH}" # This creates the logging output.
-
- # compress and remove old logs, if they exist.
- if [[ -f "${DEST}/${LOG_SUBPATH}/timestamp" ]]; then
- if ls "${DEST}/${LOG_SUBPATH}/"*.log &> /dev/null; then
- display_alert "Archiving previous build logs..." "${DEST}/${LOG_SUBPATH}" "info"
- (cd "${DEST}/${LOG_SUBPATH}" && tar -czf logs-"$(< timestamp)".tgz ./*.log) # > /dev/null 2>&1
- rm -f "${DEST}/${LOG_SUBPATH}"/*.log
- fi
- # delete compressed logs older than 7 days
- find "${DEST}"/${LOG_SUBPATH} -name '*.tgz' -mtime +7 -delete
- fi
-
- # Mark a timestamp, for next build.
- date +"%d_%m_%Y-%H_%M_%S" > "${DEST}"/${LOG_SUBPATH}/timestamp
- fi
-
- # PROGRESS_LOG_TO_FILE is either yes, or unset. (@TODO: this is still used in buildpkg)
- if [[ $PROGRESS_LOG_TO_FILE != yes ]]; then unset PROGRESS_LOG_TO_FILE; fi
-
export SHOW_WARNING=yes # If you try something that requires EXPERT=yes.
display_alert "Starting single build process" "${BOARD}" "info"
diff --git a/lib/functions/main/rootfs-image.sh b/lib/functions/main/rootfs-image.sh
index a43659f43..270145b04 100644
--- a/lib/functions/main/rootfs-image.sh
+++ b/lib/functions/main/rootfs-image.sh
@@ -68,7 +68,8 @@ function build_rootfs_and_image() {
LOG_SECTION="rootfs_apt_get_autoremove" do_with_logging apt_purge_unneeded_packages
# create list of installed packages for debug purposes
- chroot $SDCARD /bin/bash -c "dpkg --get-selections" | grep -v deinstall | awk '{print $1}' | cut -f1 -d':' > $DEST/${LOG_SUBPATH}/installed-packages-${RELEASE}$([[ ${BUILD_MINIMAL} == yes ]] && echo "-minimal")$([[ ${BUILD_DESKTOP} == yes ]] && echo "-desktop").list.log 2>&1
+ display_alert "Recording list of installed packages" "debug log" "debug"
+ chroot_sdcard dpkg --get-selections "| grep -v deinstall | awk '{print \$1}' | cut -f1 -d':' 1>&2"
# clean up / prepare for making the image
umount_chroot "$SDCARD"
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index 7732a5b80..4188a6a48 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -1,4 +1,4 @@
-install_distribution_agnostic() {
+function install_distribution_agnostic() {
display_alert "Installing distro-agnostic part of rootfs" "install_distribution_agnostic" "debug"
# install rootfs encryption related packages separate to not break packages cache
diff --git a/lib/functions/rootfs/rootfs-desktop.sh b/lib/functions/rootfs/rootfs-desktop.sh
index 3564d8df2..b0785949a 100644
--- a/lib/functions/rootfs/rootfs-desktop.sh
+++ b/lib/functions/rootfs/rootfs-desktop.sh
@@ -62,14 +62,10 @@ add_apt_sources() {
}
add_desktop_package_sources() {
-
- # Myy : I see Snap and Flatpak coming up in the next releases
- # so... let's prepare for that
add_apt_sources
chroot_sdcard_apt_get "update"
- ls -l "${SDCARD}/etc/apt/sources.list.d" >> "${DEST}/${LOG_SUBPATH}/desktop_packages_apt_sources.log"
- cat "${SDCARD}/etc/apt/sources.list" >> "${DEST}/${LOG_SUBPATH}/desktop_packages_apt_sources.log"
-
+ run_host_command_logged ls -l "${SDCARD}/etc/apt/sources.list.d"
+ run_host_command_logged cat "${SDCARD}/etc/apt/sources.list"
}
# a-kind-of-hook, called by install_distribution_agnostic() if it's a desktop build
From 11d89f69e44b97e6f494a92ea688099f2c9b8370 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 28 Feb 2022 20:36:55 +0100
Subject: [PATCH] logging: blue groups if `SHOW_DEBUG=yes` or `SHOW_GROUPS=yes`
(console equivalent of CI's avocado)
---
lib/functions/logging/logging.sh | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index cb6876420..e73a6e2d5 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -50,8 +50,10 @@ function start_logging_section() {
mkdir -p "${CURRENT_LOGGING_DIR}"
# Markers for CI (GitHub Actions); CI env var comes predefined as true there.
- if [[ "${CI}" == "true" ]]; then
+ if [[ "${CI}" == "true" ]]; then # On CI, this has special meaning.
echo "::group::[🥑] Group ${CURRENT_LOGGING_SECTION}"
+ else
+ display_alert "start group" "<${CURRENT_LOGGING_SECTION}>" "group"
fi
return 0
}
@@ -60,6 +62,8 @@ function finish_logging_section() {
# Close opened CI group.
if [[ "${CI}" == "true" ]]; then
echo "::endgroup::"
+ else
+ display_alert "finish group" "</${CURRENT_LOGGING_SECTION}>" "group"
fi
}
@@ -156,6 +160,14 @@ function display_alert() {
inline_logs_color="\e[1;33m"
;;
+ group)
+ if [[ "${SHOW_DEBUG}" != "yes" && "${SHOW_GROUPS}" != "yes" ]]; then # show when debugging, or when specifically requested
+ return 0
+ fi
+ level_indicator="🦋"
+ inline_logs_color="\e[1;36m" # cyan
+ ;;
+
command)
if [[ "${SHOW_COMMAND}" != "yes" ]]; then # enable to log all calls to external cmds
return 0
From c3f70639f0f0323baef75950f664e10517ef94fb Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 28 Feb 2022 17:20:18 +0100
Subject: [PATCH] armbian-next: shut down some too-verbose logging: logo
building and update-initramfs
---
lib/functions/image/initrd.sh | 3 ++-
lib/functions/rootfs/boot_logo.sh | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/functions/image/initrd.sh b/lib/functions/image/initrd.sh
index 8c90321a1..a3ea4b186 100644
--- a/lib/functions/image/initrd.sh
+++ b/lib/functions/image/initrd.sh
@@ -23,7 +23,8 @@ update_initramfs() {
cp "/usr/bin/$QEMU_BINARY" "$chroot_target/usr/bin"/
mount_chroot "$chroot_target/"
- chroot_custom_long_running "$chroot_target" "$update_initramfs_cmd" || {
+ local logging_filter="| grep --line-buffered -v -e '.xz' -e 'ORDER ignored' -e 'Adding binary' "
+ chroot_custom_long_running "$chroot_target" "$update_initramfs_cmd" "${logging_filter}" || {
exit_with_error "Updating initramfs FAILED"
}
display_alert "Updated initramfs." "${update_initramfs_cmd}" "info"
diff --git a/lib/functions/rootfs/boot_logo.sh b/lib/functions/rootfs/boot_logo.sh
index 4b5e98aa9..5b2861e57 100644
--- a/lib/functions/rootfs/boot_logo.sh
+++ b/lib/functions/rootfs/boot_logo.sh
@@ -102,7 +102,8 @@ function boot_logo() {
--blob "${SDCARD}"/tmp/throbber72.rgb \
--blob "${SDCARD}"/tmp/throbber73.rgb \
--blob "${SDCARD}"/tmp/throbber74.rgb \
- "${SDCARD}"/lib/firmware/bootsplash.armbian
+ "${SDCARD}"/lib/firmware/bootsplash.armbian \
+ "| grep --line-buffered -v -e 'File header' -e 'Picture header' -e 'Blob header' -e 'length:' -e 'type:' -e 'picture_id:' -e 'bg_' -e 'num_' -e '^$'"
if [[ $BOOT_LOGO == yes || $BOOT_LOGO == desktop && $BUILD_DESKTOP == yes ]]; then
[[ -f "${SDCARD}"/boot/armbianEnv.txt ]] && grep -q '^bootlogo' "${SDCARD}"/boot/armbianEnv.txt &&
From 9218d4a1196a4b7d0f303a972e2f5c293e789d90 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 28 Feb 2022 15:43:03 +0100
Subject: [PATCH] armbian-next: git/patching, kernel: use date from git as
mtime minimum for patched files
- use revision's date from git log as mtime for all fetch_from_repo
- fix patched files date at least checkout date, otherwise some patches never build
---
lib/functions/compilation/kernel.sh | 7 ++++
lib/functions/compilation/patch/fasthash.sh | 26 +++++++-------
lib/functions/compilation/patch/patching.sh | 56 +++++++++++++----------------
lib/functions/general/git.sh | 36 ++++++++++++-------
4 files changed, 67 insertions(+), 58 deletions(-)
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 54304e34f..68a748d46 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -43,7 +43,9 @@ function run_kernel_make_long_running() {
function compile_kernel() {
local kernel_work_dir="${SRC}/cache/sources/${LINUXSOURCEDIR}"
display_alert "Kernel build starting" "${LINUXSOURCEDIR}" "info"
+ declare checked_out_revision_mtime="" # set by fetch_from_repo
LOG_SECTION="kernel_prepare_git" do_with_logging do_with_hooks kernel_prepare_git
+ declare kernel_base_revision_mtime="${checked_out_revision_mtime}"
LOG_SECTION="kernel_maybe_clean" do_with_logging do_with_hooks kernel_maybe_clean
local version hash pre_patch_version
local kernel_packaging_target
@@ -66,6 +68,8 @@ function compile_kernel() {
function kernel_prepare_git() {
if [[ -n $KERNELSOURCE ]]; then
+ [[ -d "${kernel_work_dir}" ]] && "${kernel_work_dir}" && fasthash_debug "pre git, existing tree"
+
display_alert "Downloading sources" "kernel" "git"
# Does not work well with rpi for example: GIT_WARM_REMOTE_SHALLOW_AT_TAG="v${KERNEL_MAJOR_MINOR}" \
@@ -127,6 +131,9 @@ function kernel_patching() {
## - (always) produce a fasthash: represents "what would be done" (eg: md5 of a patch, crc32 of description).
## - (optionally) execute modification against living tree (eg: apply a patch, copy a file, etc). only if `DO_MODIFY=yes`
## - (always) call mark_change_commit with the description of what was done and fasthash.
+ declare -i patch_minimum_target_mtime="${kernel_base_revision_mtime}"
+ display_alert "patch_minimum_target_mtime:" "${patch_minimum_target_mtime}" "debug"
+
initialize_fasthash "kernel" "${hash}" "${pre_patch_version}" "${kernel_work_dir}"
fasthash_debug "init"
diff --git a/lib/functions/compilation/patch/fasthash.sh b/lib/functions/compilation/patch/fasthash.sh
index 0e0cc60f3..8158ab477 100644
--- a/lib/functions/compilation/patch/fasthash.sh
+++ b/lib/functions/compilation/patch/fasthash.sh
@@ -20,7 +20,7 @@ function report_fasthash() {
function initialize_fasthash() {
display_alert "initialize_fasthash" "$*" "debug"
return 0
- declare -a fast_hash_list=()
+ declare -a fast_hash_list=() # @TODO: declaring here won't do it any good, this is a shared var
}
function fasthash_branch() {
@@ -43,25 +43,25 @@ function fasthash_debug() {
sort -n | tail -n 10 1>&2
}
-function get_file_modification_time() {
- local file_date
+function get_file_modification_time() { # @TODO: This is almost always called from a subshell. No use throwing errors?
+ local -i file_date
if [[ ! -f "${1}" ]]; then
exit_with_error "Can't get modification time of nonexisting file" "${1}"
+ return 1
fi
-
- # [[CC]YY]MMDDhhmm.[ss] - it is NOT a valid integer
- file_date=$(date +%Y%m%d%H%M.%S -r "${1}")
- display_alert "Got date ${file_date} for file" "${1}" "debug"
-
- # @TODO: if MIN_PATCH_AGE
+ # YYYYMMDDhhmm.ss - it is NOT a valid integer, but is what 'touch' wants for its "-t" parameter
+ # YYYYMMDDhhmmss - IS a valid integer and we can do math to it. 'touch' code will format it later
+ file_date=$(date +%Y%m%d%H%M%S -r "${1}")
echo -n "${file_date}"
-
return 0
}
+# This is for simple "set without thinking" usage, date preservation is done directly by process_patch_file
function set_files_modification_time() {
- local mtime="${1}"
+ local -i mtime="${1}"
+ local formatted_mtime
shift
- display_alert "Setting date ${mtime} " "${*}" "debug"
- touch -m -t "${mtime}" "${@}"
+ display_alert "Setting date ${mtime}" "${*} (no newer check)" "debug"
+ formatted_mtime="${mtime:0:12}.${mtime:12}"
+ touch --no-create -m -t "${formatted_mtime}" "${@}"
}
diff --git a/lib/functions/compilation/patch/patching.sh b/lib/functions/compilation/patch/patching.sh
index 32351d1b8..df253d969 100644
--- a/lib/functions/compilation/patch/patching.sh
+++ b/lib/functions/compilation/patch/patching.sh
@@ -81,49 +81,41 @@ advanced_patch() {
# <status>: additional status text
#
process_patch_file() {
- local patch=$1
- local status=$2
- local patch_date
-
- # get the modification date of the patch. make it not less than MIN_PATCH_AGE, if set.
- # [[CC]YY]MMDDhhmm[.ss] time format
- patch_date=$(get_file_modification_time "${patch}")
-
- # detect and remove files which patch will create
- lsdiff -s --strip=1 "${patch}" | grep '^+' | awk '{print $2}' | xargs -I % sh -c 'rm -f %'
-
- # store an array of the files that patch will modify, we'll set their modification times after the fact
- declare -a patched_files
- mapfile -t patched_files < <(lsdiff -s --strip=1 "${patch}" | awk '{print $2}')
-
- # @TODO: try patching with `git am` first, so git contains the patch commit info/msg. -- For future git-based hashing.
- # shellcheck disable=SC2015 # noted, thanks. I need to handle exit code here.
- patch --batch -p1 -N < "${patch}" && {
- set_files_modification_time "${patch_date}" "${patched_files[@]}"
- display_alert "* $status $(basename "${patch}")" "" "info"
- } || {
- display_alert "* $status $(basename "${patch}")" "failed" "wrn"
- [[ $EXIT_PATCHING_ERROR == yes ]] && exit_with_error "Aborting due to" "EXIT_PATCHING_ERROR"
- }
- return 0 # short-circuit above, avoid exiting with error
-}
-function new_process_patch_file() {
- local patch="$1" # full filename
- local status="$2" # message, may contain ANSI
+ local patch="${1}"
+ local status="${2}"
+ local -i patch_date
local relative_patch="${patch##"${SRC}"/}" # ${FOO##prefix} remove prefix from FOO
# report_fashtash_should_execute is report_fasthash returns true only if we're supposed to apply the patch on disk.
if report_fashtash_should_execute file "${patch}" "Apply patch ${relative_patch}"; then
+
+ # get the modification date of the patch. make it not less than MIN_PATCH_AGE, if set.
+ patch_date=$(get_file_modification_time "${patch}")
+ # shellcheck disable=SC2154 # patch_minimum_target_mtime can be declared in outer scope
+ if [[ "${patch_minimum_target_mtime}" != "" ]]; then
+ if [[ ${patch_date} -lt ${patch_minimum_target_mtime} ]]; then
+ display_alert "Patch before minimum date" "${patch_date} -lt ${patch_minimum_target_mtime}" "debug"
+ patch_date=${patch_minimum_target_mtime}
+ fi
+ fi
+
# detect and remove files which patch will create
lsdiff -s --strip=1 "${patch}" | grep '^+' | awk '{print $2}' | xargs -I % sh -c 'rm -f %'
+ # store an array of the files that patch will add or modify, we'll set their modification times after the fact
+ declare -a patched_files
+ mapfile -t patched_files < <(lsdiff -s --strip=1 "${patch}" | grep -e '^+' -e '^!' | awk '{print $2}')
+
# @TODO: try patching with `git am` first, so git contains the patch commit info/msg. -- For future git-based hashing.
# shellcheck disable=SC2015 # noted, thanks. I need to handle exit code here.
patch --batch -p1 -N < "${patch}" && {
- display_alert "* ${status} ${relative_patch}" "" "info" || true
+ # Fix the dates.
+ set_files_modification_time "${patch_date}" "${patched_files[@]}"
+
+ display_alert "* $status ${relative_patch}" "" "info"
} || {
- display_alert "* ${status} ${relative_patch}" "failed" "wrn"
- [[ $EXIT_PATCHING_ERROR == yes ]] && exit_with_error "Aborting due to EXIT_PATCHING_ERROR" "Patch ${relative_patch} failed"
+ display_alert "* $status ${relative_patch}" "failed" "wrn"
+ [[ $EXIT_PATCHING_ERROR == yes ]] && exit_with_error "Aborting due to" "EXIT_PATCHING_ERROR"
}
mark_fasthash_done # will do git commit, associate fasthash to real hash.
fi
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index 73c066be4..c4477ca0a 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -138,6 +138,8 @@ fetch_from_repo() {
fi # offline
+ local checkout_from="HEAD" # Probably best to use the local revision?
+
if [[ "${changed}" == "true" ]]; then
git_handle_cold_and_warm_bundle_remotes # Delegate to function to find or create cache if appropriate.
@@ -153,21 +155,25 @@ fetch_from_repo() {
head) improved_git_fetch --no-tags origin HEAD ;;
esac
display_alert "Origin fetch completed, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size again
-
- display_alert "Checking out" "$dir $ref_name"
- regular_git checkout -f -q FETCH_HEAD
- regular_git clean -q -d -f
- display_alert "After checkout, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after bundle pull
-
- elif [[ -n $(git status -uno --porcelain --ignore-submodules=all) ]]; then # if not changed, but dirty...
- display_alert "Cleaning git dir" "$(git status -s | wc -l) files" # working directory is not clean, show it
- regular_git checkout -f -q HEAD # Return the files that are tracked by git to the initial state.
- regular_git clean -q -d -f # Files that are not tracked by git and were added when the patch was applied must be removed.
- else # not changed, not dirty.
- display_alert "Up to date" "$dir $ref_name at revision ${local_hash}" # working directory is clean, nothing to do
+ checkout_from="FETCH_HEAD"
fi
- display_alert "Final working copy size" "$(du -h -s | awk '{print $1}')" "debug"
+ # should be declared in outside scope, so can be read.
+ checked_out_revision_mtime="$(git log --date='format:%Y%m%d%H%M%S' --format='format:%ad' -1 "${checkout_from}")"
+ display_alert "checked_out_revision_mtime set!" "${checked_out_revision_mtime}" "debug"
+
+ display_alert "Cleaning git dir" "$(git status -s 2> /dev/null | wc -l) files" # working directory is not clean, show it
+
+ fasthash_debug "before git checkout of $dir $ref_name" # fasthash interested in this
+ regular_git checkout -f -q "${checkout_from}" # Return the files that are tracked by git to the initial state.
+
+ fasthash_debug "before git clean of $dir $ref_name"
+ regular_git clean -q -d -f # Files that are not tracked by git and were added when the patch was applied must be removed.
+
+ # set the checkout date on all the versioned files.
+ git ls-tree -r -z --name-only "${checkout_from}" | xargs -0 -- touch -m -t "${checked_out_revision_mtime:0:12}.${checked_out_revision_mtime:12}"
+
+ fasthash_debug "after setting checkout time for $dir $ref_name" #yeah
if [[ -f .gitmodules ]]; then
display_alert "Updating submodules" "" "ext"
@@ -182,9 +188,13 @@ fetch_from_repo() {
else
sref="head"
fi
+ # @TODO: in case of the bundle stuff this will fail terribly
fetch_from_repo "$surl" "$workdir/$i" "$sref"
done
fi
+
+ display_alert "Final working copy size" "$(du -h -s | awk '{print $1}')" "debug"
+ fasthash_debug "at the end of fetch_from_repo $dir $ref_name"
}
function git_fetch_from_bundle_file() {
From 839e3ab254e7d5f91fa5eeb1f456e66bf0483a1c Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 28 Feb 2022 00:20:41 +0100
Subject: [PATCH] armbian-next: first attempt at kernel packaging rework; just
linux-image pkg, no dtbs yet
- correctly predict KERNELRELEASE, put image-dtbs in the right spot for flash-kernel
- remove dpkg-gencontrol, do it all directly
---
lib/functions/compilation/kernel-debs.sh | 154 ++++++++++++++++++++++++++
lib/functions/compilation/kernel.sh | 92 +++++++++------
lib/functions/compilation/patch/kernel-pkg.sh | 3 +
lib/library-functions.sh | 9 ++
4 files changed, 227 insertions(+), 31 deletions(-)
diff --git a/lib/functions/compilation/kernel-debs.sh b/lib/functions/compilation/kernel-debs.sh
new file mode 100644
index 000000000..26a9bc3cd
--- /dev/null
+++ b/lib/functions/compilation/kernel-debs.sh
@@ -0,0 +1,154 @@
+# This is a re-imagining of mkdebian and builddeb from the kernel tree.
+
+# We wanna produce Debian/Ubuntu compatible packages so we're able to use their standard tools, like
+# `flash-kernel`, `u-boot-menu`, `grub2`, and others, so we gotta stick to their conventions.
+
+# Headers are important. We wanna be compatible with `dkms` stuff from Ubuntu, like `nvidia-driver-xxx`.
+# This is affected by cross-compilation: Armbian usually builds arm64 on amd64, and the KBUILD tools
+# that would be included in such headers package will be the wrong arch for `dkms`ing on target arm64 machine.
+
+# The main difference is that this is NOT invoked from KBUILD's Makefile, but instead
+# directly by Armbian, with references to the dirs where KBUILD's
+# `make install dtbs_install modules_install headers_install` have already successfully been run.
+
+# This will create a SET of packages. It should always create these:
+# image package: vmlinuz and such, config, modules, and dtbs (if exist) in /usr/lib/xxx
+# libc header package: just the libc headers
+# linux-headers package: just the image headers. (what about the binaries? cross compilation?)
+# linux-dtbs package: only dtbs, if they exist. in /boot/
+
+# So this will handle
+# - Creating .deb package skeleton dir (mktemp)
+# - Moving/copying around of KBUILD installed stuff for Debian/Ubuntu/Armbian standard locations, in the correct packages
+# - Separating headers, between image and libc packages.
+# - Fixing the symlinks to stuff so they fit a target system.
+# - building the .debs;
+
+is_enabled() {
+ grep -q "^$1=y" include/config/auto.conf
+}
+
+if_enabled_echo() {
+ if is_enabled "$1"; then
+ echo -n "$2"
+ elif [ $# -ge 3 ]; then
+ echo -n "$3"
+ fi
+}
+
+function prepare_kernel_packaging_debs() {
+ declare kernel_work_dir="${1}"
+ declare kernel_version="${2}"
+ declare -n tmp_kernel_install_dirs="${3}" # nameref to declare -n kernel_install_dirs dictionary
+ declare kernel_package_dir
+
+ kernel_package_dir=$(mktemp -d "${WORKDIR}/kernel.image.package.XXXXXXXXX") # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
+ display_alert "kernel_package_dir" "${kernel_package_dir}" "debug"
+
+ # Some variables and settings used throughout the script
+ declare kernel_version_family="${kernel_version}-${LINUXFAMILY}"
+ declare packageversion="${REVISION}"
+ declare linux_image_package_name="linux-image-${BRANCH}-${LINUXFAMILY}"
+
+ mkdir -p "${kernel_package_dir}/DEBIAN"
+
+ # Generate copyright file
+ mkdir -p "${kernel_package_dir}/usr/share/doc/${linux_image_package_name}"
+ cat <<- EOF > "${kernel_package_dir}/usr/share/doc/${linux_image_package_name}/copyright"
+ This is a packaged Armbian patched version of the Linux kernel.
+
+ The sources may be found at most Linux archive sites, including:
+ https://www.kernel.org/pub/linux/kernel
+
+ Copyright: 1991 - 2018 Linus Torvalds and others.
+
+ The git repository for mainline kernel development is at:
+ git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 dated June, 1991.
+
+ On Debian GNU/Linux systems, the complete text of the GNU General Public
+ License version 2 can be found in \`/usr/share/common-licenses/GPL-2'.
+ EOF
+
+ # Generate a control file
+ cat <<- EOF > "${kernel_package_dir}/DEBIAN/control"
+ Package: ${linux_image_package_name}
+ Version: ${packageversion}
+ Architecture: ${ARCH}
+ Maintainer: ${MAINTAINER} <${MAINTAINERMAIL}>
+ Section: kernel
+ Provides: linux-image, linux-image-armbian, armbian-$BRANCH
+ Description: Linux kernel, armbian version $kernel_version_family $BRANCH
+ This package contains the Linux kernel, modules and corresponding other
+ files, kernel_version_family: $kernel_version_family.
+ EOF
+
+ # Install the maintainer scripts
+ # Note: hook scripts under /etc/kernel are also executed by official Debian
+ # kernel packages, as well as kernel packages built using make-kpkg.
+ # make-kpkg sets $INITRD to indicate whether an initramfs is wanted, and
+ # so do we; recent versions of dracut and initramfs-tools will obey this.
+ declare debhookdir="/etc/kernel"
+ for script in postinst postrm preinst prerm; do
+ mkdir -p "${kernel_package_dir}${debhookdir}/${script}.d"
+ cat <<- EOF > "${kernel_package_dir}/DEBIAN/${script}"
+ #!/bin/bash
+ set -x
+ set -e
+
+ # Pass maintainer script parameters to hook scripts
+ export DEB_MAINT_PARAMS="\$*"
+
+ # Tell initramfs builder whether it's wanted
+ export INITRD=$(if_enabled_echo CONFIG_BLK_DEV_INITRD Yes No)
+
+ test -d $debhookdir/$script.d && run-parts --arg="$kernel_version_family" --arg="/$installed_image_path" $debhookdir/$script.d
+ exit 0
+ EOF
+ chmod 755 "${kernel_package_dir}/DEBIAN/${script}"
+ done
+
+ display_alert "tmp_kernel_install_dirs INSTALL_PATH:" "${tmp_kernel_install_dirs[INSTALL_PATH]}" "debug"
+ display_alert "tmp_kernel_install_dirs INSTALL_MOD_PATH:" "${tmp_kernel_install_dirs[INSTALL_MOD_PATH]}" "debug"
+ display_alert "tmp_kernel_install_dirs INSTALL_HDR_PATH:" "${tmp_kernel_install_dirs[INSTALL_HDR_PATH]}" "debug"
+
+ display_alert "Kernel install dir" "tree 1" "debug"
+ run_host_command_logged tree -C -h --du -d -L 3 "${tmp_kernel_install_dirs[INSTALL_PATH]}/../.."
+
+ run_host_command_logged cp -rp "${tmp_kernel_install_dirs[INSTALL_PATH]}" "${kernel_package_dir}/" # /boot stuff
+ run_host_command_logged cp -rp "${tmp_kernel_install_dirs[INSTALL_MOD_PATH]}/lib" "${kernel_package_dir}/" # so "lib" stuff sits at the root
+
+ if [[ -d "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}" ]]; then
+ display_alert "tmp_kernel_install_dirs INSTALL_DTBS_PATH:" "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}" "debug"
+ display_alert "Kernel build will produce DTBs package!" "DTBs YES PACKAGE" "debug"
+
+ # /usr/lib/linux-image-${kernel_version_family} is wanted by flash-kernel
+ # /lib/firmware/${kernel_version_family}/device-tree/ would also be acceptable
+ mkdir -p "${kernel_package_dir}/usr/lib"
+ run_host_command_logged cp -rp "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}" "${kernel_package_dir}/usr/lib/linux-image-${kernel_version_family}"
+ fi
+
+ run_host_command_logged chown -R root:root "${kernel_package_dir}" # Fix ownership and permissions
+ run_host_command_logged chmod -R go-w "${kernel_package_dir}" # Fix ownership and permissions
+ run_host_command_logged chmod -R a+rX "${kernel_package_dir}" # in case we are in a restrictive umask environment like 0077
+ run_host_command_logged chmod -R ug-s "${kernel_package_dir}" # in case we build in a setuid/setgid directory
+
+ cd "${kernel_package_dir}" || exit_with_error "major failure 774"
+
+ # create md5sums file. needed? @TODO: convert to subshell?
+ sh -c "cd '${kernel_package_dir}'; find . -type f ! -path './DEBIAN/*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums"
+
+ declare unpacked_size
+ unpacked_size="$(du -h -s "${kernel_package_dir}" | awk '{print $1}')"
+ display_alert "Unpacked linux-kernel image" "${unpacked_size}" "debug"
+
+ # Show it
+ display_alert "Package dir" "tree 2" "debug"
+ run_host_command_logged tree -C -h --du -d -L 3 "${kernel_package_dir}"
+
+ run_host_command_logged dpkg-deb ${DEB_COMPRESS:+-Z$DEB_COMPRESS} --build "${kernel_package_dir}" "${kernel_work_dir}/.." # not KDEB compress, we're not under a Makefile
+
+}
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 8c5db9e92..54304e34f 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -9,20 +9,19 @@ function run_kernel_make() {
)
common_make_params_quoted=(
- "$CTHREADS" # Parallel compile, "-j X" for X cpus
- "LOCALVERSION=-${LINUXFAMILY}" # Kernel param
- "KDEB_PKGVERSION=${REVISION}" # deb package version
- "KDEB_COMPRESS=${DEB_COMPRESS}" # dpkg compression for deb
- "BRANCH=${BRANCH}" # @TODO: rpardini: Wonder what BRANCH is used for during packaging?
- "INSTALL_HDR_PATH=debian/hdrtmp/usr" # For packaging headers_install used for headers
- "INSTALL_MOD_PATH=debian/tmp" # For packaging modules for image package
- "INSTALL_DTBS_PATH=debian/dtbtmp/boot/dtbs_install" # For packaging DTBs for dtb package
- "ARCH=${ARCHITECTURE}" # Why?
- "KBUILD_DEBARCH=${ARCH}" # Where used?
- "DEBFULLNAME=${MAINTAINER}" # For changelog generation
- "DEBEMAIL=${MAINTAINERMAIL}" # idem
- "CROSS_COMPILE=${CCACHE} ${KERNEL_COMPILER}" # Prefix for tool invocations.
- "KCFLAGS=-fdiagnostics-color=always" # Force GCC colored messages.
+ "$CTHREADS" # Parallel compile, "-j X" for X cpus
+ "ARCH=${ARCHITECTURE}" # Key param. Everything depends on this.
+ "LOCALVERSION=-${LINUXFAMILY}" # Change the internal kernel version to include the family.?
+
+ "BRANCH=${BRANCH}" # For mkdebian/builddep packaging only
+ "KBUILD_DEBARCH=${ARCH}" # For mkdebian/builddep packaging only
+ "KDEB_PKGVERSION=${REVISION}" # For mkdebian/builddep packaging only
+ "KDEB_COMPRESS=${DEB_COMPRESS}" # For mkdebian/builddep packaging only
+ "DEBFULLNAME=${MAINTAINER}" # For mkdebian/builddep packaging only
+ "DEBEMAIL=${MAINTAINERMAIL}" # For mkdebian/builddep packaging only
+ "CROSS_COMPILE=${CCACHE} ${KERNEL_COMPILER}" # For mkdebian/builddep packaging only
+
+ "KCFLAGS=-fdiagnostics-color=always" # Force GCC colored messages.
)
# last statement, so it passes the result to calling function.
@@ -58,8 +57,9 @@ function compile_kernel() {
LOG_SECTION="kernel_make_headers_dtbs_image_modules" do_with_logging do_with_hooks kernel_make_headers_dtbs_image_modules
LOG_SECTION="kernel_package" do_with_logging do_with_hooks kernel_package
display_alert "Done with" "kernel compile" "debug"
- cd .. || exit
+ cd "${kernel_work_dir}/.." || exit
rm -f linux-firmware-image-*.deb # remove firmware image packages here - easier than patching ~40 packaging scripts at once
+ #run_host_command_logged dpkg-deb --contents ./*.deb || true
rsync --remove-source-files -rq ./*.deb "${DEB_STORAGE}/" || exit_with_error "Failed moving kernel DEBs"
return 0
}
@@ -323,30 +323,60 @@ function kernel_make_headers_dtbs_image_modules() {
}
function kernel_package() {
+ cd "${kernel_work_dir}"
+
+ declare kernel_dest_install_dir
+ kernel_dest_install_dir=$(mktemp -d "${WORKDIR}/kernel.temp.install.target.XXXXXXXXX") # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
+
+ # define dict with vars passed and target directories
+ declare -A kernel_install_dirs=(
+ ["INSTALL_PATH"]="${kernel_dest_install_dir}/image/boot" # Used by `make install`
+ ["INSTALL_HDR_PATH"]="${kernel_dest_install_dir}/headers" # Used by `make headers_install`
+ ["INSTALL_MOD_PATH"]="${kernel_dest_install_dir}/modules" # Used by `make modules_install`
+ )
+
+ local -a prepackage_targets=(install modules_install headers_install)
+ if [[ "${KERNEL_BUILD_DTBS:-yes}" == "yes" ]]; then
+ display_alert "Kernel build will produce DTBs!" "DTBs YES" "debug"
+ prepackage_targets+=("dtbs_install")
+ kernel_install_dirs+=(["INSTALL_DTBS_PATH"]="${kernel_dest_install_dir}/dtbs") # Used by `make dtbs_install`
+ fi
- local -a prepackage_targets=(modules_install headers_install)
- [[ "${KERNEL_BUILD_DTBS:-yes}" == "yes" ]] && prepackage_targets+=("dtbs_install")
+ display_alert "Packaging Kernel" "${LINUXCONFIG} $kernel_packaging_target at ${kernel_dest_install_dir}" "info"
- display_alert "Packaging Kernel" "${LINUXCONFIG} $kernel_packaging_target" "info"
+ # loop over the keys above, get the value, create param value in array; also mkdir the dir
+ declare -a install_make_params_quoted
+ local dir_key
+ for dir_key in "${!kernel_install_dirs[@]}"; do
+ local dir="${kernel_install_dirs["${dir_key}"]}"
+ local value="${dir_key}=${dir}"
+ mkdir -p "${dir}"
+ display_alert "Adding kernel packaging param" "${value}" "debug"
+ install_make_params_quoted+=("${value}")
+ done
+ # See https://www.kernel.org/doc/Documentation/kbuild/headers_install.txt
# Prepare for packaging, using the exact same options as original compile.
display_alert "Installing kernel headers and modules for packaging" "${LINUXCONFIG} ${prepackage_targets[*]}" "info"
fasthash_debug "pre-prepackage"
- make_filter="| grep --line-buffered -v -e 'INSTALL' -e 'SIGN' -e 'XZ'" run_kernel_make_long_running "${prepackage_targets[@]}"
+ make_filter="| grep --line-buffered -v -e 'INSTALL' -e 'SIGN' -e 'XZ'" run_kernel_make_long_running "${install_make_params_quoted[@]@Q}" "${prepackage_targets[@]}"
fasthash_debug "post-prepackage"
- # produce deb packages: image, headers, firmware, dtb
- # This mostly only does
- fasthash_debug "pre-packaging"
- run_kernel_make_long_running $kernel_packaging_target
- fasthash_debug "post-packaging"
-
- if [[ "${DOUBLE_COMPILE_KERNEL}" == "yes" ]]; then
- display_alert "DOUBLE Packaging Kernel, Headers and DTBs" "${LINUXCONFIG} $kernel_packaging_target" "info"
- fasthash_debug "pre-double-packaging"
- run_kernel_make_long_running $kernel_packaging_target
- fasthash_debug "post-double-packaging"
- fi
+ cd "${kernel_work_dir}"
+ prepare_kernel_packaging_debs "${kernel_work_dir}" "${version}" kernel_install_dirs
+
+ ### # produce deb packages: image, headers, firmware, dtb
+ ### # This mostly only does
+ ### fasthash_debug "pre-packaging"
+ ### run_kernel_make_long_running "${install_make_params_quoted[@]@Q}" $kernel_packaging_target
+ ### fasthash_debug "post-packaging"
+ ###
+ ### if [[ "${DOUBLE_COMPILE_KERNEL}" == "yes" ]]; then
+ ### display_alert "DOUBLE Packaging Kernel, Headers and DTBs" "${LINUXCONFIG} $kernel_packaging_target" "info"
+ ### fasthash_debug "pre-double-packaging"
+ ### run_kernel_make_long_running $kernel_packaging_target
+ ### fasthash_debug "post-double-packaging"
+ ### fi
display_alert "Package building done" "${LINUXCONFIG} $kernel_packaging_target" "info"
}
diff --git a/lib/functions/compilation/patch/kernel-pkg.sh b/lib/functions/compilation/patch/kernel-pkg.sh
index e1653a66e..51e163b1e 100644
--- a/lib/functions/compilation/patch/kernel-pkg.sh
+++ b/lib/functions/compilation/patch/kernel-pkg.sh
@@ -7,6 +7,9 @@ function apply_kernel_patches_for_packaging() {
# Temporally set for new "default->legacy,next->current" family naming
if linux-version compare "${version}" ge 5.10; then
+ display_alert "NOT using old packaging mkdebian etc" "skipping mkdebian patching" "warn"
+ return 0 # Not anymore for new packaging.
+
# This case is special: it does not use process_patch_file. fasthash manually.
local builddeb="packages/armbian/builddeb"
local mkdebian="packages/armbian/mkdebian"
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index 6b14c18a2..75771db01 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -64,6 +64,15 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/compilation/debs.sh
source "${SRC}"/lib/functions/compilation/debs.sh
+# no errors tolerated. invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/compilation/kernel-debs.sh
+# shellcheck source=lib/functions/compilation/kernel-debs.sh
+source "${SRC}"/lib/functions/compilation/kernel-debs.sh
+
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
From 477926aac9205e2b7bc07c14e2727730eba11a27 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 25 Feb 2022 22:49:47 +0100
Subject: [PATCH] armbian-next: rework kernel source packaging, now exporting
from git, to .tar.zst
- compress with zstdmt (multi-thread zstd), remove pv indicator, it's much faster anyway
- export from git (soon will have all patches et al too)
- better logging, show pkg name
- much, much faster due to zstdmt and deb with none compression
---
lib/functions/compilation/kernel.sh | 51 +++++++++++++++++--------------------
1 file changed, 24 insertions(+), 27 deletions(-)
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index e4cb38908..8c5db9e92 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -22,13 +22,12 @@ function run_kernel_make() {
"DEBFULLNAME=${MAINTAINER}" # For changelog generation
"DEBEMAIL=${MAINTAINERMAIL}" # idem
"CROSS_COMPILE=${CCACHE} ${KERNEL_COMPILER}" # Prefix for tool invocations.
+ "KCFLAGS=-fdiagnostics-color=always" # Force GCC colored messages.
)
- common_make_params_quoted+=("KCFLAGS=-fdiagnostics-color=always") # Force GCC colored messages.
-
# last statement, so it passes the result to calling function.
full_command=("${KERNEL_MAKE_RUNNER:-run_host_command_logged}" "${common_make_envs[@]}"
- make "$@" "${common_make_params_quoted[@]@Q}" "${make_filter}")
+ make "${common_make_params_quoted[@]@Q}" "$@" "${make_filter}")
"${full_command[@]}" # and exit with it's code, since it's the last statement
}
@@ -254,38 +253,37 @@ function kernel_config() {
}
function kernel_package_source() {
- # create linux-source package - with already patched sources
- # We will build this package first and clear the memory.
- if [[ $BUILD_KSRC != no ]]; then
- display_alert "Creating kernel source package" "${LINUXCONFIG}" "info"
- create_linux-source_package
- fi
-}
+ [[ "${BUILD_KSRC}" != "yes" ]] && return 0
+
+ display_alert "Creating kernel source package" "${LINUXCONFIG}" "info"
-create_linux-source_package() {
- ts=$(date +%s)
- local sources_pkg_dir tmp_src_dir
+ local ts=${SECONDS}
+ local sources_pkg_dir tmp_src_dir tarball_size package_size
tmp_src_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
sources_pkg_dir=${tmp_src_dir}/${CHOSEN_KSRC}_${REVISION}_all
mkdir -p "${sources_pkg_dir}"/usr/src/ \
- "${sources_pkg_dir}"/usr/share/doc/linux-source-${version}-${LINUXFAMILY} \
+ "${sources_pkg_dir}/usr/share/doc/linux-source-${version}-${LINUXFAMILY}" \
"${sources_pkg_dir}"/DEBIAN
- cp "${SRC}/config/kernel/${LINUXCONFIG}.config" "default_${LINUXCONFIG}.config"
- xz < .config > "${sources_pkg_dir}/usr/src/${LINUXCONFIG}_${version}_${REVISION}_config.xz"
+ run_host_command_logged cp -v "${SRC}/config/kernel/${LINUXCONFIG}.config" "${sources_pkg_dir}/usr/src/${LINUXCONFIG}_${version}_${REVISION}_config"
+ run_host_command_logged cp -v COPYING "${sources_pkg_dir}/usr/share/doc/linux-source-${version}-${LINUXFAMILY}/LICENSE"
- display_alert "Compressing sources for the linux-source package"
- tar cp --directory="$kernel_work_dir" --exclude='.git' --owner=root . |
- pv -N "$(logging_echo_prefix_for_pv "compress_kernel_sources") $display_name" -p -b -r -s "$(du -sb "$kernel_work_dir" --exclude=='.git' | cut -f1)" |
- pixz -0 > "${sources_pkg_dir}/usr/src/linux-source-${version}-${LINUXFAMILY}.tar.xz" # @TODO: .deb will compress this later. -0 for now, but should be a plain tar
- cp COPYING "${sources_pkg_dir}/usr/share/doc/linux-source-${version}-${LINUXFAMILY}/LICENSE"
+ display_alert "Compressing sources for the linux-source package" "exporting from git" "info"
+ cd "${kernel_work_dir}"
+
+ local tar_prefix="${version}/"
+ local output_tarball="${sources_pkg_dir}/usr/src/linux-source-${version}-${LINUXFAMILY}.tar.zst"
+
+ # export tar with `git archive`; we point it at HEAD, but could be anything else too
+ run_host_command_logged git archive "--prefix=${tar_prefix}" --format=tar HEAD "| zstdmt > '${output_tarball}'"
+ tarball_size="$(du -h -s "${output_tarball}" | awk '{print $1}')"
cat <<- EOF > "${sources_pkg_dir}"/DEBIAN/control
Package: linux-source-${version}-${BRANCH}-${LINUXFAMILY}
Version: ${version}-${BRANCH}-${LINUXFAMILY}+${REVISION}
Architecture: all
- Maintainer: $MAINTAINER <$MAINTAINERMAIL>
+ Maintainer: ${MAINTAINER} <${MAINTAINERMAIL}>
Section: kernel
Priority: optional
Depends: binutils, coreutils
@@ -294,11 +292,10 @@ create_linux-source_package() {
Description: This package provides the source code for the Linux kernel $version
EOF
- fakeroot_dpkg_deb_build -z0 "${sources_pkg_dir}" "${sources_pkg_dir}.deb"
- rsync --remove-source-files -rq "${sources_pkg_dir}.deb" "${DEB_STORAGE}/"
-
- te=$(date +%s)
- display_alert "Make the linux-source package" "$(($te - $ts)) sec." "info"
+ fakeroot_dpkg_deb_build -Znone -z0 "${sources_pkg_dir}" "${sources_pkg_dir}.deb" # do not compress .deb, it already contains a zstd compressed tarball! ignores ${KDEB_COMPRESS} on purpose
+ package_size="$(du -h -s "${sources_pkg_dir}.deb" | awk '{print $1}')"
+ run_host_command_logged rsync --remove-source-files -r "${sources_pkg_dir}.deb" "${DEB_STORAGE}/"
+ display_alert "linux-source-${version}-${BRANCH}-${LINUXFAMILY} packaged" "$((SECONDS - ts)) seconds, ${tarball_size} tarball, ${package_size} .deb" "info"
}
function kernel_make_headers_dtbs_image_modules() {
From d14b2a9265f92d47185047eb8520a956f6ce9ea4 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 25 Feb 2022 00:50:27 +0100
Subject: [PATCH] armbian-next: a bit atrocious, nameref loaded,
`get_list_of_all_buildable_boards()`
- in the process, add support for userpatches/config structure mirroring core, for easy upstreaming
---
lib/functions/compilation/kernel.sh | 3 ++
lib/functions/configuration/interactive.sh | 75 +++++++++++++++++++-----------
lib/functions/configuration/main-config.sh | 25 ++++++++--
lib/functions/main/config-prepare.sh | 31 ++++++------
4 files changed, 85 insertions(+), 49 deletions(-)
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 5cde24980..e4cb38908 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -189,6 +189,9 @@ function kernel_config() {
if [[ -f $USERPATCHES_PATH/$LINUXCONFIG.config ]]; then
display_alert "Using kernel config provided by user" "userpatches/$LINUXCONFIG.config" "info"
cp -p "${USERPATCHES_PATH}/${LINUXCONFIG}.config" .config
+ elif [[ -f "${USERPATCHES_PATH}/config/kernel/${LINUXCONFIG}.config" ]]; then
+ display_alert "Using kernel config provided by user in config/kernel folder" "config/kernel/${LINUXCONFIG}.config" "info"
+ cp -p "${USERPATCHES_PATH}/config/kernel/${LINUXCONFIG}.config" .config
else
display_alert "Using kernel config file" "config/kernel/$LINUXCONFIG.config" "info"
cp -p "${SRC}/config/kernel/${LINUXCONFIG}.config" .config
diff --git a/lib/functions/configuration/interactive.sh b/lib/functions/configuration/interactive.sh
index 165f6257f..325553433 100644
--- a/lib/functions/configuration/interactive.sh
+++ b/lib/functions/configuration/interactive.sh
@@ -39,8 +39,48 @@ function interactive_config_ask_kernel_configure() {
unset options
}
+# Required usage:
+# declare -a arr_all_board_names=() arr_all_board_options=() # arrays
+# declare -A dict_all_board_types=() dict_all_board_source_files=() dict_all_board_descriptions=() # dictionaries
+# get_list_of_all_buildable_boards arr_all_board_names arr_all_board_options dict_all_board_types dict_all_board_source_files dict_all_board_descriptions # invoke
+function get_list_of_all_buildable_boards() {
+ local -a board_types=("conf")
+ [[ "${WIP_STATE}" != "supported" ]] && board_types+=("wip" "csc" "eos" "tvb")
+ local -a board_file_paths=("${SRC}/config/boards" "${USERPATCHES_PATH}/config/boards")
+
+ # local -n is a name reference, see https://www.linuxjournal.com/content/whats-new-bash-parameter-expansion
+ # it works with arrays and associative arrays/dictionaries
+ local -n ref_arr_all_board_names="${1}"
+ [[ "${2}" != "" ]] && local -n ref_arr_all_board_options="${2}" # optional
+ local -n ref_dict_all_board_types="${3}"
+ local -n ref_dict_all_board_source_files="${4}"
+ [[ "${5}" != "" ]] && local -n ref_dict_all_board_descriptions="${5}" # optional
+
+ local board_file_path board_type full_board_file
+ for board_file_path in "${board_file_paths[@]}"; do
+ [[ ! -d "${board_file_path}" ]] && continue
+ for board_type in "${board_types[@]}"; do
+ for full_board_file in "${board_file_path}"/*."${board_type}"; do
+ [[ "${full_board_file}" == *"*"* ]] && continue # ignore non-matches, due to bash's (non-)globbing behaviour
+ local board_name board_desc
+ board_name="$(basename "${full_board_file}" | cut -d'.' -f1)"
+ ref_dict_all_board_types["${board_name}"]="${board_type}"
+ ref_dict_all_board_source_files["${board_name}"]="${ref_dict_all_board_source_files["${board_name}"]} ${full_board_file}" # accumulate, will have extra space
+
+ if [[ "${2}" != "" || "${5}" != "" ]]; then # only if second or fifth reference specified, otherwise too costly
+ board_desc="$(head -1 "${full_board_file}" | cut -d'#' -f2)"
+ ref_arr_all_board_options+=("${board_name}" "\Z1(${board_type})\Zn ${board_desc}")
+ ref_dict_all_board_descriptions["${board_name}"]="${board_desc}"
+ fi
+ done
+ done
+ done
+ ref_arr_all_board_names=("${!ref_dict_all_board_types[@]}") # Expand the keys of one of the dicts, that's the list of boards.
+ return 0
+}
+
function interactive_config_ask_board_list() {
- # if BOARD is not set, display selection menu
+ # if BOARD is not set, display selection menu, otherwise return success
[[ -n ${BOARD} ]] && return 0
WIP_STATE=supported
@@ -49,27 +89,11 @@ function interactive_config_ask_board_list() {
temp_rc=$(mktemp) # @TODO: this is a _very_ early call to mktemp - no TMPDIR set yet - it needs to be cleaned-up somehow
while true; do
- options=()
- if [[ $WIP_STATE == supported ]]; then
- for board in "${SRC}"/config/boards/*.conf; do
- options+=("$(basename "${board}" | cut -d'.' -f1)" "$(head -1 "${board}" | cut -d'#' -f2)")
- done
- else
- for board in "${SRC}"/config/boards/*.wip; do
- options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(WIP)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
- done
- for board in "${SRC}"/config/boards/*.csc; do
- options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(CSC)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
- done
- for board in "${SRC}"/config/boards/*.eos; do
- options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(EOS)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
- done
- for board in "${SRC}"/config/boards/*.tvb; do
- options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(TVB)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
- done
- fi
-
- if [[ $WIP_STATE != supported ]]; then
+ declare -a arr_all_board_names=() arr_all_board_options=() # arrays
+ declare -A dict_all_board_types=() dict_all_board_source_files=() dict_all_board_descriptions=() # dictionaries
+ get_list_of_all_buildable_boards arr_all_board_names arr_all_board_options dict_all_board_types dict_all_board_source_files dict_all_board_descriptions # invoke
+ echo > "${temp_rc}" # zero out the rcfile to start
+ if [[ $WIP_STATE != supported ]]; then # be if wip csc etc included. I personally disagree here.
cat <<- 'EOF' > "${temp_rc}"
dialog_color = (RED,WHITE,OFF)
screen_color = (WHITE,RED,ON)
@@ -78,14 +102,12 @@ function interactive_config_ask_board_list() {
tag_selected_color = (WHITE,RED,ON)
tag_key_selected_color = (WHITE,RED,ON)
EOF
- else
- echo > "${temp_rc}"
fi
DIALOGRC=$temp_rc \
dialog_if_terminal_set_vars --title "Choose a board" --backtitle "$backtitle" --scrollbar \
--colors --extra-label "Show $WIP_BUTTON" --extra-button \
- --menu "Select the target board. Displaying:\n$STATE_DESCRIPTION" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
+ --menu "Select the target board. Displaying:\n$STATE_DESCRIPTION" $TTY_Y $TTY_X $((TTY_Y - 8)) "${arr_all_board_options[@]}"
BOARD="${DIALOG_RESULT}"
STATUS=${DIALOG_EXIT_CODE}
@@ -101,7 +123,7 @@ function interactive_config_ask_board_list() {
STATE_DESCRIPTION=' - boards with high level of software maturity'
WIP_STATE=supported
WIP_BUTTON='CSC/WIP/EOS'
- EXPERT=no
+ EXPERT=no # @TODO: this overrides an "expert" mode that could be set on by the user. revert to original one?
fi
continue
elif [[ $STATUS == 0 ]]; then
@@ -109,7 +131,6 @@ function interactive_config_ask_board_list() {
else
exit_with_error "You cancelled interactive config" "Build cancelled, board not chosen"
fi
- unset options
done
}
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 4183d4041..b5b2e9ca5 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -190,19 +190,36 @@ function do_main_configuration() {
# single ext4 partition is the default and preferred configuration
#BOOTFS_TYPE=''
- [[ ! -f ${SRC}/config/sources/families/$LINUXFAMILY.conf ]] &&
- exit_with_error "Sources configuration not found" "$LINUXFAMILY"
- display_alert "Sourcing family configuration" "${LINUXFAMILY}.conf" "info"
- source "${SRC}/config/sources/families/${LINUXFAMILY}.conf"
+ ## ------ Sourcing family config ---------------------------
+ declare -a family_source_paths=("${SRC}/config/sources/families/${LINUXFAMILY}.conf" "${USERPATCHES_PATH}/config/sources/families/${LINUXFAMILY}.conf")
+ declare -i family_sourced_ok=0
+ for family_source_path in "${family_source_paths[@]}"; do
+ [[ ! -f "${family_source_path}" ]] && continue
+
+ display_alert "Sourcing family configuration" "${family_source_path}" "info"
+ # shellcheck source=/dev/null
+ source "${family_source_path}"
+
+ # @TODO: reset error handling, go figure what they do in there.
+
+ family_sourced_ok=$((family_sourced_ok + 1))
+ done
+
+ [[ ${family_sourced_ok} -lt 1 ]] &&
+ exit_with_error "Sources configuration not found" "tried ${family_source_paths[*]}"
+
+ # This is for compatibility only; path above should suffice
if [[ -f $USERPATCHES_PATH/sources/families/$LINUXFAMILY.conf ]]; then
display_alert "Adding user provided $LINUXFAMILY overrides"
+ # shellcheck source=/dev/null
source "$USERPATCHES_PATH/sources/families/${LINUXFAMILY}.conf"
fi
# load architecture defaults
display_alert "Sourcing arch configuration" "${ARCH}.conf" "info"
+ # shellcheck source=/dev/null
source "${SRC}/config/sources/${ARCH}.conf"
## Extensions: at this point we've sourced all the config files that will be used,
diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh
index e26f11b3f..cd795ccd2 100644
--- a/lib/functions/main/config-prepare.sh
+++ b/lib/functions/main/config-prepare.sh
@@ -83,29 +83,24 @@ function prepare_and_config_main_build_single() {
[[ -z $KERNEL_ONLY ]] && exit_with_error "No option selected: KERNEL_ONLY"
[[ -z $KERNEL_CONFIGURE ]] && exit_with_error "No option selected: KERNEL_CONFIGURE"
- interactive_config_ask_board_list # @TODO: rpardini: This obtains a list of boards. refactor that...
+ interactive_config_ask_board_list # this uses get_list_of_all_buildable_boards too
[[ -z $BOARD ]] && exit_with_error "No board selected: BOARD"
- if [[ -f $SRC/config/boards/${BOARD}.conf ]]; then
- BOARD_TYPE='conf'
- elif [[ -f $SRC/config/boards/${BOARD}.csc ]]; then
- BOARD_TYPE='csc'
- elif [[ -f $SRC/config/boards/${BOARD}.wip ]]; then
- BOARD_TYPE='wip'
- elif [[ -f $SRC/config/boards/${BOARD}.eos ]]; then
- BOARD_TYPE='eos'
- elif [[ -f $SRC/config/boards/${BOARD}.tvb ]]; then
- BOARD_TYPE='tvb'
- fi
+ declare -a arr_all_board_names=() # arrays
+ declare -A dict_all_board_types=() dict_all_board_source_files=() # dictionaries
+ get_list_of_all_buildable_boards arr_all_board_names "" dict_all_board_types dict_all_board_source_files "" # invoke
- # @TODO: rpardini: this is when Alice enters the hole. Sourcing stuff, extensions getting activated, etc.
+ BOARD_TYPE="${dict_all_board_types["${BOARD}"]}"
+ BOARD_SOURCE_FILES="${dict_all_board_source_files["${BOARD}"]}"
- display_alert "Sourcing board configuration" "${BOARD}.${BOARD_TYPE}" "info"
- # shellcheck source=/dev/null
- source "${SRC}/config/boards/${BOARD}.${BOARD_TYPE}"
- LINUXFAMILY="${BOARDFAMILY}" # @TODO: wtf? why? this is (100%?) rewritten by family config!
+ for BOARD_SOURCE_FILE in ${BOARD_SOURCE_FILES}; do # No quotes, so expand the space-delimited list
+ display_alert "Sourcing board configuration" "${BOARD_SOURCE_FILE}" "info"
+ # shellcheck source=/dev/null
+ source "${BOARD_SOURCE_FILE}"
+ done
- # @TODO: interesting. this sourced the board config. What sources the family? do_main_configuration!
+ LINUXFAMILY="${BOARDFAMILY}" # @TODO: wtf? why? this is (100%?) rewritten by family config!
+ # this sourced the board config. do_main_configuration will source the family file.
[[ -z $KERNEL_TARGET ]] && exit_with_error "Board configuration does not define valid kernel config"
From bc0d123dc5e1baf21a20ef86d5c4e32aff3aa931 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 24 Feb 2022 19:57:43 +0100
Subject: [PATCH] armbian-next: make `SKIP_EXTERNAL_TOOLCHAINS=yes` default.
lets see what breaks [WiP]
---
lib/functions/configuration/main-config.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 5aa637534..4183d4041 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -35,6 +35,7 @@ function do_main_configuration() {
[[ -z $MAINTAINER ]] && MAINTAINER="Igor Pecovnik" # deb signature
[[ -z $MAINTAINERMAIL ]] && MAINTAINERMAIL="igor.pecovnik@****l.com" # deb signature
[[ -z $DEB_COMPRESS ]] && DEB_COMPRESS="xz" # compress .debs with XZ by default. Use 'none' for faster/larger builds
+ export SKIP_EXTERNAL_TOOLCHAINS="${SKIP_EXTERNAL_TOOLCHAINS:-yes}" # don't use any external toolchains, by default.
TZDATA=$(cat /etc/timezone) # Timezone for target is taken from host or defined here.
USEALLCORES=yes # Use all CPU cores for compiling
HOSTRELEASE=$(cat /etc/os-release | grep VERSION_CODENAME | cut -d"=" -f2)
From 7fb54baca48ed6ae60b6a0025e83b0e29380164f Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 24 Feb 2022 19:57:17 +0100
Subject: [PATCH] armbian-next: keeping stdout clean, use display_alert() for
cleanup logging
---
compile.sh | 3 ++-
lib/functions/configuration/config-desktop.sh | 5 ++---
lib/functions/configuration/main-config.sh | 1 -
lib/functions/main/rootfs-image.sh | 2 +-
4 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/compile.sh b/compile.sh
index fcd9046a0..0c35c5fd6 100755
--- a/compile.sh
+++ b/compile.sh
@@ -53,4 +53,5 @@ traps_init
# Execute the main CLI entrypoint.
cli_entrypoint "$@"
-echo "-- very last thing" 1>&2
+# Log the last statement of this script for debugging purposes.
+display_alert "Armbian build script exiting" "very last thing" "cleanup"
diff --git a/lib/functions/configuration/config-desktop.sh b/lib/functions/configuration/config-desktop.sh
index 72ddd07ec..9ff0106da 100644
--- a/lib/functions/configuration/config-desktop.sh
+++ b/lib/functions/configuration/config-desktop.sh
@@ -2,9 +2,8 @@ function desktop_element_available_for_arch() {
local desktop_element_path="${1}"
local targeted_arch="${2}"
local arch_limitation_file="${1}/only_for"
- echo "Checking if ${desktop_element_path} is available for ${targeted_arch} in ${arch_limitation_file}" >> "${DEST}"/${LOG_SUBPATH}/output.log
if [[ -f "${arch_limitation_file}" ]]; then
- if ! grep -- "${targeted_arch}" "${arch_limitation_file}"; then
+ if ! grep -- "${targeted_arch}" "${arch_limitation_file}" &> /dev/null; then
return 1
fi
fi
@@ -35,7 +34,7 @@ function desktop_element_supported() {
function desktop_environments_prepare_menu() {
for desktop_env_dir in "${DESKTOP_CONFIGS_DIR}/"*; do
local desktop_env_name expert_infos="" desktop_element_supported_result=0
- desktop_env_name=$(basename ${desktop_env_dir})
+ desktop_env_name="$(basename "${desktop_env_dir}")"
[[ "${EXPERT}" == "yes" ]] && expert_infos="[$(cat "${desktop_env_dir}/support" 2> /dev/null)]"
desktop_element_supported "${desktop_env_dir}" "${ARCH}"
[[ ${desktop_element_supported_result} == 0 ]] && options+=("${desktop_env_name}" "${desktop_env_name^} desktop environment ${expert_infos}")
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 5f43fb075..5aa637534 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -245,7 +245,6 @@ function do_main_configuration() {
CLI_CONFIG_PATH="${SRC}/config/cli/${RELEASE}"
DEBOOTSTRAP_CONFIG_PATH="${CLI_CONFIG_PATH}/debootstrap"
-
AGGREGATION_SEARCH_ROOT_ABSOLUTE_DIRS="
${SRC}/config
${SRC}/config/optional/_any_board/_config
diff --git a/lib/functions/main/rootfs-image.sh b/lib/functions/main/rootfs-image.sh
index db8fe5b40..a43659f43 100644
--- a/lib/functions/main/rootfs-image.sh
+++ b/lib/functions/main/rootfs-image.sh
@@ -103,7 +103,7 @@ function build_rootfs_and_image() {
}
function trap_handler_cleanup_rootfs_and_image() {
- echo "-- trap_handler_cleanup_rootfs_and_image cleaning up..." 1>&2
+ display_alert "Cleanup for rootfs and image" "trap_handler_cleanup_rootfs_and_image" "cleanup"
cd "${SRC}" || echo "Failed to cwd to ${SRC}" # Move pwd away, so unmounts work
# those will loop until they're unmounted.
From a3b64e15f9130871ff37061aa533ca0649c0bc0c Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 24 Feb 2022 19:35:23 +0100
Subject: [PATCH] armbian-next: library cleanups; remove `build-all.sh` for
good; bring `patching.sh` back
---
.../compilation/patch/{apply.sh => patching.sh} | 0
lib/functions/multi/build-all.sh | 440 ---------------------
lib/library-functions.sh | 27 +-
3 files changed, 9 insertions(+), 458 deletions(-)
diff --git a/lib/functions/compilation/patch/apply.sh b/lib/functions/compilation/patch/patching.sh
similarity index 100%
rename from lib/functions/compilation/patch/apply.sh
rename to lib/functions/compilation/patch/patching.sh
diff --git a/lib/functions/multi/build-all.sh b/lib/functions/multi/build-all.sh
deleted file mode 100644
index 762a588d7..000000000
--- a/lib/functions/multi/build-all.sh
+++ /dev/null
@@ -1,440 +0,0 @@
-function do_main_build_all_ng() {
- if [[ -z $VENDOR ]]; then VENDOR="Armbian"; fi
- if [[ $BETA == "yes" ]]; then STABILITY="beta"; else STABILITY="stable"; fi
- if [[ $BETA == "yes" ]]; then upload_subdir=nightly; else upload_subdir="archive"; fi
- if [[ $MAKE_ALL_BETA == "yes" ]]; then STABILITY="stable"; fi
- if [[ -z $KERNEL_ONLY ]]; then KERNEL_ONLY="yes"; fi
- if [[ -z $MULTITHREAD ]]; then MULTITHREAD=0; fi
- if [[ -z $START ]]; then START=0; fi
- if [[ -z $KERNEL_CONFIGURE ]]; then KERNEL_CONFIGURE="no"; fi
- if [[ -z $CLEAN_LEVEL ]]; then CLEAN_LEVEL="make,oldcache"; fi
-
- MAINLINE_KERNEL_SOURCE='https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable'
-
- # cleanup
- rm -f /run/armbian/*.pid
- mkdir -p /run/armbian
-
- # read user defined targets if exits
- if [[ -f $USERPATCHES_PATH/targets.conf ]]; then
- display_alert "Adding user provided targets configuration"
- BUILD_TARGETS="${USERPATCHES_PATH}/targets.conf"
- else
- BUILD_TARGETS="${SRC}/config/targets.conf"
- fi
-
- # bump version in case there was a change
- if [[ ${BUMP_VERSION} == yes ]]; then
- cd "${SRC}" || exit
- CURRENT_VERSION=$(cat VERSION)
- NEW_VERSION="${CURRENT_VERSION%%-trunk}"
- if [[ $CURRENT_VERSION == *trunk* ]]; then
- NEW_VERSION=$(echo "${CURRENT_VERSION}" | cut -d. -f1-3)"."$((${NEW_VERSION##*.} + 1))
- else
- NEW_VERSION=$(echo "${CURRENT_VERSION}" | cut -d. -f1-2)"."$((${NEW_VERSION##*.} + 1))
- fi
-
- echo "${NEW_VERSION}" > VERSION
- improved_git add "${SRC}"/VERSION
- improved_git commit -m "Bumping to new version" -m "" -m "Adding following kernels:" -m "$(find output/debs-beta/ -type f -name "linux-image*${CURRENT_VERSION}*.deb" -printf "%f\n" | sort)"
- improved_git push
- display_alert "Bumping to new version" "${NEW_VERSION}" "info"
- else
-
- # display what will be build
- echo ""
- [[ -f userpatches/family.skip ]] && display_alert "userpatches/family.skip exists and familes noted there will be skipped" "" "wrn"
- display_alert "Building all targets" "$STABILITY $(if [[ $KERNEL_ONLY == "yes" ]]; then
- echo "kernels"
- else echo "images"; fi)" "info"
-
- printf "\n%s\t%-32s\t%-8s\t%-14s\t%-6s\t%-6s\t%-6s\t%-6s\n\n" "" "board" "branch" "release" "DE" "desktop" "minimal" "DE app groups"
-
- # display what we will build
- build_all "dryrun"
-
- if [[ $BUILD_ALL != demo ]]; then
- echo ""
- # build
- build_all
- fi
-
- # wait until they are not finshed
- sleep 5
- while :; do
- if [[ $(df | grep -c /.tmp) -lt 1 ]]; then
- break
- fi
- sleep 5
- done
-
- while :; do
- if [[ -z $(ps -uax | grep 7z | grep Armbian) ]]; then
- break
- fi
- sleep 5
- done
-
- fi
-
- [[ $n -eq 0 ]] && display_alert "No changes in upstream sources, patches or configs found. Exiting." "info"
-
- buildall_end=$(date +%s)
- buildall_runtime=$(((buildall_end - buildall_start) / 60))
- display_alert "Runtime in total" "${buildall_runtime} min" "info"
- mkdir -p .tmp
- echo "${n}" > "${SRC}"/.tmp/n
-
- # display what we will build
- build_all "dryrun"
- display_alert "Done"
-}
-
-unset_all() {
- cleanup_extension_manager
- unset LINUXFAMILY LINUXCONFIG KERNELDIR KERNELSOURCE KERNELBRANCH BOOTDIR BOOTSOURCE BOOTBRANCH ARCH UBOOT_USE_GCC KERNEL_USE_GCC CPUMIN CPUMAX \
- UBOOT_VER KERNEL_VER GOVERNOR BOOTSIZE BOOTFS_TYPE UBOOT_TOOLCHAIN KERNEL_TOOLCHAIN DEBOOTSTRAP_LIST PACKAGE_LIST_EXCLUDE KERNEL_IMAGE_TYPE \
- write_uboot_platform family_tweaks family_tweaks_bsp setup_write_uboot_platform uboot_custom_postprocess atf_custom_postprocess family_tweaks_s \
- LOCALVERSION UBOOT_COMPILER KERNEL_COMPILER BOOTCONFIG BOOTCONFIG_VAR_NAME INITRD_ARCH BOOTENV_FILE BOOTDELAY ATF_TOOLCHAIN2 MOUNT SDCARD \
- BOOTPATCHDIR KERNELPATCHDIR RELEASE IMAGE_TYPE OVERLAY_PREFIX ASOUND_STATE ATF_COMPILER ATF_USE_GCC ATFSOURCE ATFDIR ATFBRANCH ATFSOURCEDIR \
- PACKAGE_LIST_RM NM_IGNORE_DEVICES DISPLAY_MANAGER family_tweaks_bsp_s CRYPTROOT_ENABLE CRYPTROOT_PASSPHRASE CRYPTROOT_SSH_UNLOCK \
- CRYPTROOT_SSH_UNLOCK_PORT CRYPTROOT_SSH_UNLOCK_KEY_NAME ROOT_MAPPER NETWORK HDMI USB WIRELESS ARMBIANMONITOR FORCE_BOOTSCRIPT_UPDATE \
- UBOOT_TOOLCHAIN2 toolchain2 BUILD_REPOSITORY_URL BUILD_REPOSITORY_COMMIT BUILD_TARGET HOST BUILD_IMAGE DEB_STORAGE REPO_STORAGE REPO_CONFIG \
- REPOSITORY_UPDATE PACKAGE_LIST_RELEASE LOCAL_MIRROR COMPILE_ATF PACKAGE_LIST_BOARD PACKAGE_LIST_FAMILY PACKAGE_LIST_DESKTOP_BOARD \
- PACKAGE_LIST_DESKTOP_FAMILY ATF_COMPILE ATFPATCHDIR OFFSET BOOTSOURCEDIR \
- BOOT_SOC DDR_BLOB MINILOADER_BLOB BL31_BLOB BOOT_SCENARIO BOOT_SUPPORT_SPI OFFLINE_WORK VAR_SHALLOW_ORIGINAL KERNELSWITCHOBJ \
- IMAGE_PARTITION_TABLE BOOT_LOGO UBOOT_REPO_VERSION FORCED_MONTH_OFFSET PACKAGE_LIST_BOARD_REMOVE PACKAGE_LIST_FAMILY_REMOVE PACKAGE_LIST_DESKTOP \
- PACKAGE_LIST_DESKTOP_BOARD_REMOVE PACKAGE_LIST_DESKTOP_FAMILY_REMOVE BOOTCONFIG_EDGE DESKTOP_ENVIRONMENT DESKTOP_ENVIRONMENT_CONFIG_NAME \
- DESKTOP_APPGROUPS_SELECTED DESKTOP_APT_FLAGS_SELECTED DESKTOP_ENVIRONMENT_DIRPATH DESKTOP_ENVIRONMENT_PACKAGE_LIST_DIRPATH UBOOT_TARGET_MAP \
- DESKTOP_ENVIRONMENT_DIRPATH DESKTOP_ENVIRONMENT_PACKAGE_LIST_DIRPATH DESKTOP_CONFIG_PREFIX DESKTOP_CONFIGS_DIR DESKTOP_APPGROUPS_DIR \
- DEBIAN_RECOMMENDS USE_OVERLAYFS aggregated_content DEBOOTSTRAP_COMPONENTS DEBOOTSTRAP_OPTION DEB_COMPRESS MAINTAINER MAINTAINERMAIL EXTRAWIFI BOOTSCRIPT
-}
-
-pack_upload() {
-
- # pack and upload to server or just pack
-
- display_alert "Signing" "Please wait!" "info"
- local version="${VENDOR}_${REVISION}_${BOARD^}_${RELEASE}_${BRANCH}_${VER/-$LINUXFAMILY/}${DESKTOP_ENVIRONMENT:+_$DESKTOP_ENVIRONMENT}"
- compression_type=""
-
- [[ $BUILD_DESKTOP == yes ]] && version=${version}_desktop
- [[ $BUILD_MINIMAL == yes ]] && version=${version}_minimal
- [[ $BETA == yes ]] && local subdir=nightly
- [[ $RC == yes ]] && local subdir=rc
-
- cd "${DESTIMG}" || exit
-
- if [[ $COMPRESS_OUTPUTIMAGE == yes ]]; then
- COMPRESS_OUTPUTIMAGE="sha,gpg,7z"
- fi
-
- if [[ $COMPRESS_OUTPUTIMAGE == *gz* ]]; then
- display_alert "Compressing" "$DEST/images/${version}.img.gz" "info"
- pigz "$DESTIMG/${version}.img"
- rm "${DESTIMG}/${version}.img"
- compression_type=".gz"
- fi
-
- if [[ $COMPRESS_OUTPUTIMAGE == *xz* ]]; then
- display_alert "Compressing" "$DEST/images/${version}.img.xz" "info"
- pixz -9 < "$DESTIMG/${version}.img" > "${DESTIMG}/${version}.img.xz"
- rm "${DESTIMG}/${version}.img"
- compression_type=".xz"
- fi
-
- if [[ $COMPRESS_OUTPUTIMAGE == *sha* ]]; then
- display_alert "SHA256 calculating" "${version}.img" "info"
- sha256sum -b "${version}.img${compression_type}" > "${version}.img${compression_type}.sha"
- fi
-
- if [[ $COMPRESS_OUTPUTIMAGE == *gpg* ]]; then
- if [[ -n "${GPG_PASS}" && "${SUDO_USER}" ]]; then
- display_alert "GPG signing" "${version}.img" "info"
- [[ -n ${SUDO_USER} ]] && sudo chown -R ${SUDO_USER}:${SUDO_USER} "${DEST}"/images/
- echo "${GPG_PASS}" | sudo -H -u ${SUDO_USER} bash -c "gpg --passphrase-fd 0 --armor --detach-sign --pinentry-mode loopback --batch --yes ${version}.img${compression_type}" || exit 1
- else
- display_alert "GPG signing skipped - no GPG_PASS" "${version}.img" "wrn"
- fi
- fi
-
- fingerprint_image "${version}.img${compression_type}.txt" "${version}"
-
- if [[ $COMPRESS_OUTPUTIMAGE == *7z* ]]; then
- display_alert "Compressing" "${version}.7z" "info"
- 7za a -t7z -bd -m0=lzma2 -mx=3 -mfb=64 -md=32m -ms=on "${version}".7z "${version}".img* > /dev/null 2>&1
- find . -type f -not -name '*.7z' -print0 | xargs -0 rm --
- fi
-
- if [[ -n "${SEND_TO_SERVER}" ]]; then
- ssh "${SEND_TO_SERVER}" "mkdir -p ${SEND_TO_LOCATION}${BOARD}/{archive,nightly}" &
- display_alert "Uploading" "Please wait!" "info"
- nice -n 19 bash -c "rsync -arP --info=progress2 --prune-empty-dirs $DESTIMG/ -e 'ssh -T -c aes128-ctr -o Compression=no -x -p 22' ${SEND_TO_SERVER}:${SEND_TO_LOCATION}${BOARD}/${subdir}; rm -rf ${DESTIMG}/*" &
- else
- mv "${DESTIMG}"/*.* "${DEST}"/images/
- fi
-
-}
-
-build_main() {
- # shellcheck source=/dev/null
- source "$USERPATCHES_PATH"/lib.config
- # build images which we do pack or kernel
- local upload_image
- upload_image="${VENDOR}_$(cat "${SRC}"/VERSION)_${BOARD^}_${RELEASE}_${BRANCH}_*${VER/-$LINUXFAMILY/}"
-
- [[ $BUILD_DESKTOP == yes ]] && upload_image=${upload_image}_desktop
- [[ $BUILD_MINIMAL == yes ]] && upload_image=${upload_image}_minimal
-
- touch "/run/armbian/${VENDOR}_${BOARD^}_${BRANCH}_${RELEASE}_${DESKTOP_ENVIRONMENT}_${BUILD_DESKTOP}_${BUILD_MINIMAL}.pid"
- LOG_SUBPATH="debug/${VENDOR}/${BOARD^}/${BRANCH}/${RELEASE}/${DESKTOP_ENVIRONMENT}_${BUILD_DESKTOP}_${BUILD_MINIMAL}"
-
- if [[ $KERNEL_ONLY != yes ]]; then
- #if ssh ${SEND_TO_SERVER} stat ${SEND_TO_LOCATION}${BOARD}/${upload_subdir}/${upload_image}* \> /dev/null 2\>\&1; then
- # echo "$n exists $upload_image"
- #else
- #shellcheck source=lib/main.sh
- source "${SRC}"/lib/main.sh
- [[ "$BSP_BUILD" != yes && -n "${SEND_TO_SERVER}" ]] && pack_upload
- #fi
-
- else
- #shellcheck source=lib/main.sh
- source "${SRC}"/lib/main.sh
-
- fi
-
- cd "${SRC}"
- rm "/run/armbian/${VENDOR}_${BOARD^}_${BRANCH}_${RELEASE}_${DESKTOP_ENVIRONMENT}_${BUILD_DESKTOP}_${BUILD_MINIMAL}.pid"
-}
-
-array_contains() {
-
- # utility snippet
-
- local array="$1[@]"
- local seeking=$2
- local in=1
-
- for element in "${!array}"; do
- if [[ "${element}" == "${seeking}" ]]; then
- in=0
- break
- fi
- done
- return $in
-
-}
-
-function check_hash() {
- local BOARDFAMILY ref_type ref_name
-
- BOARDFAMILY=$(grep BOARDFAMILY "${SRC}/config/boards/${BOARD}".* | cut -d \" -f2)
- # shellcheck source=/dev/null
- source "${SRC}/config/sources/families/${BOARDFAMILY}.conf" &> /dev/null
- # shellcheck source=/dev/null
- source "${SRC}/config/sources/${ARCH}.conf" &> /dev/null
- ref_type=${KERNELBRANCH%%:*}
- if [[ $ref_type == head ]]; then
- ref_name=HEAD
- else
- ref_name=${KERNELBRANCH##*:}
- fi
- [[ -z $LINUXFAMILY ]] && LINUXFAMILY=$BOARDFAMILY
- [[ -z ${KERNELPATCHDIR} ]] && KERNELPATCHDIR=$LINUXFAMILY-$BRANCH
- [[ -z ${LINUXCONFIG} ]] && LINUXCONFIG=linux-$LINUXFAMILY-$BRANCH
- hash_watch_1=$(LC_COLLATE=C find -L "${SRC}/patch/kernel/${KERNELPATCHDIR}"/ -name '*.patch' -mindepth 1 -maxdepth 1 -printf '%s %P\n' 2> /dev/null | LC_COLLATE=C sort -n)
- hash_watch_2=$(cat "${SRC}/config/kernel/${LINUXCONFIG}.config" 2> /dev/null)
- patch_hash=$(echo "${hash_watch_1}${hash_watch_2}" | improved_git hash-object --stdin)
-
- case $ref_type in
- branch) hash=$(improved_git ls-remote "${KERNELSOURCE}" refs/heads/"${ref_name}" 2> /dev/null | awk '{print $1}') ;;
- tag) hash=$(improved_git ls-remote "${KERNELSOURCE}" tags/"${ref_name}" 2> /dev/null | awk '{print $1}') ;;
- head) hash=$(improved_git ls-remote "${KERNELSOURCE}" HEAD 2> /dev/null | awk '{print $1}') ;;
- commit) hash=$ref_name ;;
- esac
- # ignore diff checking in case of network errrors
- local kernel_hash="${SRC}/cache/hash"$([[ ${BETA} == yes ]] && echo "-beta")"/linux-image-${BRANCH}-${LINUXFAMILY}.githash"
- if [[ -f ${kernel_hash} ]]; then
- [[ "$hash" == "$(head -1 "${kernel_hash}")" && "$patch_hash" == "$(tail -1 "${kernel_hash}")" || -z $hash ]] && echo "IDENTICAL"
- fi
-}
-
-function build_all() {
-
- # main routine
-
- buildall_start=$(date +%s)
- n=0
- ARRAY=()
- buildlist="cat "
-
- # building selected ones
- if [[ -n ${REBUILD_IMAGES} ]]; then
-
- buildlist="grep -w '"
- filter="'"
- for build in $(tr ',' ' ' <<< "${REBUILD_IMAGES}"); do
- buildlist=$buildlist"$build\|"
- filter=$filter"$build\|"
- done
- buildlist=${buildlist::-2}"'"
- filter=${filter::-2}"'"
-
- fi
-
- # find unique boards - we will build debs for all variants
- sorted_unique_ids=($(echo "${ids[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' '))
- unique_boards=$(eval "${buildlist}" "${SRC}"/config/targets.conf | sed '/^#/ d' | awk '{print $1}')
- read -r -a unique_boards <<< "$(echo "${unique_boards[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')"
-
- while read -r line; do
- # @TODO: this almost a complete copy of main.sh. refactor.
-
- [[ "${line}" =~ ^#.*$ ]] && continue
- [[ -n "${REBUILD_IMAGES}" ]] && [[ -z $(echo "${line}" | eval grep -w "${filter}") ]] && continue
- #[[ $n -lt $START ]] && ((n+=1)) && continue
-
- unset_all
- # unset also board related variables
- unset BOARDFAMILY DESKTOP_AUTOLOGIN DEFAULT_CONSOLE FULL_DESKTOP MODULES MODULES_CURRENT MODULES_LEGACY MODULES_EDGE \
- BOOTCONFIG MODULES_BLACKLIST MODULES_BLACKLIST_LEGACY MODULES_BLACKLIST_CURRENT MODULES_BLACKLIST_EDGE DEFAULT_OVERLAYS SERIALCON \
- BUILD_MINIMAL RELEASE ATFBRANCH BOOT_FDT_FILE BOOTCONFIG_EDGE BOOTSOURCEDIR SRC_CMDLINE SRC_EXTLINUX INITRD_ARCH
-
- read -r BOARD BRANCH RELEASE BUILD_TARGET BUILD_STABILITY BUILD_IMAGE DESKTOP_ENVIRONMENT DESKTOP_ENVIRONMENT_CONFIG_NAME DESKTOP_APPGROUPS_SELECTED <<< "${line}"
- DESKTOP_APPGROUPS_SELECTED="${DESKTOP_APPGROUPS_SELECTED//,/ }"
- # read all possible configurations
- # shellcheck source=/dev/null
- source "${SRC}/config/boards/${BOARD}".eos 2> /dev/null
- # shellcheck source=/dev/null
- source "${SRC}/config/boards/${BOARD}".tvb 2> /dev/null
- # shellcheck source=/dev/null
- source "${SRC}/config/boards/${BOARD}".csc 2> /dev/null
- # shellcheck source=/dev/null
- source "${SRC}/config/boards/${BOARD}".wip 2> /dev/null
- # shellcheck source=/dev/null
- source "${SRC}/config/boards/${BOARD}".conf 2> /dev/null
-
- # override branch to build selected branches if defined
- if [[ -n "${BROVER}" ]]; then
- if [[ "${KERNEL_TARGET}" == *${BROVER}* ]]; then
- BRANCH=${BROVER}
- else
- continue
- fi
- fi
-
- # exceptions handling
- [[ ${BOARDFAMILY} == sun*i ]] && BOARDFAMILY=sunxi
- [[ ${BOARDFAMILY} == sun8i-v3s ]] && BOARDFAMILY=sunxi
- [[ ${BOARDFAMILY} == sun*iw* ]] && BOARDFAMILY=sunxi64
- [[ ${BOARDFAMILY} == meson8b ]] && BOARDFAMILY=meson
- [[ ${BOARDFAMILY} == meson-* ]] && BOARDFAMILY=meson64
- # small optimisation. we only (try to) build needed kernels
- if [[ $KERNEL_ONLY == yes ]]; then
- LINUXFAMILY="${BOARDFAMILY}"
- array_contains ARRAY "${LINUXFAMILY}${BRANCH}${BUILD_STABILITY}" && continue
-
- elif [[ $BUILD_IMAGE == no ]]; then
-
- continue
-
- fi
- ARRAY+=("${LINUXFAMILY}${BRANCH}${BUILD_STABILITY}")
-
- BUILD_DESKTOP="no"
- BUILD_MINIMAL="no"
-
- [[ ${BUILD_TARGET} == "desktop" && ${BSP_BUILD} != "yes" ]] && BUILD_DESKTOP="yes"
- [[ ${BUILD_TARGET} == "minimal" ]] && BUILD_MINIMAL="yes"
- [[ ${BSP_BUILD} == yes ]] && BUILD_STABILITY=$STABILITY
-
- # create a file and put grep style list of the one that must be skipped: sunxi\|sunxi64
- [[ -f userpatches/family.skip ]] && grep -qw "$BOARDFAMILY" userpatches/family.skip && continue
-
- # create beta or stable
- if [[ "${BUILD_STABILITY}" == "${STABILITY}" ]]; then
- # check if currnt hash is the same as upstream
- if [[ "$IGNORE_HASH" != yes ]]; then
- local store_hash
- store_hash=$(check_hash)
- fi
- if [[ "$store_hash" != IDENTICAL ]]; then
-
- if [[ $1 != "dryrun" ]] && [[ $n -ge $START ]]; then
- ((n += 1))
- while :; do
- if [[ $(find /run/armbian/*.pid 2> /dev/null | wc -l) -le ${MULTITHREAD} || ${MULTITHREAD} -eq 0 ]]; then
- break
- fi
- sleep 5
- done
-
- display_alert "Building ${n}."
- if [[ "$KERNEL_ONLY" == "no" && "${MULTITHREAD}" -gt 0 ]]; then
- build_main &
- sleep $((RANDOM % 25))
- elif [[ "${MULTITHREAD}" -gt 0 ]]; then
- build_main &
- sleep $((RANDOM % 5))
- else
- build_main
- fi
-
- # create BSP for all boards
- elif [[ "${BSP_BUILD}" == yes ]]; then
- ((n += 1))
- for BOARD in "${unique_boards[@]}"; do
- # shellcheck source=/dev/null
- source "${SRC}/config/boards/${BOARD}".eos 2> /dev/null
- # shellcheck source=/dev/null
- source "${SRC}/config/boards/${BOARD}".tvb 2> /dev/null
- # shellcheck source=/dev/null
- source "${SRC}/config/boards/${BOARD}".csc 2> /dev/null
- # shellcheck source=/dev/null
- source "${SRC}/config/boards/${BOARD}".wip 2> /dev/null
- # shellcheck source=/dev/null
- source "${SRC}/config/boards/${BOARD}".conf 2> /dev/null
- IFS=',' read -r -a RELBRANCH <<< "${KERNEL_TARGET}"
- for BRANCH in "${RELBRANCH[@]}"; do
- RELTARGETS=($(ls -1d config/distributions/*/ | cut -d"/" -f3))
- # we don't need to cycle all distributions when making u-boot package
- [[ $BOOTONLY == "yes" ]] && RELTARGETS=(focal)
- for RELEASE in "${RELTARGETS[@]}"; do
- display_alert "BSP for ${BOARD} ${BRANCH} ${RELEASE}."
- if [[ "$IGNORE_HASH" == yes && "$KERNEL_ONLY" != "yes" && "${MULTITHREAD}" -gt 0 ]]; then
- build_main &
- sleep 0.02
- elif [[ "${MULTITHREAD}" -gt 0 ]]; then
- build_main &
- sleep $((RANDOM % 5))
- else
- build_main
- fi
- # unset non board related stuff
- unset_all
- done
- done
- done
- display_alert "Done building all BSP images"
- exit
- else
- ((n += 1))
- # In dryrun it only prints out what will be build but also color green if file already exists
- FIND="$SRC/output/images/$BOARD/$upload_subdir/Armbian_$(cat "${SRC}"/VERSION)_${BOARD^}_${RELEASE}_${BRANCH}"
- if ls $FIND* 1> /dev/null 2>&1; then
- echo -ne "\e[0;92m"
- else
- echo -ne "\x1B[0m"
- fi
- printf "%s\t%-32s\t%-8s\t%-14s\t%-6s\t%-6s\t%-6s\t%-6s\n" "${n}." \
- "$BOARD (${BOARDFAMILY})" "${BRANCH}" "${RELEASE}" "${DESKTOP_ENVIRONMENT}" "${BUILD_DESKTOP}" "${BUILD_MINIMAL}" "${DESKTOP_APPGROUPS_SELECTED}"
- fi
- fi
- fi
-
- # at which image to stop
- [[ "$STOP" == "$n" ]] && [[ $1 != "dryrun" ]] && exit
- done < "${BUILD_TARGETS}"
-
-}
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index cec0c0fc7..6b14c18a2 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -73,15 +73,6 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/compilation/kernel.sh
source "${SRC}"/lib/functions/compilation/kernel.sh
-# no errors tolerated. invoked before each sourced file to make sure.
-#set -o pipefail # trace ERR through pipes - will be enabled "soon"
-#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
-set -o errtrace # trace ERR through - enabled
-set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/compilation/patch/apply.sh
-# shellcheck source=lib/functions/compilation/patch/apply.sh
-source "${SRC}"/lib/functions/compilation/patch/apply.sh
-
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
@@ -118,6 +109,15 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/compilation/patch/kernel-pkg.sh
source "${SRC}"/lib/functions/compilation/patch/kernel-pkg.sh
+# no errors tolerated. invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/compilation/patch/patching.sh
+# shellcheck source=lib/functions/compilation/patch/patching.sh
+source "${SRC}"/lib/functions/compilation/patch/patching.sh
+
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
@@ -370,15 +370,6 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/main/rootfs-image.sh
source "${SRC}"/lib/functions/main/rootfs-image.sh
-# no errors tolerated. invoked before each sourced file to make sure.
-#set -o pipefail # trace ERR through pipes - will be enabled "soon"
-#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
-set -o errtrace # trace ERR through - enabled
-set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/multi/build-all.sh
-# shellcheck source=lib/functions/multi/build-all.sh
-source "${SRC}"/lib/functions/multi/build-all.sh
-
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
From 68efe99a09da93c27a9cf20d1f14fc9354c73b92 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 24 Feb 2022 19:27:06 +0100
Subject: [PATCH] armbian-next: `interactive_desktop_main_configuration()` and
stderr'ed + error handl'ed dialog
- use redirection to fd 3 for dialog, now cleanly on stderr
- `show_menu()` -> `dialog_menu()` et al
- interactive configuration now works again!
---
lib/functions/configuration/config-desktop.sh | 61 ++++++++++++---------------
lib/functions/configuration/interactive.sh | 14 +++---
lib/functions/configuration/main-config.sh | 16 ++-----
lib/functions/configuration/menu.sh | 49 +++++++++++++--------
lib/functions/general/host.sh | 2 +-
lib/functions/main/config-prepare.sh | 3 +-
6 files changed, 72 insertions(+), 73 deletions(-)
diff --git a/lib/functions/configuration/config-desktop.sh b/lib/functions/configuration/config-desktop.sh
index 32afa4a95..72ddd07ec 100644
--- a/lib/functions/configuration/config-desktop.sh
+++ b/lib/functions/configuration/config-desktop.sh
@@ -66,7 +66,8 @@ function desktop_environment_check_if_valid() {
exit_with_error "${error_msg}"
}
-function desktop_main_configuration_interactive() {
+function interactive_desktop_main_configuration() {
+ [[ $BUILD_DESKTOP != "yes" ]] && return 0 # Only for desktops.
# Myy : Once we got a list of selected groups, parse the PACKAGE_LIST inside configuration.sh
DESKTOP_ELEMENTS_DIR="${SRC}/config/desktop/${RELEASE}"
@@ -74,37 +75,36 @@ function desktop_main_configuration_interactive() {
DESKTOP_CONFIG_PREFIX="config_"
DESKTOP_APPGROUPS_DIR="${DESKTOP_ELEMENTS_DIR}/appgroups"
- display_alert "Handling some" "desktop config stuff 1" "${DESKTOP_CONFIGS_DIR}" "debug"
+ display_alert "desktop-config" "DESKTOP_ENVIRONMENT entry: ${DESKTOP_ENVIRONMENT}" "debug"
- if [[ $BUILD_DESKTOP == "yes" && -z $DESKTOP_ENVIRONMENT ]]; then
+ if [[ -z $DESKTOP_ENVIRONMENT ]]; then
options=()
desktop_environments_prepare_menu
if [[ "${options[0]}" == "" ]]; then
exit_with_error "No desktop environment seems to be available for your board ${BOARD} (ARCH : ${ARCH} - EXPERT : ${EXPERT})"
fi
- DESKTOP_ENVIRONMENT=$(show_menu "Choose a desktop environment" "$backtitle" "Select the default desktop environment to bundle with this image" "${options[@]}")
+
+ display_alert "Desktops available" "${options[*]}" "debug"
+ dialog_menu "Choose a desktop environment" "$backtitle" "Select the default desktop environment to bundle with this image" "${options[@]}"
+ DESKTOP_ENVIRONMENT="${DIALOG_MENU_RESULT}"
+
unset options
if [[ -z "${DESKTOP_ENVIRONMENT}" ]]; then
exit_with_error "No desktop environment selected..."
fi
fi
- display_alert "Handling some" "desktop config stuff 2" "debug"
- if [[ $BUILD_DESKTOP == "yes" ]]; then
- DESKTOP_ENVIRONMENT_DIRPATH="${DESKTOP_CONFIGS_DIR}/${DESKTOP_ENVIRONMENT}"
- desktop_environment_check_if_valid # Make sure desktop config is sane.
- fi
+ display_alert "desktop-config" "DESKTOP_ENVIRONMENT selected: ${DESKTOP_ENVIRONMENT}" "debug"
- display_alert "Handling some" "desktop config stuff 3" "debug"
+ DESKTOP_ENVIRONMENT_DIRPATH="${DESKTOP_CONFIGS_DIR}/${DESKTOP_ENVIRONMENT}"
+ desktop_environment_check_if_valid # Make sure desktop config is sane.
- if [[ $BUILD_DESKTOP == "yes" && -z $DESKTOP_ENVIRONMENT_CONFIG_NAME ]]; then
- # FIXME Check for empty folders, just in case the current maintainer
- # messed up
- # Note, we could also ignore it and don't show anything in the previous
- # menu, but that hides information and make debugging harder, which I
- # don't like. Adding desktop environments as a maintainer is not a
- # trivial nor common task.
+ display_alert "desktop-config" "DESKTOP_ENVIRONMENT_CONFIG_NAME entry: ${DESKTOP_ENVIRONMENT_CONFIG_NAME}" "debug"
+ if [[ -z $DESKTOP_ENVIRONMENT_CONFIG_NAME ]]; then
+ # @FIXME: Myy: Check for empty folders, just in case the current maintainer messed up
+ # Note, we could also ignore it and don't show anything in the previous menu, but that hides information and make debugging harder, which I
+ # don't like. Adding desktop environments as a maintainer is not a trivial nor common task.
options=()
for configuration in "${DESKTOP_ENVIRONMENT_DIRPATH}/${DESKTOP_CONFIG_PREFIX}"*; do
config_filename=$(basename ${configuration})
@@ -112,38 +112,33 @@ function desktop_main_configuration_interactive() {
options+=("${config_filename}" "${config_name} configuration")
done
- DESKTOP_ENVIRONMENT_CONFIG_NAME=$(show_menu "Choose the desktop environment config" "$backtitle" "Select the configuration for this environment.\nThese are sourced from ${desktop_environment_config_dir}" "${options[@]}")
+ dialog_menu "Choose the desktop environment config" "$backtitle" "Select the configuration for this environment.\nThese are sourced from ${desktop_environment_config_dir}" "${options[@]}"
+ DESKTOP_ENVIRONMENT_CONFIG_NAME="${DIALOG_MENU_RESULT}"
unset options
if [[ -z $DESKTOP_ENVIRONMENT_CONFIG_NAME ]]; then
exit_with_error "No desktop configuration selected... Do you really want a desktop environment ?"
fi
fi
- display_alert "Handling some" "desktop config stuff 4" "debug"
+ display_alert "desktop-config" "DESKTOP_ENVIRONMENT_CONFIG_NAME exit: ${DESKTOP_ENVIRONMENT_CONFIG_NAME}" "debug"
- if [[ $BUILD_DESKTOP == "yes" ]]; then
- DESKTOP_ENVIRONMENT_PACKAGE_LIST_DIRPATH="${DESKTOP_ENVIRONMENT_DIRPATH}/${DESKTOP_ENVIRONMENT_CONFIG_NAME}"
- DESKTOP_ENVIRONMENT_PACKAGE_LIST_FILEPATH="${DESKTOP_ENVIRONMENT_PACKAGE_LIST_DIRPATH}/packages"
- fi
+ export DESKTOP_ENVIRONMENT_PACKAGE_LIST_DIRPATH="${DESKTOP_ENVIRONMENT_DIRPATH}/${DESKTOP_ENVIRONMENT_CONFIG_NAME}"
+ export DESKTOP_ENVIRONMENT_PACKAGE_LIST_FILEPATH="${DESKTOP_ENVIRONMENT_PACKAGE_LIST_DIRPATH}/packages"
+ display_alert "desktop-config" "DESKTOP_APPGROUPS_SELECTED+x entry: ${DESKTOP_APPGROUPS_SELECTED+x}" "debug"
# "-z ${VAR+x}" allows to check for unset variable
# Technically, someone might want to build a desktop with no additional
# appgroups.
- if [[ $BUILD_DESKTOP == "yes" && -z ${DESKTOP_APPGROUPS_SELECTED+x} ]]; then
+ if [[ -z ${DESKTOP_APPGROUPS_SELECTED+x} ]]; then
options=()
for appgroup_path in "${DESKTOP_APPGROUPS_DIR}/"*; do
appgroup="$(basename "${appgroup_path}")"
options+=("${appgroup}" "${appgroup^}" off)
done
- # FIXME: pardini: here's a subshell to run dialog. in the middle of the main config. refactor this away
- DESKTOP_APPGROUPS_SELECTED=$(
- show_select_menu \
- "Choose desktop softwares to add" \
- "$backtitle" \
- "Select which kind of softwares you'd like to add to your build" \
- "${options[@]}"
- )
+
+ dialog_checklist "Choose desktop softwares to add" "$backtitle" "Select which kind of softwares you'd like to add to your build" "${options[@]}"
+ DESKTOP_APPGROUPS_SELECTED="${DIALOG_CHECKLIST_RESULT}"
unset options
fi
- display_alert "Done with" "desktop config stuff - END" "debug"
+ display_alert "desktop-config" "DESKTOP_APPGROUPS_SELECTED exit: ${DESKTOP_APPGROUPS_SELECTED}" "debug"
}
diff --git a/lib/functions/configuration/interactive.sh b/lib/functions/configuration/interactive.sh
index 28486fa02..165f6257f 100644
--- a/lib/functions/configuration/interactive.sh
+++ b/lib/functions/configuration/interactive.sh
@@ -22,7 +22,7 @@ function interactive_config_ask_kernel_only() {
[[ -n ${KERNEL_ONLY} ]] && return 0
options+=("yes" "U-boot and kernel packages")
options+=("no" "Full OS image for flashing")
- dialog_if_terminal_set_vars --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags --menu "Select what to build" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
+ dialog_if_terminal_set_vars --title "Choose an option" --backtitle "$backtitle" --no-tags --menu "Select what to build" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
KERNEL_ONLY="${DIALOG_RESULT}"
[[ "${DIALOG_EXIT_CODE}" != "0" ]] && exit_with_error "You cancelled interactive during KERNEL_ONLY selection: '${DIALOG_EXIT_CODE}'" "Build cancelled: ${DIALOG_EXIT_CODE}"
unset options
@@ -33,7 +33,7 @@ function interactive_config_ask_kernel_configure() {
options+=("no" "Do not change the kernel configuration")
options+=("yes" "Show a kernel configuration menu before compilation")
options+=("prebuilt" "Use precompiled packages from Armbian repository")
- dialog_if_terminal_set_vars --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags --menu "Select the kernel configuration" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
+ dialog_if_terminal_set_vars --title "Choose an option" --backtitle "$backtitle" --no-tags --menu "Select the kernel configuration" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
KERNEL_CONFIGURE="${DIALOG_RESULT}"
[[ ${DIALOG_EXIT_CODE} != 0 ]] && exit_with_error "You cancelled interactive during kernel configuration" "Build cancelled"
unset options
@@ -83,7 +83,7 @@ function interactive_config_ask_board_list() {
fi
DIALOGRC=$temp_rc \
- dialog_if_terminal_set_vars --stdout --title "Choose a board" --backtitle "$backtitle" --scrollbar \
+ dialog_if_terminal_set_vars --title "Choose a board" --backtitle "$backtitle" --scrollbar \
--colors --extra-label "Show $WIP_BUTTON" --extra-button \
--menu "Select the target board. Displaying:\n$STATE_DESCRIPTION" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
BOARD="${DIALOG_RESULT}"
@@ -125,7 +125,7 @@ function interactive_config_ask_branch() {
if [[ "${#options[@]}" == 2 ]]; then
BRANCH="${options[0]}"
else
- dialog_if_terminal_set_vars --stdout --title "Choose a kernel" --backtitle "$backtitle" --colors \
+ dialog_if_terminal_set_vars --title "Choose a kernel" --backtitle "$backtitle" --colors \
--menu "Select the target kernel branch\nExact kernel versions depend on selected board" \
$TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
BRANCH="${DIALOG_RESULT}"
@@ -141,7 +141,7 @@ function interactive_config_ask_release() {
options=()
distros_options
- dialog_if_terminal_set_vars --stdout --title "Choose a release package base" --backtitle "$backtitle" --menu "Select the target OS release package base" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
+ dialog_if_terminal_set_vars --title "Choose a release package base" --backtitle "$backtitle" --menu "Select the target OS release package base" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
RELEASE="${DIALOG_RESULT}"
[[ -z ${RELEASE} ]] && exit_with_error "No release selected"
unset options
@@ -158,7 +158,7 @@ function interactive_config_ask_desktop_build() {
options=()
options+=("no" "Image with console interface (server)")
options+=("yes" "Image with desktop environment")
- dialog_if_terminal_set_vars --stdout --title "Choose image type" --backtitle "$backtitle" --no-tags \
+ dialog_if_terminal_set_vars --title "Choose image type" --backtitle "$backtitle" --no-tags \
--menu "Select the target image type" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
BUILD_DESKTOP="${DIALOG_RESULT}"
unset options
@@ -177,7 +177,7 @@ function interactive_config_ask_standard_or_minimal() {
options=()
options+=("no" "Standard image with console interface")
options+=("yes" "Minimal image with console interface")
- dialog_if_terminal_set_vars --stdout --title "Choose image type" --backtitle "$backtitle" --no-tags \
+ dialog_if_terminal_set_vars --title "Choose image type" --backtitle "$backtitle" --no-tags \
--menu "Select the target image type" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
BUILD_MINIMAL="${DIALOG_RESULT}"
unset options
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 848474b09..5f43fb075 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -217,7 +217,7 @@ function do_main_configuration() {
it is often used to in turn override those.
POST_FAMILY_CONFIG
- desktop_main_configuration_interactive
+ interactive_desktop_main_configuration
# dropbear needs to be configured differently # @TODO: rpardini: yes, and? are you a lost leftover comment from a previous era?
[[ $CRYPTROOT_ENABLE == yes && $RELEASE == xenial ]] && exit_with_error "Encrypted rootfs is not supported in Xenial"
@@ -295,17 +295,9 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
PACKAGE_LIST="$(one_line aggregate_all_cli "packages" " ")"
PACKAGE_LIST_ADDITIONAL="$(one_line aggregate_all_cli "packages.additional" " ")"
- LOG_OUTPUT_FILE="$SRC/output/${LOG_SUBPATH}/debootstrap-list.log"
-
- # Dependent desktop packages
- # Myy : Sources packages from file here
-
- # Myy : FIXME Rename aggregate_all to aggregate_all_desktop # @TODO: rpardini: already done?
if [[ $BUILD_DESKTOP == "yes" ]]; then
PACKAGE_LIST_DESKTOP+="$(one_line aggregate_all_desktop "packages" " ")"
- echo -e "\nGroups selected ${DESKTOP_APPGROUPS_SELECTED} -> PACKAGES :" >> "${LOG_OUTPUT_FILE}"
fi
- unset LOG_OUTPUT_FILE
DEBIAN_MIRROR='deb.debian.org/debian'
DEBIAN_SECURTY='security.debian.org/'
@@ -333,10 +325,8 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
# don't use mirrors that throws garbage on 404
if [[ -z ${ARMBIAN_MIRROR} ]]; then
while true; do
-
ARMBIAN_MIRROR=$(wget -SO- -T 1 -t 1 https://redirect.armbian.com 2>&1 | egrep -i "Location" | awk '{print $2}' | head -1)
[[ ${ARMBIAN_MIRROR} != *armbian.hosthatch* ]] && break
-
done
fi
@@ -363,10 +353,9 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
EXTENSION_PREPARE_CONFIG
# apt-cacher-ng mirror configurarion
+ APT_MIRROR=$DEBIAN_MIRROR
if [[ $DISTRIBUTION == Ubuntu ]]; then
APT_MIRROR=$UBUNTU_MIRROR
- else
- APT_MIRROR=$DEBIAN_MIRROR
fi
[[ -n $APT_PROXY_ADDR ]] && display_alert "Using custom apt-cacher-ng address" "$APT_PROXY_ADDR" "info"
@@ -391,6 +380,7 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
PACKAGE_LIST_UNINSTALL="$(cleanup_list aggregated_content)"
unset aggregated_content
+ # @TODO: rpardini: this has to stop. refactor this into array or dict-based and stop the madness.
if [[ -n $PACKAGE_LIST_RM ]]; then
# Turns out that \b can be tricked by dashes.
# So if you remove mesa-utils but still want to install "mesa-utils-extra"
diff --git a/lib/functions/configuration/menu.sh b/lib/functions/configuration/menu.sh
index c0ecc6e06..64b5350f3 100644
--- a/lib/functions/configuration/menu.sh
+++ b/lib/functions/configuration/menu.sh
@@ -1,47 +1,60 @@
# Stuff involving dialog
# rpardini: dialog reports what happened via nonzero exit codes.
-# most certainly, we also want to capture the stdout of dialog.
+# we also want to capture the stdout of dialog.
# this is a helper function that handles the error logging on/off and does the capturing
-# then reports via exported variables, which we can test directly.
-# warning: this will exit on errors if dialog is not a terminal or running under CI, or if dialog not installed
-# otherwise it will NOT exit on common errors.
+# then reports via exported variables, which the caller can/should test for later.
+# warning: this will exit with error if stdin/stdout/stderr is not a terminal or running under CI, or if dialog not installed
+# otherwise it will NOT exit with error, even if user cancelled.
+# This is a boring topic, see https://askubuntu.com/questions/491509/how-to-get-dialog-box-input-directed-to-a-variable
function dialog_if_terminal_set_vars() {
export DIALOG_RESULT=""
export DIALOG_EXIT_CODE=0
+
[[ ! -t 0 ]] && exit_with_error "stdin is not a terminal. can't use dialog." "dialog_if_terminal_set_vars ${*}" "err"
+ [[ ! -t 1 ]] && exit_with_error "stdout is not a terminal. can't use dialog." "dialog_if_terminal_set_vars ${*}" "err"
+ [[ ! -t 2 ]] && exit_with_error "stderr is not a terminal. can't use dialog." "dialog_if_terminal_set_vars ${*}" "err"
+
[[ "${CI}" == "true" ]] && exit_with_error "CI=true. can't use dialog." "dialog_if_terminal_set_vars ${*}" "err"
+
[[ ! -f /usr/bin/dialog ]] && exit_with_error "Dialog is not installed at /usr/bin/dialog" "dialog_if_terminal_set_vars ${*}" "err"
+
set +e # allow errors through
set +o errtrace # do not trap errors inside a subshell/function
set +o errexit # disable
- DIALOG_RESULT=$(dialog "$@")
- export DIALOG_EXIT_CODE=$?
- export DIALOG_RESULT
+
+ exec 3>&1 # open fd 3...
+ DIALOG_RESULT=$(dialog "$@" 2>&1 1>&3) # juggle fds and capture.
+ DIALOG_EXIT_CODE=$? # get the exit code.
+ exec 3>&- # close fd 3...
+
set -e # back to normal
set -o errtrace # back to normal
set -o errexit # back to normal
- return 0 # always success
+
+ return 0 # always success, caller must check DIALOG_EXIT_CODE and DIALOG_RESULT
}
# Myy : Menu configuration for choosing desktop configurations
-show_menu() {
+dialog_menu() {
+ export DIALOG_MENU_RESULT=""
provided_title=$1
provided_backtitle=$2
provided_menuname=$3
- dialog_if_terminal_set_vars --stdout --title "$provided_title" --backtitle "${provided_backtitle}" --menu "$provided_menuname" $TTY_Y $TTY_X $((TTY_Y - 8)) "${@:4}"
- [[ $DIALOG_EXIT_CODE != 0 ]] && return $DIALOG_EXIT_CODE
- echo -n "${DIALOG_RESULT}"
+ dialog_if_terminal_set_vars --title "$provided_title" --backtitle "${provided_backtitle}" --menu "$provided_menuname" $TTY_Y $TTY_X $((TTY_Y - 8)) "${@:4}"
+ DIALOG_MENU_RESULT="${DIALOG_RESULT}"
+ return $DIALOG_EXIT_CODE
}
-# Myy : FIXME Factorize
-show_select_menu() {
+# Almost identical, but is a checklist instead of menu
+dialog_checklist() {
+ export DIALOG_CHECKLIST_RESULT=""
provided_title=$1
provided_backtitle=$2
provided_menuname=$3
- dialog_if_terminal_set_vars --stdout --title "${provided_title}" --backtitle "${provided_backtitle}" --checklist "${provided_menuname}" $TTY_Y $TTY_X $((TTY_Y - 8)) "${@:4}"
- [[ $DIALOG_EXIT_CODE != 0 ]] && return $DIALOG_EXIT_CODE
- echo -n "${DIALOG_RESULT}"
+ dialog_if_terminal_set_vars --title "${provided_title}" --backtitle "${provided_backtitle}" --checklist "${provided_menuname}" $TTY_Y $TTY_X $((TTY_Y - 8)) "${@:4}"
+ DIALOG_CHECKLIST_RESULT="${DIALOG_RESULT}"
+ return $DIALOG_EXIT_CODE
}
# Other menu stuff
@@ -63,7 +76,7 @@ show_developer_warning() {
- Forum posts related to dev kernel, CSC, WIP and EOS boards
should be created in the \Z2\"Community forums\"\Zn section
"
- DIALOGRC=$temp_rc dialog_if_terminal_set_vars --stdout --title "Expert mode warning" --backtitle "${backtitle}" --colors --defaultno --no-label "I do not agree" --yes-label "I understand and agree" --yesno "$warn_text" "${TTY_Y}" "${TTY_X}"
+ DIALOGRC=$temp_rc dialog_if_terminal_set_vars --title "Expert mode warning" --backtitle "${backtitle}" --colors --defaultno --no-label "I do not agree" --yes-label "I understand and agree" --yesno "$warn_text" "${TTY_Y}" "${TTY_X}"
[[ ${DIALOG_EXIT_CODE} -ne 0 ]] && exit_with_error "Error switching to the expert mode"
SHOW_WARNING=no
}
diff --git a/lib/functions/general/host.sh b/lib/functions/general/host.sh
index ff5f9ee89..2af993dc9 100644
--- a/lib/functions/general/host.sh
+++ b/lib/functions/general/host.sh
@@ -268,7 +268,7 @@ prepare_host() {
display_alert "Low free space left" "$(($freespace / 1073741824)) GiB" "wrn"
# pause here since dialog-based menu will hide this message otherwise
echo -e "Press \e[0;33m<Ctrl-C>\x1B[0m to abort compilation, \e[0;33m<Enter>\x1B[0m to ignore and continue"
- read
+ read # @TODO: this fails if stdin is not a tty, or just hangs
fi
}
diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh
index 98a0260e6..e26f11b3f 100644
--- a/lib/functions/main/config-prepare.sh
+++ b/lib/functions/main/config-prepare.sh
@@ -17,6 +17,7 @@ function prepare_and_config_main_build_single() {
[[ -z $LANGUAGE ]] && export LANGUAGE="en_US:en" # set to english if not set
[[ -z $CONSOLE_CHAR ]] && export CONSOLE_CHAR="UTF-8" # set console to UTF-8 if not set
+ # @TODO: rpardini: this definitely should NOT be done during config preparation. move outside
if [[ "${CONFIG_DEFS_ONLY}" != "yes" ]]; then
# set log path
LOG_SUBPATH=${LOG_SUBPATH:=debug}
@@ -40,7 +41,7 @@ function prepare_and_config_main_build_single() {
# PROGRESS_LOG_TO_FILE is either yes, or unset. (@TODO: this is still used in buildpkg)
if [[ $PROGRESS_LOG_TO_FILE != yes ]]; then unset PROGRESS_LOG_TO_FILE; fi
- SHOW_WARNING=yes
+ export SHOW_WARNING=yes # If you try something that requires EXPERT=yes.
display_alert "Starting single build process" "${BOARD}" "info"
From 8aed5b427cbc6fd3ddef54b604ee0a8287ebdd7b Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 24 Feb 2022 16:36:59 +0100
Subject: [PATCH] armbian-next: logging: `SHOW_PIDS=yes`
---
lib/functions/logging/logging.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index a3c6523ad..cb6876420 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -175,8 +175,13 @@ function display_alert() {
timing_info="${tool_color}(${normal_color}$(printf "%3s" "${SECONDS}")${tool_color})" # SECONDS is bash builtin for seconds since start of script.
fi
+ local pids_info=""
+ if [[ "${SHOW_PIDS}" == "yes" ]]; then
+ pids_info="${tool_color}(${normal_color}$$ - ${BASHPID}${tool_color})" # BASHPID is the current subshell; $$ is parent's?
+ fi
+
[[ -n $2 ]] && extra=" [${inline_logs_color} ${2} ${normal_color}]"
- echo -e "${normal_color}${left_marker}${padding}${level_indicator}${padding}${normal_color}${right_marker}${timing_info} ${normal_color}${message}${extra}${normal_color}" >&2
+ echo -e "${normal_color}${left_marker}${padding}${level_indicator}${padding}${normal_color}${right_marker}${timing_info}${pids_info} ${normal_color}${message}${extra}${normal_color}" >&2
# Now write to CI, if we're running on it
if [[ "${CI}" == "true" ]] && [[ "${ci_log}" != "" ]]; then
From 5ede8ce433706f6e98413a2e976c8698bbc85afa Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 24 Feb 2022 16:36:18 +0100
Subject: [PATCH] armbian-next: refactor and error-handle most of desktop
configuration, incl menus/dialog
- `dialog_if_terminal_set_vars()` in place of `dialog_if_terminal()`
---
lib/functions/configuration/config-desktop.sh | 137 ++++++++++---
lib/functions/configuration/interactive.sh | 278 ++++++++++++++------------
lib/functions/configuration/main-config.sh | 96 +--------
lib/functions/configuration/menu.sh | 51 +++--
lib/functions/general/repo.sh | 1 +
lib/functions/main/config-prepare.sh | 6 +-
6 files changed, 289 insertions(+), 280 deletions(-)
diff --git a/lib/functions/configuration/config-desktop.sh b/lib/functions/configuration/config-desktop.sh
index 89658fe3b..32afa4a95 100644
--- a/lib/functions/configuration/config-desktop.sh
+++ b/lib/functions/configuration/config-desktop.sh
@@ -1,61 +1,60 @@
-desktop_element_available_for_arch() {
+function desktop_element_available_for_arch() {
local desktop_element_path="${1}"
local targeted_arch="${2}"
-
local arch_limitation_file="${1}/only_for"
-
echo "Checking if ${desktop_element_path} is available for ${targeted_arch} in ${arch_limitation_file}" >> "${DEST}"/${LOG_SUBPATH}/output.log
if [[ -f "${arch_limitation_file}" ]]; then
- grep -- "${targeted_arch}" "${arch_limitation_file}"
- return $?
- else
- return 0
+ if ! grep -- "${targeted_arch}" "${arch_limitation_file}"; then
+ return 1
+ fi
fi
+ return 0
}
-desktop_element_supported() {
+function desktop_element_supported() {
local desktop_element_path="${1}"
-
local support_level_filepath="${desktop_element_path}/support"
+ export desktop_element_supported_result=0
if [[ -f "${support_level_filepath}" ]]; then
local support_level="$(cat "${support_level_filepath}")"
if [[ "${support_level}" != "supported" && "${EXPERT}" != "yes" ]]; then
- return 65
+ desktop_element_supported_result=65
+ return 0
fi
-
- desktop_element_available_for_arch "${desktop_element_path}" "${ARCH}"
- if [[ $? -ne 0 ]]; then
- return 66
+ if ! desktop_element_available_for_arch "${desktop_element_path}" "${ARCH}"; then
+ desktop_element_supported_result=66
+ return 0
fi
else
- return 64
+ desktop_element_supported_result=64
+ return 0
fi
-
return 0
-
}
-desktop_environments_prepare_menu() {
+
+function desktop_environments_prepare_menu() {
for desktop_env_dir in "${DESKTOP_CONFIGS_DIR}/"*; do
- local desktop_env_name=$(basename ${desktop_env_dir})
- local expert_infos=""
+ local desktop_env_name expert_infos="" desktop_element_supported_result=0
+ desktop_env_name=$(basename ${desktop_env_dir})
[[ "${EXPERT}" == "yes" ]] && expert_infos="[$(cat "${desktop_env_dir}/support" 2> /dev/null)]"
- desktop_element_supported "${desktop_env_dir}" "${ARCH}" && options+=("${desktop_env_name}" "${desktop_env_name^} desktop environment ${expert_infos}")
+ desktop_element_supported "${desktop_env_dir}" "${ARCH}"
+ [[ ${desktop_element_supported_result} == 0 ]] && options+=("${desktop_env_name}" "${desktop_env_name^} desktop environment ${expert_infos}")
done
+ return 0
}
-desktop_environment_check_if_valid() {
- local error_msg=""
+function desktop_environment_check_if_valid() {
+ local error_msg="" desktop_element_supported_result=0
desktop_element_supported "${DESKTOP_ENVIRONMENT_DIRPATH}" "${ARCH}"
- local retval=$?
- if [[ ${retval} == 0 ]]; then
+ if [[ ${desktop_element_supported_result} == 0 ]]; then
return
- elif [[ ${retval} == 64 ]]; then
+ elif [[ ${desktop_element_supported_result} == 64 ]]; then
error_msg+="Either the desktop environment ${DESKTOP_ENVIRONMENT} does not exist "
error_msg+="or the file ${DESKTOP_ENVIRONMENT_DIRPATH}/support is missing"
- elif [[ ${retval} == 65 ]]; then
+ elif [[ ${desktop_element_supported_result} == 65 ]]; then
error_msg+="Only experts can build an image with the desktop environment \"${DESKTOP_ENVIRONMENT}\", since the Armbian team won't offer any support for it (EXPERT=${EXPERT})"
- elif [[ ${retval} == 66 ]]; then
+ elif [[ ${desktop_element_supported_result} == 66 ]]; then
error_msg+="The desktop environment \"${DESKTOP_ENVIRONMENT}\" has no packages for your targeted board architecture (BOARD=${BOARD} ARCH=${ARCH}). "
error_msg+="The supported boards architectures are : "
error_msg+="$(cat "${DESKTOP_ENVIRONMENT_DIRPATH}/only_for")"
@@ -66,3 +65,85 @@ desktop_environment_check_if_valid() {
exit_with_error "${error_msg}"
}
+
+function desktop_main_configuration_interactive() {
+
+ # Myy : Once we got a list of selected groups, parse the PACKAGE_LIST inside configuration.sh
+ DESKTOP_ELEMENTS_DIR="${SRC}/config/desktop/${RELEASE}"
+ DESKTOP_CONFIGS_DIR="${DESKTOP_ELEMENTS_DIR}/environments"
+ DESKTOP_CONFIG_PREFIX="config_"
+ DESKTOP_APPGROUPS_DIR="${DESKTOP_ELEMENTS_DIR}/appgroups"
+
+ display_alert "Handling some" "desktop config stuff 1" "${DESKTOP_CONFIGS_DIR}" "debug"
+
+ if [[ $BUILD_DESKTOP == "yes" && -z $DESKTOP_ENVIRONMENT ]]; then
+ options=()
+ desktop_environments_prepare_menu
+ if [[ "${options[0]}" == "" ]]; then
+ exit_with_error "No desktop environment seems to be available for your board ${BOARD} (ARCH : ${ARCH} - EXPERT : ${EXPERT})"
+ fi
+ DESKTOP_ENVIRONMENT=$(show_menu "Choose a desktop environment" "$backtitle" "Select the default desktop environment to bundle with this image" "${options[@]}")
+ unset options
+ if [[ -z "${DESKTOP_ENVIRONMENT}" ]]; then
+ exit_with_error "No desktop environment selected..."
+ fi
+ fi
+ display_alert "Handling some" "desktop config stuff 2" "debug"
+
+ if [[ $BUILD_DESKTOP == "yes" ]]; then
+ DESKTOP_ENVIRONMENT_DIRPATH="${DESKTOP_CONFIGS_DIR}/${DESKTOP_ENVIRONMENT}"
+ desktop_environment_check_if_valid # Make sure desktop config is sane.
+ fi
+
+ display_alert "Handling some" "desktop config stuff 3" "debug"
+
+ if [[ $BUILD_DESKTOP == "yes" && -z $DESKTOP_ENVIRONMENT_CONFIG_NAME ]]; then
+ # FIXME Check for empty folders, just in case the current maintainer
+ # messed up
+ # Note, we could also ignore it and don't show anything in the previous
+ # menu, but that hides information and make debugging harder, which I
+ # don't like. Adding desktop environments as a maintainer is not a
+ # trivial nor common task.
+
+ options=()
+ for configuration in "${DESKTOP_ENVIRONMENT_DIRPATH}/${DESKTOP_CONFIG_PREFIX}"*; do
+ config_filename=$(basename ${configuration})
+ config_name=${config_filename#"${DESKTOP_CONFIG_PREFIX}"}
+ options+=("${config_filename}" "${config_name} configuration")
+ done
+
+ DESKTOP_ENVIRONMENT_CONFIG_NAME=$(show_menu "Choose the desktop environment config" "$backtitle" "Select the configuration for this environment.\nThese are sourced from ${desktop_environment_config_dir}" "${options[@]}")
+ unset options
+
+ if [[ -z $DESKTOP_ENVIRONMENT_CONFIG_NAME ]]; then
+ exit_with_error "No desktop configuration selected... Do you really want a desktop environment ?"
+ fi
+ fi
+ display_alert "Handling some" "desktop config stuff 4" "debug"
+
+ if [[ $BUILD_DESKTOP == "yes" ]]; then
+ DESKTOP_ENVIRONMENT_PACKAGE_LIST_DIRPATH="${DESKTOP_ENVIRONMENT_DIRPATH}/${DESKTOP_ENVIRONMENT_CONFIG_NAME}"
+ DESKTOP_ENVIRONMENT_PACKAGE_LIST_FILEPATH="${DESKTOP_ENVIRONMENT_PACKAGE_LIST_DIRPATH}/packages"
+ fi
+
+ # "-z ${VAR+x}" allows to check for unset variable
+ # Technically, someone might want to build a desktop with no additional
+ # appgroups.
+ if [[ $BUILD_DESKTOP == "yes" && -z ${DESKTOP_APPGROUPS_SELECTED+x} ]]; then
+ options=()
+ for appgroup_path in "${DESKTOP_APPGROUPS_DIR}/"*; do
+ appgroup="$(basename "${appgroup_path}")"
+ options+=("${appgroup}" "${appgroup^}" off)
+ done
+ # FIXME: pardini: here's a subshell to run dialog. in the middle of the main config. refactor this away
+ DESKTOP_APPGROUPS_SELECTED=$(
+ show_select_menu \
+ "Choose desktop softwares to add" \
+ "$backtitle" \
+ "Select which kind of softwares you'd like to add to your build" \
+ "${options[@]}"
+ )
+ unset options
+ fi
+ display_alert "Done with" "desktop config stuff - END" "debug"
+}
diff --git a/lib/functions/configuration/interactive.sh b/lib/functions/configuration/interactive.sh
index 1f6989ae9..28486fa02 100644
--- a/lib/functions/configuration/interactive.sh
+++ b/lib/functions/configuration/interactive.sh
@@ -8,171 +8,183 @@ function interactive_config_prepare_terminal() {
export TTY_Y=$(($(stty size | awk '{print $1}') - 6)) # determine terminal height
fi
fi
-
# We'll use this title on all menus
- export backtitle="Armbian building script, https://www.armbian.com | https://docs.armbian.com | (c) 2013-2021 Igor Pecovnik "
+ export backtitle="Armbian building script, https://www.armbian.com | https://docs.armbian.com | (c) 2013-2022 Igor Pecovnik "
}
function interactive_config_ask_kernel() {
- # @TODO: rpardini: should be refactored into 'menu' or something
+ interactive_config_ask_kernel_only
+ interactive_config_ask_kernel_configure
+}
+
+function interactive_config_ask_kernel_only() {
# if KERNEL_ONLY, KERNEL_CONFIGURE, BOARD, BRANCH or RELEASE are not set, display selection menu
- if [[ -z $KERNEL_ONLY ]]; then
- options+=("yes" "U-boot and kernel packages")
- options+=("no" "Full OS image for flashing")
- KERNEL_ONLY=$(dialog_if_terminal --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags \
- --menu "Select what to build" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
- unset options
- fi
+ [[ -n ${KERNEL_ONLY} ]] && return 0
+ options+=("yes" "U-boot and kernel packages")
+ options+=("no" "Full OS image for flashing")
+ dialog_if_terminal_set_vars --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags --menu "Select what to build" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
+ KERNEL_ONLY="${DIALOG_RESULT}"
+ [[ "${DIALOG_EXIT_CODE}" != "0" ]] && exit_with_error "You cancelled interactive during KERNEL_ONLY selection: '${DIALOG_EXIT_CODE}'" "Build cancelled: ${DIALOG_EXIT_CODE}"
+ unset options
+}
- if [[ -z $KERNEL_CONFIGURE ]]; then
- options+=("no" "Do not change the kernel configuration")
- options+=("yes" "Show a kernel configuration menu before compilation")
- options+=("prebuilt" "Use precompiled packages from Armbian repository")
- KERNEL_CONFIGURE=$(dialog_if_terminal --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags \
- --menu "Select the kernel configuration" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
- unset options
- fi
+function interactive_config_ask_kernel_configure() {
+ [[ -n ${KERNEL_CONFIGURE} ]] && return 0
+ options+=("no" "Do not change the kernel configuration")
+ options+=("yes" "Show a kernel configuration menu before compilation")
+ options+=("prebuilt" "Use precompiled packages from Armbian repository")
+ dialog_if_terminal_set_vars --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags --menu "Select the kernel configuration" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
+ KERNEL_CONFIGURE="${DIALOG_RESULT}"
+ [[ ${DIALOG_EXIT_CODE} != 0 ]] && exit_with_error "You cancelled interactive during kernel configuration" "Build cancelled"
+ unset options
}
function interactive_config_ask_board_list() {
- if [[ -z $BOARD ]]; then
- WIP_STATE=supported
- WIP_BUTTON='CSC/WIP/EOS/TVB'
- STATE_DESCRIPTION=' - boards with high level of software maturity'
- temp_rc=$(mktemp) # @TODO: this is a _very_ early call to mktemp - no TMPDIR set yet - it needs to be cleaned-up somehow
-
- while true; do
- options=()
- if [[ $WIP_STATE == supported ]]; then
- for board in "${SRC}"/config/boards/*.conf; do
- options+=("$(basename "${board}" | cut -d'.' -f1)" "$(head -1 "${board}" | cut -d'#' -f2)")
- done
- else
- for board in "${SRC}"/config/boards/*.wip; do
- options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(WIP)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
- done
- for board in "${SRC}"/config/boards/*.csc; do
- options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(CSC)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
- done
- for board in "${SRC}"/config/boards/*.eos; do
- options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(EOS)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
- done
- for board in "${SRC}"/config/boards/*.tvb; do
- options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(TVB)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
- done
- fi
+ # if BOARD is not set, display selection menu
+ [[ -n ${BOARD} ]] && return 0
- if [[ $WIP_STATE != supported ]]; then
- cat <<- 'EOF' > "${temp_rc}"
- dialog_color = (RED,WHITE,OFF)
- screen_color = (WHITE,RED,ON)
- tag_color = (RED,WHITE,ON)
- item_selected_color = (WHITE,RED,ON)
- tag_selected_color = (WHITE,RED,ON)
- tag_key_selected_color = (WHITE,RED,ON)
- EOF
- else
- echo > "${temp_rc}"
- fi
- BOARD=$(DIALOGRC=$temp_rc dialog_if_terminal --stdout --title "Choose a board" --backtitle "$backtitle" --scrollbar \
- --colors --extra-label "Show $WIP_BUTTON" --extra-button \
- --menu "Select the target board. Displaying:\n$STATE_DESCRIPTION" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
- STATUS=$?
- if [[ $STATUS == 3 ]]; then
- if [[ $WIP_STATE == supported ]]; then
- [[ $SHOW_WARNING == yes ]] && show_developer_warning
- STATE_DESCRIPTION=' - \Z1(CSC)\Zn - Community Supported Configuration\n - \Z1(WIP)\Zn - Work In Progress
- \n - \Z1(EOS)\Zn - End Of Support\n - \Z1(TVB)\Zn - TV boxes'
- WIP_STATE=unsupported
- WIP_BUTTON='matured'
- EXPERT=yes
- else
- STATE_DESCRIPTION=' - boards with high level of software maturity'
- WIP_STATE=supported
- WIP_BUTTON='CSC/WIP/EOS'
- EXPERT=no
- fi
- continue
- elif [[ $STATUS == 0 ]]; then
- break
- fi
- unset options
- done
- fi
-}
+ WIP_STATE=supported
+ WIP_BUTTON='CSC/WIP/EOS/TVB'
+ STATE_DESCRIPTION=' - boards with high level of software maturity'
+ temp_rc=$(mktemp) # @TODO: this is a _very_ early call to mktemp - no TMPDIR set yet - it needs to be cleaned-up somehow
-function interactive_config_ask_branch() {
- # @TODO: rpardini, again, refactor into menu/interactive config stuff
- if [[ -z $BRANCH ]]; then
+ while true; do
options=()
- [[ $KERNEL_TARGET == *current* ]] && options+=("current" "Recommended. Come with best support")
- [[ $KERNEL_TARGET == *legacy* ]] && options+=("legacy" "Old stable / Legacy")
- [[ $KERNEL_TARGET == *edge* && $EXPERT = yes ]] && options+=("edge" "\Z1Bleeding edge from @kernel.org\Zn")
+ if [[ $WIP_STATE == supported ]]; then
+ for board in "${SRC}"/config/boards/*.conf; do
+ options+=("$(basename "${board}" | cut -d'.' -f1)" "$(head -1 "${board}" | cut -d'#' -f2)")
+ done
+ else
+ for board in "${SRC}"/config/boards/*.wip; do
+ options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(WIP)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
+ done
+ for board in "${SRC}"/config/boards/*.csc; do
+ options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(CSC)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
+ done
+ for board in "${SRC}"/config/boards/*.eos; do
+ options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(EOS)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
+ done
+ for board in "${SRC}"/config/boards/*.tvb; do
+ options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(TVB)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
+ done
+ fi
+
+ if [[ $WIP_STATE != supported ]]; then
+ cat <<- 'EOF' > "${temp_rc}"
+ dialog_color = (RED,WHITE,OFF)
+ screen_color = (WHITE,RED,ON)
+ tag_color = (RED,WHITE,ON)
+ item_selected_color = (WHITE,RED,ON)
+ tag_selected_color = (WHITE,RED,ON)
+ tag_key_selected_color = (WHITE,RED,ON)
+ EOF
+ else
+ echo > "${temp_rc}"
+ fi
+
+ DIALOGRC=$temp_rc \
+ dialog_if_terminal_set_vars --stdout --title "Choose a board" --backtitle "$backtitle" --scrollbar \
+ --colors --extra-label "Show $WIP_BUTTON" --extra-button \
+ --menu "Select the target board. Displaying:\n$STATE_DESCRIPTION" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
+ BOARD="${DIALOG_RESULT}"
+ STATUS=${DIALOG_EXIT_CODE}
- # do not display selection dialog if only one kernel branch is available
- if [[ "${#options[@]}" == 2 ]]; then
- BRANCH="${options[0]}"
+ if [[ $STATUS == 3 ]]; then
+ if [[ $WIP_STATE == supported ]]; then
+ [[ $SHOW_WARNING == yes ]] && show_developer_warning
+ STATE_DESCRIPTION=' - \Z1(CSC)\Zn - Community Supported Configuration\n - \Z1(WIP)\Zn - Work In Progress
+ \n - \Z1(EOS)\Zn - End Of Support\n - \Z1(TVB)\Zn - TV boxes'
+ WIP_STATE=unsupported
+ WIP_BUTTON='matured'
+ EXPERT=yes
+ else
+ STATE_DESCRIPTION=' - boards with high level of software maturity'
+ WIP_STATE=supported
+ WIP_BUTTON='CSC/WIP/EOS'
+ EXPERT=no
+ fi
+ continue
+ elif [[ $STATUS == 0 ]]; then
+ break
else
- BRANCH=$(dialog_if_terminal --stdout --title "Choose a kernel" --backtitle "$backtitle" --colors \
- --menu "Select the target kernel branch\nExact kernel versions depend on selected board" \
- $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
+ exit_with_error "You cancelled interactive config" "Build cancelled, board not chosen"
fi
unset options
- [[ $BRANCH == dev && $SHOW_WARNING == yes ]] && show_developer_warning
+ done
+}
+
+function interactive_config_ask_branch() {
+ # if BRANCH not set, display selection menu
+ [[ -n $BRANCH ]] && return 0
+ options=()
+ [[ $KERNEL_TARGET == *current* ]] && options+=("current" "Recommended. Come with best support")
+ [[ $KERNEL_TARGET == *legacy* ]] && options+=("legacy" "Old stable / Legacy")
+ [[ $KERNEL_TARGET == *edge* && $EXPERT = yes ]] && options+=("edge" "\Z1Bleeding edge from @kernel.org\Zn")
+
+ # do not display selection dialog if only one kernel branch is available
+ if [[ "${#options[@]}" == 2 ]]; then
+ BRANCH="${options[0]}"
else
- [[ $BRANCH == next ]] && KERNEL_TARGET="next"
- # next = new legacy. Should stay for backward compatibility, but be removed from menu above
- # or we left definitions in board configs and only remove menu
+ dialog_if_terminal_set_vars --stdout --title "Choose a kernel" --backtitle "$backtitle" --colors \
+ --menu "Select the target kernel branch\nExact kernel versions depend on selected board" \
+ $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
+ BRANCH="${DIALOG_RESULT}"
fi
+ [[ -z ${BRANCH} ]] && exit_with_error "No kernel branch selected"
+ unset options
return 0
}
function interactive_config_ask_release() {
- if [[ $KERNEL_ONLY != yes && -z $RELEASE ]]; then
- options=()
- distros_options
- RELEASE=$(dialog_if_terminal --stdout --title "Choose a release package base" --backtitle "$backtitle" \
- --menu "Select the target OS release package base" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
- echo "options : ${options}"
- unset options
- fi
+ [[ $KERNEL_ONLY == yes ]] && return 0 # Don't ask if building packages only.
+ [[ -n ${RELEASE} ]] && return 0
+
+ options=()
+ distros_options
+ dialog_if_terminal_set_vars --stdout --title "Choose a release package base" --backtitle "$backtitle" --menu "Select the target OS release package base" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
+ RELEASE="${DIALOG_RESULT}"
+ [[ -z ${RELEASE} ]] && exit_with_error "No release selected"
+ unset options
}
function interactive_config_ask_desktop_build() {
# don't show desktop option if we choose minimal build
[[ $BUILD_MINIMAL == yes ]] && BUILD_DESKTOP=no
- if [[ $KERNEL_ONLY != yes && -z $BUILD_DESKTOP ]]; then
- # read distribution support status which is written to the armbian-release file
- set_distribution_status
- options=()
- options+=("no" "Image with console interface (server)")
- options+=("yes" "Image with desktop environment")
- BUILD_DESKTOP=$(dialog_if_terminal --stdout --title "Choose image type" --backtitle "$backtitle" --no-tags \
- --menu "Select the target image type" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
- unset options
- [[ -z $BUILD_DESKTOP ]] && exit_with_error "No option selected"
- if [[ ${BUILD_DESKTOP} == "yes" ]]; then
- BUILD_MINIMAL=no
- SELECTED_CONFIGURATION="desktop"
- fi
+ [[ $KERNEL_ONLY == yes ]] && return 0
+ [[ -n ${BUILD_DESKTOP} ]] && return 0
+ # read distribution support status which is written to the armbian-release file
+ set_distribution_status
+ options=()
+ options+=("no" "Image with console interface (server)")
+ options+=("yes" "Image with desktop environment")
+ dialog_if_terminal_set_vars --stdout --title "Choose image type" --backtitle "$backtitle" --no-tags \
+ --menu "Select the target image type" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
+ BUILD_DESKTOP="${DIALOG_RESULT}"
+ unset options
+ [[ -z $BUILD_DESKTOP ]] && exit_with_error "No image type selected"
+ if [[ ${BUILD_DESKTOP} == "yes" ]]; then
+ BUILD_MINIMAL=no
+ SELECTED_CONFIGURATION="desktop"
fi
return 0
}
function interactive_config_ask_standard_or_minimal() {
- if [[ $KERNEL_ONLY != yes && $BUILD_DESKTOP == no && -z $BUILD_MINIMAL ]]; then
- options=()
- options+=("no" "Standard image with console interface")
- options+=("yes" "Minimal image with console interface")
- BUILD_MINIMAL=$(dialog_if_terminal --stdout --title "Choose image type" --backtitle "$backtitle" --no-tags \
- --menu "Select the target image type" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
- unset options
- [[ -z $BUILD_MINIMAL ]] && exit_with_error "No option selected"
- if [[ $BUILD_MINIMAL == "yes" ]]; then
- SELECTED_CONFIGURATION="cli_minimal"
- else
- SELECTED_CONFIGURATION="cli_standard"
- fi
+ [[ $KERNEL_ONLY == yes ]] && return 0
+ [[ $BUILD_DESKTOP != no ]] && return 0
+ [[ -n $BUILD_MINIMAL ]] && return 0
+ options=()
+ options+=("no" "Standard image with console interface")
+ options+=("yes" "Minimal image with console interface")
+ dialog_if_terminal_set_vars --stdout --title "Choose image type" --backtitle "$backtitle" --no-tags \
+ --menu "Select the target image type" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
+ BUILD_MINIMAL="${DIALOG_RESULT}"
+ unset options
+ [[ -z $BUILD_MINIMAL ]] && exit_with_error "No standard/minimal selected"
+ if [[ $BUILD_MINIMAL == "yes" ]]; then
+ SELECTED_CONFIGURATION="cli_minimal"
+ else
+ SELECTED_CONFIGURATION="cli_standard"
fi
}
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 883550d79..848474b09 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -217,98 +217,7 @@ function do_main_configuration() {
it is often used to in turn override those.
POST_FAMILY_CONFIG
- display_alert "Handling some" "desktop config stuff 1" "debug"
-
- # Myy : Once we got a list of selected groups, parse the PACKAGE_LIST inside configuration.sh
- DESKTOP_ELEMENTS_DIR="${SRC}/config/desktop/${RELEASE}"
- DESKTOP_CONFIGS_DIR="${DESKTOP_ELEMENTS_DIR}/environments"
- DESKTOP_CONFIG_PREFIX="config_"
- DESKTOP_APPGROUPS_DIR="${DESKTOP_ELEMENTS_DIR}/appgroups"
-
- if [[ $BUILD_DESKTOP == "yes" && -z $DESKTOP_ENVIRONMENT ]]; then
-
- options=()
- desktop_environments_prepare_menu
-
- if [[ "${options[0]}" == "" ]]; then
- exit_with_error "No desktop environment seems to be available for your board ${BOARD} (ARCH : ${ARCH} - EXPERT : ${EXPERT})"
- fi
-
- DESKTOP_ENVIRONMENT=$(show_menu "Choose a desktop environment" "$backtitle" "Select the default desktop environment to bundle with this image" "${options[@]}")
-
- unset options
-
- if [[ -z "${DESKTOP_ENVIRONMENT}" ]]; then
- exit_with_error "No desktop environment selected..."
- fi
-
- fi
- display_alert "Handling some" "desktop config stuff 2" "debug"
-
- if [[ $BUILD_DESKTOP == "yes" ]]; then
- # Expected environment variables :
- # - options
- # - ARCH
-
- DESKTOP_ENVIRONMENT_DIRPATH="${DESKTOP_CONFIGS_DIR}/${DESKTOP_ENVIRONMENT}"
-
- desktop_environment_check_if_valid
- fi
- display_alert "Handling some" "desktop config stuff 3" "debug"
-
- if [[ $BUILD_DESKTOP == "yes" && -z $DESKTOP_ENVIRONMENT_CONFIG_NAME ]]; then
- # FIXME Check for empty folders, just in case the current maintainer
- # messed up
- # Note, we could also ignore it and don't show anything in the previous
- # menu, but that hides information and make debugging harder, which I
- # don't like. Adding desktop environments as a maintainer is not a
- # trivial nor common task.
-
- options=()
- for configuration in "${DESKTOP_ENVIRONMENT_DIRPATH}/${DESKTOP_CONFIG_PREFIX}"*; do
- config_filename=$(basename ${configuration})
- config_name=${config_filename#"${DESKTOP_CONFIG_PREFIX}"}
- options+=("${config_filename}" "${config_name} configuration")
- done
-
- DESKTOP_ENVIRONMENT_CONFIG_NAME=$(show_menu "Choose the desktop environment config" "$backtitle" "Select the configuration for this environment.\nThese are sourced from ${desktop_environment_config_dir}" "${options[@]}")
- unset options
-
- if [[ -z $DESKTOP_ENVIRONMENT_CONFIG_NAME ]]; then
- exit_with_error "No desktop configuration selected... Do you really want a desktop environment ?"
- fi
- fi
- display_alert "Handling some" "desktop config stuff 4" "debug"
-
- if [[ $BUILD_DESKTOP == "yes" ]]; then
- DESKTOP_ENVIRONMENT_PACKAGE_LIST_DIRPATH="${DESKTOP_ENVIRONMENT_DIRPATH}/${DESKTOP_ENVIRONMENT_CONFIG_NAME}"
- DESKTOP_ENVIRONMENT_PACKAGE_LIST_FILEPATH="${DESKTOP_ENVIRONMENT_PACKAGE_LIST_DIRPATH}/packages"
- fi
-
- # "-z ${VAR+x}" allows to check for unset variable
- # Technically, someone might want to build a desktop with no additional
- # appgroups.
- if [[ $BUILD_DESKTOP == "yes" && -z ${DESKTOP_APPGROUPS_SELECTED+x} ]]; then
-
- options=()
- for appgroup_path in "${DESKTOP_APPGROUPS_DIR}/"*; do
- appgroup="$(basename "${appgroup_path}")"
- options+=("${appgroup}" "${appgroup^}" off)
- done
-
- # FIXME: pardini: here's a subshell to run dialog. in the middle of the main config. refactor this away
- DESKTOP_APPGROUPS_SELECTED=$(
- show_select_menu \
- "Choose desktop softwares to add" \
- "$backtitle" \
- "Select which kind of softwares you'd like to add to your build" \
- "${options[@]}"
- )
-
- unset options
- fi
-
- display_alert "Done with" "desktop config stuff - END" "debug"
+ desktop_main_configuration_interactive
# dropbear needs to be configured differently # @TODO: rpardini: yes, and? are you a lost leftover comment from a previous era?
[[ $CRYPTROOT_ENABLE == yes && $RELEASE == xenial ]] && exit_with_error "Encrypted rootfs is not supported in Xenial"
@@ -336,9 +245,6 @@ function do_main_configuration() {
CLI_CONFIG_PATH="${SRC}/config/cli/${RELEASE}"
DEBOOTSTRAP_CONFIG_PATH="${CLI_CONFIG_PATH}/debootstrap"
- if [[ $? != 0 ]]; then
- exit_with_error "The desktop environment ${DESKTOP_ENVIRONMENT} is not available for your architecture ${ARCH}"
- fi
AGGREGATION_SEARCH_ROOT_ABSOLUTE_DIRS="
${SRC}/config
diff --git a/lib/functions/configuration/menu.sh b/lib/functions/configuration/menu.sh
index 92afcc5c5..c0ecc6e06 100644
--- a/lib/functions/configuration/menu.sh
+++ b/lib/functions/configuration/menu.sh
@@ -1,10 +1,27 @@
# Stuff involving dialog
-# Pardini: dialog_if_terminal prints error and exits if stdin is not a terminal, or if running under CI.
-function dialog_if_terminal() {
- [[ ! -t 0 ]] && exit_with_error "stdin is not a terminal. can't use dialog." "dialog_if_terminal ${*}" "err"
- [[ "${CI}" == "true" ]] && exit_with_error "CI=true. can't use dialog." "dialog_if_terminal ${*}" "err"
- dialog "$@"
+# rpardini: dialog reports what happened via nonzero exit codes.
+# most certainly, we also want to capture the stdout of dialog.
+# this is a helper function that handles the error logging on/off and does the capturing
+# then reports via exported variables, which we can test directly.
+# warning: this will exit on errors if dialog is not a terminal or running under CI, or if dialog not installed
+# otherwise it will NOT exit on common errors.
+function dialog_if_terminal_set_vars() {
+ export DIALOG_RESULT=""
+ export DIALOG_EXIT_CODE=0
+ [[ ! -t 0 ]] && exit_with_error "stdin is not a terminal. can't use dialog." "dialog_if_terminal_set_vars ${*}" "err"
+ [[ "${CI}" == "true" ]] && exit_with_error "CI=true. can't use dialog." "dialog_if_terminal_set_vars ${*}" "err"
+ [[ ! -f /usr/bin/dialog ]] && exit_with_error "Dialog is not installed at /usr/bin/dialog" "dialog_if_terminal_set_vars ${*}" "err"
+ set +e # allow errors through
+ set +o errtrace # do not trap errors inside a subshell/function
+ set +o errexit # disable
+ DIALOG_RESULT=$(dialog "$@")
+ export DIALOG_EXIT_CODE=$?
+ export DIALOG_RESULT
+ set -e # back to normal
+ set -o errtrace # back to normal
+ set -o errexit # back to normal
+ return 0 # always success
}
# Myy : Menu configuration for choosing desktop configurations
@@ -12,14 +29,9 @@ show_menu() {
provided_title=$1
provided_backtitle=$2
provided_menuname=$3
- # Myy : I don't know why there's a TTY_Y - 8...
- #echo "Provided title : $provided_title"
- #echo "Provided backtitle : $provided_backtitle"
- #echo "Provided menuname : $provided_menuname"
- #echo "Provided options : " "${@:4}"
- #echo "TTY X: $TTY_X Y: $TTY_Y"
- dialog_if_terminal --stdout --title "$provided_title" --backtitle "${provided_backtitle}" \
- --menu "$provided_menuname" $TTY_Y $TTY_X $((TTY_Y - 8)) "${@:4}"
+ dialog_if_terminal_set_vars --stdout --title "$provided_title" --backtitle "${provided_backtitle}" --menu "$provided_menuname" $TTY_Y $TTY_X $((TTY_Y - 8)) "${@:4}"
+ [[ $DIALOG_EXIT_CODE != 0 ]] && return $DIALOG_EXIT_CODE
+ echo -n "${DIALOG_RESULT}"
}
# Myy : FIXME Factorize
@@ -27,12 +39,12 @@ show_select_menu() {
provided_title=$1
provided_backtitle=$2
provided_menuname=$3
- dialog_if_terminal --stdout --title "${provided_title}" --backtitle "${provided_backtitle}" \
- --checklist "${provided_menuname}" $TTY_Y $TTY_X $((TTY_Y - 8)) "${@:4}"
+ dialog_if_terminal_set_vars --stdout --title "${provided_title}" --backtitle "${provided_backtitle}" --checklist "${provided_menuname}" $TTY_Y $TTY_X $((TTY_Y - 8)) "${@:4}"
+ [[ $DIALOG_EXIT_CODE != 0 ]] && return $DIALOG_EXIT_CODE
+ echo -n "${DIALOG_RESULT}"
}
# Other menu stuff
-
show_developer_warning() {
local temp_rc
temp_rc=$(mktemp) # @TODO: this is a _very_ early call to mktemp - no TMPDIR set yet - it needs to be cleaned-up somehow
@@ -51,16 +63,14 @@ show_developer_warning() {
- Forum posts related to dev kernel, CSC, WIP and EOS boards
should be created in the \Z2\"Community forums\"\Zn section
"
- DIALOGRC=$temp_rc dialog_if_terminal --title "Expert mode warning" --backtitle "${backtitle}" --colors --defaultno --no-label "I do not agree" \
- --yes-label "I understand and agree" --yesno "$warn_text" "${TTY_Y}" "${TTY_X}"
- [[ $? -ne 0 ]] && exit_with_error "Error switching to the expert mode"
+ DIALOGRC=$temp_rc dialog_if_terminal_set_vars --stdout --title "Expert mode warning" --backtitle "${backtitle}" --colors --defaultno --no-label "I do not agree" --yes-label "I understand and agree" --yesno "$warn_text" "${TTY_Y}" "${TTY_X}"
+ [[ ${DIALOG_EXIT_CODE} -ne 0 ]] && exit_with_error "Error switching to the expert mode"
SHOW_WARNING=no
}
# Stuff that was in config files
function distro_menu() {
# create a select menu for choosing a distribution based EXPERT status
-
local distrib_dir="${1}"
if [[ -d "${distrib_dir}" && -f "${distrib_dir}/support" ]]; then
@@ -75,7 +85,6 @@ function distro_menu() {
options+=("${distro_codename}" "${distro_fullname} ${expert_infos}")
fi
fi
-
}
function distros_options() {
diff --git a/lib/functions/general/repo.sh b/lib/functions/general/repo.sh
index be3121527..155151300 100644
--- a/lib/functions/general/repo.sh
+++ b/lib/functions/general/repo.sh
@@ -193,6 +193,7 @@ repo-manipulate() {
LIST=("${new_list[@]}")
LIST_LENGTH=$((${#LIST[@]} / 2))
exec 3>&1
+ # @TODO: this is broken!! revisit
TARGET_VERSION=$(dialog_if_terminal --cancel-label "Cancel" --backtitle "BACKTITLE" --no-collapse --title "Remove packages from repositories" --clear --menu "Delete" $((9 + ${LIST_LENGTH})) 82 65 "${LIST[@]}" 2>&1 1>&3)
exitstatus=$?
exec 3>&-
diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh
index 875295a2a..98a0260e6 100644
--- a/lib/functions/main/config-prepare.sh
+++ b/lib/functions/main/config-prepare.sh
@@ -82,7 +82,7 @@ function prepare_and_config_main_build_single() {
[[ -z $KERNEL_ONLY ]] && exit_with_error "No option selected: KERNEL_ONLY"
[[ -z $KERNEL_CONFIGURE ]] && exit_with_error "No option selected: KERNEL_CONFIGURE"
- interactive_config_ask_board_list
+ interactive_config_ask_board_list # @TODO: rpardini: This obtains a list of boards. refactor that...
[[ -z $BOARD ]] && exit_with_error "No board selected: BOARD"
if [[ -f $SRC/config/boards/${BOARD}.conf ]]; then
@@ -113,7 +113,7 @@ function prepare_and_config_main_build_single() {
[[ $KERNEL_TARGET != *$BRANCH* ]] && display_alert "Kernel branch not defined for this board" "$BRANCH for ${BOARD}" "warn"
interactive_config_ask_release
- [[ -z $RELEASE ]] && exit_with_error "No release selected: RELEASE"
+ [[ -z $RELEASE && ${KERNEL_ONLY} != yes ]] && exit_with_error "No release selected: RELEASE"
interactive_config_ask_desktop_build
@@ -191,7 +191,7 @@ function prepare_and_config_main_build_single() {
export KERNEL_MAJOR=5
export KERNEL_MAJOR_SHALLOW_TAG="v${KERNEL_MAJOR_MINOR}-rc1"
elif linux-version compare "${KERNEL_MAJOR_MINOR}" ge "4.4" && linux-version compare "${KERNEL_MAJOR_MINOR}" lt "5.0"; then
- export KERNEL_MAJOR=4 # We support 4.x from 4.4; all require custom packaging.
+ export KERNEL_MAJOR=4 # We support 4.x from 4.4; all require custom packaging.
export KERNEL_MAJOR_SHALLOW_TAG="v${KERNEL_MAJOR_MINOR}-rc1"
else
exit_with_error "Kernel series unsupported" "'${KERNEL_MAJOR_MINOR}' is unsupported, or bad config"
From 6d5802b05da59513e169dd2837d293b8d99e95c4 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 24 Feb 2022 01:27:39 +0100
Subject: [PATCH] [WiP] ddk stuff, allow if not in `$KERNEL_TARGET`
---
lib/functions/main/config-prepare.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh
index 56616cff6..875295a2a 100644
--- a/lib/functions/main/config-prepare.sh
+++ b/lib/functions/main/config-prepare.sh
@@ -102,7 +102,7 @@ function prepare_and_config_main_build_single() {
display_alert "Sourcing board configuration" "${BOARD}.${BOARD_TYPE}" "info"
# shellcheck source=/dev/null
source "${SRC}/config/boards/${BOARD}.${BOARD_TYPE}"
- LINUXFAMILY="${BOARDFAMILY}"
+ LINUXFAMILY="${BOARDFAMILY}" # @TODO: wtf? why? this is (100%?) rewritten by family config!
# @TODO: interesting. this sourced the board config. What sources the family? do_main_configuration!
@@ -110,7 +110,7 @@ function prepare_and_config_main_build_single() {
interactive_config_ask_branch
[[ -z $BRANCH ]] && exit_with_error "No kernel branch selected: BRANCH"
- [[ $KERNEL_TARGET != *$BRANCH* ]] && exit_with_error "Kernel branch not defined for this board" "$BRANCH"
+ [[ $KERNEL_TARGET != *$BRANCH* ]] && display_alert "Kernel branch not defined for this board" "$BRANCH for ${BOARD}" "warn"
interactive_config_ask_release
[[ -z $RELEASE ]] && exit_with_error "No release selected: RELEASE"
From e1e33a3e9413fda79f7240abf61a9bd3ef95d27a Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 24 Feb 2022 00:39:31 +0100
Subject: [PATCH] armbian-next: split `compile_kernel()` function into smaller
functions (+logging)
- `do_with_logging()` galore, much better error reporting for kernel
- `do_with_hooks()` is for the future, just a placeholder for now
---
lib/functions/compilation/kernel.sh | 135 +++++++++++++++++++++---------------
lib/functions/main/default-build.sh | 2 +-
2 files changed, 79 insertions(+), 58 deletions(-)
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 28debe659..5cde24980 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -44,7 +44,28 @@ function run_kernel_make_long_running() {
function compile_kernel() {
local kernel_work_dir="${SRC}/cache/sources/${LINUXSOURCEDIR}"
+ display_alert "Kernel build starting" "${LINUXSOURCEDIR}" "info"
+ LOG_SECTION="kernel_prepare_git" do_with_logging do_with_hooks kernel_prepare_git
+ LOG_SECTION="kernel_maybe_clean" do_with_logging do_with_hooks kernel_maybe_clean
+ local version hash pre_patch_version
+ local kernel_packaging_target
+ LOG_SECTION="kernel_prepare_patching" do_with_logging do_with_hooks kernel_prepare_patching
+ LOG_SECTION="kernel_patching" do_with_logging do_with_hooks kernel_patching
+ [[ $CREATE_PATCHES == yes ]] && userpatch_create "kernel" # create patch for manual source changes
+ local version
+ local toolchain
+ LOG_SECTION="kernel_config" do_with_logging do_with_hooks kernel_config
+ LOG_SECTION="kernel_package_source" do_with_logging do_with_hooks kernel_package_source
+ LOG_SECTION="kernel_make_headers_dtbs_image_modules" do_with_logging do_with_hooks kernel_make_headers_dtbs_image_modules
+ LOG_SECTION="kernel_package" do_with_logging do_with_hooks kernel_package
+ display_alert "Done with" "kernel compile" "debug"
+ cd .. || exit
+ rm -f linux-firmware-image-*.deb # remove firmware image packages here - easier than patching ~40 packaging scripts at once
+ rsync --remove-source-files -rq ./*.deb "${DEB_STORAGE}/" || exit_with_error "Failed moving kernel DEBs"
+ return 0
+}
+function kernel_prepare_git() {
if [[ -n $KERNELSOURCE ]]; then
display_alert "Downloading sources" "kernel" "git"
@@ -62,15 +83,20 @@ function compile_kernel() {
GIT_COLD_BUNDLE_URL="${MAINLINE_KERNEL_COLD_BUNDLE_URL}" \
fetch_from_repo "$KERNELSOURCE" "unused:set via GIT_FIXED_WORKDIR" "$KERNELBRANCH" "yes"
fi
+}
+function kernel_maybe_clean() {
if [[ $CLEAN_LEVEL == *make* ]]; then
display_alert "Cleaning" "$LINUXSOURCEDIR" "info"
(
cd "${kernel_work_dir}"
make ARCH="${ARCHITECTURE}" clean > /dev/null 2>&1
)
+ fasthash_debug "post make clean"
fi
- fasthash_debug "post git clean"
+}
+
+function kernel_prepare_patching() {
if [[ $USE_OVERLAYFS == yes ]]; then
display_alert "Using overlayfs_wrapper" "kernel_${LINUXFAMILY}_${BRANCH}" "debug"
@@ -82,20 +108,21 @@ function compile_kernel() {
rm -f localversion
# read kernel version
- local version hash pre_patch_version
version=$(grab_version "$kernel_work_dir")
pre_patch_version="${version}"
display_alert "Pre-patch kernel version" "${pre_patch_version}" "debug"
# different packaging for 4.3+
- local kernel_packaging_target="deb-pkg"
+ kernel_packaging_target="deb-pkg"
if linux-version compare "${version}" ge 4.3; then
kernel_packaging_target="bindeb-pkg"
fi
# read kernel git hash
hash=$(git --git-dir="$kernel_work_dir"/.git rev-parse HEAD)
+}
+function kernel_patching() {
## Start kernel patching process.
## There's a few objectives here:
## - (always) produce a fasthash: represents "what would be done" (eg: md5 of a patch, crc32 of description).
@@ -130,12 +157,10 @@ function compile_kernel() {
fasthash_debug "finish"
finish_fasthash "kernel" # this reports the final hash and creates git branch to build ID. All modifications commited.
+}
- # create patch for manual source changes in debug mode
- [[ $CREATE_PATCHES == yes ]] && userpatch_create "kernel"
-
+function kernel_config() {
# re-read kernel version after patching
- local version
version=$(grab_version "$kernel_work_dir")
display_alert "Compiling $BRANCH kernel" "$version" "info"
@@ -146,7 +171,6 @@ function compile_kernel() {
display_alert "Native compilation" "target ${ARCH} on host $(dpkg --print-architecture)"
elif [[ $(dpkg --print-architecture) == amd64 ]]; then
display_alert "Cross compilation" "target ${ARCH} on host $(dpkg --print-architecture)"
- local toolchain
toolchain=$(find_toolchain "$KERNEL_COMPILER" "$KERNEL_USE_GCC")
[[ -z $toolchain ]] && exit_with_error "Could not find required toolchain" "${KERNEL_COMPILER}gcc $KERNEL_USE_GCC"
else
@@ -224,14 +248,57 @@ function compile_kernel() {
# Restore the date of .config. Above delta is a pure function, theoretically.
set_files_modification_time "${kernel_config_mtime}" ".config"
+}
+function kernel_package_source() {
# create linux-source package - with already patched sources
# We will build this package first and clear the memory.
if [[ $BUILD_KSRC != no ]]; then
display_alert "Creating kernel source package" "${LINUXCONFIG}" "info"
create_linux-source_package
fi
+}
+
+create_linux-source_package() {
+ ts=$(date +%s)
+ local sources_pkg_dir tmp_src_dir
+ tmp_src_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
+
+ sources_pkg_dir=${tmp_src_dir}/${CHOSEN_KSRC}_${REVISION}_all
+ mkdir -p "${sources_pkg_dir}"/usr/src/ \
+ "${sources_pkg_dir}"/usr/share/doc/linux-source-${version}-${LINUXFAMILY} \
+ "${sources_pkg_dir}"/DEBIAN
+ cp "${SRC}/config/kernel/${LINUXCONFIG}.config" "default_${LINUXCONFIG}.config"
+ xz < .config > "${sources_pkg_dir}/usr/src/${LINUXCONFIG}_${version}_${REVISION}_config.xz"
+
+ display_alert "Compressing sources for the linux-source package"
+ tar cp --directory="$kernel_work_dir" --exclude='.git' --owner=root . |
+ pv -N "$(logging_echo_prefix_for_pv "compress_kernel_sources") $display_name" -p -b -r -s "$(du -sb "$kernel_work_dir" --exclude=='.git' | cut -f1)" |
+ pixz -0 > "${sources_pkg_dir}/usr/src/linux-source-${version}-${LINUXFAMILY}.tar.xz" # @TODO: .deb will compress this later. -0 for now, but should be a plain tar
+ cp COPYING "${sources_pkg_dir}/usr/share/doc/linux-source-${version}-${LINUXFAMILY}/LICENSE"
+
+ cat <<- EOF > "${sources_pkg_dir}"/DEBIAN/control
+ Package: linux-source-${version}-${BRANCH}-${LINUXFAMILY}
+ Version: ${version}-${BRANCH}-${LINUXFAMILY}+${REVISION}
+ Architecture: all
+ Maintainer: $MAINTAINER <$MAINTAINERMAIL>
+ Section: kernel
+ Priority: optional
+ Depends: binutils, coreutils
+ Provides: linux-source, linux-source-${version}-${LINUXFAMILY}
+ Recommends: gcc, make
+ Description: This package provides the source code for the Linux kernel $version
+ EOF
+
+ fakeroot_dpkg_deb_build -z0 "${sources_pkg_dir}" "${sources_pkg_dir}.deb"
+ rsync --remove-source-files -rq "${sources_pkg_dir}.deb" "${DEB_STORAGE}/"
+
+ te=$(date +%s)
+ display_alert "Make the linux-source package" "$(($te - $ts)) sec." "info"
+}
+
+function kernel_make_headers_dtbs_image_modules() {
local -a build_targets=("headers")
[[ "${KERNEL_BUILD_DTBS:-yes}" == "yes" ]] && build_targets+=("dtbs")
build_targets+=("${KERNEL_IMAGE_TYPE}" modules)
@@ -253,6 +320,9 @@ function compile_kernel() {
if [[ ! -f "${check_built_kernel_file}" ]]; then
exit_with_error "Kernel was not built" "${check_built_kernel_file}"
fi
+}
+
+function kernel_package() {
local -a prepackage_targets=(modules_install headers_install)
[[ "${KERNEL_BUILD_DTBS:-yes}" == "yes" ]] && prepackage_targets+=("dtbs_install")
@@ -279,53 +349,4 @@ function compile_kernel() {
fi
display_alert "Package building done" "${LINUXCONFIG} $kernel_packaging_target" "info"
-
- display_alert "Done with" "kernel compile" "debug"
-
- cd .. || exit
- # remove firmware image packages here - easier than patching ~40 packaging scripts at once
- rm -f linux-firmware-image-*.deb
-
- rsync --remove-source-files -rq ./*.deb "${DEB_STORAGE}/" || exit_with_error "Failed moving kernel DEBs"
-
- return 0
-}
-
-create_linux-source_package() {
- ts=$(date +%s)
- local sources_pkg_dir tmp_src_dir
- tmp_src_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
-
- sources_pkg_dir=${tmp_src_dir}/${CHOSEN_KSRC}_${REVISION}_all
- mkdir -p "${sources_pkg_dir}"/usr/src/ \
- "${sources_pkg_dir}"/usr/share/doc/linux-source-${version}-${LINUXFAMILY} \
- "${sources_pkg_dir}"/DEBIAN
-
- cp "${SRC}/config/kernel/${LINUXCONFIG}.config" "default_${LINUXCONFIG}.config"
- xz < .config > "${sources_pkg_dir}/usr/src/${LINUXCONFIG}_${version}_${REVISION}_config.xz"
-
- display_alert "Compressing sources for the linux-source package"
- tar cp --directory="$kernel_work_dir" --exclude='.git' --owner=root . |
- pv -N "$(logging_echo_prefix_for_pv "compress_kernel_sources") $display_name" -p -b -r -s "$(du -sb "$kernel_work_dir" --exclude=='.git' | cut -f1)" |
- pixz -0 > "${sources_pkg_dir}/usr/src/linux-source-${version}-${LINUXFAMILY}.tar.xz" # @TODO: .deb will compress this later. -0 for now, but should be a plain tar
- cp COPYING "${sources_pkg_dir}/usr/share/doc/linux-source-${version}-${LINUXFAMILY}/LICENSE"
-
- cat <<- EOF > "${sources_pkg_dir}"/DEBIAN/control
- Package: linux-source-${version}-${BRANCH}-${LINUXFAMILY}
- Version: ${version}-${BRANCH}-${LINUXFAMILY}+${REVISION}
- Architecture: all
- Maintainer: $MAINTAINER <$MAINTAINERMAIL>
- Section: kernel
- Priority: optional
- Depends: binutils, coreutils
- Provides: linux-source, linux-source-${version}-${LINUXFAMILY}
- Recommends: gcc, make
- Description: This package provides the source code for the Linux kernel $version
- EOF
-
- fakeroot_dpkg_deb_build -z0 "${sources_pkg_dir}" "${sources_pkg_dir}.deb"
- rsync --remove-source-files -rq "${sources_pkg_dir}.deb" "${DEB_STORAGE}/"
-
- te=$(date +%s)
- display_alert "Make the linux-source package" "$(($te - $ts)) sec." "info"
}
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index 3d621c8a1..e2882082b 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -71,7 +71,7 @@ main_default_build_single() {
if [[ ! -f ${DEB_STORAGE}/${CHOSEN_KERNEL}_${REVISION}_${ARCH}.deb ]]; then
export KDEB_CHANGELOG_DIST=$RELEASE
if [[ -n $KERNELSOURCE ]] && [[ "${REPOSITORY_INSTALL}" != *kernel* ]]; then
- LOG_SECTION="compile_kernel" do_with_logging compile_kernel
+ compile_kernel # This handles its own logging sections.
fi
fi
if [[ "${exit_after_kernel_build}" == "yes" ]]; then
From e16b1e19e04308d5313908a5750e74ed2bdd72aa Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 24 Feb 2022 00:31:23 +0100
Subject: [PATCH] armbian-next: `do_with_hooks()` placeholder for future ideas
---
lib/extensions.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/extensions.sh b/lib/extensions.sh
index ae3775b14..ad215bdf0 100644
--- a/lib/extensions.sh
+++ b/lib/extensions.sh
@@ -267,7 +267,7 @@ cleanup_extension_manager() {
}
function cleanup_handler_extensions() {
- display_alert "yeah the extensions trap handler..." "cleanup_handler_extensions" "cleanup"
+ display_alert "yeah the extensions trap handler..." "cleanup_handler_extensions" "cleanup"
cleanup_extension_manager
# Move temporary log file over to final destination.
@@ -417,3 +417,8 @@ enable_extension() {
done
}
+
+# Fancy placeholder for future ideas. allow any core function to be hooked. maybe with "voters" infrastructure?
+function do_with_hooks() {
+ "$@"
+}
From 4416b6b18cdb3c9311aa254189b21dfdf03747cf Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 24 Feb 2022 00:30:55 +0100
Subject: [PATCH] armbian-next: logging: small refactor and `do_with_logging`
admit it does not do error control
---
lib/functions/logging/logging.sh | 40 +++++++++++++++++++++++-----------------
1 file changed, 23 insertions(+), 17 deletions(-)
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index fd23722b8..a3c6523ad 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -40,10 +40,7 @@ function logging_error_show_log() {
return 0
}
-function do_with_logging() {
- [[ -z "${DEST}" ]] && exit_with_error "DEST is not defined. Can't start logging."
-
- # @TODO: check we're not currently logging (eg: this has been called 2 times without exiting)
+function start_logging_section() {
export logging_section_counter=$((logging_section_counter + 1)) # increment counter, used in filename
export CURRENT_LOGGING_COUNTER
CURRENT_LOGGING_COUNTER="$(printf "%03d" "$logging_section_counter")"
@@ -56,13 +53,31 @@ function do_with_logging() {
if [[ "${CI}" == "true" ]]; then
echo "::group::[🥑] Group ${CURRENT_LOGGING_SECTION}"
fi
+ return 0
+}
+
+function finish_logging_section() {
+ # Close opened CI group.
+ if [[ "${CI}" == "true" ]]; then
+ echo "::endgroup::"
+ fi
+}
+
+function do_with_logging() {
+ [[ -z "${DEST}" ]] && exit_with_error "DEST is not defined. Can't start logging."
+
+ # @TODO: check we're not currently logging (eg: this has been called 2 times without exiting)
+
+ start_logging_section
+
+ # Important: no error control is done here.
+ # Called arguments are run with set -e in effect.
# We now execute whatever was passed as parameters, in some different conditions:
# In both cases, writing to stderr will display to terminal.
# So whatever is being called, should prevent rogue stuff writing to stderr.
# this is mostly handled by redirecting stderr to stdout: 2>&1
- local exit_code=176 # fail by default...
if [[ "${SHOW_LOG}" == "yes" ]]; then
local prefix_sed_contents
prefix_sed_contents="$(logging_echo_prefix_for_pv "tool") $(echo -n -e "${tool_color}")"
@@ -76,24 +91,15 @@ function do_with_logging() {
sed -u -e "${prefix_sed_cmd}"
)
"$@" >&3
- exit_code=$? # hopefully this is the pipe
- exec 3>&- # close the file descriptor, lest sed keeps running forever.
+ exec 3>&- # close the file descriptor, lest sed keeps running forever.
else
# If not showing the log, just send stdout to logfile. stderr will flow to screen.
"$@" >> "${CURRENT_LOGFILE}"
- exit_code=$?
fi
- # Close opened CI group.
- if [[ "${CI}" == "true" ]]; then
- echo "::endgroup::"
- fi
+ finish_logging_section
- if [[ $exit_code != 0 ]]; then
- display_alert "build group FAILED: exit code: ${exit_code}" "${CURRENT_LOGGING_SECTION}" "err"
- fi
-
- return $exit_code
+ return 0
}
function display_alert() {
From 3047f4362cad224283a9febd1dc05c4178768964 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 24 Feb 2022 00:28:09 +0100
Subject: [PATCH] armbian-next: fix: traps: `trap_manager_error_handled` is
integer (`-i`) not array (`-a`)
---
lib/functions/logging/traps.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/functions/logging/traps.sh b/lib/functions/logging/traps.sh
index a465e718d..7c3eb97cd 100644
--- a/lib/functions/logging/traps.sh
+++ b/lib/functions/logging/traps.sh
@@ -5,7 +5,7 @@ function traps_init() {
# shellcheck disable=SC2034 # Array of cleanup handlers.
declare -a trap_manager_cleanup_handlers=()
# shellcheck disable=SC2034 # Global to avoid doubly reporting ERR/EXIT pairs.
- declare -a trap_manager_error_handled=0
+ declare -i trap_manager_error_handled=0
trap 'main_trap_handler "ERR" "$?"' ERR
trap 'main_trap_handler "EXIT" "$?"' EXIT
trap 'main_trap_handler "INT" "$?"' INT
From a6df63b905f60045a41f640f98c01e8e5305e8ed Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 24 Feb 2022 00:25:30 +0100
Subject: [PATCH] armbian-next: sunxi-tools: fix logging for sunxi-tools
compilation
---
extensions/sunxi-tools.sh | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/extensions/sunxi-tools.sh b/extensions/sunxi-tools.sh
index 5b699ac14..8f0909426 100644
--- a/extensions/sunxi-tools.sh
+++ b/extensions/sunxi-tools.sh
@@ -6,12 +6,12 @@ function build_host_tools__compile_sunxi_tools() {
# Compile and install only if git commit hash changed
cd "${SRC}"/cache/sources/sunxi-tools || exit
# need to check if /usr/local/bin/sunxi-fexc to detect new Docker containers with old cached sources
- if [[ ! -f .commit_id || $(improved_git rev-parse @ 2> /dev/null) != $(< .commit_id) || ! -f /usr/local/bin/sunxi-fexc ]]; then
+ if [[ ! -f .commit_id || $(git rev-parse @ 2> /dev/null) != $(< .commit_id) || ! -f /usr/local/bin/sunxi-fexc ]]; then
display_alert "Compiling" "sunxi-tools" "info"
- make -s clean > /dev/null
- make -s tools > /dev/null
+ run_host_command_logged make -s clean
+ run_host_command_logged make -s tools
mkdir -p /usr/local/bin/
- make install-tools > /dev/null 2>&1
- improved_git rev-parse @ 2> /dev/null > .commit_id
+ run_host_command_logged make install-tools
+ git rev-parse @ 2> /dev/null > .commit_id
fi
}
From 1f1f7c01f3e77fa8de9c5657a123f0bf723cceb0 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 24 Feb 2022 00:24:33 +0100
Subject: [PATCH] armbian-next: runners now run bash with `-o pipefail` in
addition to `-e`
- attention, only affects stuff run through the functions in runners.sh
---
lib/functions/logging/runners.sh | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index a85914f55..3ef7071c8 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -16,7 +16,7 @@ function chroot_sdcard_apt_get() {
# please, please, unify around this function. if SDCARD is not enough, I'll make a mount version.
function chroot_sdcard() {
- TMPDIR="" run_host_command_logged_raw chroot "${SDCARD}" /bin/bash -e -c "$*"
+ TMPDIR="" run_host_command_logged_raw chroot "${SDCARD}" /bin/bash -e -o pipefail -c "$*"
}
# This should be used if you need to capture the stdout produced by the command. It is NOT logged, and NOT run thru bash, and NOT quoted.
@@ -31,21 +31,21 @@ function chroot_custom_long_running() {
# @TODO: disabled, the pipe causes the left-hand side to subshell and caos ensues.
# local _exit_code=1
# if [[ "${SHOW_LOG}" == "yes" ]] || [[ "${CI}" == "true" ]]; then
- # TMPDIR="" run_host_command_logged_raw chroot "${target}" /bin/bash -e -c "$*"
+ # TMPDIR="" run_host_command_logged_raw chroot "${target}" /bin/bash -e -o pipefail -c "$*"
# _exit_code=$?
# else
- # TMPDIR="" run_host_command_logged_raw chroot "${target}" /bin/bash -e -c "$*" | pv -N "$(logging_echo_prefix_for_pv "${INDICATOR:-compile}")" --progress --timer --line-mode --force --cursor --delay-start 0 -i "0.5"
+ # TMPDIR="" run_host_command_logged_raw chroot "${target}" /bin/bash -e -o pipefail -c "$*" | pv -N "$(logging_echo_prefix_for_pv "${INDICATOR:-compile}")" --progress --timer --line-mode --force --cursor --delay-start 0 -i "0.5"
# _exit_code=$?
# fi
# return $_exit_code
- TMPDIR="" run_host_command_logged_raw chroot "${target}" /bin/bash -e -c "$*"
+ TMPDIR="" run_host_command_logged_raw chroot "${target}" /bin/bash -e -o pipefail -c "$*"
}
function chroot_custom() {
local target=$1
shift
- TMPDIR="" run_host_command_logged_raw chroot "${target}" /bin/bash -e -c "$*"
+ TMPDIR="" run_host_command_logged_raw chroot "${target}" /bin/bash -e -o pipefail -c "$*"
}
# for deb building.
@@ -62,16 +62,16 @@ function run_host_command_logged_long_running() {
# @TODO: disabled. The Pipe used for "pv" causes the left-hand side to run in a subshell.
#local _exit_code=1
#if [[ "${SHOW_LOG}" == "yes" ]] || [[ "${CI}" == "true" ]]; then
- # run_host_command_logged_raw /bin/bash -e -c "$*"
+ # run_host_command_logged_raw /bin/bash -e -o pipefail-c "$*"
# _exit_code=$?
#else
- # run_host_command_logged_raw /bin/bash -e -c "$*" | pv -N "$(logging_echo_prefix_for_pv "${INDICATOR:-compile}") " --progress --timer --line-mode --force --cursor --delay-start 0 -i "2"
+ # run_host_command_logged_raw /bin/bash -e -o pipefail -c "$*" | pv -N "$(logging_echo_prefix_for_pv "${INDICATOR:-compile}") " --progress --timer --line-mode --force --cursor --delay-start 0 -i "2"
# _exit_code=$?
#fi
#return $_exit_code
# Run simple and exit with it's code. Sorry.
- run_host_command_logged_raw /bin/bash -e -c "$*"
+ run_host_command_logged_raw /bin/bash -e -o pipefail -c "$*"
}
# For installing packages host-side. Not chroot!
@@ -113,12 +113,12 @@ function run_host_x86_binary_logged() {
# run_host_command_logged is the very basic, should be used for everything, but, please use helpers above, this is very low-level.
function run_host_command_logged() {
- run_host_command_logged_raw /bin/bash -e -c "$*"
+ run_host_command_logged_raw /bin/bash -e -o pipefail -c "$*"
}
# for interactive, dialog-like host-side invocations. no redirections performed, but same bash usage and expansion, for consistency.
function run_host_command_dialog() {
- /bin/bash -e -c "$*"
+ /bin/bash -e -o pipefail -c "$*"
}
# do NOT use directly, it does NOT expand the way it should (through bash)
From cdfe8e12f9940a457f5161798d11c5131c99b81b Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 23 Feb 2022 21:02:10 +0100
Subject: [PATCH] armbian-next: kernel: reduce logging clutter (CC,LD,AR)
- hide fasthash_debug under `SHOW_FASTHASH`
---
lib/functions/compilation/kernel.sh | 4 ++--
lib/functions/compilation/patch/fasthash.sh | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 014e4d337..28debe659 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -186,7 +186,7 @@ function compile_kernel() {
# hack for OdroidXU4. Copy firmare files
if [[ $BOARD == odroidxu4 ]]; then
mkdir -p "${kernel_work_dir}/firmware/edid"
- cp "${SRC}"/packages/blobs/odroidxu4/*.bin "${kernel_work_dir}/firmware/edid"
+ cp -p "${SRC}"/packages/blobs/odroidxu4/*.bin "${kernel_work_dir}/firmware/edid"
fi
# hack for deb builder. To pack what's missing in headers pack.
@@ -238,7 +238,7 @@ function compile_kernel() {
display_alert "Compiling Kernel" "${LINUXCONFIG} ${KERNEL_IMAGE_TYPE}" "info"
fasthash_debug "pre-compile"
- run_kernel_make_long_running "${build_targets[@]}"
+ make_filter="| grep --line-buffered -v -e 'CC' -e 'LD' -e 'AR'" run_kernel_make_long_running "${build_targets[@]}"
fasthash_debug "post-compile"
if [[ "${DOUBLE_COMPILE_KERNEL}" == "yes" ]]; then
diff --git a/lib/functions/compilation/patch/fasthash.sh b/lib/functions/compilation/patch/fasthash.sh
index 724b8d3cf..0e0cc60f3 100644
--- a/lib/functions/compilation/patch/fasthash.sh
+++ b/lib/functions/compilation/patch/fasthash.sh
@@ -34,10 +34,10 @@ function finish_fasthash() {
}
function fasthash_debug() {
- display_alert "fasthash_debug" "$*" "debug"
- if [[ "${SHOW_DEBUG}" != "yes" ]]; then # enable debug for many, many debugging msgs
+ if [[ "${SHOW_FASTHASH}" != "yes" ]]; then # enable debug for many, many debugging msgs
return 0
fi
+ display_alert "fasthash_debug" "$*" "debug"
find . -type f -printf '%T@ %p\n' |
grep -v -e "\.ko" -e "\.o" -e "\.cmd" -e "\.mod" -e "\.a" -e "\.tmp" -e "\.dtb" -e ".scr" -e "\.\/debian" |
sort -n | tail -n 10 1>&2
From 9ffb0891d8572ab04126bff74632dcabc31a81b1 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 23 Feb 2022 21:00:59 +0100
Subject: [PATCH] armbian-next: `armhf` should make `zImage` -- or should it?
---
config/sources/armhf.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/sources/armhf.conf b/config/sources/armhf.conf
index 2d4682408..01a9eac47 100644
--- a/config/sources/armhf.conf
+++ b/config/sources/armhf.conf
@@ -16,7 +16,7 @@ INITRD_ARCH=arm
QEMU_BINARY="qemu-arm-static"
ARCHITECTURE=arm
ARCH=armhf
-KERNEL_IMAGE_TYPE=Image
+KERNEL_IMAGE_TYPE=zImage
CAN_BUILD_STRETCH=yes
FAST_CREATE_IMAGE="yes"
From 4d8eab13c18560b8d64735858b2cf2462ac3f644 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 23 Feb 2022 13:22:21 +0100
Subject: [PATCH] armbian-next: show logs through ccze; avoid ANSI escapes in
file; `SHOW_xxx` control
- `SHOW_DEBUG` shows the debug level
- `SHOW_COMMAND` shows all invoked commands through the runners
- `SHOW_TRAPS` to show 'cleanup' and 'trap' level
- `SHOW_TIMING` to show $SECONDS but pretty
- replace hardcoded traps/cleanups logging
---
lib/extensions.sh | 2 +-
lib/functions/compilation/patch/fasthash.sh | 6 +++--
lib/functions/general/host.sh | 2 +-
lib/functions/logging/logging.sh | 37 +++++++++++++++++++++++++----
lib/functions/logging/stacktraces.sh | 6 +++--
lib/functions/logging/traps.sh | 8 +++----
lib/functions/main/default-build.sh | 2 +-
7 files changed, 47 insertions(+), 16 deletions(-)
diff --git a/lib/extensions.sh b/lib/extensions.sh
index 9cbc4b78b..ae3775b14 100644
--- a/lib/extensions.sh
+++ b/lib/extensions.sh
@@ -267,7 +267,7 @@ cleanup_extension_manager() {
}
function cleanup_handler_extensions() {
- echo "-- yeah the extensions trap handler..." 1>&2
+ display_alert "yeah the extensions trap handler..." "cleanup_handler_extensions" "cleanup"
cleanup_extension_manager
# Move temporary log file over to final destination.
diff --git a/lib/functions/compilation/patch/fasthash.sh b/lib/functions/compilation/patch/fasthash.sh
index a01fe7664..724b8d3cf 100644
--- a/lib/functions/compilation/patch/fasthash.sh
+++ b/lib/functions/compilation/patch/fasthash.sh
@@ -21,7 +21,6 @@ function initialize_fasthash() {
display_alert "initialize_fasthash" "$*" "debug"
return 0
declare -a fast_hash_list=()
-
}
function fasthash_branch() {
@@ -36,6 +35,9 @@ function finish_fasthash() {
function fasthash_debug() {
display_alert "fasthash_debug" "$*" "debug"
+ if [[ "${SHOW_DEBUG}" != "yes" ]]; then # enable debug for many, many debugging msgs
+ return 0
+ fi
find . -type f -printf '%T@ %p\n' |
grep -v -e "\.ko" -e "\.o" -e "\.cmd" -e "\.mod" -e "\.a" -e "\.tmp" -e "\.dtb" -e ".scr" -e "\.\/debian" |
sort -n | tail -n 10 1>&2
@@ -47,7 +49,7 @@ function get_file_modification_time() {
exit_with_error "Can't get modification time of nonexisting file" "${1}"
fi
- # [[CC]YY]MMDDhhmm[ss] - it is a valid integer
+ # [[CC]YY]MMDDhhmm.[ss] - it is NOT a valid integer
file_date=$(date +%Y%m%d%H%M.%S -r "${1}")
display_alert "Got date ${file_date} for file" "${1}" "debug"
diff --git a/lib/functions/general/host.sh b/lib/functions/general/host.sh
index 34f17a38e..ff5f9ee89 100644
--- a/lib/functions/general/host.sh
+++ b/lib/functions/general/host.sh
@@ -69,7 +69,7 @@ prepare_host() {
nfs-kernel-server ntpdate p7zip-full parted patchutils pigz pixz \
pkg-config pv python3-dev python3-distutils qemu-user-static rsync swig \
systemd-container u-boot-tools udev unzip uuid-dev wget whiptail zip \
- zlib1g-dev file"
+ zlib1g-dev file ccze"
if [[ $(dpkg --print-architecture) == amd64 ]]; then
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index 368d0a8d6..fd23722b8 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -24,8 +24,15 @@ function logging_error_show_log() {
local prefix_sed_contents="${normal_color}${left_marker}${padding}👉${padding}${right_marker} "
local prefix_sed_cmd="s/^/${prefix_sed_contents}/;"
display_alert " 👇👇👇 Showing logfile below 👇👇👇" "${logfile_to_show}" "err"
- # shellcheck disable=SC2002 # my cat is great. thank you, shellcheck.
- cat "${logfile_to_show}" | grep -v -e "^$" | sed -e "${prefix_sed_cmd}" 1>&2 # write it to stderr!!
+
+ if [[ -f /usr/bin/ccze ]]; then # use 'ccze' to colorize the log, making errors a lot more obvious.
+ # shellcheck disable=SC2002 # my cat is great. thank you, shellcheck.
+ cat "${logfile_to_show}" | grep -v -e "^$" | /usr/bin/ccze -A | sed -e "${prefix_sed_cmd}" 1>&2 # write it to stderr!!
+ else
+ # shellcheck disable=SC2002 # my cat is great. thank you, shellcheck.
+ cat "${logfile_to_show}" | grep -v -e "^$" | sed -e "${prefix_sed_cmd}" 1>&2 # write it to stderr!!
+ fi
+
display_alert " 👆👆👆 Showing logfile above 👆👆👆" "${logfile_to_show}" "err"
else
display_alert "✋ Error log not available at this stage of build" "check messages above" "debug"
@@ -92,12 +99,12 @@ function do_with_logging() {
function display_alert() {
# We'll be writing to stderr (" >&2"), so also write the message to the generic logfile, for context.
if [[ -f "${CURRENT_LOGFILE}" ]]; then
- echo "--> A: [" "$@" "]" >> "${CURRENT_LOGFILE}"
+ echo -e "--> A: [" "$@" "]" | sed 's/\x1b\[[0-9;]*m//g' >> "${CURRENT_LOGFILE}"
fi
# If asked, avoid any fancy ANSI escapes completely.
if [[ "${ANSI_COLOR}" == "none" ]]; then
- echo "${@}" >&2
+ echo -e "${@}" | sed 's/\x1b\[[0-9;]*m//g' >&2
return 0
fi
@@ -127,12 +134,26 @@ function display_alert() {
inline_logs_color="\e[0;32m"
;;
+ cleanup | trap)
+ if [[ "${SHOW_TRAPS}" != "yes" ]]; then # enable debug for many, many debugging msgs
+ return 0
+ fi
+ level_indicator="🧽"
+ inline_logs_color="\e[1;33m"
+ ;;
+
debug | deprecation)
+ if [[ "${SHOW_DEBUG}" != "yes" ]]; then # enable debug for many, many debugging msgs
+ return 0
+ fi
level_indicator="✨"
inline_logs_color="\e[1;33m"
;;
command)
+ if [[ "${SHOW_COMMAND}" != "yes" ]]; then # enable to log all calls to external cmds
+ return 0
+ fi
level_indicator="🐸"
inline_logs_color="${tool_color}" # either gray or normal, a bit subdued.
;;
@@ -142,8 +163,14 @@ function display_alert() {
inline_logs_color="\e[1;37m"
;;
esac
+
+ local timing_info=""
+ if [[ "${SHOW_TIMING}" == "yes" ]]; then
+ timing_info="${tool_color}(${normal_color}$(printf "%3s" "${SECONDS}")${tool_color})" # SECONDS is bash builtin for seconds since start of script.
+ fi
+
[[ -n $2 ]] && extra=" [${inline_logs_color} ${2} ${normal_color}]"
- echo -e "${normal_color}${left_marker}${padding}${level_indicator}${padding}${normal_color}${right_marker} ${normal_color}${message}${extra}${normal_color}" >&2
+ echo -e "${normal_color}${left_marker}${padding}${level_indicator}${padding}${normal_color}${right_marker}${timing_info} ${normal_color}${message}${extra}${normal_color}" >&2
# Now write to CI, if we're running on it
if [[ "${CI}" == "true" ]] && [[ "${ci_log}" != "" ]]; then
diff --git a/lib/functions/logging/stacktraces.sh b/lib/functions/logging/stacktraces.sh
index 3ab2900ef..a08c03499 100644
--- a/lib/functions/logging/stacktraces.sh
+++ b/lib/functions/logging/stacktraces.sh
@@ -34,11 +34,13 @@ function show_caller_full() {
local line_no
local function_name
local file_name
+ local padded_function_name
+ local short_file_name
while caller $i; do
((i++))
done | while read -r line_no function_name file_name; do
- local padded_function_name=$(printf "%30s" "$function_name()")
- local short_file_name="${file_name/"${SRC}/"/"./"}"
+ padded_function_name="$(printf "%30s" "$function_name()")"
+ short_file_name="${file_name/"${SRC}/"/"./"}"
echo -e "$padded_function_name --> $short_file_name:$line_no"
done
} || true # always success
diff --git a/lib/functions/logging/traps.sh b/lib/functions/logging/traps.sh
index fb294e06e..a465e718d 100644
--- a/lib/functions/logging/traps.sh
+++ b/lib/functions/logging/traps.sh
@@ -32,7 +32,7 @@ function main_trap_handler() {
stack_caller="$(show_caller_full)"
short_stack="${BASH_SOURCE[1]}:${BASH_LINENO[0]}"
- echo "-- main_trap_handler: ${trap_type} and ${trap_exit_code} trap_manager_error_handled:${trap_manager_error_handled} " 1>&2
+ display_alert "main_trap_handler" "${trap_type} and ${trap_exit_code} trap_manager_error_handled:${trap_manager_error_handled}" "trap"
case "${trap_type}" in
TERM | INT)
@@ -71,7 +71,7 @@ function main_trap_handler() {
# Run the cleanup handlers, if any, and clean the cleanup list.
function run_cleanup_handlers() {
- echo "-- run_cleanup_handlers! list: ${trap_manager_cleanup_handlers[*]}" 1>&2
+ display_alert "run_cleanup_handlers! list:" "${trap_manager_cleanup_handlers[*]}" "cleanup"
if [[ ${#trap_manager_cleanup_handlers[@]} -lt 1 ]]; then
return 0 # No handlers set, just return.
else
@@ -90,12 +90,12 @@ function run_cleanup_handlers() {
# Adds a callback for trap types; first argument is function name; extra params are the types to add for.
function add_cleanup_handler() {
local callback="$1"
- echo "-- Add callback ${callback} as cleanup handler" 1>&2
+ display_alert "Add callback as cleanup handler" "${callback}" "cleanup"
trap_manager_cleanup_handlers+=("$callback")
}
function remove_all_trap_handlers() {
- echo "-- Will remove ALL trap handlers, for a clean exit..." 1>&2
+ display_alert "Will remove ALL trap handlers, for a clean exit..." "" "cleanup"
}
# exit_with_error <message> <highlight>
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index 112628729..3d621c8a1 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -178,7 +178,7 @@ main_default_build_single() {
}
function trap_handler_cleanup_workdir() {
- echo "-- cleanup handler: Should cleanup $WORKDIR WORKDIR here" 1>&2
+ display_alert "Cleanup WORKDIR: $WORKDIR" "trap_handler_cleanup_workdir" "cleanup"
unset TMPDIR
if [[ -d "${WORKDIR}" ]]; then
display_alert "Cleaning up WORKDIR" "$(du -h -s "$WORKDIR")" "debug"
From 6cbb8c84798438b5ca5b353829b011cdbc263f1b Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Tue, 22 Feb 2022 14:36:41 +0100
Subject: [PATCH] armbian-next: add `KERNEL_MAJOR_MINOR=x.z` to every family,
manually from the `KERNELBRANCH`
---
config/sources/families/imx6.conf | 4 +++-
config/sources/families/imx7d.conf | 4 +++-
config/sources/families/include/meson_common.inc | 3 +++
config/sources/families/include/rockchip64_common.inc | 10 +++++-----
config/sources/families/include/sunxi64_common.inc | 3 +++
config/sources/families/include/sunxi_common.inc | 3 +++
config/sources/families/jetson-nano.conf | 3 +++
config/sources/families/media.conf | 4 ++++
config/sources/families/mt7623.conf | 1 +
config/sources/families/mvebu.conf | 5 ++++-
config/sources/families/mvebu64.conf | 3 +++
config/sources/families/odroidxu4.conf | 3 +++
config/sources/families/rk322x.conf | 3 +++
config/sources/families/rk3399.conf | 1 +
config/sources/families/rk35xx.conf | 2 ++
config/sources/families/rockchip.conf | 3 +++
config/sources/families/rockchip64.conf | 1 +
config/sources/families/rockpis.conf | 1 +
config/sources/families/s5p6818.conf | 1 +
config/sources/families/sun50iw9.conf | 1 +
config/sources/families/virtual.conf | 1 +
config/sources/families/zynq.conf | 1 +
22 files changed, 53 insertions(+), 8 deletions(-)
diff --git a/config/sources/families/imx6.conf b/config/sources/families/imx6.conf
index ad22c4982..d63f84266 100644
--- a/config/sources/families/imx6.conf
+++ b/config/sources/families/imx6.conf
@@ -9,13 +9,15 @@ case $BRANCH in
current)
+ export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
KERNELBRANCH='branch:linux-5.15.y'
;;
edge)
- KERNELBRANCH='branch:linux-5.19.y'
+ export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:linux-5.16.y'
;;
diff --git a/config/sources/families/imx7d.conf b/config/sources/families/imx7d.conf
index aa50d4970..8f6c2d3fa 100644
--- a/config/sources/families/imx7d.conf
+++ b/config/sources/families/imx7d.conf
@@ -11,13 +11,15 @@ case $BRANCH in
legacy)
KERNELSOURCE='https://source.codeaurora.org/external/imx/linux-imx'
+ export KERNEL_MAJOR_MINOR="4.14" # Major and minor versions of this kernel.
KERNELBRANCH='branch:imx_4.14.98_2.0.0_ga'
KERNELDIR='linux-imx7'
BOOTBRANCH='branch:imx_v2018.03_4.14.98_2.0.0_ga'
BOOTPATCHDIR="u-boot-imx7d-legacy"
;;
- current | default)
+ current)
KERNELSOURCE='https://source.codeaurora.org/external/imx/linux-imx'
+ export KERNEL_MAJOR_MINOR="5.4" # Major and minor versions of this kernel.
KERNELBRANCH='branch:imx_5.4.70_2.3.0'
KERNELDIR='linux-imx7-current'
BOOTBRANCH='branch:imx_v2020.04_5.4.70_2.3.0'
diff --git a/config/sources/families/include/meson_common.inc b/config/sources/families/include/meson_common.inc
index 62f30cfde..d24ac85ee 100644
--- a/config/sources/families/include/meson_common.inc
+++ b/config/sources/families/include/meson_common.inc
@@ -17,18 +17,21 @@ GOVERNOR=ondemand
case $BRANCH in
legacy)
+ export KERNEL_MAJOR_MINOR="5.4" # Major and minor versions of this kernel.
KERNELBRANCH="branch:linux-5.4.y"
KERNELPATCHDIR='meson-'$BRANCH
;;
current)
+ export KERNEL_MAJOR_MINOR="5.10" # Major and minor versions of this kernel.
KERNELBRANCH="branch:linux-5.10.y"
KERNELPATCHDIR='meson-current'
;;
edge)
+ export KERNEL_MAJOR_MINOR="5.11" # Major and minor versions of this kernel.
KERNELBRANCH="branch:linux-5.11.y"
KERNELPATCHDIR='meson-current'
diff --git a/config/sources/families/include/rockchip64_common.inc b/config/sources/families/include/rockchip64_common.inc
index 0f0000d26..815e87b26 100644
--- a/config/sources/families/include/rockchip64_common.inc
+++ b/config/sources/families/include/rockchip64_common.inc
@@ -90,8 +90,8 @@ case $BRANCH in
current)
- KERNELBRANCH="branch:linux-5.15.y"
- KERNELBRANCH="tag:v5.15.35"
+ export KERNEL_MAJOR_MINOR="5.10" # Major and minor versions of this kernel.
+ KERNELBRANCH="branch:linux-5.10.y"
KERNELPATCHDIR='rockchip64-'$BRANCH
LINUXFAMILY=rockchip64
LINUXCONFIG='linux-rockchip64-'$BRANCH
@@ -100,8 +100,8 @@ case $BRANCH in
edge)
KERNELPATCHDIR='rockchip64-'$BRANCH
- KERNELBRANCH="branch:linux-5.17.y"
- KERNELBRANCH="tag:v5.17.5"
+ export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
+ KERNELBRANCH="branch:linux-5.15.y"
LINUXFAMILY=rockchip64
LINUXCONFIG='linux-rockchip64-'$BRANCH
@@ -234,7 +234,7 @@ family_tweaks() {
chroot $SDCARD /bin/bash -c "systemctl --no-reload enable z28pro-bluetooth.service >/dev/null 2>&1"
- elif [[ $BOARD == nanopi-r2s || $BOARD == nanopi-r2c || $BOARD == orangepi-r1plus || $BOARD == orangepi-r1plus-lts ]]; then
+ elif [[ $BOARD == nanopi-r2s || $BOARD == nanopi-r2c || $BOARD == orangepi-r1plus ]]; then
# rename USB based network to lan0
mkdir -p $SDCARD/etc/udev/rules.d/
diff --git a/config/sources/families/include/sunxi64_common.inc b/config/sources/families/include/sunxi64_common.inc
index c7a3e0a20..323d67c1c 100644
--- a/config/sources/families/include/sunxi64_common.inc
+++ b/config/sources/families/include/sunxi64_common.inc
@@ -14,16 +14,19 @@ export KERNELPATCHDIR='sunxi-'$BRANCH
case $BRANCH in
legacy)
+ export KERNEL_MAJOR_MINOR="5.10" # Major and minor versions of this kernel.
export KERNELBRANCH="branch:linux-5.10.y"
export KERNELBRANCH_MEGOUS="branch:orange-pi-5.10"
;;
current)
+ export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
export KERNELBRANCH="branch:linux-5.15.y"
export KERNELBRANCH_MEGOUS="branch:orange-pi-5.15"
;;
edge)
+ export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
export KERNELBRANCH="branch:linux-5.16.y"
export KERNELBRANCH_MEGOUS="branch:orange-pi-5.16"
;;
diff --git a/config/sources/families/include/sunxi_common.inc b/config/sources/families/include/sunxi_common.inc
index c450fecbd..a9f14f950 100644
--- a/config/sources/families/include/sunxi_common.inc
+++ b/config/sources/families/include/sunxi_common.inc
@@ -15,16 +15,19 @@ export KERNELPATCHDIR='sunxi-'$BRANCH
case $BRANCH in
legacy)
+ export KERNEL_MAJOR_MINOR="5.10" # Major and minor versions of this kernel.
export KERNELBRANCH="branch:linux-5.10.y"
export KERNELBRANCH_MEGOUS="branch:orange-pi-5.10"
;;
current)
+ export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
export KERNELBRANCH="branch:linux-5.15.y"
export KERNELBRANCH_MEGOUS="branch:orange-pi-5.15"
;;
edge)
+ export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
export KERNELBRANCH="branch:linux-5.16.y"
export KERNELBRANCH_MEGOUS="branch:orange-pi-5.16"
;;
diff --git a/config/sources/families/jetson-nano.conf b/config/sources/families/jetson-nano.conf
index fbc14d5af..77b83e479 100644
--- a/config/sources/families/jetson-nano.conf
+++ b/config/sources/families/jetson-nano.conf
@@ -13,6 +13,7 @@ case $BRANCH in
legacy)
KERNELDIR='linux-nano'
KERNELSOURCE='https://github.com/150balbes/Jetson-Nano'
+ export KERNEL_MAJOR_MINOR="4.9" # Major and minor versions of this kernel.
KERNELBRANCH='branch:4.9.201'
EXTRAWIFI="no"
BOOT_FDT_FILE="none"
@@ -21,6 +22,7 @@ case $BRANCH in
;;
current)
+ export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
KERNELBRANCH="branch:linux-5.15.y"
KERNELPATCHDIR='media-'$BRANCH
LINUXFAMILY=media
@@ -30,6 +32,7 @@ case $BRANCH in
edge)
SKIP_BOOTSPLASH="yes"
+ export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
KERNELBRANCH="branch:linux-5.16.y"
KERNELPATCHDIR='media-'$BRANCH
LINUXFAMILY=media
diff --git a/config/sources/families/media.conf b/config/sources/families/media.conf
index 7c5a76af6..07529a634 100644
--- a/config/sources/families/media.conf
+++ b/config/sources/families/media.conf
@@ -13,6 +13,7 @@ case $BRANCH in
if [[ $BOARD == station-p2 || $BOARD == station-m2 ]]; then
KERNELSOURCE='https://github.com/150balbes/rockchip-kernel'
+ export KERNEL_MAJOR_MINOR="4.19" # Major and minor versions of this kernel.
KERNELBRANCH='branch:kernel-4.19'
KERNELPATCHDIR='station-p2-'$BRANCH
LINUXCONFIG='linux-station-p2-'$BRANCH
@@ -21,6 +22,7 @@ case $BRANCH in
WIREGUARD="no"
else
KERNELSOURCE='https://github.com/ayufan-rock64/linux-kernel'
+ export KERNEL_MAJOR_MINOR="4.4" # Major and minor versions of this kernel.
KERNELBRANCH='tag:4.4.202-1237-rockchip-ayufan'
KERNELPATCHDIR='rockchip64-'$BRANCH
LINUXCONFIG='linux-rockchip64-'$BRANCH
@@ -29,6 +31,7 @@ case $BRANCH in
;;
current)
+ export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
KERNELBRANCH="branch:linux-5.15.y"
KERNELPATCHDIR='media-'$BRANCH
LINUXFAMILY=media
@@ -37,6 +40,7 @@ case $BRANCH in
edge)
SKIP_BOOTSPLASH="yes"
+ export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
KERNELBRANCH="branch:linux-5.16.y"
KERNELPATCHDIR='media-'$BRANCH
LINUXFAMILY=media
diff --git a/config/sources/families/mt7623.conf b/config/sources/families/mt7623.conf
index 8c0d9f754..2eb00c881 100644
--- a/config/sources/families/mt7623.conf
+++ b/config/sources/families/mt7623.conf
@@ -9,6 +9,7 @@ case $BRANCH in
legacy)
+ export KERNEL_MAJOR_MINOR="4.19" # Major and minor versions of this kernel.
KERNELBRANCH='branch:linux-4.19.y'
;;
diff --git a/config/sources/families/mvebu.conf b/config/sources/families/mvebu.conf
index 66abc39c3..ad240d6b6 100644
--- a/config/sources/families/mvebu.conf
+++ b/config/sources/families/mvebu.conf
@@ -11,19 +11,22 @@ fi
case $BRANCH in
legacy)
+ export KERNEL_MAJOR_MINOR="4.19" # Major and minor versions of this kernel.
KERNELBRANCH='tag:v4.19.167'
;;
current)
+ export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
KERNELBRANCH='branch:linux-5.15.y'
;;
edge)
- KERNELBRANCH='branch:linux-5.17.y'
+ export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
+ KERNELBRANCH='branch:linux-5.16.y'
LINUXCONFIG='linux-mvebu-edge'
KERNELPATCHDIR="mvebu-edge"
diff --git a/config/sources/families/mvebu64.conf b/config/sources/families/mvebu64.conf
index 58d66ab98..27c4e318a 100644
--- a/config/sources/families/mvebu64.conf
+++ b/config/sources/families/mvebu64.conf
@@ -29,6 +29,7 @@ case $BRANCH in
legacy)
KERNELSOURCE='https://github.com/MarvellEmbeddedProcessors/linux-marvell.git'
+ export KERNEL_MAJOR_MINOR="4.14" # Major and minor versions of this kernel.
KERNELBRANCH='branch:linux-4.14.22-armada-18.06'
KERNELDIR='linux-marvell'
@@ -36,11 +37,13 @@ case $BRANCH in
current)
+ export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
KERNELBRANCH='branch:linux-5.15.y'
;;
edge)
+ export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
KERNELBRANCH='branch:linux-5.16.y'
;;
diff --git a/config/sources/families/odroidxu4.conf b/config/sources/families/odroidxu4.conf
index ee4a32af5..02a9947a9 100644
--- a/config/sources/families/odroidxu4.conf
+++ b/config/sources/families/odroidxu4.conf
@@ -10,6 +10,7 @@ case $BRANCH in
legacy)
KERNELSOURCE='https://github.com/hardkernel/linux'
+ export KERNEL_MAJOR_MINOR="4.14" # Major and minor versions of this kernel.
KERNELBRANCH='branch:odroidxu4-4.14.y'
KERNELDIR='linux-odroidxu4'
@@ -18,11 +19,13 @@ case $BRANCH in
current)
KERNELSOURCE='https://github.com/hardkernel/linux'
+ export KERNEL_MAJOR_MINOR="5.4" # Major and minor versions of this kernel.
KERNELBRANCH='branch:odroid-5.4.y'
KERNELDIR='linux-odroidxu4'
;;
edge)
+ export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
KERNELBRANCH='branch:linux-5.16.y'
;;
diff --git a/config/sources/families/rk322x.conf b/config/sources/families/rk322x.conf
index 1a8ba863f..897a452db 100644
--- a/config/sources/families/rk322x.conf
+++ b/config/sources/families/rk322x.conf
@@ -12,6 +12,7 @@ case $BRANCH in
legacy)
KERNELSOURCE='https://github.com/armbian/linux'
+ export KERNEL_MAJOR_MINOR="4.4" # Major and minor versions of this kernel.
KERNELBRANCH='branch:stable-4.4-rk3288-linux-v2.x'
KERNELDIR='linux-rockchip'
@@ -19,12 +20,14 @@ case $BRANCH in
current)
+ export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
KERNELBRANCH='branch:linux-5.15.y'
;;
edge)
+ export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
KERNELBRANCH='branch:linux-5.16.y'
;;
diff --git a/config/sources/families/rk3399.conf b/config/sources/families/rk3399.conf
index b7d5ccdb7..cc1f3ba71 100644
--- a/config/sources/families/rk3399.conf
+++ b/config/sources/families/rk3399.conf
@@ -5,6 +5,7 @@ case $BRANCH in
legacy)
KERNELSOURCE='https://github.com/friendlyarm/kernel-rockchip'
+ export KERNEL_MAJOR_MINOR="4.4" # Major and minor versions of this kernel.
KERNELBRANCH='branch:nanopi4-linux-v4.4.y'
KERNELDIR='linux-rockchip64'
KERNELCONFIG='linux-rockchip64'
diff --git a/config/sources/families/rk35xx.conf b/config/sources/families/rk35xx.conf
index acc5ffc16..3744e6e5f 100644
--- a/config/sources/families/rk35xx.conf
+++ b/config/sources/families/rk35xx.conf
@@ -12,6 +12,7 @@ case $BRANCH in
UBOOT_USE_GCC='< 8.0'
BOOTDIR='u-boot-rockchip64'
KERNELSOURCE='https://github.com/radxa/kernel'
+ export KERNEL_MAJOR_MINOR="4.19" # Major and minor versions of this kernel.
KERNELBRANCH='branch:stable-4.19-rock3'
KERNELDIR='linux-rockchip64'
KERNELPATCHDIR='rk35xx-legacy'
@@ -23,6 +24,7 @@ case $BRANCH in
# temporary until kernel 5.16 is well supported for rockchip64
edge)
+ export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
KERNELBRANCH="branch:linux-5.16.y"
KERNELPATCHDIR='rk35xx-'$BRANCH
SKIP_BOOTSPLASH="yes"
diff --git a/config/sources/families/rockchip.conf b/config/sources/families/rockchip.conf
index 5870ed1fb..55f56e492 100644
--- a/config/sources/families/rockchip.conf
+++ b/config/sources/families/rockchip.conf
@@ -20,6 +20,7 @@ case $BRANCH in
legacy)
KERNELSOURCE='https://github.com/armbian/linux'
+ export KERNEL_MAJOR_MINOR="4.4" # Major and minor versions of this kernel.
KERNELBRANCH='branch:stable-4.4-rk3288-linux'
KERNELDIR='linux-rockchip'
@@ -27,12 +28,14 @@ case $BRANCH in
current)
+ export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
KERNELBRANCH='branch:linux-5.15.y'
;;
edge)
+ export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel.
KERNELBRANCH='branch:linux-5.16.y'
;;
diff --git a/config/sources/families/rockchip64.conf b/config/sources/families/rockchip64.conf
index 6790c35b7..7734f69a7 100644
--- a/config/sources/families/rockchip64.conf
+++ b/config/sources/families/rockchip64.conf
@@ -5,6 +5,7 @@ case $BRANCH in
legacy)
KERNELDIR='linux-rockchip64'
KERNELSOURCE='https://github.com/ayufan-rock64/linux-kernel'
+ export KERNEL_MAJOR_MINOR="4.4" # Major and minor versions of this kernel.
KERNELBRANCH='tag:4.4.202-1237-rockchip-ayufan'
KERNELPATCHDIR='rockchip64-'$BRANCH
;;
diff --git a/config/sources/families/rockpis.conf b/config/sources/families/rockpis.conf
index 0f40c9ad7..2dd31ae5b 100644
--- a/config/sources/families/rockpis.conf
+++ b/config/sources/families/rockpis.conf
@@ -35,6 +35,7 @@ case $BRANCH in
UBOOT_USE_GCC='< 8.0'
BOOTDIR='u-boot-rockchip64'
KERNELSOURCE='https://github.com/piter75/rockchip-kernel'
+ export KERNEL_MAJOR_MINOR="4.4" # Major and minor versions of this kernel.
KERNELBRANCH='branch:rockpis-develop-4.4'
KERNELDIR='linux-rockchip64'
unset IDBLOADER_BLOB
diff --git a/config/sources/families/s5p6818.conf b/config/sources/families/s5p6818.conf
index 9074ba85a..38e4e566e 100644
--- a/config/sources/families/s5p6818.conf
+++ b/config/sources/families/s5p6818.conf
@@ -9,6 +9,7 @@ ATF_COMPILE="no"
case $BRANCH in
legacy | current)
KERNELSOURCE='https://github.com/armbian/linux'
+ export KERNEL_MAJOR_MINOR="4.14" # Major and minor versions of this kernel. See https://github.com/armbian/linux/blob/s5p6818/Makefile
KERNELBRANCH='branch:s5p6818'
KERNELDIR='linux-mainline'
;;
diff --git a/config/sources/families/sun50iw9.conf b/config/sources/families/sun50iw9.conf
index 3384f869a..c8b311493 100644
--- a/config/sources/families/sun50iw9.conf
+++ b/config/sources/families/sun50iw9.conf
@@ -10,6 +10,7 @@ case $BRANCH in
LINUXFAMILY=sun50iw9
KERNELSOURCE='https://github.com/orangepi-xunlong/linux-orangepi.git'
+ export KERNEL_MAJOR_MINOR="4.9" # Major and minor versions of this kernel.
KERNELBRANCH="branch:orange-pi-4.9-sun50iw9"
KERNELPATCHDIR=${BOARDFAMILY}-${BRANCH}
KERNELDIR='linux-orangepi'
diff --git a/config/sources/families/virtual.conf b/config/sources/families/virtual.conf
index 41d36d1f9..3745afee6 100644
--- a/config/sources/families/virtual.conf
+++ b/config/sources/families/virtual.conf
@@ -1,5 +1,6 @@
BOOTBRANCH='tag:v2021.04'
+export KERNEL_MAJOR_MINOR="5.10" # Major and minor versions of this kernel.
KERNELBRANCH='branch:linux-5.10.y'
ARCH=arm64
diff --git a/config/sources/families/zynq.conf b/config/sources/families/zynq.conf
index b69bcc347..2bc2d6e9d 100644
--- a/config/sources/families/zynq.conf
+++ b/config/sources/families/zynq.conf
@@ -3,6 +3,7 @@ SERIALCON='ttyPS0'
LINUXFAMILY=zynq
KERNELSOURCE='https://github.com/Xilinx/linux-xlnx.git'
+export KERNEL_MAJOR_MINOR="5.4" # Major and minor versions of this kernel. See https://github.com/Xilinx/linux-xlnx/blob/xilinx-v2020.2/Makefile
KERNELBRANCH='tag:xilinx-v2020.2'
KERNELDIR='linux-xlnx'
KERNELPATCHDIR='zynq-'$BRANCH
From 7b907d446bfae3db8c5afb4431d8e9bbd9e5df9e Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Tue, 22 Feb 2022 02:27:09 +0100
Subject: [PATCH] armbian-next: cold/warm bundles import/download/export for
fetch_from_repo
- warm remote, if present, can be exported shallow
- if warm remote bundle is present, can be imported shallow too
- fallback to cold bundle if warm not present
- export (from cold, if exists + warm) shallow bundle
- use temp clone and DATE (not rev or tag) for shallowing, WORKS!
- info JSON/CSV, include "config_ok" true/false, kernel/uboot info
- include logs for failed configs too
- core reports ARMBIAN_WILL_BUILD_KERNEL and ARMBIAN_WILL_BUILD_UBOOT now with package names
---
lib/functions/compilation/kernel.sh | 16 ++-
lib/functions/general/git.sh | 259 +++++++++++++++++++++++++----------
lib/functions/main/config-prepare.sh | 50 +++++--
lib/tools/info.py | 17 +--
lib/tools/json2csv.py | 2 +
5 files changed, 246 insertions(+), 98 deletions(-)
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 9deb439eb..014e4d337 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -47,10 +47,18 @@ function compile_kernel() {
if [[ -n $KERNELSOURCE ]]; then
display_alert "Downloading sources" "kernel" "git"
+
+ # Does not work well with rpi for example: GIT_WARM_REMOTE_SHALLOW_AT_TAG="v${KERNEL_MAJOR_MINOR}" \
+ # GIT_WARM_REMOTE_SHALLOW_AT_TAG sets GIT_WARM_REMOTE_SHALLOW_AT_DATE for you, as long as it is included by GIT_WARM_REMOTE_FETCH_TAGS
+ # GIT_WARM_REMOTE_SHALLOW_AT_DATE is the only one really used for making shallow
+
GIT_FIXED_WORKDIR="${LINUXSOURCEDIR}" \
- WARM_REMOTE_NAME="kernel-stable-${KERNEL_MAJOR_MINOR}" \
- WARM_REMOTE_URL="${MAINLINE_KERNEL_SOURCE}" \
- WARM_REMOTE_BRANCH="branch:linux-${KERNEL_MAJOR_MINOR}.y" \
+ GIT_WARM_REMOTE_NAME="kernel-stable-${KERNEL_MAJOR_MINOR}" \
+ GIT_WARM_REMOTE_URL="${MAINLINE_KERNEL_SOURCE}" \
+ GIT_WARM_REMOTE_BRANCH="linux-${KERNEL_MAJOR_MINOR}.y" \
+ GIT_WARM_REMOTE_FETCH_TAGS="v${KERNEL_MAJOR_MINOR}*" \
+ GIT_WARM_REMOTE_SHALLOW_AT_TAG="${KERNEL_MAJOR_SHALLOW_TAG}" \
+ GIT_WARM_REMOTE_BUNDLE="kernel-stable-${KERNEL_MAJOR_MINOR}" \
GIT_COLD_BUNDLE_URL="${MAINLINE_KERNEL_COLD_BUNDLE_URL}" \
fetch_from_repo "$KERNELSOURCE" "unused:set via GIT_FIXED_WORKDIR" "$KERNELBRANCH" "yes"
fi
@@ -254,7 +262,7 @@ function compile_kernel() {
# Prepare for packaging, using the exact same options as original compile.
display_alert "Installing kernel headers and modules for packaging" "${LINUXCONFIG} ${prepackage_targets[*]}" "info"
fasthash_debug "pre-prepackage"
- make_filter="| grep --line-buffered -v -e 'INSTALL' -e 'SIGN'" run_kernel_make_long_running "${prepackage_targets[@]}"
+ make_filter="| grep --line-buffered -v -e 'INSTALL' -e 'SIGN' -e 'XZ'" run_kernel_make_long_running "${prepackage_targets[@]}"
fasthash_debug "post-prepackage"
# produce deb packages: image, headers, firmware, dtb
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index 15a5cbbd2..73c066be4 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -8,7 +8,7 @@ improved_git() {
local delay=10
local count=0
while [ $count -lt $retries ]; do
- run_host_command_logged_raw "$real_git" --no-pager "$@" && return 0 # this gobbles up errors, but returns if OK, so everything after is error
+ run_host_command_logged_raw eatmydata "$real_git" --no-pager "$@" && return 0 # this gobbles up errors, but returns if OK, so everything after is error
count=$((count + 1))
display_alert "improved_git try $count failed, retrying in ${delay} seconds" "git $*" "warn"
sleep $delay
@@ -17,6 +17,11 @@ improved_git() {
return 17 # explode with error if this is reached, "too many retries"
}
+# Not improved, just regular, but logged "correctly".
+regular_git() {
+ run_host_command_logged_raw eatmydata -- git --no-pager "$@"
+}
+
# avoid repeating myself too much
function improved_git_fetch() {
improved_git fetch --progress --verbose --no-auto-maintenance "$@"
@@ -67,6 +72,7 @@ fetch_from_repo() {
git_work_dir="${SRC}/cache/sources/${workdir}"
+ # if GIT_FIXED_WORKDIR has something, ignore above logic and use that directly.
if [[ "${GIT_FIXED_WORKDIR}" != "" ]]; then
display_alert "GIT_FIXED_WORKDIR is set to" "${GIT_FIXED_WORKDIR}" "debug"
git_work_dir="${SRC}/cache/sources/${GIT_FIXED_WORKDIR}"
@@ -83,11 +89,15 @@ fetch_from_repo() {
exit_with_error "Remote URL does not match. Stopping!" "${git_work_dir} $dir $ref_name" "warn"
fi
+ local do_warmup_remote="no" do_cold_bundle="no" do_add_origin="no"
+
if [[ "$(git rev-parse --git-dir)" != ".git" ]]; then
display_alert "Creating local copy" "$dir $ref_name"
- improved_git init -q --initial-branch="armbian_unused_initial_branch" .
- improved_git remote add origin "${url}"
- offline=false # Force online, we'll need to fetch.
+ regular_git init -q --initial-branch="armbian_unused_initial_branch" .
+ offline=false # Force online, we'll need to fetch.
+ do_add_origin="yes" # Just created the repo, it needs an origin later.
+ do_warmup_remote="yes" # Just created the repo, mark it as ready to receive the warm remote if exists.
+ do_cold_bundle="yes" # Just created the repo, mark it as ready to receive a cold bundle if that is available.
fi
local changed=false
@@ -129,61 +139,12 @@ fetch_from_repo() {
fi # offline
if [[ "${changed}" == "true" ]]; then
+ git_handle_cold_and_warm_bundle_remotes # Delegate to function to find or create cache if appropriate.
- # If there's a cold bundle URL specified:
- # - if there's already a cold_bundle_xxx remote, move on.
- # - grab the bundle via http/https first, and fetch from that, into "cold_bundle_xxx" remote.
- # - do nothing else with this, it'll be used internally by git to avoid a huge fetch later.
- # - but, after this, the wanted branch will be fetched. signal has_fetched_from_bundle=1 for later.
- local has_fetched_from_bundle=0
- if [[ "${GIT_COLD_BUNDLE_URL}" != "" ]]; then
- local git_cold_bundle_id git_cold_bundle_cache_dir git_cold_bundle_cache_file git_cold_bundle_remote_id git_cold_bundle_fetched_marker_file
- # calculate the id, dir and name of local file and remote
- git_cold_bundle_cache_dir="${SRC}/cache/gitbundles"
- mkdir -p "${git_cold_bundle_cache_dir}"
- git_cold_bundle_id="$(echo -n "${GIT_COLD_BUNDLE_URL}" | md5sum | awk '{print $1}')" # md5 of the URL.
- git_cold_bundle_cache_file="${git_cold_bundle_cache_dir}/${git_cold_bundle_id}.gitbundle"
- git_cold_bundle_remote_id="cold_bundle_${git_cold_bundle_id}"
- git_cold_bundle_fetched_marker_file=".git/fetched-from-bundle-${git_cold_bundle_id}"
-
- display_alert "There's a " "${GIT_COLD_BUNDLE_URL} -- ${git_cold_bundle_id} -- file: ${git_cold_bundle_cache_file}" "debug"
-
- # Don't do if already done before for this bundle.
- if [[ ! -f "${git_cold_bundle_fetched_marker_file}" ]]; then
-
- # Download the bundle file if it does not exist.
- if [[ ! -f "${git_cold_bundle_cache_file}" ]]; then
- display_alert "Downloading cold bundle from remote server" "${GIT_COLD_BUNDLE_URL}" "debug"
- run_host_command_logged wget --continue --output-document="${git_cold_bundle_cache_file}" "${GIT_COLD_BUNDLE_URL}"
- else
- display_alert "Cold bundle file exists, using it" "${git_cold_bundle_cache_file}" "debug"
- fi
-
- # Make sure bundle is valid.
- improved_git bundle verify "${git_cold_bundle_cache_file}"
-
- # Get a list of remotes in the repo; add remote to bundle if it does not exist, and fetch from it.
- # This should be done only once per workdir, so I use a marker file to denote completion.
- if git remote get-url "${git_cold_bundle_remote_id}" 2> /dev/null; then
- display_alert "Git already has bundle remote" "incomplete fetch? ${git_cold_bundle_id}" "debug"
- else
- improved_git remote add "${git_cold_bundle_remote_id}" "${git_cold_bundle_cache_file}" # Add the remote pointing to the cold bundle file
- fi
-
- display_alert "Fetching from git bundle, wait" "${git_cold_bundle_id}" "info"
- improved_git_fetch --no-tags "${git_cold_bundle_remote_id}" # Fetch it! (all refs!)
- has_fetched_from_bundle=1 # marker for pruning logic below
- echo "${remote_hash}" > "${git_cold_bundle_fetched_marker_file}" # marker for future invocation
- display_alert "Bundle fetch completed, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after bundle pull
-
- fi
+ if [[ "${do_add_origin}" == "yes" ]]; then
+ regular_git remote add origin "${url}"
fi
- # @TODO: If there's a warmup remote specified: (for u-boot and others)
- # - if there's already a warmup remote, move on.
- # - if there's a cached warmup bundle file, add it as remote and fetch from it, and move on.
- # - add the warmup as remote, fetch from it; export it as a cached bundle for next time.
-
# remote was updated, fetch and check out updates, but not tags; tags pull their respective commits too, making it a huge fetch.
display_alert "Fetching updates from origin" "$dir $ref_name"
case $ref_type in
@@ -194,25 +155,14 @@ fetch_from_repo() {
display_alert "Origin fetch completed, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size again
display_alert "Checking out" "$dir $ref_name"
- improved_git checkout -f -q FETCH_HEAD
- improved_git clean -q -d -f
+ regular_git checkout -f -q FETCH_HEAD
+ regular_git clean -q -d -f
display_alert "After checkout, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after bundle pull
- # @TODO: find fork point, shallow from there, repack, and export bundle for that version;
- # would need a mainline reference to to this (eg: find 5.10.0, export 5.10 bundle from there)
- if [[ $has_fetched_from_bundle -gt 0 ]]; then
- display_alert "Pre-pruning, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after bundle pull
- display_alert "@TODO" "export bundle after full fetch" "warn"
- # echo -n "${remote_hash}" > .git/shallow # commit to keep for shallowing, can be something else. for now is full prune.
- # improved_git remote remove "${git_cold_bundle_remote_id}"
- # improved_git reflog expire --expire=0 --all
- # improved_git gc --prune=all
- fi
-
elif [[ -n $(git status -uno --porcelain --ignore-submodules=all) ]]; then # if not changed, but dirty...
display_alert "Cleaning git dir" "$(git status -s | wc -l) files" # working directory is not clean, show it
- improved_git checkout -f -q HEAD # Return the files that are tracked by git to the initial state.
- improved_git clean -q -d -f # Files that are not tracked by git and were added when the patch was applied must be removed.
+ regular_git checkout -f -q HEAD # Return the files that are tracked by git to the initial state.
+ regular_git clean -q -d -f # Files that are not tracked by git and were added when the patch was applied must be removed.
else # not changed, not dirty.
display_alert "Up to date" "$dir $ref_name at revision ${local_hash}" # working directory is clean, nothing to do
fi
@@ -236,3 +186,170 @@ fetch_from_repo() {
done
fi
}
+
+function git_fetch_from_bundle_file() {
+ local bundle_file="${1}" remote_name="${2}" shallow_file="${3}"
+ regular_git bundle verify "${bundle_file}" # Make sure bundle is valid.
+ regular_git remote add "${remote_name}" "${bundle_file}" # Add the remote pointing to the cold bundle file
+ if [[ -f "${shallow_file}" ]]; then
+ display_alert "Bundle is shallow" "${shallow_file}" "debug"
+ cp -p "${shallow_file}" ".git/shallow"
+ fi
+ improved_git_fetch --tags "${remote_name}" # Fetch it! (including tags!)
+ display_alert "Bundle fetch '${remote_name}' completed, working copy size" "$(du -h -s | awk '{print $1}')" "debug"
+}
+
+function download_git_bundle_from_http() {
+ local bundle_file="${1}" bundle_url="${2}"
+ if [[ ! -f "${git_cold_bundle_cache_file}" ]]; then # Download the bundle file if it does not exist.
+ display_alert "Downloading cold bundle from remote server" "${bundle_url}" "debug" # This gonna take a while. And waste bandwidth
+ run_host_command_logged wget --continue --output-document="${bundle_file}" "${bundle_url}" # @TODO: progress giga?
+ else
+ display_alert "Cold bundle file exists, using it" "${bundle_file}" "debug"
+ fi
+}
+
+function git_remove_cold_and_warm_bundle_remotes() {
+ # Remove the cold bundle remote, otherwise it holds references that impede the shallow to actually work.
+ if [[ ${has_git_cold_remote} -gt 0 ]]; then
+ regular_git remote remove "${git_cold_bundle_remote_name}"
+ has_git_cold_remote=0
+ fi
+
+ # Remove the warmup remote, otherwise it holds references forever.
+ if [[ ${has_git_warm_remote} -gt 0 ]]; then
+ regular_git remote remove "${GIT_WARM_REMOTE_NAME}"
+ has_git_warm_remote=0
+ fi
+}
+
+function git_handle_cold_and_warm_bundle_remotes() {
+
+ local has_git_cold_remote=0
+ local has_git_warm_remote=0
+ local git_warm_remote_bundle_file git_warm_remote_bundle_cache_dir git_warm_remote_bundle_file_shallowfile
+ local git_warm_remote_bundle_extra_fn=""
+
+ # First check the warm remote bundle cache. If that exists, use that, and skip the cold bundle.
+ if [[ "${do_warmup_remote}" == "yes" ]]; then
+ if [[ "${GIT_WARM_REMOTE_NAME}" != "" ]] && [[ "${GIT_WARM_REMOTE_BUNDLE}" != "" ]]; then
+ # Add extras to filename, for shallow by tag or revision
+ if [[ "${GIT_WARM_REMOTE_SHALLOW_REVISION}" != "" ]]; then
+ git_warm_remote_bundle_extra_fn="-shallow-rev-${GIT_WARM_REMOTE_SHALLOW_REVISION}"
+ elif [[ "${GIT_WARM_REMOTE_SHALLOW_AT_TAG}" != "" ]]; then
+ git_warm_remote_bundle_extra_fn="-shallow-tag-${GIT_WARM_REMOTE_SHALLOW_AT_TAG}"
+ fi
+ git_warm_remote_bundle_cache_dir="${SRC}/cache/gitbundles/warm" # calculate the id, dir and name of local file and remote
+ git_warm_remote_bundle_file="${git_warm_remote_bundle_cache_dir}/${GIT_WARM_REMOTE_BUNDLE}${git_warm_remote_bundle_extra_fn}.gitbundle" # final filename of bundle
+ git_warm_remote_bundle_file_shallowfile="${git_warm_remote_bundle_file}.shallow" # it can be there's a shallow revision
+ if [[ -f "${git_warm_remote_bundle_file}" ]]; then
+ display_alert "Fetching from Warm git bundle, wait" "${GIT_WARM_REMOTE_BUNDLE}" "info" # This is gonna take a long while...
+ git_fetch_from_bundle_file "${git_warm_remote_bundle_file}" "${GIT_WARM_REMOTE_NAME}" "${git_warm_remote_bundle_file_shallowfile}"
+ do_cold_bundle="no" # Skip the cold bundle, below.
+ do_warmup_remote="no" # Skip the warm bundle creation, below, too.
+ has_git_warm_remote=1 # mark warm remote as added.
+ else
+ display_alert "Could not find warm bundle file" "${git_warm_remote_bundle_file}" "debug"
+ fi
+ fi
+ fi
+
+ if [[ "${do_cold_bundle}" == "yes" ]]; then
+ # If there's a cold bundle URL specified:
+ # - if there's already a cold_bundle_xxx remote, move on.
+ # - grab the bundle via http/https first, and fetch from that, into "cold_bundle_xxx" remote.
+ # - do nothing else with this, it'll be used internally by git to avoid a huge fetch later.
+ # - but, after this, the wanted branch will be fetched. signal has_git_cold_remote=1 for later.
+ if [[ "${GIT_COLD_BUNDLE_URL}" != "" ]]; then
+ display_alert "There's a " "${GIT_COLD_BUNDLE_URL} -- ${git_cold_bundle_id} -- file: ${git_cold_bundle_cache_file}" "debug" # @TODO: remove
+ local git_cold_bundle_id git_cold_bundle_cache_dir git_cold_bundle_cache_file git_cold_bundle_remote_name
+ git_cold_bundle_cache_dir="${SRC}/cache/gitbundles/cold" # calculate the id, dir and name of local file and remote
+ git_cold_bundle_id="$(echo -n "${GIT_COLD_BUNDLE_URL}" | md5sum | awk '{print $1}')" # md5 of the URL.
+ git_cold_bundle_cache_file="${git_cold_bundle_cache_dir}/${git_cold_bundle_id}.gitbundle" # final filename of bundle
+ git_cold_bundle_remote_name="cold_bundle_${git_cold_bundle_id}" # name of the remote that will point to bundle
+ mkdir -p "${git_cold_bundle_cache_dir}" # make sure directory exists before downloading
+ download_git_bundle_from_http "${git_cold_bundle_cache_file}" "${GIT_COLD_BUNDLE_URL}"
+ display_alert "Fetching from cold git bundle, wait" "${git_cold_bundle_id}" "info" # This is gonna take a long while...
+ git_fetch_from_bundle_file "${git_cold_bundle_cache_file}" "${git_cold_bundle_remote_name}"
+ has_git_cold_remote=1 # marker for pruning logic below
+ fi
+ fi
+
+ # If there's a warmup remote specified.
+ # - if there's a cached warmup bundle file, add it as remote and fetch from it, and move on.
+ # - add the warmup as remote, fetch from it; export it as a cached bundle for next time.
+ if [[ "${do_warmup_remote}" == "yes" ]]; then
+ if [[ "${GIT_WARM_REMOTE_NAME}" != "" ]] && [[ "${GIT_WARM_REMOTE_URL}" != "" ]] && [[ "${GIT_WARM_REMOTE_BRANCH}" != "" ]]; then
+
+ display_alert "Using Warmup Remote before origin fetch" "${GIT_WARM_REMOTE_NAME} - ${GIT_WARM_REMOTE_BRANCH}" "debug"
+ regular_git remote add "${GIT_WARM_REMOTE_NAME}" "${GIT_WARM_REMOTE_URL}" # Add the remote to the warmup source
+ has_git_warm_remote=1 # mark as done. Will export the bundle!
+
+ improved_git_fetch --no-tags "${GIT_WARM_REMOTE_NAME}" "${GIT_WARM_REMOTE_BRANCH}" # Fetch the remote branch, but no tags
+ display_alert "After warm bundle, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after bundle pull
+
+ # Checkout that to a branch. We wanna have a local reference to what has been fetched.
+ # @TODO: could be a param instead of FETCH_HEAD; would drop commits after that rev
+ local git_warm_branch_name="warm__${GIT_WARM_REMOTE_BRANCH}"
+ regular_git branch "${git_warm_branch_name}" FETCH_HEAD || true
+
+ improved_git_fetch "${GIT_WARM_REMOTE_NAME}" "'refs/tags/${GIT_WARM_REMOTE_FETCH_TAGS}:refs/tags/${GIT_WARM_REMOTE_FETCH_TAGS}'" || true # Fetch the remote branch, but no tags
+ display_alert "After warm bundle tags, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after bundle pull
+
+ # Lookup the tag (at the warm remote directly) to find the rev to shallow to.
+ if [[ "${GIT_WARM_REMOTE_SHALLOW_AT_TAG}" != "" ]]; then
+ display_alert "GIT_WARM_REMOTE_SHALLOW_AT_TAG" "${GIT_WARM_REMOTE_SHALLOW_AT_TAG}" "debug"
+ GIT_WARM_REMOTE_SHALLOW_AT_DATE="$(git tag --list --format="%(creatordate)" "${GIT_WARM_REMOTE_SHALLOW_AT_TAG}")"
+ display_alert "GIT_WARM_REMOTE_SHALLOW_AT_TAG ${GIT_WARM_REMOTE_SHALLOW_AT_TAG} resulted in GIT_WARM_REMOTE_SHALLOW_AT_DATE" "Date: ${GIT_WARM_REMOTE_SHALLOW_AT_DATE}" "debug"
+ fi
+
+ # At this stage, we might wanna make the local copy shallow and re-pack it.
+ if [[ "${GIT_WARM_REMOTE_SHALLOW_AT_DATE}" != "" ]]; then
+ display_alert "Making working copy shallow" "before date ${GIT_WARM_REMOTE_SHALLOW_AT_DATE}" "debug"
+
+ # 'git clone' is the only consistent, usable thing we can do to do this.
+ # it does require a temporary dir, though. use one.
+
+ local temp_git_dir="${git_work_dir}.making.shallow.temp"
+ rm -rf "${temp_git_dir}"
+
+ regular_git clone --no-checkout --progress --verbose \
+ --single-branch --branch="${git_warm_branch_name}" \
+ --tags --shallow-since="${GIT_WARM_REMOTE_SHALLOW_AT_DATE}" \
+ "file://${git_work_dir}" "${temp_git_dir}"
+
+ display_alert "After shallow clone, temp_git_dir" "$(du -h -s "${temp_git_dir}" | awk '{print $1}')" "debug" # Show size after shallow
+
+ # Get rid of original, replace with new. Move cwd so no warnings are produced.
+ cd "${SRC}" || exit_with_error "Failed to move cwd away so we can remove" "${git_work_dir}"
+ rm -rf "${git_work_dir}"
+ mv -v "${temp_git_dir}" "${git_work_dir}"
+ cd "${git_work_dir}" || exit_with_error "Failed to get new dir after clone" "${git_work_dir}"
+
+ # dir switched, no more the original remotes. but origin is leftover, remove it
+ regular_git remote remove origin || true
+ has_git_cold_remote=0
+ has_git_warm_remote=0
+
+ display_alert "After shallow, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after shallow
+ fi
+
+ # Now git working copy has a precious state we might wanna preserve (export the bundle).
+ if [[ "${GIT_WARM_REMOTE_BUNDLE}" != "" ]]; then
+ mkdir -p "${git_warm_remote_bundle_cache_dir}"
+ display_alert "Exporting warm remote bundle" "${git_warm_remote_bundle_file}" "debug"
+ regular_git bundle create "${git_warm_remote_bundle_file}" --all
+
+ rm -f "${git_warm_remote_bundle_file_shallowfile}" # not shallow at first...
+ if [[ -f ".git/shallow" ]]; then
+ display_alert "Exported bundle is shallow" "Will copy to ${git_warm_remote_bundle_file_shallowfile}" "debug"
+ cp -p ".git/shallow" "${git_warm_remote_bundle_file_shallowfile}"
+ fi
+
+ fi
+ fi
+ fi
+
+ # Make sure to remove the cold and warm bundle remote, otherwise it holds references for no good reason.
+ git_remove_cold_and_warm_bundle_remotes
+}
diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh
index 618f4eb9c..56616cff6 100644
--- a/lib/functions/main/config-prepare.sh
+++ b/lib/functions/main/config-prepare.sh
@@ -160,22 +160,8 @@ function prepare_and_config_main_build_single() {
fi
export BOOTSOURCEDIR="${BOOTDIR}/$(branch2dir "${BOOTBRANCH}")"
- export LINUXSOURCEDIR="${KERNELDIR}/$(branch2dir "${KERNELBRANCH}")"
[[ -n $ATFSOURCE ]] && export ATFSOURCEDIR="${ATFDIR}/$(branch2dir "${ATFBRANCH}")"
- # So for kernel full cached rebuilds.
- # We wanna be able to rebuild kernels very fast. so it only makes sense to use a dir for each built kernel.
- # That is the "default" layout; there will be as many source dirs as there are built kernel debs.
- # But, it really makes much more sense if the major.minor (such as 5.10, 5.15, or 4.4) of kernel has its own
- # tree. So in the end:
- # <arch>-<major.minor>[-<family>]
- # So we gotta explictly know the major.minor to be able to do that scheme.
- # If we don't know, we could use BRANCH as reference, but that changes over time, and leads to wastage.
- if [[ "x${KERNEL_MAJOR_MINOR}x" == "xx" ]]; then
- exit_with_error "BAD config, missing" "KERNEL_MAJOR_MINOR" "err"
- fi
- export LINUXSOURCEDIR="kernel/${ARCH}__${KERNEL_MAJOR_MINOR}__${LINUXFAMILY}"
-
export BSP_CLI_PACKAGE_NAME="armbian-bsp-cli-${BOARD}${EXTRA_BSP_NAME}"
export BSP_CLI_PACKAGE_FULLNAME="${BSP_CLI_PACKAGE_NAME}_${REVISION}_${ARCH}"
export BSP_DESKTOP_PACKAGE_NAME="armbian-bsp-desktop-${BOARD}${EXTRA_BSP_NAME}"
@@ -186,7 +172,41 @@ function prepare_and_config_main_build_single() {
export CHOSEN_ROOTFS=${BSP_CLI_PACKAGE_NAME}
export CHOSEN_DESKTOP=armbian-${RELEASE}-desktop-${DESKTOP_ENVIRONMENT}
export CHOSEN_KSRC=linux-source-${BRANCH}-${LINUXFAMILY}
- export CHOSEN_KERNEL_WITH_ARCH=${CHOSEN_KERNEL}-${ARCH} # Only for reporting purposes.
+
+ # So for kernel full cached rebuilds.
+ # We wanna be able to rebuild kernels very fast. so it only makes sense to use a dir for each built kernel.
+ # That is the "default" layout; there will be as many source dirs as there are built kernel debs.
+ # But, it really makes much more sense if the major.minor (such as 5.10, 5.15, or 4.4) of kernel has its own
+ # tree. So in the end:
+ # <arch>-<major.minor>[-<family>]
+ # So we gotta explictly know the major.minor to be able to do that scheme.
+ # If we don't know, we could use BRANCH as reference, but that changes over time, and leads to wastage.
+ if [[ -n "${KERNELSOURCE}" ]]; then
+ export ARMBIAN_WILL_BUILD_KERNEL="${CHOSEN_KERNEL}-${ARCH}"
+ if [[ "x${KERNEL_MAJOR_MINOR}x" == "xx" ]]; then
+ exit_with_error "BAD config, missing" "KERNEL_MAJOR_MINOR" "err"
+ fi
+ # Parse/validate the the major, bail if no match
+ if linux-version compare "${KERNEL_MAJOR_MINOR}" ge "5.4"; then # We support 5.x from 5.4; 5.10+ brings unified packaging.
+ export KERNEL_MAJOR=5
+ export KERNEL_MAJOR_SHALLOW_TAG="v${KERNEL_MAJOR_MINOR}-rc1"
+ elif linux-version compare "${KERNEL_MAJOR_MINOR}" ge "4.4" && linux-version compare "${KERNEL_MAJOR_MINOR}" lt "5.0"; then
+ export KERNEL_MAJOR=4 # We support 4.x from 4.4; all require custom packaging.
+ export KERNEL_MAJOR_SHALLOW_TAG="v${KERNEL_MAJOR_MINOR}-rc1"
+ else
+ exit_with_error "Kernel series unsupported" "'${KERNEL_MAJOR_MINOR}' is unsupported, or bad config"
+ fi
+
+ export LINUXSOURCEDIR="kernel/${ARCH}__${KERNEL_MAJOR_MINOR}__${LINUXFAMILY}"
+ else
+ export ARMBIAN_WILL_BUILD_KERNEL=no
+ fi
+
+ if [[ -n "${BOOTCONFIG}" ]] && [[ "${BOOTCONFIG}" != "none" ]]; then
+ export ARMBIAN_WILL_BUILD_UBOOT=yes
+ else
+ export ARMBIAN_WILL_BUILD_UBOOT=no
+ fi
display_alert "Done with prepare_and_config_main_build_single" "${BOARD}.${BOARD_TYPE}" "info"
}
diff --git a/lib/tools/info.py b/lib/tools/info.py
index 088d4738a..6319a1427 100755
--- a/lib/tools/info.py
+++ b/lib/tools/info.py
@@ -44,7 +44,8 @@ def map_to_armbian_params(map_params):
def run_armbian_compile_and_parse(path_to_compile_sh, compile_params):
exec_cmd = ([path_to_compile_sh] + map_to_armbian_params(compile_params))
- # print(exec_cmd)
+ result = None
+ logs = ["Not available"]
try:
result = subprocess.run(
exec_cmd,
@@ -62,7 +63,11 @@ def run_armbian_compile_and_parse(path_to_compile_sh, compile_params):
compile_params, e.returncode, e.stderr
)
)
- raise e
+ return {"in": compile_params, "out": {}, "logs": e.stderr.split("\n"), "config_ok": False}
+
+ if result is not None:
+ if result.stderr:
+ logs = result.stderr.split("\n")
# Now parse it with regex-power!
# regex = r"^declare (..) (.*?)=\"(.*?)\"$" # old multiline version
@@ -83,11 +88,7 @@ def run_armbian_compile_and_parse(path_to_compile_sh, compile_params):
all_keys[key] = value
- logs = ["Not available"]
- if result.stderr:
- logs = result.stderr.split("\n")
-
- return {"in": compile_params, "out": all_keys, "logs": logs}
+ return {"in": compile_params, "out": all_keys, "logs": logs, "config_ok": True}
# Find the location of compile.sh, relative to this Python script.
@@ -160,7 +161,7 @@ def get_info_for_one_board(board_file, board_name, common_params, board_info):
return parsed | board_info
except:
eprint("Failed get info for board '{}'".format(board_name))
- return None
+ return board_info | {"ARMBIAN_CONFIG_OK": False}
if True:
diff --git a/lib/tools/json2csv.py b/lib/tools/json2csv.py
index 7933ed9d6..68c1decb0 100755
--- a/lib/tools/json2csv.py
+++ b/lib/tools/json2csv.py
@@ -33,6 +33,8 @@ for obj in flat:
value = obj[key]
if type(value) == str:
columns_map[key] = True
+ if type(value) == bool:
+ columns_map[key] = True
columns = columns_map.keys()
From 8eca261f5e3e41d7f363514a79b4fd764c3e9b71 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 21 Feb 2022 17:39:40 +0100
Subject: [PATCH] armbian-next: `KERNELDIR` is out, `KERNEL_MAJOR_MINOR` is in
for all `meson64`, `rpi4b` and `uefi`
---
config/sources/families/bcm2711.conf | 3 ++-
config/sources/families/include/meson64_common.inc | 7 ++++---
config/sources/families/include/uefi_common.inc | 8 ++++----
extensions/grub.sh | 1 -
4 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/config/sources/families/bcm2711.conf b/config/sources/families/bcm2711.conf
index 0dc25fc3f..a5a0bff7f 100644
--- a/config/sources/families/bcm2711.conf
+++ b/config/sources/families/bcm2711.conf
@@ -3,7 +3,6 @@ export LINUXFAMILY=bcm2711
export ARCH=arm64
export UEFI_FS_LABEL="RPICFG" # Windows/Mac users will see this if they mount the SD card. Configurable, but should be uppercase always
export SKIP_BOOTSPLASH="yes" # video is init-ed before us
-export KERNELDIR='linux-rpi' # Avoid sharing a source tree with others, until we know it's safe.
export FK__PUBLISHED_KERNEL_VERSION="raspi" # flash kernel (FK) configuration
export FK__KERNEL_PACKAGES=""
export RASPI_ROOT_FS_LABEL="armbian"
@@ -20,6 +19,7 @@ case "${BRANCH}" in
current)
export RASPI_DISTRO_KERNEL=no
export KERNELSOURCE='https://github.com/raspberrypi/linux'
+ export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel. For mainline caching.
export KERNELBRANCH="branch:rpi-5.15.y"
export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
@@ -28,6 +28,7 @@ case "${BRANCH}" in
edge)
export RASPI_DISTRO_KERNEL=no
export KERNELSOURCE='https://github.com/raspberrypi/linux'
+ export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel. For mainline caching.
export KERNELBRANCH="branch:rpi-5.16.y"
export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
diff --git a/config/sources/families/include/meson64_common.inc b/config/sources/families/include/meson64_common.inc
index f69669a5f..ea4363e81 100644
--- a/config/sources/families/include/meson64_common.inc
+++ b/config/sources/families/include/meson64_common.inc
@@ -24,17 +24,18 @@ case $BRANCH in
legacy)
KERNELSOURCE='https://github.com/hardkernel/linux'
- #KERNELBRANCH='branch:odroidg12-4.9.y'
- KERNELBRANCH='tag:4.9.277-122'
- KERNELDIR='linux-odroid'
+ export KERNEL_MAJOR_MINOR="4.9" # Major and minor versions of this kernel. For mainline caching.
+ KERNELBRANCH='branch:odroidg12-4.9.y'
;;
current)
+ export KERNEL_MAJOR_MINOR="5.10" # Major and minor versions of this kernel. For mainline caching.
KERNELBRANCH='branch:linux-5.10.y'
KERNELPATCHDIR='meson64-current'
;;
edge)
+ export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel. For mainline caching.
KERNELBRANCH='branch:linux-5.15.y'
KERNELPATCHDIR='meson64-edge'
;;
diff --git a/config/sources/families/include/uefi_common.inc b/config/sources/families/include/uefi_common.inc
index 7d6c97e0a..b362bcba0 100644
--- a/config/sources/families/include/uefi_common.inc
+++ b/config/sources/families/include/uefi_common.inc
@@ -14,16 +14,16 @@ case "${BRANCH}" in
current)
export DISTRO_GENERIC_KERNEL=no
export LINUXCONFIG="linux-uefi-${LINUXFAMILY}-${BRANCH}"
- export KERNELBRANCH="branch:linux-5.15.y"
+ export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel. For mainline caching.
+ export KERNELBRANCH="branch:linux-5.15.y" # Branch or tag to build from. It should match MAJOR_MINOR
export KERNELPATCHDIR="uefi-${LINUXFAMILY}-${BRANCH}" # Might be empty.
- export KERNELDIR="linux-uefi-${LINUXFAMILY}" # Avoid sharing a source tree with others, until we know it's safe.
;;
edge)
export DISTRO_GENERIC_KERNEL=no
export LINUXCONFIG="linux-uefi-${LINUXFAMILY}-${BRANCH}"
- export KERNELBRANCH="branch:linux-5.16.y"
+ export KERNEL_MAJOR_MINOR="5.16" # Major and minor versions of this kernel. For mainline caching.
+ export KERNELBRANCH="branch:linux-5.16.y" # Branch or tag to build from. It should match MAJOR_MINOR
export KERNELPATCHDIR="uefi-${LINUXFAMILY}-${BRANCH}" # Might be empty.
- export KERNELDIR="linux-uefi-${LINUXFAMILY}" # Avoid sharing a source tree with others, until we know it's safe.
;;
esac
diff --git a/extensions/grub.sh b/extensions/grub.sh
index 3f0478454..e1b20a87e 100644
--- a/extensions/grub.sh
+++ b/extensions/grub.sh
@@ -53,7 +53,6 @@ function extension_prepare_config__prepare_flash_kernel() {
unset KERNELSOURCE # This should make Armbian skip most stuff. At least, I hacked it to.
export INSTALL_ARMBIAN_FIRMWARE=no # Should skip build and install of Armbian-firmware.
else
- export KERNELDIR="linux-uefi-${LINUXFAMILY}" # Avoid sharing a source tree with others, until we know it's safe.
# Don't install anything. Armbian handles everything.
DISTRO_KERNEL_PACKAGES=""
DISTRO_FIRMWARE_PACKAGES=""
From 6f046c4f36a156468666b8c7bfff995934c44264 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 21 Feb 2022 17:37:10 +0100
Subject: [PATCH] armbian-next: new kernel workdir layout:
cache/sources/kernel/<ARCH>-<KERNEL_MAJOR_MINOR>-<LINUXFAMILY>
- `GIT_FIXED_WORKDIR` is used to ignore 2nd param and use a specific dir
- this now REQUIRES `KERNEL_MAJOR_MINOR` to be set.
- prepare some `WARM_REMOTE_NAME` and related, based on it
---
lib/functions/compilation/kernel.sh | 41 ++++++++++++++++++++----------------
lib/functions/general/git.sh | 7 +++++-
lib/functions/main/config-prepare.sh | 13 ++++++++++++
lib/functions/main/default-build.sh | 2 +-
4 files changed, 43 insertions(+), 20 deletions(-)
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index f429110d2..9deb439eb 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -43,34 +43,39 @@ function run_kernel_make_long_running() {
}
function compile_kernel() {
+ local kernel_work_dir="${SRC}/cache/sources/${LINUXSOURCEDIR}"
+
if [[ -n $KERNELSOURCE ]]; then
display_alert "Downloading sources" "kernel" "git"
- GIT_COLD_BUNDLE_URL="${MAINLINE_KERNEL_COLD_BUNDLE_URL}" \
- fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes"
+ GIT_FIXED_WORKDIR="${LINUXSOURCEDIR}" \
+ WARM_REMOTE_NAME="kernel-stable-${KERNEL_MAJOR_MINOR}" \
+ WARM_REMOTE_URL="${MAINLINE_KERNEL_SOURCE}" \
+ WARM_REMOTE_BRANCH="branch:linux-${KERNEL_MAJOR_MINOR}.y" \
+ GIT_COLD_BUNDLE_URL="${MAINLINE_KERNEL_COLD_BUNDLE_URL}" \
+ fetch_from_repo "$KERNELSOURCE" "unused:set via GIT_FIXED_WORKDIR" "$KERNELBRANCH" "yes"
fi
if [[ $CLEAN_LEVEL == *make* ]]; then
display_alert "Cleaning" "$LINUXSOURCEDIR" "info"
(
- cd "${SRC}/cache/sources/${LINUXSOURCEDIR}"
+ cd "${kernel_work_dir}"
make ARCH="${ARCHITECTURE}" clean > /dev/null 2>&1
)
fi
fasthash_debug "post git clean"
- local kerneldir="$SRC/cache/sources/$LINUXSOURCEDIR"
if [[ $USE_OVERLAYFS == yes ]]; then
display_alert "Using overlayfs_wrapper" "kernel_${LINUXFAMILY}_${BRANCH}" "debug"
- kerneldir=$(overlayfs_wrapper "wrap" "$SRC/cache/sources/$LINUXSOURCEDIR" "kernel_${LINUXFAMILY}_${BRANCH}")
+ kernel_work_dir=$(overlayfs_wrapper "wrap" "$SRC/cache/sources/$LINUXSOURCEDIR" "kernel_${LINUXFAMILY}_${BRANCH}")
fi
- cd "${kerneldir}" || exit
+ cd "${kernel_work_dir}" || exit
# @TODO: why would we delete localversion?
rm -f localversion
# read kernel version
local version hash pre_patch_version
- version=$(grab_version "$kerneldir")
+ version=$(grab_version "$kernel_work_dir")
pre_patch_version="${version}"
display_alert "Pre-patch kernel version" "${pre_patch_version}" "debug"
@@ -81,14 +86,14 @@ function compile_kernel() {
fi
# read kernel git hash
- hash=$(git --git-dir="$kerneldir"/.git rev-parse HEAD)
+ hash=$(git --git-dir="$kernel_work_dir"/.git rev-parse HEAD)
## Start kernel patching process.
## There's a few objectives here:
## - (always) produce a fasthash: represents "what would be done" (eg: md5 of a patch, crc32 of description).
## - (optionally) execute modification against living tree (eg: apply a patch, copy a file, etc). only if `DO_MODIFY=yes`
## - (always) call mark_change_commit with the description of what was done and fasthash.
- initialize_fasthash "kernel" "${hash}" "${pre_patch_version}" "${kerneldir}"
+ initialize_fasthash "kernel" "${hash}" "${pre_patch_version}" "${kernel_work_dir}"
fasthash_debug "init"
# Apply a series of patches if a series file exists
@@ -96,17 +101,17 @@ function compile_kernel() {
if test -f "${series_conf}"; then
display_alert "series.conf file visible. Apply"
fasthash_branch "patches-${KERNELPATCHDIR}-series.conf"
- apply_patch_series "${kerneldir}" "${series_conf}" # applies a series of patches, read from a file. calls process_patch_file
+ apply_patch_series "${kernel_work_dir}" "${series_conf}" # applies a series of patches, read from a file. calls process_patch_file
fi
# mostly local-based packaging fixes.
fasthash_branch "packaging-patches"
- apply_kernel_patches_for_packaging "${kerneldir}" "${version}" # calls process_patch_file and other stuff.
+ apply_kernel_patches_for_packaging "${kernel_work_dir}" "${version}" # calls process_patch_file and other stuff.
# applies a humongous amount of patches coming from github repos.
# it's mostly conditional, and very complex.
# @TODO: re-enable after finishing converting it with fasthash magic
- # apply_kernel_patches_for_drivers "${kerneldir}" "${version}" # calls process_patch_file and other stuff. there is A LOT of it.
+ # apply_kernel_patches_for_drivers "${kernel_work_dir}" "${version}" # calls process_patch_file and other stuff. there is A LOT of it.
# applies a series of patches, in directory order, from multiple directories (default/"user" patches)
# @TODO: I believe using the $BOARD here is the most confusing thing in the whole of Armbian. It should be disabled.
@@ -123,7 +128,7 @@ function compile_kernel() {
# re-read kernel version after patching
local version
- version=$(grab_version "$kerneldir")
+ version=$(grab_version "$kernel_work_dir")
display_alert "Compiling $BRANCH kernel" "$version" "info"
@@ -172,8 +177,8 @@ function compile_kernel() {
# hack for OdroidXU4. Copy firmare files
if [[ $BOARD == odroidxu4 ]]; then
- mkdir -p "${kerneldir}/firmware/edid"
- cp "${SRC}"/packages/blobs/odroidxu4/*.bin "${kerneldir}/firmware/edid"
+ mkdir -p "${kernel_work_dir}/firmware/edid"
+ cp "${SRC}"/packages/blobs/odroidxu4/*.bin "${kernel_work_dir}/firmware/edid"
fi
# hack for deb builder. To pack what's missing in headers pack.
@@ -236,7 +241,7 @@ function compile_kernel() {
fi
# Check for built kernel image file file; can override default with KERNEL_IMAGE_TYPE_PATH
- local check_built_kernel_file="${kerneldir}/${KERNEL_IMAGE_TYPE_PATH:-"arch/${ARCHITECTURE}/boot/${KERNEL_IMAGE_TYPE}"}"
+ local check_built_kernel_file="${kernel_work_dir}/${KERNEL_IMAGE_TYPE_PATH:-"arch/${ARCHITECTURE}/boot/${KERNEL_IMAGE_TYPE}"}"
if [[ ! -f "${check_built_kernel_file}" ]]; then
exit_with_error "Kernel was not built" "${check_built_kernel_file}"
fi
@@ -292,8 +297,8 @@ create_linux-source_package() {
xz < .config > "${sources_pkg_dir}/usr/src/${LINUXCONFIG}_${version}_${REVISION}_config.xz"
display_alert "Compressing sources for the linux-source package"
- tar cp --directory="$kerneldir" --exclude='.git' --owner=root . |
- pv -N "$(logging_echo_prefix_for_pv "compress_kernel_sources") $display_name" -p -b -r -s "$(du -sb "$kerneldir" --exclude=='.git' | cut -f1)" |
+ tar cp --directory="$kernel_work_dir" --exclude='.git' --owner=root . |
+ pv -N "$(logging_echo_prefix_for_pv "compress_kernel_sources") $display_name" -p -b -r -s "$(du -sb "$kernel_work_dir" --exclude=='.git' | cut -f1)" |
pixz -0 > "${sources_pkg_dir}/usr/src/linux-source-${version}-${LINUXFAMILY}.tar.xz" # @TODO: .deb will compress this later. -0 for now, but should be a plain tar
cp COPYING "${sources_pkg_dir}/usr/share/doc/linux-source-${version}-${LINUXFAMILY}/LICENSE"
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index 81b64586b..15a5cbbd2 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -67,6 +67,11 @@ fetch_from_repo() {
git_work_dir="${SRC}/cache/sources/${workdir}"
+ if [[ "${GIT_FIXED_WORKDIR}" != "" ]]; then
+ display_alert "GIT_FIXED_WORKDIR is set to" "${GIT_FIXED_WORKDIR}" "debug"
+ git_work_dir="${SRC}/cache/sources/${GIT_FIXED_WORKDIR}"
+ fi
+
mkdir -p "${git_work_dir}" || exit_with_error "No path or no write permission" "${git_work_dir}"
cd "${git_work_dir}" || exit
@@ -82,7 +87,7 @@ fetch_from_repo() {
display_alert "Creating local copy" "$dir $ref_name"
improved_git init -q --initial-branch="armbian_unused_initial_branch" .
improved_git remote add origin "${url}"
- offline=false # Force only, we'll need to fetch.
+ offline=false # Force online, we'll need to fetch.
fi
local changed=false
diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh
index bb3831889..618f4eb9c 100644
--- a/lib/functions/main/config-prepare.sh
+++ b/lib/functions/main/config-prepare.sh
@@ -163,6 +163,19 @@ function prepare_and_config_main_build_single() {
export LINUXSOURCEDIR="${KERNELDIR}/$(branch2dir "${KERNELBRANCH}")"
[[ -n $ATFSOURCE ]] && export ATFSOURCEDIR="${ATFDIR}/$(branch2dir "${ATFBRANCH}")"
+ # So for kernel full cached rebuilds.
+ # We wanna be able to rebuild kernels very fast. so it only makes sense to use a dir for each built kernel.
+ # That is the "default" layout; there will be as many source dirs as there are built kernel debs.
+ # But, it really makes much more sense if the major.minor (such as 5.10, 5.15, or 4.4) of kernel has its own
+ # tree. So in the end:
+ # <arch>-<major.minor>[-<family>]
+ # So we gotta explictly know the major.minor to be able to do that scheme.
+ # If we don't know, we could use BRANCH as reference, but that changes over time, and leads to wastage.
+ if [[ "x${KERNEL_MAJOR_MINOR}x" == "xx" ]]; then
+ exit_with_error "BAD config, missing" "KERNEL_MAJOR_MINOR" "err"
+ fi
+ export LINUXSOURCEDIR="kernel/${ARCH}__${KERNEL_MAJOR_MINOR}__${LINUXFAMILY}"
+
export BSP_CLI_PACKAGE_NAME="armbian-bsp-cli-${BOARD}${EXTRA_BSP_NAME}"
export BSP_CLI_PACKAGE_FULLNAME="${BSP_CLI_PACKAGE_NAME}_${REVISION}_${ARCH}"
export BSP_DESKTOP_PACKAGE_NAME="armbian-bsp-desktop-${BOARD}${EXTRA_BSP_NAME}"
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index 5430e9e97..112628729 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -75,7 +75,7 @@ main_default_build_single() {
fi
fi
if [[ "${exit_after_kernel_build}" == "yes" ]]; then
- display "Only building kernel and exiting" "NOW" "debug"
+ display_alert "Only building kernel and exiting" "NOW" "debug"
exit 0
fi
fi
From e736b5233c440555fa8a1a654f1c3ac9ae664580 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 21 Feb 2022 16:01:19 +0100
Subject: [PATCH] armbian-next: JUST_KERNEL=yes (opposed to KERNEL_ONLY=yes) is
really just the kernel build
---
lib/functions/main/default-build.sh | 56 ++++++++++++++++++++++++++-----------
1 file changed, 39 insertions(+), 17 deletions(-)
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index 94c202aff..5430e9e97 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -23,38 +23,60 @@ main_default_build_single() {
cleaning "sources"
fi
+ # Too many things being done. Allow doing only one thing. For core development, mostly.
+ # Also because "KERNEL_ONLY=yes" should really be spelled "PACKAGES_ONLY=yes"
+ local do_build_uboot="yes" do_build_kernel="yes" exit_after_kernel_build="no" do_host_tools="yes"
+ if [[ "${JUST_KERNEL}" == "yes" ]]; then
+ display_alert "JUST_KERNEL set to yes" "Building only kernel and exiting after that" "debug"
+ do_build_uboot="no"
+ exit_after_kernel_build="yes"
+ do_host_tools="no"
+ fi
+
# ignore updates help on building all images - for internal purposes
if [[ $IGNORE_UPDATES != yes ]]; then
- LOG_SECTION="fetch_and_build_host_tools" do_with_logging fetch_and_build_host_tools
+
+ # Fetch and build the host tools (via extensions)
+ if [[ "${do_host_tools}" == "yes" ]]; then
+ LOG_SECTION="fetch_and_build_host_tools" do_with_logging fetch_and_build_host_tools
+ fi
for option in $(tr ',' ' ' <<< "${CLEAN_LEVEL}"); do
if [[ $option != sources ]]; then
LOG_SECTION="cleaning" do_with_logging cleaning "$option"
- fasthash_debug "main_cleaning_armbian"
+ #fasthash_debug "main_cleaning_armbian"
fi
done
fi
- # Don't build u-boot at all if the BOOTCONFIG is 'none'.
- if [[ "${BOOTCONFIG}" != "none" ]]; then
- # @TODO: refactor this. we use it very often
- # Compile u-boot if packed .deb does not exist or use the one from repository
- if [[ ! -f "${DEB_STORAGE}"/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb ]]; then
- if [[ -n "${ATFSOURCE}" && "${ATFSOURCE}" != "none" && "${REPOSITORY_INSTALL}" != *u-boot* ]]; then
- LOG_SECTION="compile_atf" do_with_logging compile_atf
- fi
- # @TODO: refactor this construct. we use it too many times.
- if [[ "${REPOSITORY_INSTALL}" != *u-boot* ]]; then
- LOG_SECTION="compile_uboot" do_with_logging compile_uboot
+ if [[ "${do_build_uboot}" == "yes" ]]; then
+ # Don't build u-boot at all if the BOOTCONFIG is 'none'.
+ if [[ "${BOOTCONFIG}" != "none" ]]; then
+ # @TODO: refactor this. we use it very often
+ # Compile u-boot if packed .deb does not exist or use the one from repository
+ if [[ ! -f "${DEB_STORAGE}"/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb ]]; then
+ if [[ -n "${ATFSOURCE}" && "${ATFSOURCE}" != "none" && "${REPOSITORY_INSTALL}" != *u-boot* ]]; then
+ LOG_SECTION="compile_atf" do_with_logging compile_atf
+ fi
+ # @TODO: refactor this construct. we use it too many times.
+ if [[ "${REPOSITORY_INSTALL}" != *u-boot* ]]; then
+ LOG_SECTION="compile_uboot" do_with_logging compile_uboot
+ fi
fi
fi
fi
# Compile kernel if packed .deb does not exist or use the one from repository
- if [[ ! -f ${DEB_STORAGE}/${CHOSEN_KERNEL}_${REVISION}_${ARCH}.deb ]]; then
- export KDEB_CHANGELOG_DIST=$RELEASE
- if [[ -n $KERNELSOURCE ]] && [[ "${REPOSITORY_INSTALL}" != *kernel* ]]; then
- LOG_SECTION="compile_kernel" do_with_logging compile_kernel
+ if [[ "${do_build_kernel}" == "yes" ]]; then
+ if [[ ! -f ${DEB_STORAGE}/${CHOSEN_KERNEL}_${REVISION}_${ARCH}.deb ]]; then
+ export KDEB_CHANGELOG_DIST=$RELEASE
+ if [[ -n $KERNELSOURCE ]] && [[ "${REPOSITORY_INSTALL}" != *kernel* ]]; then
+ LOG_SECTION="compile_kernel" do_with_logging compile_kernel
+ fi
+ fi
+ if [[ "${exit_after_kernel_build}" == "yes" ]]; then
+ display "Only building kernel and exiting" "NOW" "debug"
+ exit 0
fi
fi
From df90ffa11bff94bcb3b90b3460bacd7ed102a567 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 21 Feb 2022 14:40:47 +0100
Subject: [PATCH] armbian-next: fetch_from_repos now done when actually
compiling atf/uboot/kernel, not before
- lib regen after removing empty files (sources.sh and errors.sh are now gone)
---
lib/functions/compilation/atf.sh | 5 +++++
lib/functions/compilation/kernel.sh | 6 ++++++
lib/functions/compilation/sources.sh | 17 -----------------
lib/functions/compilation/uboot.sh | 5 +++++
lib/functions/logging/errors.sh | 10 ----------
lib/functions/main/default-build.sh | 2 +-
lib/library-functions.sh | 18 ------------------
7 files changed, 17 insertions(+), 46 deletions(-)
diff --git a/lib/functions/compilation/atf.sh b/lib/functions/compilation/atf.sh
index f5e9aa691..7f20028da 100644
--- a/lib/functions/compilation/atf.sh
+++ b/lib/functions/compilation/atf.sh
@@ -1,4 +1,9 @@
compile_atf() {
+ if [[ -n "${ATFSOURCE}" && "${ATFSOURCE}" != "none" ]]; then
+ display_alert "Downloading sources" "atf" "git"
+ fetch_from_repo "$ATFSOURCE" "$ATFDIR" "$ATFBRANCH" "yes"
+ fi
+
if [[ $CLEAN_LEVEL == *make* ]]; then
display_alert "Cleaning" "$ATFSOURCEDIR" "info"
(
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 3b2219579..f429110d2 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -43,6 +43,12 @@ function run_kernel_make_long_running() {
}
function compile_kernel() {
+ if [[ -n $KERNELSOURCE ]]; then
+ display_alert "Downloading sources" "kernel" "git"
+ GIT_COLD_BUNDLE_URL="${MAINLINE_KERNEL_COLD_BUNDLE_URL}" \
+ fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes"
+ fi
+
if [[ $CLEAN_LEVEL == *make* ]]; then
display_alert "Cleaning" "$LINUXSOURCEDIR" "info"
(
diff --git a/lib/functions/compilation/sources.sh b/lib/functions/compilation/sources.sh
deleted file mode 100644
index 377d4510b..000000000
--- a/lib/functions/compilation/sources.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-function fetch_sources_kernel_uboot_atf() {
- if [[ -n $KERNELSOURCE ]]; then
- display_alert "Downloading sources" "kernel" "git"
- GIT_COLD_BUNDLE_URL="${MAINLINE_KERNEL_COLD_BUNDLE_URL}" \
- fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes"
- fi
-
- if [[ -n $BOOTSOURCE ]] && [[ "${BOOTSOURCE}" != "none" ]]; then
- display_alert "Downloading sources" "u-boot" "git"
- fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes" # fetch_from_repo <url> <dir> <ref> <subdir_flag>
- fi
-
- if [[ -n "${ATFSOURCE}" && "${ATFSOURCE}" != "none" ]]; then
- display_alert "Downloading sources" "atf" "git"
- fetch_from_repo "$ATFSOURCE" "$ATFDIR" "$ATFBRANCH" "yes"
- fi
-}
diff --git a/lib/functions/compilation/uboot.sh b/lib/functions/compilation/uboot.sh
index 053312875..33415c2e2 100644
--- a/lib/functions/compilation/uboot.sh
+++ b/lib/functions/compilation/uboot.sh
@@ -96,6 +96,11 @@ function compile_uboot_target() {
}
compile_uboot() {
+ if [[ -n $BOOTSOURCE ]] && [[ "${BOOTSOURCE}" != "none" ]]; then
+ display_alert "Downloading sources" "u-boot" "git"
+ fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes" # fetch_from_repo <url> <dir> <ref> <subdir_flag>
+ fi
+
# not optimal, but extra cleaning before overlayfs_wrapper should keep sources directory clean
if [[ $CLEAN_LEVEL == *make* ]]; then
display_alert "Cleaning" "$BOOTSOURCEDIR" "info"
diff --git a/lib/functions/logging/errors.sh b/lib/functions/logging/errors.sh
deleted file mode 100644
index 29263306c..000000000
--- a/lib/functions/logging/errors.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2015 Igor Pecovnik, igor.pecovnik@gma**.com
-#
-# This file is licensed under the terms of the GNU General Public
-# License version 2. This program is licensed "as is" without any
-# warranty of any kind, whether express or implied.
-
-# This file is a part of the Armbian build script
-# https://github.com/armbian/build/
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index 5b80314ef..94c202aff 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -22,9 +22,9 @@ main_default_build_single() {
if [[ $CLEAN_LEVEL == *sources* ]]; then
cleaning "sources"
fi
+
# ignore updates help on building all images - for internal purposes
if [[ $IGNORE_UPDATES != yes ]]; then
- LOG_SECTION="fetch_sources_kernel_uboot_atf" do_with_logging fetch_sources_kernel_uboot_atf
LOG_SECTION="fetch_and_build_host_tools" do_with_logging fetch_and_build_host_tools
for option in $(tr ',' ' ' <<< "${CLEAN_LEVEL}"); do
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index 2e720a66f..cec0c0fc7 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -118,15 +118,6 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/compilation/patch/kernel-pkg.sh
source "${SRC}"/lib/functions/compilation/patch/kernel-pkg.sh
-# no errors tolerated. invoked before each sourced file to make sure.
-#set -o pipefail # trace ERR through pipes - will be enabled "soon"
-#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
-set -o errtrace # trace ERR through - enabled
-set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/compilation/sources.sh
-# shellcheck source=lib/functions/compilation/sources.sh
-source "${SRC}"/lib/functions/compilation/sources.sh
-
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
@@ -316,15 +307,6 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/logging/capture.sh
source "${SRC}"/lib/functions/logging/capture.sh
-# no errors tolerated. invoked before each sourced file to make sure.
-#set -o pipefail # trace ERR through pipes - will be enabled "soon"
-#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
-set -o errtrace # trace ERR through - enabled
-set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/logging/errors.sh
-# shellcheck source=lib/functions/logging/errors.sh
-source "${SRC}"/lib/functions/logging/errors.sh
-
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
From a44e91752d1005daa5bba5eb0b0114654199e3e5 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 21 Feb 2022 01:50:16 +0100
Subject: [PATCH] armbian-next: linux: back to Torvalds bundle, no tags;
reminder about export
---
lib/functions/configuration/main-config.sh | 2 +-
lib/functions/general/git.sh | 25 ++++++++++++++-----------
2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 722371f3e..883550d79 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -115,7 +115,7 @@ function do_main_configuration() {
# URL for the git bundle used to "bootstrap" local git copies without too much server load. This applies independently of git mirror below.
export MAINLINE_KERNEL_TORVALDS_BUNDLE_URL="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/clone.bundle" # this is plain torvalds, single branch
export MAINLINE_KERNEL_STABLE_BUNDLE_URL="https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/clone.bundle" # this is all stable branches. with tags!
- export MAINLINE_KERNEL_COLD_BUNDLE_URL="${MAINLINE_KERNEL_COLD_BUNDLE_URL:-$MAINLINE_KERNEL_STABLE_BUNDLE_URL}" # default to stable. it's bigger but more useful for developers.
+ export MAINLINE_KERNEL_COLD_BUNDLE_URL="${MAINLINE_KERNEL_COLD_BUNDLE_URL:-${MAINLINE_KERNEL_TORVALDS_BUNDLE_URL}}" # default to Torvalds; everything else is small enough with this
case $MAINLINE_MIRROR in
google)
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index 51f658d31..81b64586b 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -166,7 +166,7 @@ fetch_from_repo() {
fi
display_alert "Fetching from git bundle, wait" "${git_cold_bundle_id}" "info"
- improved_git_fetch --tags "${git_cold_bundle_remote_id}" # Fetch it! and all its tags, too.
+ improved_git_fetch --no-tags "${git_cold_bundle_remote_id}" # Fetch it! (all refs!)
has_fetched_from_bundle=1 # marker for pruning logic below
echo "${remote_hash}" > "${git_cold_bundle_fetched_marker_file}" # marker for future invocation
display_alert "Bundle fetch completed, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after bundle pull
@@ -182,9 +182,9 @@ fetch_from_repo() {
# remote was updated, fetch and check out updates, but not tags; tags pull their respective commits too, making it a huge fetch.
display_alert "Fetching updates from origin" "$dir $ref_name"
case $ref_type in
- branch | commit) improved_git_fetch --tags origin "${ref_name}" ;;
- tag) improved_git_fetch --tags origin tags/"${ref_name}" ;;
- head) improved_git_fetch --tags origin HEAD ;;
+ branch | commit) improved_git_fetch --no-tags origin "${ref_name}" ;;
+ tag) improved_git_fetch --no-tags origin tags/"${ref_name}" ;;
+ head) improved_git_fetch --no-tags origin HEAD ;;
esac
display_alert "Origin fetch completed, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size again
@@ -193,13 +193,16 @@ fetch_from_repo() {
improved_git clean -q -d -f
display_alert "After checkout, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after bundle pull
- #if [[ $has_fetched_from_bundle -gt 0 ]]; then
- # display_alert "Pre-pruning, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after bundle pull
- # echo -n "${remote_hash}" > .git/shallow # commit to keep for shallowing, can be something else. for now is full prune.
- # improved_git remote remove "${git_cold_bundle_remote_id}"
- # improved_git reflog expire --expire=0 --all
- # improved_git gc --prune=all
- #fi
+ # @TODO: find fork point, shallow from there, repack, and export bundle for that version;
+ # would need a mainline reference to to this (eg: find 5.10.0, export 5.10 bundle from there)
+ if [[ $has_fetched_from_bundle -gt 0 ]]; then
+ display_alert "Pre-pruning, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after bundle pull
+ display_alert "@TODO" "export bundle after full fetch" "warn"
+ # echo -n "${remote_hash}" > .git/shallow # commit to keep for shallowing, can be something else. for now is full prune.
+ # improved_git remote remove "${git_cold_bundle_remote_id}"
+ # improved_git reflog expire --expire=0 --all
+ # improved_git gc --prune=all
+ fi
elif [[ -n $(git status -uno --porcelain --ignore-submodules=all) ]]; then # if not changed, but dirty...
display_alert "Cleaning git dir" "$(git status -s | wc -l) files" # working directory is not clean, show it
From 9acef6be57519029f5e4eeccabac183e27e3f845 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 19 Feb 2022 02:29:27 +0100
Subject: [PATCH] armbian-next: full cached kernel build; refactor all make's
in a single place, even for packaging
- 2nd+ runs build in less than a minute
- kernel: compile and package in a single step, more efficient?
- KERNEL_BUILD_DTBS yes/no to build or not dtbs, replaces KERNEL_EXTRA_TARGETS
- dtbs_install, modules_install and headers_install now called by Armbian, not packaging
- kernel with split, but identical, build and install makes for modules/headers/dtbs
- make mkdebian and builddeb idempotent as possible
- keep a lot more cache, specially 'debian' folder
- filtering logging of install stuff
- might be a few leftovers, revisit gains with packaging later
- keeping the arm64 makefile Image.gz vs Image hack
- fix order of packaging patch byteshift, but still there
- cleaning of scripts tools on cross compile removed (!)
---
config/sources/amd64.conf | 4 +-
lib/functions/compilation/kernel.sh | 138 +++++++------
lib/functions/compilation/patch/apply.sh | 10 +
lib/functions/compilation/patch/fasthash.sh | 40 +++-
lib/functions/compilation/patch/kernel-pkg.sh | 16 +-
lib/functions/compilation/sources.sh | 4 +-
lib/functions/main/default-build.sh | 4 +-
packages/armbian/builddeb | 218 ++++++++-------------
packages/armbian/mkdebian | 268 +++++++++++++-------------
9 files changed, 352 insertions(+), 350 deletions(-)
diff --git a/config/sources/amd64.conf b/config/sources/amd64.conf
index 510d1b6b6..cc1b4b256 100644
--- a/config/sources/amd64.conf
+++ b/config/sources/amd64.conf
@@ -3,8 +3,8 @@ export ARCHITECTURE=x86_64 # "kernel" arch
export QEMU_BINARY="qemu-x86_64-static" # Hopefully you have this installed.
export KERNEL_COMPILER=' ' # hack: use single space for host gcc. won't work on arm64 hosts
export KERNEL_USE_GCC=' ' # more hacks.
-export KERNEL_IMAGE_TYPE="bzImage" # Ubuntu Standard
-export KERNEL_EXTRA_TARGETS=" " # default is "dtbs" but x86_64 has no DTB. use a space for no target
+export KERNEL_IMAGE_TYPE="bzImage" # Passed to kernel's `make`
+export KERNEL_BUILD_DTBS="no" # amd64 has no DTBs. that I know of.
#export INITRD_ARCH=amd64 # Used by u-boot for mkimage in initramfs. No u-boot for x86 yet.
export UBOOT_USE_GCC="none" # required by configuration.sh
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index c6591d5cc..3b2219579 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -5,25 +5,30 @@ function run_kernel_make() {
common_make_envs=(
"CCACHE_BASEDIR=\"$(pwd)\"" # Base directory for ccache, for cache reuse
"PATH=\"${toolchain}:${PATH}\"" # Insert the toolchain first into the PATH.
+ "DPKG_COLORS=always" # Use colors for dpkg
)
common_make_params_quoted=(
- "$CTHREADS" # Parallel compile, "-j X" for X cpus
- "LOCALVERSION=-${LINUXFAMILY}" # Kernel param
- "KDEB_PKGVERSION=${REVISION}" # deb package version
- "KDEB_COMPRESS=${DEB_COMPRESS}" # dpkg compression for deb
- "BRANCH=${BRANCH}" # @TODO: rpardini: Wonder what BRANCH is used for during packaging?
- "ARCH=${ARCHITECTURE}" # Why?
- "KBUILD_DEBARCH=${ARCH}" # Where used?
- "DEBFULLNAME=${MAINTAINER}" # For changelog generation
- "DEBEMAIL=${MAINTAINERMAIL}" # idem
- "CROSS_COMPILE=${CCACHE} ${KERNEL_COMPILER}" # Prefix for tool invocations.
+ "$CTHREADS" # Parallel compile, "-j X" for X cpus
+ "LOCALVERSION=-${LINUXFAMILY}" # Kernel param
+ "KDEB_PKGVERSION=${REVISION}" # deb package version
+ "KDEB_COMPRESS=${DEB_COMPRESS}" # dpkg compression for deb
+ "BRANCH=${BRANCH}" # @TODO: rpardini: Wonder what BRANCH is used for during packaging?
+ "INSTALL_HDR_PATH=debian/hdrtmp/usr" # For packaging headers_install used for headers
+ "INSTALL_MOD_PATH=debian/tmp" # For packaging modules for image package
+ "INSTALL_DTBS_PATH=debian/dtbtmp/boot/dtbs_install" # For packaging DTBs for dtb package
+ "ARCH=${ARCHITECTURE}" # Why?
+ "KBUILD_DEBARCH=${ARCH}" # Where used?
+ "DEBFULLNAME=${MAINTAINER}" # For changelog generation
+ "DEBEMAIL=${MAINTAINERMAIL}" # idem
+ "CROSS_COMPILE=${CCACHE} ${KERNEL_COMPILER}" # Prefix for tool invocations.
)
common_make_params_quoted+=("KCFLAGS=-fdiagnostics-color=always") # Force GCC colored messages.
# last statement, so it passes the result to calling function.
- full_command=("${KERNEL_MAKE_RUNNER:-run_host_command_logged}" "${common_make_envs[@]}" make "$@" "${common_make_params_quoted[@]@Q}")
+ full_command=("${KERNEL_MAKE_RUNNER:-run_host_command_logged}" "${common_make_envs[@]}"
+ make "$@" "${common_make_params_quoted[@]@Q}" "${make_filter}")
"${full_command[@]}" # and exit with it's code, since it's the last statement
}
@@ -32,7 +37,9 @@ function run_kernel_make_dialog() {
}
function run_kernel_make_long_running() {
+ local seconds_start=${SECONDS} # Bash has a builtin SECONDS that is seconds since start of script
KERNEL_MAKE_RUNNER="run_host_command_logged_long_running" run_kernel_make "$@"
+ display_alert "Kernel Make '$*' took" "$((SECONDS - seconds_start)) seconds" "debug"
}
function compile_kernel() {
@@ -43,6 +50,7 @@ function compile_kernel() {
make ARCH="${ARCHITECTURE}" clean > /dev/null 2>&1
)
fi
+ fasthash_debug "post git clean"
local kerneldir="$SRC/cache/sources/$LINUXSOURCEDIR"
if [[ $USE_OVERLAYFS == yes ]]; then
@@ -51,6 +59,7 @@ function compile_kernel() {
fi
cd "${kerneldir}" || exit
+ # @TODO: why would we delete localversion?
rm -f localversion
# read kernel version
@@ -59,6 +68,12 @@ function compile_kernel() {
pre_patch_version="${version}"
display_alert "Pre-patch kernel version" "${pre_patch_version}" "debug"
+ # different packaging for 4.3+
+ local kernel_packaging_target="deb-pkg"
+ if linux-version compare "${version}" ge 4.3; then
+ kernel_packaging_target="bindeb-pkg"
+ fi
+
# read kernel git hash
hash=$(git --git-dir="$kerneldir"/.git rev-parse HEAD)
@@ -68,7 +83,7 @@ function compile_kernel() {
## - (optionally) execute modification against living tree (eg: apply a patch, copy a file, etc). only if `DO_MODIFY=yes`
## - (always) call mark_change_commit with the description of what was done and fasthash.
initialize_fasthash "kernel" "${hash}" "${pre_patch_version}" "${kerneldir}"
- declare -a fast_hash_list=()
+ fasthash_debug "init"
# Apply a series of patches if a series file exists
local series_conf="${SRC}"/patch/kernel/${KERNELPATCHDIR}/series.conf
@@ -94,6 +109,7 @@ function compile_kernel() {
fasthash_branch "patches-${KERNELPATCHDIR}-$BRANCH"
advanced_patch "kernel" "$KERNELPATCHDIR" "$BOARD" "" "$BRANCH" "$LINUXFAMILY-$BRANCH" # calls process_patch_file, "target" is empty there
+ fasthash_debug "finish"
finish_fasthash "kernel" # this reports the final hash and creates git branch to build ID. All modifications commited.
# create patch for manual source changes in debug mode
@@ -137,6 +153,10 @@ function compile_kernel() {
fi
fi
+ # Store the .config modification date at this time, for restoring later. Otherwise rebuilds.
+ local kernel_config_mtime
+ kernel_config_mtime=$(get_file_modification_time ".config")
+
call_extension_method "custom_kernel_config" <<- 'CUSTOM_KERNEL_CONFIG'
*Kernel .config is in place, still clean from git version*
Called after ${LINUXCONFIG}.config is put in place (.config).
@@ -156,12 +176,7 @@ function compile_kernel() {
display_alert "Kernel configuration" "${LINUXCONFIG}" "info"
if [[ $KERNEL_CONFIGURE != yes ]]; then
- if [[ $BRANCH == default ]]; then
- run_kernel_make silentoldconfig # This will exit with generic error if it fails.
- else
- # TODO: check if required
- run_kernel_make olddefconfig
- fi
+ run_kernel_make olddefconfig # @TODO: what is this? does it fuck up dates?
else
display_alert "Starting kernel oldconfig+menuconfig" "${LINUXCONFIG}" "debug"
@@ -170,6 +185,9 @@ function compile_kernel() {
# No logging for this. this is UI piece
run_kernel_make_dialog "${KERNEL_MENUCONFIG:-menuconfig}"
+ # Capture new date. Otherwise changes not detected by make.
+ kernel_config_mtime=$(get_file_modification_time ".config")
+
# store kernel config in easily reachable place
display_alert "Exporting new kernel config" "$DEST/config/$LINUXCONFIG.config" "info"
cp .config "${DEST}/config/${LINUXCONFIG}.config"
@@ -185,6 +203,9 @@ function compile_kernel() {
fi
fi
+ # Restore the date of .config. Above delta is a pure function, theoretically.
+ set_files_modification_time "${kernel_config_mtime}" ".config"
+
# create linux-source package - with already patched sources
# We will build this package first and clear the memory.
if [[ $BUILD_KSRC != no ]]; then
@@ -192,65 +213,62 @@ function compile_kernel() {
create_linux-source_package
fi
- display_alert "Compiling Kernel" "${LINUXCONFIG} ${KERNEL_IMAGE_TYPE}" "info"
- run_kernel_make_long_running "${KERNEL_IMAGE_TYPE}" modules "${KERNEL_EXTRA_TARGETS:-dtbs}"
- #run_kernel_make "${KERNEL_IMAGE_TYPE}" modules "${KERNEL_EXTRA_TARGETS:-dtbs}"
+ local -a build_targets=("headers")
+ [[ "${KERNEL_BUILD_DTBS:-yes}" == "yes" ]] && build_targets+=("dtbs")
+ build_targets+=("${KERNEL_IMAGE_TYPE}" modules)
- if [[ ! -f arch/$ARCHITECTURE/boot/$KERNEL_IMAGE_TYPE ]]; then
- exit_with_error "Kernel was not built" "arch/$ARCHITECTURE/boot/$KERNEL_IMAGE_TYPE"
+ display_alert "Compiling Kernel" "${LINUXCONFIG} ${KERNEL_IMAGE_TYPE}" "info"
+ fasthash_debug "pre-compile"
+ run_kernel_make_long_running "${build_targets[@]}"
+ fasthash_debug "post-compile"
+
+ if [[ "${DOUBLE_COMPILE_KERNEL}" == "yes" ]]; then
+ display_alert "DOUBLE Compiling Kernel" "${LINUXCONFIG} ${KERNEL_IMAGE_TYPE}" "info"
+ fasthash_debug "pre-double-compile"
+ run_kernel_make_long_running "${build_targets[@]}"
+ fasthash_debug "post-double-compile"
fi
- # different packaging for 4.3+
- if linux-version compare "${version}" ge 4.3; then
- local kernel_packaging_target="bindeb-pkg"
- else
- local kernel_packaging_target="deb-pkg"
+ # Check for built kernel image file file; can override default with KERNEL_IMAGE_TYPE_PATH
+ local check_built_kernel_file="${kerneldir}/${KERNEL_IMAGE_TYPE_PATH:-"arch/${ARCHITECTURE}/boot/${KERNEL_IMAGE_TYPE}"}"
+ if [[ ! -f "${check_built_kernel_file}" ]]; then
+ exit_with_error "Kernel was not built" "${check_built_kernel_file}"
fi
- display_alert "Creating kernel packages" "${LINUXCONFIG} $kernel_packaging_target" "info"
+ local -a prepackage_targets=(modules_install headers_install)
+ [[ "${KERNEL_BUILD_DTBS:-yes}" == "yes" ]] && prepackage_targets+=("dtbs_install")
+
+ display_alert "Packaging Kernel" "${LINUXCONFIG} $kernel_packaging_target" "info"
+
+ # Prepare for packaging, using the exact same options as original compile.
+ display_alert "Installing kernel headers and modules for packaging" "${LINUXCONFIG} ${prepackage_targets[*]}" "info"
+ fasthash_debug "pre-prepackage"
+ make_filter="| grep --line-buffered -v -e 'INSTALL' -e 'SIGN'" run_kernel_make_long_running "${prepackage_targets[@]}"
+ fasthash_debug "post-prepackage"
# produce deb packages: image, headers, firmware, dtb
+ # This mostly only does
+ fasthash_debug "pre-packaging"
run_kernel_make_long_running $kernel_packaging_target
+ fasthash_debug "post-packaging"
+
+ if [[ "${DOUBLE_COMPILE_KERNEL}" == "yes" ]]; then
+ display_alert "DOUBLE Packaging Kernel, Headers and DTBs" "${LINUXCONFIG} $kernel_packaging_target" "info"
+ fasthash_debug "pre-double-packaging"
+ run_kernel_make_long_running $kernel_packaging_target
+ fasthash_debug "post-double-packaging"
+ fi
display_alert "Package building done" "${LINUXCONFIG} $kernel_packaging_target" "info"
+ display_alert "Done with" "kernel compile" "debug"
+
cd .. || exit
# remove firmware image packages here - easier than patching ~40 packaging scripts at once
rm -f linux-firmware-image-*.deb
rsync --remove-source-files -rq ./*.deb "${DEB_STORAGE}/" || exit_with_error "Failed moving kernel DEBs"
- if [[ "a" == "b" ]]; then # @TODO DISABLED! TOO CRAZY
- display_alert "Update Kernel hashes" "${LINUXCONFIG} $kernel_packaging_target"
-
- # store git hash to the file and create a change log
- HASHTARGET="${SRC}/cache/hash$([[ ${BETA} == yes ]] && echo "-beta" || true)/linux-image-${BRANCH}-${LINUXFAMILY}"
- OLDHASHTARGET=$(head -1 "${HASHTARGET}.githash" 2> /dev/null || true)
-
- git -C ${kerneldir} cat-file -t ${OLDHASHTARGET} > /dev/null 2>&1 && OLDHASHTARGET=$(git -C ${kerneldir} rev-list --max-parents=0 HEAD)
-
- [[ -z ${KERNELPATCHDIR} ]] && KERNELPATCHDIR=$LINUXFAMILY-$BRANCH
- [[ -z ${LINUXCONFIG} ]] && LINUXCONFIG=linux-$LINUXFAMILY-$BRANCH
-
- # calculate URL
- if [[ "$KERNELSOURCE" == *"github.com"* ]]; then
- URL="${KERNELSOURCE/git:/https:}/commit/${HASH}"
- elif [[ "$KERNELSOURCE" == *"kernel.org"* ]]; then
- URL="${KERNELSOURCE/git:/https:}/commit/?h=$(echo $KERNELBRANCH | cut -d":" -f2)&id=${HASH}"
- else
- URL="${KERNELSOURCE}/+/$HASH"
- fi
-
- # create change log
- git --no-pager -C ${kerneldir} log --abbrev-commit --oneline --no-patch --no-merges --date-order --date=format:'%Y-%m-%d %H:%M:%S' --pretty=format:'%C(black bold)%ad%Creset%C(auto) | %s | <%an> | <a href='$URL'%H>%H</a>' ${OLDHASHTARGET}..${hash} > "${HASHTARGET}.gitlog"
-
- echo "${hash}" > "${HASHTARGET}.githash"
- hash_watch_1=$(LC_COLLATE=C find -L "${SRC}/patch/kernel/${KERNELPATCHDIR}"/ -name '*.patch' -mindepth 1 -maxdepth 1 -printf '%s %P\n' 2> /dev/null | LC_COLLATE=C sort -n)
- hash_watch_2=$(cat "${SRC}/config/kernel/${LINUXCONFIG}.config")
- echo "${hash_watch_1}${hash_watch_2}" | git hash-object --stdin >> "${HASHTARGET}.githash"
-
- display_alert "Finished updating kernel hashes" "${LINUXCONFIG} $kernel_packaging_target" "info"
- fi
return 0
}
diff --git a/lib/functions/compilation/patch/apply.sh b/lib/functions/compilation/patch/apply.sh
index 3387c061a..32351d1b8 100644
--- a/lib/functions/compilation/patch/apply.sh
+++ b/lib/functions/compilation/patch/apply.sh
@@ -83,13 +83,23 @@ advanced_patch() {
process_patch_file() {
local patch=$1
local status=$2
+ local patch_date
+
+ # get the modification date of the patch. make it not less than MIN_PATCH_AGE, if set.
+ # [[CC]YY]MMDDhhmm[.ss] time format
+ patch_date=$(get_file_modification_time "${patch}")
# detect and remove files which patch will create
lsdiff -s --strip=1 "${patch}" | grep '^+' | awk '{print $2}' | xargs -I % sh -c 'rm -f %'
+ # store an array of the files that patch will modify, we'll set their modification times after the fact
+ declare -a patched_files
+ mapfile -t patched_files < <(lsdiff -s --strip=1 "${patch}" | awk '{print $2}')
+
# @TODO: try patching with `git am` first, so git contains the patch commit info/msg. -- For future git-based hashing.
# shellcheck disable=SC2015 # noted, thanks. I need to handle exit code here.
patch --batch -p1 -N < "${patch}" && {
+ set_files_modification_time "${patch_date}" "${patched_files[@]}"
display_alert "* $status $(basename "${patch}")" "" "info"
} || {
display_alert "* $status $(basename "${patch}")" "failed" "wrn"
diff --git a/lib/functions/compilation/patch/fasthash.sh b/lib/functions/compilation/patch/fasthash.sh
index 306966d38..a01fe7664 100644
--- a/lib/functions/compilation/patch/fasthash.sh
+++ b/lib/functions/compilation/patch/fasthash.sh
@@ -1,5 +1,6 @@
function report_fashtash_should_execute() {
- display_alert "report_fashtash_should_execute" "$*" "debug"
+ report_fasthash "$@"
+ # @TODO: if fasthash only, return 1
return 0
}
@@ -9,13 +10,18 @@ function mark_fasthash_done() {
}
function report_fasthash() {
- display_alert "report_fasthash" "$*" "debug"
+ local type="${1}"
+ local obj="${2}"
+ local desc="${3}"
+ display_alert "report_fasthash" "${type}: ${desc}" "debug"
return 0
}
function initialize_fasthash() {
display_alert "initialize_fasthash" "$*" "debug"
return 0
+ declare -a fast_hash_list=()
+
}
function fasthash_branch() {
@@ -27,3 +33,33 @@ function finish_fasthash() {
display_alert "finish_fasthash" "$*" "debug"
return 0
}
+
+function fasthash_debug() {
+ display_alert "fasthash_debug" "$*" "debug"
+ find . -type f -printf '%T@ %p\n' |
+ grep -v -e "\.ko" -e "\.o" -e "\.cmd" -e "\.mod" -e "\.a" -e "\.tmp" -e "\.dtb" -e ".scr" -e "\.\/debian" |
+ sort -n | tail -n 10 1>&2
+}
+
+function get_file_modification_time() {
+ local file_date
+ if [[ ! -f "${1}" ]]; then
+ exit_with_error "Can't get modification time of nonexisting file" "${1}"
+ fi
+
+ # [[CC]YY]MMDDhhmm[ss] - it is a valid integer
+ file_date=$(date +%Y%m%d%H%M.%S -r "${1}")
+ display_alert "Got date ${file_date} for file" "${1}" "debug"
+
+ # @TODO: if MIN_PATCH_AGE
+ echo -n "${file_date}"
+
+ return 0
+}
+
+function set_files_modification_time() {
+ local mtime="${1}"
+ shift
+ display_alert "Setting date ${mtime} " "${*}" "debug"
+ touch -m -t "${mtime}" "${@}"
+}
diff --git a/lib/functions/compilation/patch/kernel-pkg.sh b/lib/functions/compilation/patch/kernel-pkg.sh
index 11d7d4244..e1653a66e 100644
--- a/lib/functions/compilation/patch/kernel-pkg.sh
+++ b/lib/functions/compilation/patch/kernel-pkg.sh
@@ -1,5 +1,4 @@
function apply_kernel_patches_for_packaging() {
- set -x
local kerneldir="${1}"
local version="${2}"
# Packaging patch for modern kernels should be one for all.
@@ -13,15 +12,16 @@ function apply_kernel_patches_for_packaging() {
local mkdebian="packages/armbian/mkdebian"
local kernel_package_dir="${kerneldir}/scripts/package"
if report_fashtash_should_execute text "$(cat "${SRC}/${builddeb}" "${SRC}/${mkdebian}")" "armbian builddeb and mkdebian replace"; then
- rm -rf "${kerneldir}/debian"/*
-
- # @TODO: is this idempotent?
- # shellcheck disable=SC2016
- sed -i -e 's/^KBUILD_IMAGE := \$(boot)\/Image\.gz$/KBUILD_IMAGE := \$(boot)\/Image/' "${kerneldir}/arch/arm64/Makefile"
+ # Read mtime, then sed, then restore it
+ local arm64_makefile="${kerneldir}/arch/arm64/Makefile" arm64_makefile_mtime
+ arm64_makefile_mtime="$(get_file_modification_time "${arm64_makefile}")"
+ # shellcheck disable=SC2016 # this should be a .patch?
+ sed -i -e 's/^KBUILD_IMAGE := \$(boot)\/Image\.gz$/KBUILD_IMAGE := \$(boot)\/Image/' "${arm64_makefile}"
+ set_files_modification_time "${arm64_makefile_mtime}" "${arm64_makefile}"
# cp with -p to preserve the original dates
- cp -p "${SRC}/${builddeb}" "${kernel_package_dir}/builddeb"
- cp -p "${SRC}/${mkdebian}" "${kernel_package_dir}/mkdebian"
+ cp -pv "${SRC}/${builddeb}" "${kernel_package_dir}/builddeb"
+ cp -pv "${SRC}/${mkdebian}" "${kernel_package_dir}/mkdebian"
chmod 755 "${kernel_package_dir}/builddeb" "${kernel_package_dir}/mkdebian"
mark_fasthash_done # will do git commit, associate fasthash to real hash.
diff --git a/lib/functions/compilation/sources.sh b/lib/functions/compilation/sources.sh
index b4dd11c17..377d4510b 100644
--- a/lib/functions/compilation/sources.sh
+++ b/lib/functions/compilation/sources.sh
@@ -5,12 +5,12 @@ function fetch_sources_kernel_uboot_atf() {
fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes"
fi
- if [[ -n $BOOTSOURCE ]]; then
+ if [[ -n $BOOTSOURCE ]] && [[ "${BOOTSOURCE}" != "none" ]]; then
display_alert "Downloading sources" "u-boot" "git"
fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes" # fetch_from_repo <url> <dir> <ref> <subdir_flag>
fi
- if [[ -n $ATFSOURCE ]]; then
+ if [[ -n "${ATFSOURCE}" && "${ATFSOURCE}" != "none" ]]; then
display_alert "Downloading sources" "atf" "git"
fetch_from_repo "$ATFSOURCE" "$ATFDIR" "$ATFBRANCH" "yes"
fi
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index 7fc46c3d6..5b80314ef 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -13,7 +13,6 @@ main_default_build_single() {
start=$(date +%s)
# Check and install dependencies, directory structure and settings
- # The OFFLINE_WORK variable inside the function
LOG_SECTION="prepare_host" do_with_logging prepare_host
if [[ "${JUST_INIT}" == "yes" ]]; then
@@ -31,6 +30,7 @@ main_default_build_single() {
for option in $(tr ',' ' ' <<< "${CLEAN_LEVEL}"); do
if [[ $option != sources ]]; then
LOG_SECTION="cleaning" do_with_logging cleaning "$option"
+ fasthash_debug "main_cleaning_armbian"
fi
done
fi
@@ -40,7 +40,7 @@ main_default_build_single() {
# @TODO: refactor this. we use it very often
# Compile u-boot if packed .deb does not exist or use the one from repository
if [[ ! -f "${DEB_STORAGE}"/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb ]]; then
- if [[ -n "${ATFSOURCE}" && "${REPOSITORY_INSTALL}" != *u-boot* ]]; then
+ if [[ -n "${ATFSOURCE}" && "${ATFSOURCE}" != "none" && "${REPOSITORY_INSTALL}" != *u-boot* ]]; then
LOG_SECTION="compile_atf" do_with_logging compile_atf
fi
# @TODO: refactor this construct. we use it too many times.
diff --git a/packages/armbian/builddeb b/packages/armbian/builddeb
index d57ba1d76..631380a0c 100755
--- a/packages/armbian/builddeb
+++ b/packages/armbian/builddeb
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/bash
#
# builddeb 1.3
# Copyright 2003 Wichert Akkerman <wichert@wiggy.net>
@@ -45,11 +45,13 @@ create_package() {
local pname="$1" pdir="$2"
local dpkg_deb_opts
+ echo "Armbian kernel packaging: ${pname} ${pdir}"
+
mkdir -m 755 -p "$pdir/DEBIAN"
mkdir -p "$pdir/usr/share/doc/$pname"
- cp debian/copyright "$pdir/usr/share/doc/$pname/"
- cp debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian"
- gzip -9 "$pdir/usr/share/doc/$pname/changelog.Debian"
+ cp -pv debian/copyright "$pdir/usr/share/doc/$pname/"
+ cp -pv debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian"
+ gzip --force -9 "$pdir/usr/share/doc/$pname/changelog.Debian"
sh -c "cd '$pdir'; find . -type f ! -path './DEBIAN/*' -printf '%P\0' \
| xargs -r0 md5sum > DEBIAN/md5sums"
@@ -114,13 +116,14 @@ create_package() {
# Create the package
dpkg-gencontrol -p$pname -P"$pdir"
+ echo "Building deb package with compression '$KDEB_COMPRESS'" 1>&2
dpkg-deb ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir" ..
}
deploy_kernel_headers() {
- pdir=$1
+ pdir=$1 # kernel_headers_dir
- rm -rf $pdir
+ echo "Armbian deploy_kernel_headers: ${pdir}"
destdir=$pdir/usr/src/linux-headers-$version
mkdir -p $destdir
@@ -128,15 +131,14 @@ deploy_kernel_headers() {
(
cd $srctree
find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl
- find arch/*/include include scripts -type f -o -type l
+ find arch/*/include include scripts -type f -o -type l # @TODO: could strip off some stuff?
find security/*/include -type f
find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform
find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f
- ) > debian/hdrsrcfiles
+ ) | grep -v "^\/debian" > debian/hdrsrcfiles
{
if is_enabled CONFIG_STACK_VALIDATION; then
- # echo tools/objtool/objtool
find tools/objtool -type f -executable
fi
@@ -145,147 +147,77 @@ deploy_kernel_headers() {
if is_enabled CONFIG_GCC_PLUGINS; then
find scripts/gcc-plugins -name \*.so -o -name gcc-common.h
fi
- } > debian/hdrobjfiles
+ } | grep -v "^\/debian" > debian/hdrobjfiles
+
+ echo "Headers copying over..."
+ tar -c -f - -C $srctree -T debian/hdrsrcfiles | tar -xf - -C $destdir # Copy over using tar pipes, sources
+ tar -c -f - -T debian/hdrobjfiles | tar -xf - -C $destdir # Copy over using tar pipes, object files
+ rm -f debian/hdrsrcfiles debian/hdrobjfiles # remove file lists
+ # After copying over, apply patch;
if is_native; then
echo "info: Build native: Skip headers-debian-byteshift.patch" >&2
elif is_build_on_amd64; then
(
cd $destdir
- patch -p1 < /tmp/headers-debian-byteshift.patch
+ # detect and remove files which patch will create
+ lsdiff -s --strip=1 "/tmp/headers-debian-byteshift.patch" | grep '^+' | awk '{print $2}' | xargs -I % sh -c 'rm -f %'
+ patch --batch -p1 < "/tmp/headers-debian-byteshift.patch"
)
fi
- tar -c -f - -C $srctree -T debian/hdrsrcfiles | tar -xf - -C $destdir
- tar -c -f - -T debian/hdrobjfiles | tar -xf - -C $destdir
- rm -f debian/hdrsrcfiles debian/hdrobjfiles
-
# copy .config manually to be where it's expected to be
- cp $KCONFIG_CONFIG $destdir/.config
+ cp -pv $KCONFIG_CONFIG $destdir/.config
mkdir -p $pdir/lib/modules/$version/
+ rm -f $pdir/lib/modules/$version/build
ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build
}
deploy_libc_headers() {
pdir=$1
-
- rm -rf $pdir
-
- $MAKE -f $srctree/Makefile headers
- $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH=$pdir/usr
-
# move asm headers to /usr/include/<libc-machine>/asm to match the structure
# used by Debian-based distros (to support multi-arch)
host_arch=$(dpkg-architecture -a$(cat debian/arch) -qDEB_HOST_MULTIARCH)
- mkdir $pdir/usr/include/$host_arch
- mv $pdir/usr/include/asm $pdir/usr/include/$host_arch/
+ mkdir -p $pdir/usr/include/$host_arch
+ [ -d $pdir/usr/include/asm ] && cp -rv $pdir/usr/include/asm $pdir/usr/include/$host_arch/
+ return 0
}
-version=$KERNELRELEASE
+# set -x
+echo "Armbian builddeb starting: ${KERNELRELEASE}..."
+
+version=${KERNELRELEASE}
tmpdir="debian/tmp"
kernel_headers_dir="debian/hdrtmp"
-libc_headers_dir="debian/headertmp"
+libc_headers_dir="debian/libc_header_tmp"
dbg_dir="debian/dbgtmp"
dtb_dir="debian/dtbtmp"
-packagename=linux-image-"$BRANCH$LOCALVERSION"
-kernel_headers_packagename=linux-headers-"$BRANCH$LOCALVERSION"
-dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
+packagename=linux-image-"${BRANCH}${LOCALVERSION}"
+kernel_headers_packagename=linux-headers-"${BRANCH}${LOCALVERSION}"
+dtb_packagename=linux-dtb-"${BRANCH}${LOCALVERSION}"
libc_headers_packagename=linux-libc-dev
-dbg_packagename=$packagename-dbg
-
-if [ "$ARCH" = "um" ]; then
- packagename=user-mode-linux-$version
-fi
-
-# Not all arches have the same installed path in debian
-# XXX: have each arch Makefile export a variable of the canonical image install
-# path instead
-case $ARCH in
- ++aarch64|arm64)
- image_name=Image
- installed_image_path="boot/vmlinuz-$version"
- ;;
- arm*)
- image_name=zImage
- installed_image_path="boot/vmlinuz-$version"
- ;;
- um)
- installed_image_path="usr/bin/linux-$version"
- ;;
- parisc|mips|powerpc)
- installed_image_path="boot/vmlinux-$version"
- ;;
- *)
- image_name=vmlinuz
- installed_image_path="boot/vmlinuz-$version"
- ;;
-esac
+dbg_packagename=${packagename}-dbg
+installed_image_path="boot/vmlinuz-$version" # for all arches
BUILD_DEBUG=$(if_enabled_echo CONFIG_DEBUG_INFO Yes)
-# Setup the directory structure
-rm -rf "$tmpdir" "$dbg_dir" "$dtb_dir" debian/files
+# Complement the directory structure
mkdir -m 755 -p "$tmpdir/DEBIAN"
mkdir -p "$tmpdir/lib" "$tmpdir/boot"
mkdir -m 755 -p "$dtb_dir/DEBIAN"
-mkdir -p "$dtb_dir/boot/dtb-$version" "$dtb_dir/usr/share/doc/$dtb_packagename"
+mkdir -p "$dtb_dir/usr/share/doc/$dtb_packagename"
mkdir -m 755 -p "$kernel_headers_dir/lib/modules/$version/"
mkdir -m 755 -p "$libc_headers_dir/DEBIAN"
-# Install the kernel
-if [ "$ARCH" = "um" ]; then
- mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" "$tmpdir/usr/share/doc/$packagename"
- $MAKE linux
- cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
- cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config"
- gzip "$tmpdir/usr/share/doc/$packagename/config"
-else
- cp System.map "$tmpdir/boot/System.map-$version"
- cp $KCONFIG_CONFIG "$tmpdir/boot/config-$version"
-fi
-cp "$($MAKE -s -f $srctree/Makefile image_name)" "$tmpdir/$installed_image_path"
-
-if is_enabled CONFIG_OF_EARLY_FLATTREE; then
- # Only some architectures with OF support have this target
- if [ -d "${srctree}/arch/$SRCARCH/boot/dts" ]; then
- $MAKE -f $srctree/Makefile INSTALL_DTBS_PATH="$tmpdir/usr/lib/linux-image-$version" dtbs_install
- fi
-fi
+# Install the kernel's System.map and config
+cp -pv System.map "$tmpdir/boot/System.map-$version"
+cp -pv $KCONFIG_CONFIG "$tmpdir/boot/config-$version"
-if grep -q '^CONFIG_OF=y' $KCONFIG_CONFIG; then
- #mkdir -p "$tmpdir/boot/dtb"
- INSTALL_DTBS_PATH="$dtb_dir/boot/dtb-$version" $MAKE KBUILD_SRC= dtbs_install
-fi
-
-if is_enabled CONFIG_MODULES; then
- INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_install
- rm -f "$tmpdir/lib/modules/$version/build"
- rm -f "$tmpdir/lib/modules/$version/source"
-
- if [ "$ARCH" = "um" ]; then
- mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/"
- rmdir "$tmpdir/lib/modules/$version"
- fi
-
- if [ -n "$BUILD_DEBUG" ]; then
- for module in $(find $tmpdir/lib/modules/ -name *.ko -printf '%P\n'); do
- module=lib/modules/$module
- mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module)
- # only keep debug symbols in the debug file
- $OBJCOPY --only-keep-debug $tmpdir/$module $dbg_dir/usr/lib/debug/$module
- # strip original module from debug symbols
- $OBJCOPY --strip-debug $tmpdir/$module
- # then add a link to those
- $OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $tmpdir/$module
- done
-
- # resign stripped modules
- if is_enabled CONFIG_MODULE_SIG_ALL; then
- INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_sign
- fi
- fi
-fi
+# Get the image from the makefile and install it as vmlinuz
+image_name_from_makefile="$($MAKE -s -f "$srctree/Makefile" image_name)"
+cp -pv "${image_name_from_makefile}" "$tmpdir/$installed_image_path"
+image_name="$(basename "${image_name_from_makefile}")" # Just the file name
# Install the maintainer scripts
# Note: hook scripts under /etc/kernel are also executed by official Debian
@@ -297,7 +229,7 @@ for script in postinst postrm preinst prerm; do
mkdir -p "$tmpdir$debhookdir/$script.d"
cat <<- EOF > "$tmpdir/DEBIAN/$script"
#!/bin/bash
-
+ set -x
set -e
# Pass maintainer script parameters to hook scripts
@@ -330,12 +262,12 @@ cat >> $tmpdir/DEBIAN/preinst <<- EOT
# exit if we are running chroot
if [ "\$(stat -c %d:%i /)" != "\$(stat -c %d:%i /proc/1/root/.)" ]; then exit 0; fi
- check_boot_dev (){
+ check_and_unmount (){
boot_device=\$(mountpoint -d /boot)
for file in /dev/* ; do
CURRENT_DEVICE=\$(printf "%d:%d" \$(stat --printf="0x%t 0x%T" \$file))
- if [[ "\$CURRENT_DEVICE" = "\$boot_device" ]]; then
+ if [ "\$CURRENT_DEVICE" = "\$boot_device" ]; then
boot_partition=\$file
break
fi
@@ -343,41 +275,43 @@ cat >> $tmpdir/DEBIAN/preinst <<- EOT
bootfstype=\$(blkid -s TYPE -o value \$boot_partition)
if [ "\$bootfstype" = "vfat" ]; then
+ umount /boot
rm -f /boot/System.map* /boot/config* /boot/vmlinuz* /boot/$image_name /boot/uImage
fi
}
- mountpoint -q /boot && check_boot_dev
+ mountpoint -q /boot && check_and_unmount
exit 0
EOT
create_package "$packagename" "$tmpdir"
-if [ "$ARCH" != "um" ]; then
+# Put the DTBs, installed by kernel make at "$dtb_dir/boot/dtbs_install", at "$dtb_dir/boot/dtb-$version"
+if [ -d "$dtb_dir/boot/dtbs_install" ]; then
+ echo "Armbian: DTB " "$dtb_dir/boot/dtbs_install" "exists, moving to" "$dtb_dir/boot/dtb-$version"
+ [ -d "$dtb_dir/boot/dtb-$version" ] && rm -rf "$dtb_dir/boot/dtb-$version"
+ mv -v "$dtb_dir/boot/dtbs_install" "$dtb_dir/boot/dtb-$version"
+ create_package "$dtb_packagename" "$dtb_dir" "dtb"
+fi
- if [ "$(cat debian/arch)" != "amd64" ]; then # No DTB for amd64 target
- create_package "$dtb_packagename" "$dtb_dir" "dtb"
- fi
+deploy_libc_headers ${libc_headers_dir}
+create_package $libc_headers_packagename $libc_headers_dir
- deploy_libc_headers $libc_headers_dir
- create_package $libc_headers_packagename $libc_headers_dir
-
- if is_enabled CONFIG_MODULES; then
- if is_native; then
- # echo "Skip scripts folder cleaning" >&2
- # echo "Skip creating postinst prerm scripts for headers" >&2
- deploy_kernel_headers $kernel_headers_dir
- create_package $kernel_headers_packagename $kernel_headers_dir
- else
- # Clean up the executables that are left over from
- # cross-compilation for a different host architecture.
- #(
- # cd $srctree
- # make M=scripts clean
- #)
- echo "-- NOT CLEANING before packaging headers. " 1>&2
- deploy_kernel_headers $kernel_headers_dir
- create_package $kernel_headers_packagename $kernel_headers_dir "headers"
- fi
+if is_enabled CONFIG_MODULES; then
+ if is_native; then
+ # echo "Skip scripts folder cleaning" >&2
+ # echo "Skip creating postinst prerm scripts for headers" >&2
+ deploy_kernel_headers $kernel_headers_dir
+ create_package $kernel_headers_packagename $kernel_headers_dir # no "headers" here, no postinst
+ else
+ # Clean up the executables that are left over from
+ # cross-compilation for a different host architecture.
+ #(
+ # cd $srctree
+ # make M=scripts clean
+ #)
+ echo "-- NOT CLEANING before packaging headers. " 1>&2
+ deploy_kernel_headers $kernel_headers_dir
+ create_package $kernel_headers_packagename $kernel_headers_dir "headers"
fi
fi
@@ -387,7 +321,7 @@ if [ -n "$BUILD_DEBUG" ]; then
# Different tools want the image in different locations
# perf
mkdir -p $dbg_dir/usr/lib/debug/lib/modules/$version/
- cp vmlinux $dbg_dir/usr/lib/debug/lib/modules/$version/
+ cp -pv vmlinux $dbg_dir/usr/lib/debug/lib/modules/$version/
# systemtap
mkdir -p $dbg_dir/usr/lib/debug/boot/
ln -s ../lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/boot/vmlinux-$version
diff --git a/packages/armbian/mkdebian b/packages/armbian/mkdebian
index 003195372..83a37b99d 100755
--- a/packages/armbian/mkdebian
+++ b/packages/armbian/mkdebian
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/bash
#
# Copyright 2003 Wichert Akkerman <wichert@wiggy.net>
#
@@ -19,57 +19,64 @@ if_enabled_echo() {
}
set_debarch() {
- if [ -n "$KBUILD_DEBARCH" ] ; then
+ if [ -n "$KBUILD_DEBARCH" ]; then
debarch="$KBUILD_DEBARCH"
return
fi
# Attempt to find the correct Debian architecture
case "$UTS_MACHINE" in
- i386|ia64|alpha|m68k|riscv*)
- debarch="$UTS_MACHINE" ;;
- x86_64)
- debarch=amd64 ;;
- sparc*)
- debarch=sparc$(if_enabled_echo CONFIG_64BIT 64) ;;
- s390*)
- debarch=s390x ;;
- ppc*)
- if is_enabled CONFIG_64BIT; then
- debarch=ppc64$(if_enabled_echo CONFIG_CPU_LITTLE_ENDIAN el)
- else
- debarch=powerpc$(if_enabled_echo CONFIG_SPE spe)
- fi
- ;;
- parisc*)
- debarch=hppa ;;
- mips*)
- if is_enabled CONFIG_CPU_LITTLE_ENDIAN; then
- debarch=mips$(if_enabled_echo CONFIG_64BIT 64)$(if_enabled_echo CONFIG_CPU_MIPSR6 r6)el
- elif is_enabled CONFIG_CPU_MIPSR6; then
- debarch=mips$(if_enabled_echo CONFIG_64BIT 64)r6
- else
- debarch=mips
- fi
- ;;
- aarch64|arm64)
- debarch=arm64 ;;
- arm*)
- if is_enabled CONFIG_AEABI; then
- debarch=arm$(if_enabled_echo CONFIG_VFP hf el)
- else
- debarch=arm
- fi
- ;;
- openrisc)
- debarch=or1k ;;
- sh)
- if is_enabled CONFIG_CPU_SH3; then
- debarch=sh3$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
- elif is_enabled CONFIG_CPU_SH4; then
- debarch=sh4$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
- fi
- ;;
+ i386 | ia64 | alpha | m68k | riscv*)
+ debarch="$UTS_MACHINE"
+ ;;
+ x86_64)
+ debarch=amd64
+ ;;
+ sparc*)
+ debarch=sparc$(if_enabled_echo CONFIG_64BIT 64)
+ ;;
+ s390*)
+ debarch=s390x
+ ;;
+ ppc*)
+ if is_enabled CONFIG_64BIT; then
+ debarch=ppc64$(if_enabled_echo CONFIG_CPU_LITTLE_ENDIAN el)
+ else
+ debarch=powerpc$(if_enabled_echo CONFIG_SPE spe)
+ fi
+ ;;
+ parisc*)
+ debarch=hppa
+ ;;
+ mips*)
+ if is_enabled CONFIG_CPU_LITTLE_ENDIAN; then
+ debarch=mips$(if_enabled_echo CONFIG_64BIT 64)$(if_enabled_echo CONFIG_CPU_MIPSR6 r6)el
+ elif is_enabled CONFIG_CPU_MIPSR6; then
+ debarch=mips$(if_enabled_echo CONFIG_64BIT 64)r6
+ else
+ debarch=mips
+ fi
+ ;;
+ aarch64 | arm64)
+ debarch=arm64
+ ;;
+ arm*)
+ if is_enabled CONFIG_AEABI; then
+ debarch=arm$(if_enabled_echo CONFIG_VFP hf el)
+ else
+ debarch=arm
+ fi
+ ;;
+ openrisc)
+ debarch=or1k
+ ;;
+ sh)
+ if is_enabled CONFIG_CPU_SH3; then
+ debarch=sh3$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
+ elif is_enabled CONFIG_CPU_SH4; then
+ debarch=sh4$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
+ fi
+ ;;
esac
if [ -z "$debarch" ]; then
debarch=$(dpkg-architecture -qDEB_HOST_ARCH)
@@ -84,6 +91,9 @@ set_debarch() {
fi
}
+#set -x
+echo "Armbian mkdebian starting..."
+
# Some variables and settings used throughout the script
KDEB_SOURCENAME=linux-$KERNELRELEASE
version=$KERNELRELEASE
@@ -91,7 +101,7 @@ if [ -n "$KDEB_PKGVERSION" ]; then
packageversion=$KDEB_PKGVERSION
revision=${packageversion##*-}
else
- revision=$(cat .version 2>/dev/null||echo 1)
+ revision=$(cat .version 2> /dev/null || echo 1)
packageversion=$version-$revision
fi
sourcename=$KDEB_SOURCENAME
@@ -101,10 +111,6 @@ libc_headers_packagename=linux-libc-dev
dtb_packagename=linux-dtb-"$BRANCH$LOCALVERSION"
dbg_packagename=$packagename-dbg
-if [ "$ARCH" = "um" ] ; then
- packagename=user-mode-linux-$version
-fi
-
debarch=
set_debarch
@@ -118,7 +124,7 @@ else
user=${KBUILD_BUILD_USER-$(id -nu)}
name=${DEBFULLNAME-$user}
if [ -z "$email" ]; then
- buildhost=${KBUILD_BUILD_HOST-$(hostname -f 2>/dev/null || hostname)}
+ buildhost=${KBUILD_BUILD_HOST-$(hostname -f 2> /dev/null || hostname)}
email="$user@$buildhost"
fi
maintainer="$name <$email>"
@@ -126,14 +132,14 @@ fi
# Try to determine distribution
if [ -n "$KDEB_CHANGELOG_DIST" ]; then
- distribution=$KDEB_CHANGELOG_DIST
+ distribution=$KDEB_CHANGELOG_DIST
# In some cases lsb_release returns the codename as n/a, which breaks dpkg-parsechangelog
-elif distribution=$(lsb_release -cs 2>/dev/null) && [ -n "$distribution" ] && [ "$distribution" != "n/a" ]; then
- : # nothing to do in this case
+elif distribution=$(lsb_release -cs 2> /dev/null) && [ -n "$distribution" ] && [ "$distribution" != "n/a" ]; then
+ : # nothing to do in this case
else
- distribution="unstable"
- echo >&2 "Using default distribution of 'unstable' in the changelog"
- echo >&2 "Install lsb-release or set \$KDEB_CHANGELOG_DIST explicitly"
+ distribution="unstable"
+ echo >&2 "Using default distribution of 'unstable' in the changelog"
+ echo >&2 "Install lsb-release or set \$KDEB_CHANGELOG_DIST explicitly"
fi
mkdir -p debian/source/
@@ -144,111 +150,109 @@ extra_build_depends=", $(if_enabled_echo CONFIG_UNWINDER_ORC libelf-dev:native)"
extra_build_depends="$extra_build_depends, $(if_enabled_echo CONFIG_SYSTEM_TRUSTED_KEYRING libssl-dev:native)"
# Generate a simple changelog template
-cat <<EOF > debian/changelog
-$sourcename ($packageversion) $distribution; urgency=low
+cat <<- EOF > debian/changelog
+ $sourcename ($packageversion) $distribution; urgency=low
- * Armbian built Linux kernel. $BRANCH
+ * Armbian built Linux kernel. $BRANCH
- -- $maintainer $(date -R)
+ -- $maintainer $(date -R)
EOF
# Generate copyright file
-cat <<EOF > debian/copyright
-This is a packacked armbian patches version of the Linux kernel.
+cat <<- EOF > debian/copyright
+ This is a packacked armbian patches version of the Linux kernel.
-The sources may be found at most Linux archive sites, including:
-https://www.kernel.org/pub/linux/kernel
+ The sources may be found at most Linux archive sites, including:
+ https://www.kernel.org/pub/linux/kernel
-Copyright: 1991 - 2018 Linus Torvalds and others.
+ Copyright: 1991 - 2018 Linus Torvalds and others.
-The git repository for mainline kernel development is at:
-git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
+ The git repository for mainline kernel development is at:
+ git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 dated June, 1991.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 dated June, 1991.
-On Debian GNU/Linux systems, the complete text of the GNU General Public
-License version 2 can be found in \`/usr/share/common-licenses/GPL-2'.
+ On Debian GNU/Linux systems, the complete text of the GNU General Public
+ License version 2 can be found in \`/usr/share/common-licenses/GPL-2'.
EOF
# Generate a control file
-cat <<EOF > debian/control
-Source: $sourcename
-Section: kernel
-Priority: optional
-Maintainer: $maintainer
-Build-Depends: bc, rsync, kmod, cpio, bison, flex | flex:native $extra_build_depends
-Homepage: https://www.kernel.org/
-
-Package: $packagename
-Architecture: $debarch
-Provides: linux-image, linux-image-armbian, armbian-$BRANCH
-Description: Linux kernel, armbian version $version $BRANCH
- This package contains the Linux kernel, modules and corresponding other
- files, version: $version.
-
-Package: $libc_headers_packagename
-Section: devel
-Provides: linux-kernel-headers
-Conflicts: linux-kernel-headers
-Replaces: linux-kernel-headers
-Architecture: $debarch
-Description: Armbian Linux support headers for userspace development
- This package provides userspaces headers from the Linux kernel. These headers
- are used by the installed headers for GNU glibc and other system libraries.
-Multi-Arch: same
-
-Package: $dtb_packagename
-Architecture: $debarch
-Provides: linux-dtb, linux-dtb-armbian, armbian-$BRANCH
-Description: Armbian Linux DTB, version $version $BRANCH
- This package contains device blobs from the Linux kernel, version $version
+cat <<- EOF > debian/control
+ Source: $sourcename
+ Section: kernel
+ Priority: optional
+ Maintainer: $maintainer
+ Build-Depends: bc, rsync, kmod, cpio, bison, flex | flex:native $extra_build_depends
+ Homepage: https://www.kernel.org/
+
+ Package: $packagename
+ Architecture: $debarch
+ Provides: linux-image, linux-image-armbian, armbian-$BRANCH
+ Description: Linux kernel, armbian version $version $BRANCH
+ This package contains the Linux kernel, modules and corresponding other
+ files, version: $version.
+
+ Package: $libc_headers_packagename
+ Section: devel
+ Provides: linux-kernel-headers
+ Conflicts: linux-kernel-headers
+ Replaces: linux-kernel-headers
+ Architecture: $debarch
+ Description: Armbian Linux support headers for userspace development
+ This package provides userspaces headers from the Linux kernel. These headers
+ are used by the installed headers for GNU glibc and other system libraries.
+ Multi-Arch: same
+
+ Package: $dtb_packagename
+ Architecture: $debarch
+ Provides: linux-dtb, linux-dtb-armbian, armbian-$BRANCH
+ Description: Armbian Linux DTB, version $version $BRANCH
+ This package contains device blobs from the Linux kernel, version $version
EOF
if is_enabled CONFIG_MODULES; then
-cat <<EOF >> debian/control
-
-Package: $kernel_headers_packagename
-Section: devel
-Architecture: $debarch
-Provides: linux-headers, linux-headers-armbian, armbian-$BRANCH
-Depends: make, gcc, libc6-dev, bison, flex, libssl-dev
-Description: Linux kernel headers for $version on $debarch $BRANCH
- This package provides kernel header files for $version on $debarch
- .
- This is useful for people who need to build external modules
-EOF
+ cat <<- EOF >> debian/control
+
+ Package: $kernel_headers_packagename
+ Section: devel
+ Architecture: $debarch
+ Provides: linux-headers, linux-headers-armbian, armbian-$BRANCH
+ Depends: make, gcc, libc6-dev, bison, flex, libssl-dev
+ Description: Linux kernel headers for $version on $debarch $BRANCH
+ This package provides kernel header files for $version on $debarch
+ .
+ This is useful for people who need to build external modules
+ EOF
fi
if is_enabled CONFIG_DEBUG_INFO; then
-cat <<EOF >> debian/control
-
-Package: $dbg_packagename
-Section: debug
-Architecture: $debarch
-Description: Linux kernel debugging symbols for $version
- This package will come in handy if you need to debug the kernel. It provides
- all the necessary debug symbols for the kernel and its modules.
-EOF
+ cat <<- EOF >> debian/control
+
+ Package: $dbg_packagename
+ Section: debug
+ Architecture: $debarch
+ Description: Linux kernel debugging symbols for $version
+ This package will come in handy if you need to debug the kernel. It provides
+ all the necessary debug symbols for the kernel and its modules.
+ EOF
fi
-cat <<EOF > debian/rules
+cat << EOF > debian/rules
#!$(command -v $MAKE) -f
srctree ?= .
build:
- \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
- KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile
+ echo "Kernel should be built, headers and modules installed before calling this."
binary-arch:
- \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
- KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile intdeb-pkg
+ echo "Armbian: Calling builddep via make intdeb-pkg"
+ \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile intdeb-pkg
clean:
rm -rf debian/*tmp debian/files
- \$(MAKE) clean
binary: binary-arch
EOF
From 0e26d1439e8e6ad7ae331247a618db4ea4a4130c Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 19 Feb 2022 01:06:32 +0100
Subject: [PATCH] armbian-next: minor stylistic changes that I end up doing
while working on other stuff
- I am `OFFLINE_WORK`'ing, I don't wanna waste 3 seconds, thanks
- OCD-fix of double `local` declarations
---
lib/functions/cli/cli-entrypoint.sh | 8 ++------
lib/functions/general/git.sh | 22 ++++++++++------------
2 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/lib/functions/cli/cli-entrypoint.sh b/lib/functions/cli/cli-entrypoint.sh
index d9da56acc..22de78eb4 100644
--- a/lib/functions/cli/cli-entrypoint.sh
+++ b/lib/functions/cli/cli-entrypoint.sh
@@ -17,7 +17,6 @@ function bla() {
#exit 0 # exit without error
}
-
function cli_entrypoint() {
if [[ "${ARMBIAN_ENABLE_CALL_TRACING}" == "yes" ]]; then
set -T # inherit return/debug traps
@@ -42,12 +41,9 @@ function cli_entrypoint() {
fi
# The only way to get this is via ENV var...
- if [ "$OFFLINE_WORK" == "yes" ]; then
- echo -e "\n"
- display_alert "* " "You are working offline."
+ if [ "${OFFLINE_WORK}" == "yes" ]; then
+ display_alert "* " "You are working offline!"
display_alert "* " "Sources, time and host will not be checked"
- echo -e "\n"
- sleep 3s
else
# check and install the basic utilities here # @TODO: logging?
prepare_host_basic
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index 6b043832b..51f658d31 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -47,18 +47,15 @@ fetch_from_repo() {
url=${url//'https://github.com/'/$GITHUB_SOURCE}
# The 'offline' variable must always be set to 'true' or 'false'
- if [ "$OFFLINE_WORK" == "yes" ]; then
- local offline=true
- else
- local offline=false
+ local offline=false
+ if [[ "${OFFLINE_WORK}" == "yes" ]]; then
+ offline=true
fi
[[ -z $ref || ($ref != tag:* && $ref != branch:* && $ref != head && $ref != commit:*) ]] && exit_with_error "Error in configuration"
- local ref_type=${ref%%:*}
+ local ref_type=${ref%%:*} ref_name=${ref##*:}
if [[ $ref_type == head ]]; then
- local ref_name=HEAD
- else
- local ref_name=${ref##*:}
+ ref_name=HEAD
fi
display_alert "Getting sources from Git" "$dir $ref_name" "info"
@@ -76,7 +73,6 @@ fetch_from_repo() {
display_alert "Git working dir" "${git_work_dir}" "debug"
-
# "Sanity check" since we only support one "origin"
if [[ "$(git rev-parse --git-dir)" == ".git" && "$url" != *"$(git remote get-url origin | sed 's/^.*@//' | sed 's/^.*\/\///')" ]]; then
exit_with_error "Remote URL does not match. Stopping!" "${git_work_dir} $dir $ref_name" "warn"
@@ -91,10 +87,12 @@ fetch_from_repo() {
local changed=false
+ # get local hash; might fail
+ local local_hash
+ local_hash=$(git rev-parse @ 2> /dev/null || true) # Don't fail nor output anything if failure
+
# when we work offline we simply return the sources to their original state
if ! $offline; then
- local local_hash
- local_hash=$(git rev-parse @ 2> /dev/null || true) # Don't fail nor output anything if failure
case $ref_type in
branch)
@@ -125,7 +123,7 @@ fetch_from_repo() {
fi # offline
- if [[ $changed == true ]]; then
+ if [[ "${changed}" == "true" ]]; then
# If there's a cold bundle URL specified:
# - if there's already a cold_bundle_xxx remote, move on.
From 1b0d604efc56025a1dfd8a2d9ef3485799fbbe1b Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 18 Feb 2022 04:26:28 +0100
Subject: [PATCH] [giga-wip] rework patching, introducing fasthash
---
lib/functions/compilation/kernel.sh | 41 +++--
.../compilation/{patching.sh => patch/apply.sh} | 85 +++++----
lib/functions/compilation/patch/fasthash.sh | 29 ++++
.../compilation/patch/kernel-bootsplash.sh | 34 ++++
.../{extra-drivers.sh => patch/kernel-drivers.sh} | 189 ++++-----------------
lib/functions/compilation/patch/kernel-pkg.sh | 92 ++++++++++
lib/functions/compilation/sources.sh | 10 +-
lib/library-functions.sh | 45 ++++-
8 files changed, 303 insertions(+), 222 deletions(-)
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index d33c18f9f..c6591d5cc 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -44,11 +44,10 @@ function compile_kernel() {
)
fi
+ local kerneldir="$SRC/cache/sources/$LINUXSOURCEDIR"
if [[ $USE_OVERLAYFS == yes ]]; then
- local kerneldir
+ display_alert "Using overlayfs_wrapper" "kernel_${LINUXFAMILY}_${BRANCH}" "debug"
kerneldir=$(overlayfs_wrapper "wrap" "$SRC/cache/sources/$LINUXSOURCEDIR" "kernel_${LINUXFAMILY}_${BRANCH}")
- else
- local kerneldir="$SRC/cache/sources/$LINUXSOURCEDIR"
fi
cd "${kerneldir}" || exit
@@ -63,19 +62,39 @@ function compile_kernel() {
# read kernel git hash
hash=$(git --git-dir="$kerneldir"/.git rev-parse HEAD)
+ ## Start kernel patching process.
+ ## There's a few objectives here:
+ ## - (always) produce a fasthash: represents "what would be done" (eg: md5 of a patch, crc32 of description).
+ ## - (optionally) execute modification against living tree (eg: apply a patch, copy a file, etc). only if `DO_MODIFY=yes`
+ ## - (always) call mark_change_commit with the description of what was done and fasthash.
+ initialize_fasthash "kernel" "${hash}" "${pre_patch_version}" "${kerneldir}"
+ declare -a fast_hash_list=()
+
# Apply a series of patches if a series file exists
- if test -f "${SRC}"/patch/kernel/"${KERNELPATCHDIR}"/series.conf; then
+ local series_conf="${SRC}"/patch/kernel/${KERNELPATCHDIR}/series.conf
+ if test -f "${series_conf}"; then
display_alert "series.conf file visible. Apply"
- series_conf="${SRC}"/patch/kernel/${KERNELPATCHDIR}/series.conf
-
- # apply_patch_series <target dir> <full path to series file>
- apply_patch_series "${kerneldir}" "$series_conf"
+ fasthash_branch "patches-${KERNELPATCHDIR}-series.conf"
+ apply_patch_series "${kerneldir}" "${series_conf}" # applies a series of patches, read from a file. calls process_patch_file
fi
- # build 3rd party drivers; # @TODO: does it build? or only patch?
- prepare_extra_kernel_drivers
+ # mostly local-based packaging fixes.
+ fasthash_branch "packaging-patches"
+ apply_kernel_patches_for_packaging "${kerneldir}" "${version}" # calls process_patch_file and other stuff.
+
+ # applies a humongous amount of patches coming from github repos.
+ # it's mostly conditional, and very complex.
+ # @TODO: re-enable after finishing converting it with fasthash magic
+ # apply_kernel_patches_for_drivers "${kerneldir}" "${version}" # calls process_patch_file and other stuff. there is A LOT of it.
+
+ # applies a series of patches, in directory order, from multiple directories (default/"user" patches)
+ # @TODO: I believe using the $BOARD here is the most confusing thing in the whole of Armbian. It should be disabled.
+ # @TODO: Armbian built kernels dont't vary per-board, but only per "$ARCH-$LINUXFAMILY-$BRANCH"
+ # @TODO: allowing for board-specific kernel patches creates insanity. uboot is enough.
+ fasthash_branch "patches-${KERNELPATCHDIR}-$BRANCH"
+ advanced_patch "kernel" "$KERNELPATCHDIR" "$BOARD" "" "$BRANCH" "$LINUXFAMILY-$BRANCH" # calls process_patch_file, "target" is empty there
- advanced_patch "kernel" "$KERNELPATCHDIR" "$BOARD" "" "$BRANCH" "$LINUXFAMILY-$BRANCH"
+ finish_fasthash "kernel" # this reports the final hash and creates git branch to build ID. All modifications commited.
# create patch for manual source changes in debug mode
[[ $CREATE_PATCHES == yes ]] && userpatch_create "kernel"
diff --git a/lib/functions/compilation/patching.sh b/lib/functions/compilation/patch/apply.sh
similarity index 71%
rename from lib/functions/compilation/patching.sh
rename to lib/functions/compilation/patch/apply.sh
index 7ebcef3ac..3387c061a 100644
--- a/lib/functions/compilation/patching.sh
+++ b/lib/functions/compilation/patch/apply.sh
@@ -97,54 +97,49 @@ process_patch_file() {
}
return 0 # short-circuit above, avoid exiting with error
}
+function new_process_patch_file() {
+ local patch="$1" # full filename
+ local status="$2" # message, may contain ANSI
+ local relative_patch="${patch##"${SRC}"/}" # ${FOO##prefix} remove prefix from FOO
+
+ # report_fashtash_should_execute is report_fasthash returns true only if we're supposed to apply the patch on disk.
+ if report_fashtash_should_execute file "${patch}" "Apply patch ${relative_patch}"; then
+ # detect and remove files which patch will create
+ lsdiff -s --strip=1 "${patch}" | grep '^+' | awk '{print $2}' | xargs -I % sh -c 'rm -f %'
+
+ # @TODO: try patching with `git am` first, so git contains the patch commit info/msg. -- For future git-based hashing.
+ # shellcheck disable=SC2015 # noted, thanks. I need to handle exit code here.
+ patch --batch -p1 -N < "${patch}" && {
+ display_alert "* ${status} ${relative_patch}" "" "info" || true
+ } || {
+ display_alert "* ${status} ${relative_patch}" "failed" "wrn"
+ [[ $EXIT_PATCHING_ERROR == yes ]] && exit_with_error "Aborting due to EXIT_PATCHING_ERROR" "Patch ${relative_patch} failed"
+ }
+ mark_fasthash_done # will do git commit, associate fasthash to real hash.
+ fi
-# apply_patch_series <target dir> <full path to series file>
-apply_patch_series() {
- local t_dir="${1}"
- local series="${2}"
- local bzdir="$(dirname $series)"
- local flag
- local err_pt=$(mktemp /tmp/apply_patch_series_XXXXX) # @OTODO: rpardini: hmm, why is this different from all others?
-
- list=$(awk '$0 !~ /^#.*|^-.*|^$/' "${series}")
- skiplist=$(awk '$0 ~ /^-.*/{print $NF}' "${series}")
-
- display_alert "apply a series of " "[$(echo $list | wc -w)] patches"
- display_alert "skip [$(echo $skiplist | wc -w)] patches"
-
- cd "${t_dir}" || exit 1
- for p in $list; do
- # Detect and remove files as '*.patch' which patch will create.
- # So we need to delete the file before applying the patch if it exists.
- lsdiff -s --strip=1 "$bzdir/$p" |
- awk '$0 ~ /^+.*patch$/{print $2}' |
- xargs -I % sh -c 'rm -f %'
-
- set +e # has to tolerate error here to catch them
- patch --batch --silent --no-backup-if-mismatch -p1 -N < $bzdir/"$p" >> $err_pt 2>&1
- flag=$?
- set -e # back to normal, errors cause stop.
+ return 0 # short-circuit above, avoid exiting with error
+}
- case $flag in
- 0)
- printf "[\033[32m done \033[0m] %s\n" "${p}"
- printf "[ done ] %s\n" "${p}" >> "${DEST}"/debug/patching.log
- ;;
- 1)
- printf "[\033[33m FAILED \033[0m] %s\n" "${p}"
- echo -e "[ FAILED ] For ${p} \t\tprocess exit [ $flag ]" >> "${DEST}"/debug/patching.log
- cat $err_pt >> "${DEST}"/debug/patching.log
- ;;
- 2)
- printf "[\033[31m Patch wrong \033[0m] %s\n" "${p}"
- echo -e "Patch wrong ${p}\t\tprocess exit [ $flag ]" >> "${DEST}"/debug/patching.log
- cat $err_pt >> "${DEST}"/debug/patching.log
- ;;
- esac
- echo "" > $err_pt
+# apply_patch_series <target dir> <full path to series_file_full_path file>
+apply_patch_series() {
+ local target_dir="${1}"
+ local series_file_full_path="${2}"
+ local included_list skip_list skip_count counter=1 base_dir
+ base_dir="$(dirname "${series_file_full_path}")"
+ included_list="$(awk '$0 !~ /^#.*|^-.*|^$/' "${series_file_full_path}")"
+ included_count=$(echo -n "${included_list}" | wc -w)
+ skip_list="$(awk '$0 ~ /^-.*/{print $NF}' "${series_file_full_path}")"
+ skip_count=$(echo -n "${skip_list}" | wc -w)
+ display_alert "apply a series of " "[$(echo -n "$included_list" | wc -w)] patches" "info"
+ [[ ${skip_count} -gt 0 ]] && display_alert "skipping" "[${skip_count}] patches" "warn"
+ cd "${target_dir}" || exit 1
+
+ for p in $included_list; do
+ process_patch_file "${base_dir}/${p}" "${counter}/${included_count}"
+ counter=$((counter + 1))
done
- echo "" >> "${DEST}"/debug/patching.log
- rm $err_pt
+ display_alert "done applying patch series " "[$(echo -n "$included_list" | wc -w)] patches" "info"
}
userpatch_create() {
diff --git a/lib/functions/compilation/patch/fasthash.sh b/lib/functions/compilation/patch/fasthash.sh
new file mode 100644
index 000000000..306966d38
--- /dev/null
+++ b/lib/functions/compilation/patch/fasthash.sh
@@ -0,0 +1,29 @@
+function report_fashtash_should_execute() {
+ display_alert "report_fashtash_should_execute" "$*" "debug"
+ return 0
+}
+
+function mark_fasthash_done() {
+ display_alert "mark_fasthash_done" "$*" "debug"
+ return 0
+}
+
+function report_fasthash() {
+ display_alert "report_fasthash" "$*" "debug"
+ return 0
+}
+
+function initialize_fasthash() {
+ display_alert "initialize_fasthash" "$*" "debug"
+ return 0
+}
+
+function fasthash_branch() {
+ display_alert "fasthash_branch" "$*" "debug"
+ return 0
+}
+
+function finish_fasthash() {
+ display_alert "finish_fasthash" "$*" "debug"
+ return 0
+}
diff --git a/lib/functions/compilation/patch/kernel-bootsplash.sh b/lib/functions/compilation/patch/kernel-bootsplash.sh
new file mode 100644
index 000000000..e5d279110
--- /dev/null
+++ b/lib/functions/compilation/patch/kernel-bootsplash.sh
@@ -0,0 +1,34 @@
+#
+# Linux splash file
+#
+function apply_kernel_patches_for_bootsplash() {
+ # previously: if linux-version compare "${version}" ge 5.10 && [ $SKIP_BOOTSPLASH != yes ]; then
+ [[ "${SKIP_BOOTSPLASH}" == "yes" ]] && return 0
+ linux-version compare "${version}" le 5.10 && return 0
+
+ display_alert "Adding" "Kernel bootsplash patch" "info"
+
+ process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0001-Revert-fbcon-Add-option-to-enable-legacy-hardware-ac.patch" "applying"
+
+ if linux-version compare "${version}" ge 5.15; then
+ process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0002-Revert-vgacon-drop-unused-vga_init_done.patch" "applying"
+ fi
+ process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0003-Revert-vgacon-remove-software-scrollback-support.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0004-Revert-drivers-video-fbcon-fix-NULL-dereference-in-f.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0005-Revert-fbcon-remove-no-op-fbcon_set_origin.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0006-Revert-fbcon-remove-now-unusued-softback_lines-curso.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0007-Revert-fbcon-remove-soft-scrollback-code.patch" "applying"
+
+ process_patch_file "${SRC}/patch/misc/0001-bootsplash.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/0002-bootsplash.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/0003-bootsplash.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/0004-bootsplash.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/0005-bootsplash.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/0006-bootsplash.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/0007-bootsplash.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/0008-bootsplash.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/0009-bootsplash.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/0010-bootsplash.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/0011-bootsplash.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/0012-bootsplash.patch" "applying"
+}
diff --git a/lib/functions/compilation/extra-drivers.sh b/lib/functions/compilation/patch/kernel-drivers.sh
similarity index 75%
rename from lib/functions/compilation/extra-drivers.sh
rename to lib/functions/compilation/patch/kernel-drivers.sh
index f731b4319..61f1cb630 100644
--- a/lib/functions/compilation/extra-drivers.sh
+++ b/lib/functions/compilation/patch/kernel-drivers.sh
@@ -9,125 +9,7 @@
# This file is a part of the Armbian build script
# https://github.com/armbian/build/
-prepare_extra_kernel_drivers() {
-
- # Packaging patch for modern kernels should be one for all.
- # Currently we have it per kernel family since we can't have one
- # Maintaining one from central location starting with 5.3+
- # Temporally set for new "default->legacy,next->current" family naming
-
- if linux-version compare "${version}" ge 5.10; then
-
- if test -d ${kerneldir}/debian; then
- rm -rf ${kerneldir}/debian/*
- fi
- sed -i -e '
- s/^KBUILD_IMAGE := \$(boot)\/Image\.gz$/KBUILD_IMAGE := \$(boot)\/Image/
- ' ${kerneldir}/arch/arm64/Makefile
-
- rm -f ${kerneldir}/scripts/package/{builddeb,mkdebian}
-
- cp ${SRC}/packages/armbian/builddeb ${kerneldir}/scripts/package/builddeb
- cp ${SRC}/packages/armbian/mkdebian ${kerneldir}/scripts/package/mkdebian
-
- chmod 755 ${kerneldir}/scripts/package/{builddeb,mkdebian}
-
- elif linux-version compare "${version}" ge 5.8.17 &&
- linux-version compare "${version}" le 5.9 ||
- linux-version compare "${version}" ge 5.9.2; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-5.8-9.y.patch" "applying"
- elif linux-version compare "${version}" ge 5.6; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-5.6.y.patch" "applying"
- elif linux-version compare "${version}" ge 5.3; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-5.3.y.patch" "applying"
- fi
-
- if [[ "${version}" == "4.19."* ]] && [[ "$LINUXFAMILY" == sunxi* || "$LINUXFAMILY" == meson64 ||
- "$LINUXFAMILY" == mvebu64 || "$LINUXFAMILY" == mt7623 || "$LINUXFAMILY" == mvebu ]]; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-4.19.y.patch" "applying"
- fi
-
- if [[ "${version}" == "4.19."* ]] && [[ "$LINUXFAMILY" == rk35xx ]]; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-4.19.y-rk35xx.patch" "applying"
- fi
-
- if [[ "${version}" == "4.14."* ]] && [[ "$LINUXFAMILY" == s5p6818 || "$LINUXFAMILY" == mvebu64 ||
- "$LINUXFAMILY" == imx7d || "$LINUXFAMILY" == odroidxu4 || "$LINUXFAMILY" == mvebu ]]; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-4.14.y.patch" "applying"
- fi
-
- if [[ "${version}" == "4.4."* || "${version}" == "4.9."* ]] &&
- [[ "$LINUXFAMILY" == rockpis || "$LINUXFAMILY" == rk3399 ]]; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-4.4.y-rk3399.patch" "applying"
- fi
-
- if [[ "${version}" == "4.4."* ]] &&
- [[ "$LINUXFAMILY" == rockchip64 || "$LINUXFAMILY" == station* ]]; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-4.4.y-rockchip64.patch" "applying"
- fi
-
- if [[ "${version}" == "4.4."* ]] && [[ "$LINUXFAMILY" == rockchip || "$LINUXFAMILY" == rk322x ]]; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-4.4.y.patch" "applying"
- fi
-
- if [[ "${version}" == "4.9."* ]] && [[ "$LINUXFAMILY" == meson64 || "$LINUXFAMILY" == odroidc4 ]]; then
- display_alert "Adjusting" "packaging" "info"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/patch/misc/general-packaging-4.9.y.patch" "applying"
- fi
-
- #
- # Linux splash file
- #
-
- if linux-version compare "${version}" ge 5.10 && [ $SKIP_BOOTSPLASH != yes ]; then
-
- display_alert "Adding" "Kernel splash file" "info"
-
- process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0001-Revert-fbcon-Add-option-to-enable-legacy-hardware-ac.patch" "applying"
-
- if linux-version compare "${version}" ge 5.15; then
- process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0002-Revert-vgacon-drop-unused-vga_init_done.patch" "applying"
- fi
- process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0003-Revert-vgacon-remove-software-scrollback-support.patch" "applying"
- process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0004-Revert-drivers-video-fbcon-fix-NULL-dereference-in-f.patch" "applying"
- process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0005-Revert-fbcon-remove-no-op-fbcon_set_origin.patch" "applying"
- process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0006-Revert-fbcon-remove-now-unusued-softback_lines-curso.patch" "applying"
- process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0007-Revert-fbcon-remove-soft-scrollback-code.patch" "applying"
-
- process_patch_file "${SRC}/patch/misc/0001-bootsplash.patch" "applying"
- process_patch_file "${SRC}/patch/misc/0002-bootsplash.patch" "applying"
- process_patch_file "${SRC}/patch/misc/0003-bootsplash.patch" "applying"
- process_patch_file "${SRC}/patch/misc/0004-bootsplash.patch" "applying"
- process_patch_file "${SRC}/patch/misc/0005-bootsplash.patch" "applying"
- process_patch_file "${SRC}/patch/misc/0006-bootsplash.patch" "applying"
- process_patch_file "${SRC}/patch/misc/0007-bootsplash.patch" "applying"
- process_patch_file "${SRC}/patch/misc/0008-bootsplash.patch" "applying"
- process_patch_file "${SRC}/patch/misc/0009-bootsplash.patch" "applying"
- process_patch_file "${SRC}/patch/misc/0010-bootsplash.patch" "applying"
- process_patch_file "${SRC}/patch/misc/0011-bootsplash.patch" "applying"
- process_patch_file "${SRC}/patch/misc/0012-bootsplash.patch" "applying"
-
- fi
-
+function prepare_extra_kernel_drivers() {
#
# mac80211 wireless driver injection features from Kali Linux
#
@@ -150,45 +32,35 @@ prepare_extra_kernel_drivers() {
# Older versions have AUFS support with a patch
if linux-version compare "${version}" ge 5.1 && linux-version compare "${version}" le 5.12 && [ "$AUFS" == yes ]; then
-
- # attach to specifics tag or branch
- local aufstag
- aufstag=$(echo "${version}" | cut -f 1-2 -d ".")
+ # @TODO: Fasthash for this whole block is only the git hash of revision we'd apply from Mr. Okajima
+ local aufs_tag # attach to specifics tag or branch
+ aufs_tag=$(echo "${version}" | cut -f 1-2 -d ".")
# manual overrides
- if linux-version compare "${version}" ge 5.4.3 && linux-version compare "${version}" le 5.5; then aufstag="5.4.3"; fi
- if linux-version compare "${version}" ge 5.10.82 && linux-version compare "${version}" le 5.11; then aufstag="5.10.82"; fi
- if linux-version compare "${version}" ge 5.15.5 && linux-version compare "${version}" le 5.16; then aufstag="5.15.5"; fi
-
- # check if Mr. Okajima already made a branch for this version
- improved_git ls-remote --exit-code --heads https://github.com/sfjro/aufs5-standalone "aufs${aufstag}" > /dev/null
-
- if [ "$?" -ne "0" ]; then
- # then use rc branch
- aufstag="5.x-rcN"
- # @TODO: this does not do what you think it does; nonzero explode always
- improved_git ls-remote --exit-code --heads https://github.com/sfjro/aufs5-standalone "aufs${aufstag}" > /dev/null
- fi
-
- if [ "$?" -eq "0" ]; then
-
- display_alert "Adding" "AUFS ${aufstag}" "info"
- local aufsver="branch:aufs${aufstag}"
- fetch_from_repo "https://github.com/sfjro/aufs5-standalone" "aufs5" "branch:${aufsver}" "yes"
- cd "$kerneldir" || exit
- process_patch_file "${SRC}/cache/sources/aufs5/${aufsver#*:}/aufs5-kbuild.patch" "applying"
- process_patch_file "${SRC}/cache/sources/aufs5/${aufsver#*:}/aufs5-base.patch" "applying"
- process_patch_file "${SRC}/cache/sources/aufs5/${aufsver#*:}/aufs5-mmap.patch" "applying"
- process_patch_file "${SRC}/cache/sources/aufs5/${aufsver#*:}/aufs5-standalone.patch" "applying"
- cp -R "${SRC}/cache/sources/aufs5/${aufsver#*:}"/{Documentation,fs} .
- cp "${SRC}/cache/sources/aufs5/${aufsver#*:}"/include/uapi/linux/aufs_type.h include/uapi/linux/
-
- fi
+ if linux-version compare "${version}" ge 5.4.3 && linux-version compare "${version}" le 5.5; then aufs_tag="5.4.3"; fi
+ if linux-version compare "${version}" ge 5.10.82 && linux-version compare "${version}" le 5.11; then aufs_tag="5.10.82"; fi
+ if linux-version compare "${version}" ge 5.15.5 && linux-version compare "${version}" le 5.16; then aufs_tag="5.15.5"; fi
+
+ # check if Mr. Okajima already made a branch for this version, otherwise use RC.
+ git ls-remote --exit-code --heads https://github.com/sfjro/aufs5-standalone "aufs${aufs_tag}" > /dev/null || {
+ aufs_tag="5.x-rcN" # then use rc branch
+ git ls-remote --exit-code --heads https://github.com/sfjro/aufs5-standalone "aufs${aufs_tag}" > /dev/null
+ }
+ display_alert "Adding" "AUFS ${aufs_tag}" "info"
+ local aufs_branch="branch:aufs${aufs_tag}"
+ fetch_from_repo "https://github.com/sfjro/aufs5-standalone" "aufs5" "branch:${aufs_branch}" "yes"
+ cd "$kerneldir" || exit
+ process_patch_file "${SRC}/cache/sources/aufs5/${aufs_branch#*:}/aufs5-kbuild.patch" "applying"
+ process_patch_file "${SRC}/cache/sources/aufs5/${aufs_branch#*:}/aufs5-base.patch" "applying"
+ process_patch_file "${SRC}/cache/sources/aufs5/${aufs_branch#*:}/aufs5-mmap.patch" "applying"
+ process_patch_file "${SRC}/cache/sources/aufs5/${aufs_branch#*:}/aufs5-standalone.patch" "applying"
+ cp -R "${SRC}/cache/sources/aufs5/${aufs_branch#*:}"/{Documentation,fs} .
+ cp "${SRC}/cache/sources/aufs5/${aufs_branch#*:}"/include/uapi/linux/aufs_type.h include/uapi/linux/
fi
# WireGuard VPN for Linux 3.10 - 5.5
if linux-version compare "${version}" ge 3.10 && linux-version compare "${version}" le 5.5 && [ "${WIREGUARD}" == yes ]; then
-
+ # @TODO: fasthash for this is... ? remote git hash?
# attach to specifics tag or branch
local wirever="branch:master"
@@ -218,6 +90,7 @@ prepare_extra_kernel_drivers() {
# Updated USB network drivers for RTL8152/RTL8153 based dongles that also support 2.5Gbs variants
if linux-version compare "${version}" ge 5.4 && linux-version compare "${version}" le 5.12 && [ $LINUXFAMILY != mvebu64 ] && [ $LINUXFAMILY != rk322x ] && [ $LINUXFAMILY != odroidxu4 ] && [ $EXTRAWIFI == yes ]; then
+ # @TODO: fasthash for this is... ? remote git hash?
# attach to specifics tag or branch
local rtl8152ver="branch:master"
@@ -232,6 +105,7 @@ prepare_extra_kernel_drivers() {
# Wireless drivers for Realtek 8189ES chipsets
if linux-version compare "${version}" ge 3.14 && [ "$EXTRAWIFI" == yes ]; then
+ # @TODO: fasthash for this is... ? remote git hash?
# attach to specifics tag or branch
local rtl8189esver="branch:master"
@@ -264,6 +138,7 @@ prepare_extra_kernel_drivers() {
# Wireless drivers for Realtek 8189FS chipsets
if linux-version compare "${version}" ge 3.14 && [ "$EXTRAWIFI" == yes ]; then
+ # @TODO: fasthash for this is... ? remote git hash?
# attach to specifics tag or branch
local rtl8189fsver="branch:rtl8189fs"
@@ -296,6 +171,7 @@ prepare_extra_kernel_drivers() {
# Wireless drivers for Realtek 8192EU chipsets
if linux-version compare "${version}" ge 3.14 && [ "$EXTRAWIFI" == yes ]; then
+ # @TODO: fasthash for this is... ? remote git hash?
# attach to specifics tag or branch
local rtl8192euver="branch:realtek-4.4.x"
@@ -328,6 +204,7 @@ prepare_extra_kernel_drivers() {
# Wireless drivers for Realtek 8811, 8812, 8814 and 8821 chipsets
if linux-version compare "${version}" ge 3.14 && [ "$EXTRAWIFI" == yes ]; then
+ # @TODO: fasthash for this is... ? remote git hash?
# attach to specifics tag or branch
local rtl8812auver="branch:v5.6.4.2"
@@ -358,6 +235,7 @@ prepare_extra_kernel_drivers() {
# Wireless drivers for Xradio XR819 chipsets
if linux-version compare "${version}" ge 4.19 && [[ "$LINUXFAMILY" == sunxi* ]] && [[ "$EXTRAWIFI" == yes ]]; then
+ # @TODO: fasthash for this is... ? remote git hash?
display_alert "Adding" "Wireless drivers for Xradio XR819 chipsets" "info"
@@ -391,6 +269,7 @@ prepare_extra_kernel_drivers() {
# Wireless drivers for Realtek RTL8811CU and RTL8821C chipsets
if linux-version compare "${version}" ge 3.14 && [ "$EXTRAWIFI" == yes ]; then
+ # @TODO: fasthash for this is... ? remote git hash?
# attach to specifics tag or branch
local rtl8811cuver="commit:2bebdb9a35c1d9b6e6a928e371fa39d5fcec8a62"
@@ -440,6 +319,7 @@ prepare_extra_kernel_drivers() {
if linux-version compare "${version}" ge 3.14 &&
linux-version compare "${version}" lt 5.15 &&
[ "$EXTRAWIFI" == yes ]; then
+ # @TODO: fasthash for this is... ? remote git hash?
# attach to specifics tag or branch
local rtl8188euver="branch:v5.7.6.1"
@@ -481,6 +361,7 @@ prepare_extra_kernel_drivers() {
# Wireless drivers for Realtek 88x2bu chipsets
if linux-version compare "${version}" ge 5.0 && [ "$EXTRAWIFI" == yes ]; then
+ # @TODO: fasthash for this is... ? remote git hash?
# attach to specifics tag or branch
local rtl88x2buver="branch:5.8.7.1_35809.20191129_COEX20191120-7777"
@@ -517,6 +398,7 @@ prepare_extra_kernel_drivers() {
# Wireless drivers for Realtek 88x2cs chipsets
if linux-version compare "${version}" ge 5.9 && [ "$EXTRAWIFI" == yes ]; then
+ # @TODO: fasthash for this is... ? remote git hash?
# attach to specifics tag or branch
local rtl88x2csver="branch:tune_for_jethub"
@@ -564,6 +446,7 @@ prepare_extra_kernel_drivers() {
# Wireless drivers for Realtek 8723DS chipsets
if linux-version compare "${version}" ge 5.0 && [ "$EXTRAWIFI" == yes ]; then
+ # @TODO: fasthash for this is... ? remote git hash?
# attach to specifics tag or branch
local rtl8723dsver="branch:master"
@@ -600,6 +483,7 @@ prepare_extra_kernel_drivers() {
# Wireless drivers for Realtek 8723DU chipsets
if linux-version compare $version ge 5.0 && [ "$EXTRAWIFI" == yes ]; then
+ # @TODO: fasthash for this is... ? remote git hash?
# attach to specifics tag or branch
if linux-version compare $version ge 5.12; then
@@ -636,6 +520,7 @@ prepare_extra_kernel_drivers() {
# Wireless drivers for Realtek 8822BS chipsets
if linux-version compare "${version}" ge 4.4 && [ "$EXTRAWIFI" == yes ]; then
+ # @TODO: fasthash for this is... ? remote git hash?
# attach to specifics tag or branch
display_alert "Adding" "Wireless drivers for Realtek 8822BS chipsets ${rtl8822bsver}" "info"
diff --git a/lib/functions/compilation/patch/kernel-pkg.sh b/lib/functions/compilation/patch/kernel-pkg.sh
new file mode 100644
index 000000000..11d7d4244
--- /dev/null
+++ b/lib/functions/compilation/patch/kernel-pkg.sh
@@ -0,0 +1,92 @@
+function apply_kernel_patches_for_packaging() {
+ set -x
+ local kerneldir="${1}"
+ local version="${2}"
+ # Packaging patch for modern kernels should be one for all.
+ # Currently we have it per kernel family since we can't have one
+ # Maintaining one from central location starting with 5.3+
+ # Temporally set for new "default->legacy,next->current" family naming
+
+ if linux-version compare "${version}" ge 5.10; then
+ # This case is special: it does not use process_patch_file. fasthash manually.
+ local builddeb="packages/armbian/builddeb"
+ local mkdebian="packages/armbian/mkdebian"
+ local kernel_package_dir="${kerneldir}/scripts/package"
+ if report_fashtash_should_execute text "$(cat "${SRC}/${builddeb}" "${SRC}/${mkdebian}")" "armbian builddeb and mkdebian replace"; then
+ rm -rf "${kerneldir}/debian"/*
+
+ # @TODO: is this idempotent?
+ # shellcheck disable=SC2016
+ sed -i -e 's/^KBUILD_IMAGE := \$(boot)\/Image\.gz$/KBUILD_IMAGE := \$(boot)\/Image/' "${kerneldir}/arch/arm64/Makefile"
+
+ # cp with -p to preserve the original dates
+ cp -p "${SRC}/${builddeb}" "${kernel_package_dir}/builddeb"
+ cp -p "${SRC}/${mkdebian}" "${kernel_package_dir}/mkdebian"
+
+ chmod 755 "${kernel_package_dir}/builddeb" "${kernel_package_dir}/mkdebian"
+ mark_fasthash_done # will do git commit, associate fasthash to real hash.
+ fi
+
+ elif linux-version compare "${version}" ge 5.8.17 &&
+ linux-version compare "${version}" le 5.9 ||
+ linux-version compare "${version}" ge 5.9.2; then
+ display_alert "Adjusting" "packaging" "info"
+ cd "$kerneldir" || exit
+ process_patch_file "${SRC}/patch/misc/general-packaging-5.8-9.y.patch" "applying"
+ elif linux-version compare "${version}" ge 5.6; then
+ display_alert "Adjusting" "packaging" "info"
+ cd "$kerneldir" || exit
+ process_patch_file "${SRC}/patch/misc/general-packaging-5.6.y.patch" "applying"
+ elif linux-version compare "${version}" ge 5.3; then
+ display_alert "Adjusting" "packaging" "info"
+ cd "$kerneldir" || exit
+ process_patch_file "${SRC}/patch/misc/general-packaging-5.3.y.patch" "applying"
+ fi
+
+ if [[ "${version}" == "4.19."* ]] && [[ "$LINUXFAMILY" == sunxi* || "$LINUXFAMILY" == meson64 ||
+ "$LINUXFAMILY" == mvebu64 || "$LINUXFAMILY" == mt7623 || "$LINUXFAMILY" == mvebu ]]; then
+ display_alert "Adjusting" "packaging" "info"
+ cd "$kerneldir" || exit
+ process_patch_file "${SRC}/patch/misc/general-packaging-4.19.y.patch" "applying"
+ fi
+
+ if [[ "${version}" == "4.19."* ]] && [[ "$LINUXFAMILY" == rk35xx ]]; then
+ display_alert "Adjusting" "packaging" "info"
+ cd "$kerneldir" || exit
+ process_patch_file "${SRC}/patch/misc/general-packaging-4.19.y-rk35xx.patch" "applying"
+ fi
+
+ if [[ "${version}" == "4.14."* ]] && [[ "$LINUXFAMILY" == s5p6818 || "$LINUXFAMILY" == mvebu64 ||
+ "$LINUXFAMILY" == imx7d || "$LINUXFAMILY" == odroidxu4 || "$LINUXFAMILY" == mvebu ]]; then
+ display_alert "Adjusting" "packaging" "info"
+ cd "$kerneldir" || exit
+ process_patch_file "${SRC}/patch/misc/general-packaging-4.14.y.patch" "applying"
+ fi
+
+ if [[ "${version}" == "4.4."* || "${version}" == "4.9."* ]] &&
+ [[ "$LINUXFAMILY" == rockpis || "$LINUXFAMILY" == rk3399 ]]; then
+ display_alert "Adjusting" "packaging" "info"
+ cd "$kerneldir" || exit
+ process_patch_file "${SRC}/patch/misc/general-packaging-4.4.y-rk3399.patch" "applying"
+ fi
+
+ if [[ "${version}" == "4.4."* ]] &&
+ [[ "$LINUXFAMILY" == rockchip64 || "$LINUXFAMILY" == station* ]]; then
+ display_alert "Adjusting" "packaging" "info"
+ cd "$kerneldir" || exit
+ process_patch_file "${SRC}/patch/misc/general-packaging-4.4.y-rockchip64.patch" "applying"
+ fi
+
+ if [[ "${version}" == "4.4."* ]] && [[ "$LINUXFAMILY" == rockchip || "$LINUXFAMILY" == rk322x ]]; then
+ display_alert "Adjusting" "packaging" "info"
+ cd "$kerneldir" || exit
+ process_patch_file "${SRC}/patch/misc/general-packaging-4.4.y.patch" "applying"
+ fi
+
+ if [[ "${version}" == "4.9."* ]] && [[ "$LINUXFAMILY" == meson64 || "$LINUXFAMILY" == odroidc4 ]]; then
+ display_alert "Adjusting" "packaging" "info"
+ cd "$kerneldir" || exit
+ process_patch_file "${SRC}/patch/misc/general-packaging-4.9.y.patch" "applying"
+ fi
+
+}
diff --git a/lib/functions/compilation/sources.sh b/lib/functions/compilation/sources.sh
index 1fcacf8a3..b4dd11c17 100644
--- a/lib/functions/compilation/sources.sh
+++ b/lib/functions/compilation/sources.sh
@@ -1,15 +1,15 @@
function fetch_sources_kernel_uboot_atf() {
- if [[ -n $BOOTSOURCE ]]; then
- display_alert "Downloading sources" "u-boot" "git"
- fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes" # fetch_from_repo <url> <dir> <ref> <subdir_flag>
- fi
-
if [[ -n $KERNELSOURCE ]]; then
display_alert "Downloading sources" "kernel" "git"
GIT_COLD_BUNDLE_URL="${MAINLINE_KERNEL_COLD_BUNDLE_URL}" \
fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes"
fi
+ if [[ -n $BOOTSOURCE ]]; then
+ display_alert "Downloading sources" "u-boot" "git"
+ fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes" # fetch_from_repo <url> <dir> <ref> <subdir_flag>
+ fi
+
if [[ -n $ATFSOURCE ]]; then
display_alert "Downloading sources" "atf" "git"
fetch_from_repo "$ATFSOURCE" "$ATFDIR" "$ATFBRANCH" "yes"
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index 39792dbe5..2e720a66f 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -69,27 +69,54 @@ source "${SRC}"/lib/functions/compilation/debs.sh
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/compilation/extra-drivers.sh
-# shellcheck source=lib/functions/compilation/extra-drivers.sh
-source "${SRC}"/lib/functions/compilation/extra-drivers.sh
+### lib/functions/compilation/kernel.sh
+# shellcheck source=lib/functions/compilation/kernel.sh
+source "${SRC}"/lib/functions/compilation/kernel.sh
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/compilation/kernel.sh
-# shellcheck source=lib/functions/compilation/kernel.sh
-source "${SRC}"/lib/functions/compilation/kernel.sh
+### lib/functions/compilation/patch/apply.sh
+# shellcheck source=lib/functions/compilation/patch/apply.sh
+source "${SRC}"/lib/functions/compilation/patch/apply.sh
+
+# no errors tolerated. invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/compilation/patch/fasthash.sh
+# shellcheck source=lib/functions/compilation/patch/fasthash.sh
+source "${SRC}"/lib/functions/compilation/patch/fasthash.sh
+
+# no errors tolerated. invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/compilation/patch/kernel-bootsplash.sh
+# shellcheck source=lib/functions/compilation/patch/kernel-bootsplash.sh
+source "${SRC}"/lib/functions/compilation/patch/kernel-bootsplash.sh
+
+# no errors tolerated. invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/compilation/patch/kernel-drivers.sh
+# shellcheck source=lib/functions/compilation/patch/kernel-drivers.sh
+source "${SRC}"/lib/functions/compilation/patch/kernel-drivers.sh
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/compilation/patching.sh
-# shellcheck source=lib/functions/compilation/patching.sh
-source "${SRC}"/lib/functions/compilation/patching.sh
+### lib/functions/compilation/patch/kernel-pkg.sh
+# shellcheck source=lib/functions/compilation/patch/kernel-pkg.sh
+source "${SRC}"/lib/functions/compilation/patch/kernel-pkg.sh
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
From 8939a9142a7e08f0dae8bc866811687119501c5e Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 18 Feb 2022 04:17:22 +0100
Subject: [PATCH] [wip] git: experiment with stable kernel bundle, and all
tags. nice, but for what?
- also: never delete working copy, exit with error instead.
---
lib/functions/configuration/main-config.sh | 6 ++++--
lib/functions/general/git.sh | 34 +++++++++++++-----------------
2 files changed, 19 insertions(+), 21 deletions(-)
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 800845483..722371f3e 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -112,8 +112,10 @@ function do_main_configuration() {
# used by multiple sources - reduce code duplication
[[ $USE_MAINLINE_GOOGLE_MIRROR == yes ]] && MAINLINE_MIRROR=google
- # URL for the git bundle used to "bootstrap" local git copies.
- export MAINLINE_KERNEL_COLD_BUNDLE_URL="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/clone.bundle"
+ # URL for the git bundle used to "bootstrap" local git copies without too much server load. This applies independently of git mirror below.
+ export MAINLINE_KERNEL_TORVALDS_BUNDLE_URL="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/clone.bundle" # this is plain torvalds, single branch
+ export MAINLINE_KERNEL_STABLE_BUNDLE_URL="https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/clone.bundle" # this is all stable branches. with tags!
+ export MAINLINE_KERNEL_COLD_BUNDLE_URL="${MAINLINE_KERNEL_COLD_BUNDLE_URL:-$MAINLINE_KERNEL_STABLE_BUNDLE_URL}" # default to stable. it's bigger but more useful for developers.
case $MAINLINE_MIRROR in
google)
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index e6a2fe521..6b043832b 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -76,15 +76,10 @@ fetch_from_repo() {
display_alert "Git working dir" "${git_work_dir}" "debug"
- # check if existing remote URL for the repo or branch does not match current one
- # may not be supported by older git versions
- # Check the folder as a git repository.
- # Then the target URL matches the local URL.
+ # "Sanity check" since we only support one "origin"
if [[ "$(git rev-parse --git-dir)" == ".git" && "$url" != *"$(git remote get-url origin | sed 's/^.*@//' | sed 's/^.*\/\///')" ]]; then
- display_alert "Remote URL does not match, removing existing local copy" "$dir $ref_name" "warn"
- rm -rf "${git_work_dir}"
- mkdir -p "${git_work_dir}"
+ exit_with_error "Remote URL does not match. Stopping!" "${git_work_dir} $dir $ref_name" "warn"
fi
if [[ "$(git rev-parse --git-dir)" != ".git" ]]; then
@@ -187,25 +182,26 @@ fetch_from_repo() {
# - add the warmup as remote, fetch from it; export it as a cached bundle for next time.
# remote was updated, fetch and check out updates, but not tags; tags pull their respective commits too, making it a huge fetch.
- display_alert "Fetching updates from origin" "$dir $ref_name "
+ display_alert "Fetching updates from origin" "$dir $ref_name"
case $ref_type in
- branch | commit) improved_git_fetch origin "${ref_name}" ;;
- tag) improved_git_fetch origin tags/"${ref_name}" ;;
- head) improved_git_fetch origin HEAD ;;
+ branch | commit) improved_git_fetch --tags origin "${ref_name}" ;;
+ tag) improved_git_fetch --tags origin tags/"${ref_name}" ;;
+ head) improved_git_fetch --tags origin HEAD ;;
esac
display_alert "Origin fetch completed, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size again
display_alert "Checking out" "$dir $ref_name"
improved_git checkout -f -q FETCH_HEAD
improved_git clean -q -d -f
-
- if [[ $has_fetched_from_bundle -gt 0 ]]; then
- display_alert "Pre-pruning, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after bundle pull
- echo -n "${remote_hash}" > .git/shallow # commit to keep for shallowing, can be something else. for now is full prune.
- improved_git remote remove "${git_cold_bundle_remote_id}"
- improved_git reflog expire --expire=0 --all
- improved_git gc --prune=all
- fi
+ display_alert "After checkout, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after bundle pull
+
+ #if [[ $has_fetched_from_bundle -gt 0 ]]; then
+ # display_alert "Pre-pruning, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after bundle pull
+ # echo -n "${remote_hash}" > .git/shallow # commit to keep for shallowing, can be something else. for now is full prune.
+ # improved_git remote remove "${git_cold_bundle_remote_id}"
+ # improved_git reflog expire --expire=0 --all
+ # improved_git gc --prune=all
+ #fi
elif [[ -n $(git status -uno --porcelain --ignore-submodules=all) ]]; then # if not changed, but dirty...
display_alert "Cleaning git dir" "$(git status -s | wc -l) files" # working directory is not clean, show it
From b853358ccab458dce0efca486ec5a15fda4ec193 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 18 Feb 2022 04:09:37 +0100
Subject: [PATCH] [wip] disable make clean during packaging. I wanna rebuild
fast, always [NO PR?]
---
packages/armbian/builddeb | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/packages/armbian/builddeb b/packages/armbian/builddeb
index 0163d401a..d57ba1d76 100755
--- a/packages/armbian/builddeb
+++ b/packages/armbian/builddeb
@@ -370,10 +370,11 @@ if [ "$ARCH" != "um" ]; then
else
# Clean up the executables that are left over from
# cross-compilation for a different host architecture.
- (
- cd $srctree
- make M=scripts clean
- )
+ #(
+ # cd $srctree
+ # make M=scripts clean
+ #)
+ echo "-- NOT CLEANING before packaging headers. " 1>&2
deploy_kernel_headers $kernel_headers_dir
create_package $kernel_headers_packagename $kernel_headers_dir "headers"
fi
From d61b6ddd982f316604bdedd82a0907beef7cfa0b Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 17 Feb 2022 22:21:33 +0100
Subject: [PATCH] armbian-next: export CHOSEN_KERNEL_WITH_ARCH for reporting
info
- fix info gathering, parse all boards first, and stop if some failed
- fix KERNEL_TARGET regex by including optional "export "
- add export from info to CSV, very basic stuff, but works
---
lib/functions/main/config-prepare.sh | 1 +
lib/tools/info.py | 21 +++++++++------
lib/tools/json2csv.py | 51 ++++++++++++++++++++++++++++++++++++
3 files changed, 65 insertions(+), 8 deletions(-)
diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh
index b416b1302..bb3831889 100644
--- a/lib/functions/main/config-prepare.sh
+++ b/lib/functions/main/config-prepare.sh
@@ -173,6 +173,7 @@ function prepare_and_config_main_build_single() {
export CHOSEN_ROOTFS=${BSP_CLI_PACKAGE_NAME}
export CHOSEN_DESKTOP=armbian-${RELEASE}-desktop-${DESKTOP_ENVIRONMENT}
export CHOSEN_KSRC=linux-source-${BRANCH}-${LINUXFAMILY}
+ export CHOSEN_KERNEL_WITH_ARCH=${CHOSEN_KERNEL}-${ARCH} # Only for reporting purposes.
display_alert "Done with prepare_and_config_main_build_single" "${BOARD}.${BOARD_TYPE}" "info"
}
diff --git a/lib/tools/info.py b/lib/tools/info.py
index af932eefa..088d4738a 100755
--- a/lib/tools/info.py
+++ b/lib/tools/info.py
@@ -135,8 +135,8 @@ def parse_board_file_for_static_info(board_file, board_id):
hw_desc_clean = hw_desc_line.strip("# ").strip("\n")
# Parse KERNEL_TARGET line.
- kernel_target_matches = re.findall(r"^KERNEL_TARGET=\"(.*)\"", "\n".join(file_lines), re.MULTILINE)
- kernel_targets = kernel_target_matches[0].split(",")
+ kernel_target_matches = re.findall(r"^(export )?KERNEL_TARGET=\"(.*)\"", "\n".join(file_lines), re.MULTILINE)
+ kernel_targets = kernel_target_matches[0][1].split(",")
eprint("Possible kernel branches for board: ", board_id, " : ", kernel_targets)
return {
@@ -167,16 +167,21 @@ if True:
all_boards = get_all_boards_list_from_armbian(armbian_src_path)
# eprint(json.dumps(all_boards, indent=4, sort_keys=True))
+ # first, gather the board_info for every board. if any fail, stop.
+ info_for_board = {}
+ for board in all_boards.keys():
+ try:
+ board_info = parse_board_file_for_static_info(all_boards[board], board)
+ info_for_board[board] = board_info
+ except BaseException as e:
+ eprint("** Failed to parse board file {} static: {}".format(board, e))
+ raise e
+ # now loop over gathered infos
every_info = []
with concurrent.futures.ProcessPoolExecutor(max_workers=32) as executor:
every_future = []
for board in all_boards.keys():
- try:
- board_info = parse_board_file_for_static_info(all_boards[board], board)
- except:
- eprint("** Failed to parse board file {} static.".format(board))
- continue
-
+ board_info = info_for_board[board]
for possible_branch in board_info["BOARD_POSSIBLE_BRANCHES"]:
all_params = common_compile_params | board_compile_params | {"BRANCH": possible_branch}
eprint("Submitting future for board {} with BRANCH={}".format(board, possible_branch))
diff --git a/lib/tools/json2csv.py b/lib/tools/json2csv.py
new file mode 100755
index 000000000..7933ed9d6
--- /dev/null
+++ b/lib/tools/json2csv.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python3
+import collections.abc
+import json
+import sys
+
+
+def eprint(*args, **kwargs):
+ print(*args, file=sys.stderr, **kwargs)
+
+
+def flatten(d, parent_key='', sep='_'):
+ items = []
+ for k, v in d.items():
+ new_key = parent_key + sep + k if parent_key else k
+ if isinstance(v, collections.abc.MutableMapping):
+ items.extend(flatten(v, new_key, sep=sep).items())
+ else:
+ items.append((new_key, v))
+ return dict(items)
+
+
+json_object = json.load(sys.stdin)
+eprint("Loaded {} objects from stdin...".format(len(json_object)))
+
+flat = []
+for obj in json_object:
+ flat.append(flatten(obj, '', '.'))
+
+columns_map = {}
+for obj in flat:
+ # get the string keys
+ for key in obj.keys():
+ value = obj[key]
+ if type(value) == str:
+ columns_map[key] = True
+
+columns = columns_map.keys()
+
+eprint("columns: {}".format(columns_map))
+
+eprint("columns: {}".format(columns))
+
+import csv
+
+with open('boards_vs_branches.csv', 'w', newline='') as csvfile:
+ fieldnames = columns
+ writer = csv.DictWriter(csvfile, fieldnames=fieldnames, extrasaction='ignore')
+
+ writer.writeheader()
+ for obj in flat:
+ writer.writerow(obj)
From dcf101ccbcb61fb4bf0af97f8592f6f166a20b92 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 17 Feb 2022 21:47:02 +0100
Subject: [PATCH] [squash] remove ddk bullshit from KERNEL_TARGET
---
config/boards/rpi4b.wip | 2 +-
config/boards/uefi-arm64.conf | 2 +-
config/boards/uefi-x86.conf | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/config/boards/rpi4b.wip b/config/boards/rpi4b.wip
index b471e3421..c78b14060 100644
--- a/config/boards/rpi4b.wip
+++ b/config/boards/rpi4b.wip
@@ -1,7 +1,7 @@
# Broadcom BCM2711 quad core 1-8Gb RAM SoC USB3 GBE USB-C WiFi/BT
export BOARD_NAME="Raspberry Pi 4"
export BOARDFAMILY="bcm2711"
-export KERNEL_TARGET="ddk,current,edge"
+export KERNEL_TARGET="legacy,current,edge"
export FK__MACHINE_MODEL="Raspberry Pi 4 Model B" # this is passed to flash-kernel.
export ASOUND_STATE="asound.state.rpi"
diff --git a/config/boards/uefi-arm64.conf b/config/boards/uefi-arm64.conf
index 523e488ce..8f5e201f7 100644
--- a/config/boards/uefi-arm64.conf
+++ b/config/boards/uefi-arm64.conf
@@ -1,4 +1,4 @@
# aarch64 via UEFI for all UEFI-enabled boards
export BOARD_NAME="UEFI arm64"
export BOARDFAMILY="uefi-arm64"
-export KERNEL_TARGET="ddk,current,edge"
+export KERNEL_TARGET="legacy,current,edge"
diff --git a/config/boards/uefi-x86.conf b/config/boards/uefi-x86.conf
index 186e5fdba..7ff375bb8 100644
--- a/config/boards/uefi-x86.conf
+++ b/config/boards/uefi-x86.conf
@@ -1,4 +1,4 @@
# x86_64 via UEFI/BIOS for all boards
export BOARD_NAME="UEFI x86"
export BOARDFAMILY="uefi-x86"
-export KERNEL_TARGET="ddk,current,edge"
+export KERNEL_TARGET="legacy,current,edge"
From 7183b3290b9df1c4fce8307813702c23846be817 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 17 Feb 2022 15:49:27 +0100
Subject: [PATCH] armbian-next: remove file logging of aggregation stuff.
config phase can't touch disk anymore.
---
lib/functions/configuration/aggregation.sh | 46 ------------------------------
lib/functions/configuration/main-config.sh | 11 -------
2 files changed, 57 deletions(-)
diff --git a/lib/functions/configuration/aggregation.sh b/lib/functions/configuration/aggregation.sh
index e89275995..0dc729544 100644
--- a/lib/functions/configuration/aggregation.sh
+++ b/lib/functions/configuration/aggregation.sh
@@ -5,22 +5,12 @@
# Write to variables :
# - aggregated_content
aggregate_content() {
- [[ "${CONFIG_DEFS_ONLY}" == "yes" ]] && return 0 # Don't write to disk in this case.
- LOG_OUTPUT_FILE="$SRC/output/${LOG_SUBPATH}/potential-paths.log"
- echo -e "Potential paths :" >> "${LOG_OUTPUT_FILE}"
- show_checklist_variables potential_paths
for filepath in ${potential_paths}; do
if [[ -f "${filepath}" ]]; then
- echo -e "${filepath/"$SRC"\//} yes" >> "${LOG_OUTPUT_FILE}"
aggregated_content+=$(cat "${filepath}")
aggregated_content+="${separator}"
- # else
- # echo -e "${filepath/"$SRC"\//} no\n" >> "${LOG_OUTPUT_FILE}"
fi
-
done
- echo "" >> "${LOG_OUTPUT_FILE}"
- unset LOG_OUTPUT_FILE
}
get_all_potential_paths() {
@@ -35,14 +25,6 @@ get_all_potential_paths() {
done
done
done
- # for ppath in ${potential_paths}; do
- # echo "Checking for ${ppath}"
- # if [[ -f "${ppath}" ]]; then
- # echo "OK !|"
- # else
- # echo "Nope|"
- # fi
- # done
}
# Environment variables expected :
@@ -110,31 +92,3 @@ cleanup_list() {
list_to_clean="${list_to_clean%"${list_to_clean##*[![:space:]]}"}"
echo ${list_to_clean}
}
-
-# is a formatted output of the values of variables
-# from the list at the place of the function call.
-#
-# The LOG_OUTPUT_FILE variable must be defined in the calling function
-# before calling the `show_checklist_variables` function and unset after.
-#
-show_checklist_variables() {
- [[ "${CONFIG_DEFS_ONLY}" == "yes" ]] && return 0 # Don't write to disk in this case.
- local checklist=$*
- local var pval
- local log_file=${LOG_OUTPUT_FILE:-"${SRC}"/output/${LOG_SUBPATH}/trash.log}
- local _line=${BASH_LINENO[0]}
- local _function=${FUNCNAME[1]}
- local _file=$(basename "${BASH_SOURCE[1]}")
-
- echo -e "Show variables in function: $_function" "[$_file:$_line]\n" >> $log_file
-
- for var in $checklist; do
- eval pval=\$$var
- echo -e "\n$var =:" >> $log_file
- if [ $(echo "$pval" | gawk -F"/" '{print NF}') -ge 4 ]; then
- printf "%s\n" $pval >> $log_file
- else
- printf "%-30s %-30s %-30s %-30s\n" $pval >> $log_file
- fi
- done
-}
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index e21bb2de9..800845483 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -388,7 +388,6 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
PACKAGE_LIST_ADDITIONAL="$(one_line aggregate_all_cli "packages.additional" " ")"
LOG_OUTPUT_FILE="$SRC/output/${LOG_SUBPATH}/debootstrap-list.log"
- show_checklist_variables "DEBOOTSTRAP_LIST DEBOOTSTRAP_COMPONENTS PACKAGE_LIST PACKAGE_LIST_ADDITIONAL PACKAGE_LIST_UNINSTALL"
# Dependent desktop packages
# Myy : Sources packages from file here
@@ -397,7 +396,6 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
if [[ $BUILD_DESKTOP == "yes" ]]; then
PACKAGE_LIST_DESKTOP+="$(one_line aggregate_all_desktop "packages" " ")"
echo -e "\nGroups selected ${DESKTOP_APPGROUPS_SELECTED} -> PACKAGES :" >> "${LOG_OUTPUT_FILE}"
- show_checklist_variables PACKAGE_LIST_DESKTOP
fi
unset LOG_OUTPUT_FILE
@@ -509,8 +507,6 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
PACKAGE_MAIN_LIST="$(echo ${PACKAGE_MAIN_LIST})"
fi
- [[ "${CONFIG_DEFS_ONLY}" == "yes" ]] || write_deboostrap_list_debug_log
-
# Give the option to configure DNS server used in the chroot during the build process
[[ -z $NAMESERVER ]] && NAMESERVER="1.0.0.1" # default is cloudflare alternate
@@ -527,13 +523,6 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
display_alert "Done with main-config.sh" "do_main_configuration" "debug"
}
-function write_deboostrap_list_debug_log() {
- LOG_OUTPUT_FILE="$SRC/output/${LOG_SUBPATH}/debootstrap-list.log"
- echo -e "\nVariables after manual configuration" >> $LOG_OUTPUT_FILE
- show_checklist_variables "DEBOOTSTRAP_COMPONENTS DEBOOTSTRAP_LIST PACKAGE_LIST PACKAGE_MAIN_LIST"
- unset LOG_OUTPUT_FILE
-}
-
function write_config_summary_output_file() {
local build_script_env_file="${DEST}/${LOG_SUBPATH}/output.log"
local debug_dpkg_arch debug_uname debug_virt debug_src_mount debug_src_perms debug_src_temp_perms
From 4f858ace7b8674c8d5555e311bd053819555648a Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 17 Feb 2022 03:24:08 +0100
Subject: [PATCH] [WiP] git cold bundle; no: shallow clones/fetched; yes:
locally packed repo
---
config/sources/families/include/sunxi64_common.inc | 80 ++---
config/sources/families/include/sunxi_common.inc | 81 ++---
lib/functions/compilation/debs.sh | 4 +-
lib/functions/compilation/extra-drivers.sh | 1 +
lib/functions/compilation/kernel.sh | 11 +-
lib/functions/compilation/patching.sh | 2 +
lib/functions/compilation/sources.sh | 3 +-
lib/functions/compilation/uboot.sh | 4 +-
lib/functions/configuration/main-config.sh | 7 +-
lib/functions/general/git.sh | 338 ++++++++-------------
lib/functions/multi/build-all.sh | 2 +-
11 files changed, 194 insertions(+), 339 deletions(-)
diff --git a/config/sources/families/include/sunxi64_common.inc b/config/sources/families/include/sunxi64_common.inc
index 6a570b341..c7a3e0a20 100644
--- a/config/sources/families/include/sunxi64_common.inc
+++ b/config/sources/families/include/sunxi64_common.inc
@@ -1,44 +1,42 @@
enable_extension "sunxi-tools"
-ARCH=arm64
-ATF_TARGET_MAP="PLAT=$ATF_PLAT DEBUG=1 bl31;;build/$ATF_PLAT/debug/bl31.bin"
-BOOTDELAY=1
-
-BOOTPATCHDIR='u-boot-sunxi'
-BOOTENV_FILE='sunxi.txt'
-UBOOT_TARGET_MAP=';;u-boot-sunxi-with-spl.bin'
-BOOTSCRIPT='boot-sun50i-next.cmd:boot.cmd'
-LINUXFAMILY=sunxi64
+export ARCH=arm64
+export ATF_TARGET_MAP="PLAT=$ATF_PLAT DEBUG=1 bl31;;build/$ATF_PLAT/debug/bl31.bin"
+export BOOTDELAY=1
+
+export BOOTPATCHDIR='u-boot-sunxi'
+export BOOTENV_FILE='sunxi.txt'
+export UBOOT_TARGET_MAP=';;u-boot-sunxi-with-spl.bin'
+export BOOTSCRIPT='boot-sun50i-next.cmd:boot.cmd'
+export LINUXFAMILY=sunxi64
+export KERNELSOURCE=$MAINLINE_KERNEL_SOURCE
+export KERNELPATCHDIR='sunxi-'$BRANCH
case $BRANCH in
- legacy) KERNEL_VERSION_LEVEL="5.10" ;;
-
- current) KERNEL_VERSION_LEVEL="5.15" ;;
-
- edge) KERNEL_VERSION_LEVEL="5.16" ;;
-esac
-
-case "$KERNEL_VERSION_LEVEL" in
+ legacy)
+ export KERNELBRANCH="branch:linux-5.10.y"
+ export KERNELBRANCH_MEGOUS="branch:orange-pi-5.10"
+ ;;
- 5.10 | 5.15 | 5.16)
- KERNELSOURCE=$MAINLINE_KERNEL_SOURCE
- KERNELSOURCENAME='name=origin'
- KERNELBRANCH="branch:linux-${KERNEL_VERSION_LEVEL}.y"
+ current)
+ export KERNELBRANCH="branch:linux-5.15.y"
+ export KERNELBRANCH_MEGOUS="branch:orange-pi-5.15"
;;
- *)
- KERNELSOURCE="https://github.com/megous/linux"
- KERNELSOURCENAME='name=megous'
- KERNELBRANCH="branch:orange-pi-$KERNEL_VERSION_LEVEL"
+ edge)
+ export KERNELBRANCH="branch:linux-5.16.y"
+ export KERNELBRANCH_MEGOUS="branch:orange-pi-5.16"
;;
esac
-KERNELPATCHDIR='sunxi-'$BRANCH
+# Hack for easily using megous for tests.
+if [[ "$USE_MEGOUS" == "yes" ]]; then
+ display_alert "Using megous/linux for kernel" "USE_MEGOUS: ${USE_MEGOUS}" "debug"
+ export KERNELSOURCE="https://github.com/megous/linux"
+ export KERNELBRANCH="${KERNELBRANCH_MEGOUS}"
+fi
-# An optional parameter for switching to a git object such as a tag, commit,
-# or a specific branch. The object must exist in the local repository.
-# KERNELSWITCHOBJ=""
-# tag|obj|commit=v5.10.15|megous/$branch|$hash
+unset KERNELBRANCH_MEGOUS
family_tweaks() {
# execute specific tweaks function if present
@@ -71,25 +69,3 @@ setup_write_uboot_platform() {
[[ -n $dev && $dev == mmcblk* ]] && DEVICE="/dev/$dev"
fi
}
-
-# default settings for kernel variables of the original kernel
-# VAR_SHALLOW_ORIGINAL=var_origin_kernel
-# Note: rpardini: this is called via VAR_SHALLOW_ORIGINAL during fetch_from_repo via waiter_local_repo
-var_origin_kernel() {
- url=$MAINLINE_KERNEL_SOURCE
- name='origin'
- branch="linux-${KERNEL_VERSION_LEVEL}.y"
- start_tag="v$KERNEL_VERSION_LEVEL"
-
- # checking the reachability of the initial tag
- if [ "$(git ls-remote --tags $url $start_tag | awk -F'/' '{if (NR == 1) print $NF}' || true)" != "$start_tag" ]; then
- exit 177
- fi
-
- # Exceptions to the rule are when the desired tag is not
- # a bifurcation point at which all previous merge branches converge.
- # This is due to the subsequent extraction of `megous`
- [ "$KERNEL_VERSION_LEVEL" == "5.12" ] && start_tag="v5.12-rc7"
-
- return 0 # don't fail due to short-circuit above
-}
diff --git a/config/sources/families/include/sunxi_common.inc b/config/sources/families/include/sunxi_common.inc
index c84c45186..c450fecbd 100644
--- a/config/sources/families/include/sunxi_common.inc
+++ b/config/sources/families/include/sunxi_common.inc
@@ -1,44 +1,43 @@
enable_extension "sunxi-tools"
-ARCH=armhf
-BOOTDELAY=1
-BOOTPATCHDIR='u-boot-sunxi'
-UBOOT_TARGET_MAP=';;u-boot-sunxi-with-spl.bin'
-BOOTSCRIPT="boot-sunxi.cmd:boot.cmd"
-BOOTENV_FILE='sunxi.txt'
-LINUXFAMILY=sunxi
-UBOOT_FW_ENV='0x88000,0x20000' # /etc/fw_env.config offset and env size
-ASOUND_STATE='asound.state.sunxi-next'
-GOVERNOR=ondemand
+export ARCH=armhf
+export BOOTDELAY=1
+export BOOTPATCHDIR='u-boot-sunxi'
+export UBOOT_TARGET_MAP=';;u-boot-sunxi-with-spl.bin'
+export BOOTSCRIPT="boot-sunxi.cmd:boot.cmd"
+export BOOTENV_FILE='sunxi.txt'
+export LINUXFAMILY=sunxi
+export UBOOT_FW_ENV='0x88000,0x20000' # /etc/fw_env.config offset and env size
+export ASOUND_STATE='asound.state.sunxi-next'
+export GOVERNOR=ondemand
+export KERNELSOURCE=$MAINLINE_KERNEL_SOURCE
+export KERNELPATCHDIR='sunxi-'$BRANCH
case $BRANCH in
- legacy) KERNEL_VERSION_LEVEL="5.10" ;;
- current) KERNEL_VERSION_LEVEL="5.15" ;;
- edge) KERNEL_VERSION_LEVEL="5.16" ;;
-
-esac
-
-case "$KERNEL_VERSION_LEVEL" in
+ legacy)
+ export KERNELBRANCH="branch:linux-5.10.y"
+ export KERNELBRANCH_MEGOUS="branch:orange-pi-5.10"
+ ;;
- 5.10 | 5.15 | 5.16)
- KERNELSOURCE=$MAINLINE_KERNEL_SOURCE
- KERNELSOURCENAME='name=origin'
- KERNELBRANCH="branch:linux-${KERNEL_VERSION_LEVEL}.y"
+ current)
+ export KERNELBRANCH="branch:linux-5.15.y"
+ export KERNELBRANCH_MEGOUS="branch:orange-pi-5.15"
;;
- *)
- KERNELSOURCE="https://github.com/megous/linux"
- KERNELSOURCENAME='name=megous'
- KERNELBRANCH="branch:orange-pi-$KERNEL_VERSION_LEVEL"
+ edge)
+ export KERNELBRANCH="branch:linux-5.16.y"
+ export KERNELBRANCH_MEGOUS="branch:orange-pi-5.16"
;;
esac
-KERNELPATCHDIR='sunxi-'$BRANCH
+# Hack for easily using megous for tests.
+if [[ "$USE_MEGOUS" == "yes" ]]; then
+ display_alert "Using megous/linux for kernel" "USE_MEGOUS: ${USE_MEGOUS}" "debug"
+ export KERNELSOURCE="https://github.com/megous/linux"
+ export KERNELBRANCH="${KERNELBRANCH_MEGOUS}"
+fi
-# An optional parameter for switching to a git object such as a tag, commit,
-# or a specific branch. The object must exist in the local repository.
-# KERNELSWITCHOBJ="tag=v5.10.15"
-# tag|obj|commit=v5.10.15|megous/$branch|$hash
+unset KERNELBRANCH_MEGOUS
family_tweaks() {
# execute specific tweaks function if present
@@ -78,25 +77,3 @@ setup_write_uboot_platform() {
done
fi
}
-
-# default settings for kernel variables of the original kernel
-# VAR_SHALLOW_ORIGINAL=var_origin_kernel
-# Note: rpardini: this is called via VAR_SHALLOW_ORIGINAL during fetch_from_repo via waiter_local_repo
-var_origin_kernel() {
- url=$MAINLINE_KERNEL_SOURCE
- name='origin'
- branch="linux-${KERNEL_VERSION_LEVEL}.y"
- start_tag="v$KERNEL_VERSION_LEVEL"
-
- # checking the reachability of the initial tag
- if [ "$(git ls-remote --tags $url $start_tag | awk -F'/' '{if (NR == 1) print $NF}' || true)" != "$start_tag" ]; then
- exit 177
- fi
-
- # Exceptions to the rule are when the desired tag is not
- # a bifurcation point at which all previous merge branches converge.
- # This is due to the subsequent extraction of `megous`
- [ "$KERNEL_VERSION_LEVEL" == "5.12" ] && start_tag="v5.12-rc7"
-
- return 0 # don't fail due to short-circuit above
-}
diff --git a/lib/functions/compilation/debs.sh b/lib/functions/compilation/debs.sh
index b00d12c60..a48bd3058 100644
--- a/lib/functions/compilation/debs.sh
+++ b/lib/functions/compilation/debs.sh
@@ -180,13 +180,13 @@ compile_xilinx_bootgen() {
# Compile and install only if git commit hash changed
# need to check if /usr/local/bin/bootgen to detect new Docker containers with old cached sources
- if [[ ! -f .commit_id || $(improved_git rev-parse @ 2> /dev/null) != $(< .commit_id) || ! -f /usr/local/bin/bootgen ]]; then
+ if [[ ! -f .commit_id || $(git rev-parse @ 2> /dev/null) != $(< .commit_id) || ! -f /usr/local/bin/bootgen ]]; then
display_alert "Compiling" "xilinx-bootgen" "info"
make -s clean > /dev/null
make -s -j$(nproc) bootgen > /dev/null
mkdir -p /usr/local/bin/
install bootgen /usr/local/bin > /dev/null 2>&1
- improved_git rev-parse @ 2> /dev/null > .commit_id
+ git rev-parse @ 2> /dev/null > .commit_id
fi
popd
diff --git a/lib/functions/compilation/extra-drivers.sh b/lib/functions/compilation/extra-drivers.sh
index d41be6307..f731b4319 100644
--- a/lib/functions/compilation/extra-drivers.sh
+++ b/lib/functions/compilation/extra-drivers.sh
@@ -166,6 +166,7 @@ prepare_extra_kernel_drivers() {
if [ "$?" -ne "0" ]; then
# then use rc branch
aufstag="5.x-rcN"
+ # @TODO: this does not do what you think it does; nonzero explode always
improved_git ls-remote --exit-code --heads https://github.com/sfjro/aufs5-standalone "aufs${aufstag}" > /dev/null
fi
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index e2232659d..d33c18f9f 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -61,7 +61,7 @@ function compile_kernel() {
display_alert "Pre-patch kernel version" "${pre_patch_version}" "debug"
# read kernel git hash
- hash=$(improved_git --git-dir="$kerneldir"/.git rev-parse HEAD)
+ hash=$(git --git-dir="$kerneldir"/.git rev-parse HEAD)
# Apply a series of patches if a series file exists
if test -f "${SRC}"/patch/kernel/"${KERNELPATCHDIR}"/series.conf; then
@@ -208,12 +208,7 @@ function compile_kernel() {
HASHTARGET="${SRC}/cache/hash$([[ ${BETA} == yes ]] && echo "-beta" || true)/linux-image-${BRANCH}-${LINUXFAMILY}"
OLDHASHTARGET=$(head -1 "${HASHTARGET}.githash" 2> /dev/null || true)
- # check if OLDHASHTARGET commit exists otherwise use oldest
- if [[ -z ${KERNEL_VERSION_LEVEL} ]]; then
- git -C ${kerneldir} cat-file -t ${OLDHASHTARGET} > /dev/null 2>&1 && OLDHASHTARGET=$(git -C ${kerneldir} show HEAD~199 --pretty=format:"%H" --no-patch)
- else
- git -C ${kerneldir} cat-file -t ${OLDHASHTARGET} > /dev/null 2>&1 && OLDHASHTARGET=$(git -C ${kerneldir} rev-list --max-parents=0 HEAD)
- fi
+ git -C ${kerneldir} cat-file -t ${OLDHASHTARGET} > /dev/null 2>&1 && OLDHASHTARGET=$(git -C ${kerneldir} rev-list --max-parents=0 HEAD)
[[ -z ${KERNELPATCHDIR} ]] && KERNELPATCHDIR=$LINUXFAMILY-$BRANCH
[[ -z ${LINUXCONFIG} ]] && LINUXCONFIG=linux-$LINUXFAMILY-$BRANCH
@@ -233,7 +228,7 @@ function compile_kernel() {
echo "${hash}" > "${HASHTARGET}.githash"
hash_watch_1=$(LC_COLLATE=C find -L "${SRC}/patch/kernel/${KERNELPATCHDIR}"/ -name '*.patch' -mindepth 1 -maxdepth 1 -printf '%s %P\n' 2> /dev/null | LC_COLLATE=C sort -n)
hash_watch_2=$(cat "${SRC}/config/kernel/${LINUXCONFIG}.config")
- echo "${hash_watch_1}${hash_watch_2}" | improved_git hash-object --stdin >> "${HASHTARGET}.githash"
+ echo "${hash_watch_1}${hash_watch_2}" | git hash-object --stdin >> "${HASHTARGET}.githash"
display_alert "Finished updating kernel hashes" "${LINUXCONFIG} $kernel_packaging_target" "info"
fi
diff --git a/lib/functions/compilation/patching.sh b/lib/functions/compilation/patching.sh
index 99cb31719..7ebcef3ac 100644
--- a/lib/functions/compilation/patching.sh
+++ b/lib/functions/compilation/patching.sh
@@ -120,8 +120,10 @@ apply_patch_series() {
awk '$0 ~ /^+.*patch$/{print $2}' |
xargs -I % sh -c 'rm -f %'
+ set +e # has to tolerate error here to catch them
patch --batch --silent --no-backup-if-mismatch -p1 -N < $bzdir/"$p" >> $err_pt 2>&1
flag=$?
+ set -e # back to normal, errors cause stop.
case $flag in
0)
diff --git a/lib/functions/compilation/sources.sh b/lib/functions/compilation/sources.sh
index 67fbad040..1fcacf8a3 100644
--- a/lib/functions/compilation/sources.sh
+++ b/lib/functions/compilation/sources.sh
@@ -6,7 +6,8 @@ function fetch_sources_kernel_uboot_atf() {
if [[ -n $KERNELSOURCE ]]; then
display_alert "Downloading sources" "kernel" "git"
- fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes"
+ GIT_COLD_BUNDLE_URL="${MAINLINE_KERNEL_COLD_BUNDLE_URL}" \
+ fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes"
fi
if [[ -n $ATFSOURCE ]]; then
diff --git a/lib/functions/compilation/uboot.sh b/lib/functions/compilation/uboot.sh
index d2d6447a2..053312875 100644
--- a/lib/functions/compilation/uboot.sh
+++ b/lib/functions/compilation/uboot.sh
@@ -9,7 +9,7 @@ function compile_uboot_target() {
# needed for multiple targets and for calling compile_uboot directly
display_alert "${uboot_prefix} Checking out to clean sources" "{$BOOTSOURCEDIR} for ${target_make}"
- improved_git checkout -f -q HEAD
+ git checkout -f -q HEAD
if [[ $CLEAN_LEVEL == *make* ]]; then
display_alert "${uboot_prefix}Cleaning" "${BOOTSOURCEDIR}" "info"
@@ -116,7 +116,7 @@ compile_uboot() {
# read uboot version
local version hash
version=$(grab_version "$ubootdir")
- hash=$(improved_git --git-dir="$ubootdir"/.git rev-parse HEAD)
+ hash=$(git --git-dir="$ubootdir"/.git rev-parse HEAD)
display_alert "Compiling u-boot" "$version ${ubootdir}" "info"
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 25dd263a5..e21bb2de9 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -44,8 +44,8 @@ function do_main_configuration() {
cd "${SRC}" || exit
[[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=14
[[ -z "${CHROOT_CACHE_VERSION}" ]] && CHROOT_CACHE_VERSION=7
- BUILD_REPOSITORY_URL=$(improved_git remote get-url $(improved_git remote 2> /dev/null | grep origin) 2> /dev/null)
- BUILD_REPOSITORY_COMMIT=$(improved_git describe --match=d_e_a_d_b_e_e_f --always --dirty 2> /dev/null)
+ BUILD_REPOSITORY_URL=$(git remote get-url "$(git remote 2> /dev/null | grep origin)" 2> /dev/null)
+ BUILD_REPOSITORY_COMMIT=$(git describe --match=d_e_a_d_b_e_e_f --always --dirty 2> /dev/null)
ROOTFS_CACHE_MAX=200 # max number of rootfs cache, older ones will be cleaned up
if [[ $BETA == yes ]]; then
@@ -112,6 +112,9 @@ function do_main_configuration() {
# used by multiple sources - reduce code duplication
[[ $USE_MAINLINE_GOOGLE_MIRROR == yes ]] && MAINLINE_MIRROR=google
+ # URL for the git bundle used to "bootstrap" local git copies.
+ export MAINLINE_KERNEL_COLD_BUNDLE_URL="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/clone.bundle"
+
case $MAINLINE_MIRROR in
google)
MAINLINE_KERNEL_SOURCE='https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable'
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index 37aff6b3c..e6a2fe521 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -2,159 +2,24 @@
# This function retries Git operations to avoid failure in case remote is borked
#
improved_git() {
- local realgit=$(command -v git)
+ local real_git
+ real_git="$(command -v git)"
local retries=3
local delay=10
- local count=1
+ local count=0
while [ $count -lt $retries ]; do
- $realgit "$@" 2>&1
- if [[ $? -eq 0 || -f .git/index.lock ]]; then
- retries=0
- break
- fi
- let count=$count+1
+ run_host_command_logged_raw "$real_git" --no-pager "$@" && return 0 # this gobbles up errors, but returns if OK, so everything after is error
+ count=$((count + 1))
+ display_alert "improved_git try $count failed, retrying in ${delay} seconds" "git $*" "warn"
sleep $delay
done
+ display_alert "improved_git, too many retries" "git $*" "err"
+ return 17 # explode with error if this is reached, "too many retries"
}
-clean_up_repo() {
- local target_dir=$1
-
- # Files that are not tracked by git and were added
- # when the patch was applied must be removed.
- improved_git -C $target_dir clean -qdf
-
- # Return the files that are tracked by git to the initial state.
- improved_git -C $target_dir checkout -qf HEAD
-}
-
-# used : waiter_local_repo arg1='value' arg2:'value'
-# waiter_local_repo \
-# url='https://github.com/megous/linux' \
-# name='megous' \
-# dir='linux-mainline/5.14' \
-# branch='orange-pi-5.14' \
-# obj=<tag|commit> or tag:$tag ...
-waiter_local_repo() {
- for arg in $@; do
-
- case $arg in
- url=* | https://* | git://*)
- eval "local url=${arg/url=/}"
- ;;
- dir=* | /*/*/*)
- eval "local dir=${arg/dir=/}"
- ;;
- *=* | *:*)
- eval "local ${arg/:/=}"
- ;;
- esac
-
- done
-
- # Required variables cannot be empty.
- for var in url name dir branch; do
- [ "${var#*=}" == "" ] && exit_with_error "Error in configuration"
- done
-
- local reachability
-
- # The 'offline' variable must always be set to 'true' or 'false'
- if [ "$OFFLINE_WORK" == "yes" ]; then
- local offline=true
- else
- local offline=false
- fi
-
- local work_dir="$(realpath ${SRC}/cache/sources)/$dir"
- mkdir -p $work_dir
- cd $work_dir || exit_with_error
-
- display_alert "Checking git sources" "$dir $url$name/$branch" "info"
-
- if [ "$(git rev-parse --git-dir 2> /dev/null)" != ".git" ]; then
- git init -q .
-
- # Run in the sub shell to avoid mixing environment variables.
- if [ -n "$VAR_SHALLOW_ORIGINAL" ]; then
- (
- $VAR_SHALLOW_ORIGINAL
-
- display_alert "Add original git sources" "$dir $url$name/$branch" "info"
- if [ "$(git ls-remote -h $url $branch |
- awk -F'/' '{if (NR == 1) print $NF}')" != "$branch" ]; then
- display_alert "Bad $branch for $url in $VAR_SHALLOW_ORIGINAL"
- exit 177
- fi
-
- git remote add -t $branch $name $url
-
- # Handle an exception if the initial tag is the top of the branch
- # As v5.16 == HEAD
- if [ "${start_tag}.1" == "$(git ls-remote -t $url ${start_tag}.1 |
- awk -F'/' '{ print $NF }')" ]; then
- git fetch --shallow-exclude=$start_tag $name
- else
- git fetch --depth 1 $name
- fi
- git fetch --deepen=1 $name
- # For a shallow clone, this works quickly and saves space.
- git gc
- )
-
- [ "$?" == "177" ] && exit
- fi
- fi
-
- files_for_clean="$(git status -s | wc -l)"
- if [ "$files_for_clean" != "0" ]; then
- display_alert " Cleaning .... " "$files_for_clean files"
- clean_up_repo $work_dir
- fi
-
- if [ "$name" != "$(git remote show | grep $name || true)" ]; then
- git remote add -t $branch $name $url
- fi
-
- if ! $offline; then
- for t_name in $(git remote show); do
- git fetch $t_name
- done
- fi
-
- # When switching, we use the concept of only "detached branch". Therefore,
- # we extract the hash from the tag, the branch name, or from the hash itself.
- # This serves as a check of the reachability of the extraction.
- # We do not use variables that characterize the current state of the git,
- # such as `HEAD` and `FETCH_HEAD`.
- reachability=false
- for var in obj tag commit branch; do
- eval pval=\$$var
-
- if [ -n "$pval" ] && [ "$pval" != *HEAD ]; then
- case $var in
- obj | tag | commit) obj=$pval ;;
- branch) obj=${name}/$branch ;;
- esac
-
- if t_hash=$(git rev-parse $obj 2> /dev/null); then
- reachability=true
- break
- else
- display_alert "Variable $var=$obj unreachable for extraction"
- fi
- fi
- done
-
- if $reachability && [ "$t_hash" != "$(git rev-parse @ 2> /dev/null)" ]; then
- # Switch "detached branch" as hash
- display_alert "Switch $obj = $t_hash"
- git checkout -qf $t_hash
- else
- # the working directory corresponds to the target commit,
- # nothing needs to be done
- display_alert "Up to date"
- fi
+# avoid repeating myself too much
+function improved_git_fetch() {
+ improved_git fetch --progress --verbose --no-auto-maintenance "$@"
}
# fetch_from_repo <url> <directory> <ref> <ref_subdir>
@@ -171,23 +36,16 @@ waiter_local_repo() {
# <ref_subdir>: "yes" to create subdirectory for tag or branch name
#
fetch_from_repo() {
+ display_alert "fetch_from_repo" "$*" "debug"
local url=$1
local dir=$2
local ref=$3
local ref_subdir=$4
+ local git_work_dir
# Set GitHub mirror before anything else touches $url
url=${url//'https://github.com/'/$GITHUB_SOURCE}
- if [ "$dir" == "linux-mainline" ] && [[ "$LINUXFAMILY" == sunxi* ]]; then
- unset LINUXSOURCEDIR
- LINUXSOURCEDIR="linux-mainline/$KERNEL_VERSION_LEVEL"
- VAR_SHALLOW_ORIGINAL=var_origin_kernel
- waiter_local_repo "url=$url $KERNELSOURCENAME $KERNELBRANCH dir=$LINUXSOURCEDIR $KERNELSWITCHOBJ"
- unset VAR_SHALLOW_ORIGINAL
- return
- fi
-
# The 'offline' variable must always be set to 'true' or 'false'
if [ "$OFFLINE_WORK" == "yes" ]; then
local offline=true
@@ -203,40 +61,37 @@ fetch_from_repo() {
local ref_name=${ref##*:}
fi
- display_alert "Checking git sources" "$dir $ref_name" "info"
-
- # get default remote branch name without cloning
- # local ref_name=$(git ls-remote --symref $url HEAD | grep -o 'refs/heads/\S*' | sed 's%refs/heads/%%')
- # for git:// protocol comparing hashes of "git ls-remote -h $url" and "git ls-remote --symref $url HEAD" is needed
+ display_alert "Getting sources from Git" "$dir $ref_name" "info"
+ local workdir=$dir
if [[ $ref_subdir == yes ]]; then
- local workdir=$dir/$ref_name
- else
- local workdir=$dir
+ workdir=$dir/$ref_name
fi
- mkdir -p "${SRC}/cache/sources/${workdir}" 2> /dev/null ||
- exit_with_error "No path or no write permission" "${SRC}/cache/sources/${workdir}"
+ git_work_dir="${SRC}/cache/sources/${workdir}"
+
+ mkdir -p "${git_work_dir}" || exit_with_error "No path or no write permission" "${git_work_dir}"
+
+ cd "${git_work_dir}" || exit
- cd "${SRC}/cache/sources/${workdir}" || exit
+ display_alert "Git working dir" "${git_work_dir}" "debug"
# check if existing remote URL for the repo or branch does not match current one
# may not be supported by older git versions
# Check the folder as a git repository.
# Then the target URL matches the local URL.
- if [[ "$(improved_git rev-parse --git-dir 2> /dev/null)" == ".git" &&
- "$url" != *"$(improved_git remote get-url origin | sed 's/^.*@//' | sed 's/^.*\/\///' 2> /dev/null)" ]]; then
- display_alert "Remote URL does not match, removing existing local copy" "$dir $ref_name"
- rm -rf .git ./*
+ if [[ "$(git rev-parse --git-dir)" == ".git" && "$url" != *"$(git remote get-url origin | sed 's/^.*@//' | sed 's/^.*\/\///')" ]]; then
+ display_alert "Remote URL does not match, removing existing local copy" "$dir $ref_name" "warn"
+ rm -rf "${git_work_dir}"
+ mkdir -p "${git_work_dir}"
fi
- if [[ "$(improved_git rev-parse --git-dir 2> /dev/null)" != ".git" ]]; then
+ if [[ "$(git rev-parse --git-dir)" != ".git" ]]; then
display_alert "Creating local copy" "$dir $ref_name"
- improved_git init -q .
+ improved_git init -q --initial-branch="armbian_unused_initial_branch" .
improved_git remote add origin "${url}"
- # Here you need to upload from a new address
- offline=false
+ offline=false # Force only, we'll need to fetch.
fi
local changed=false
@@ -244,26 +99,26 @@ fetch_from_repo() {
# when we work offline we simply return the sources to their original state
if ! $offline; then
local local_hash
- local_hash=$(git rev-parse @ 2> /dev/null || true)
+ local_hash=$(git rev-parse @ 2> /dev/null || true) # Don't fail nor output anything if failure
case $ref_type in
branch)
# TODO: grep refs/heads/$name
local remote_hash
- remote_hash=$(improved_git ls-remote -h "${url}" "$ref_name" | head -1 | cut -f1)
- [[ -z $local_hash || "${local_hash}" != "${remote_hash}" ]] && changed=true
+ remote_hash=$(git ls-remote -h "${url}" "$ref_name" | head -1 | cut -f1)
+ [[ -z $local_hash || "${local_hash}" != "a${remote_hash}" ]] && changed=true
;;
tag)
local remote_hash
- remote_hash=$(improved_git ls-remote -t "${url}" "$ref_name" | cut -f1)
+ remote_hash=$(git ls-remote -t "${url}" "$ref_name" | cut -f1)
if [[ -z $local_hash || "${local_hash}" != "${remote_hash}" ]]; then
- remote_hash=$(improved_git ls-remote -t "${url}" "$ref_name^{}" | cut -f1)
+ remote_hash=$(git ls-remote -t "${url}" "$ref_name^{}" | cut -f1)
[[ -z $remote_hash || "${local_hash}" != "${remote_hash}" ]] && changed=true
fi
;;
head)
local remote_hash
- remote_hash=$(improved_git ls-remote "${url}" HEAD | cut -f1)
+ remote_hash=$(git ls-remote "${url}" HEAD | cut -f1)
[[ -z $local_hash || "${local_hash}" != "${remote_hash}" ]] && changed=true
;;
commit)
@@ -271,60 +126,105 @@ fetch_from_repo() {
;;
esac
+ display_alert "Git local_hash vs remote_hash" "${local_hash} vs ${remote_hash}" "debug"
+
fi # offline
if [[ $changed == true ]]; then
- # remote was updated, fetch and check out updates
- display_alert "Fetching updates" "$dir $ref_name"
- case $ref_type in
- branch) improved_git fetch --depth 200 origin "${ref_name}" ;;
- tag) improved_git fetch --depth 200 origin tags/"${ref_name}" ;;
- head) improved_git fetch --depth 200 origin HEAD ;;
- esac
- # commit type needs support for older git servers that doesn't support fetching id directly
- if [[ $ref_type == commit ]]; then
- improved_git fetch --depth 200 origin "${ref_name}"
+ # If there's a cold bundle URL specified:
+ # - if there's already a cold_bundle_xxx remote, move on.
+ # - grab the bundle via http/https first, and fetch from that, into "cold_bundle_xxx" remote.
+ # - do nothing else with this, it'll be used internally by git to avoid a huge fetch later.
+ # - but, after this, the wanted branch will be fetched. signal has_fetched_from_bundle=1 for later.
+ local has_fetched_from_bundle=0
+ if [[ "${GIT_COLD_BUNDLE_URL}" != "" ]]; then
+ local git_cold_bundle_id git_cold_bundle_cache_dir git_cold_bundle_cache_file git_cold_bundle_remote_id git_cold_bundle_fetched_marker_file
+ # calculate the id, dir and name of local file and remote
+ git_cold_bundle_cache_dir="${SRC}/cache/gitbundles"
+ mkdir -p "${git_cold_bundle_cache_dir}"
+ git_cold_bundle_id="$(echo -n "${GIT_COLD_BUNDLE_URL}" | md5sum | awk '{print $1}')" # md5 of the URL.
+ git_cold_bundle_cache_file="${git_cold_bundle_cache_dir}/${git_cold_bundle_id}.gitbundle"
+ git_cold_bundle_remote_id="cold_bundle_${git_cold_bundle_id}"
+ git_cold_bundle_fetched_marker_file=".git/fetched-from-bundle-${git_cold_bundle_id}"
+
+ display_alert "There's a " "${GIT_COLD_BUNDLE_URL} -- ${git_cold_bundle_id} -- file: ${git_cold_bundle_cache_file}" "debug"
+
+ # Don't do if already done before for this bundle.
+ if [[ ! -f "${git_cold_bundle_fetched_marker_file}" ]]; then
+
+ # Download the bundle file if it does not exist.
+ if [[ ! -f "${git_cold_bundle_cache_file}" ]]; then
+ display_alert "Downloading cold bundle from remote server" "${GIT_COLD_BUNDLE_URL}" "debug"
+ run_host_command_logged wget --continue --output-document="${git_cold_bundle_cache_file}" "${GIT_COLD_BUNDLE_URL}"
+ else
+ display_alert "Cold bundle file exists, using it" "${git_cold_bundle_cache_file}" "debug"
+ fi
+
+ # Make sure bundle is valid.
+ improved_git bundle verify "${git_cold_bundle_cache_file}"
+
+ # Get a list of remotes in the repo; add remote to bundle if it does not exist, and fetch from it.
+ # This should be done only once per workdir, so I use a marker file to denote completion.
+ if git remote get-url "${git_cold_bundle_remote_id}" 2> /dev/null; then
+ display_alert "Git already has bundle remote" "incomplete fetch? ${git_cold_bundle_id}" "debug"
+ else
+ improved_git remote add "${git_cold_bundle_remote_id}" "${git_cold_bundle_cache_file}" # Add the remote pointing to the cold bundle file
+ fi
+
+ display_alert "Fetching from git bundle, wait" "${git_cold_bundle_id}" "info"
+ improved_git_fetch --tags "${git_cold_bundle_remote_id}" # Fetch it! and all its tags, too.
+ has_fetched_from_bundle=1 # marker for pruning logic below
+ echo "${remote_hash}" > "${git_cold_bundle_fetched_marker_file}" # marker for future invocation
+ display_alert "Bundle fetch completed, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after bundle pull
- # cover old type
- if [[ $? -ne 0 ]]; then
- display_alert "Commit checkout not supported on this repository. Doing full clone." "" "wrn"
- improved_git pull
- improved_git checkout -fq "${ref_name}"
- display_alert "Checkout out to" "$(improved_git --no-pager log -2 --pretty=format:"$ad%s [%an]" | head -1)" "info"
- else
- display_alert "Checking out" "$dir $ref_name"
- improved_git checkout -f -q FETCH_HEAD
- improved_git clean -qdf
fi
- else
- display_alert "Checking out" "$dir $ref_name"
- improved_git checkout -f -q FETCH_HEAD
- improved_git clean -qdf
fi
- elif [[ -n $(improved_git status -uno --porcelain --ignore-submodules=all) ]]; then
- # working directory is not clean
- display_alert " Cleaning .... " "$(improved_git status -s | wc -l) files"
- # Return the files that are tracked by git to the initial state.
- improved_git checkout -f -q HEAD
+ # @TODO: If there's a warmup remote specified: (for u-boot and others)
+ # - if there's already a warmup remote, move on.
+ # - if there's a cached warmup bundle file, add it as remote and fetch from it, and move on.
+ # - add the warmup as remote, fetch from it; export it as a cached bundle for next time.
- # Files that are not tracked by git and were added
- # when the patch was applied must be removed.
- improved_git clean -qdf
- else
- # working directory is clean, nothing to do
- display_alert "Up to date" "$dir $ref_name"
+ # remote was updated, fetch and check out updates, but not tags; tags pull their respective commits too, making it a huge fetch.
+ display_alert "Fetching updates from origin" "$dir $ref_name "
+ case $ref_type in
+ branch | commit) improved_git_fetch origin "${ref_name}" ;;
+ tag) improved_git_fetch origin tags/"${ref_name}" ;;
+ head) improved_git_fetch origin HEAD ;;
+ esac
+ display_alert "Origin fetch completed, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size again
+
+ display_alert "Checking out" "$dir $ref_name"
+ improved_git checkout -f -q FETCH_HEAD
+ improved_git clean -q -d -f
+
+ if [[ $has_fetched_from_bundle -gt 0 ]]; then
+ display_alert "Pre-pruning, working copy size" "$(du -h -s | awk '{print $1}')" "debug" # Show size after bundle pull
+ echo -n "${remote_hash}" > .git/shallow # commit to keep for shallowing, can be something else. for now is full prune.
+ improved_git remote remove "${git_cold_bundle_remote_id}"
+ improved_git reflog expire --expire=0 --all
+ improved_git gc --prune=all
+ fi
+
+ elif [[ -n $(git status -uno --porcelain --ignore-submodules=all) ]]; then # if not changed, but dirty...
+ display_alert "Cleaning git dir" "$(git status -s | wc -l) files" # working directory is not clean, show it
+ improved_git checkout -f -q HEAD # Return the files that are tracked by git to the initial state.
+ improved_git clean -q -d -f # Files that are not tracked by git and were added when the patch was applied must be removed.
+ else # not changed, not dirty.
+ display_alert "Up to date" "$dir $ref_name at revision ${local_hash}" # working directory is clean, nothing to do
fi
+ display_alert "Final working copy size" "$(du -h -s | awk '{print $1}')" "debug"
+
if [[ -f .gitmodules ]]; then
display_alert "Updating submodules" "" "ext"
# FML: http://stackoverflow.com/a/17692710
- for i in $(improved_git config -f .gitmodules --get-regexp path | awk '{ print $2 }'); do
- cd "${SRC}/cache/sources/${workdir}" || exit
+ for i in $(git config -f .gitmodules --get-regexp path | awk '{ print $2 }'); do
+ cd "${git_work_dir}" || exit
local surl sref
- surl=$(improved_git config -f .gitmodules --get "submodule.$i.url")
- sref=$(improved_git config -f .gitmodules --get "submodule.$i.branch")
+ surl=$(git config -f .gitmodules --get "submodule.$i.url")
+ sref=$(git config -f .gitmodules --get "submodule.$i.branch")
if [[ -n $sref ]]; then
sref="branch:$sref"
else
diff --git a/lib/functions/multi/build-all.sh b/lib/functions/multi/build-all.sh
index 5f8496157..762a588d7 100644
--- a/lib/functions/multi/build-all.sh
+++ b/lib/functions/multi/build-all.sh
@@ -101,7 +101,7 @@ unset_all() {
CRYPTROOT_SSH_UNLOCK_PORT CRYPTROOT_SSH_UNLOCK_KEY_NAME ROOT_MAPPER NETWORK HDMI USB WIRELESS ARMBIANMONITOR FORCE_BOOTSCRIPT_UPDATE \
UBOOT_TOOLCHAIN2 toolchain2 BUILD_REPOSITORY_URL BUILD_REPOSITORY_COMMIT BUILD_TARGET HOST BUILD_IMAGE DEB_STORAGE REPO_STORAGE REPO_CONFIG \
REPOSITORY_UPDATE PACKAGE_LIST_RELEASE LOCAL_MIRROR COMPILE_ATF PACKAGE_LIST_BOARD PACKAGE_LIST_FAMILY PACKAGE_LIST_DESKTOP_BOARD \
- PACKAGE_LIST_DESKTOP_FAMILY ATF_COMPILE ATFPATCHDIR OFFSET BOOTSOURCEDIR KERNEL_VERSION_LEVEL KERNELSOURCENAME \
+ PACKAGE_LIST_DESKTOP_FAMILY ATF_COMPILE ATFPATCHDIR OFFSET BOOTSOURCEDIR \
BOOT_SOC DDR_BLOB MINILOADER_BLOB BL31_BLOB BOOT_SCENARIO BOOT_SUPPORT_SPI OFFLINE_WORK VAR_SHALLOW_ORIGINAL KERNELSWITCHOBJ \
IMAGE_PARTITION_TABLE BOOT_LOGO UBOOT_REPO_VERSION FORCED_MONTH_OFFSET PACKAGE_LIST_BOARD_REMOVE PACKAGE_LIST_FAMILY_REMOVE PACKAGE_LIST_DESKTOP \
PACKAGE_LIST_DESKTOP_BOARD_REMOVE PACKAGE_LIST_DESKTOP_FAMILY_REMOVE BOOTCONFIG_EDGE DESKTOP_ENVIRONMENT DESKTOP_ENVIRONMENT_CONFIG_NAME \
From 134877c13df20aa7403185b41d75ee3db95c4485 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 16 Feb 2022 23:06:37 +0100
Subject: [PATCH] armbian-next: reorder functions in file, they have a ~logical
call-tree order
---
lib/functions/logging/runners.sh | 50 ++++++++++++++++++++--------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index 8bd8845f1..a85914f55 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -86,6 +86,31 @@ function host_apt_get() {
run_host_command_logged DEBIAN_FRONTEND=noninteractive apt-get "${apt_params[@]}" "$@"
}
+# For host-side invocations of binaries we _know_ are x86-only.
+# Determine if we're building on non-amd64, and if so, which qemu binary to use.
+function run_host_x86_binary_logged() {
+ local -a qemu_invocation target_bin_arch
+ target_bin_arch="unknown - file util missing"
+ if [[ -f /usr/bin/file ]]; then
+ target_bin_arch="$(file -b "$1" | cut -d "," -f 1,2 | xargs echo -n)" # obtain the ELF name from the binary using 'file'
+ fi
+ qemu_invocation=("$@") # Default to calling directly, without qemu.
+ if [[ "$(uname -m)" != "x86_64" ]]; then # If we're NOT on x86...
+ if [[ -f /usr/bin/qemu-x86_64-static ]]; then
+ display_alert "Using qemu-x86_64-static for running on $(uname -m)" "$1 (${target_bin_arch})" "debug"
+ qemu_invocation=("/usr/bin/qemu-x86_64-static" "-L" "/usr/x86_64-linux-gnu" "$@")
+ elif [[ -f /usr/bin/qemu-x86_64 ]]; then
+ display_alert "Using qemu-x86_64 (non-static) for running on $(uname -m)" "$1 (${target_bin_arch})" "debug"
+ qemu_invocation=("/usr/bin/qemu-x86_64" "-L" "/usr/x86_64-linux-gnu" "$@")
+ else
+ exit_with_error "Can't find appropriate qemu binary for running '$1' on $(uname -m), missing packages?"
+ fi
+ else
+ display_alert "Not using qemu for running x86 binary on $(uname -m)" "$1 (${target_bin_arch})" "debug"
+ fi
+ run_host_command_logged "${qemu_invocation[@]}" # Exit with this result code
+}
+
# run_host_command_logged is the very basic, should be used for everything, but, please use helpers above, this is very low-level.
function run_host_command_logged() {
run_host_command_logged_raw /bin/bash -e -c "$*"
@@ -130,28 +155,3 @@ function run_host_command_logged_raw() {
run_on_sdcard() {
chroot_sdcard "${@}"
}
-
-# For host-side invocations of binaries we _know_ are x86-only.
-# Determine if we're building on non-amd64, and if so, which qemu binary to use.
-function run_host_x86_binary_logged() {
- local -a qemu_invocation target_bin_arch
- target_bin_arch="unknown - file util missing"
- if [[ -f /usr/bin/file ]]; then
- target_bin_arch="$(file -b "$1" | cut -d "," -f 1,2 | xargs echo -n)" # obtain the ELF name from the binary using 'file'
- fi
- qemu_invocation=("$@") # Default to calling directly, without qemu.
- if [[ "$(uname -m)" != "x86_64" ]]; then # If we're NOT on x86...
- if [[ -f /usr/bin/qemu-x86_64-static ]]; then
- display_alert "Using qemu-x86_64-static for running on $(uname -m)" "$1 (${target_bin_arch})" "debug"
- qemu_invocation=("/usr/bin/qemu-x86_64-static" "-L" "/usr/x86_64-linux-gnu" "$@")
- elif [[ -f /usr/bin/qemu-x86_64 ]]; then
- display_alert "Using qemu-x86_64 (non-static) for running on $(uname -m)" "$1 (${target_bin_arch})" "debug"
- qemu_invocation=("/usr/bin/qemu-x86_64" "-L" "/usr/x86_64-linux-gnu" "$@")
- else
- exit_with_error "Can't find appropriate qemu binary for running '$1' on $(uname -m), missing packages?"
- fi
- else
- display_alert "Not using qemu for running x86 binary on $(uname -m)" "$1 (${target_bin_arch})" "debug"
- fi
- run_host_command_logged "${qemu_invocation[@]}" # Exit with this result code
-}
From f148d9aa6b42c96ee1fe9c58053886d693a5c58e Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 16 Feb 2022 23:05:28 +0100
Subject: [PATCH] armbian-next: move `fingerprint_image()` out of `git.sh` into
its own file
---
lib/functions/general/fingerprint.sh | 47 +++++++++++++++++++++++++++++++++++
lib/functions/general/git.sh | 48 ------------------------------------
lib/library-functions.sh | 9 +++++++
lib/tools/gen-library.sh | 1 +
4 files changed, 57 insertions(+), 48 deletions(-)
diff --git a/lib/functions/general/fingerprint.sh b/lib/functions/general/fingerprint.sh
new file mode 100644
index 000000000..566f76faf
--- /dev/null
+++ b/lib/functions/general/fingerprint.sh
@@ -0,0 +1,47 @@
+#--------------------------------------------------------------------------------------------------------------------------------
+# fingerprint_image <out_txt_file> [image_filename]
+# Saving build summary to the image
+#--------------------------------------------------------------------------------------------------------------------------------
+fingerprint_image() {
+ cat <<- EOF > "${1}"
+ --------------------------------------------------------------------------------
+ Title: ${VENDOR} $REVISION ${BOARD^} $BRANCH
+ Kernel: Linux $VER
+ Build date: $(date +'%d.%m.%Y')
+ Maintainer: $MAINTAINER <$MAINTAINERMAIL>
+ Authors: https://www.armbian.com/authors
+ Sources: https://github.com/armbian/
+ Support: https://forum.armbian.com/
+ Changelog: https://www.armbian.com/logbook/
+ Documantation: https://docs.armbian.com/
+ EOF
+
+ if [ -n "$2" ]; then
+ cat <<- EOF >> "${1}"
+ --------------------------------------------------------------------------------
+ Partitioning configuration: $IMAGE_PARTITION_TABLE offset: $OFFSET
+ Boot partition type: ${BOOTFS_TYPE:-(none)} ${BOOTSIZE:+"(${BOOTSIZE} MB)"}
+ Root partition type: $ROOTFS_TYPE ${FIXED_IMAGE_SIZE:+"(${FIXED_IMAGE_SIZE} MB)"}
+
+ CPU configuration: $CPUMIN - $CPUMAX with $GOVERNOR
+ --------------------------------------------------------------------------------
+ Verify GPG signature:
+ gpg --verify $2.img.asc
+
+ Verify image file integrity:
+ sha256sum --check $2.img.sha
+
+ Prepare SD card (four methodes):
+ zcat $2.img.gz | pv | dd of=/dev/mmcblkX bs=1M
+ dd if=$2.img of=/dev/mmcblkX bs=1M
+ balena-etcher $2.img.gz -d /dev/mmcblkX
+ balena-etcher $2.img -d /dev/mmcblkX
+ EOF
+ fi
+
+ cat <<- EOF >> "${1}"
+ --------------------------------------------------------------------------------
+ $(cat "${SRC}"/LICENSE)
+ --------------------------------------------------------------------------------
+ EOF
+}
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index a02faa1f2..37aff6b3c 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -333,52 +333,4 @@ fetch_from_repo() {
fetch_from_repo "$surl" "$workdir/$i" "$sref"
done
fi
-} #############################################################################
-
-#--------------------------------------------------------------------------------------------------------------------------------
-# fingerprint_image <out_txt_file> [image_filename]
-# Saving build summary to the image
-#--------------------------------------------------------------------------------------------------------------------------------
-fingerprint_image() {
- cat <<- EOF > "${1}"
- --------------------------------------------------------------------------------
- Title: ${VENDOR} $REVISION ${BOARD^} $BRANCH
- Kernel: Linux $VER
- Build date: $(date +'%d.%m.%Y')
- Maintainer: $MAINTAINER <$MAINTAINERMAIL>
- Authors: https://www.armbian.com/authors
- Sources: https://github.com/armbian/
- Support: https://forum.armbian.com/
- Changelog: https://www.armbian.com/logbook/
- Documantation: https://docs.armbian.com/
- EOF
-
- if [ -n "$2" ]; then
- cat <<- EOF >> "${1}"
- --------------------------------------------------------------------------------
- Partitioning configuration: $IMAGE_PARTITION_TABLE offset: $OFFSET
- Boot partition type: ${BOOTFS_TYPE:-(none)} ${BOOTSIZE:+"(${BOOTSIZE} MB)"}
- Root partition type: $ROOTFS_TYPE ${FIXED_IMAGE_SIZE:+"(${FIXED_IMAGE_SIZE} MB)"}
-
- CPU configuration: $CPUMIN - $CPUMAX with $GOVERNOR
- --------------------------------------------------------------------------------
- Verify GPG signature:
- gpg --verify $2.img.asc
-
- Verify image file integrity:
- sha256sum --check $2.img.sha
-
- Prepare SD card (four methodes):
- zcat $2.img.gz | pv | dd of=/dev/mmcblkX bs=1M
- dd if=$2.img of=/dev/mmcblkX bs=1M
- balena-etcher $2.img.gz -d /dev/mmcblkX
- balena-etcher $2.img -d /dev/mmcblkX
- EOF
- fi
-
- cat <<- EOF >> "${1}"
- --------------------------------------------------------------------------------
- $(cat "${SRC}"/LICENSE)
- --------------------------------------------------------------------------------
- EOF
}
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index 00f05c37a..39792dbe5 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -208,6 +208,15 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/general/downloads.sh
source "${SRC}"/lib/functions/general/downloads.sh
+# no errors tolerated. invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/general/fingerprint.sh
+# shellcheck source=lib/functions/general/fingerprint.sh
+source "${SRC}"/lib/functions/general/fingerprint.sh
+
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
diff --git a/lib/tools/gen-library.sh b/lib/tools/gen-library.sh
index 3b851fe67..11de9946f 100755
--- a/lib/tools/gen-library.sh
+++ b/lib/tools/gen-library.sh
@@ -16,6 +16,7 @@ cat <<- AUTOGEN_INCLUDES_HEADER > "${TARGET_SH}"
# This file is/was autogenerated by ${0}; don't modify manually
AUTOGEN_INCLUDES_HEADER
+cd "${SRC}"
find lib/functions -type f -name \*.sh | sort -h | while read -r path; do
ref="$(echo -n "${path}")"
From 9f774b4dac5b1c1808c2a57b2cb7b7ed2dd2e308 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 16 Feb 2022 12:02:32 +0100
Subject: [PATCH] logging: fix for double stderr redirect during
`fakeroot_dpkg_deb_build`
---
lib/functions/logging/runners.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index 2ea496cbe..8bd8845f1 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -51,7 +51,7 @@ function chroot_custom() {
# for deb building.
function fakeroot_dpkg_deb_build() {
display_alert "Building .deb package" "$(basename "${3:-${2:-${1}}}" || true)" "debug"
- run_host_command_logged_raw fakeroot dpkg-deb -b "-Z${DEB_COMPRESS}" "$@" 2>&1
+ run_host_command_logged_raw fakeroot dpkg-deb -b "-Z${DEB_COMPRESS}" "$@"
}
# for long-running, host-side expanded bash invocations.
From 8164916306b8b4bc06cd8dca5f7d937d0bfee368 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 16 Feb 2022 11:47:38 +0100
Subject: [PATCH] logging: subdued "command" logging for debugging low level
cmd invocations ("frog")
---
lib/functions/compilation/kernel.sh | 2 --
lib/functions/logging/logging.sh | 19 ++++++++++++-------
lib/functions/logging/runners.sh | 2 +-
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 3bf77ae1b..e2232659d 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -24,8 +24,6 @@ function run_kernel_make() {
# last statement, so it passes the result to calling function.
full_command=("${KERNEL_MAKE_RUNNER:-run_host_command_logged}" "${common_make_envs[@]}" make "$@" "${common_make_params_quoted[@]@Q}")
- display_alert "Kernel make" "${full_command[*]}" "debug"
- # echo "${full_command[@]}" >&2 # last-resort bash-quoting debugging
"${full_command[@]}" # and exit with it's code, since it's the last statement
}
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index bd19b8e10..368d0a8d6 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -6,6 +6,10 @@ function logging_init() {
export normal_color="\x1B[0m" gray_color="\e[1;30m" # "bright black", which is grey
declare -i logging_section_counter=0 # -i: integer
export logging_section_counter
+ export tool_color="${gray_color}" # default to gray... (should be ok on terminals)
+ if [[ "${CI}" == "true" ]]; then # ... but that is too dark for Github Actions
+ export tool_color="${normal_color}"
+ fi
}
function logging_error_show_log() {
@@ -54,10 +58,6 @@ function do_with_logging() {
local exit_code=176 # fail by default...
if [[ "${SHOW_LOG}" == "yes" ]]; then
local prefix_sed_contents
- local tool_color="${gray_color}" # default to gray... (should be ok on terminals)
- if [[ "${CI}" == "true" ]]; then # ... but that is too dark for Github Actions
- tool_color="${normal_color}"
- fi
prefix_sed_contents="$(logging_echo_prefix_for_pv "tool") $(echo -n -e "${tool_color}")"
local prefix_sed_cmd="s/^/${prefix_sed_contents}/;"
@@ -123,17 +123,22 @@ function display_alert() {
;;
info)
- level_indicator="🌱" # "🌴" 🥑
+ level_indicator="🌱"
inline_logs_color="\e[0;32m"
;;
debug | deprecation)
- level_indicator="✨" # "🌴" 🥑
+ level_indicator="✨"
inline_logs_color="\e[1;33m"
;;
+ command)
+ level_indicator="🐸"
+ inline_logs_color="${tool_color}" # either gray or normal, a bit subdued.
+ ;;
+
*)
- level_indicator="🌿" # "✨" 🌿 🪵
+ level_indicator="🌿"
inline_logs_color="\e[1;37m"
;;
esac
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index af60b1950..2ea496cbe 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -103,7 +103,7 @@ function run_host_command_logged_raw() {
echo " " >> "${CURRENT_LOGFILE}" # blank line for reader's benefit
echo "-->" "$*" " <- at $(date --utc)" >> "${CURRENT_LOGFILE}"
else
- display_alert "Running at host: " "$*" "debug"
+ display_alert "Command debug" "$*" "command" # A special 'command' level.
fi
# uncomment when desperate to understand what's going on
From b173dbe20aff3996a3ad8b32860d001336eaa34c Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 16 Feb 2022 02:23:16 +0100
Subject: [PATCH] armbian-next: when showing log, emit all host-side
invocations as `debug` too.
---
lib/functions/logging/runners.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index cdce6ead3..af60b1950 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -102,6 +102,8 @@ function run_host_command_logged_raw() {
if [[ -f "${CURRENT_LOGFILE}" ]]; then
echo " " >> "${CURRENT_LOGFILE}" # blank line for reader's benefit
echo "-->" "$*" " <- at $(date --utc)" >> "${CURRENT_LOGFILE}"
+ else
+ display_alert "Running at host: " "$*" "debug"
fi
# uncomment when desperate to understand what's going on
From 550e748f1a27d875cf9badfa85d6f1c251fa52aa Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 13 Feb 2022 16:49:58 +0100
Subject: [PATCH] [WiP] trap handler abstraction, somewhat works!
---
compile.sh | 11 ++-
lib/extensions.sh | 33 +++++--
lib/functions/cli/cli-entrypoint.sh | 48 ++++++----
lib/functions/image/rootfs-to-image.sh | 6 +-
lib/functions/logging/errors.sh | 44 ---------
lib/functions/logging/logging.sh | 17 +---
lib/functions/logging/stacktraces.sh | 2 +-
lib/functions/logging/traps.sh | 162 ++++++++++++++++++++++-----------
lib/functions/main/default-build.sh | 22 ++---
lib/functions/main/rootfs-image.sh | 30 +++++-
lib/functions/rootfs/create-cache.sh | 4 +-
11 files changed, 220 insertions(+), 159 deletions(-)
diff --git a/compile.sh b/compile.sh
index 64fcfb4f1..fcd9046a0 100755
--- a/compile.sh
+++ b/compile.sh
@@ -44,8 +44,13 @@ fi
# shellcheck source=lib/single.sh
source "${SRC}"/lib/single.sh
-# hook up the error handler early, we wanna see stack for all errors.
-trap 'main_error_monitor "$?"' ERR EXIT
+# initialize logging variables.
+logging_init
-# And execute the main entrypoint.
+# initialize the traps
+traps_init
+
+# Execute the main CLI entrypoint.
cli_entrypoint "$@"
+
+echo "-- very last thing" 1>&2
diff --git a/lib/extensions.sh b/lib/extensions.sh
index 737656a38..9cbc4b78b 100644
--- a/lib/extensions.sh
+++ b/lib/extensions.sh
@@ -69,6 +69,9 @@ initialize_extension_manager() {
export EXTENSION_MANAGER_LOG_FILE="${EXTENSION_MANAGER_TMP_DIR}/extensions.log"
[[ "${WRITE_EXTENSIONS_METADATA:-yes}" == "no" ]] && echo -n "" > "${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt"
+ # Add trap handler to cleanup and not leave garbage behind when exiting.
+ add_cleanup_handler cleanup_handler_extensions
+
# globally initialize the extensions log.
echo "-- lib/extensions.sh included. logs will be below, followed by the debug generated by the initialize_extension_manager() function." > "${EXTENSION_MANAGER_LOG_FILE}"
@@ -252,18 +255,32 @@ initialize_extension_manager() {
cleanup_extension_manager() {
if [[ -f "${fragment_manager_cleanup_file}" ]]; then
display_alert "Cleaning up" "extension manager" "info"
- # this will unset all the functions.
# shellcheck disable=SC1090 # dynamic source, thanks, shellcheck
- source "${fragment_manager_cleanup_file}"
- # file is removed together with EXTENSION_MANAGER_TMP_DIR below.
+ source "${fragment_manager_cleanup_file}" # this will unset all the functions.
+ rm -f "${fragment_manager_cleanup_file}" # also remove the file.
+ unset fragment_manager_cleanup_file # and unset the var.
+ fi
+
+ # reset/unset the variables used
+ initialize_extension_manager_counter=0
+ unset extension_function_info defined_hook_point_functions hook_point_function_trace_sources hook_point_function_trace_lines fragment_manager_cleanup_file
+}
+
+function cleanup_handler_extensions() {
+ echo "-- yeah the extensions trap handler..." 1>&2
+ cleanup_extension_manager
+
+ # Move temporary log file over to final destination.
+ if [[ -f "${EXTENSION_MANAGER_LOG_FILE}" ]]; then
+ mv "${EXTENSION_MANAGER_LOG_FILE}" "${DEST}/${LOG_SUBPATH:-debug}/extensions.log"
fi
+ unset EXTENSION_MANAGER_LOG_FILE
+
# cleanup our tmpdir.
if [[ -d "${EXTENSION_MANAGER_TMP_DIR}" ]]; then
rm -rf "${EXTENSION_MANAGER_TMP_DIR}"
fi
- # reset/unset the variables used
- initialize_extension_manager_counter=0
- unset extension_function_info defined_hook_point_functions hook_point_function_trace_sources hook_point_function_trace_lines fragment_manager_cleanup_file
+ unset EXTENSION_MANAGER_TMP_DIR
}
# why not eat our own dog food?
@@ -290,10 +307,6 @@ run_after_build__999_finish_extension_manager() {
- `${hook_point_function_trace_lines}` is the same, but BASH_LINENO info.
After this hook is done, the `${EXTENSION_MANAGER_TMP_DIR}` will be removed.
EXTENSION_METADATA_READY
-
- # Move temporary log file over to final destination, and start writing to it instead (although 999 is pretty late in the game)
- mv "${EXTENSION_MANAGER_LOG_FILE}" "${DEST}/${LOG_SUBPATH:-debug}/extensions.log"
- export EXTENSION_MANAGER_LOG_FILE="${DEST}/${LOG_SUBPATH:-debug}/extensions.log"
}
# This is called by call_extension_method(). To say the truth, this should be in an extension. But then it gets too meta for anyone's head.
diff --git a/lib/functions/cli/cli-entrypoint.sh b/lib/functions/cli/cli-entrypoint.sh
index 587348b01..d9da56acc 100644
--- a/lib/functions/cli/cli-entrypoint.sh
+++ b/lib/functions/cli/cli-entrypoint.sh
@@ -1,3 +1,23 @@
+function bla_cleanup1() {
+ echo "-- bla cleanup1" 1>&2
+}
+function bla_cleanup2() {
+ echo "-- bla cleanup2" 1>&2
+}
+
+function bla() {
+ display_alert "bla starting" "bla is here! PID: $$ - BASHPID: $BASHPID" "debug"
+ add_cleanup_handler bla_cleanup1
+ add_cleanup_handler bla_cleanup2
+
+ #sleep 10
+ #explode_here
+ #exit 66 # exit with error
+ exit_with_error "something" "wrong"
+ #exit 0 # exit without error
+}
+
+
function cli_entrypoint() {
if [[ "${ARMBIAN_ENABLE_CALL_TRACING}" == "yes" ]]; then
set -T # inherit return/debug traps
@@ -6,8 +26,6 @@ function cli_entrypoint() {
trap 'echo "${BASH_LINENO[@]}|${BASH_SOURCE[@]}|${FUNCNAME[@]}" >> ${SRC}/output/debug/calls.txt ;' RETURN
fi
- logging_init # initialize logging.
-
check_args "$@"
do_update_src "$@"
@@ -108,27 +126,23 @@ function cli_entrypoint() {
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
- if [[ "${BUILD_ALL}" == "yes" || "${BUILD_ALL}" == "demo" ]]; then
- do_main_build_all_ng
- else
- # configuration etc - it initializes the extension manager.
- do_capturing_defs prepare_and_config_main_build_single # this sets CAPTURED_VARS
-
- if [[ "${CONFIG_DEFS_ONLY}" == "yes" ]]; then
- echo "${CAPTURED_VARS}" # to stdout!
- cleanup_extension_manager # manually cleanup extension manager before exiting
- return 0
- else
- unset CAPTURED_VARS
- fi
+ # configuration etc - it initializes the extension manager.
+ do_capturing_defs prepare_and_config_main_build_single # this sets CAPTURED_VARS
+ if [[ "${CONFIG_DEFS_ONLY}" == "yes" ]]; then
+ echo "${CAPTURED_VARS}" # to stdout!
+ else
+ unset CAPTURED_VARS
# Allow for custom user-invoked functions, or do the default build.
if [[ -z $1 ]]; then
- main_default_build_single # this cleans up the extension manager
+ main_default_build_single
else
# @TODO: check this with extensions usage?
eval "$@"
fi
-
fi
+
+ # Build done, run the cleanup handlers explicitly.
+ # This zeroes out the list of cleanups, so it's not done again when the main script exits.
+ run_cleanup_handlers
}
diff --git a/lib/functions/image/rootfs-to-image.sh b/lib/functions/image/rootfs-to-image.sh
index 898a7372b..77d61fc2c 100644
--- a/lib/functions/image/rootfs-to-image.sh
+++ b/lib/functions/image/rootfs-to-image.sh
@@ -78,7 +78,7 @@ create_image_from_sdcard_rootfs() {
Called before unmounting both `/root` and `/boot`.
PRE_UMOUNT_FINAL_IMAGE
- # unmount /boot/efi first, then /boot, rootfs third, image file last
+ # unmount /boot/efi first, then /boot, rootfs third, image file last # @TODO: why using lazy unmount?
sync
[[ $UEFISIZE != 0 ]] && umount -l "${MOUNT}${UEFI_MOUNT_POINT}"
[[ $BOOTSIZE != 0 ]] && umount -l $MOUNT/boot
@@ -90,7 +90,7 @@ PRE_UMOUNT_FINAL_IMAGE
Called after unmounting both `/root` and `/boot`.
POST_UMOUNT_FINAL_IMAGE
- # to make sure its unmounted
+ # to make sure its unmounted # @TODO: maybe use the recursive unmount we have now
while grep -Eq '(${MOUNT}|${DESTIMG})' /proc/mounts; do
display_alert "Wait for unmount" "${MOUNT}" "info"
sleep 5
@@ -98,6 +98,8 @@ PRE_UMOUNT_FINAL_IMAGE
display_alert "Freeing loop device" "${LOOP}" "wrn"
losetup -d "${LOOP}"
+ unset LOOP # unset so cleanup handler does not try it again
+
# Don't delete $DESTIMG here, extensions might have put nice things there already.
rm -rf --one-file-system $MOUNT
diff --git a/lib/functions/logging/errors.sh b/lib/functions/logging/errors.sh
index f3766399d..29263306c 100644
--- a/lib/functions/logging/errors.sh
+++ b/lib/functions/logging/errors.sh
@@ -8,47 +8,3 @@
# This file is a part of the Armbian build script
# https://github.com/armbian/build/
-
-# exit_with_error <message> <highlight>
-#
-# a way to terminate build process
-# with verbose error message
-#
-
-function exit_with_error() {
- local _file
- local _line=${BASH_LINENO[0]}
- local _function=${FUNCNAME[1]}
- local _description=$1
- local _highlight=$2
- _file=$(basename "${BASH_SOURCE[1]}")
- local stacktrace logfile
- stacktrace="$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}" || true)"
-
- local logfile_to_show="${CURRENT_LOGFILE}" # store it
- unset CURRENT_LOGFILE # stop logging, otherwise crazy
-
- display_alert "ERROR in function $_function" "$stacktrace" "err"
- display_alert "$_description" "$_highlight" "err"
-
- # delegate to logging to make it pretty
- logging_error_show_log "$_description" "$_highlight" "${stacktrace}" "${logfile_to_show}"
-
- if [[ "${ERROR_DEBUG_SHELL}" == "yes" ]]; then
- display_alert "MOUNT" "${MOUNT}" "err"
- display_alert "SDCARD" "${SDCARD}" "err"
- display_alert "Here's a shell." "debug it" "err"
- bash < /dev/tty || true
- fi
-
- display_alert "Build terminating... wait for cleanups..." "" "err"
-
- overlayfs_wrapper "cleanup"
- # unlock loop device access in case of starvation # @TODO: hmm, say that again?
- exec {FD}> /var/lock/armbian-debootstrap-losetup
- flock -u "${FD}"
-
- export ALREADY_EXITING_WITH_ERROR=yes # marker for future trap handlers. avoid showing errors twice.
- exit 43
- display_alert "Never to be seen" "after exit and traps" "bye"
-}
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index 8c3bfa315..bd19b8e10 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -9,18 +9,13 @@ function logging_init() {
}
function logging_error_show_log() {
- # Do nothing if we're already showing the log on stderr.
- [[ "${SHOW_LOG}" == "yes" ]] && return 0
-
- # Close opened CI group, even if there is none; errors would be buried otherwise.
- if [[ "${CI}" == "true" ]]; then
+ local logfile_to_show="${CURRENT_LOGFILE}" # store current logfile in separate var
+ unset CURRENT_LOGFILE # stop logging, otherwise crazy
+ [[ "${SHOW_LOG}" == "yes" ]] && return 0 # Do nothing if we're already showing the log on stderr.
+ if [[ "${CI}" == "true" ]]; then # Close opened CI group, even if there is none; errors would be buried otherwise.
echo "::endgroup::"
fi
- local message="$1"
- local stacktrace="$3"
- local logfile_to_show="$4"
-
if [[ -f "${logfile_to_show}" ]]; then
local prefix_sed_contents="${normal_color}${left_marker}${padding}👉${padding}${right_marker} "
local prefix_sed_cmd="s/^/${prefix_sed_contents}/;"
@@ -28,10 +23,8 @@ function logging_error_show_log() {
# shellcheck disable=SC2002 # my cat is great. thank you, shellcheck.
cat "${logfile_to_show}" | grep -v -e "^$" | sed -e "${prefix_sed_cmd}" 1>&2 # write it to stderr!!
display_alert " 👆👆👆 Showing logfile above 👆👆👆" "${logfile_to_show}" "err"
- display_alert "🦞 Error Msg" "$message" "err"
- display_alert "🐞 Error stacktrace" "$stacktrace" "err"
else
- display_alert "✋ Error Log not Available" "${logfile_to_show}" "err"
+ display_alert "✋ Error log not available at this stage of build" "check messages above" "debug"
fi
return 0
}
diff --git a/lib/functions/logging/stacktraces.sh b/lib/functions/logging/stacktraces.sh
index 14e74171f..3ab2900ef 100644
--- a/lib/functions/logging/stacktraces.sh
+++ b/lib/functions/logging/stacktraces.sh
@@ -37,7 +37,7 @@ function show_caller_full() {
while caller $i; do
((i++))
done | while read -r line_no function_name file_name; do
- local padded_function_name=$(printf "%30s" "$function_name")
+ local padded_function_name=$(printf "%30s" "$function_name()")
local short_file_name="${file_name/"${SRC}/"/"./"}"
echo -e "$padded_function_name --> $short_file_name:$line_no"
done
diff --git a/lib/functions/logging/traps.sh b/lib/functions/logging/traps.sh
index f403547c9..fb294e06e 100644
--- a/lib/functions/logging/traps.sh
+++ b/lib/functions/logging/traps.sh
@@ -1,65 +1,121 @@
-# unmount_on_exit - used during rootfs building, to avoid leaving mounted stuff behind
-#
-unmount_on_exit() {
- set +e # we just wanna plow through this, ignoring errors.
- trap - INT TERM EXIT # remove the trap
+# Initialize and prepare the trap managers, one for each of ERR, INT, TERM and EXIT traps.
+# Bash goes insane regarding line numbers and other stuff if we try to overwrite the traps.
+# This also implements the custom "cleanup" handlers, which always run at the end of build, or when exiting prematurely for any reason.
+function traps_init() {
+ # shellcheck disable=SC2034 # Array of cleanup handlers.
+ declare -a trap_manager_cleanup_handlers=()
+ # shellcheck disable=SC2034 # Global to avoid doubly reporting ERR/EXIT pairs.
+ declare -a trap_manager_error_handled=0
+ trap 'main_trap_handler "ERR" "$?"' ERR
+ trap 'main_trap_handler "EXIT" "$?"' EXIT
+ trap 'main_trap_handler "INT" "$?"' INT
+ trap 'main_trap_handler "TERM" "$?"' TERM
+}
- local stack_here
- stack_here="$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}" || true)"
- display_alert "trap caught, shutting down" "${stack_here}" "err"
- if [[ "${ERROR_DEBUG_SHELL}" == "yes" ]]; then
- ERROR_DEBUG_SHELL=no # dont do it twice
- display_alert "MOUNT" "${MOUNT}" "err"
- display_alert "SDCARD" "${SDCARD}" "err"
- display_alert "ERROR_DEBUG_SHELL=yes, starting a shell." "ERROR_DEBUG_SHELL" "err"
- bash < /dev/tty >&2 || true
- fi
+# This is setup early in compile.sh as a trap handler for ERR, EXIT and INT signals.
+# There are arrays trap_manager_error_handlers=() trap_manager_exit_handlers=() trap_manager_int_handlers=()
+# that will receive the actual handlers.
+# First param is the type of trap, the second is the value of "$?"
+# In order of occurrence.
+# 1) Ctrl-C causes INT [stack unreliable], then ERR, then EXIT with trap_exit_code > 0
+# 2) Stuff failing causes ERR [stack OK], then EXIT with trap_exit_code > 0
+# 3) exit_with_error causes EXIT [stack OK, with extra frame] directly with trap_exit_code == 43
+# 4) EXIT can also be called directly [stack unreliable], with trap_exit_code == 0 if build successful.
+# So the EXIT trap will do:
+# - show stack, if not previously shown (trap_manager_error_handled==0), and if trap_exit_code > 0
+# - allow for debug shell, if trap_exit_code > 0
+# - call all the cleanup functions (always)
+function main_trap_handler() {
+ local trap_type="${1}"
+ local trap_exit_code="${2}"
+ local stack_caller short_stack
+ stack_caller="$(show_caller_full)"
+ short_stack="${BASH_SOURCE[1]}:${BASH_LINENO[0]}"
- cd "${SRC}" || echo "Failed to cwd to ${SRC}" # Move pwd away, so unmounts work
- # those will loop until they're unmounted.
- umount_chroot_recursive "${SDCARD}/"
- umount_chroot_recursive "${MOUNT}/"
+ echo "-- main_trap_handler: ${trap_type} and ${trap_exit_code} trap_manager_error_handled:${trap_manager_error_handled} " 1>&2
- mountpoint -q "${SRC}"/cache/toolchain && umount -l "${SRC}"/cache/toolchain >&2 # @TODO: why does Igor uses lazy umounts? nfs?
- mountpoint -q "${SRC}"/cache/rootfs && umount -l "${SRC}"/cache/rootfs >&2
- [[ $CRYPTROOT_ENABLE == yes ]] && cryptsetup luksClose "${ROOT_MAPPER}" >&2
+ case "${trap_type}" in
+ TERM | INT)
+ display_alert "Build interrupted" "Build interrupted by SIG${trap_type}" "warn"
+ trap_manager_error_handled=1
+ return # Nothing else to do here. Let the ERR trap show the stack, and the EXIT trap do cleanups.
+ ;;
- # shellcheck disable=SC2153 # global var. also a local 'loop' in another function. sorry.
- if [[ -b "${LOOP}" ]]; then
- display_alert "Freeing loop" "unmount_on_exit ${LOOP}" "wrn"
- losetup -d "${LOOP}" >&2
- fi
+ ERR)
+ logging_error_show_log
+ display_alert "Error occurred" "code ${trap_exit_code} at ${short_stack}\n${stack_caller}\n" "err"
+ trap_manager_error_handled=1
+ return # Nothing else to do here, let the EXIT trap do the cleanups.
+ ;;
- [[ -d "${SDCARD}" ]] && rm -rf --one-file-system "${SDCARD}"
- [[ -d "${MOUNT}" ]] && rm -rf --one-file-system "${MOUNT}"
+ EXIT)
+ if [[ ${trap_manager_error_handled} -lt 1 ]] && [[ ${trap_exit_code} -gt 0 ]]; then
+ logging_error_show_log
+ display_alert "Exit with error detected" "${trap_exit_code} at ${short_stack} -\n${stack_caller}\n" "err"
+ trap_manager_error_handled=1
+ fi
- # if we've been called by exit_with_error itself, don't recurse.
- if [[ "${ALREADY_EXITING_WITH_ERROR:-no}" != "yes" ]]; then
- exit_with_error "generic error during build_rootfs_image: ${stack_here}" || true # but don't trigger error again
- fi
+ if [[ ${trap_exit_code} -gt 0 ]] && [[ "${ERROR_DEBUG_SHELL}" == "yes" ]]; then
+ export ERROR_DEBUG_SHELL=no # dont do it twice
+ display_alert "MOUNT" "${MOUNT}" "debug"
+ display_alert "SDCARD" "${SDCARD}" "debug"
+ display_alert "ERROR_DEBUG_SHELL=yes, starting a shell." "ERROR_DEBUG_SHELL; exit to cleanup." "debug"
+ bash < /dev/tty >&2 || true
+ fi
- return 49 # trap returns error.
+ # Run the cleanup handlers, always.
+ run_cleanup_handlers || true
+ ;;
+ esac
}
-# added by main_default_build_single to show details about errors when they happen and exit. exit might trigger the above.
-function main_error_monitor() {
- if [[ "${ALREADY_EXITING_WITH_ERROR}" == "yes" ]]; then
- return 46
+# Run the cleanup handlers, if any, and clean the cleanup list.
+function run_cleanup_handlers() {
+ echo "-- run_cleanup_handlers! list: ${trap_manager_cleanup_handlers[*]}" 1>&2
+ if [[ ${#trap_manager_cleanup_handlers[@]} -lt 1 ]]; then
+ return 0 # No handlers set, just return.
+ else
+ display_alert "Cleaning up" "please wait for cleanups to finish" "debug"
fi
- local errcode="${1}"
- # If there's no error, do nothing.
- if [[ $errcode -eq 0 ]]; then
- return 0
- fi
- local stack_caller="$(show_caller_full)"
- if [[ "${ALREADY_EXITING_WITH_ERROR}" != "yes" ]]; then # Don't do this is exit_with_error already did it.
- local logfile_to_show="${CURRENT_LOGFILE}" # store it
- unset CURRENT_LOGFILE # stop logging, otherwise crazy
- logging_error_show_log "main_error_monitor unknown error" "main_error_monitor unknown highlight" "${stack_caller}" "${logfile_to_show}"
- fi
- display_alert "main_error_monitor: error code ${errcode}" "\n${stack_caller}\n" "err"
+ # Loop over the handlers, execute one by one. Ignore errors.
+ local one_cleanup_handler
+ for one_cleanup_handler in "${trap_manager_cleanup_handlers[@]}"; do
+ display_alert "Running cleanup handler" "${one_cleanup_handler}" "debug"
+ "${one_cleanup_handler}" || true
+ done
+ # Clear the cleanup handler list, so they don't accidentally run again.
+ trap_manager_cleanup_handlers=()
+}
+
+# Adds a callback for trap types; first argument is function name; extra params are the types to add for.
+function add_cleanup_handler() {
+ local callback="$1"
+ echo "-- Add callback ${callback} as cleanup handler" 1>&2
+ trap_manager_cleanup_handlers+=("$callback")
+}
+
+function remove_all_trap_handlers() {
+ echo "-- Will remove ALL trap handlers, for a clean exit..." 1>&2
+}
+
+# exit_with_error <message> <highlight>
+# a way to terminate build process with verbose error message
+function exit_with_error() {
+ # Log the error and exit.
+ # Everything else will be done by shared trap handling, above.
+ local _file="${BASH_SOURCE[1]}"
+ local _function=${FUNCNAME[1]}
+ local _line="${BASH_LINENO[0]}"
+
+ display_alert "error: ${1}" "${2} in ${_function}() at ${_file}:${_line}" "err"
+
+ # @TODO: move this into trap handler
+ # @TODO: integrate both overlayfs and the FD locking with cleanup logic
+ display_alert "Build terminating... wait for cleanups..." "" "err"
+ overlayfs_wrapper "cleanup"
+ # unlock loop device access in case of starvation # @TODO: hmm, say that again?
+ exec {FD}> /var/lock/armbian-debootstrap-losetup
+ flock -u "${FD}"
- ALREADY_EXITING_WITH_ERROR=yes
- exit 45
- return 44
+ exit 43
}
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index 3e81d7cd5..7fc46c3d6 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -7,8 +7,9 @@ main_default_build_single() {
# Invoking chroot directly will fail in subtle ways, so, please use the runner.sh functions.
display_alert "Starting single build, exporting TMPDIR" "${WORKDIR}" "debug"
mkdir -p "${WORKDIR}"
+ add_cleanup_handler trap_handler_cleanup_workdir
+
export TMPDIR="${WORKDIR}"
- # @todo: handle this in the exit trap, don't leave garbage behind when exiting.
start=$(date +%s)
# Check and install dependencies, directory structure and settings
@@ -132,16 +133,6 @@ main_default_build_single() {
- *NOTE:* this will run only if there were no errors during build process.
RUN_AFTER_BUILD
- # Cleanup. Remove the WORKDIR, unset the TMPDIR
- unset TMPDIR
- if [[ -d "${WORKDIR}" ]]; then
- display_alert "Cleaning up WORKDIR" "$(du -h -s "$WORKDIR")" "debug"
- rm -rf "${WORKDIR}"
- fi
-
- # cleanup the extension manager, that was initialized during prepare_and_config_main_build_single
- cleanup_extension_manager
-
end=$(date +%s)
runtime=$(((end - start) / 60))
display_alert "Runtime" "$runtime min" "info"
@@ -163,3 +154,12 @@ main_default_build_single() {
display_alert "Repeat Build Options" "${repeat_args[*]}" "ext" # * = expand array, space delimited, single-word.
}
+
+function trap_handler_cleanup_workdir() {
+ echo "-- cleanup handler: Should cleanup $WORKDIR WORKDIR here" 1>&2
+ unset TMPDIR
+ if [[ -d "${WORKDIR}" ]]; then
+ display_alert "Cleaning up WORKDIR" "$(du -h -s "$WORKDIR")" "debug"
+ rm -rf "${WORKDIR}"
+ fi
+}
diff --git a/lib/functions/main/rootfs-image.sh b/lib/functions/main/rootfs-image.sh
index e31c319fb..db8fe5b40 100644
--- a/lib/functions/main/rootfs-image.sh
+++ b/lib/functions/main/rootfs-image.sh
@@ -13,8 +13,8 @@ function build_rootfs_and_image() {
[[ $ROOTFS_TYPE != ext4 ]] && display_alert "Assuming $BOARD $BRANCH kernel supports $ROOTFS_TYPE" "" "wrn"
- # trap to unmount stuff in case of error/manual interruption
- trap unmount_on_exit INT TERM EXIT
+ # add handler to cleanup when done or if something fails or is interrupted.
+ add_cleanup_handler trap_handler_cleanup_rootfs_and_image
# stage: clean and create directories
rm -rf $SDCARD $MOUNT
@@ -98,6 +98,28 @@ function build_rootfs_and_image() {
fi
rm -rf $SDCARD
- # remove exit trap
- trap - INT TERM EXIT
+ # No need to remove the cleanup handler here, it's automatic.
+ return 0
+}
+
+function trap_handler_cleanup_rootfs_and_image() {
+ echo "-- trap_handler_cleanup_rootfs_and_image cleaning up..." 1>&2
+
+ cd "${SRC}" || echo "Failed to cwd to ${SRC}" # Move pwd away, so unmounts work
+ # those will loop until they're unmounted.
+ umount_chroot_recursive "${SDCARD}/" || true
+ umount_chroot_recursive "${MOUNT}/" || true
+
+ mountpoint -q "${SRC}"/cache/toolchain && umount -l "${SRC}"/cache/toolchain >&2 # @TODO: why does Igor uses lazy umounts? nfs?
+ mountpoint -q "${SRC}"/cache/rootfs && umount -l "${SRC}"/cache/rootfs >&2
+ [[ $CRYPTROOT_ENABLE == yes ]] && cryptsetup luksClose "${ROOT_MAPPER}" >&2
+
+ # shellcheck disable=SC2153 # global var.
+ if [[ -b "${LOOP}" ]]; then
+ display_alert "Freeing loop" "trap_handler_cleanup_rootfs_and_image ${LOOP}" "wrn"
+ losetup -d "${LOOP}" >&2 || true
+ fi
+
+ [[ -d "${SDCARD}" ]] && rm -rf --one-file-system "${SDCARD}"
+ [[ -d "${MOUNT}" ]] && rm -rf --one-file-system "${MOUNT}"
}
diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh
index acadbf6e3..eec9f2fa3 100644
--- a/lib/functions/rootfs/create-cache.sh
+++ b/lib/functions/rootfs/create-cache.sh
@@ -61,7 +61,7 @@ get_or_create_rootfs_cache_chroot_sdcard() {
umount --lazy "$SDCARD"
rm -rf $SDCARD
# remove exit trap
- trap - INT TERM EXIT
+ remove_all_trap_handlers INT TERM EXIT
exit
fi
@@ -87,7 +87,7 @@ get_or_create_rootfs_cache_chroot_sdcard() {
umount --lazy "$SDCARD"
rm -rf $SDCARD
# remove exit trap
- trap - INT TERM EXIT
+ remove_all_trap_handlers INT TERM EXIT
exit
fi
From 7f06253437a0ae20d4570e09e8babe3302bb8350 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 16 Feb 2022 00:01:54 +0100
Subject: [PATCH] armbian-next: manual merge (10) of all lib/*.sh changes
between revisions a4ae3a22703a66f1e383a193d74655533ff96c3a and
3305d45b8175dbdd647dc1dc53fa6f0a522920c7 - but NOT the git unshallow stuff,
that will be rewritten
---
config/sources/families/bcm2711.conf | 9 ++++++++-
config/sources/families/include/uefi_common.inc | 14 ++++++++++---
lib/functions/configuration/main-config.sh | 5 +----
lib/functions/image/partitioning.sh | 27 +++++++------------------
packages/armbian/builddeb | 9 ---------
5 files changed, 27 insertions(+), 37 deletions(-)
diff --git a/config/sources/families/bcm2711.conf b/config/sources/families/bcm2711.conf
index 2198c490c..0dc25fc3f 100644
--- a/config/sources/families/bcm2711.conf
+++ b/config/sources/families/bcm2711.conf
@@ -57,7 +57,14 @@ pre_flash_kernel__symlink_dtb_and_kernel() {
Kernel-Flavors: any
EOD
- ## DTB compatibility has been moved to symlink done in packages/armbian/builddeb
+ ## @TODO: rpardini: a horrible hack. I'll sort this out together with overlays, later.
+ local oneDTB dtbBase
+ for oneDTB in "${MOUNT}"/boot/dtb/broadcom/*.dtb; do
+ dtbBase=$(basename "${oneDTB}")
+ cp "${MOUNT}"/boot/dtb/broadcom/"${dtbBase}" "${MOUNT}"/etc/flash-kernel/dtbs/"${dtbBase}"
+ done
+
+ rm -rf "${MOUNT}"/boot/dtb* || true
# @TODO: rpardini: packaging could maybe already use the correct names? I can't figure out how.
ln -s ./Image "${MOUNT}"/boot/vmlinuz
diff --git a/config/sources/families/include/uefi_common.inc b/config/sources/families/include/uefi_common.inc
index 907e55ad1..7d6c97e0a 100644
--- a/config/sources/families/include/uefi_common.inc
+++ b/config/sources/families/include/uefi_common.inc
@@ -3,19 +3,27 @@ export SERIALCON="tty1" # Cant reasonably expect UEFI s
export SKIP_BOOTSPLASH="yes" # No splash.
export UEFI_GRUB_TIMEOUT=${UEFI_GRUB_TIMEOUT:-3} # Default 3-seconds timeout for GRUB menu.
export BOARD_FIRMWARE_INSTALL="-full" # Install full firmware for UEFI boards
-export DISTRO_GENERIC_KERNEL=no # no, build from source; yes: use distro
case "${BRANCH}" in
- current | ddk)
+ legacy | ddk)
# This will force `unset KERNELSOURCE` later; no kernel will be built.
# Instead, the distro's default linux-generic kernel will be installed.
export DISTRO_GENERIC_KERNEL=yes
;;
- edge)
+ current)
+ export DISTRO_GENERIC_KERNEL=no
export LINUXCONFIG="linux-uefi-${LINUXFAMILY}-${BRANCH}"
export KERNELBRANCH="branch:linux-5.15.y"
export KERNELPATCHDIR="uefi-${LINUXFAMILY}-${BRANCH}" # Might be empty.
export KERNELDIR="linux-uefi-${LINUXFAMILY}" # Avoid sharing a source tree with others, until we know it's safe.
;;
+
+ edge)
+ export DISTRO_GENERIC_KERNEL=no
+ export LINUXCONFIG="linux-uefi-${LINUXFAMILY}-${BRANCH}"
+ export KERNELBRANCH="branch:linux-5.16.y"
+ export KERNELPATCHDIR="uefi-${LINUXFAMILY}-${BRANCH}" # Might be empty.
+ export KERNELDIR="linux-uefi-${LINUXFAMILY}" # Avoid sharing a source tree with others, until we know it's safe.
+ ;;
esac
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 06eb888fd..25dd263a5 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -151,14 +151,11 @@ function do_main_configuration() {
case $GITHUB_MIRROR in
fastgit)
- GITHUB_SOURCE='https://hub.fastgit.org/'
+ GITHUB_SOURCE='https://hub.fastgit.xyz/'
;;
gitclone)
GITHUB_SOURCE='https://gitclone.com/github.com/'
;;
- cnpmjs)
- GITHUB_SOURCE='https://github.com.cnpmjs.org/'
- ;;
*)
GITHUB_SOURCE='https://github.com/'
;;
diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh
index 0e075132a..2387f37e0 100644
--- a/lib/functions/image/partitioning.sh
+++ b/lib/functions/image/partitioning.sh
@@ -134,26 +134,13 @@ prepare_partitions() {
fi
else
local imagesize=$(($rootfs_size + $OFFSET + $BOOTSIZE + $UEFISIZE + $EXTRA_ROOTFS_MIB_SIZE)) # MiB
- case $ROOTFS_TYPE in
- btrfs)
- # Used for server images, currently no swap functionality, so disk space
- if [[ $BTRFS_COMPRESSION == none ]]; then
- local sdsize=$(bc -l <<< "scale=0; (($imagesize * 1.25) / 4 + 1) * 4")
- else
- # requirements are rather low since rootfs gets filled with compress-force=zlib
- local sdsize=$(bc -l <<< "scale=0; (($imagesize * 0.8) / 4 + 1) * 4")
- fi
- ;;
- *)
- # Hardcoded overhead +25% is needed for desktop images,
- # for CLI it could be lower. Align the size up to 4MiB
- if [[ $BUILD_DESKTOP == yes ]]; then
- local sdsize=$(bc -l <<< "scale=0; ((($imagesize * 1.30) / 1 + 0) / 4 + 1) * 4")
- else
- local sdsize=$(bc -l <<< "scale=0; ((($imagesize * 1.25) / 1 + 0) / 4 + 1) * 4")
- fi
- ;;
- esac
+ # Hardcoded overhead +25% is needed for desktop images,
+ # for CLI it could be lower. Align the size up to 4MiB
+ if [[ $BUILD_DESKTOP == yes ]]; then
+ local sdsize=$(bc -l <<< "scale=0; ((($imagesize * 1.30) / 1 + 0) / 4 + 1) * 4")
+ else
+ local sdsize=$(bc -l <<< "scale=0; ((($imagesize * 1.25) / 1 + 0) / 4 + 1) * 4")
+ fi
fi
# stage: create blank image
diff --git a/packages/armbian/builddeb b/packages/armbian/builddeb
index 0209f3528..0163d401a 100755
--- a/packages/armbian/builddeb
+++ b/packages/armbian/builddeb
@@ -74,23 +74,14 @@ create_package() {
exit 0
EOT
- # for Ubuntu/Debian compatiblity, copy DTBs to /lib/firmware/$version/device-tree
cat >> $pdir/DEBIAN/postinst <<- EOT
cd /boot
ln -sfT dtb-$version dtb 2> /dev/null || mv dtb-$version dtb
- mkdir -p /lib/firmware/$version
- rm -rf /lib/firmware/$version/device-tree
- cp -rp /boot/dtb-$version /lib/firmware/$version/device-tree
exit 0
EOT
- cat >> $pdir/DEBIAN/postrm <<- EOT
- rm -rf /lib/firmware/$version
- EOT
-
chmod 775 $pdir/DEBIAN/preinst
chmod 775 $pdir/DEBIAN/postinst
- chmod 775 $pdir/DEBIAN/postrm
fi
# Create postinst prerm script for headers
From dcbc1fa8d159e9a7423e82c5bc81b223c20dfbc1 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 13 Feb 2022 14:35:36 +0100
Subject: [PATCH] armbian-next: trapmanager pt1, identifying spots for trap
manager intervention
---
lib/functions/bsp/bsp-cli.sh | 2 +-
lib/functions/bsp/bsp-desktop.sh | 4 ++--
lib/functions/compilation/atf.sh | 2 +-
lib/functions/compilation/debs.sh | 6 +++---
lib/functions/compilation/kernel.sh | 2 +-
lib/functions/compilation/uboot.sh | 2 +-
6 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/lib/functions/bsp/bsp-cli.sh b/lib/functions/bsp/bsp-cli.sh
index a4e6db654..ee557963c 100644
--- a/lib/functions/bsp/bsp-cli.sh
+++ b/lib/functions/bsp/bsp-cli.sh
@@ -1,7 +1,7 @@
create_board_package() {
display_alert "Creating board support package for CLI" "$CHOSEN_ROOTFS" "info"
- bsptempdir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
+ bsptempdir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
chmod 700 ${bsptempdir}
local destination=${bsptempdir}/${BSP_CLI_PACKAGE_FULLNAME}
diff --git a/lib/functions/bsp/bsp-desktop.sh b/lib/functions/bsp/bsp-desktop.sh
index 7ccba50c2..54259fc4a 100644
--- a/lib/functions/bsp/bsp-desktop.sh
+++ b/lib/functions/bsp/bsp-desktop.sh
@@ -32,7 +32,7 @@ create_desktop_package() {
PACKAGE_LIST_PREDEPENDS=${PACKAGE_LIST_PREDEPENDS//[[:space:]]/}
local destination tmp_dir
- tmp_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
+ tmp_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
destination=${tmp_dir}/${BOARD}/${CHOSEN_DESKTOP}_${REVISION}_all
rm -rf "${destination}"
mkdir -p "${destination}"/DEBIAN
@@ -97,7 +97,7 @@ create_bsp_desktop_package() {
local package_name="${BSP_DESKTOP_PACKAGE_FULLNAME}"
local destination tmp_dir
- tmp_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
+ tmp_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
destination=${tmp_dir}/${BOARD}/${BSP_DESKTOP_PACKAGE_FULLNAME}
rm -rf "${destination}"
mkdir -p "${destination}"/DEBIAN
diff --git a/lib/functions/compilation/atf.sh b/lib/functions/compilation/atf.sh
index 857c1744f..f5e9aa691 100644
--- a/lib/functions/compilation/atf.sh
+++ b/lib/functions/compilation/atf.sh
@@ -57,7 +57,7 @@ compile_atf() {
[[ $(type -t atf_custom_postprocess) == function ]] && atf_custom_postprocess 2>&1
- atftempdir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
+ atftempdir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
chmod 700 ${atftempdir}
# copy files to temp directory
diff --git a/lib/functions/compilation/debs.sh b/lib/functions/compilation/debs.sh
index f491715a3..b00d12c60 100644
--- a/lib/functions/compilation/debs.sh
+++ b/lib/functions/compilation/debs.sh
@@ -3,7 +3,7 @@ compile_firmware() {
local firmwaretempdir plugin_dir
- firmwaretempdir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
+ firmwaretempdir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
chmod 700 ${firmwaretempdir}
plugin_dir="armbian-firmware${FULL}"
@@ -50,7 +50,7 @@ compile_firmware() {
compile_armbian-zsh() {
local tmp_dir armbian_zsh_dir
- tmp_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
+ tmp_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
chmod 700 ${tmp_dir}
armbian_zsh_dir=armbian-zsh_${REVISION}_all
@@ -124,7 +124,7 @@ compile_armbian-zsh() {
compile_armbian-config() {
local tmp_dir armbian_config_dir
- tmp_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
+ tmp_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
chmod 700 ${tmp_dir}
armbian_config_dir=armbian-config_${REVISION}_all
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 306fbb839..3bf77ae1b 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -245,7 +245,7 @@ function compile_kernel() {
create_linux-source_package() {
ts=$(date +%s)
local sources_pkg_dir tmp_src_dir
- tmp_src_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
+ tmp_src_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
sources_pkg_dir=${tmp_src_dir}/${CHOSEN_KSRC}_${REVISION}_all
mkdir -p "${sources_pkg_dir}"/usr/src/ \
diff --git a/lib/functions/compilation/uboot.sh b/lib/functions/compilation/uboot.sh
index 051dbfdb7..d2d6447a2 100644
--- a/lib/functions/compilation/uboot.sh
+++ b/lib/functions/compilation/uboot.sh
@@ -142,7 +142,7 @@ compile_uboot() {
local uboot_name="${CHOSEN_UBOOT}_${REVISION}_${ARCH}"
# create directory structure for the .deb package
- uboottempdir="$(mktemp -d)" # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
+ uboottempdir="$(mktemp -d)" # subject to TMPDIR/WORKDIR, so is protected by single/common error trapmanager to clean-up.
chmod 700 "${uboottempdir}"
mkdir -p "$uboottempdir/$uboot_name/usr/lib/u-boot" "$uboottempdir/$uboot_name/usr/lib/$uboot_name" "$uboottempdir/$uboot_name/DEBIAN"
From d2c3f332f9e9a04ff68d2bf1e694a223999e3304 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 13 Feb 2022 13:42:44 +0100
Subject: [PATCH] armbian-next: `install_pkg_deb` ->
`install_host_side_packages` which is completely rewritten version
- much simplified; compare installed packages vs wanted, and only update if some missing
---
lib/functions/general/host.sh | 141 ++++++++-------------------------------
lib/functions/logging/runners.sh | 14 +++-
2 files changed, 40 insertions(+), 115 deletions(-)
diff --git a/lib/functions/general/host.sh b/lib/functions/general/host.sh
index 2f24d4826..34f17a38e 100644
--- a/lib/functions/general/host.sh
+++ b/lib/functions/general/host.sh
@@ -157,9 +157,8 @@ prepare_host() {
# don't prompt for apt cacher selection
sudo echo "apt-cacher-ng apt-cacher-ng/tunnelenable boolean false" | sudo debconf-set-selections
- LOG_OUTPUT_FILE="${DEST}"/${LOG_SUBPATH}/hostdeps.log
- install_pkg_deb "$hostdeps"
- unset LOG_OUTPUT_FILE
+ # This handles the wanted list in $hostdeps, updates apt only if needed
+ install_host_side_packages "$hostdeps"
update-ccache-symlinks
@@ -308,119 +307,33 @@ function fetch_and_build_host_tools() {
}
-# Installing debian packages in the armbian build system.
-# The function accepts four optional parameters:
-# autoupdate - If the installation list is not empty then update first.
-# upgrade, clean - the same name for apt
-# verbose - detailed log for the function
-#
-# list="pkg1 pkg2 pkg3 pkgbadname pkg-1.0 | pkg-2.0 pkg5 (>= 9)"
-# install_pkg_deb upgrade verbose $list
-# or
-# install_pkg_deb autoupdate $list
-#
-# If the package has a bad name, we will see it in the log file.
-# If there is an LOG_OUTPUT_FILE variable and it has a value as
-# the full real path to the log file, then all the information will be there.
-#
-# The LOG_OUTPUT_FILE variable must be defined in the calling function
-# before calling the install_pkg_deb function and unset after.
-#
-install_pkg_deb() {
- local list=""
- local log_file
- local for_install
- local need_autoup=false
- local need_upgrade=false
- local need_clean=false
- local need_verbose=false
- local _line=${BASH_LINENO[0]}
- local _function=${FUNCNAME[1]}
- local _file=$(basename "${BASH_SOURCE[1]}")
- local tmp_file=$(mktemp /tmp/install_log_XXXXX) # @TODO: rpardini: hmm. why? lets use TMPDIR just like everyone else.
- export DEBIAN_FRONTEND=noninteractive
-
- list=$(
- for p in $*; do
- case $p in
- autoupdate)
- need_autoup=true
- continue
- ;;
- upgrade)
- need_upgrade=true
- continue
- ;;
- clean)
- need_clean=true
- continue
- ;;
- verbose)
- need_verbose=true
- continue
- ;;
- \| | \(* | *\)) continue ;;
- esac
- echo " $p"
- done
- )
-
- if [ -d $(dirname $LOG_OUTPUT_FILE) ]; then
- log_file=${LOG_OUTPUT_FILE}
- else
- log_file="${SRC}/output/${LOG_SUBPATH}/install.log"
- fi
-
- # This is necessary first when there is no apt cache.
- if $need_upgrade; then
- apt-get -q update || echo "apt cannot update" >> $tmp_file
- apt-get -y upgrade || echo "apt cannot upgrade" >> $tmp_file
- fi
-
- # If the package is not installed, check the latest
- # up-to-date version in the apt cache.
- # Exclude bad package names and send a message to the log.
- for_install=$(
- for p in $list; do
- if $(dpkg-query -W -f '${db:Status-Abbrev}' $p |& awk '/ii/{exit 1}'); then
- apt-cache show $p -o APT::Cache::AllVersions=no |&
- awk -v p=$p -v tmp_file=$tmp_file \
- '/^Package:/{print $2} /^E:/{print "Bad package name: ",p >>tmp_file}'
- fi
- done
- )
-
- # This information should be logged.
- if [ -s $tmp_file ]; then
- echo -e "\nInstalling packages in function: $_function" "[$_file:$_line]" \
- >> $log_file
- echo -e "\nIncoming list:" >> $log_file
- printf "%-30s %-30s %-30s %-30s\n" $list >> $log_file
- echo "" >> $log_file
- cat $tmp_file >> $log_file
- fi
-
- if [ -n "$for_install" ]; then
- if $need_autoup; then
- apt-get -q update
- apt-get -y upgrade
+# Install the whitespace-delimited packages listed in the first parameter, in the host (not chroot).
+# It handles correctly the case where all wanted packages are already installed, and in that case does nothing.
+# If packages are to be installed, it does an apt-get update first.
+function install_host_side_packages() {
+ declare wanted_packages_string
+ declare -a currently_installed_packages missing_packages
+ wanted_packages_string=${*}
+ missing_packages=()
+ # shellcheck disable=SC2207 # I wanna split, thanks.
+ currently_installed_packages=($(dpkg-query --show --showformat='${Package} '))
+ for PKG_TO_INSTALL in ${wanted_packages_string}; do
+ # shellcheck disable=SC2076 # I wanna match literally, thanks.
+ if [[ ! " ${currently_installed_packages[*]} " =~ " ${PKG_TO_INSTALL} " ]]; then
+ display_alert "Should install package" "${PKG_TO_INSTALL}"
+ missing_packages+=("${PKG_TO_INSTALL}")
fi
- apt-get install -qq -y --no-install-recommends $for_install
- echo -e "\nPackages installed:" >> $log_file
- dpkg-query -W \
- -f '${binary:Package;-27} ${Version;-23}\n' \
- $for_install >> $log_file
-
- fi
+ done
- # We will show the status after installation all listed
- if $need_verbose; then
- echo -e "\nstatus after installation:" >> $log_file
- dpkg-query -W \
- -f '${binary:Package;-27} ${Version;-23} [ ${Status} ]\n' \
- $list >> $log_file
+ if [[ ${#missing_packages[@]} -gt 0 ]]; then
+ display_alert "Updating apt host-side for installing packages" "${#missing_packages[@]} packages" "info"
+ host_apt_get update
+ display_alert "Installing host-side packages" "${missing_packages[*]}" "info"
+ host_apt_get_install "${missing_packages[@]}"
+ else
+ display_alert "All host-side dependencies/packages already installed." "Skipping host-hide install" "debug"
fi
- if $need_clean; then apt-get clean; fi
- rm $tmp_file
+ unset currently_installed_packages
+ return 0
}
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index 66bd54015..cdce6ead3 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -8,8 +8,8 @@ function chroot_sdcard_apt_get() {
[[ $NO_APT_CACHER != yes ]] && apt_params+=(
-o "Acquire::http::Proxy=\"http://${APT_PROXY_ADDR:-localhost:3142}\""
-o "Acquire::http::Proxy::localhost=\"DIRECT\""
- -o "Dpkg::Use-Pty=0" # Please be quiet
)
+ apt_params+=(-o "Dpkg::Use-Pty=0") # Please be quiet
# IMPORTANT: this function returns the exit code of last statement, in this case chroot (which gets its result from bash which calls apt-get)
chroot_sdcard DEBIAN_FRONTEND=noninteractive apt-get "${apt_params[@]}" "$@"
}
@@ -74,6 +74,18 @@ function run_host_command_logged_long_running() {
run_host_command_logged_raw /bin/bash -e -c "$*"
}
+# For installing packages host-side. Not chroot!
+function host_apt_get_install() {
+ host_apt_get --no-install-recommends install "$@"
+}
+
+# For running apt-get stuff host-side. Not chroot!
+function host_apt_get() {
+ local -a apt_params=("-${APT_OPTS:-y}")
+ apt_params+=(-o "Dpkg::Use-Pty=0") # Please be quiet
+ run_host_command_logged DEBIAN_FRONTEND=noninteractive apt-get "${apt_params[@]}" "$@"
+}
+
# run_host_command_logged is the very basic, should be used for everything, but, please use helpers above, this is very low-level.
function run_host_command_logged() {
run_host_command_logged_raw /bin/bash -e -c "$*"
From 3b2d026b59d86cd463119876a9b69b02fd6ecf45 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 13 Feb 2022 13:27:31 +0100
Subject: [PATCH] armbian-next: force u-boot and kernel's gcc to output colors
to make easy to spot warnings and errors
---
lib/functions/compilation/kernel.sh | 4 +---
lib/functions/compilation/uboot.sh | 4 ++--
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index e10c5af72..306fbb839 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -20,9 +20,7 @@ function run_kernel_make() {
"CROSS_COMPILE=${CCACHE} ${KERNEL_COMPILER}" # Prefix for tool invocations.
)
- #if [[ "${SHOW_LOG}" == "yes" ]]; then
- common_make_params_quoted+=("KCFLAGS=-fdiagnostics-color=always") # Force GCC colored messages.
- #fi
+ common_make_params_quoted+=("KCFLAGS=-fdiagnostics-color=always") # Force GCC colored messages.
# last statement, so it passes the result to calling function.
full_command=("${KERNEL_MAKE_RUNNER:-run_host_command_logged}" "${common_make_envs[@]}" make "$@" "${common_make_params_quoted[@]@Q}")
diff --git a/lib/functions/compilation/uboot.sh b/lib/functions/compilation/uboot.sh
index ca56fbfa1..051dbfdb7 100644
--- a/lib/functions/compilation/uboot.sh
+++ b/lib/functions/compilation/uboot.sh
@@ -32,7 +32,7 @@ function compile_uboot_target() {
display_alert "${uboot_prefix}Preparing u-boot config" "${version} ${target_make}" "info"
export MSG_IF_ERROR="${uboot_prefix}Failed to configure u-boot ${version} $BOOTCONFIG ${target_make}"
run_host_command_logged CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${toolchain2}:${PATH}" \
- make "$CTHREADS" "$BOOTCONFIG" "CROSS_COMPILE=\"$CCACHE $UBOOT_COMPILER\""
+ make "$CTHREADS" "$BOOTCONFIG" "CROSS_COMPILE=\"$CCACHE $UBOOT_COMPILER\"" "KCFLAGS=-fdiagnostics-color=always"
# armbian specifics u-boot settings
[[ -f .config ]] && sed -i 's/CONFIG_LOCALVERSION=""/CONFIG_LOCALVERSION="-armbian"/g' .config
@@ -66,7 +66,7 @@ function compile_uboot_target() {
display_alert "${uboot_prefix}Compiling u-boot" "${version} ${target_make}" "info"
export MSG_IF_ERROR="${uboot_prefix}Failed to build u-boot ${version} ${target_make}"
- run_host_command_logged_long_running CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${toolchain2}:${PATH}" make "$target_make" "$CTHREADS" "${cross_compile}"
+ run_host_command_logged_long_running CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${toolchain2}:${PATH}" make "$target_make" "$CTHREADS" "${cross_compile}" "KCFLAGS=-fdiagnostics-color=always"
if [[ $(type -t uboot_custom_postprocess) == function ]]; then
display_alert "${uboot_prefix}Postprocessing u-boot" "${version} ${target_make}"
From fb4be3fa4a0d19043ee8d7ff1304ec3ccdf618cb Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 13 Feb 2022 13:23:51 +0100
Subject: [PATCH] docker: pass the `CI` env var through Docker invocation, for
GitHub Actions
---
config/templates/config-docker.conf | 3 +++
1 file changed, 3 insertions(+)
diff --git a/config/templates/config-docker.conf b/config/templates/config-docker.conf
index 54f655b59..0a59dfb28 100644
--- a/config/templates/config-docker.conf
+++ b/config/templates/config-docker.conf
@@ -90,6 +90,9 @@ DOCKER_FLAGS+=(-v=${SRC}/cache:/root/armbian/cache -v=armbian-ccache:/root/.ccac
DOCKER_FLAGS+=(-e COLUMNS="`tput cols`" -e LINES="`tput lines`")
+# Pass the "CI" env variable that comes from Github Actions.
+DOCKER_FLAGS+=(-e CI="${CI}")
+
# pass other command line arguments like KERNEL_ONLY=yes, KERNEL_CONFIGURE=yes, etc.
# pass "docker-guest" as an additional config name that will be sourced in the container if exists
if [[ $SHELL_ONLY == yes ]]; then
From 3db36a4fd3e6ad8c1b2d47d88d664936274bb875 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 13 Feb 2022 13:23:09 +0100
Subject: [PATCH] armbian-next: avoid warning if "file" utility not installed
- should not happen, but better safe than sorry
---
lib/functions/logging/runners.sh | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index 01bc1c8cd..66bd54015 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -121,9 +121,12 @@ run_on_sdcard() {
# Determine if we're building on non-amd64, and if so, which qemu binary to use.
function run_host_x86_binary_logged() {
local -a qemu_invocation target_bin_arch
- target_bin_arch="$(file -b "$1" | cut -d "," -f 1,2 | xargs echo -n)" # obtain the ELF name from the binary using 'file'
- qemu_invocation=("$@") # Default to calling directly, without qemu.
- if [[ "$(uname -m)" != "x86_64" ]]; then # If we're NOT on x86...
+ target_bin_arch="unknown - file util missing"
+ if [[ -f /usr/bin/file ]]; then
+ target_bin_arch="$(file -b "$1" | cut -d "," -f 1,2 | xargs echo -n)" # obtain the ELF name from the binary using 'file'
+ fi
+ qemu_invocation=("$@") # Default to calling directly, without qemu.
+ if [[ "$(uname -m)" != "x86_64" ]]; then # If we're NOT on x86...
if [[ -f /usr/bin/qemu-x86_64-static ]]; then
display_alert "Using qemu-x86_64-static for running on $(uname -m)" "$1 (${target_bin_arch})" "debug"
qemu_invocation=("/usr/bin/qemu-x86_64-static" "-L" "/usr/x86_64-linux-gnu" "$@")
From d986cbc68bc926d9dc8fca44cbe9b5a19d6a88b6 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 13 Feb 2022 13:22:33 +0100
Subject: [PATCH] armbian-next: disable long_running `pv` progress bar for
custom case too
- will rework later, for now pipe causes subshell and caos
---
lib/functions/logging/runners.sh | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index 9cf069834..01bc1c8cd 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -27,15 +27,19 @@ function chroot_sdcard_with_stdout() {
function chroot_custom_long_running() {
local target=$1
shift
- local _exit_code=1
- if [[ "${SHOW_LOG}" == "yes" ]] || [[ "${CI}" == "true" ]]; then
- TMPDIR="" run_host_command_logged_raw chroot "${target}" /bin/bash -e -c "$*"
- _exit_code=$?
- else
- TMPDIR="" run_host_command_logged_raw chroot "${target}" /bin/bash -e -c "$*" | pv -N "$(logging_echo_prefix_for_pv "${INDICATOR:-compile}")" --progress --timer --line-mode --force --cursor --delay-start 0 -i "0.5"
- _exit_code=$?
- fi
- return $_exit_code
+
+ # @TODO: disabled, the pipe causes the left-hand side to subshell and caos ensues.
+ # local _exit_code=1
+ # if [[ "${SHOW_LOG}" == "yes" ]] || [[ "${CI}" == "true" ]]; then
+ # TMPDIR="" run_host_command_logged_raw chroot "${target}" /bin/bash -e -c "$*"
+ # _exit_code=$?
+ # else
+ # TMPDIR="" run_host_command_logged_raw chroot "${target}" /bin/bash -e -c "$*" | pv -N "$(logging_echo_prefix_for_pv "${INDICATOR:-compile}")" --progress --timer --line-mode --force --cursor --delay-start 0 -i "0.5"
+ # _exit_code=$?
+ # fi
+ # return $_exit_code
+
+ TMPDIR="" run_host_command_logged_raw chroot "${target}" /bin/bash -e -c "$*"
}
function chroot_custom() {
From 7d49d5f6a72be78fa8afcd362fe7984e34d28614 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 13 Feb 2022 13:21:12 +0100
Subject: [PATCH] armbian-next: if `CI=true` then `SHOW_LOG=yes` always
---
compile.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/compile.sh b/compile.sh
index 3a5052989..64fcfb4f1 100755
--- a/compile.sh
+++ b/compile.sh
@@ -36,6 +36,11 @@ if [[ ! -f "${SRC}"/lib/single.sh ]]; then
exit 255
fi
+# Most CI runners, GitHub Actions included, pass env var "CI=true". In this case, force full logging.
+if [[ "${CI}" == "true" ]]; then
+ export SHOW_LOG=yes
+fi
+
# shellcheck source=lib/single.sh
source "${SRC}"/lib/single.sh
From a803a9dbbb8b86301ca930214675c1365e9125a7 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 12 Feb 2022 23:18:05 +0100
Subject: [PATCH] docker: add arm64 toolchain to Dockerfile; warn, but don't
break, on modprobe failure
---
config/templates/Dockerfile | 2 ++
lib/functions/general/host.sh | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/config/templates/Dockerfile b/config/templates/Dockerfile
index 06f873cf1..9a56ca2e9 100644
--- a/config/templates/Dockerfile
+++ b/config/templates/Dockerfile
@@ -53,6 +53,8 @@ RUN apt-get update \
gcc-arm-linux-gnueabihf \
gcc-arm-linux-gnueabi \
gcc-arm-none-eabi \
+ gcc-aarch64-linux-gnu \
+ g++-aarch64-linux-gnu \
gdisk \
git \
imagemagick \
diff --git a/lib/functions/general/host.sh b/lib/functions/general/host.sh
index 94409fafd..2f24d4826 100644
--- a/lib/functions/general/host.sh
+++ b/lib/functions/general/host.sh
@@ -244,7 +244,7 @@ prepare_host() {
# enable arm binary format so that the cross-architecture chroot environment will work
if [[ $KERNEL_ONLY != yes ]]; then
- modprobe -q binfmt_misc
+ modprobe -q binfmt_misc || display_alert "Failed to modprobe" "binfmt_misc" "warn"
mountpoint -q /proc/sys/fs/binfmt_misc/ || mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
if [[ "$(arch)" != "aarch64" ]]; then
test -e /proc/sys/fs/binfmt_misc/qemu-arm || update-binfmts --enable qemu-arm
From aaed9afade2dda38d9e92a7054f3477801468760 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 12 Feb 2022 21:52:01 +0100
Subject: [PATCH] armbian-next: docker: use ubuntu:rolling, fix deps, use
`$SRC/cache` as container's cache dir
---
config/templates/Dockerfile | 7 ++-----
config/templates/config-docker.conf | 4 ++--
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/config/templates/Dockerfile b/config/templates/Dockerfile
index 3666170d1..06f873cf1 100644
--- a/config/templates/Dockerfile
+++ b/config/templates/Dockerfile
@@ -1,7 +1,4 @@
-ARG BASE_IMAGE=ubuntu:jammy
-FROM $BASE_IMAGE as armbian_builder
-ARG CUSTOM_PACKAGES='g++-11-arm-linux-gnueabihf libssl3'
-ENV CUSTOM_PACKAGES $CUSTOM_PACKAGES
+FROM ubuntu:rolling
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get -y dist-upgrade && apt-get -y install \
joe \
@@ -23,7 +20,6 @@ RUN sh -c " \
RUN apt-get update \
&& apt-get -y dist-upgrade \
&& apt-get install -y --no-install-recommends \
- $CUSTOM_PACKAGES \
acl \
aptly \
aria2 \
@@ -51,6 +47,7 @@ RUN apt-get update \
fakeroot \
fdisk \
flex \
+ g++-arm-linux-gnueabihf \
gawk \
gcc-aarch64-linux-gnu \
gcc-arm-linux-gnueabihf \
diff --git a/config/templates/config-docker.conf b/config/templates/config-docker.conf
index 60b9a22ac..54f655b59 100644
--- a/config/templates/config-docker.conf
+++ b/config/templates/config-docker.conf
@@ -83,10 +83,10 @@ fi
#DOCKER_FLAGS+=(-v /dev/bus/usb:/dev/bus/usb:ro)
# map source to Docker Working dir.
-DOCKER_FLAGS+=(-v=$SRC/:/root/armbian/)
+DOCKER_FLAGS+=(-v=${SRC}/:/root/armbian/)
# mount 2 named volumes - for cacheable data and compiler cache
-DOCKER_FLAGS+=(-v=armbian-cache:/root/armbian/cache -v=armbian-ccache:/root/.ccache)
+DOCKER_FLAGS+=(-v=${SRC}/cache:/root/armbian/cache -v=armbian-ccache:/root/.ccache)
DOCKER_FLAGS+=(-e COLUMNS="`tput cols`" -e LINES="`tput lines`")
From 6e52c4d1b50f4bff209d7536573329f7ea9e5e47 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 12 Feb 2022 23:17:20 +0100
Subject: [PATCH] armbian-next: logging fixes (padding, don't show error more
than once, don't remove trap)
---
lib/functions/logging/logging.sh | 1 -
lib/functions/logging/stacktraces.sh | 2 +-
lib/functions/logging/traps.sh | 4 +---
3 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index 65ad6db33..8c3bfa315 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -22,7 +22,6 @@ function logging_error_show_log() {
local logfile_to_show="$4"
if [[ -f "${logfile_to_show}" ]]; then
-
local prefix_sed_contents="${normal_color}${left_marker}${padding}👉${padding}${right_marker} "
local prefix_sed_cmd="s/^/${prefix_sed_contents}/;"
display_alert " 👇👇👇 Showing logfile below 👇👇👇" "${logfile_to_show}" "err"
diff --git a/lib/functions/logging/stacktraces.sh b/lib/functions/logging/stacktraces.sh
index a1c256bb5..14e74171f 100644
--- a/lib/functions/logging/stacktraces.sh
+++ b/lib/functions/logging/stacktraces.sh
@@ -37,7 +37,7 @@ function show_caller_full() {
while caller $i; do
((i++))
done | while read -r line_no function_name file_name; do
- local padded_function_name=$(printf "%20s" "$function_name")
+ local padded_function_name=$(printf "%30s" "$function_name")
local short_file_name="${file_name/"${SRC}/"/"./"}"
echo -e "$padded_function_name --> $short_file_name:$line_no"
done
diff --git a/lib/functions/logging/traps.sh b/lib/functions/logging/traps.sh
index 7891db338..f403547c9 100644
--- a/lib/functions/logging/traps.sh
+++ b/lib/functions/logging/traps.sh
@@ -44,8 +44,7 @@ unmount_on_exit() {
# added by main_default_build_single to show details about errors when they happen and exit. exit might trigger the above.
function main_error_monitor() {
if [[ "${ALREADY_EXITING_WITH_ERROR}" == "yes" ]]; then
- display_alert "second run detected" "ERR trap" "err"
- #exit 46
+ return 46
fi
local errcode="${1}"
# If there's no error, do nothing.
@@ -61,7 +60,6 @@ function main_error_monitor() {
display_alert "main_error_monitor: error code ${errcode}" "\n${stack_caller}\n" "err"
ALREADY_EXITING_WITH_ERROR=yes
- trap - EXIT # remove EXIT trap, we're gonna exit...
exit 45
return 44
}
From 5022af1c97af824af73d6e79bee988a3bf3773d1 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 12 Feb 2022 21:50:37 +0100
Subject: [PATCH] armbian-next: fixes for early error handling and logging
- split stacktrace-related functions into their own lib file
- simplify the traps
- some stacktrace formatting for readability
---
compile.sh | 3 ++-
lib/extensions.sh | 45 ------------------------------------
lib/functions/logging/stacktraces.sh | 45 ++++++++++++++++++++++++++++++++++++
lib/functions/logging/traps.sh | 8 +++----
lib/library-functions.sh | 10 ++++++++
5 files changed, 60 insertions(+), 51 deletions(-)
diff --git a/compile.sh b/compile.sh
index 5e92ddefe..3a5052989 100755
--- a/compile.sh
+++ b/compile.sh
@@ -15,6 +15,7 @@
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -e
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
# Important, go read http://mywiki.wooledge.org/BashFAQ/105 NOW!
@@ -39,7 +40,7 @@ fi
source "${SRC}"/lib/single.sh
# hook up the error handler early, we wanna see stack for all errors.
-trap 'main_error_monitor "$?" "$(show_caller_full)" "$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}")"' ERR EXIT
+trap 'main_error_monitor "$?"' ERR EXIT
# And execute the main entrypoint.
cli_entrypoint "$@"
diff --git a/lib/extensions.sh b/lib/extensions.sh
index c9f9cc9c4..737656a38 100644
--- a/lib/extensions.sh
+++ b/lib/extensions.sh
@@ -314,51 +314,6 @@ write_hook_point_metadata() {
echo "${main_hook_point_name}" >> "${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt"
}
-# Helper function, to get clean "stack traces" that do not include the hook/extension infrastructure code.
-get_extension_hook_stracktrace() {
- local sources_str="$1" # Give this ${BASH_SOURCE[*]} - expanded
- local lines_str="$2" # And this # Give this ${BASH_LINENO[*]} - expanded
- local sources lines index final_stack=""
- IFS=' ' read -r -a sources <<< "${sources_str}"
- IFS=' ' read -r -a lines <<< "${lines_str}"
- for index in "${!sources[@]}"; do
- local source="${sources[index]}" line="${lines[((index - 1))]}"
- # skip extension infrastructure sources, these only pollute the trace and add no insight to users
- [[ ${source} == */.tmp/extension_function_definition.sh ]] && continue
- [[ ${source} == *lib/extensions.sh ]] && continue
- [[ ${source} == *lib/functions/logging.sh ]] && continue
- [[ ${source} == */compile.sh ]] && continue
- [[ ${line} -lt 1 ]] && continue
- # relativize the source, otherwise too long to display
- source="${source#"${SRC}/"}"
- # remove 'lib/'. hope this is not too confusing.
- source="${source#"lib/functions/"}"
- source="${source#"lib/"}"
- # add to the list
- # shellcheck disable=SC2015 # i know. thanks. I won't write an if here
- arrow="$([[ "$final_stack" != "" ]] && echo "-> " || true)"
- final_stack="${source}:${line} ${arrow} ${final_stack} "
- done
- # output the result, no newline
- # shellcheck disable=SC2086 # I wanna suppress double spacing, thanks
- echo -n $final_stack
-}
-
-show_caller_full() {
- {
- local i=0
- local line_no
- local function_name
- local file_name
- echo "" # line break
- while caller $i; do
- ((i++))
- done | while read -r line_no function_name file_name; do
- echo -e "\t$file_name:$line_no\tat\t$function_name"
- done
- } || true # always success
-}
-
# can be called by board, family, config or user to make sure an extension is included.
# single argument is the extension name.
# will look for it in /userpatches/extensions first.
diff --git a/lib/functions/logging/stacktraces.sh b/lib/functions/logging/stacktraces.sh
new file mode 100644
index 000000000..a1c256bb5
--- /dev/null
+++ b/lib/functions/logging/stacktraces.sh
@@ -0,0 +1,45 @@
+# Helper function, to get clean "stack traces" that do not include the hook/extension infrastructure code.
+function get_extension_hook_stracktrace() {
+ local sources_str="$1" # Give this ${BASH_SOURCE[*]} - expanded
+ local lines_str="$2" # And this # Give this ${BASH_LINENO[*]} - expanded
+ local sources lines index final_stack=""
+ IFS=' ' read -r -a sources <<< "${sources_str}"
+ IFS=' ' read -r -a lines <<< "${lines_str}"
+ for index in "${!sources[@]}"; do
+ local source="${sources[index]}" line="${lines[((index - 1))]}"
+ # skip extension infrastructure sources, these only pollute the trace and add no insight to users
+ [[ ${source} == */extension_function_definition.sh ]] && continue
+ [[ ${source} == *lib/extensions.sh ]] && continue
+ [[ ${source} == *lib/functions/logging.sh ]] && continue
+ [[ ${source} == */compile.sh ]] && continue
+ [[ ${line} -lt 1 ]] && continue
+ # relativize the source, otherwise too long to display
+ source="${source#"${SRC}/"}"
+ # remove 'lib/'. hope this is not too confusing.
+ source="${source#"lib/functions/"}"
+ source="${source#"lib/"}"
+ # add to the list
+ # shellcheck disable=SC2015 # i know. thanks. I won't write an if here
+ arrow="$([[ "$final_stack" != "" ]] && echo "-> " || true)"
+ final_stack="${source}:${line} ${arrow} ${final_stack} "
+ done
+ # output the result, no newline
+ # shellcheck disable=SC2086 # I wanna suppress double spacing, thanks
+ echo -n $final_stack
+}
+
+function show_caller_full() {
+ {
+ local i=1 # skip the first frame
+ local line_no
+ local function_name
+ local file_name
+ while caller $i; do
+ ((i++))
+ done | while read -r line_no function_name file_name; do
+ local padded_function_name=$(printf "%20s" "$function_name")
+ local short_file_name="${file_name/"${SRC}/"/"./"}"
+ echo -e "$padded_function_name --> $short_file_name:$line_no"
+ done
+ } || true # always success
+}
diff --git a/lib/functions/logging/traps.sh b/lib/functions/logging/traps.sh
index faf9d8192..7891db338 100644
--- a/lib/functions/logging/traps.sh
+++ b/lib/functions/logging/traps.sh
@@ -47,23 +47,21 @@ function main_error_monitor() {
display_alert "second run detected" "ERR trap" "err"
#exit 46
fi
- #trap - ERR # remove this trap
local errcode="${1}"
# If there's no error, do nothing.
if [[ $errcode -eq 0 ]]; then
return 0
fi
- local stack_caller="${2}"
- local full_stack_caller="${3}"
+ local stack_caller="$(show_caller_full)"
if [[ "${ALREADY_EXITING_WITH_ERROR}" != "yes" ]]; then # Don't do this is exit_with_error already did it.
local logfile_to_show="${CURRENT_LOGFILE}" # store it
unset CURRENT_LOGFILE # stop logging, otherwise crazy
logging_error_show_log "main_error_monitor unknown error" "main_error_monitor unknown highlight" "${stack_caller}" "${logfile_to_show}"
fi
- display_alert "main_error_monitor: ${errcode}! stack:" "${stack_caller}" "err"
- display_alert "main_error_monitor: ${errcode}! full:" "${full_stack_caller}" "err"
+ display_alert "main_error_monitor: error code ${errcode}" "\n${stack_caller}\n" "err"
ALREADY_EXITING_WITH_ERROR=yes
+ trap - EXIT # remove EXIT trap, we're gonna exit...
exit 45
return 44
}
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index f7a679dcc..00f05c37a 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -307,6 +307,15 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/logging/runners.sh
source "${SRC}"/lib/functions/logging/runners.sh
+# no errors tolerated. invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/logging/stacktraces.sh
+# shellcheck source=lib/functions/logging/stacktraces.sh
+source "${SRC}"/lib/functions/logging/stacktraces.sh
+
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
@@ -424,6 +433,7 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/rootfs/rootfs-desktop.sh
source "${SRC}"/lib/functions/rootfs/rootfs-desktop.sh
+
# no errors tolerated. one last time for the win!
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
From a94d0cf61be12647c9ce5ce05440b6fe44b53cb4 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 12 Feb 2022 21:45:05 +0100
Subject: [PATCH] armbian-next: fix: don't `trap` `ERR` twice, it causes bash
to go bananas regarding `caller`
---
lib/extensions.sh | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/lib/extensions.sh b/lib/extensions.sh
index 8b7ba183c..c9f9cc9c4 100644
--- a/lib/extensions.sh
+++ b/lib/extensions.sh
@@ -420,29 +420,12 @@ enable_extension() {
# store a list of existing functions at this point, before sourcing the extension.
before_function_list="$(compgen -A function)"
- # error handling during a 'source' call is quite insane in bash after 4.3.
- # to be able to catch errors in sourced scripts the only way is to trap
- declare -i extension_source_generated_error=0
- trap 'extension_source_generated_error=1;' ERR
-
- # source the file. extensions are not supposed to do anything except export variables and define functions, so nothing should happen here.
- # there is no way to enforce it though, short of static analysis.
- # we could punish the extension authors who violate it by removing some essential variables temporarily from the environment during this source, and restore them later.
# shellcheck disable=SC1090
source "${extension_file}"
- # remove the trap we set.
- trap - ERR
-
# decrement the recurse counter, so calls to this method are allowed again.
enable_extension_recurse_counter=$((enable_extension_recurse_counter - 1))
- # test if it fell into the trap, and abort immediately with an error.
- if [[ $extension_source_generated_error != 0 ]]; then
- display_alert "Extension failed to load" "${extension_file}" "err"
- exit 4
- fi
-
# get a new list of functions after sourcing the extension
after_function_list="$(compgen -A function)"
From 54ce1b35ffac8eb5933a147b264352ac7ceb026a Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 12 Feb 2022 17:01:00 +0100
Subject: [PATCH] armbian-next: `UPSTEM_VER` -> `UBOOT_REPO_VERSION` and
related fixes
---
lib/functions/image/loop.sh | 4 ++--
lib/functions/image/rootfs-to-image.sh | 6 ++----
lib/functions/multi/build-all.sh | 2 +-
lib/functions/rootfs/distro-agnostic.sh | 2 +-
4 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/lib/functions/image/loop.sh b/lib/functions/image/loop.sh
index 296697b44..97ee1891e 100644
--- a/lib/functions/image/loop.sh
+++ b/lib/functions/image/loop.sh
@@ -34,8 +34,8 @@ write_uboot_to_loop_image() {
TEMP_DIR=$(mktemp -d) # set-e is in effect. no need to exit on errors explicitly
chmod 700 ${TEMP_DIR}
revision=${REVISION}
- if [[ -n $UPSTREM_VER ]]; then
- revision=${UPSTREM_VER}
+ if [[ -n $UBOOT_REPO_VERSION ]]; then
+ revision=${UBOOT_REPO_VERSION}
dpkg -x "${DEB_STORAGE}/linux-u-boot-${BOARD}-${BRANCH}_${revision}_${ARCH}.deb" ${TEMP_DIR}/ 2>&1
else
dpkg -x "${DEB_STORAGE}/${CHOSEN_UBOOT}_${revision}_${ARCH}.deb" ${TEMP_DIR}/ 2>&1
diff --git a/lib/functions/image/rootfs-to-image.sh b/lib/functions/image/rootfs-to-image.sh
index b39ab161a..898a7372b 100644
--- a/lib/functions/image/rootfs-to-image.sh
+++ b/lib/functions/image/rootfs-to-image.sh
@@ -66,10 +66,8 @@ create_image_from_sdcard_rootfs() {
# stage: write u-boot, unless the deb is not there, which would happen if BOOTCONFIG=none
# exception: if we use the one from repository, install version which was downloaded from repo
- if [[ -f "${DEB_STORAGE}"/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb ]]; then
- write_uboot $LOOP
- elif [[ "${UPSTREM_VER}" ]]; then
- write_uboot $LOOP
+ if [[ -f "${DEB_STORAGE}"/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb ]] || [[ -n $UBOOT_REPO_VERSION ]]; then
+ write_uboot_to_loop_image $LOOP
fi
# fix wrong / permissions
diff --git a/lib/functions/multi/build-all.sh b/lib/functions/multi/build-all.sh
index 5f33ecffa..5f8496157 100644
--- a/lib/functions/multi/build-all.sh
+++ b/lib/functions/multi/build-all.sh
@@ -103,7 +103,7 @@ unset_all() {
REPOSITORY_UPDATE PACKAGE_LIST_RELEASE LOCAL_MIRROR COMPILE_ATF PACKAGE_LIST_BOARD PACKAGE_LIST_FAMILY PACKAGE_LIST_DESKTOP_BOARD \
PACKAGE_LIST_DESKTOP_FAMILY ATF_COMPILE ATFPATCHDIR OFFSET BOOTSOURCEDIR KERNEL_VERSION_LEVEL KERNELSOURCENAME \
BOOT_SOC DDR_BLOB MINILOADER_BLOB BL31_BLOB BOOT_SCENARIO BOOT_SUPPORT_SPI OFFLINE_WORK VAR_SHALLOW_ORIGINAL KERNELSWITCHOBJ \
- IMAGE_PARTITION_TABLE BOOT_LOGO UPSTREM_VER FORCED_MONTH_OFFSET PACKAGE_LIST_BOARD_REMOVE PACKAGE_LIST_FAMILY_REMOVE PACKAGE_LIST_DESKTOP \
+ IMAGE_PARTITION_TABLE BOOT_LOGO UBOOT_REPO_VERSION FORCED_MONTH_OFFSET PACKAGE_LIST_BOARD_REMOVE PACKAGE_LIST_FAMILY_REMOVE PACKAGE_LIST_DESKTOP \
PACKAGE_LIST_DESKTOP_BOARD_REMOVE PACKAGE_LIST_DESKTOP_FAMILY_REMOVE BOOTCONFIG_EDGE DESKTOP_ENVIRONMENT DESKTOP_ENVIRONMENT_CONFIG_NAME \
DESKTOP_APPGROUPS_SELECTED DESKTOP_APT_FLAGS_SELECTED DESKTOP_ENVIRONMENT_DIRPATH DESKTOP_ENVIRONMENT_PACKAGE_LIST_DIRPATH UBOOT_TARGET_MAP \
DESKTOP_ENVIRONMENT_DIRPATH DESKTOP_ENVIRONMENT_PACKAGE_LIST_DIRPATH DESKTOP_CONFIG_PREFIX DESKTOP_CONFIGS_DIR DESKTOP_APPGROUPS_DIR \
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index 31d7f4c62..7732a5b80 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -283,7 +283,7 @@ install_distribution_agnostic() {
install_deb_chroot "${DEB_STORAGE}/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb"
else
install_deb_chroot "linux-u-boot-${BOARD}-${BRANCH}" "remote" "yes"
- UPSTREM_VER=$(dpkg-deb -f "${SDCARD}"/var/cache/apt/archives/linux-u-boot-${BOARD}-${BRANCH}*_${ARCH}.deb Version)
+ UBOOT_REPO_VERSION=$(dpkg-deb -f "${SDCARD}"/var/cache/apt/archives/linux-u-boot-${BOARD}-${BRANCH}*_${ARCH}.deb Version)
fi
}
From e4d30f131db7f9ab15759e4fa7fe5f18117cccd6 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 12 Feb 2022 16:06:30 +0100
Subject: [PATCH] armbian-next: oops, fix some non-lib changes I missed, up to
revision ff4346c4682e260be3137a2301ac7a69b97c044d
---
.../deepin/armbian/create_desktop_package.sh | 2 +-
.../sources/families/include/rockchip64_common.inc | 31 ++++++++++++++++++----
config/sources/families/include/sunxi64_common.inc | 8 +++---
config/sources/families/include/sunxi_common.inc | 6 ++---
config/sources/families/jetson-nano.conf | 13 +++++----
config/sources/families/mvebu64.conf | 6 ++---
config/sources/families/odroidxu4.conf | 2 +-
config/sources/families/rk322x.conf | 4 +--
config/sources/families/rk35xx.conf | 23 +++++++---------
config/sources/families/rockchip64.conf | 2 +-
config/templates/config-example.conf | 2 +-
packages/armbian/builddeb | 5 ++--
12 files changed, 62 insertions(+), 42 deletions(-)
diff --git a/config/desktop/focal/environments/deepin/armbian/create_desktop_package.sh b/config/desktop/focal/environments/deepin/armbian/create_desktop_package.sh
index d25ffd974..78f4d23be 100755
--- a/config/desktop/focal/environments/deepin/armbian/create_desktop_package.sh
+++ b/config/desktop/focal/environments/deepin/armbian/create_desktop_package.sh
@@ -22,7 +22,7 @@ mkdir -p "${destination}"/usr/share/pixmaps/armbian
cp "${SRC}"/packages/blobs/desktop/icons/armbian.png "${destination}"/usr/share/pixmaps/armbian
#generate wallpaper list for background changer
-mkdir -p "${destination}"/usr/sharedeepin-background-properties
+mkdir -p "${destination}"/usr/share/deepin-background-properties
cat << EOF > "${destination}"/usr/share/deepin-background-properties/armbian.xml
<?xml version="1.0"?>
<!DOCTYPE wallpapers SYSTEM "deepin-wp-list.dtd">
diff --git a/config/sources/families/include/rockchip64_common.inc b/config/sources/families/include/rockchip64_common.inc
index a6cc52133..0f0000d26 100644
--- a/config/sources/families/include/rockchip64_common.inc
+++ b/config/sources/families/include/rockchip64_common.inc
@@ -15,18 +15,27 @@ BOOTPATCHDIR="u-boot-rockchip64"
PACKAGE_LIST_FAMILY="ethtool"
RKBIN_DIR="$SRC/cache/sources/rkbin-tools"
+
BOOT_SOC=$(expr $BOOTCONFIG : '.*\(rk[[:digit:]]\+.*\)_.*')
+CPUMIN=${CPUMIN:="408000"}
+
if [[ $BOOT_SOC == rk3399 ]]; then
- CPUMIN=${CPUMIN:="408000"}
CPUMAX=${CPUMAX:="2016000"}
-else # rk3308, rk3328
+elif [[ $BOOT_SOC == rk3328 || $BOOT_SOC == rk3308 ]]; then
- CPUMIN=${CPUMIN:="408000"}
CPUMAX=${CPUMAX:="1296000"}
+elif [[ "${BOOT_SOC}" == rk3566 ]]; then
+
+ CPUMAX=${CPUMAX:="1800000"}
+
+elif [[ "${BOOT_SOC}" == rk3568 ]]; then
+
+ CPUMAX=${CPUMAX:="1992000"}
+
fi
if [[ $BOOT_SOC == rk3328 ]]; then
@@ -50,6 +59,18 @@ elif [[ $BOOT_SOC == rk3399pro ]]; then
MINILOADER_BLOB='rk33/rk3399pro_miniloader_v1.26.bin'
BL31_BLOB='rk33/rk3399pro_bl31_v1.35.elf'
+elif [[ $BOOT_SOC == rk3566 ]]; then
+
+ BOOT_SCENARIO="${BOOT_SCENARIO:=spl-blobs}"
+ DDR_BLOB='rk35/rk3566_ddr_1056MHz_v1.10.bin'
+ BL31_BLOB='rk35/rk3568_bl31_v1.29.elf'
+
+elif [[ $BOOT_SOC == rk3568 ]]; then
+
+ BOOT_SCENARIO="${BOOT_SCENARIO:=spl-blobs}"
+ DDR_BLOB='rk35/rk3568_ddr_1560MHz_v1.10.bin'
+ BL31_BLOB='rk35/rk3568_bl31_v1.29.elf'
+
elif [[ $BOARD == rockpi-s ]]; then
BOOT_SCENARIO="${BOOT_SCENARIO:=only-blobs}"
@@ -274,8 +295,8 @@ family_tweaks_bsp() {
cat <<- EOF > "$destination"/etc/X11/xorg.conf.d/02-driver.conf
# set fbdev as default driver.
Section "Device"
- Identifier "NOGPU"
- Driver "fbdev"
+ Identifier "NOGPU"
+ Driver "fbdev"
EndSection
EOF
fi
diff --git a/config/sources/families/include/sunxi64_common.inc b/config/sources/families/include/sunxi64_common.inc
index 4c44d37bf..6a570b341 100644
--- a/config/sources/families/include/sunxi64_common.inc
+++ b/config/sources/families/include/sunxi64_common.inc
@@ -11,16 +11,16 @@ LINUXFAMILY=sunxi64
case $BRANCH in
- legacy) KERNEL_VERSION_LEVEL="5.4" ;;
+ legacy) KERNEL_VERSION_LEVEL="5.10" ;;
- current) KERNEL_VERSION_LEVEL="5.10" ;;
+ current) KERNEL_VERSION_LEVEL="5.15" ;;
- edge) KERNEL_VERSION_LEVEL="5.15" ;;
+ edge) KERNEL_VERSION_LEVEL="5.16" ;;
esac
case "$KERNEL_VERSION_LEVEL" in
- 5.10 | 5.15)
+ 5.10 | 5.15 | 5.16)
KERNELSOURCE=$MAINLINE_KERNEL_SOURCE
KERNELSOURCENAME='name=origin'
KERNELBRANCH="branch:linux-${KERNEL_VERSION_LEVEL}.y"
diff --git a/config/sources/families/include/sunxi_common.inc b/config/sources/families/include/sunxi_common.inc
index eabacf86b..c84c45186 100644
--- a/config/sources/families/include/sunxi_common.inc
+++ b/config/sources/families/include/sunxi_common.inc
@@ -12,9 +12,9 @@ GOVERNOR=ondemand
case $BRANCH in
- legacy) KERNEL_VERSION_LEVEL="5.4" ;;
- current) KERNEL_VERSION_LEVEL="5.10" ;;
- edge) KERNEL_VERSION_LEVEL="5.15" ;;
+ legacy) KERNEL_VERSION_LEVEL="5.10" ;;
+ current) KERNEL_VERSION_LEVEL="5.15" ;;
+ edge) KERNEL_VERSION_LEVEL="5.16" ;;
esac
diff --git a/config/sources/families/jetson-nano.conf b/config/sources/families/jetson-nano.conf
index 03717a673..fbc14d5af 100644
--- a/config/sources/families/jetson-nano.conf
+++ b/config/sources/families/jetson-nano.conf
@@ -1,11 +1,8 @@
ARCH=arm64
KERNEL_IMAGE_TYPE=Image
+BOOTCONFIG=none
ATF_COMPILE="no"
OFFSET=16
-BOOTDELAY=0
-BOOTBRANCH="tag:v2021.07"
-BOOTPATCHDIR="u-boot-rockchip64"
-UBOOT_TARGET_MAP=";;u-boot.bin"
CPUMIN=504000
CPUMAX=2132000
@@ -18,7 +15,9 @@ case $BRANCH in
KERNELSOURCE='https://github.com/150balbes/Jetson-Nano'
KERNELBRANCH='branch:4.9.201'
EXTRAWIFI="no"
- BOOT_FDT_FILE="tegra210-p3448-0000-p3449-0000-a02.dtb"
+ BOOT_FDT_FILE="none"
+ SRC_CMDLINE='console=ttyS0,115200n8 console=tty0 tegraid=21.1.2.0.0 ddr_die=4096M@2048M section=512M memtype=0 vpr_resize usb_port_owner_info=0 lane_owner_info=0 emc_max_dvfs=0 touch_id=0@63 video=tegrafb debug_uartport=lsport,4 earlyprintk=uart8250-32bit,0x70006000 maxcpus=4 usbcore.old_scheme_first=1 lp0_vec=0x1000@0xff780000 core_edp_mv=1075 core_edp_ma=4000 tegra_fbmem=0x800000@0x92ca9000 is_hdmi_initialised=1 earlycon=uart8250,mmio32,0x70006000 fbcon=map:0'
+ MODULES_INITRD="jetson-nano-legacy"
;;
current)
@@ -26,6 +25,7 @@ case $BRANCH in
KERNELPATCHDIR='media-'$BRANCH
LINUXFAMILY=media
LINUXCONFIG='linux-media-'$BRANCH
+ MODULES_INITRD="jetson-nano-current"
;;
edge)
@@ -34,6 +34,7 @@ case $BRANCH in
KERNELPATCHDIR='media-'$BRANCH
LINUXFAMILY=media
LINUXCONFIG='linux-media-'$BRANCH
+ MODULES_INITRD="jetson-nano-edge"
;;
esac
@@ -44,6 +45,8 @@ write_uboot_platform() {
family_tweaks() {
+ install -m 755 $SRC/packages/blobs/jetson/jetson.sh $SDCARD/etc/initramfs-tools/hooks/jetson.sh
+
if [[ $BRANCH == legacy ]]; then
install -m 755 $SRC/packages/blobs/jetson/tegra21x_xusb_firmware $SDCARD/lib/firmware/tegra21x_xusb_firmware
install -m 755 $SRC/packages/blobs/jetson/asound.conf.tegrahda $SDCARD/etc/asound.conf.tegrahda
diff --git a/config/sources/families/mvebu64.conf b/config/sources/families/mvebu64.conf
index 0a0979287..58d66ab98 100644
--- a/config/sources/families/mvebu64.conf
+++ b/config/sources/families/mvebu64.conf
@@ -1,6 +1,6 @@
enable_extension "marvell-tools"
ARCH=arm64
-BOOTBRANCH='branch:v2021.01'
+BOOTBRANCH='branch:v2022.01'
BOOTENV_FILE='mvebu64.txt'
ATFSOURCE='https://github.com/MarvellEmbeddedProcessors/atf-marvell'
ATFDIR='arm-trusted-firmware-espressobin'
@@ -36,12 +36,12 @@ case $BRANCH in
current)
- KERNELBRANCH='branch:linux-5.10.y'
+ KERNELBRANCH='branch:linux-5.15.y'
;;
edge)
- KERNELBRANCH='branch:linux-5.15.y'
+ KERNELBRANCH='branch:linux-5.16.y'
;;
esac
diff --git a/config/sources/families/odroidxu4.conf b/config/sources/families/odroidxu4.conf
index 76edb26d6..ee4a32af5 100644
--- a/config/sources/families/odroidxu4.conf
+++ b/config/sources/families/odroidxu4.conf
@@ -23,7 +23,7 @@ case $BRANCH in
;;
edge)
- KERNELBRANCH='branch:linux-5.15.y'
+ KERNELBRANCH='branch:linux-5.16.y'
;;
esac
diff --git a/config/sources/families/rk322x.conf b/config/sources/families/rk322x.conf
index 637527d36..1a8ba863f 100644
--- a/config/sources/families/rk322x.conf
+++ b/config/sources/families/rk322x.conf
@@ -19,13 +19,13 @@ case $BRANCH in
current)
- KERNELBRANCH='branch:linux-5.10.y'
+ KERNELBRANCH='branch:linux-5.15.y'
;;
edge)
- KERNELBRANCH='branch:linux-5.15.y'
+ KERNELBRANCH='branch:linux-5.16.y'
;;
diff --git a/config/sources/families/rk35xx.conf b/config/sources/families/rk35xx.conf
index bdcf9c6a4..acc5ffc16 100644
--- a/config/sources/families/rk35xx.conf
+++ b/config/sources/families/rk35xx.conf
@@ -5,16 +5,6 @@ BOOTBRANCH='branch:stable-4.19-rock3'
BOOTPATCHDIR="u-boot-rk35xx"
OVERLAY_PREFIX='rk35xx'
-if [[ "${BOOT_SOC}" == rk3566 ]]; then
- CPUMAX=1800000
- DDR_BLOB='rk35/rk3566_ddr_1056MHz_v1.10.bin'
- BL31_BLOB='rk35/rk3568_bl31_v1.29.elf'
-elif [[ "${BOOT_SOC}" == rk3568 ]]; then
- CPUMAX=1992000
- DDR_BLOB='rk35/rk3568_ddr_1056MHz_v1.10.bin'
- BL31_BLOB='rk35/rk3568_bl31_v1.29.elf'
-fi
-
case $BRANCH in
legacy)
@@ -31,14 +21,19 @@ case $BRANCH in
;;
+ # temporary until kernel 5.16 is well supported for rockchip64
+ edge)
+ KERNELBRANCH="branch:linux-5.16.y"
+ KERNELPATCHDIR='rk35xx-'$BRANCH
+ SKIP_BOOTSPLASH="yes"
+ LINUXCONFIG='linux-rk35xx-'$BRANCH
+
+ ;;
+
esac
prepare_boot_configuration
-uboot_custom_postprocess() {
- tools/mkimage -n rk356x -T rksd -d $RKBIN_DIR/$DDR_BLOB:spl/u-boot-spl.bin idbloader.img
-}
-
family_tweaks_bsp() {
:
}
diff --git a/config/sources/families/rockchip64.conf b/config/sources/families/rockchip64.conf
index 729c47315..6790c35b7 100644
--- a/config/sources/families/rockchip64.conf
+++ b/config/sources/families/rockchip64.conf
@@ -3,9 +3,9 @@ source "${BASH_SOURCE%/*}/include/rockchip64_common.inc"
case $BRANCH in
legacy)
+ KERNELDIR='linux-rockchip64'
KERNELSOURCE='https://github.com/ayufan-rock64/linux-kernel'
KERNELBRANCH='tag:4.4.202-1237-rockchip-ayufan'
- KERNELDIR='linux-rockchip64'
KERNELPATCHDIR='rockchip64-'$BRANCH
;;
diff --git a/config/templates/config-example.conf b/config/templates/config-example.conf
index 41578ea32..b75e4b44b 100644
--- a/config/templates/config-example.conf
+++ b/config/templates/config-example.conf
@@ -19,6 +19,6 @@ DEST_LANG="en_US.UTF-8" # sl_SI.UTF-8, en_US.UTF-8
EXTERNAL_NEW="prebuilt" # compile and install or install prebuilt additional packages
INSTALL_HEADERS="" # install kernel headers package
LIB_TAG="master" # change to "branchname" to use any branch currently available.
-USE_TORRENT="yes" # use torrent network for faster toolchain and cache download
+USE_TORRENT="no" # use torrent network for faster toolchain and cache download
DOWNLOAD_MIRROR="" # set to "china" to use mirrors.tuna.tsinghua.edu.cn
CARD_DEVICE="" # device name /dev/sdx of your SD card to burn directly to the card when done
diff --git a/packages/armbian/builddeb b/packages/armbian/builddeb
index 0080bb87c..0209f3528 100755
--- a/packages/armbian/builddeb
+++ b/packages/armbian/builddeb
@@ -74,12 +74,13 @@ create_package() {
exit 0
EOT
- # for Ubuntu/Debian compatiblity, symlink in /lib/firmware/$version/device-tree
+ # for Ubuntu/Debian compatiblity, copy DTBs to /lib/firmware/$version/device-tree
cat >> $pdir/DEBIAN/postinst <<- EOT
cd /boot
ln -sfT dtb-$version dtb 2> /dev/null || mv dtb-$version dtb
mkdir -p /lib/firmware/$version
- [ ! -L /lib/firmware/$version/device-tree ] && ln -s /boot/dtb-$version /lib/firmware/$version/device-tree
+ rm -rf /lib/firmware/$version/device-tree
+ cp -rp /boot/dtb-$version /lib/firmware/$version/device-tree
exit 0
EOT
From 326548a2fb5909159b84ad75d11c714b4dbe42b3 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 12 Feb 2022 15:46:09 +0100
Subject: [PATCH] armbian-next: manual merge (9) of all lib/*.sh changes
between revisions 3b7f5b1f3418b7ad7a7c03f2af6d8da66f20bcb9 and
ff4346c4682e260be3137a2301ac7a69b97c044d
---
lib/functions/compilation/extra-drivers.sh | 26 ++++++++++++++------------
lib/functions/configuration/main-config.sh | 2 +-
lib/functions/image/partitioning.sh | 2 +-
lib/functions/image/rootfs-to-image.sh | 7 ++++++-
lib/functions/rootfs/distro-agnostic.sh | 10 +++++-----
5 files changed, 27 insertions(+), 20 deletions(-)
diff --git a/lib/functions/compilation/extra-drivers.sh b/lib/functions/compilation/extra-drivers.sh
index b466c940b..d41be6307 100644
--- a/lib/functions/compilation/extra-drivers.sh
+++ b/lib/functions/compilation/extra-drivers.sh
@@ -98,21 +98,20 @@ prepare_extra_kernel_drivers() {
# Linux splash file
#
- if linux-version compare "${version}" ge 5.8.10 && [ $SKIP_BOOTSPLASH != yes ]; then
+ if linux-version compare "${version}" ge 5.10 && [ $SKIP_BOOTSPLASH != yes ]; then
display_alert "Adding" "Kernel splash file" "info"
- if linux-version compare "${version}" ge 5.13; then
- process_patch_file "${SRC}/patch/misc/bootsplash-5.10.y-0001-Revert-vgacon-drop-unused-vga_init_done.patch" "applying"
- fi
+ process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0001-Revert-fbcon-Add-option-to-enable-legacy-hardware-ac.patch" "applying"
- process_patch_file "${SRC}/patch/misc/bootsplash-5.8.10-0001-Revert-vgacon-remove-software-scrollback-support.patch" "applying"
- process_patch_file "${SRC}/patch/misc/bootsplash-5.8.10-0002-Revert-fbcon-remove-now-unusued-softback_lines-curso.patch" "applying"
- if linux-version compare "${version}" ge 5.10; then
- process_patch_file "${SRC}/patch/misc/bootsplash-5.10.y-0003-Revert-fbcon-remove-soft-scrollback-code.patch" "applying"
- else
- process_patch_file "${SRC}/patch/misc/bootsplash-5.8.10-0003-Revert-fbcon-remove-soft-scrollback-code.patch" "applying"
+ if linux-version compare "${version}" ge 5.15; then
+ process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0002-Revert-vgacon-drop-unused-vga_init_done.patch" "applying"
fi
+ process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0003-Revert-vgacon-remove-software-scrollback-support.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0004-Revert-drivers-video-fbcon-fix-NULL-dereference-in-f.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0005-Revert-fbcon-remove-no-op-fbcon_set_origin.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0006-Revert-fbcon-remove-now-unusued-softback_lines-curso.patch" "applying"
+ process_patch_file "${SRC}/patch/misc/bootsplash-5.16.y-0007-Revert-fbcon-remove-soft-scrollback-code.patch" "applying"
process_patch_file "${SRC}/patch/misc/0001-bootsplash.patch" "applying"
process_patch_file "${SRC}/patch/misc/0002-bootsplash.patch" "applying"
@@ -159,6 +158,7 @@ prepare_extra_kernel_drivers() {
# manual overrides
if linux-version compare "${version}" ge 5.4.3 && linux-version compare "${version}" le 5.5; then aufstag="5.4.3"; fi
if linux-version compare "${version}" ge 5.10.82 && linux-version compare "${version}" le 5.11; then aufstag="5.10.82"; fi
+ if linux-version compare "${version}" ge 5.15.5 && linux-version compare "${version}" le 5.16; then aufstag="5.15.5"; fi
# check if Mr. Okajima already made a branch for this version
improved_git ls-remote --exit-code --heads https://github.com/sfjro/aufs5-standalone "aufs${aufstag}" > /dev/null
@@ -436,14 +436,16 @@ prepare_extra_kernel_drivers() {
# Wireless drivers for Realtek 8188EU 8188EUS and 8188ETV chipsets
- if linux-version compare "${version}" ge 3.14 && [ "$EXTRAWIFI" == yes ]; then
+ if linux-version compare "${version}" ge 3.14 &&
+ linux-version compare "${version}" lt 5.15 &&
+ [ "$EXTRAWIFI" == yes ]; then
# attach to specifics tag or branch
local rtl8188euver="branch:v5.7.6.1"
display_alert "Adding" "Wireless drivers for Realtek 8188EU 8188EUS and 8188ETV chipsets ${rtl8188euver}" "info"
- fetch_from_repo "https://github.com/aircrack-ng/rtl8188eus" "rtl8188eu" "${rtl8188euver}" "yes"
+ fetch_from_repo "$GITHUB_SOURCE/aircrack-ng/rtl8188eus" "rtl8188eu" "${rtl8188euver}" "yes"
cd "$kerneldir" || exit
rm -rf "$kerneldir/drivers/net/wireless/rtl8188eu"
mkdir -p "$kerneldir/drivers/net/wireless/rtl8188eu/"
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 1457e6bca..06eb888fd 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -63,7 +63,7 @@ function do_main_configuration() {
if [[ "${MAKE_FOLDERS}" == yes ]]; then
if [[ "$RC" == yes ]]; then
- FINALDEST=$DEST/images/"${BOARD}"/RC
+ FINALDEST=$DEST/images/"${BOARD}"/rc
elif [[ "$BETA" == yes ]]; then
FINALDEST=$DEST/images/"${BOARD}"/nightly
else
diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh
index b8b6e0595..0e075132a 100644
--- a/lib/functions/image/partitioning.sh
+++ b/lib/functions/image/partitioning.sh
@@ -351,7 +351,7 @@ prepare_partitions() {
# create extlinux config
if [[ -f $SDCARD/boot/extlinux/extlinux.conf ]]; then
- echo " APPEND root=$rootfs $SRC_CMDLINE $MAIN_CMDLINE" >> $SDCARD/boot/extlinux/extlinux.conf
+ echo " append root=$rootfs $SRC_CMDLINE $MAIN_CMDLINE" >> $SDCARD/boot/extlinux/extlinux.conf
[[ -f $SDCARD/boot/armbianEnv.txt ]] && rm $SDCARD/boot/armbianEnv.txt
fi
diff --git a/lib/functions/image/rootfs-to-image.sh b/lib/functions/image/rootfs-to-image.sh
index c0aace136..b39ab161a 100644
--- a/lib/functions/image/rootfs-to-image.sh
+++ b/lib/functions/image/rootfs-to-image.sh
@@ -65,7 +65,12 @@ create_image_from_sdcard_rootfs() {
display_alert "Mount point" "$(echo -e "$freespace" | grep $MOUNT | head -1 | awk '{print $5}')" "info"
# stage: write u-boot, unless the deb is not there, which would happen if BOOTCONFIG=none
- [[ -f "${DEB_STORAGE}"/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb ]] && write_uboot_to_loop_image $LOOP
+ # exception: if we use the one from repository, install version which was downloaded from repo
+ if [[ -f "${DEB_STORAGE}"/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb ]]; then
+ write_uboot $LOOP
+ elif [[ "${UPSTREM_VER}" ]]; then
+ write_uboot $LOOP
+ fi
# fix wrong / permissions
chmod 755 $MOUNT
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index e3c9e41aa..31d7f4c62 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -154,16 +154,16 @@ install_distribution_agnostic() {
if [[ $SRC_EXTLINUX == yes ]]; then
mkdir -p $SDCARD/boot/extlinux
cat <<- EOF > "$SDCARD/boot/extlinux/extlinux.conf"
- LABEL ${VENDOR}
- LINUX /boot/$NAME_KERNEL
- INITRD /boot/$NAME_INITRD
+ label ${VENDOR}
+ kernel /boot/$NAME_KERNEL
+ initrd /boot/$NAME_INITRD
EOF
if [[ -n $BOOT_FDT_FILE ]]; then
if [[ $BOOT_FDT_FILE != "none" ]]; then
- echo " FDT /boot/dtb/$BOOT_FDT_FILE" >> "$SDCARD/boot/extlinux/extlinux.conf"
+ echo " fdt /boot/dtb/$BOOT_FDT_FILE" >> "$SDCARD/boot/extlinux/extlinux.conf"
fi
else
- echo " FDTDIR /boot/dtb/" >> "$SDCARD/boot/extlinux/extlinux.conf"
+ echo " fdtdir /boot/dtb/" >> "$SDCARD/boot/extlinux/extlinux.conf"
fi
else
From 8180b79f136be27a79d225ade02faa823012923f Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 12 Feb 2022 10:18:32 +0100
Subject: [PATCH] armbian-next: more error handling fixes. avoid shortcircuits.
- store previous error message in `MSG_IF_ERROR` (still to be actually shown somewhere during error)
---
lib/functions/compilation/atf.sh | 2 +-
lib/functions/compilation/uboot.sh | 10 ++++------
lib/functions/image/partitioning.sh | 19 ++++++++++---------
lib/functions/rootfs/apt.sh | 5 ++---
lib/functions/rootfs/create-cache.sh | 31 +++++++++++--------------------
lib/functions/rootfs/distro-agnostic.sh | 5 +----
6 files changed, 29 insertions(+), 43 deletions(-)
diff --git a/lib/functions/compilation/atf.sh b/lib/functions/compilation/atf.sh
index 91ca8aaf1..857c1744f 100644
--- a/lib/functions/compilation/atf.sh
+++ b/lib/functions/compilation/atf.sh
@@ -51,7 +51,7 @@ compile_atf() {
# Check: https://github.com/armbian/build/issues/1157
CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${toolchain2}:${PATH}" \
make ENABLE_BACKTRACE="0" $target_make $CTHREADS \
- CROSS_COMPILE="$CCACHE $ATF_COMPILER" 2>&1 || {
+ CROSS_COMPILE="$CCACHE $ATF_COMPILER" 2>&1 || { # HANDLED SHORTCIRCUIT: direct command invocation; @TODO: replace with runner
exit_with_error "ATF compilation failed"
}
diff --git a/lib/functions/compilation/uboot.sh b/lib/functions/compilation/uboot.sh
index 188c062d6..ca56fbfa1 100644
--- a/lib/functions/compilation/uboot.sh
+++ b/lib/functions/compilation/uboot.sh
@@ -30,10 +30,9 @@ function compile_uboot_target() {
fi
display_alert "${uboot_prefix}Preparing u-boot config" "${version} ${target_make}" "info"
+ export MSG_IF_ERROR="${uboot_prefix}Failed to configure u-boot ${version} $BOOTCONFIG ${target_make}"
run_host_command_logged CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${toolchain2}:${PATH}" \
- make "$CTHREADS" "$BOOTCONFIG" "CROSS_COMPILE=\"$CCACHE $UBOOT_COMPILER\"" || {
- exit_with_error "${uboot_prefix}Failed to configure u-boot ${version} $BOOTCONFIG ${target_make}"
- }
+ make "$CTHREADS" "$BOOTCONFIG" "CROSS_COMPILE=\"$CCACHE $UBOOT_COMPILER\""
# armbian specifics u-boot settings
[[ -f .config ]] && sed -i 's/CONFIG_LOCALVERSION=""/CONFIG_LOCALVERSION="-armbian"/g' .config
@@ -66,9 +65,8 @@ function compile_uboot_target() {
[[ -n $UBOOT_TOOLCHAIN2 ]] && cross_compile="ARMBIAN=foe" # empty parameter is not allowed
display_alert "${uboot_prefix}Compiling u-boot" "${version} ${target_make}" "info"
- run_host_command_logged_long_running CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${toolchain2}:${PATH}" make "$target_make" "$CTHREADS" "${cross_compile}" || {
- exit_with_error "${uboot_prefix}Failed to build u-boot ${version} ${target_make}"
- }
+ export MSG_IF_ERROR="${uboot_prefix}Failed to build u-boot ${version} ${target_make}"
+ run_host_command_logged_long_running CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${toolchain2}:${PATH}" make "$target_make" "$CTHREADS" "${cross_compile}"
if [[ $(type -t uboot_custom_postprocess) == function ]]; then
display_alert "${uboot_prefix}Postprocessing u-boot" "${version} ${target_make}"
diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh
index 36683314d..b8b6e0595 100644
--- a/lib/functions/image/partitioning.sh
+++ b/lib/functions/image/partitioning.sh
@@ -199,22 +199,22 @@ prepare_partitions() {
parted -s ${SDCARD}.raw -- mkpart efi fat32 ${uefistart}s ${uefiend}s
parted -s ${SDCARD}.raw -- mkpart rootfs ${parttype[$ROOTFS_TYPE]} ${rootstart}s "100%"
# transpose so BIOS is in sda14; EFI is in sda15 and root in sda1; requires sgdisk, parted cant do numbers
- sgdisk --transpose 1:14 ${SDCARD}.raw &> /dev/null || echo "*** TRANSPOSE 1:14 FAILED"
- sgdisk --transpose 2:15 ${SDCARD}.raw &> /dev/null || echo "*** TRANSPOSE 2:15 FAILED"
- sgdisk --transpose 3:1 ${SDCARD}.raw &> /dev/null || echo "*** TRANSPOSE 3:1 FAILED"
+ sgdisk --transpose 1:14 ${SDCARD}.raw
+ sgdisk --transpose 2:15 ${SDCARD}.raw
+ sgdisk --transpose 3:1 ${SDCARD}.raw
# set the ESP (efi) flag on 15
- parted -s ${SDCARD}.raw -- set 14 bios_grub on || echo "*** SETTING bios_grub ON 14 FAILED"
- parted -s ${SDCARD}.raw -- set 15 esp on || echo "*** SETTING ESP ON 15 FAILED"
+ parted -s ${SDCARD}.raw -- set 14 bios_grub on
+ parted -s ${SDCARD}.raw -- set 15 esp on
else
display_alert "Creating partitions" "UEFI+rootfs (no BIOS)" "info"
# Simple EFI + root partition on GPT, no BIOS.
parted -s ${SDCARD}.raw -- mkpart efi fat32 ${bootstart}s ${bootend}s
parted -s ${SDCARD}.raw -- mkpart rootfs ${parttype[$ROOTFS_TYPE]} ${rootstart}s "100%"
# transpose so EFI is in sda15 and root in sda1; requires sgdisk, parted cant do numbers
- sgdisk --transpose 1:15 ${SDCARD}.raw &> /dev/null || echo "*** TRANSPOSE 1:15 FAILED"
- sgdisk --transpose 2:1 ${SDCARD}.raw &> /dev/null || echo "*** TRANSPOSE 2:1 FAILED"
+ sgdisk --transpose 1:15 ${SDCARD}.raw
+ sgdisk --transpose 2:1 ${SDCARD}.raw
# set the ESP (efi) flag on 15
- parted -s ${SDCARD}.raw -- set 15 esp on || echo "*** SETTING ESP ON 15 FAILED"
+ parted -s ${SDCARD}.raw -- set 15 esp on
fi
else
parted -s ${SDCARD}.raw -- mkpart primary fat32 ${bootstart}s ${bootend}s
@@ -238,7 +238,8 @@ prepare_partitions() {
exec {FD}> /var/lock/armbian-debootstrap-losetup
flock -x $FD
- export LOOP=$(losetup -f) || exit_with_error "Unable to find free loop device"
+ export LOOP
+ LOOP=$(losetup -f) || exit_with_error "Unable to find free loop device"
display_alert "Allocated loop device" "LOOP=${LOOP}" "wrn"
check_loop_device "$LOOP"
diff --git a/lib/functions/rootfs/apt.sh b/lib/functions/rootfs/apt.sh
index 29833851a..768636fc9 100644
--- a/lib/functions/rootfs/apt.sh
+++ b/lib/functions/rootfs/apt.sh
@@ -29,9 +29,8 @@ install_deb_chroot() {
[[ $BUILD_ALL == yes && ${variant} == remote ]] && chroot_sdcard_apt_get update
# install in chroot via apt-get, not dpkg, so dependencies are also installed from repo if needed.
- chroot_sdcard_apt_get --no-install-recommends install "${name}" || {
- exit_with_error "Installation of $name failed" "${BOARD} ${RELEASE} ${BUILD_DESKTOP} ${LINUXFAMILY}"
- }
+ export MSG_IF_ERROR="Installation of $name failed ${BOARD} ${RELEASE} ${BUILD_DESKTOP} ${LINUXFAMILY}"
+ chroot_sdcard_apt_get --no-install-recommends install "${name}"
# @TODO: mysterious. store installed/downloaded packages in deb storage. only used for u-boot deb. why?
[[ ${variant} == remote && ${transfer} == yes ]] && rsync -rq "${SDCARD}"/var/cache/apt/archives/*.deb "${DEB_STORAGE}"/
diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh
index c83cdaf99..acadbf6e3 100644
--- a/lib/functions/rootfs/create-cache.sh
+++ b/lib/functions/rootfs/create-cache.sh
@@ -126,9 +126,8 @@ function create_new_rootfs_cache() {
cp /usr/share/keyrings/*-archive-keyring.gpg "${SDCARD}/usr/share/keyrings/"
display_alert "Installing base system" "Stage 2/2" "info"
- chroot_sdcard LC_ALL=C LANG=C /debootstrap/debootstrap --second-stage 2>&1 || { # invoke inside chroot/qemu, stderr to stdout.
- exit_with_error "Debootstrap second stage failed" "${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL}"
- }
+ export MSG_IF_ERROR="Debootstrap second stage failed ${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL}"
+ chroot_sdcard LC_ALL=C LANG=C /debootstrap/debootstrap --second-stage
[[ ! -f "${SDCARD}/bin/bash" ]] && exit_with_error "Debootstrap first stage did not produce /bin/bash"
mount_chroot "${SDCARD}"
@@ -171,15 +170,11 @@ function create_new_rootfs_cache() {
# stage: update packages list
display_alert "Updating package list" "$RELEASE" "info"
- chroot_sdcard_apt_get update || {
- display_alert "Updating package lists" "failed" "wrn"
- }
+ chroot_sdcard_apt_get update
# stage: upgrade base packages from xxx-updates and xxx-backports repository branches
display_alert "Upgrading base packages" "Armbian" "info"
- chroot_sdcard_apt_get upgrade || {
- display_alert "Upgrading packages" "failed" "wrn"
- }
+ chroot_sdcard_apt_get upgrade
# Myy: Dividing the desktop packages installation steps into multiple
# ones. We first install the "ADDITIONAL_PACKAGES" in order to get
@@ -189,9 +184,8 @@ function create_new_rootfs_cache() {
# stage: install additional packages
display_alert "Installing the main packages for" "Armbian" "info"
- chroot_sdcard_apt_get_install "$PACKAGE_MAIN_LIST" || {
- exit_with_error "Installation of Armbian main packages for ${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL} failed"
- }
+ export MSG_IF_ERROR="Installation of Armbian main packages for ${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL} failed"
+ chroot_sdcard_apt_get_install "$PACKAGE_MAIN_LIST"
if [[ $BUILD_DESKTOP == "yes" ]]; then
# FIXME Myy : Are we keeping this only for Desktop users,
@@ -213,22 +207,19 @@ function create_new_rootfs_cache() {
fi
display_alert "Installing the desktop packages for" "Armbian" "info"
- chroot_sdcard_apt_get install ${apt_desktop_install_flags} $PACKAGE_LIST_DESKTOP || {
- exit_with_error "Installation of Armbian desktop packages for ${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL} failed"
- }
+ MSG_IF_ERROR="Installation of Armbian desktop packages for ${BRANCH} ${BOARD} ${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL} failed"
+ chroot_sdcard_apt_get install ${apt_desktop_install_flags} $PACKAGE_LIST_DESKTOP
fi
# Remove packages from packages.uninstall
display_alert "Uninstall packages" "$PACKAGE_LIST_UNINSTALL" "info"
# shellcheck disable=SC2086
- chroot_sdcard_apt_get purge $PACKAGE_LIST_UNINSTALL || exit_with_error "Un-Installation of packages failed"
+ chroot_sdcard_apt_get purge $PACKAGE_LIST_UNINSTALL
# stage: purge residual packages
display_alert "Purging residual packages for" "Armbian" "info"
PURGINGPACKAGES=$(chroot $SDCARD /bin/bash -c "dpkg -l | grep \"^rc\" | awk '{print \$2}' | tr \"\n\" \" \"")
- chroot_sdcard_apt_get remove --purge $PURGINGPACKAGES || {
- exit_with_error "Purging of residual Armbian packages failed"
- }
+ chroot_sdcard_apt_get remove --purge $PURGINGPACKAGES
# stage: remove downloaded packages
chroot_sdcard_apt_get autoremove
@@ -280,7 +271,7 @@ get_package_list_hash() {
local list_content
read -ra package_arr <<< "${DEBOOTSTRAP_LIST} ${PACKAGE_LIST}"
read -ra exclude_arr <<< "${PACKAGE_LIST_EXCLUDE}"
- (
+ (
(
printf "%s\n" "${package_arr[@]}"
printf -- "-%s\n" "${exclude_arr[@]}"
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index ef8c40720..e3c9e41aa 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -249,10 +249,7 @@ install_distribution_agnostic() {
_pkg_list=${PACKAGE_LIST_BOARD}
display_alert "Installing PACKAGE_LIST_BOARD packages" "${_pkg_list}"
# shellcheck disable=SC2086 # we need to expand.
- chroot_sdcard_apt_get_install ${_pkg_list} || {
- # exit_with_error will collaborate with logging to show the current log before exiting.
- exit_with_error "Failed to install PACKAGE_LIST_BOARD" "${_pkg_list}" "err"
- }
+ chroot_sdcard_apt_get_install ${_pkg_list}
fi
# remove family packages
From f549907b967be0199cb10b995f8aa3449e0de8ad Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 12 Feb 2022 09:17:38 +0100
Subject: [PATCH] armbian-next: more error handling fixes. avoid subshells,
shortcircuits, and pipes
- add `CFLAGS=-fdiagnostics-color=always` to kernel compile; would need also for u-boot soon
---
lib/functions/compilation/kernel.sh | 24 +++++++++++-------------
lib/functions/logging/logging.sh | 2 +-
lib/functions/logging/runners.sh | 31 +++++++++++++++++++------------
lib/functions/logging/traps.sh | 6 ++++++
4 files changed, 37 insertions(+), 26 deletions(-)
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index dc357ee93..e10c5af72 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -1,4 +1,5 @@
function run_kernel_make() {
+ set -e
declare -a common_make_params_quoted common_make_envs full_command
common_make_envs=(
@@ -19,6 +20,10 @@ function run_kernel_make() {
"CROSS_COMPILE=${CCACHE} ${KERNEL_COMPILER}" # Prefix for tool invocations.
)
+ #if [[ "${SHOW_LOG}" == "yes" ]]; then
+ common_make_params_quoted+=("KCFLAGS=-fdiagnostics-color=always") # Force GCC colored messages.
+ #fi
+
# last statement, so it passes the result to calling function.
full_command=("${KERNEL_MAKE_RUNNER:-run_host_command_logged}" "${common_make_envs[@]}" make "$@" "${common_make_params_quoted[@]@Q}")
display_alert "Kernel make" "${full_command[*]}" "debug"
@@ -34,7 +39,7 @@ function run_kernel_make_long_running() {
KERNEL_MAKE_RUNNER="run_host_command_logged_long_running" run_kernel_make "$@"
}
-compile_kernel() {
+function compile_kernel() {
if [[ $CLEAN_LEVEL == *make* ]]; then
display_alert "Cleaning" "$LINUXSOURCEDIR" "info"
(
@@ -140,9 +145,7 @@ compile_kernel() {
run_kernel_make silentoldconfig # This will exit with generic error if it fails.
else
# TODO: check if required
- run_kernel_make olddefconfig || {
- exit_with_error "Error kernel olddefconfig"
- }
+ run_kernel_make olddefconfig
fi
else
display_alert "Starting kernel oldconfig+menuconfig" "${LINUXCONFIG}" "debug"
@@ -150,9 +153,7 @@ compile_kernel() {
run_kernel_make oldconfig
# No logging for this. this is UI piece
- run_kernel_make_dialog "${KERNEL_MENUCONFIG:-menuconfig}" || {
- exit_with_error "Error kernel menuconfig failed"
- }
+ run_kernel_make_dialog "${KERNEL_MENUCONFIG:-menuconfig}"
# store kernel config in easily reachable place
display_alert "Exporting new kernel config" "$DEST/config/$LINUXCONFIG.config" "info"
@@ -177,9 +178,8 @@ compile_kernel() {
fi
display_alert "Compiling Kernel" "${LINUXCONFIG} ${KERNEL_IMAGE_TYPE}" "info"
- run_kernel_make_long_running "${KERNEL_IMAGE_TYPE}" modules "${KERNEL_EXTRA_TARGETS:-dtbs}" || {
- exit_with_error "Failure during kernel compile" "@host"
- }
+ run_kernel_make_long_running "${KERNEL_IMAGE_TYPE}" modules "${KERNEL_EXTRA_TARGETS:-dtbs}"
+ #run_kernel_make "${KERNEL_IMAGE_TYPE}" modules "${KERNEL_EXTRA_TARGETS:-dtbs}"
if [[ ! -f arch/$ARCHITECTURE/boot/$KERNEL_IMAGE_TYPE ]]; then
exit_with_error "Kernel was not built" "arch/$ARCHITECTURE/boot/$KERNEL_IMAGE_TYPE"
@@ -195,9 +195,7 @@ compile_kernel() {
display_alert "Creating kernel packages" "${LINUXCONFIG} $kernel_packaging_target" "info"
# produce deb packages: image, headers, firmware, dtb
- run_kernel_make_long_running $kernel_packaging_target || {
- exit_with_error "Failure during kernel packaging" "@host"
- }
+ run_kernel_make_long_running $kernel_packaging_target
display_alert "Package building done" "${LINUXCONFIG} $kernel_packaging_target" "info"
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index 90a376608..65ad6db33 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -97,7 +97,7 @@ function do_with_logging() {
return $exit_code
}
-display_alert() {
+function display_alert() {
# We'll be writing to stderr (" >&2"), so also write the message to the generic logfile, for context.
if [[ -f "${CURRENT_LOGFILE}" ]]; then
echo "--> A: [" "$@" "]" >> "${CURRENT_LOGFILE}"
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index 64f463648..9cf069834 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -24,7 +24,6 @@ function chroot_sdcard_with_stdout() {
TMPDIR="" chroot "${SDCARD}" "$@"
}
-
function chroot_custom_long_running() {
local target=$1
shift
@@ -56,15 +55,19 @@ function fakeroot_dpkg_deb_build() {
# the raw version is already redirect stderr to stdout, and we'll be running under do_with_logging,
# so: _the stdout must flow_!!!
function run_host_command_logged_long_running() {
- local _exit_code=1
- if [[ "${SHOW_LOG}" == "yes" ]] || [[ "${CI}" == "true" ]]; then
- run_host_command_logged_raw /bin/bash -e -c "$*"
- _exit_code=$?
- else
- run_host_command_logged_raw /bin/bash -e -c "$*" | pv -N "$(logging_echo_prefix_for_pv "${INDICATOR:-compile}") " --progress --timer --line-mode --force --cursor --delay-start 0 -i "2"
- _exit_code=$?
- fi
- return $_exit_code
+ # @TODO: disabled. The Pipe used for "pv" causes the left-hand side to run in a subshell.
+ #local _exit_code=1
+ #if [[ "${SHOW_LOG}" == "yes" ]] || [[ "${CI}" == "true" ]]; then
+ # run_host_command_logged_raw /bin/bash -e -c "$*"
+ # _exit_code=$?
+ #else
+ # run_host_command_logged_raw /bin/bash -e -c "$*" | pv -N "$(logging_echo_prefix_for_pv "${INDICATOR:-compile}") " --progress --timer --line-mode --force --cursor --delay-start 0 -i "2"
+ # _exit_code=$?
+ #fi
+ #return $_exit_code
+
+ # Run simple and exit with it's code. Sorry.
+ run_host_command_logged_raw /bin/bash -e -c "$*"
}
# run_host_command_logged is the very basic, should be used for everything, but, please use helpers above, this is very low-level.
@@ -88,15 +91,19 @@ function run_host_command_logged_raw() {
# uncomment when desperate to understand what's going on
# echo "cmd about to run" "$@" >&2
+ # In this case I wanna KNOW exactly what failed, thus disable errexit, then re-enable immediately after running.
+ set +e
local exit_code=666
"$@" 2>&1 # redirect stderr to stdout. $* is NOT $@!
exit_code=$?
+ set -e
if [[ -f "${CURRENT_LOGFILE}" ]]; then
echo "--> cmd exited with code ${exit_code} at $(date --utc)" >> "${CURRENT_LOGFILE}"
fi
if [[ $exit_code != 0 ]]; then
- display_alert "cmd exited with code ${exit_code}" "$*" "wrn"
- display_alert "stacktrace for failed command" "$(show_caller_full)" "wrn"
+ # This is very specific; remove CURRENT_LOGFILE's value when calling display_alert here otherwise logged twice.
+ CURRENT_LOGFILE="" display_alert "cmd exited with code ${exit_code}" "$*" "wrn"
+ CURRENT_LOGFILE="" display_alert "stacktrace for failed command" "$(show_caller_full)" "wrn"
fi
return $exit_code
}
diff --git a/lib/functions/logging/traps.sh b/lib/functions/logging/traps.sh
index 47878a0b0..faf9d8192 100644
--- a/lib/functions/logging/traps.sh
+++ b/lib/functions/logging/traps.sh
@@ -55,8 +55,14 @@ function main_error_monitor() {
fi
local stack_caller="${2}"
local full_stack_caller="${3}"
+ if [[ "${ALREADY_EXITING_WITH_ERROR}" != "yes" ]]; then # Don't do this is exit_with_error already did it.
+ local logfile_to_show="${CURRENT_LOGFILE}" # store it
+ unset CURRENT_LOGFILE # stop logging, otherwise crazy
+ logging_error_show_log "main_error_monitor unknown error" "main_error_monitor unknown highlight" "${stack_caller}" "${logfile_to_show}"
+ fi
display_alert "main_error_monitor: ${errcode}! stack:" "${stack_caller}" "err"
display_alert "main_error_monitor: ${errcode}! full:" "${full_stack_caller}" "err"
+
ALREADY_EXITING_WITH_ERROR=yes
exit 45
return 44
From 6e3a035ec4ba55378e61e0229fb0290f3b0cdf99 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 31 Jan 2022 20:03:34 +0100
Subject: [PATCH] WiP: indexing JSON into OpenSearch, all-hardcoded version
---
lib/tools/index-opensearch.py | 52 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/lib/tools/index-opensearch.py b/lib/tools/index-opensearch.py
new file mode 100755
index 000000000..b6b82a2d2
--- /dev/null
+++ b/lib/tools/index-opensearch.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python3
+import json
+import sys
+
+from opensearchpy import OpenSearch # pip install opensearch-py
+
+
+def eprint(*args, **kwargs):
+ print(*args, file=sys.stderr, **kwargs)
+
+
+# info = get_info_for_one_board(board, all_params)
+print(json.dumps({}, indent=4, sort_keys=True))
+
+eprint("Hello")
+
+# Read JSON from stdin
+# - should be array of objects
+# - loop over array and index each obj into OS in to the passed index
+# read_from_stdin = sys.stdin.read()
+
+json_object = json.load(sys.stdin)
+
+eprint("Loaded {} objects from stdin...".format(len(json_object)))
+
+host = '192.168.66.55'
+port = 31920
+
+# Create the OpenSearch client.
+client = OpenSearch(hosts=[{'host': host, 'port': port}], http_compress=False, use_ssl=False)
+
+# Create an index with non-default settings.
+index_name = 'board-vars-build'
+index_body = {'settings': {'index': {'number_of_shards': 1, 'number_of_replicas': 0}}}
+
+# Delete the index; remove old data.
+try:
+ response = client.indices.delete(index=index_name)
+ print('\nDeleting index:')
+ print(response)
+except:
+ eprint("Failed to delete index {}".format(index_name))
+
+response = client.indices.create(index_name, body=index_body)
+print('\nCreating index:')
+print(response)
+
+for obj in json_object:
+ # print(obj)
+ response = client.index(index=index_name, body=obj, refresh=True)
+ print('\nAdding document:')
+ print(response)
From a1e81b3a46d9511962246ff6852ae9549b154fb9 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 6 Feb 2022 01:57:09 +0100
Subject: [PATCH] rpi: add DTB symlink in Debian/Ubuntu standard location
/lib/firmware/$version/device-tree; remove build-time-only hacks
- this allows us to remove the most horrible hack
- should allow for correctly working DTB upgrades
- should NOT impact other families, although a new symlink will be created, nothing uses it.
---
config/sources/families/bcm2711.conf | 9 +--------
packages/armbian/builddeb | 8 ++++++++
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/config/sources/families/bcm2711.conf b/config/sources/families/bcm2711.conf
index 0dc25fc3f..2198c490c 100644
--- a/config/sources/families/bcm2711.conf
+++ b/config/sources/families/bcm2711.conf
@@ -57,14 +57,7 @@ pre_flash_kernel__symlink_dtb_and_kernel() {
Kernel-Flavors: any
EOD
- ## @TODO: rpardini: a horrible hack. I'll sort this out together with overlays, later.
- local oneDTB dtbBase
- for oneDTB in "${MOUNT}"/boot/dtb/broadcom/*.dtb; do
- dtbBase=$(basename "${oneDTB}")
- cp "${MOUNT}"/boot/dtb/broadcom/"${dtbBase}" "${MOUNT}"/etc/flash-kernel/dtbs/"${dtbBase}"
- done
-
- rm -rf "${MOUNT}"/boot/dtb* || true
+ ## DTB compatibility has been moved to symlink done in packages/armbian/builddeb
# @TODO: rpardini: packaging could maybe already use the correct names? I can't figure out how.
ln -s ./Image "${MOUNT}"/boot/vmlinuz
diff --git a/packages/armbian/builddeb b/packages/armbian/builddeb
index 0163d401a..0080bb87c 100755
--- a/packages/armbian/builddeb
+++ b/packages/armbian/builddeb
@@ -74,14 +74,22 @@ create_package() {
exit 0
EOT
+ # for Ubuntu/Debian compatiblity, symlink in /lib/firmware/$version/device-tree
cat >> $pdir/DEBIAN/postinst <<- EOT
cd /boot
ln -sfT dtb-$version dtb 2> /dev/null || mv dtb-$version dtb
+ mkdir -p /lib/firmware/$version
+ [ ! -L /lib/firmware/$version/device-tree ] && ln -s /boot/dtb-$version /lib/firmware/$version/device-tree
exit 0
EOT
+ cat >> $pdir/DEBIAN/postrm <<- EOT
+ rm -rf /lib/firmware/$version
+ EOT
+
chmod 775 $pdir/DEBIAN/preinst
chmod 775 $pdir/DEBIAN/postinst
+ chmod 775 $pdir/DEBIAN/postrm
fi
# Create postinst prerm script for headers
From e665d2fb3e9a25b2e9e927e3749ff14065f29ffb Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 5 Feb 2022 23:37:01 +0100
Subject: [PATCH] rpi: fix: flash-kernel fix to ignore kernel 'flavour' for all
raspi's
---
config/sources/families/bcm2711.conf | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/sources/families/bcm2711.conf b/config/sources/families/bcm2711.conf
index 0a1322ac3..0dc25fc3f 100644
--- a/config/sources/families/bcm2711.conf
+++ b/config/sources/families/bcm2711.conf
@@ -52,8 +52,8 @@ pre_flash_kernel__symlink_dtb_and_kernel() {
mkdir -p "${MOUNT}"/etc/flash-kernel/dtbs
cat <<- EOD >> "${MOUNT}"/etc/flash-kernel/db
- # Armbian kernels have a different flavour than expected.
- Machine: ${FK__MACHINE_MODEL}
+ # Armbian kernels don't have a 'flavour'. Ignore flavors for all rpi revisions.
+ Machine: Raspberry Pi *
Kernel-Flavors: any
EOD
From acb9b1ee273bb16ab3a5caf47830f63a9eedef37 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 6 Feb 2022 14:19:04 +0100
Subject: [PATCH] armbian-next: don't try to remove packages that are not
installed to begin with
- much faster
- new chroot_sdcard_with_stdout() runner, without bash or any escaping.
---
lib/functions/logging/runners.sh | 6 ++++++
lib/functions/rootfs/distro-agnostic.sh | 13 ++++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index 82ea46dae..64f463648 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -19,6 +19,12 @@ function chroot_sdcard() {
TMPDIR="" run_host_command_logged_raw chroot "${SDCARD}" /bin/bash -e -c "$*"
}
+# This should be used if you need to capture the stdout produced by the command. It is NOT logged, and NOT run thru bash, and NOT quoted.
+function chroot_sdcard_with_stdout() {
+ TMPDIR="" chroot "${SDCARD}" "$@"
+}
+
+
function chroot_custom_long_running() {
local target=$1
shift
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index 5569580c1..ef8c40720 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -262,13 +262,20 @@ install_distribution_agnostic() {
chroot_sdcard_apt_get remove --auto-remove ${_pkg_list}
fi
- # remove board packages
+ # remove board packages. loop over the list to remove, check if they're actually installed, then remove individually.
if [[ -n ${PACKAGE_LIST_BOARD_REMOVE} ]]; then
_pkg_list=${PACKAGE_LIST_BOARD_REMOVE}
- display_alert "Removing PACKAGE_LIST_BOARD_REMOVE packages" "${_pkg_list}"
+ declare -a currently_installed_packages
+ # shellcheck disable=SC2207 # I wanna split, thanks.
+ currently_installed_packages=($(chroot_sdcard_with_stdout dpkg-query --show --showformat='${Package} '))
for PKG_REMOVE in ${_pkg_list}; do
- chroot_sdcard_apt_get remove --auto-remove "${PKG_REMOVE}"
+ # shellcheck disable=SC2076 # I wanna match literally, thanks.
+ if [[ " ${currently_installed_packages[*]} " =~ " ${PKG_REMOVE} " ]]; then
+ display_alert "Removing PACKAGE_LIST_BOARD_REMOVE package" "${PKG_REMOVE}"
+ chroot_sdcard_apt_get remove --auto-remove "${PKG_REMOVE}"
+ fi
done
+ unset currently_installed_packages
fi
# install u-boot
From c2a084f37049b0a3338e8f8bdf1e103539439c89 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 6 Feb 2022 12:42:25 +0100
Subject: [PATCH] armbian-next: don't try to enable systemd services for units
that don't exist
- those might be removed by a bsp extension, so check for existence before trying to enable
---
lib/functions/rootfs/distro-agnostic.sh | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index 3d8607de0..5569580c1 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -267,7 +267,7 @@ install_distribution_agnostic() {
_pkg_list=${PACKAGE_LIST_BOARD_REMOVE}
display_alert "Removing PACKAGE_LIST_BOARD_REMOVE packages" "${_pkg_list}"
for PKG_REMOVE in ${_pkg_list}; do
- chroot_sdcard_apt_get remove --auto-remove "${PKG_REMOVE}" 2>&1
+ chroot_sdcard_apt_get remove --auto-remove "${PKG_REMOVE}"
done
fi
@@ -414,14 +414,14 @@ install_distribution_agnostic() {
It allows implementors access to the rootfs (`${SDCARD}`) in its pristine state after packages are installed.
FAMILY_TWEAKS
- # enable additional services
- chroot_sdcard systemctl --no-reload enable armbian-firstrun.service || true
- chroot_sdcard systemctl --no-reload enable armbian-firstrun-config.service || true
- chroot_sdcard systemctl --no-reload enable armbian-zram-config.service || true
- chroot_sdcard systemctl --no-reload enable armbian-hardware-optimize.service || true
- chroot_sdcard systemctl --no-reload enable armbian-ramlog.service || true
- chroot_sdcard systemctl --no-reload enable armbian-resize-filesystem.service || true
- chroot_sdcard systemctl --no-reload enable armbian-hardware-monitor.service || true
+ # enable additional services, if they exist.
+ [[ -f "${SDCARD}"/lib/systemd/system/armbian-firstrun.service ]] && chroot_sdcard systemctl --no-reload enable armbian-firstrun.service
+ [[ -f "${SDCARD}"/lib/systemd/system/armbian-firstrun-config.service ]] && chroot_sdcard systemctl --no-reload enable armbian-firstrun-config.service
+ [[ -f "${SDCARD}"/lib/systemd/system/armbian-zram-config.service ]] && chroot_sdcard systemctl --no-reload enable armbian-zram-config.service
+ [[ -f "${SDCARD}"/lib/systemd/system/armbian-hardware-optimize.service ]] && chroot_sdcard systemctl --no-reload enable armbian-hardware-optimize.service
+ [[ -f "${SDCARD}"/lib/systemd/system/armbian-ramlog.service ]] && chroot_sdcard systemctl --no-reload enable armbian-ramlog.service
+ [[ -f "${SDCARD}"/lib/systemd/system/armbian-resize-filesystem.service ]] && chroot_sdcard systemctl --no-reload enable armbian-resize-filesystem.service
+ [[ -f "${SDCARD}"/lib/systemd/system/armbian-hardware-monitor.service ]] && chroot_sdcard systemctl --no-reload enable armbian-hardware-monitor.service
# copy "first run automated config, optional user configured"
cp "${SRC}"/packages/bsp/armbian_first_run.txt.template "${SDCARD}"/boot/armbian_first_run.txt.template
From 9291369c6d68660e9a43f43ee3fc94c8ad0fc774 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 6 Feb 2022 12:12:01 +0100
Subject: [PATCH] armbian-next: don't error/warn on failure to enable
bootsplash when systemd units missing
---
lib/functions/rootfs/boot_logo.sh | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/functions/rootfs/boot_logo.sh b/lib/functions/rootfs/boot_logo.sh
index 319ea1144..4b5e98aa9 100644
--- a/lib/functions/rootfs/boot_logo.sh
+++ b/lib/functions/rootfs/boot_logo.sh
@@ -108,10 +108,11 @@ function boot_logo() {
[[ -f "${SDCARD}"/boot/armbianEnv.txt ]] && grep -q '^bootlogo' "${SDCARD}"/boot/armbianEnv.txt &&
sed -i 's/^bootlogo.*/bootlogo=true/' "${SDCARD}"/boot/armbianEnv.txt || echo 'bootlogo=true' >> "${SDCARD}"/boot/armbianEnv.txt
[[ -f "${SDCARD}"/boot/boot.ini ]] && sed -i 's/^setenv bootlogo.*/setenv bootlogo "true"/' "${SDCARD}"/boot/boot.ini
+
+ # enable additional services. @TODO: rpardini: really wonder where do these come from?
+ chroot_sdcard "systemctl --no-reload enable bootsplash-ask-password-console.path || true"
+ chroot_sdcard "systemctl --no-reload enable bootsplash-hide-when-booted.service || true"
+ chroot_sdcard "systemctl --no-reload enable bootsplash-show-on-shutdown.service || true"
fi
- # enable additional services
- chroot_sdcard systemctl --no-reload enable bootsplash-ask-password-console.path || true
- chroot_sdcard systemctl --no-reload enable bootsplash-hide-when-booted.service || true
- chroot_sdcard systemctl --no-reload enable bootsplash-show-on-shutdown.service || true
return 0
}
From ee634ea265ad9947f4061cd3bc0ffdf7d83d3e78 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 6 Feb 2022 11:24:33 +0100
Subject: [PATCH] armbian-next: use indented HEREDOCS for all
call_extension_method's
---
lib/extensions.sh | 30 +++++++++++++++---------------
lib/functions/bsp/bsp-cli.sh | 8 ++++----
lib/functions/image/partitioning.sh | 22 +++++++++++-----------
lib/functions/image/rootfs-to-image.sh | 30 +++++++++++++++---------------
lib/functions/main/default-build.sh | 10 +++++-----
lib/functions/main/rootfs-image.sh | 8 ++++----
lib/functions/rootfs/customize.sh | 18 +++++++++---------
lib/functions/rootfs/distro-agnostic.sh | 28 ++++++++++++++--------------
lib/functions/rootfs/post-tweaks.sh | 10 +++++-----
9 files changed, 82 insertions(+), 82 deletions(-)
diff --git a/lib/extensions.sh b/lib/extensions.sh
index 516700bbb..8b7ba183c 100644
--- a/lib/extensions.sh
+++ b/lib/extensions.sh
@@ -275,21 +275,21 @@ run_after_build__999_finish_extension_manager() {
export defined_hook_point_functions hook_point_function_trace_sources
# eat our own dog food, pt2.
- call_extension_method "extension_metadata_ready" << 'EXTENSION_METADATA_READY'
-*meta-Meta time!*
-Implement this hook to work with/on the meta-data made available by the extension manager.
-Interesting stuff to process:
-- `"${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt"` contains a list of all hook points called, in order.
-- For each hook_point in the list, more files will have metadata about that hook point.
- - `${EXTENSION_MANAGER_TMP_DIR}/hook_point.orig.md` contains the hook documentation at the call site (inline docs), hopefully in Markdown format.
- - `${EXTENSION_MANAGER_TMP_DIR}/hook_point.compat` contains the compatibility names for the hooks.
- - `${EXTENSION_MANAGER_TMP_DIR}/hook_point.exports` contains _exported_ environment variables.
- - `${EXTENSION_MANAGER_TMP_DIR}/hook_point.vars` contains _all_ environment variables.
-- `${defined_hook_point_functions}` is a map of _all_ the defined hook point functions and their extension information.
-- `${hook_point_function_trace_sources}` is a map of all the hook point functions _that were really called during the build_ and their BASH_SOURCE information.
-- `${hook_point_function_trace_lines}` is the same, but BASH_LINENO info.
-After this hook is done, the `${EXTENSION_MANAGER_TMP_DIR}` will be removed.
-EXTENSION_METADATA_READY
+ call_extension_method "extension_metadata_ready" <<- 'EXTENSION_METADATA_READY'
+ *meta-Meta time!*
+ Implement this hook to work with/on the meta-data made available by the extension manager.
+ Interesting stuff to process:
+ - `"${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt"` contains a list of all hook points called, in order.
+ - For each hook_point in the list, more files will have metadata about that hook point.
+ - `${EXTENSION_MANAGER_TMP_DIR}/hook_point.orig.md` contains the hook documentation at the call site (inline docs), hopefully in Markdown format.
+ - `${EXTENSION_MANAGER_TMP_DIR}/hook_point.compat` contains the compatibility names for the hooks.
+ - `${EXTENSION_MANAGER_TMP_DIR}/hook_point.exports` contains _exported_ environment variables.
+ - `${EXTENSION_MANAGER_TMP_DIR}/hook_point.vars` contains _all_ environment variables.
+ - `${defined_hook_point_functions}` is a map of _all_ the defined hook point functions and their extension information.
+ - `${hook_point_function_trace_sources}` is a map of all the hook point functions _that were really called during the build_ and their BASH_SOURCE information.
+ - `${hook_point_function_trace_lines}` is the same, but BASH_LINENO info.
+ After this hook is done, the `${EXTENSION_MANAGER_TMP_DIR}` will be removed.
+ EXTENSION_METADATA_READY
# Move temporary log file over to final destination, and start writing to it instead (although 999 is pretty late in the game)
mv "${EXTENSION_MANAGER_LOG_FILE}" "${DEST}/${LOG_SUBPATH:-debug}/extensions.log"
diff --git a/lib/functions/bsp/bsp-cli.sh b/lib/functions/bsp/bsp-cli.sh
index a2c0adc58..a4e6db654 100644
--- a/lib/functions/bsp/bsp-cli.sh
+++ b/lib/functions/bsp/bsp-cli.sh
@@ -289,10 +289,10 @@ create_board_package() {
display_alert "Done with family_tweaks_bsp" "${LINUXFAMILY}" "debug"
fi
- call_extension_method "post_family_tweaks_bsp" << 'POST_FAMILY_TWEAKS_BSP'
-*family_tweaks_bsp overrrides what is in the config, so give it a chance to override the family tweaks*
-This should be implemented by the config to tweak the BSP, after the board or family has had the chance to.
-POST_FAMILY_TWEAKS_BSP
+ call_extension_method "post_family_tweaks_bsp" <<- 'POST_FAMILY_TWEAKS_BSP'
+ *family_tweaks_bsp overrrides what is in the config, so give it a chance to override the family tweaks*
+ This should be implemented by the config to tweak the BSP, after the board or family has had the chance to.
+ POST_FAMILY_TWEAKS_BSP
# add some summary to the image
fingerprint_image "${destination}/etc/armbian.txt"
diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh
index 4090d96e1..36683314d 100644
--- a/lib/functions/image/partitioning.sh
+++ b/lib/functions/image/partitioning.sh
@@ -68,10 +68,10 @@ prepare_partitions() {
UEFI_MOUNT_POINT=${UEFI_MOUNT_POINT:-/boot/efi}
UEFI_FS_LABEL="${UEFI_FS_LABEL:-ARMBIEFI}" # Should be always uppercase
- call_extension_method "pre_prepare_partitions" "prepare_partitions_custom" << 'PRE_PREPARE_PARTITIONS'
-*allow custom options for mkfs*
-Good time to change stuff like mkfs opts, types etc.
-PRE_PREPARE_PARTITIONS
+ call_extension_method "pre_prepare_partitions" "prepare_partitions_custom" <<- 'PRE_PREPARE_PARTITIONS'
+ *allow custom options for mkfs*
+ Good time to change stuff like mkfs opts, types etc.
+ PRE_PREPARE_PARTITIONS
# stage: determine partition configuration
if [[ -n $BOOTFS_TYPE ]]; then
@@ -117,13 +117,13 @@ PRE_PREPARE_PARTITIONS
export rootfs_size=$(du -sm $SDCARD/ | cut -f1) # MiB
display_alert "Current rootfs size" "$rootfs_size MiB" "info"
- call_extension_method "prepare_image_size" "config_prepare_image_size" << 'PREPARE_IMAGE_SIZE'
-*allow dynamically determining the size based on the $rootfs_size*
-Called after `${rootfs_size}` is known, but before `${FIXED_IMAGE_SIZE}` is taken into account.
-A good spot to determine `FIXED_IMAGE_SIZE` based on `rootfs_size`.
-UEFISIZE can be set to 0 for no UEFI partition, or to a size in MiB to include one.
-Last chance to set `USE_HOOK_FOR_PARTITION`=yes and then implement create_partition_table hook_point.
-PREPARE_IMAGE_SIZE
+ call_extension_method "prepare_image_size" "config_prepare_image_size" <<- 'PREPARE_IMAGE_SIZE'
+ *allow dynamically determining the size based on the $rootfs_size*
+ Called after `${rootfs_size}` is known, but before `${FIXED_IMAGE_SIZE}` is taken into account.
+ A good spot to determine `FIXED_IMAGE_SIZE` based on `rootfs_size`.
+ UEFISIZE can be set to 0 for no UEFI partition, or to a size in MiB to include one.
+ Last chance to set `USE_HOOK_FOR_PARTITION`=yes and then implement create_partition_table hook_point.
+ PREPARE_IMAGE_SIZE
if [[ -n $FIXED_IMAGE_SIZE && $FIXED_IMAGE_SIZE =~ ^[0-9]+$ ]]; then
display_alert "Using user-defined image size" "$FIXED_IMAGE_SIZE MiB" "info"
diff --git a/lib/functions/image/rootfs-to-image.sh b/lib/functions/image/rootfs-to-image.sh
index 8b89d6217..c0aace136 100644
--- a/lib/functions/image/rootfs-to-image.sh
+++ b/lib/functions/image/rootfs-to-image.sh
@@ -47,10 +47,10 @@ create_image_from_sdcard_rootfs() {
run_host_command_logged rsync -aHWXh --info=progress0,stats1 "$SDCARD/boot" "$MOUNT"
fi
- call_extension_method "pre_update_initramfs" "config_pre_update_initramfs" << 'PRE_UPDATE_INITRAMFS'
-*allow config to hack into the initramfs create process*
-Called after rsync has synced both `/root` and `/root` on the target, but before calling `update_initramfs`.
-PRE_UPDATE_INITRAMFS
+ call_extension_method "pre_update_initramfs" "config_pre_update_initramfs" <<- 'PRE_UPDATE_INITRAMFS'
+ *allow config to hack into the initramfs create process*
+ Called after rsync has synced both `/root` and `/root` on the target, but before calling `update_initramfs`.
+ PRE_UPDATE_INITRAMFS
# stage: create final initramfs
[[ -n $KERNELSOURCE ]] && {
@@ -82,10 +82,10 @@ PRE_UMOUNT_FINAL_IMAGE
[[ $ROOTFS_TYPE != nfs ]] && umount -l $MOUNT
[[ $CRYPTROOT_ENABLE == yes ]] && cryptsetup luksClose $ROOT_MAPPER
- call_extension_method "post_umount_final_image" "config_post_umount_final_image" << 'POST_UMOUNT_FINAL_IMAGE'
-*allow config to hack into the image after the unmount*
-Called after unmounting both `/root` and `/boot`.
-POST_UMOUNT_FINAL_IMAGE
+ call_extension_method "post_umount_final_image" "config_post_umount_final_image" <<- 'POST_UMOUNT_FINAL_IMAGE'
+ *allow config to hack into the image after the unmount*
+ Called after unmounting both `/root` and `/boot`.
+ POST_UMOUNT_FINAL_IMAGE
# to make sure its unmounted
while grep -Eq '(${MOUNT}|${DESTIMG})' /proc/mounts; do
@@ -179,13 +179,13 @@ POST_UMOUNT_FINAL_IMAGE
# Previously, post_build_image passed the .img path as an argument to the hook. Now its an ENV var.
export FINAL_IMAGE_FILE="${DESTIMG}/${version}.img"
- call_extension_method "post_build_image" << 'POST_BUILD_IMAGE'
-*custom post build hook*
-Called after the final .img file is built, before it is (possibly) written to an SD writer.
-- *NOTE*: this hook used to take an argument ($1) for the final image produced.
- - Now it is passed as an environment variable `${FINAL_IMAGE_FILE}`
-It is the last possible chance to modify `$CARD_DEVICE`.
-POST_BUILD_IMAGE
+ call_extension_method "post_build_image" <<- 'POST_BUILD_IMAGE'
+ *custom post build hook*
+ Called after the final .img file is built, before it is (possibly) written to an SD writer.
+ - *NOTE*: this hook used to take an argument ($1) for the final image produced.
+ - Now it is passed as an environment variable `${FINAL_IMAGE_FILE}`
+ It is the last possible chance to modify `$CARD_DEVICE`.
+ POST_BUILD_IMAGE
# move artefacts from temporally directory to its final destination
[[ -n $compression_type ]] && rm $DESTIMG/${version}.img
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index 00a11e47e..3e81d7cd5 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -126,11 +126,11 @@ main_default_build_single() {
display_alert "Done building image" "${BOARD}" "target-reached"
fi
- call_extension_method "run_after_build" << 'RUN_AFTER_BUILD'
-*hook for function to run after build, i.e. to change owner of `$SRC`*
-Really one of the last hooks ever called. The build has ended. Congratulations.
-- *NOTE:* this will run only if there were no errors during build process.
-RUN_AFTER_BUILD
+ call_extension_method "run_after_build" <<- 'RUN_AFTER_BUILD'
+ *hook for function to run after build, i.e. to change owner of `$SRC`*
+ Really one of the last hooks ever called. The build has ended. Congratulations.
+ - *NOTE:* this will run only if there were no errors during build process.
+ RUN_AFTER_BUILD
# Cleanup. Remove the WORKDIR, unset the TMPDIR
unset TMPDIR
diff --git a/lib/functions/main/rootfs-image.sh b/lib/functions/main/rootfs-image.sh
index 9996d4b94..e31c319fb 100644
--- a/lib/functions/main/rootfs-image.sh
+++ b/lib/functions/main/rootfs-image.sh
@@ -43,10 +43,10 @@ function build_rootfs_and_image() {
# stage: prepare basic rootfs: unpack cache or create from scratch
LOG_SECTION="get_or_create_rootfs_cache_chroot_sdcard" do_with_logging get_or_create_rootfs_cache_chroot_sdcard
- call_extension_method "pre_install_distribution_specific" "config_pre_install_distribution_specific" << 'PRE_INSTALL_DISTRIBUTION_SPECIFIC'
-*give config a chance to act before install_distribution_specific*
-Called after `create_rootfs_cache` (_prepare basic rootfs: unpack cache or create from scratch_) but before `install_distribution_specific` (_install distribution and board specific applications_).
-PRE_INSTALL_DISTRIBUTION_SPECIFIC
+ call_extension_method "pre_install_distribution_specific" "config_pre_install_distribution_specific" <<- 'PRE_INSTALL_DISTRIBUTION_SPECIFIC'
+ *give config a chance to act before install_distribution_specific*
+ Called after `create_rootfs_cache` (_prepare basic rootfs: unpack cache or create from scratch_) but before `install_distribution_specific` (_install distribution and board specific applications_).
+ PRE_INSTALL_DISTRIBUTION_SPECIFIC
# stage: install kernel and u-boot packages
# install distribution and board specific applications
diff --git a/lib/functions/rootfs/customize.sh b/lib/functions/rootfs/customize.sh
index 2dc59d712..5405b814f 100644
--- a/lib/functions/rootfs/customize.sh
+++ b/lib/functions/rootfs/customize.sh
@@ -3,11 +3,11 @@ customize_image() {
# for users that need to prepare files at host
[[ -f $USERPATCHES_PATH/customize-image-host.sh ]] && source "$USERPATCHES_PATH"/customize-image-host.sh
- call_extension_method "pre_customize_image" "image_tweaks_pre_customize" << 'PRE_CUSTOMIZE_IMAGE'
-*run before customize-image.sh*
-This hook is called after `customize-image-host.sh` is called, but before the overlay is mounted.
-It thus can be used for the same purposes as `customize-image-host.sh`.
-PRE_CUSTOMIZE_IMAGE
+ call_extension_method "pre_customize_image" "image_tweaks_pre_customize" <<- 'PRE_CUSTOMIZE_IMAGE'
+ *run before customize-image.sh*
+ This hook is called after `customize-image-host.sh` is called, but before the overlay is mounted.
+ It thus can be used for the same purposes as `customize-image-host.sh`.
+ PRE_CUSTOMIZE_IMAGE
cp "$USERPATCHES_PATH"/customize-image.sh "${SDCARD}"/tmp/customize-image.sh
chmod +x "${SDCARD}"/tmp/customize-image.sh
@@ -23,10 +23,10 @@ PRE_CUSTOMIZE_IMAGE
exit_with_error "customize-image.sh exited with error (rc: $CUSTOMIZE_IMAGE_RC)"
fi
- call_extension_method "post_customize_image" "image_tweaks_post_customize" << 'POST_CUSTOMIZE_IMAGE'
-*post customize-image.sh hook*
-Run after the customize-image.sh script is run, and the overlay is unmounted.
-POST_CUSTOMIZE_IMAGE
+ call_extension_method "post_customize_image" "image_tweaks_post_customize" <<- 'POST_CUSTOMIZE_IMAGE'
+ *post customize-image.sh hook*
+ Run after the customize-image.sh script is run, and the overlay is unmounted.
+ POST_CUSTOMIZE_IMAGE
return 0
}
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index 0f916b8e6..3d8607de0 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -283,10 +283,10 @@ install_distribution_agnostic() {
fi
}
- call_extension_method "pre_install_kernel_debs" << 'PRE_INSTALL_KERNEL_DEBS'
-*called before installing the Armbian-built kernel deb packages*
-It is not too late to `unset KERNELSOURCE` here and avoid kernel install.
-PRE_INSTALL_KERNEL_DEBS
+ call_extension_method "pre_install_kernel_debs" <<- 'PRE_INSTALL_KERNEL_DEBS'
+ *called before installing the Armbian-built kernel deb packages*
+ It is not too late to `unset KERNELSOURCE` here and avoid kernel install.
+ PRE_INSTALL_KERNEL_DEBS
# install kernel
[[ -n $KERNELSOURCE ]] && {
@@ -312,11 +312,11 @@ PRE_INSTALL_KERNEL_DEBS
fi
}
- call_extension_method "post_install_kernel_debs" << 'POST_INSTALL_KERNEL_DEBS'
-*allow config to do more with the installed kernel/headers*
-Called after packages, u-boot, kernel and headers installed in the chroot, but before the BSP is installed.
-If `KERNELSOURCE` is (still?) unset after this, Armbian-built firmware will not be installed.
-POST_INSTALL_KERNEL_DEBS
+ call_extension_method "post_install_kernel_debs" <<- 'POST_INSTALL_KERNEL_DEBS'
+ *allow config to do more with the installed kernel/headers*
+ Called after packages, u-boot, kernel and headers installed in the chroot, but before the BSP is installed.
+ If `KERNELSOURCE` is (still?) unset after this, Armbian-built firmware will not be installed.
+ POST_INSTALL_KERNEL_DEBS
# install board support packages
if [[ "${REPOSITORY_INSTALL}" != *bsp* ]]; then
@@ -408,11 +408,11 @@ POST_INSTALL_KERNEL_DEBS
display_alert "Done with family_tweaks" "$BOARD :: $LINUXFAMILY" "debug"
fi
- call_extension_method "post_family_tweaks" << 'FAMILY_TWEAKS'
-*customize the tweaks made by $LINUXFAMILY-specific family_tweaks*
-It is run after packages are installed in the rootfs, but before enabling additional services.
-It allows implementors access to the rootfs (`${SDCARD}`) in its pristine state after packages are installed.
-FAMILY_TWEAKS
+ call_extension_method "post_family_tweaks" <<- 'FAMILY_TWEAKS'
+ *customize the tweaks made by $LINUXFAMILY-specific family_tweaks*
+ It is run after packages are installed in the rootfs, but before enabling additional services.
+ It allows implementors access to the rootfs (`${SDCARD}`) in its pristine state after packages are installed.
+ FAMILY_TWEAKS
# enable additional services
chroot_sdcard systemctl --no-reload enable armbian-firstrun.service || true
diff --git a/lib/functions/rootfs/post-tweaks.sh b/lib/functions/rootfs/post-tweaks.sh
index c7cb23ea9..ec26f46af 100644
--- a/lib/functions/rootfs/post-tweaks.sh
+++ b/lib/functions/rootfs/post-tweaks.sh
@@ -6,10 +6,10 @@ post_debootstrap_tweaks() {
chroot "${SDCARD}" /bin/bash -c "dpkg-divert --quiet --local --rename --remove /sbin/start-stop-daemon"
rm -f "${SDCARD}"/usr/sbin/policy-rc.d "${SDCARD}/usr/bin/${QEMU_BINARY}"
- call_extension_method "post_post_debootstrap_tweaks" "config_post_debootstrap_tweaks" << 'POST_POST_DEBOOTSTRAP_TWEAKS'
-*run after removing diversions and qemu with chroot unmounted*
-Last chance to touch the `${SDCARD}` filesystem before it is copied to the final media.
-It is too late to run any chrooted commands, since the supporting filesystems are already unmounted.
-POST_POST_DEBOOTSTRAP_TWEAKS
+ call_extension_method "post_post_debootstrap_tweaks" "config_post_debootstrap_tweaks" <<- 'POST_POST_DEBOOTSTRAP_TWEAKS'
+ *run after removing diversions and qemu with chroot unmounted*
+ Last chance to touch the `${SDCARD}` filesystem before it is copied to the final media.
+ It is too late to run any chrooted commands, since the supporting filesystems are already unmounted.
+ POST_POST_DEBOOTSTRAP_TWEAKS
}
From cba342a0ce4843cf69144c11ea881e0ce0b6ba40 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 6 Feb 2022 14:39:49 +0100
Subject: [PATCH] armbian-next: manual merge (8) of all lib/*.sh changes
between revisions 1d499d9ac282d44d4fdb052e5f64fb902688c18f and
3b7f5b1f3418b7ad7a7c03f2af6d8da66f20bcb9
---
lib/functions/compilation/patching.sh | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/lib/functions/compilation/patching.sh b/lib/functions/compilation/patching.sh
index 0d32729ab..99cb31719 100644
--- a/lib/functions/compilation/patching.sh
+++ b/lib/functions/compilation/patching.sh
@@ -120,26 +120,28 @@ apply_patch_series() {
awk '$0 ~ /^+.*patch$/{print $2}' |
xargs -I % sh -c 'rm -f %'
- patch --batch --silent --no-backup-if-mismatch -p1 -N < $bzdir/"$p" > $err_pt 2>&1
+ patch --batch --silent --no-backup-if-mismatch -p1 -N < $bzdir/"$p" >> $err_pt 2>&1
flag=$?
case $flag in
0)
- printf "%-77s [\033[32m done \033[0m]\n" "${p}"
- printf "%-77s [ done ]\n" "${p}" >> "${DEST}"/debug/patching.log
+ printf "[\033[32m done \033[0m] %s\n" "${p}"
+ printf "[ done ] %s\n" "${p}" >> "${DEST}"/debug/patching.log
;;
1)
- printf "%-77s [\033[33m FAILED \033[0m]\n" "${p}"
- echo -e "For ${p} \t\tprocess exit [ $flag ]" >> "${DEST}"/debug/patching.log
+ printf "[\033[33m FAILED \033[0m] %s\n" "${p}"
+ echo -e "[ FAILED ] For ${p} \t\tprocess exit [ $flag ]" >> "${DEST}"/debug/patching.log
cat $err_pt >> "${DEST}"/debug/patching.log
;;
2)
- printf "%-77s [\033[31m Patch wrong \033[0m]\n" "${p}"
+ printf "[\033[31m Patch wrong \033[0m] %s\n" "${p}"
echo -e "Patch wrong ${p}\t\tprocess exit [ $flag ]" >> "${DEST}"/debug/patching.log
cat $err_pt >> "${DEST}"/debug/patching.log
;;
esac
+ echo "" > $err_pt
done
+ echo "" >> "${DEST}"/debug/patching.log
rm $err_pt
}
From b2b1fdf3dae9193072994369c7b5bac7318366eb Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 5 Feb 2022 22:05:21 +0100
Subject: [PATCH] armbian-next: manual merge (7) of all lib/*.sh changes
between revisions d885bfc97d908b09dddac06393c2987995704d0a and
1d499d9ac282d44d4fdb052e5f64fb902688c18f
---
lib/functions/compilation/extra-drivers.sh | 3 +--
lib/functions/configuration/main-config.sh | 22 ++++++++++++++++++++--
lib/functions/general/git.sh | 4 ++--
lib/functions/image/rootfs-to-image.sh | 14 --------------
lib/functions/main/default-build.sh | 6 ++++++
lib/functions/rootfs/distro-agnostic.sh | 5 +++--
lib/functions/rootfs/distro-specific.sh | 7 +++++++
7 files changed, 39 insertions(+), 22 deletions(-)
diff --git a/lib/functions/compilation/extra-drivers.sh b/lib/functions/compilation/extra-drivers.sh
index 7fb60c37c..b466c940b 100644
--- a/lib/functions/compilation/extra-drivers.sh
+++ b/lib/functions/compilation/extra-drivers.sh
@@ -552,9 +552,8 @@ prepare_extra_kernel_drivers() {
# Bluetooth support for Realtek 8822CS (hci_ver 0x8) chipsets
# For sunxi, these two patches are applied in a series.
- if linux-version compare "${version}" ge 5.11 && [[ "$LINUXFAMILY" != sunxi* ]] && [[ "$EXTRAWIFI" == yes ]]; then
+ if linux-version compare "${version}" ge 5.11 && [[ "$LINUXFAMILY" != sunxi* ]]; then
display_alert "Adding" "Bluetooth support for Realtek 8822CS (hci_ver 0x8) chipsets" "info"
-
process_patch_file "${SRC}/patch/misc/bluetooth-rtl8822cs-hci_ver-0x8.patch" "applying"
process_patch_file "${SRC}/patch/misc/Bluetooth-hci_h5-Add-power-reset-via-gpio-in-h5_btrt.patch" "applying"
fi
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 5f6a21b1a..1457e6bca 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -42,7 +42,7 @@ function do_main_configuration() {
[[ -z $EXIT_PATCHING_ERROR ]] && EXIT_PATCHING_ERROR="" # exit patching if failed
[[ -z $HOST ]] && HOST="$BOARD" # set hostname to the board
cd "${SRC}" || exit
- [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=13
+ [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=14
[[ -z "${CHROOT_CACHE_VERSION}" ]] && CHROOT_CACHE_VERSION=7
BUILD_REPOSITORY_URL=$(improved_git remote get-url $(improved_git remote 2> /dev/null | grep origin) 2> /dev/null)
BUILD_REPOSITORY_COMMIT=$(improved_git describe --match=d_e_a_d_b_e_e_f --always --dirty 2> /dev/null)
@@ -58,6 +58,21 @@ function do_main_configuration() {
REPO_CONFIG="aptly.conf"
fi
+ # image artefact destination with or without subfolder
+ FINALDEST=$DEST/images
+ if [[ "${MAKE_FOLDERS}" == yes ]]; then
+
+ if [[ "$RC" == yes ]]; then
+ FINALDEST=$DEST/images/"${BOARD}"/RC
+ elif [[ "$BETA" == yes ]]; then
+ FINALDEST=$DEST/images/"${BOARD}"/nightly
+ else
+ FINALDEST=$DEST/images/"${BOARD}"/archive
+ fi
+
+ install -d ${FINALDEST}
+ fi
+
# TODO: fixed name can't be used for parallel image building
ROOT_MAPPER="armbian-root"
@@ -87,7 +102,7 @@ function do_main_configuration() {
china)
[[ -z $USE_MAINLINE_GOOGLE_MIRROR ]] && [[ -z $MAINLINE_MIRROR ]] && MAINLINE_MIRROR=tuna
[[ -z $USE_GITHUB_UBOOT_MIRROR ]] && [[ -z $UBOOT_MIRROR ]] && UBOOT_MIRROR=gitee
- [[ -z $GITHUB_MIRROR ]] && GITHUB_MIRROR=fastgit
+ [[ -z $GITHUB_MIRROR ]] && GITHUB_MIRROR=cnpmjs
[[ -z $DOWNLOAD_MIRROR ]] && DOWNLOAD_MIRROR=china
;;
*) ;;
@@ -404,6 +419,9 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
if [[ "${ARCH}" == "amd64" ]]; then
UBUNTU_MIRROR='archive.ubuntu.com/ubuntu' # ports are only for non-amd64, of course.
+ if [[ -n ${CUSTOM_UBUNTU_MIRROR} ]]; then # ubuntu redirector doesn't work well on amd64
+ UBUNTU_MIRROR="${CUSTOM_UBUNTU_MIRROR}"
+ fi
fi
# don't use mirrors that throws garbage on 404
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index 6d0bda152..a02faa1f2 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -70,7 +70,7 @@ waiter_local_repo() {
mkdir -p $work_dir
cd $work_dir || exit_with_error
- display_alert "Checking git sources" "$dir $name/$branch" "info"
+ display_alert "Checking git sources" "$dir $url$name/$branch" "info"
if [ "$(git rev-parse --git-dir 2> /dev/null)" != ".git" ]; then
git init -q .
@@ -80,7 +80,7 @@ waiter_local_repo() {
(
$VAR_SHALLOW_ORIGINAL
- display_alert "Add original git sources" "$dir $name/$branch" "info"
+ display_alert "Add original git sources" "$dir $url$name/$branch" "info"
if [ "$(git ls-remote -h $url $branch |
awk -F'/' '{if (NR == 1) print $NF}')" != "$branch" ]; then
display_alert "Bad $branch for $url in $VAR_SHALLOW_ORIGINAL"
diff --git a/lib/functions/image/rootfs-to-image.sh b/lib/functions/image/rootfs-to-image.sh
index b62ad1f5c..8b89d6217 100644
--- a/lib/functions/image/rootfs-to-image.sh
+++ b/lib/functions/image/rootfs-to-image.sh
@@ -101,20 +101,6 @@ POST_UMOUNT_FINAL_IMAGE
mkdir -p $DESTIMG
mv ${SDCARD}.raw $DESTIMG/${version}.img
- FINALDEST=$DEST/images
- [[ "${BUILD_ALL}" == yes ]] && MAKE_FOLDERS="yes"
-
- if [[ "${MAKE_FOLDERS}" == yes ]]; then
- if [[ "$RC" == yes ]]; then
- FINALDEST=$DEST/images/"${BOARD}"/RC
- elif [[ "$BETA" == yes ]]; then
- FINALDEST=$DEST/images/"${BOARD}"/nightly
- else
- FINALDEST=$DEST/images/"${BOARD}"/archive
- fi
- install -d ${FINALDEST}
- fi
-
# custom post_build_image_modify hook to run before fingerprinting and compression
[[ $(type -t post_build_image_modify) == function ]] && display_alert "Custom Hook Detected" "post_build_image_modify" "info" && post_build_image_modify "${DESTIMG}/${version}.img"
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index 34aafb1d0..00a11e47e 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -101,6 +101,12 @@ main_default_build_single() {
LOG_SECTION="create_bsp_desktop_package" do_with_logging create_bsp_desktop_package
fi
+ # skip image creation if exists. useful for CI when making a lot of images
+ if [ "$IMAGE_PRESENT" == yes ] && ls "${FINALDEST}/${VENDOR}_${REVISION}_${BOARD^}_${RELEASE}_${BRANCH}_${VER/-$LINUXFAMILY/}${DESKTOP_ENVIRONMENT:+_$DESKTOP_ENVIRONMENT}"*.xz 1> /dev/null 2>&1; then
+ display_alert "Skipping image creation" "image already made - IMAGE_PRESENT is set" "wrn"
+ exit
+ fi
+
# build additional packages
if [[ $EXTERNAL_NEW == compile ]]; then
LOG_SECTION="chroot_build_packages" do_with_logging chroot_build_packages
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index d48879929..0f916b8e6 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -152,7 +152,6 @@ install_distribution_agnostic() {
# create extlinux config file @TODO: refactor into extensions u-boot, extlinux
if [[ $SRC_EXTLINUX == yes ]]; then
-
mkdir -p $SDCARD/boot/extlinux
cat <<- EOF > "$SDCARD/boot/extlinux/extlinux.conf"
LABEL ${VENDOR}
@@ -160,7 +159,9 @@ install_distribution_agnostic() {
INITRD /boot/$NAME_INITRD
EOF
if [[ -n $BOOT_FDT_FILE ]]; then
- echo " FDT /boot/dtb/$BOOT_FDT_FILE" >> "$SDCARD/boot/extlinux/extlinux.conf"
+ if [[ $BOOT_FDT_FILE != "none" ]]; then
+ echo " FDT /boot/dtb/$BOOT_FDT_FILE" >> "$SDCARD/boot/extlinux/extlinux.conf"
+ fi
else
echo " FDTDIR /boot/dtb/" >> "$SDCARD/boot/extlinux/extlinux.conf"
fi
diff --git a/lib/functions/rootfs/distro-specific.sh b/lib/functions/rootfs/distro-specific.sh
index 7ba7e19e7..4770af4bc 100644
--- a/lib/functions/rootfs/distro-specific.sh
+++ b/lib/functions/rootfs/distro-specific.sh
@@ -78,6 +78,13 @@ install_distribution_specific() {
chroot "${SDCARD}" /bin/bash -c "systemctl --no-reload mask ondemand.service >/dev/null 2>&1"
;;
esac
+
+ # use list modules INITRAMFS
+ if [ -f "${SRC}"/config/modules/"${MODULES_INITRD}" ]; then
+ display_alert "Use file list modules INITRAMFS" "${MODULES_INITRD}"
+ sed -i "s/^MODULES=.*/MODULES=list/" "${SDCARD}"/etc/initramfs-tools/initramfs.conf
+ cat "${SRC}"/config/modules/"${MODULES_INITRD}" >> "${SDCARD}"/etc/initramfs-tools/modules
+ fi
}
# create_sources_list <release> <basedir>
From b2849431e1736e9bae4eeddd3ef363a058352465 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 30 Jan 2022 22:21:50 +0100
Subject: [PATCH] armbian-next: manual merge (6) of all lib/*.sh changes
between revisions c7f3c239fe93f8fcfdd1b1edf6f11e143802e379 and
d885bfc97d908b09dddac06393c2987995704d0a
---
lib/functions/compilation/extra-drivers.sh | 4 ++--
lib/functions/compilation/patching.sh | 12 ++++++------
lib/functions/configuration/main-config.sh | 2 +-
lib/functions/general/git.sh | 8 ++------
lib/functions/rootfs/create-cache.sh | 3 ++-
5 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/lib/functions/compilation/extra-drivers.sh b/lib/functions/compilation/extra-drivers.sh
index d45913f32..7fb60c37c 100644
--- a/lib/functions/compilation/extra-drivers.sh
+++ b/lib/functions/compilation/extra-drivers.sh
@@ -551,8 +551,8 @@ prepare_extra_kernel_drivers() {
fi
# Bluetooth support for Realtek 8822CS (hci_ver 0x8) chipsets
-
- if linux-version compare "${version}" ge 5.11 && [ "$EXTRAWIFI" == yes ]; then
+ # For sunxi, these two patches are applied in a series.
+ if linux-version compare "${version}" ge 5.11 && [[ "$LINUXFAMILY" != sunxi* ]] && [[ "$EXTRAWIFI" == yes ]]; then
display_alert "Adding" "Bluetooth support for Realtek 8822CS (hci_ver 0x8) chipsets" "info"
process_patch_file "${SRC}/patch/misc/bluetooth-rtl8822cs-hci_ver-0x8.patch" "applying"
diff --git a/lib/functions/compilation/patching.sh b/lib/functions/compilation/patching.sh
index 861054de2..0d32729ab 100644
--- a/lib/functions/compilation/patching.sh
+++ b/lib/functions/compilation/patching.sh
@@ -106,8 +106,8 @@ apply_patch_series() {
local flag
local err_pt=$(mktemp /tmp/apply_patch_series_XXXXX) # @OTODO: rpardini: hmm, why is this different from all others?
- list=$(gawk '$0 !~ /^#.*|^-.*|^$/' "${series}")
- skiplist=$(gawk '$0 ~ /^-.*/' "${series}")
+ list=$(awk '$0 !~ /^#.*|^-.*|^$/' "${series}")
+ skiplist=$(awk '$0 ~ /^-.*/{print $NF}' "${series}")
display_alert "apply a series of " "[$(echo $list | wc -w)] patches"
display_alert "skip [$(echo $skiplist | wc -w)] patches"
@@ -125,16 +125,16 @@ apply_patch_series() {
case $flag in
0)
- printf "%-72s [\033[32m done \033[0m]\n" "${p#*/}"
- printf "%-72s [ done ]\n" "${p#*/}" >> "${DEST}"/debug/patching.log
+ printf "%-77s [\033[32m done \033[0m]\n" "${p}"
+ printf "%-77s [ done ]\n" "${p}" >> "${DEST}"/debug/patching.log
;;
1)
- printf "%-72s [\033[33m FAILED \033[0m]\n" "${p#*/}"
+ printf "%-77s [\033[33m FAILED \033[0m]\n" "${p}"
echo -e "For ${p} \t\tprocess exit [ $flag ]" >> "${DEST}"/debug/patching.log
cat $err_pt >> "${DEST}"/debug/patching.log
;;
2)
- printf "%-72s [\033[31m Patch wrong \033[0m]\n" "${p#*/}"
+ printf "%-77s [\033[31m Patch wrong \033[0m]\n" "${p}"
echo -e "Patch wrong ${p}\t\tprocess exit [ $flag ]" >> "${DEST}"/debug/patching.log
cat $err_pt >> "${DEST}"/debug/patching.log
;;
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 0acb3b671..5f6a21b1a 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -42,7 +42,7 @@ function do_main_configuration() {
[[ -z $EXIT_PATCHING_ERROR ]] && EXIT_PATCHING_ERROR="" # exit patching if failed
[[ -z $HOST ]] && HOST="$BOARD" # set hostname to the board
cd "${SRC}" || exit
- [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=12
+ [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=13
[[ -z "${CHROOT_CACHE_VERSION}" ]] && CHROOT_CACHE_VERSION=7
BUILD_REPOSITORY_URL=$(improved_git remote get-url $(improved_git remote 2> /dev/null | grep origin) 2> /dev/null)
BUILD_REPOSITORY_COMMIT=$(improved_git describe --match=d_e_a_d_b_e_e_f --always --dirty 2> /dev/null)
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index e4a03f278..6d0bda152 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -91,12 +91,8 @@ waiter_local_repo() {
# Handle an exception if the initial tag is the top of the branch
# As v5.16 == HEAD
- if $(
- git ls-remote -t $url ${start_tag}\* |
- awk -F'/' '$NF !~ /v[4-5][.][1-9]{1,2}[.][1]$/ {
- exit 1
- }'
- ); then
+ if [ "${start_tag}.1" == "$(git ls-remote -t $url ${start_tag}.1 |
+ awk -F'/' '{ print $NF }')" ]; then
git fetch --shallow-exclude=$start_tag $name
else
git fetch --depth 1 $name
diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh
index 13e2565fd..c83cdaf99 100644
--- a/lib/functions/rootfs/create-cache.sh
+++ b/lib/functions/rootfs/create-cache.sh
@@ -231,6 +231,7 @@ function create_new_rootfs_cache() {
}
# stage: remove downloaded packages
+ chroot_sdcard_apt_get autoremove
chroot_sdcard_apt_get clean
# DEBUG: print free space
@@ -260,7 +261,7 @@ function create_new_rootfs_cache() {
umount_chroot "$SDCARD"
tar cp --xattrs --directory=$SDCARD/ --exclude='./dev/*' --exclude='./proc/*' --exclude='./run/*' --exclude='./tmp/*' \
- --exclude='./sys/*' . | pv -p -b -r -s "$(du -sb $SDCARD/ | cut -f1)" -N "$(logging_echo_prefix_for_pv "store_rootfs") $display_name" | lz4 -5 -c > "$cache_fname"
+ --exclude='./sys/*' --exclude='./home/*' --exclude='./root/*' . | pv -p -b -r -s "$(du -sb $SDCARD/ | cut -f1)" -N "$(logging_echo_prefix_for_pv "store_rootfs") $display_name" | lz4 -5 -c > "$cache_fname"
# sign rootfs cache archive that it can be used for web cache once. Internal purposes
if [[ -n "${GPG_PASS}" && "${SUDO_USER}" ]]; then
From 4fcb0204e5df9bc6c540806096def9ce8e3126e1 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 24 Jan 2022 00:16:42 +0100
Subject: [PATCH] armbian-next: avoid writing to disk during configuration;
`ANSI_COLOR=none` logging; make CONFIG_DEFS_ONLY=yes runnable without sudo
- when `CONFIG_DEFS_ONLY=yes`, avoid writing the config summary output.log file.
- refactor that into a function as to be easy to if-out-of
- don't write to disk during aggregate_content() if `CONFIG_DEFS_ONLY=yes`
- don't write to disk during show_checklist_variables() if `CONFIG_DEFS_ONLY=yes`
- don't write to disk during write_deboostrap_list_debug_log() if `CONFIG_DEFS_ONLY=yes`
- don't compress and rotate logs if `CONFIG_DEFS_ONLY=yes`
- don't pretend to be handling errors we can't handle during var capture
- I foresee a world we can build all .debs without sudo
- and a some kind of split of codebase entrypoint due to that future feature
- some python info.py enhancements, not ready yet
---
lib/extensions.sh | 13 ++--
lib/functions/cli/cli-entrypoint.sh | 7 ++-
lib/functions/configuration/aggregation.sh | 2 +
lib/functions/configuration/main-config.sh | 39 +++++++-----
lib/functions/logging/capture.sh | 11 ++--
lib/functions/logging/logging.sh | 6 ++
lib/functions/main/config-prepare.sh | 32 +++++-----
lib/tools/info.py | 95 ++++++++++++++++++++++++------
8 files changed, 142 insertions(+), 63 deletions(-)
diff --git a/lib/extensions.sh b/lib/extensions.sh
index 5398de20f..516700bbb 100644
--- a/lib/extensions.sh
+++ b/lib/extensions.sh
@@ -61,13 +61,13 @@ initialize_extension_manager() {
# This marks the manager as initialized, no more extensions are allowed to load after this.
export initialize_extension_manager_counter=$((initialize_extension_manager_counter + 1))
- # Extensions has its own work/tmp directory, defined by do_main_configuration, with build UUID. We just create it here.
- display_alert "EXTENSION_MANAGER_TMP_DIR" "${EXTENSION_MANAGER_TMP_DIR}" "debug"
+ # Extensions has its own work/tmp directory, defined by do_main_configuration, with build UUID. We just create it here, unless told not to.
+ display_alert "Initializing EXTENSION_MANAGER_TMP_DIR" "${EXTENSION_MANAGER_TMP_DIR}" "debug"
mkdir -p "${EXTENSION_MANAGER_TMP_DIR}"
# Log destination.
export EXTENSION_MANAGER_LOG_FILE="${EXTENSION_MANAGER_TMP_DIR}/extensions.log"
- echo -n "" > "${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt"
+ [[ "${WRITE_EXTENSIONS_METADATA:-yes}" == "no" ]] && echo -n "" > "${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt"
# globally initialize the extensions log.
echo "-- lib/extensions.sh included. logs will be below, followed by the debug generated by the initialize_extension_manager() function." > "${EXTENSION_MANAGER_LOG_FILE}"
@@ -87,7 +87,7 @@ initialize_extension_manager() {
declare -i hook_points_counter=0 hook_functions_counter=0 hook_point_functions_counter=0
# initialize the cleanups file.
- fragment_manager_cleanup_file="${SRC}"/.tmp/extension_function_cleanup.sh
+ fragment_manager_cleanup_file="${EXTENSION_MANAGER_TMP_DIR}/extension_function_cleanup.sh"
echo "# cleanups: " > "${fragment_manager_cleanup_file}"
local FUNCTION_SORT_OPTIONS="--general-numeric-sort --ignore-case" # --random-sort could be used to introduce chaos
@@ -255,7 +255,7 @@ cleanup_extension_manager() {
# this will unset all the functions.
# shellcheck disable=SC1090 # dynamic source, thanks, shellcheck
source "${fragment_manager_cleanup_file}"
- rm "${fragment_manager_cleanup_file}" # remove the cleanup file
+ # file is removed together with EXTENSION_MANAGER_TMP_DIR below.
fi
# cleanup our tmpdir.
if [[ -d "${EXTENSION_MANAGER_TMP_DIR}" ]]; then
@@ -298,6 +298,9 @@ EXTENSION_METADATA_READY
# This is called by call_extension_method(). To say the truth, this should be in an extension. But then it gets too meta for anyone's head.
write_hook_point_metadata() {
+ # Dont do anything if told not to.
+ [[ "${WRITE_EXTENSIONS_METADATA:-yes}" == "no" ]] && return 0
+
local main_hook_point_name="$1"
[[ ! -d "${EXTENSION_MANAGER_TMP_DIR}" ]] && mkdir -p "${EXTENSION_MANAGER_TMP_DIR}"
diff --git a/lib/functions/cli/cli-entrypoint.sh b/lib/functions/cli/cli-entrypoint.sh
index b16ea387d..587348b01 100644
--- a/lib/functions/cli/cli-entrypoint.sh
+++ b/lib/functions/cli/cli-entrypoint.sh
@@ -15,8 +15,8 @@ function cli_entrypoint() {
:
elif [[ "${1}" == docker || "${1}" == dockerpurge || "${1}" == docker-shell ]] && grep -q "$(whoami)" <(getent group docker); then
:
- elif [[ "${CONFIG_DEFS_ONLY}" == "yes" ]]; then # not really building in this case, just gathering meta-data.
- :
+ elif [[ "${CONFIG_DEFS_ONLY}" == "yes" ]]; then # this var is set in the ENVIRONMENT, not as parameter.
+ display_alert "No sudo for" "env CONFIG_DEFS_ONLY=yes" "debug" # not really building in this case, just gathering meta-data.
else
display_alert "This script requires root privileges, trying to use sudo" "" "wrn"
sudo "${SRC}/compile.sh" "$@"
@@ -115,7 +115,8 @@ function cli_entrypoint() {
do_capturing_defs prepare_and_config_main_build_single # this sets CAPTURED_VARS
if [[ "${CONFIG_DEFS_ONLY}" == "yes" ]]; then
- echo "${CAPTURED_VARS}" # to stdout!
+ echo "${CAPTURED_VARS}" # to stdout!
+ cleanup_extension_manager # manually cleanup extension manager before exiting
return 0
else
unset CAPTURED_VARS
diff --git a/lib/functions/configuration/aggregation.sh b/lib/functions/configuration/aggregation.sh
index c57529ca7..e89275995 100644
--- a/lib/functions/configuration/aggregation.sh
+++ b/lib/functions/configuration/aggregation.sh
@@ -5,6 +5,7 @@
# Write to variables :
# - aggregated_content
aggregate_content() {
+ [[ "${CONFIG_DEFS_ONLY}" == "yes" ]] && return 0 # Don't write to disk in this case.
LOG_OUTPUT_FILE="$SRC/output/${LOG_SUBPATH}/potential-paths.log"
echo -e "Potential paths :" >> "${LOG_OUTPUT_FILE}"
show_checklist_variables potential_paths
@@ -117,6 +118,7 @@ cleanup_list() {
# before calling the `show_checklist_variables` function and unset after.
#
show_checklist_variables() {
+ [[ "${CONFIG_DEFS_ONLY}" == "yes" ]] && return 0 # Don't write to disk in this case.
local checklist=$*
local var pval
local log_file=${LOG_OUTPUT_FILE:-"${SRC}"/output/${LOG_SUBPATH}/trash.log}
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 4cc607176..0acb3b671 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -491,33 +491,42 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
PACKAGE_MAIN_LIST="$(echo ${PACKAGE_MAIN_LIST})"
fi
- LOG_OUTPUT_FILE="$SRC/output/${LOG_SUBPATH}/debootstrap-list.log"
- echo -e "\nVariables after manual configuration" >> $LOG_OUTPUT_FILE
- show_checklist_variables "DEBOOTSTRAP_COMPONENTS DEBOOTSTRAP_LIST PACKAGE_LIST PACKAGE_MAIN_LIST"
- unset LOG_OUTPUT_FILE
+ [[ "${CONFIG_DEFS_ONLY}" == "yes" ]] || write_deboostrap_list_debug_log
# Give the option to configure DNS server used in the chroot during the build process
[[ -z $NAMESERVER ]] && NAMESERVER="1.0.0.1" # default is cloudflare alternate
- call_extension_method "post_aggregate_packages" "user_config_post_aggregate_packages" << 'POST_AGGREGATE_PACKAGES'
-*For final user override, using a function, after all aggregations are done*
-Called after aggregating all package lists, before the end of `compilation.sh`.
-Packages will still be installed after this is called, so it is the last chance
-to confirm or change any packages.
-POST_AGGREGATE_PACKAGES
+ call_extension_method "post_aggregate_packages" "user_config_post_aggregate_packages" <<- 'POST_AGGREGATE_PACKAGES'
+ *For final user override, using a function, after all aggregations are done*
+ Called after aggregating all package lists, before the end of `compilation.sh`.
+ Packages will still be installed after this is called, so it is the last chance
+ to confirm or change any packages.
+ POST_AGGREGATE_PACKAGES
- local build_script_env_file="${DEST}/${LOG_SUBPATH}/output.log"
- display_alert "Writing build config summary to" "${build_script_env_file}" "debug"
+ # If not only capturing defs, write the output file. This an early write to disk, and @TODO: should be moved later into the configuration phase
+ [[ "${CONFIG_DEFS_ONLY}" == "yes" ]] || write_config_summary_output_file
- # debug
+ display_alert "Done with main-config.sh" "do_main_configuration" "debug"
+}
+
+function write_deboostrap_list_debug_log() {
+ LOG_OUTPUT_FILE="$SRC/output/${LOG_SUBPATH}/debootstrap-list.log"
+ echo -e "\nVariables after manual configuration" >> $LOG_OUTPUT_FILE
+ show_checklist_variables "DEBOOTSTRAP_COMPONENTS DEBOOTSTRAP_LIST PACKAGE_LIST PACKAGE_MAIN_LIST"
+ unset LOG_OUTPUT_FILE
+}
+
+function write_config_summary_output_file() {
+ local build_script_env_file="${DEST}/${LOG_SUBPATH}/output.log"
local debug_dpkg_arch debug_uname debug_virt debug_src_mount debug_src_perms debug_src_temp_perms
debug_dpkg_arch="$(dpkg --print-architecture)"
debug_uname="$(uname -a)"
- debug_virt="$(systemd-detect-virt)"
+ debug_virt="$(systemd-detect-virt || true)"
debug_src_mount="$(findmnt -o TARGET,SOURCE,FSTYPE,AVAIL -T "${SRC}")"
debug_src_perms="$(getfacl -p "${SRC}")"
debug_src_temp_perms="$(getfacl -p "${SRC}"/.tmp 2> /dev/null)"
+ display_alert "Writing build config summary to" "${build_script_env_file}" "debug"
cat <<- EOF >> "${build_script_env_file}"
## BUILD SCRIPT ENVIRONMENT
@@ -565,6 +574,4 @@ POST_AGGREGATE_PACKAGES
CPU configuration: $CPUMIN - $CPUMAX with $GOVERNOR
EOF
-
- display_alert "Done with main-config.sh" "do_main_configuration" "debug"
}
diff --git a/lib/functions/logging/capture.sh b/lib/functions/logging/capture.sh
index 660068c89..775923419 100644
--- a/lib/functions/logging/capture.sh
+++ b/lib/functions/logging/capture.sh
@@ -1,10 +1,11 @@
function do_capturing_defs() {
# make sure to local with a value, otherwise they will appear in the list...
- local pre_exec_vars="" exit_code=0 post_exec_vars="" new_vars_list="" onevar="" all_vars_array=()
+ local pre_exec_vars="" post_exec_vars="" new_vars_list="" onevar="" all_vars_array=()
pre_exec_vars="$(compgen -A variable | grep -E '[[:upper:]]+' | grep -v -e "^BASH_" | sort)"
- # run parameters passed
- "$@" || exit_code=$?
+ # run parameters passed. if this fails, so will we, immediately, and not capture anything correctly.
+ # if you ever find stacks referring here, please look at the caller and $1
+ "$@"
post_exec_vars="$(compgen -A variable | grep -E '[[:upper:]]+' | grep -v -e "^BASH_" | sort)"
new_vars_list="$(comm -13 <(echo "$pre_exec_vars") <(echo "${post_exec_vars}"))"
@@ -14,9 +15,9 @@ function do_capturing_defs() {
all_vars_array+=("$(declare -p "${onevar}")")
done
#IFS=$'\n'
- CAPTURED_VARS="${all_vars_array[*]}"
+ export CAPTURED_VARS="${all_vars_array[*]}"
#display_alert "Vars defined during ${*@Q}:" "${CAPTURED_VARS}" "debug"
unset all_vars_array post_exec_vars new_vars_list pre_exec_vars onevar join_by
- return ${exit_code}
+ return 0 # return success explicitly , preemptively preventing short-circuit problems.
}
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index 66aeb9d40..90a376608 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -103,6 +103,12 @@ display_alert() {
echo "--> A: [" "$@" "]" >> "${CURRENT_LOGFILE}"
fi
+ # If asked, avoid any fancy ANSI escapes completely.
+ if [[ "${ANSI_COLOR}" == "none" ]]; then
+ echo "${@}" >&2
+ return 0
+ fi
+
local message="$1" level="$3" # params
local level_indicator="" inline_logs_color="" extra="" ci_log="" # this log
case "${level}" in
diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh
index cad494207..b416b1302 100644
--- a/lib/functions/main/config-prepare.sh
+++ b/lib/functions/main/config-prepare.sh
@@ -17,23 +17,25 @@ function prepare_and_config_main_build_single() {
[[ -z $LANGUAGE ]] && export LANGUAGE="en_US:en" # set to english if not set
[[ -z $CONSOLE_CHAR ]] && export CONSOLE_CHAR="UTF-8" # set console to UTF-8 if not set
- # set log path
- LOG_SUBPATH=${LOG_SUBPATH:=debug}
- mkdir -p "${DEST}/${LOG_SUBPATH}" # This creates the logging output.
-
- # compress and remove old logs, if they exist.
- if [[ -f "${DEST}/${LOG_SUBPATH}/timestamp" ]]; then
- if ls "${DEST}/${LOG_SUBPATH}/"*.log &> /dev/null; then
- display_alert "Archiving previous build logs..." "${DEST}/${LOG_SUBPATH}" "info"
- (cd "${DEST}/${LOG_SUBPATH}" && tar -czf logs-"$(< timestamp)".tgz ./*.log) # > /dev/null 2>&1
- rm -f "${DEST}/${LOG_SUBPATH}"/*.log
+ if [[ "${CONFIG_DEFS_ONLY}" != "yes" ]]; then
+ # set log path
+ LOG_SUBPATH=${LOG_SUBPATH:=debug}
+ mkdir -p "${DEST}/${LOG_SUBPATH}" # This creates the logging output.
+
+ # compress and remove old logs, if they exist.
+ if [[ -f "${DEST}/${LOG_SUBPATH}/timestamp" ]]; then
+ if ls "${DEST}/${LOG_SUBPATH}/"*.log &> /dev/null; then
+ display_alert "Archiving previous build logs..." "${DEST}/${LOG_SUBPATH}" "info"
+ (cd "${DEST}/${LOG_SUBPATH}" && tar -czf logs-"$(< timestamp)".tgz ./*.log) # > /dev/null 2>&1
+ rm -f "${DEST}/${LOG_SUBPATH}"/*.log
+ fi
+ # delete compressed logs older than 7 days
+ find "${DEST}"/${LOG_SUBPATH} -name '*.tgz' -mtime +7 -delete
fi
- # delete compressed logs older than 7 days
- find "${DEST}"/${LOG_SUBPATH} -name '*.tgz' -mtime +7 -delete
- fi
- # Mark a timestamp, for next build.
- date +"%d_%m_%Y-%H_%M_%S" > "${DEST}"/${LOG_SUBPATH}/timestamp
+ # Mark a timestamp, for next build.
+ date +"%d_%m_%Y-%H_%M_%S" > "${DEST}"/${LOG_SUBPATH}/timestamp
+ fi
# PROGRESS_LOG_TO_FILE is either yes, or unset. (@TODO: this is still used in buildpkg)
if [[ $PROGRESS_LOG_TO_FILE != yes ]]; then unset PROGRESS_LOG_TO_FILE; fi
diff --git a/lib/tools/info.py b/lib/tools/info.py
index 308d482e7..af932eefa 100755
--- a/lib/tools/info.py
+++ b/lib/tools/info.py
@@ -1,4 +1,4 @@
-#!/bin/env python3
+#!/usr/bin/env python3
import concurrent.futures
import glob
import json
@@ -18,11 +18,12 @@ def armbian_value_parse_list(item_value):
def get_all_boards_list_from_armbian(src_path):
- ret = []
+ ret = {}
for file in glob.glob(src_path + "/config/boards/*.*"):
stem = Path(file).stem
if stem != "README":
- ret.append(stem)
+ ret[stem] = file
+ # return ret
return ret
@@ -42,10 +43,26 @@ def map_to_armbian_params(map_params):
def run_armbian_compile_and_parse(path_to_compile_sh, compile_params):
- result = subprocess.run(
- [path_to_compile_sh] + map_to_armbian_params(compile_params),
- stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, universal_newlines=True
- )
+ exec_cmd = ([path_to_compile_sh] + map_to_armbian_params(compile_params))
+ # print(exec_cmd)
+ try:
+ result = subprocess.run(
+ exec_cmd,
+ stdout=subprocess.PIPE, check=True, universal_newlines=True,
+ env={
+ "CONFIG_DEFS_ONLY": "yes", # Dont do anything. Just output vars.
+ "ANSI_COLOR": "none", # Do not use ANSI colors in logging output
+ "WRITE_EXTENSIONS_METADATA": "no" # Not interested in ext meta here
+ },
+ stderr=subprocess.PIPE
+ )
+ except subprocess.CalledProcessError as e:
+ eprint(
+ "Error calling Armbian: params: {}, return code: {}, stderr: {}".format(
+ compile_params, e.returncode, e.stderr
+ )
+ )
+ raise e
# Now parse it with regex-power!
# regex = r"^declare (..) (.*?)=\"(.*?)\"$" # old multiline version
@@ -66,7 +83,11 @@ def run_armbian_compile_and_parse(path_to_compile_sh, compile_params):
all_keys[key] = value
- return {"in": compile_params, "out": all_keys, "logs": result.stderr.split("\n")}
+ logs = ["Not available"]
+ if result.stderr:
+ logs = result.stderr.split("\n")
+
+ return {"in": compile_params, "out": all_keys, "logs": logs}
# Find the location of compile.sh, relative to this Python script.
@@ -90,25 +111,53 @@ common_compile_params = {
"CLOUD_IMAGE": "yes",
"CLEAN_LEVEL": "debs",
"SHOW_LOG": "yes",
+ "SKIP_EXTERNAL_TOOLCHAINS": "yes",
"CONFIG_DEFS_ONLY": "yes",
"KERNEL_CONFIGURE": "no",
"EXPERT": "yes"
}
board_compile_params = {
- "BOARD": "uefi-x86",
- "BRANCH": "current",
"RELEASE": "impish",
"BUILD_DESKTOP": "no"
}
-def get_info_for_one_board(board_name, common_params):
- eprint("Getting info for board '{}'".format(board_name))
+# I've to read the first line from the board file, that's the hardware description in a pound comment.
+# Also, 'KERNEL_TARGET="legacy,current,edge"' which we need to parse.
+def parse_board_file_for_static_info(board_file, board_id):
+ file_handle = open(board_file, 'r')
+ file_lines = file_handle.readlines()
+ file_handle.close()
+
+ file_lines.reverse()
+ hw_desc_line = file_lines.pop()
+ hw_desc_clean = hw_desc_line.strip("# ").strip("\n")
+
+ # Parse KERNEL_TARGET line.
+ kernel_target_matches = re.findall(r"^KERNEL_TARGET=\"(.*)\"", "\n".join(file_lines), re.MULTILINE)
+ kernel_targets = kernel_target_matches[0].split(",")
+ eprint("Possible kernel branches for board: ", board_id, " : ", kernel_targets)
+
+ return {
+ "BOARD_FILE_HARDWARE_DESC": hw_desc_clean,
+ "BOARD_POSSIBLE_BRANCHES": kernel_targets,
+ "BOARD_DESC_ID": board_id
+ }
+
+
+def get_info_for_one_board(board_file, board_name, common_params, board_info):
+ eprint(
+ "Getting info for board '{}' branch '{}' in file '{}'".format(
+ board_name, common_params["BRANCH"], board_file
+ )
+ )
+
+ # eprint("Running Armbian bash for board '{}'".format(board_name))
try:
parsed = run_armbian_compile_and_parse(compile_sh_full_path, common_params | {"BOARD": board_name})
# print(json.dumps(parsed, indent=4, sort_keys=True))
- return parsed
+ return parsed | board_info
except:
eprint("Failed get info for board '{}'".format(board_name))
return None
@@ -116,16 +165,24 @@ def get_info_for_one_board(board_name, common_params):
if True:
all_boards = get_all_boards_list_from_armbian(armbian_src_path)
- # print(json.dumps(all_boards, indent=4, sort_keys=True))
+ # eprint(json.dumps(all_boards, indent=4, sort_keys=True))
every_info = []
with concurrent.futures.ProcessPoolExecutor(max_workers=32) as executor:
every_future = []
- for board in all_boards:
- all_params = common_compile_params | board_compile_params
- eprint("Submitting future for board {}".format(board))
- future = executor.submit(get_info_for_one_board, board, all_params)
- every_future.append(future)
+ for board in all_boards.keys():
+ try:
+ board_info = parse_board_file_for_static_info(all_boards[board], board)
+ except:
+ eprint("** Failed to parse board file {} static.".format(board))
+ continue
+
+ for possible_branch in board_info["BOARD_POSSIBLE_BRANCHES"]:
+ all_params = common_compile_params | board_compile_params | {"BRANCH": possible_branch}
+ eprint("Submitting future for board {} with BRANCH={}".format(board, possible_branch))
+ future = executor.submit(get_info_for_one_board, all_boards[board], board, all_params,
+ board_info)
+ every_future.append(future)
eprint("Waiting for all futures...")
executor.shutdown(wait=True)
From c7785c788f81bce938f2af6b3d576ba9834433b7 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 23 Jan 2022 23:00:17 +0100
Subject: [PATCH] armbian-next: shellfmt and regen library (after rebase from
master n.5)
---
lib/functions/compilation/atf.sh | 2 +-
lib/functions/logging/logging.sh | 4 +-
lib/functions/rootfs/create-cache.sh | 2 +-
lib/library-functions.sh | 365 +++++++++++++++++------------------
4 files changed, 186 insertions(+), 187 deletions(-)
diff --git a/lib/functions/compilation/atf.sh b/lib/functions/compilation/atf.sh
index d2a30d09f..91ca8aaf1 100644
--- a/lib/functions/compilation/atf.sh
+++ b/lib/functions/compilation/atf.sh
@@ -57,7 +57,7 @@ compile_atf() {
[[ $(type -t atf_custom_postprocess) == function ]] && atf_custom_postprocess 2>&1
- atftempdir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
+ atftempdir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
chmod 700 ${atftempdir}
# copy files to temp directory
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index 5981d9547..66aeb9d40 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -4,7 +4,7 @@ function logging_init() {
# globals
export padding="" left_marker="[" right_marker="]"
export normal_color="\x1B[0m" gray_color="\e[1;30m" # "bright black", which is grey
- declare -i logging_section_counter=0 # -i: integer
+ declare -i logging_section_counter=0 # -i: integer
export logging_section_counter
}
@@ -45,7 +45,7 @@ function do_with_logging() {
export CURRENT_LOGGING_COUNTER
CURRENT_LOGGING_COUNTER="$(printf "%03d" "$logging_section_counter")"
export CURRENT_LOGGING_SECTION=${LOG_SECTION:-build} # default to "build"
- export CURRENT_LOGGING_DIR="${DEST}/${LOG_SUBPATH}" # origin: build-all-ng - @TODO: rpardini: lets revisit this later
+ export CURRENT_LOGGING_DIR="${DEST}/${LOG_SUBPATH}" # origin: build-all-ng - @TODO: rpardini: lets revisit this later
export CURRENT_LOGFILE="${CURRENT_LOGGING_DIR}/${CURRENT_LOGGING_COUNTER}.${CURRENT_LOGGING_SECTION}.log"
mkdir -p "${CURRENT_LOGGING_DIR}"
diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh
index f969159cf..13e2565fd 100644
--- a/lib/functions/rootfs/create-cache.sh
+++ b/lib/functions/rootfs/create-cache.sh
@@ -279,7 +279,7 @@ get_package_list_hash() {
local list_content
read -ra package_arr <<< "${DEBOOTSTRAP_LIST} ${PACKAGE_LIST}"
read -ra exclude_arr <<< "${PACKAGE_LIST_EXCLUDE}"
- (
+ (
(
printf "%s\n" "${package_arr[@]}"
printf -- "-%s\n" "${exclude_arr[@]}"
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index 09139086b..f7a679dcc 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -1,97 +1,97 @@
#!/usr/bin/env bash
# This file is/was autogenerated by lib/tools/gen-library.sh; don't modify manually
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/general/repo.sh
-# shellcheck source=lib/functions/general/repo.sh
-source "${SRC}"/lib/functions/general/repo.sh
+### lib/functions/bsp/bsp-cli.sh
+# shellcheck source=lib/functions/bsp/bsp-cli.sh
+source "${SRC}"/lib/functions/bsp/bsp-cli.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/general/host.sh
-# shellcheck source=lib/functions/general/host.sh
-source "${SRC}"/lib/functions/general/host.sh
+### lib/functions/bsp/bsp-desktop.sh
+# shellcheck source=lib/functions/bsp/bsp-desktop.sh
+source "${SRC}"/lib/functions/bsp/bsp-desktop.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/general/git.sh
-# shellcheck source=lib/functions/general/git.sh
-source "${SRC}"/lib/functions/general/git.sh
+### lib/functions/bsp/utils-bsp.sh
+# shellcheck source=lib/functions/bsp/utils-bsp.sh
+source "${SRC}"/lib/functions/bsp/utils-bsp.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/general/downloads.sh
-# shellcheck source=lib/functions/general/downloads.sh
-source "${SRC}"/lib/functions/general/downloads.sh
+### lib/functions/cli/cli-entrypoint.sh
+# shellcheck source=lib/functions/cli/cli-entrypoint.sh
+source "${SRC}"/lib/functions/cli/cli-entrypoint.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/general/cleaning.sh
-# shellcheck source=lib/functions/general/cleaning.sh
-source "${SRC}"/lib/functions/general/cleaning.sh
+### lib/functions/cli/utils-cli.sh
+# shellcheck source=lib/functions/cli/utils-cli.sh
+source "${SRC}"/lib/functions/cli/utils-cli.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/general/chroot-helpers.sh
-# shellcheck source=lib/functions/general/chroot-helpers.sh
-source "${SRC}"/lib/functions/general/chroot-helpers.sh
+### lib/functions/compilation/atf.sh
+# shellcheck source=lib/functions/compilation/atf.sh
+source "${SRC}"/lib/functions/compilation/atf.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/extras/buildpkg.sh
-# shellcheck source=lib/functions/extras/buildpkg.sh
-source "${SRC}"/lib/functions/extras/buildpkg.sh
+### lib/functions/compilation/debs.sh
+# shellcheck source=lib/functions/compilation/debs.sh
+source "${SRC}"/lib/functions/compilation/debs.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/extras/fel.sh
-# shellcheck source=lib/functions/extras/fel.sh
-source "${SRC}"/lib/functions/extras/fel.sh
+### lib/functions/compilation/extra-drivers.sh
+# shellcheck source=lib/functions/compilation/extra-drivers.sh
+source "${SRC}"/lib/functions/compilation/extra-drivers.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/compilation/debs.sh
-# shellcheck source=lib/functions/compilation/debs.sh
-source "${SRC}"/lib/functions/compilation/debs.sh
+### lib/functions/compilation/kernel.sh
+# shellcheck source=lib/functions/compilation/kernel.sh
+source "${SRC}"/lib/functions/compilation/kernel.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/compilation/uboot.sh
-# shellcheck source=lib/functions/compilation/uboot.sh
-source "${SRC}"/lib/functions/compilation/uboot.sh
+### lib/functions/compilation/patching.sh
+# shellcheck source=lib/functions/compilation/patching.sh
+source "${SRC}"/lib/functions/compilation/patching.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
@@ -100,16 +100,16 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/compilation/sources.sh
source "${SRC}"/lib/functions/compilation/sources.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/compilation/extra-drivers.sh
-# shellcheck source=lib/functions/compilation/extra-drivers.sh
-source "${SRC}"/lib/functions/compilation/extra-drivers.sh
+### lib/functions/compilation/uboot.sh
+# shellcheck source=lib/functions/compilation/uboot.sh
+source "${SRC}"/lib/functions/compilation/uboot.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
@@ -118,268 +118,250 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/compilation/utils-compilation.sh
source "${SRC}"/lib/functions/compilation/utils-compilation.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
-#set -o pipefail # trace ERR through pipes - will be enabled "soon"
-#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
-set -o errtrace # trace ERR through - enabled
-set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/compilation/patching.sh
-# shellcheck source=lib/functions/compilation/patching.sh
-source "${SRC}"/lib/functions/compilation/patching.sh
-
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/compilation/kernel.sh
-# shellcheck source=lib/functions/compilation/kernel.sh
-source "${SRC}"/lib/functions/compilation/kernel.sh
-
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
-#set -o pipefail # trace ERR through pipes - will be enabled "soon"
-#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
-set -o errtrace # trace ERR through - enabled
-set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/compilation/atf.sh
-# shellcheck source=lib/functions/compilation/atf.sh
-source "${SRC}"/lib/functions/compilation/atf.sh
+### lib/functions/configuration/aggregation.sh
+# shellcheck source=lib/functions/configuration/aggregation.sh
+source "${SRC}"/lib/functions/configuration/aggregation.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/cli/cli-entrypoint.sh
-# shellcheck source=lib/functions/cli/cli-entrypoint.sh
-source "${SRC}"/lib/functions/cli/cli-entrypoint.sh
+### lib/functions/configuration/config-desktop.sh
+# shellcheck source=lib/functions/configuration/config-desktop.sh
+source "${SRC}"/lib/functions/configuration/config-desktop.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/cli/utils-cli.sh
-# shellcheck source=lib/functions/cli/utils-cli.sh
-source "${SRC}"/lib/functions/cli/utils-cli.sh
+### lib/functions/configuration/interactive.sh
+# shellcheck source=lib/functions/configuration/interactive.sh
+source "${SRC}"/lib/functions/configuration/interactive.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/logging/errors.sh
-# shellcheck source=lib/functions/logging/errors.sh
-source "${SRC}"/lib/functions/logging/errors.sh
+### lib/functions/configuration/main-config.sh
+# shellcheck source=lib/functions/configuration/main-config.sh
+source "${SRC}"/lib/functions/configuration/main-config.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/logging/runners.sh
-# shellcheck source=lib/functions/logging/runners.sh
-source "${SRC}"/lib/functions/logging/runners.sh
+### lib/functions/configuration/menu.sh
+# shellcheck source=lib/functions/configuration/menu.sh
+source "${SRC}"/lib/functions/configuration/menu.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/logging/capture.sh
-# shellcheck source=lib/functions/logging/capture.sh
-source "${SRC}"/lib/functions/logging/capture.sh
+### lib/functions/extras/buildpkg.sh
+# shellcheck source=lib/functions/extras/buildpkg.sh
+source "${SRC}"/lib/functions/extras/buildpkg.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/logging/traps.sh
-# shellcheck source=lib/functions/logging/traps.sh
-source "${SRC}"/lib/functions/logging/traps.sh
+### lib/functions/extras/fel.sh
+# shellcheck source=lib/functions/extras/fel.sh
+source "${SRC}"/lib/functions/extras/fel.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/logging/logging.sh
-# shellcheck source=lib/functions/logging/logging.sh
-source "${SRC}"/lib/functions/logging/logging.sh
+### lib/functions/general/chroot-helpers.sh
+# shellcheck source=lib/functions/general/chroot-helpers.sh
+source "${SRC}"/lib/functions/general/chroot-helpers.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/bsp/utils-bsp.sh
-# shellcheck source=lib/functions/bsp/utils-bsp.sh
-source "${SRC}"/lib/functions/bsp/utils-bsp.sh
+### lib/functions/general/cleaning.sh
+# shellcheck source=lib/functions/general/cleaning.sh
+source "${SRC}"/lib/functions/general/cleaning.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/bsp/bsp-desktop.sh
-# shellcheck source=lib/functions/bsp/bsp-desktop.sh
-source "${SRC}"/lib/functions/bsp/bsp-desktop.sh
+### lib/functions/general/downloads.sh
+# shellcheck source=lib/functions/general/downloads.sh
+source "${SRC}"/lib/functions/general/downloads.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/bsp/bsp-cli.sh
-# shellcheck source=lib/functions/bsp/bsp-cli.sh
-source "${SRC}"/lib/functions/bsp/bsp-cli.sh
+### lib/functions/general/git.sh
+# shellcheck source=lib/functions/general/git.sh
+source "${SRC}"/lib/functions/general/git.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/main/default-build.sh
-# shellcheck source=lib/functions/main/default-build.sh
-source "${SRC}"/lib/functions/main/default-build.sh
+### lib/functions/general/host.sh
+# shellcheck source=lib/functions/general/host.sh
+source "${SRC}"/lib/functions/general/host.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/main/config-prepare.sh
-# shellcheck source=lib/functions/main/config-prepare.sh
-source "${SRC}"/lib/functions/main/config-prepare.sh
+### lib/functions/general/repo.sh
+# shellcheck source=lib/functions/general/repo.sh
+source "${SRC}"/lib/functions/general/repo.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/main/rootfs-image.sh
-# shellcheck source=lib/functions/main/rootfs-image.sh
-source "${SRC}"/lib/functions/main/rootfs-image.sh
+### lib/functions/image/initrd.sh
+# shellcheck source=lib/functions/image/initrd.sh
+source "${SRC}"/lib/functions/image/initrd.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/configuration/aggregation.sh
-# shellcheck source=lib/functions/configuration/aggregation.sh
-source "${SRC}"/lib/functions/configuration/aggregation.sh
+### lib/functions/image/loop.sh
+# shellcheck source=lib/functions/image/loop.sh
+source "${SRC}"/lib/functions/image/loop.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/configuration/main-config.sh
-# shellcheck source=lib/functions/configuration/main-config.sh
-source "${SRC}"/lib/functions/configuration/main-config.sh
+### lib/functions/image/partitioning.sh
+# shellcheck source=lib/functions/image/partitioning.sh
+source "${SRC}"/lib/functions/image/partitioning.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/configuration/interactive.sh
-# shellcheck source=lib/functions/configuration/interactive.sh
-source "${SRC}"/lib/functions/configuration/interactive.sh
+### lib/functions/image/rootfs-to-image.sh
+# shellcheck source=lib/functions/image/rootfs-to-image.sh
+source "${SRC}"/lib/functions/image/rootfs-to-image.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/configuration/menu.sh
-# shellcheck source=lib/functions/configuration/menu.sh
-source "${SRC}"/lib/functions/configuration/menu.sh
+### lib/functions/logging/capture.sh
+# shellcheck source=lib/functions/logging/capture.sh
+source "${SRC}"/lib/functions/logging/capture.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/configuration/config-desktop.sh
-# shellcheck source=lib/functions/configuration/config-desktop.sh
-source "${SRC}"/lib/functions/configuration/config-desktop.sh
+### lib/functions/logging/errors.sh
+# shellcheck source=lib/functions/logging/errors.sh
+source "${SRC}"/lib/functions/logging/errors.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/multi/build-all.sh
-# shellcheck source=lib/functions/multi/build-all.sh
-source "${SRC}"/lib/functions/multi/build-all.sh
+### lib/functions/logging/logging.sh
+# shellcheck source=lib/functions/logging/logging.sh
+source "${SRC}"/lib/functions/logging/logging.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/image/initrd.sh
-# shellcheck source=lib/functions/image/initrd.sh
-source "${SRC}"/lib/functions/image/initrd.sh
+### lib/functions/logging/runners.sh
+# shellcheck source=lib/functions/logging/runners.sh
+source "${SRC}"/lib/functions/logging/runners.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/image/rootfs-to-image.sh
-# shellcheck source=lib/functions/image/rootfs-to-image.sh
-source "${SRC}"/lib/functions/image/rootfs-to-image.sh
+### lib/functions/logging/traps.sh
+# shellcheck source=lib/functions/logging/traps.sh
+source "${SRC}"/lib/functions/logging/traps.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/image/loop.sh
-# shellcheck source=lib/functions/image/loop.sh
-source "${SRC}"/lib/functions/image/loop.sh
+### lib/functions/main/config-prepare.sh
+# shellcheck source=lib/functions/main/config-prepare.sh
+source "${SRC}"/lib/functions/main/config-prepare.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/image/partitioning.sh
-# shellcheck source=lib/functions/image/partitioning.sh
-source "${SRC}"/lib/functions/image/partitioning.sh
+### lib/functions/main/default-build.sh
+# shellcheck source=lib/functions/main/default-build.sh
+source "${SRC}"/lib/functions/main/default-build.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/rootfs/post-tweaks.sh
-# shellcheck source=lib/functions/rootfs/post-tweaks.sh
-source "${SRC}"/lib/functions/rootfs/post-tweaks.sh
+### lib/functions/main/rootfs-image.sh
+# shellcheck source=lib/functions/main/rootfs-image.sh
+source "${SRC}"/lib/functions/main/rootfs-image.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/rootfs/rootfs-desktop.sh
-# shellcheck source=lib/functions/rootfs/rootfs-desktop.sh
-source "${SRC}"/lib/functions/rootfs/rootfs-desktop.sh
+### lib/functions/multi/build-all.sh
+# shellcheck source=lib/functions/multi/build-all.sh
+source "${SRC}"/lib/functions/multi/build-all.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/rootfs/distro-agnostic.sh
-# shellcheck source=lib/functions/rootfs/distro-agnostic.sh
-source "${SRC}"/lib/functions/rootfs/distro-agnostic.sh
+### lib/functions/rootfs/apt.sh
+# shellcheck source=lib/functions/rootfs/apt.sh
+source "${SRC}"/lib/functions/rootfs/apt.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
@@ -388,16 +370,16 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/rootfs/boot_logo.sh
source "${SRC}"/lib/functions/rootfs/boot_logo.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/rootfs/apt.sh
-# shellcheck source=lib/functions/rootfs/apt.sh
-source "${SRC}"/lib/functions/rootfs/apt.sh
+### lib/functions/rootfs/create-cache.sh
+# shellcheck source=lib/functions/rootfs/create-cache.sh
+source "${SRC}"/lib/functions/rootfs/create-cache.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
@@ -406,16 +388,16 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/rootfs/customize.sh
source "${SRC}"/lib/functions/rootfs/customize.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
-### lib/functions/rootfs/create-cache.sh
-# shellcheck source=lib/functions/rootfs/create-cache.sh
-source "${SRC}"/lib/functions/rootfs/create-cache.sh
+### lib/functions/rootfs/distro-agnostic.sh
+# shellcheck source=lib/functions/rootfs/distro-agnostic.sh
+source "${SRC}"/lib/functions/rootfs/distro-agnostic.sh
-# no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
@@ -424,6 +406,23 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/rootfs/distro-specific.sh
source "${SRC}"/lib/functions/rootfs/distro-specific.sh
+# no errors tolerated. invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/rootfs/post-tweaks.sh
+# shellcheck source=lib/functions/rootfs/post-tweaks.sh
+source "${SRC}"/lib/functions/rootfs/post-tweaks.sh
+
+# no errors tolerated. invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/rootfs/rootfs-desktop.sh
+# shellcheck source=lib/functions/rootfs/rootfs-desktop.sh
+source "${SRC}"/lib/functions/rootfs/rootfs-desktop.sh
# no errors tolerated. one last time for the win!
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
From ac99b0432bdbb7d2ee589a5f41a72e17dcbfecee Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 23 Jan 2022 22:59:25 +0100
Subject: [PATCH] tools/shellfmt.sh: exclude "cache" and ".tmp" from
formatting, for obvious reasons
---
lib/tools/shellfmt.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/tools/shellfmt.sh b/lib/tools/shellfmt.sh
index 9e84606c0..69d2bbb05 100755
--- a/lib/tools/shellfmt.sh
+++ b/lib/tools/shellfmt.sh
@@ -54,7 +54,7 @@ cd "${SRC}"
# Should match the .editorconfig [*.{sh,inc,conf,eos,wip,tvb,csc}]
-declare -a ALL_BASH_FILES=($(find . -type f -name '*.sh') $(find ./config -type f -name '*.inc' -o -name '*.conf' -o -name '*.eos' -o -name '*.wip' -o -name '*.tvb' -o -name '*.csc' | grep -v -e "\/config\/aptly" -e "\/config\/targets"))
+declare -a ALL_BASH_FILES=($(find . -type f -name '*.sh' | grep -v -e "^./cache/" -e "^./.tmp/") $(find ./config -type f -name '*.inc' -o -name '*.conf' -o -name '*.eos' -o -name '*.wip' -o -name '*.tvb' -o -name '*.csc' | grep -v -e "\/config\/aptly" -e "\/config\/targets"))
echo "All files:" "${ALL_BASH_FILES[@]}"
From b17bb64ddc739b7084b98d070848aade693f3794 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 23 Jan 2022 22:58:36 +0100
Subject: [PATCH] tools/gen-library.sh: sort function files, so it does not
keep changing between runs on different machines.
- order should not be important, since files only contain functions, but avoid git churn
---
lib/tools/gen-library.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/tools/gen-library.sh b/lib/tools/gen-library.sh
index 8abfad05e..3b851fe67 100755
--- a/lib/tools/gen-library.sh
+++ b/lib/tools/gen-library.sh
@@ -17,7 +17,7 @@ cat <<- AUTOGEN_INCLUDES_HEADER > "${TARGET_SH}"
AUTOGEN_INCLUDES_HEADER
-find lib/functions -type f -name \*.sh | while read -r path; do
+find lib/functions -type f -name \*.sh | sort -h | while read -r path; do
ref="$(echo -n "${path}")"
cat <<- AUTOGEN_INCLUDES_EACH >> "${TARGET_SH}"
# no errors tolerated. invoked before each sourced file to make sure.
From d84cbf9f3a367ab068bd619619daa58c56e7c96f Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 23 Jan 2022 22:42:25 +0100
Subject: [PATCH] armbian-next: manual merge (5) of all lib/*.sh changes
between revisions 1b18df3c834c5c4166e99f731d53ec88d14caf7d and
e7962bb2b555d3afdca0ff168982cc45235ca0a8
- most PKG_PREFIX work was already done
---
config/sources/families/jetson-nano.conf | 50 +++++++++++++++-----------------
lib/functions/general/host.sh | 2 +-
lib/functions/rootfs/distro-agnostic.sh | 3 ++
3 files changed, 27 insertions(+), 28 deletions(-)
diff --git a/config/sources/families/jetson-nano.conf b/config/sources/families/jetson-nano.conf
index f4710d751..03717a673 100644
--- a/config/sources/families/jetson-nano.conf
+++ b/config/sources/families/jetson-nano.conf
@@ -22,13 +22,18 @@ case $BRANCH in
;;
current)
- KERNELBRANCH="branch:linux-5.10.y"
- KERNELPATCHDIR='rockchip64-'$BRANCH
+ KERNELBRANCH="branch:linux-5.15.y"
+ KERNELPATCHDIR='media-'$BRANCH
+ LINUXFAMILY=media
+ LINUXCONFIG='linux-media-'$BRANCH
;;
edge)
- KERNELBRANCH="branch:linux-5.15.y"
- KERNELPATCHDIR='rockchip64-'$BRANCH
+ SKIP_BOOTSPLASH="yes"
+ KERNELBRANCH="branch:linux-5.16.y"
+ KERNELPATCHDIR='media-'$BRANCH
+ LINUXFAMILY=media
+ LINUXCONFIG='linux-media-'$BRANCH
;;
esac
@@ -39,28 +44,19 @@ write_uboot_platform() {
family_tweaks() {
- case $BRANCH in
-
- legacy)
-
- install -m 755 $SRC/packages/blobs/jetson/tegra21x_xusb_firmware $SDCARD/lib/firmware/tegra21x_xusb_firmware
- install -m 755 $SRC/packages/blobs/jetson/asound.conf.tegrahda $SDCARD/etc/asound.conf.tegrahda
- install -m 755 $SRC/packages/blobs/jetson/asound.conf.tegrahda $SDCARD/etc/asound.conf
- install -m 755 $SRC/packages/blobs/jetson/asound.conf.tegrasndt210ref $SDCARD/etc/asound.conf.tegrasndt210ref
- install -m 755 $SRC/packages/blobs/jetson/tegra-hda.conf $SDCARD/usr/share/alsa/cards/tegra-hda.conf
- install -m 755 $SRC/packages/blobs/jetson/tegra-snd-t210r.conf $SDCARD/usr/share/alsa/cards/tegra-snd-t210r.conf
-
- sed -e 's/exit 0//g' -i $SDCARD/etc/rc.local
- echo "su -c 'echo 255 > /sys/devices/pwm-fan/target_pwm'" >> $SDCARD/etc/rc.local
- echo "exit 0" >> $SDCARD/etc/rc.local
-
- ;;
-
- edge)
-
- cp -R $SRC/packages/blobs/jetson/firmware/* $SDCARD/lib/firmware/
-
- ;;
- esac
+ if [[ $BRANCH == legacy ]]; then
+ install -m 755 $SRC/packages/blobs/jetson/tegra21x_xusb_firmware $SDCARD/lib/firmware/tegra21x_xusb_firmware
+ install -m 755 $SRC/packages/blobs/jetson/asound.conf.tegrahda $SDCARD/etc/asound.conf.tegrahda
+ install -m 755 $SRC/packages/blobs/jetson/asound.conf.tegrahda $SDCARD/etc/asound.conf
+ install -m 755 $SRC/packages/blobs/jetson/asound.conf.tegrasndt210ref $SDCARD/etc/asound.conf.tegrasndt210ref
+ install -m 755 $SRC/packages/blobs/jetson/tegra-hda.conf $SDCARD/usr/share/alsa/cards/tegra-hda.conf
+ install -m 755 $SRC/packages/blobs/jetson/tegra-snd-t210r.conf $SDCARD/usr/share/alsa/cards/tegra-snd-t210r.conf
+
+ sed -e 's/exit 0//g' -i $SDCARD/etc/rc.local
+ echo "su -c 'echo 255 > /sys/devices/pwm-fan/target_pwm'" >> $SDCARD/etc/rc.local
+ echo "exit 0" >> $SDCARD/etc/rc.local
+ else
+ cp -R $SRC/packages/blobs/jetson/firmware/* $SDCARD/lib/firmware/
+ fi
}
diff --git a/lib/functions/general/host.sh b/lib/functions/general/host.sh
index fa1fcbc52..94409fafd 100644
--- a/lib/functions/general/host.sh
+++ b/lib/functions/general/host.sh
@@ -73,7 +73,7 @@ prepare_host() {
if [[ $(dpkg --print-architecture) == amd64 ]]; then
- hostdeps+=" distcc lib32ncurses-dev lib32stdc++6 libc6-i386 zlib1g:i386"
+ hostdeps+=" distcc lib32ncurses-dev lib32stdc++6 libc6-i386"
grep -q i386 <(dpkg --print-foreign-architectures) || dpkg --add-architecture i386
elif [[ $(dpkg --print-architecture) == arm64 ]]; then
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index d348e4d39..d48879929 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -229,6 +229,9 @@ install_distribution_agnostic() {
display_alert "Temporarily disabling" "initramfs-tools hook for kernel"
chroot_sdcard chmod -v -x /etc/kernel/postinst.d/initramfs-tools
+ display_alert "Cleaning" "package lists"
+ APT_OPTS="y" chroot_sdcard_apt_get clean
+
display_alert "Updating" "apt package lists"
APT_OPTS="y" chroot_sdcard_apt_get update
From b18f3c81a1613e4b1550674a471f309a59526167 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 23 Jan 2022 22:08:16 +0100
Subject: [PATCH] armbian-next: `TMPDIR` for all, many logging fixes, error
handling: leave-no-garbage-behind without needing traps.
- set `MOUNT_UUID` and `WORKDIR`/`MOUNT`/`SDCARD`/`EXTENSION_MANAGER_TMP_DIR`/`DESTIMG` early in do_main_configuration()
- but, they're just _set_ there, dirs are not created early, but on demand later
- still @TODO: actually clean those during error trap. (unhappy path leaves garbage still)
- but does not leave garbage behind during "successful" runs at least (happy path works)
- actually export `TMPDIR` (== `WORKDIR`) during start of build (not config!), so all `mktemp` are subject to it
- `runners.sh` has helpers to avoid passing `TMPDIR` to chroot. Use the helpers! don't call `chroot` directly.
- don't trap/cleanup individual `mktemp` temp dirs during .deb packaging's, all is handled at once now.
- kernel packaging, for example, automatically picks up `TMPDIR` too. So now hosts `/tmp` is mostly left alone.
- fix some "infodumps" that are done into `.log` files directly.
- don't use sudo if `CONFIG_DEFS_ONLY=yes`; we'll only be collecting info, not doing anything.
- simpler logging for `rsync` operations (just dump to stdout, logging will handle it!)
- use padded counter for section logfiles, so we know which order things ran. exported as `CURRENT_LOGGING_COUNTER`
- no reason to use `apt-get` with `-yqq` anymore, since all logging is handled, so now `-y` by default
- desktop: using runners helpers for rootfs-desktop.sh, which should help a lot with acng caching and finding of problems
- extensions: correctly cleanup temp stuff, extensions has its own tmp/workdir now, and is always cleaned up at end of build.
---
lib/extensions.sh | 14 +++++++++-----
lib/functions/bsp/bsp-cli.sh | 7 +------
lib/functions/bsp/bsp-desktop.sh | 12 +++---------
lib/functions/cli/cli-entrypoint.sh | 10 +++++++---
lib/functions/compilation/atf.sh | 5 +----
lib/functions/compilation/debs.sh | 16 +++-------------
lib/functions/compilation/kernel.sh | 7 ++-----
lib/functions/compilation/patching.sh | 2 +-
lib/functions/compilation/uboot.sh | 3 +--
lib/functions/configuration/main-config.sh | 21 +++++++++++----------
lib/functions/configuration/menu.sh | 2 +-
lib/functions/general/host.sh | 2 +-
lib/functions/image/rootfs-to-image.sh | 16 ++++++----------
lib/functions/logging/logging.sh | 11 ++++++++---
lib/functions/logging/runners.sh | 2 +-
lib/functions/main/config-prepare.sh | 2 +-
lib/functions/main/default-build.sh | 19 +++++++++++++++++++
lib/functions/rootfs/rootfs-desktop.sh | 22 +++++++++++-----------
18 files changed, 87 insertions(+), 86 deletions(-)
diff --git a/lib/extensions.sh b/lib/extensions.sh
index 1f7cd2db8..5398de20f 100644
--- a/lib/extensions.sh
+++ b/lib/extensions.sh
@@ -61,8 +61,8 @@ initialize_extension_manager() {
# This marks the manager as initialized, no more extensions are allowed to load after this.
export initialize_extension_manager_counter=$((initialize_extension_manager_counter + 1))
- # Have a unique temporary dir, even if being built concurrently by build_all_ng.
- export EXTENSION_MANAGER_TMP_DIR="${SRC}/.tmp/.extensions/${LOG_SUBPATH}"
+ # Extensions has its own work/tmp directory, defined by do_main_configuration, with build UUID. We just create it here.
+ display_alert "EXTENSION_MANAGER_TMP_DIR" "${EXTENSION_MANAGER_TMP_DIR}" "debug"
mkdir -p "${EXTENSION_MANAGER_TMP_DIR}"
# Log destination.
@@ -245,6 +245,8 @@ initialize_extension_manager() {
# Dont show any output until we have more than 1 hook function (we implement one already, below)
[[ ${hook_functions_counter} -gt 0 ]] &&
display_alert "Extension manager" "processed ${hook_points_counter} Extension Methods calls and ${hook_functions_counter} Extension Method implementations" "info" | tee -a "${EXTENSION_MANAGER_LOG_FILE}"
+
+ return 0 # exit with success, short-circuit above.
}
cleanup_extension_manager() {
@@ -253,6 +255,11 @@ cleanup_extension_manager() {
# this will unset all the functions.
# shellcheck disable=SC1090 # dynamic source, thanks, shellcheck
source "${fragment_manager_cleanup_file}"
+ rm "${fragment_manager_cleanup_file}" # remove the cleanup file
+ fi
+ # cleanup our tmpdir.
+ if [[ -d "${EXTENSION_MANAGER_TMP_DIR}" ]]; then
+ rm -rf "${EXTENSION_MANAGER_TMP_DIR}"
fi
# reset/unset the variables used
initialize_extension_manager_counter=0
@@ -287,9 +294,6 @@ EXTENSION_METADATA_READY
# Move temporary log file over to final destination, and start writing to it instead (although 999 is pretty late in the game)
mv "${EXTENSION_MANAGER_LOG_FILE}" "${DEST}/${LOG_SUBPATH:-debug}/extensions.log"
export EXTENSION_MANAGER_LOG_FILE="${DEST}/${LOG_SUBPATH:-debug}/extensions.log"
-
- # Cleanup. Leave no trace...
- [[ -d "${EXTENSION_MANAGER_TMP_DIR}" ]] && rm -rf "${EXTENSION_MANAGER_TMP_DIR}"
}
# This is called by call_extension_method(). To say the truth, this should be in an extension. But then it gets too meta for anyone's head.
diff --git a/lib/functions/bsp/bsp-cli.sh b/lib/functions/bsp/bsp-cli.sh
index 71f0ea765..a2c0adc58 100644
--- a/lib/functions/bsp/bsp-cli.sh
+++ b/lib/functions/bsp/bsp-cli.sh
@@ -1,10 +1,8 @@
create_board_package() {
display_alert "Creating board support package for CLI" "$CHOSEN_ROOTFS" "info"
- bsptempdir=$(mktemp -d)
+ bsptempdir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
chmod 700 ${bsptempdir}
- # @TODO: these traps are a real trap.
- #trap "rm -rf \"${bsptempdir}\" ; exit 0" 0 1 2 3 15
local destination=${bsptempdir}/${BSP_CLI_PACKAGE_FULLNAME}
mkdir -p "${destination}"/DEBIAN
@@ -309,7 +307,4 @@ POST_FAMILY_TWEAKS_BSP
rsync --remove-source-files -rq "${destination}.deb" "${DEB_STORAGE}/" 2>&1
display_alert "Done building BSP CLI package" "${destination}" "debug"
-
- # cleanup
- rm -rf ${bsptempdir}
}
diff --git a/lib/functions/bsp/bsp-desktop.sh b/lib/functions/bsp/bsp-desktop.sh
index baa585d7f..7ccba50c2 100644
--- a/lib/functions/bsp/bsp-desktop.sh
+++ b/lib/functions/bsp/bsp-desktop.sh
@@ -32,7 +32,7 @@ create_desktop_package() {
PACKAGE_LIST_PREDEPENDS=${PACKAGE_LIST_PREDEPENDS//[[:space:]]/}
local destination tmp_dir
- tmp_dir=$(mktemp -d)
+ tmp_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
destination=${tmp_dir}/${BOARD}/${CHOSEN_DESKTOP}_${REVISION}_all
rm -rf "${destination}"
mkdir -p "${destination}"/DEBIAN
@@ -66,7 +66,7 @@ create_desktop_package() {
chmod 755 "${destination}"/DEBIAN/postinst
#display_alert "Showing ${destination}/DEBIAN/postinst"
- cat "${destination}/DEBIAN/postinst" >> "${DEST}"/${LOG_SUBPATH}/install.log
+ cat "${destination}/DEBIAN/postinst" >> "${DEST}/${LOG_SUBPATH}/bsp_postinst.log"
# Armbian create_desktop_package scripts
@@ -86,9 +86,6 @@ create_desktop_package() {
cd ..
fakeroot_dpkg_deb_build "${destination}" "${DEB_STORAGE}/${RELEASE}/${CHOSEN_DESKTOP}_${REVISION}_all.deb"
- # cleanup
- rm -rf "${tmp_dir}"
-
unset aggregated_content
}
@@ -100,7 +97,7 @@ create_bsp_desktop_package() {
local package_name="${BSP_DESKTOP_PACKAGE_FULLNAME}"
local destination tmp_dir
- tmp_dir=$(mktemp -d)
+ tmp_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
destination=${tmp_dir}/${BOARD}/${BSP_DESKTOP_PACKAGE_FULLNAME}
rm -rf "${destination}"
mkdir -p "${destination}"/DEBIAN
@@ -148,9 +145,6 @@ create_bsp_desktop_package() {
cd ..
fakeroot_dpkg_deb_build "${destination}" "${DEB_STORAGE}/${RELEASE}/${package_name}.deb"
- # cleanup
- rm -rf "${tmp_dir}"
-
unset aggregated_content
}
diff --git a/lib/functions/cli/cli-entrypoint.sh b/lib/functions/cli/cli-entrypoint.sh
index 4590d7e37..b16ea387d 100644
--- a/lib/functions/cli/cli-entrypoint.sh
+++ b/lib/functions/cli/cli-entrypoint.sh
@@ -15,6 +15,8 @@ function cli_entrypoint() {
:
elif [[ "${1}" == docker || "${1}" == dockerpurge || "${1}" == docker-shell ]] && grep -q "$(whoami)" <(getent group docker); then
:
+ elif [[ "${CONFIG_DEFS_ONLY}" == "yes" ]]; then # not really building in this case, just gathering meta-data.
+ :
else
display_alert "This script requires root privileges, trying to use sudo" "" "wrn"
sudo "${SRC}/compile.sh" "$@"
@@ -109,7 +111,7 @@ function cli_entrypoint() {
if [[ "${BUILD_ALL}" == "yes" || "${BUILD_ALL}" == "demo" ]]; then
do_main_build_all_ng
else
- # configuration etc
+ # configuration etc - it initializes the extension manager.
do_capturing_defs prepare_and_config_main_build_single # this sets CAPTURED_VARS
if [[ "${CONFIG_DEFS_ONLY}" == "yes" ]]; then
@@ -119,11 +121,13 @@ function cli_entrypoint() {
unset CAPTURED_VARS
fi
- # Allow for custom user-invoked functions. @TODO: check this with extensions usage?
+ # Allow for custom user-invoked functions, or do the default build.
if [[ -z $1 ]]; then
- main_default_build_single
+ main_default_build_single # this cleans up the extension manager
else
+ # @TODO: check this with extensions usage?
eval "$@"
fi
+
fi
}
diff --git a/lib/functions/compilation/atf.sh b/lib/functions/compilation/atf.sh
index 10d9bdec3..d2a30d09f 100644
--- a/lib/functions/compilation/atf.sh
+++ b/lib/functions/compilation/atf.sh
@@ -57,12 +57,9 @@ compile_atf() {
[[ $(type -t atf_custom_postprocess) == function ]] && atf_custom_postprocess 2>&1
- atftempdir=$(mktemp -d)
+ atftempdir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
chmod 700 ${atftempdir}
- # @TODO: these traps are a real trap.
- #trap "rm -rf \"${atftempdir}\" ; exit 0" 0 1 2 3 15
-
# copy files to temp directory
for f in $target_files; do
local f_src
diff --git a/lib/functions/compilation/debs.sh b/lib/functions/compilation/debs.sh
index 2932264c0..f491715a3 100644
--- a/lib/functions/compilation/debs.sh
+++ b/lib/functions/compilation/debs.sh
@@ -3,11 +3,9 @@ compile_firmware() {
local firmwaretempdir plugin_dir
- firmwaretempdir=$(mktemp -d)
+ firmwaretempdir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
chmod 700 ${firmwaretempdir}
- # @TODO: these traps are a real trap.
- #trap "rm -rf \"${firmwaretempdir}\" ; exit 0" 0 1 2 3 15
plugin_dir="armbian-firmware${FULL}"
mkdir -p "${firmwaretempdir}/${plugin_dir}/lib/firmware"
@@ -47,18 +45,14 @@ compile_firmware() {
mv "armbian-firmware${FULL}_${REVISION}_all" "armbian-firmware${FULL}"
rsync -rq "armbian-firmware${FULL}_${REVISION}_all.deb" "${DEB_STORAGE}/"
- # remove temp directory - @TODO: maybe not, just leave thrash behind.
- rm -rf "${firmwaretempdir}"
}
compile_armbian-zsh() {
local tmp_dir armbian_zsh_dir
- tmp_dir=$(mktemp -d)
+ tmp_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
chmod 700 ${tmp_dir}
- # @TODO: these traps are a real trap.
- #trap "rm -rf \"${tmp_dir}\" ; exit 0" 0 1 2 3 15
armbian_zsh_dir=armbian-zsh_${REVISION}_all
display_alert "Building deb" "armbian-zsh" "info"
@@ -124,18 +118,15 @@ compile_armbian-zsh() {
fakeroot_dpkg_deb_build "${tmp_dir}/${armbian_zsh_dir}"
rsync --remove-source-files -rq "${tmp_dir}/${armbian_zsh_dir}.deb" "${DEB_STORAGE}/"
- rm -rf "${tmp_dir}"
}
compile_armbian-config() {
local tmp_dir armbian_config_dir
- tmp_dir=$(mktemp -d)
+ tmp_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
chmod 700 ${tmp_dir}
- # @TODO: these traps are a real trap.
- #trap "rm -rf \"${tmp_dir}\" ; exit 0" 0 1 2 3 15
armbian_config_dir=armbian-config_${REVISION}_all
display_alert "Building deb" "armbian-config" "info"
@@ -179,7 +170,6 @@ compile_armbian-config() {
fakeroot_dpkg_deb_build "${tmp_dir}/${armbian_config_dir}"
rsync --remove-source-files -rq "${tmp_dir}/${armbian_config_dir}.deb" "${DEB_STORAGE}/"
- rm -rf "${tmp_dir}"
}
compile_xilinx_bootgen() {
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index e0bce0699..dc357ee93 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -249,10 +249,8 @@ compile_kernel() {
create_linux-source_package() {
ts=$(date +%s)
local sources_pkg_dir tmp_src_dir
- tmp_src_dir=$(mktemp -d)
+ tmp_src_dir=$(mktemp -d) # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
- # @TODO: these traps are a real trap.
- #trap "rm -rf \"${tmp_src_dir}\" ; exit 0" 0 1 2 3 15
sources_pkg_dir=${tmp_src_dir}/${CHOSEN_KSRC}_${REVISION}_all
mkdir -p "${sources_pkg_dir}"/usr/src/ \
"${sources_pkg_dir}"/usr/share/doc/linux-source-${version}-${LINUXFAMILY} \
@@ -264,7 +262,7 @@ create_linux-source_package() {
display_alert "Compressing sources for the linux-source package"
tar cp --directory="$kerneldir" --exclude='.git' --owner=root . |
pv -N "$(logging_echo_prefix_for_pv "compress_kernel_sources") $display_name" -p -b -r -s "$(du -sb "$kerneldir" --exclude=='.git' | cut -f1)" |
- pixz -4 > "${sources_pkg_dir}/usr/src/linux-source-${version}-${LINUXFAMILY}.tar.xz"
+ pixz -0 > "${sources_pkg_dir}/usr/src/linux-source-${version}-${LINUXFAMILY}.tar.xz" # @TODO: .deb will compress this later. -0 for now, but should be a plain tar
cp COPYING "${sources_pkg_dir}/usr/share/doc/linux-source-${version}-${LINUXFAMILY}/LICENSE"
cat <<- EOF > "${sources_pkg_dir}"/DEBIAN/control
@@ -285,5 +283,4 @@ create_linux-source_package() {
te=$(date +%s)
display_alert "Make the linux-source package" "$(($te - $ts)) sec." "info"
- rm -rf "${tmp_src_dir}"
}
diff --git a/lib/functions/compilation/patching.sh b/lib/functions/compilation/patching.sh
index 52d00010f..861054de2 100644
--- a/lib/functions/compilation/patching.sh
+++ b/lib/functions/compilation/patching.sh
@@ -104,7 +104,7 @@ apply_patch_series() {
local series="${2}"
local bzdir="$(dirname $series)"
local flag
- local err_pt=$(mktemp /tmp/apply_patch_series_XXXXX)
+ local err_pt=$(mktemp /tmp/apply_patch_series_XXXXX) # @OTODO: rpardini: hmm, why is this different from all others?
list=$(gawk '$0 !~ /^#.*|^-.*|^$/' "${series}")
skiplist=$(gawk '$0 ~ /^-.*/' "${series}")
diff --git a/lib/functions/compilation/uboot.sh b/lib/functions/compilation/uboot.sh
index fba1d185b..188c062d6 100644
--- a/lib/functions/compilation/uboot.sh
+++ b/lib/functions/compilation/uboot.sh
@@ -144,7 +144,7 @@ compile_uboot() {
local uboot_name="${CHOSEN_UBOOT}_${REVISION}_${ARCH}"
# create directory structure for the .deb package
- uboottempdir="$(mktemp -d)"
+ uboottempdir="$(mktemp -d)" # subject to TMPDIR/WORKDIR, so is protected by single/common error trap to clean-up.
chmod 700 "${uboottempdir}"
mkdir -p "$uboottempdir/$uboot_name/usr/lib/u-boot" "$uboottempdir/$uboot_name/usr/lib/$uboot_name" "$uboottempdir/$uboot_name/DEBIAN"
@@ -227,7 +227,6 @@ compile_uboot() {
[[ ! -f $uboottempdir/${uboot_name}.deb ]] && exit_with_error "Building u-boot package failed"
rsync --remove-source-files -rq "$uboottempdir/${uboot_name}.deb" "${DEB_STORAGE}/" 2>&1
- rm -rf "$uboottempdir"
display_alert "Built u-boot deb OK" "${uboot_name}.deb" "info"
return 0 # success
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index d4995a6b7..4cc607176 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -10,7 +10,17 @@
# https://github.com/armbian/build/
function do_main_configuration() {
- display_alert "Starting main configuration" "" "info"
+ # set unique mounting directory for this build.
+ MOUNT_UUID=$(uuidgen)
+
+ # Super-global variables, used everywhere. The directories are NOT _created_ here, since this is config stage, not build.
+ export WORKDIR="${SRC}/.tmp/work-${MOUNT_UUID}" # WORKDIR at this stage. It will become TMPDIR later. It has special significance to `mktemp` and others!
+ export SDCARD="${SRC}/.tmp/rootfs-${MOUNT_UUID}" # SDCARD (which is NOT an sdcard, but will be, maybe, one day) is where we work the rootfs before final imaging. "rootfs" stage.
+ export MOUNT="${SRC}/.tmp/mount-${MOUNT_UUID}" # MOUNT ("mounted on the loop") is the mounted root on final image (via loop). "image" stage
+ export EXTENSION_MANAGER_TMP_DIR="${SRC}/.tmp/extensions-${MOUNT_UUID}" # EXTENSION_MANAGER_TMP_DIR used to store extension-composed functions
+ export DESTIMG="${SRC}/.tmp/image-${MOUNT_UUID}" # DESTIMG is where the backing image (raw, huge, sparse file) is kept
+
+ display_alert "Starting main configuration" "${MOUNT_UUID}" "info"
# common options
# daily beta build contains date in subrevision
@@ -283,15 +293,6 @@ function do_main_configuration() {
display_alert "Done with" "desktop config stuff - END" "debug"
- # set unique mounting directory
- MOUNT_UUID=$(uuidgen)
-
- # Super-global variables, used everywhere. They're not _created_ here, since this is config stage, not build.
- export WORKDIR="${SRC}/.tmp/work-${MOUNT_UUID}" # WORKDIR at this stage. It will become TMPDIR later. It has special significance to `mktemp` and others!
- export SDCARD="${SRC}/.tmp/rootfs-${MOUNT_UUID}" # SDCARD (which is NOT an sdcard, but will be, maybe, one day) is where we work the rootfs before final imaging. "rootfs" stage.
- export MOUNT="${SRC}/.tmp/mount-${MOUNT_UUID}" # MOUNT ("mounted on the loop") is the mounted root on final image (via loop). "image" stage
- export DESTIMG="${SRC}/.tmp/image-${MOUNT_UUID}" # DESTIMG is where the backing image (raw, huge, sparse file) is kept
-
# dropbear needs to be configured differently # @TODO: rpardini: yes, and? are you a lost leftover comment from a previous era?
[[ $CRYPTROOT_ENABLE == yes && $RELEASE == xenial ]] && exit_with_error "Encrypted rootfs is not supported in Xenial"
[[ $RELEASE == stretch && $CAN_BUILD_STRETCH != yes ]] && exit_with_error "Building Debian Stretch images with selected kernel is not supported"
diff --git a/lib/functions/configuration/menu.sh b/lib/functions/configuration/menu.sh
index 2d4ac1462..92afcc5c5 100644
--- a/lib/functions/configuration/menu.sh
+++ b/lib/functions/configuration/menu.sh
@@ -35,7 +35,7 @@ show_select_menu() {
show_developer_warning() {
local temp_rc
- temp_rc=$(mktemp)
+ temp_rc=$(mktemp) # @TODO: this is a _very_ early call to mktemp - no TMPDIR set yet - it needs to be cleaned-up somehow
cat <<- 'EOF' > "${temp_rc}"
screen_color = (WHITE,RED,ON)
EOF
diff --git a/lib/functions/general/host.sh b/lib/functions/general/host.sh
index e875dc340..fa1fcbc52 100644
--- a/lib/functions/general/host.sh
+++ b/lib/functions/general/host.sh
@@ -337,7 +337,7 @@ install_pkg_deb() {
local _line=${BASH_LINENO[0]}
local _function=${FUNCNAME[1]}
local _file=$(basename "${BASH_SOURCE[1]}")
- local tmp_file=$(mktemp /tmp/install_log_XXXXX)
+ local tmp_file=$(mktemp /tmp/install_log_XXXXX) # @TODO: rpardini: hmm. why? lets use TMPDIR just like everyone else.
export DEBIAN_FRONTEND=noninteractive
list=$(
diff --git a/lib/functions/image/rootfs-to-image.sh b/lib/functions/image/rootfs-to-image.sh
index f1d327a84..b62ad1f5c 100644
--- a/lib/functions/image/rootfs-to-image.sh
+++ b/lib/functions/image/rootfs-to-image.sh
@@ -19,15 +19,15 @@ create_image_from_sdcard_rootfs() {
[[ $ROOTFS_TYPE == nfs ]] && version=${version}_nfsboot
if [[ $ROOTFS_TYPE != nfs ]]; then
- display_alert "Copying files to" "/"
- rsync -aHWXh \
+ display_alert "Copying files via rsync to" "/"
+ run_host_command_logged rsync -aHWXh \
--exclude="/boot/*" \
--exclude="/dev/*" \
--exclude="/proc/*" \
--exclude="/run/*" \
--exclude="/tmp/*" \
--exclude="/sys/*" \
- --info=progress0,stats1 $SDCARD/ $MOUNT/ 2>&1
+ --info=progress0,stats1 $SDCARD/ $MOUNT/
else
display_alert "Creating rootfs archive" "rootfs.tgz" "info"
tar cp --xattrs --directory=$SDCARD/ --exclude='./boot/*' --exclude='./dev/*' --exclude='./proc/*' --exclude='./run/*' --exclude='./tmp/*' \
@@ -41,14 +41,10 @@ create_image_from_sdcard_rootfs() {
display_alert "Copying files to" "/boot"
if [[ $(findmnt --target $MOUNT/boot -o FSTYPE -n) == vfat ]]; then
# fat32
- rsync -rLtWh \
- --info=progress0,stats1 \
- --log-file="${DEST}"/${LOG_SUBPATH}/install.log $SDCARD/boot $MOUNT 2>&1 #@TODO: log to stdout, terse?
+ run_host_command_logged rsync -rLtWh --info=progress0,stats1 "$SDCARD/boot" "$MOUNT"
else
# ext4
- rsync -aHWXh \
- --info=progress0,stats1 \
- --log-file="${DEST}"/${LOG_SUBPATH}/install.log $SDCARD/boot $MOUNT 2>&1 #@TODO: log to stdout, terse?
+ run_host_command_logged rsync -aHWXh --info=progress0,stats1 "$SDCARD/boot" "$MOUNT"
fi
call_extension_method "pre_update_initramfs" "config_pre_update_initramfs" << 'PRE_UPDATE_INITRAMFS'
@@ -58,7 +54,7 @@ PRE_UPDATE_INITRAMFS
# stage: create final initramfs
[[ -n $KERNELSOURCE ]] && {
- update_initramfs $MOUNT
+ update_initramfs "$MOUNT"
}
# DEBUG: print free space
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index b075a76ab..5981d9547 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -4,6 +4,8 @@ function logging_init() {
# globals
export padding="" left_marker="[" right_marker="]"
export normal_color="\x1B[0m" gray_color="\e[1;30m" # "bright black", which is grey
+ declare -i logging_section_counter=0 # -i: integer
+ export logging_section_counter
}
function logging_error_show_log() {
@@ -39,9 +41,12 @@ function do_with_logging() {
[[ -z "${DEST}" ]] && exit_with_error "DEST is not defined. Can't start logging."
# @TODO: check we're not currently logging (eg: this has been called 2 times without exiting)
- export CURRENT_LOGGING_SECTION=${LOG_SECTION:-build}
- export CURRENT_LOGGING_DIR="${DEST}/${LOG_SUBPATH}"
- export CURRENT_LOGFILE="${CURRENT_LOGGING_DIR}/000.${CURRENT_LOGGING_SECTION}.log"
+ export logging_section_counter=$((logging_section_counter + 1)) # increment counter, used in filename
+ export CURRENT_LOGGING_COUNTER
+ CURRENT_LOGGING_COUNTER="$(printf "%03d" "$logging_section_counter")"
+ export CURRENT_LOGGING_SECTION=${LOG_SECTION:-build} # default to "build"
+ export CURRENT_LOGGING_DIR="${DEST}/${LOG_SUBPATH}" # origin: build-all-ng - @TODO: rpardini: lets revisit this later
+ export CURRENT_LOGFILE="${CURRENT_LOGGING_DIR}/${CURRENT_LOGGING_COUNTER}.${CURRENT_LOGGING_SECTION}.log"
mkdir -p "${CURRENT_LOGGING_DIR}"
# Markers for CI (GitHub Actions); CI env var comes predefined as true there.
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index 255281667..82ea46dae 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -4,7 +4,7 @@ function chroot_sdcard_apt_get_install() {
}
function chroot_sdcard_apt_get() {
- local -a apt_params=("-${APT_OPTS:-yqq}")
+ local -a apt_params=("-${APT_OPTS:-y}")
[[ $NO_APT_CACHER != yes ]] && apt_params+=(
-o "Acquire::http::Proxy=\"http://${APT_PROXY_ADDR:-localhost:3142}\""
-o "Acquire::http::Proxy::localhost=\"DIRECT\""
diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh
index 32be7355d..cad494207 100644
--- a/lib/functions/main/config-prepare.sh
+++ b/lib/functions/main/config-prepare.sh
@@ -133,7 +133,7 @@ function prepare_and_config_main_build_single() {
[[ ${KERNEL_CONFIGURE} == prebuilt ]] && [[ -z ${REPOSITORY_INSTALL} ]] &&
REPOSITORY_INSTALL="u-boot,kernel,bsp,armbian-zsh,armbian-config,armbian-bsp-cli,armbian-firmware${BUILD_DESKTOP:+,armbian-desktop,armbian-bsp-desktop}"
- do_main_configuration
+ do_main_configuration # This initializes the extension manager among a lot of other things
# @TODO: this does not belong in configuration. it's a compilation thing. move there
# optimize build time with 100% CPU usage
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index 5d868a381..34aafb1d0 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -1,6 +1,15 @@
# This does NOT run under the logging manager. We should invoke the do_with_logging wrapper for
# strategic parts of this. Attention: rootfs does it's own logging, so just let that be.
main_default_build_single() {
+
+ # Starting work. Export TMPDIR, which will be picked up by all `mktemp` invocations hopefully.
+ # Runner functions in logging/runners.sh will explicitly unset TMPDIR before invoking chroot.
+ # Invoking chroot directly will fail in subtle ways, so, please use the runner.sh functions.
+ display_alert "Starting single build, exporting TMPDIR" "${WORKDIR}" "debug"
+ mkdir -p "${WORKDIR}"
+ export TMPDIR="${WORKDIR}"
+ # @todo: handle this in the exit trap, don't leave garbage behind when exiting.
+
start=$(date +%s)
# Check and install dependencies, directory structure and settings
# The OFFLINE_WORK variable inside the function
@@ -117,6 +126,16 @@ Really one of the last hooks ever called. The build has ended. Congratulations.
- *NOTE:* this will run only if there were no errors during build process.
RUN_AFTER_BUILD
+ # Cleanup. Remove the WORKDIR, unset the TMPDIR
+ unset TMPDIR
+ if [[ -d "${WORKDIR}" ]]; then
+ display_alert "Cleaning up WORKDIR" "$(du -h -s "$WORKDIR")" "debug"
+ rm -rf "${WORKDIR}"
+ fi
+
+ # cleanup the extension manager, that was initialized during prepare_and_config_main_build_single
+ cleanup_extension_manager
+
end=$(date +%s)
runtime=$(((end - start) / 60))
display_alert "Runtime" "$runtime min" "info"
diff --git a/lib/functions/rootfs/rootfs-desktop.sh b/lib/functions/rootfs/rootfs-desktop.sh
index 571571045..3564d8df2 100644
--- a/lib/functions/rootfs/rootfs-desktop.sh
+++ b/lib/functions/rootfs/rootfs-desktop.sh
@@ -9,7 +9,7 @@ install_ppa_prerequisites() {
# Myy : TODO Try to find a way to install this package only when
# we encounter a PPA.
- run_on_sdcard "DEBIAN_FRONTEND=noninteractive apt install -yqq software-properties-common"
+ chroot_sdcard_apt_get_install "software-properties-common"
}
@@ -34,7 +34,7 @@ add_apt_sources() {
display_alert "Adding APT Source ${new_apt_source}"
# -y -> Assumes yes to all queries
# -n -> Do not update package cache after adding
- run_on_sdcard "add-apt-repository -y -n \"${new_apt_source}\""
+ chroot_sdcard "add-apt-repository -y -n \"${new_apt_source}\""
display_alert "Return code : $?"
# temporally exception for jammy
@@ -52,7 +52,7 @@ add_apt_sources() {
display_alert "Adding GPG Key ${apt_source_gpg_filepath}"
local apt_source_gpg_filename="$(basename ${apt_source_gpg_filepath})"
cp "${apt_source_gpg_filepath}" "${SDCARD}/tmp/${apt_source_gpg_filename}"
- run_on_sdcard "apt-key add \"/tmp/${apt_source_gpg_filename}\""
+ chroot_sdcard "apt-key add \"/tmp/${apt_source_gpg_filename}\""
echo "APT Key returned : $?"
fi
done
@@ -66,9 +66,9 @@ add_desktop_package_sources() {
# Myy : I see Snap and Flatpak coming up in the next releases
# so... let's prepare for that
add_apt_sources
- run_on_sdcard "apt -y -q update"
- ls -l "${SDCARD}/etc/apt/sources.list.d" >> "${DEST}"/${LOG_SUBPATH}/install.log
- cat "${SDCARD}/etc/apt/sources.list" >> "${DEST}"/${LOG_SUBPATH}/install.log
+ chroot_sdcard_apt_get "update"
+ ls -l "${SDCARD}/etc/apt/sources.list.d" >> "${DEST}/${LOG_SUBPATH}/desktop_packages_apt_sources.log"
+ cat "${SDCARD}/etc/apt/sources.list" >> "${DEST}/${LOG_SUBPATH}/desktop_packages_apt_sources.log"
}
@@ -76,20 +76,20 @@ add_desktop_package_sources() {
desktop_postinstall() {
# disable display manager for the first run
- run_on_sdcard "systemctl --no-reload disable lightdm.service >/dev/null 2>&1"
- run_on_sdcard "systemctl --no-reload disable gdm3.service >/dev/null 2>&1"
+ chroot_sdcard "systemctl --no-reload disable lightdm.service"
+ chroot_sdcard "systemctl --no-reload disable gdm3.service"
# update packages index
- run_on_sdcard "DEBIAN_FRONTEND=noninteractive apt-get update >/dev/null 2>&1"
+ chroot_sdcard_apt_get "update"
# install per board packages
if [[ -n ${PACKAGE_LIST_DESKTOP_BOARD} ]]; then
- run_on_sdcard "DEBIAN_FRONTEND=noninteractive apt-get -yqq --no-install-recommends install $PACKAGE_LIST_DESKTOP_BOARD"
+ chroot_sdcard_apt_get_install "$PACKAGE_LIST_DESKTOP_BOARD"
fi
# install per family packages
if [[ -n ${PACKAGE_LIST_DESKTOP_FAMILY} ]]; then
- run_on_sdcard "DEBIAN_FRONTEND=noninteractive apt-get -yqq --no-install-recommends install $PACKAGE_LIST_DESKTOP_FAMILY"
+ chroot_sdcard_apt_get_install "$PACKAGE_LIST_DESKTOP_FAMILY"
fi
}
From 84ad3ec52fa01eacca30bd3754853cff312dde5a Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 22 Jan 2022 10:35:06 +0000
Subject: [PATCH] armbian-next: bye `PKG_PREFIX`, hello
`run_host_x86_binary_logged()` wrapper function; better error handling
- we've x86-only utilities that might need to be run on non-x86 build machines
- previously duplicated logic in PKG_PREFIX variable refactored into logged function
- added centralized debug logging
- replace all PKG_PREFIX usage with the new wrapper function, which already handles logging and errors.
- mostly FIP tooling invocations
- but also the boot_logo image builder
- wrapper function delegates to common `run_host_command_logged`
- wrap other FIP invocations with `run_host_command_logged` too, for tidy logging
- avoid using conditionals when invoking functions; that completely disables error handling inside the called function
- use explicit bash opts instead of shortcuts like `set -e`
- a _lot_ of debug logging added
---
compile.sh | 7 +-
config/sources/families/include/meson64_common.inc | 94 ++--
.../sources/families/include/rockchip64_common.inc | 17 +-
config/sources/families/meson-gxbb.conf | 58 +--
config/sources/families/meson-gxl.conf | 6 -
lib/functions/cli/cli-entrypoint.sh | 6 +-
lib/functions/compilation/uboot.sh | 6 +-
lib/functions/general/host.sh | 2 +-
lib/functions/logging/runners.sh | 23 +
lib/functions/rootfs/boot_logo.sh | 12 +-
lib/library-functions.sh | 558 ++++++++++++++-------
lib/tools/gen-library.sh | 12 +-
12 files changed, 497 insertions(+), 304 deletions(-)
diff --git a/compile.sh b/compile.sh
index 27d598bd2..5e92ddefe 100755
--- a/compile.sh
+++ b/compile.sh
@@ -13,8 +13,11 @@
# use configuration files like config-default.conf to set the build configuration
# check Armbian documentation https://docs.armbian.com/ for more info
-set -e # disallow errors
-set -o errtrace # error trace
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+# Important, go read http://mywiki.wooledge.org/BashFAQ/105 NOW!
SRC="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
cd "${SRC}" || exit
diff --git a/config/sources/families/include/meson64_common.inc b/config/sources/families/include/meson64_common.inc
index 4d9c9e7c9..f69669a5f 100644
--- a/config/sources/families/include/meson64_common.inc
+++ b/config/sources/families/include/meson64_common.inc
@@ -41,48 +41,38 @@ case $BRANCH in
esac
-if [ "$(uname -m)" = "aarch64" ]; then
- if [[ "$(lsb_release -sc)" == "bullseye" || "$(lsb_release -sc)" == "focal" || "$(lsb_release -sc)" == "hirsute" || "$(lsb_release -sc)" == "impish" || "$(lsb_release -sc)" == "jammy" ]]; then
- PKG_PREFIX="qemu-x86_64-static -L /usr/x86_64-linux-gnu "
- else
- PKG_PREFIX="qemu-x86_64 "
- fi
-else
- PKG_PREFIX=""
-fi
-
# this helper function includes postprocess for p212 and its variants.
# $1 PATH for uboot blob repo
# $2 dir name in uboot blob repo
uboot_gxl_postprocess() {
- mv u-boot.bin bl33.bin
+ run_host_command_logged mv -v u-boot.bin bl33.bin
- $1/blx_fix.sh $1/$2/bl30.bin \
+ run_host_command_logged $1/blx_fix.sh $1/$2/bl30.bin \
$1/$2/zero_tmp \
$1/$2/bl30_zero.bin \
$1/$2/bl301.bin \
$1/$2/bl301_zero.bin \
$1/$2/bl30_new.bin bl30
- python $1/acs_tool.pyc $1/$2/bl2.bin \
+ run_host_command_logged python $1/acs_tool.pyc $1/$2/bl2.bin \
$1/$2/bl2_acs.bin \
$1/$2/acs.bin 0
- $1/blx_fix.sh $1/$2/bl2_acs.bin \
+ run_host_command_logged $1/blx_fix.sh $1/$2/bl2_acs.bin \
$1/$2/zero_tmp \
$1/$2/bl2_zero.bin \
$1/$2/bl21.bin \
$1/$2/bl21_zero.bin \
$1/$2/bl2_new.bin bl2
- $PKG_PREFIX$1/$2/aml_encrypt_gxl --bl3enc --input $1/$2/bl30_new.bin
- $PKG_PREFIX$1/$2/aml_encrypt_gxl --bl3enc --input $1/$2/bl31.img
- $PKG_PREFIX$1/$2/aml_encrypt_gxl --bl3enc --input bl33.bin
+ run_host_x86_binary_logged $1/$2/aml_encrypt_gxl --bl3enc --input $1/$2/bl30_new.bin
+ run_host_x86_binary_logged $1/$2/aml_encrypt_gxl --bl3enc --input $1/$2/bl31.img
+ run_host_x86_binary_logged $1/$2/aml_encrypt_gxl --bl3enc --input bl33.bin
- $PKG_PREFIX$1/$2/aml_encrypt_gxl --bl2sig --input $1/$2/bl2_new.bin \
+ run_host_x86_binary_logged $1/$2/aml_encrypt_gxl --bl2sig --input $1/$2/bl2_new.bin \
--output bl2.n.bin.sig
- $PKG_PREFIX$1/$2/aml_encrypt_gxl --bootmk \
+ run_host_x86_binary_logged $1/$2/aml_encrypt_gxl --bootmk \
--output u-boot.bin \
--bl2 bl2.n.bin.sig \
--bl30 $1/$2/bl30_new.bin.enc \
@@ -94,42 +84,42 @@ uboot_gxl_postprocess() {
# $1 PATH for uboot blob repo
# $2 dir name in uboot blob repo
uboot_axg_postprocess_ng() {
- mv u-boot.bin bl33.bin
+ run_host_command_logged mv -v u-boot.bin bl33.bin
- $1/blx_fix.sh $1/$2/bl30.bin \
+ run_host_command_logged $1/blx_fix.sh $1/$2/bl30.bin \
$1/$2/zero_tmp \
$1/$2/bl30_zero.bin \
$1/$2/bl301.bin \
$1/$2/bl301_zero.bin \
$1/$2/bl30_new.bin bl30
- python3 $1/acs_tool.py $1/$2/bl2.bin \
+ run_host_command_logged python3 $1/acs_tool.py $1/$2/bl2.bin \
$1/$2/bl2_acs.bin \
$1/$2/acs.bin 0
- $1/blx_fix.sh $1/$2/bl2_acs.bin \
+ run_host_command_logged $1/blx_fix.sh $1/$2/bl2_acs.bin \
$1/$2/zero_tmp \
$1/$2/bl2_zero.bin \
$1/$2/bl21.bin \
$1/$2/bl21_zero.bin \
$1/$2/bl2_new.bin bl2
- $PKG_PREFIX$1/$2/aml_encrypt_axg --bl3sig --input $1/$2/bl30_new.bin \
+ run_host_x86_binary_logged $1/$2/aml_encrypt_axg --bl3sig --input $1/$2/bl30_new.bin \
--output bl30_new.bin.enc \
--level v3 --type bl30
- $PKG_PREFIX$1/$2/aml_encrypt_axg --bl3sig --input $1/$2/bl31.img \
+ run_host_x86_binary_logged $1/$2/aml_encrypt_axg --bl3sig --input $1/$2/bl31.img \
--output bl31.img.enc \
--level v3 --type bl31
- $PKG_PREFIX$1/$2/aml_encrypt_axg --bl3sig --input bl33.bin --compress lz4 \
+ run_host_x86_binary_logged $1/$2/aml_encrypt_axg --bl3sig --input bl33.bin --compress lz4 \
--output bl33.bin.enc \
--level v3 --type bl33
- $PKG_PREFIX$1/$2/aml_encrypt_axg --bl2sig --input $1/$2/bl2_new.bin \
+ run_host_x86_binary_logged $1/$2/aml_encrypt_axg --bl2sig --input $1/$2/bl2_new.bin \
--output bl2.n.bin.sig
- $PKG_PREFIX$1/$2/aml_encrypt_axg --bootmk \
+ run_host_x86_binary_logged $1/$2/aml_encrypt_axg --bootmk \
--output u-boot.bin \
--bl2 bl2.n.bin.sig \
--bl30 bl30_new.bin.enc \
@@ -141,44 +131,44 @@ uboot_axg_postprocess_ng() {
# $1 PATH for uboot blob repo
# $2 family g12a or g12b
uboot_g12_postprocess() {
- mv u-boot.bin bl33.bin
+ run_host_command_logged mv -v u-boot.bin bl33.bin
- $1/blx_fix.sh $1/bl30.bin \
+ run_host_command_logged $1/blx_fix.sh $1/bl30.bin \
zero_tmp \
bl30_zero.bin \
$1/bl301.bin \
bl301_zero.bin \
bl30_new.bin bl30
- $1/blx_fix.sh $1/bl2.bin \
+ run_host_command_logged $1/blx_fix.sh $1/bl2.bin \
zero_tmp \
bl2_zero.bin \
$1/acs.bin \
bl21_zero.bin \
bl2_new.bin bl2
- $PKG_PREFIX$1/aml_encrypt_$2 --bl30sig \
+ run_host_x86_binary_logged $1/aml_encrypt_$2 --bl30sig \
--input bl30_new.bin \
--output bl30_new.bin.g12.enc \
--level v3
- $PKG_PREFIX$1/aml_encrypt_$2 --bl3sig \
+ run_host_x86_binary_logged $1/aml_encrypt_$2 --bl3sig \
--input bl30_new.bin.g12.enc \
--output bl30_new.bin.enc \
--level v3 --type bl30
- $PKG_PREFIX$1/aml_encrypt_$2 --bl3sig \
+ run_host_x86_binary_logged $1/aml_encrypt_$2 --bl3sig \
--input $1/bl31.img \
--output bl31.img.enc \
--level v3 --type bl31
- $PKG_PREFIX$1/aml_encrypt_$2 --bl3sig \
+ run_host_x86_binary_logged $1/aml_encrypt_$2 --bl3sig \
--input bl33.bin \
--compress lz4 \
--output bl33.bin.enc \
--level v3 --type bl33
- $PKG_PREFIX$1/aml_encrypt_$2 --bl2sig \
+ run_host_x86_binary_logged $1/aml_encrypt_$2 --bl2sig \
--input bl2_new.bin \
--output bl2.n.bin.sig
if [ -e $1/lpddr3_1d.fw ]; then
- $PKG_PREFIX$1/aml_encrypt_$2 --bootmk --output u-boot.bin \
+ run_host_x86_binary_logged $1/aml_encrypt_$2 --bootmk --output u-boot.bin \
--bl2 bl2.n.bin.sig \
--bl30 bl30_new.bin.enc \
--bl31 bl31.img.enc \
@@ -194,7 +184,7 @@ uboot_g12_postprocess() {
--ddrfw9 $1/lpddr3_1d.fw \
--level v3
else
- $PKG_PREFIX$1/aml_encrypt_$2 --bootmk --output u-boot.bin \
+ run_host_x86_binary_logged $1/aml_encrypt_$2 --bootmk --output u-boot.bin \
--bl2 bl2.n.bin.sig \
--bl30 bl30_new.bin.enc \
--bl31 bl31.img.enc \
@@ -215,31 +205,31 @@ uboot_g12_postprocess() {
# this helper function includes postprocess for meson gxl and gxm.
# $1 PATH for uboot blob repo
uboot_gxl_postprocess_ng() {
- mv u-boot.bin bl33.bin
+ run_host_command_logged mv -v u-boot.bin bl33.bin
- $1/blx_fix.sh $1/bl30.bin \
+ run_host_command_logged $1/blx_fix.sh $1/bl30.bin \
$1/zero_tmp \
$1/bl30_zero.bin \
$1/bl301.bin \
$1/bl301_zero.bin \
$1/bl30_new.bin bl30
- python3 $1/acs_tool.py $1/bl2.bin $1/bl2_acs.bin $1/acs.bin 0
+ run_host_command_logged python3 $1/acs_tool.py $1/bl2.bin $1/bl2_acs.bin $1/acs.bin 0
- $1/blx_fix.sh $1/bl2_acs.bin \
+ run_host_command_logged $1/blx_fix.sh $1/bl2_acs.bin \
$1/zero_tmp \
$1/bl2_zero.bin \
$1/bl21.bin \
$1/bl21_zero.bin \
$1/bl2_new.bin bl2
- $1/aml_encrypt_gxl --bl3enc --input $1/bl30_new.bin
- $1/aml_encrypt_gxl --bl3enc --input $1/bl31.img
- $1/aml_encrypt_gxl --bl3enc --input bl33.bin
- $1/aml_encrypt_gxl --bl2sig --input $1/bl2_new.bin \
+ run_host_command_logged $1/aml_encrypt_gxl --bl3enc --input $1/bl30_new.bin
+ run_host_command_logged $1/aml_encrypt_gxl --bl3enc --input $1/bl31.img
+ run_host_command_logged $1/aml_encrypt_gxl --bl3enc --input bl33.bin
+ run_host_command_logged $1/aml_encrypt_gxl --bl2sig --input $1/bl2_new.bin \
--output bl2.n.bin.sig
- $1/aml_encrypt_gxl --bootmk --output u-boot.bin \
+ run_host_command_logged $1/aml_encrypt_gxl --bootmk --output u-boot.bin \
--bl2 bl2.n.bin.sig \
--bl30 $1/bl30_new.bin.enc \
--bl31 $1/bl31.img.enc \
@@ -247,8 +237,8 @@ uboot_gxl_postprocess_ng() {
}
write_uboot_platform() {
- dd if=$1/u-boot.bin of=$2 bs=1 count=442 conv=fsync > /dev/null 2>&1
- dd if=$1/u-boot.bin of=$2 bs=512 skip=1 seek=1 conv=fsync > /dev/null 2>&1
+ dd if=$1/u-boot.bin of=$2 bs=1 count=442 conv=fsync 2>&1
+ dd if=$1/u-boot.bin of=$2 bs=512 skip=1 seek=1 conv=fsync 2>&1
}
family_tweaks_bsp() {
@@ -283,7 +273,7 @@ family_tweaks_bsp() {
cat <<- EOF > "$destination"/etc/X11/xorg.conf
Section "Device"
Identifier "DRM Graphics Acclerated"
-
+
## Use modesetting and glamor
Driver "modesetting"
Option "AccelMethod" "glamor" ### "glamor" to enable 3D acceleration, "none" to disable.
@@ -291,9 +281,9 @@ family_tweaks_bsp() {
Option "Dri2Vsync" "true"
Option "TripleBuffer" "True"
## End glamor configuration
-
+
EndSection
-
+
Section "Screen"
Identifier "Default Screen"
SubSection "Display"
diff --git a/config/sources/families/include/rockchip64_common.inc b/config/sources/families/include/rockchip64_common.inc
index 03efae1ed..a6cc52133 100644
--- a/config/sources/families/include/rockchip64_common.inc
+++ b/config/sources/families/include/rockchip64_common.inc
@@ -15,19 +15,6 @@ BOOTPATCHDIR="u-boot-rockchip64"
PACKAGE_LIST_FAMILY="ethtool"
RKBIN_DIR="$SRC/cache/sources/rkbin-tools"
-if [ "$(uname -m)" = "aarch64" ]; then
- case "$(lsb_release -sc)" in
- "bullseye" | "focal" | "hirsute" | "impish" | "jammy")
- PKG_PREFIX="qemu-x86_64-static -L /usr/x86_64-linux-gnu "
- ;;
- *)
- PKG_PREFIX="qemu-x86_64 -L /usr/x86_64-linux-gnu "
- ;;
- esac
-else
- PKG_PREFIX=""
-fi
-
BOOT_SOC=$(expr $BOOTCONFIG : '.*\(rk[[:digit:]]\+.*\)_.*')
if [[ $BOOT_SOC == rk3399 ]]; then
@@ -153,8 +140,8 @@ uboot_custom_postprocess() {
local tempfile=$(mktemp)
tools/mkimage -n $BOOT_SOC -T rksd -d $RKBIN_DIR/$DDR_BLOB idbloader.bin
cat $RKBIN_DIR/$MINILOADER_BLOB >> idbloader.bin
- $PKG_PREFIX$RKBIN_DIR/tools/loaderimage --pack --uboot ./u-boot-dtb.bin uboot.img 0x200000
- $PKG_PREFIX$RKBIN_DIR/tools/trust_merger --replace bl31.elf $RKBIN_DIR/$BL31_BLOB trust.ini
+ run_host_x86_binary_logged $RKBIN_DIR/tools/loaderimage --pack --uboot ./u-boot-dtb.bin uboot.img 0x200000
+ run_host_x86_binary_logged $RKBIN_DIR/tools/trust_merger --replace bl31.elf $RKBIN_DIR/$BL31_BLOB trust.ini
else
echo "Unsupported u-boot processing configuration!"
diff --git a/config/sources/families/meson-gxbb.conf b/config/sources/families/meson-gxbb.conf
index e78c1739d..2c02fbc6d 100644
--- a/config/sources/families/meson-gxbb.conf
+++ b/config/sources/families/meson-gxbb.conf
@@ -5,16 +5,16 @@ fi
uboot_custom_postprocess() {
if [[ $BOARD == odroidc2 ]]; then
- local t=$SRC/cache/sources/odroidc2-blobs/
- $PKG_PREFIX$t/fip_create --bl30 $t/gxb/bl30.bin \
- --bl301 $t/gxb/bl301.bin \
- --bl31 $t/gxb/bl31.bin \
+ local fip_blobs_dir="$SRC/cache/sources/odroidc2-blobs/"
+ run_host_x86_binary_logged $fip_blobs_dir/fip_create --bl30 $fip_blobs_dir/gxb/bl30.bin \
+ --bl301 $fip_blobs_dir/gxb/bl301.bin \
+ --bl31 $fip_blobs_dir/gxb/bl31.bin \
--bl33 u-boot.bin \
fip.bin
- $PKG_PREFIX$t/fip_create --dump fip.bin
- cat $t/gxb/bl2.package fip.bin > boot_new.bin
+ run_host_x86_binary_logged $fip_blobs_dir/fip_create --dump fip.bin
+ cat $fip_blobs_dir/gxb/bl2.package fip.bin > boot_new.bin
rm -f u-boot.img
- $PKG_PREFIX$t/gxb/aml_encrypt_gxb --bootsig \
+ run_host_x86_binary_logged $fip_blobs_dir/gxb/aml_encrypt_gxb --bootsig \
--input boot_new.bin \
--output u-boot.img
rm -f u-boot.bin
@@ -22,37 +22,37 @@ uboot_custom_postprocess() {
fi
if [[ $BOARD == nanopik2-s905 ]]; then
- local t=$SRC/cache/sources/odroidc2-blobs/
+ local fip_blobs_dir=$SRC/cache/sources/odroidc2-blobs/
mv u-boot.bin bl33.bin
- $t/blx_fix.sh $t/k2/bl30.bin \
- $t/k2/zero_tmp \
- $t/k2/bl30_zero.bin \
- $t/k2/bl301.bin \
- $t/k2/bl301_zero.bin \
- $t/k2/bl30_new.bin bl30
+ $fip_blobs_dir/blx_fix.sh $fip_blobs_dir/k2/bl30.bin \
+ $fip_blobs_dir/k2/zero_tmp \
+ $fip_blobs_dir/k2/bl30_zero.bin \
+ $fip_blobs_dir/k2/bl301.bin \
+ $fip_blobs_dir/k2/bl301_zero.bin \
+ $fip_blobs_dir/k2/bl30_new.bin bl30
- $PKG_PREFIX$t/k2/fip_create --bl30 $t/k2/bl30_new.bin \
- --bl31 $t/k2/bl31.img \
+ run_host_x86_binary_logged $fip_blobs_dir/k2/fip_create --bl30 $fip_blobs_dir/k2/bl30_new.bin \
+ --bl31 $fip_blobs_dir/k2/bl31.img \
--bl33 bl33.bin \
- $t/k2/fip.bin
+ $fip_blobs_dir/k2/fip.bin
- $PKG_PREFIX$t/k2/fip_create --dump $t/k2/fip.bin
+ run_host_x86_binary_logged $fip_blobs_dir/k2/fip_create --dump $fip_blobs_dir/k2/fip.bin
- python $t/acs_tool.pyc $t/k2/bl2.bin \
- $t/k2/bl2_acs.bin \
- $t/k2/acs.bin 0
+ python $fip_blobs_dir/acs_tool.pyc $fip_blobs_dir/k2/bl2.bin \
+ $fip_blobs_dir/k2/bl2_acs.bin \
+ $fip_blobs_dir/k2/acs.bin 0
- $t/blx_fix.sh $t/k2/bl2_acs.bin \
- $t/k2/zero_tmp \
- $t/k2/bl2_zero.bin \
- $t/k2/bl21.bin \
- $t/k2/bl21_zero.bin \
- $t/k2/bl2_new.bin bl2
+ $fip_blobs_dir/blx_fix.sh $fip_blobs_dir/k2/bl2_acs.bin \
+ $fip_blobs_dir/k2/zero_tmp \
+ $fip_blobs_dir/k2/bl2_zero.bin \
+ $fip_blobs_dir/k2/bl21.bin \
+ $fip_blobs_dir/k2/bl21_zero.bin \
+ $fip_blobs_dir/k2/bl2_new.bin bl2
- cat $t/k2/bl2_new.bin $t/k2/fip.bin > boot_new.bin
+ cat $fip_blobs_dir/k2/bl2_new.bin $fip_blobs_dir/k2/fip.bin > boot_new.bin
- $PKG_PREFIX$t/k2/aml_encrypt_gxb --bootsig \
+ run_host_x86_binary_logged $fip_blobs_dir/k2/aml_encrypt_gxb --bootsig \
--input boot_new.bin \
--output u-boot.bin
diff --git a/config/sources/families/meson-gxl.conf b/config/sources/families/meson-gxl.conf
index 8f42459ea..8a98b09ef 100644
--- a/config/sources/families/meson-gxl.conf
+++ b/config/sources/families/meson-gxl.conf
@@ -1,23 +1,17 @@
source "${BASH_SOURCE%/*}/include/meson64_common.inc"
if [[ $BOARD == lafrite ]]; then
-
UBOOT_TARGET_MAP="u-boot-dtb.img;;u-boot.bin:u-boot.bin u-boot-dtb.img"
-
fi
if [[ $BOARD = khadas-vim1 ]]; then
-
# temporally workaround - using prebuild u-boot from https://github.com/khadas/khadas-uboot/releases/tag/0.11
UBOOT_TARGET_MAP=";;$SRC/packages/blobs/meson/u-boot-vim1-sd.bin:u-boot.bin"
-
fi
if [[ $BOARD = khadas-vim2 ]]; then
-
# temporally workaround - using prebuild u-boot from https://github.com/khadas/khadas-uboot/releases/tag/0.11
UBOOT_TARGET_MAP=";;$SRC/packages/blobs/meson/u-boot-vim2-sd.bin:u-boot.bin"
-
fi
family_tweaks() {
diff --git a/lib/functions/cli/cli-entrypoint.sh b/lib/functions/cli/cli-entrypoint.sh
index 99adc61a4..4590d7e37 100644
--- a/lib/functions/cli/cli-entrypoint.sh
+++ b/lib/functions/cli/cli-entrypoint.sh
@@ -101,8 +101,10 @@ function cli_entrypoint() {
##
# reset completely after sourcing config file
- set -e # disallow errors
- set -o errtrace # error trace
+ #set -o pipefail # trace ERR through pipes - will be enabled "soon"
+ #set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+ set -o errtrace # trace ERR through - enabled
+ set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
if [[ "${BUILD_ALL}" == "yes" || "${BUILD_ALL}" == "demo" ]]; then
do_main_build_all_ng
diff --git a/lib/functions/compilation/uboot.sh b/lib/functions/compilation/uboot.sh
index 183298c4b..fba1d185b 100644
--- a/lib/functions/compilation/uboot.sh
+++ b/lib/functions/compilation/uboot.sh
@@ -72,7 +72,7 @@ function compile_uboot_target() {
if [[ $(type -t uboot_custom_postprocess) == function ]]; then
display_alert "${uboot_prefix}Postprocessing u-boot" "${version} ${target_make}"
- uboot_custom_postprocess 2>&1
+ uboot_custom_postprocess
fi
display_alert "${uboot_prefix}Preparing u-boot targets packaging" "${version} ${target_make}"
@@ -155,9 +155,7 @@ compile_uboot() {
for target in ${UBOOT_TARGET_MAP}; do
IFS="${_old_ifs}" # restore for the body of loop
export target uboot_name uboottempdir toolchain version uboot_target_counter
- compile_uboot_target || {
- exit_with_error "Failed to compile u-boot target" "${target}"
- }
+ compile_uboot_target
uboot_target_counter=$((uboot_target_counter + 1))
IFS="${_new_ifs}" # split on newlines only for rest of loop
done
diff --git a/lib/functions/general/host.sh b/lib/functions/general/host.sh
index d292fcf10..e875dc340 100644
--- a/lib/functions/general/host.sh
+++ b/lib/functions/general/host.sh
@@ -69,7 +69,7 @@ prepare_host() {
nfs-kernel-server ntpdate p7zip-full parted patchutils pigz pixz \
pkg-config pv python3-dev python3-distutils qemu-user-static rsync swig \
systemd-container u-boot-tools udev unzip uuid-dev wget whiptail zip \
- zlib1g-dev"
+ zlib1g-dev file"
if [[ $(dpkg --print-architecture) == amd64 ]]; then
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index 97b13ddef..255281667 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -90,6 +90,7 @@ function run_host_command_logged_raw() {
fi
if [[ $exit_code != 0 ]]; then
display_alert "cmd exited with code ${exit_code}" "$*" "wrn"
+ display_alert "stacktrace for failed command" "$(show_caller_full)" "wrn"
fi
return $exit_code
}
@@ -98,3 +99,25 @@ function run_host_command_logged_raw() {
run_on_sdcard() {
chroot_sdcard "${@}"
}
+
+# For host-side invocations of binaries we _know_ are x86-only.
+# Determine if we're building on non-amd64, and if so, which qemu binary to use.
+function run_host_x86_binary_logged() {
+ local -a qemu_invocation target_bin_arch
+ target_bin_arch="$(file -b "$1" | cut -d "," -f 1,2 | xargs echo -n)" # obtain the ELF name from the binary using 'file'
+ qemu_invocation=("$@") # Default to calling directly, without qemu.
+ if [[ "$(uname -m)" != "x86_64" ]]; then # If we're NOT on x86...
+ if [[ -f /usr/bin/qemu-x86_64-static ]]; then
+ display_alert "Using qemu-x86_64-static for running on $(uname -m)" "$1 (${target_bin_arch})" "debug"
+ qemu_invocation=("/usr/bin/qemu-x86_64-static" "-L" "/usr/x86_64-linux-gnu" "$@")
+ elif [[ -f /usr/bin/qemu-x86_64 ]]; then
+ display_alert "Using qemu-x86_64 (non-static) for running on $(uname -m)" "$1 (${target_bin_arch})" "debug"
+ qemu_invocation=("/usr/bin/qemu-x86_64" "-L" "/usr/x86_64-linux-gnu" "$@")
+ else
+ exit_with_error "Can't find appropriate qemu binary for running '$1' on $(uname -m), missing packages?"
+ fi
+ else
+ display_alert "Not using qemu for running x86 binary on $(uname -m)" "$1 (${target_bin_arch})" "debug"
+ fi
+ run_host_command_logged "${qemu_invocation[@]}" # Exit with this result code
+}
diff --git a/lib/functions/rootfs/boot_logo.sh b/lib/functions/rootfs/boot_logo.sh
index 9559b5917..319ea1144 100644
--- a/lib/functions/rootfs/boot_logo.sh
+++ b/lib/functions/rootfs/boot_logo.sh
@@ -1,9 +1,4 @@
function boot_logo() {
- if [[ $(dpkg --print-architecture) != amd64 ]]; then
- display_alert "Can't build boot_logo throbber using this arch" "$(dpkg --print-architecture)"
- return 0
- fi
-
display_alert "Building kernel splash logo" "$RELEASE" "info"
LOGO=${SRC}/packages/blobs/splash/logo.png
@@ -14,8 +9,8 @@ function boot_logo() {
THROBBER_HEIGHT=$(identify $THROBBER | head -1 | cut -d " " -f 3 | cut -d x -f 2)
convert -alpha remove -background "#000000" $LOGO "${SDCARD}"/tmp/logo.rgb
convert -alpha remove -background "#000000" $THROBBER "${SDCARD}"/tmp/throbber%02d.rgb
- # @TODO I guess this is a x86 binary?
- ${SRC}/packages/blobs/splash/bootsplash-packer \
+
+ run_host_x86_binary_logged "${SRC}/packages/blobs/splash/bootsplash-packer" \
--bg_red 0x00 \
--bg_green 0x00 \
--bg_blue 0x00 \
@@ -107,7 +102,8 @@ function boot_logo() {
--blob "${SDCARD}"/tmp/throbber72.rgb \
--blob "${SDCARD}"/tmp/throbber73.rgb \
--blob "${SDCARD}"/tmp/throbber74.rgb \
- "${SDCARD}"/lib/firmware/bootsplash.armbian > /dev/null 2>&1
+ "${SDCARD}"/lib/firmware/bootsplash.armbian
+
if [[ $BOOT_LOGO == yes || $BOOT_LOGO == desktop && $BUILD_DESKTOP == yes ]]; then
[[ -f "${SDCARD}"/boot/armbianEnv.txt ]] && grep -q '^bootlogo' "${SDCARD}"/boot/armbianEnv.txt &&
sed -i 's/^bootlogo.*/bootlogo=true/' "${SDCARD}"/boot/armbianEnv.txt || echo 'bootlogo=true' >> "${SDCARD}"/boot/armbianEnv.txt
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index 564af3c42..09139086b 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -1,241 +1,433 @@
#!/usr/bin/env bash
# This file is/was autogenerated by lib/tools/gen-library.sh; don't modify manually
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/configuration/menu.sh
-# shellcheck source=lib/functions/configuration/menu.sh
-source "${SRC}"/lib/functions/configuration/menu.sh
-
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/configuration/interactive.sh
-# shellcheck source=lib/functions/configuration/interactive.sh
-source "${SRC}"/lib/functions/configuration/interactive.sh
-
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/configuration/config-desktop.sh
-# shellcheck source=lib/functions/configuration/config-desktop.sh
-source "${SRC}"/lib/functions/configuration/config-desktop.sh
-
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/configuration/main-config.sh
-# shellcheck source=lib/functions/configuration/main-config.sh
-source "${SRC}"/lib/functions/configuration/main-config.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/general/repo.sh
+# shellcheck source=lib/functions/general/repo.sh
+source "${SRC}"/lib/functions/general/repo.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/configuration/aggregation.sh
-# shellcheck source=lib/functions/configuration/aggregation.sh
-source "${SRC}"/lib/functions/configuration/aggregation.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/general/host.sh
+# shellcheck source=lib/functions/general/host.sh
+source "${SRC}"/lib/functions/general/host.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/rootfs/create-cache.sh
-# shellcheck source=lib/functions/rootfs/create-cache.sh
-source "${SRC}"/lib/functions/rootfs/create-cache.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/general/git.sh
+# shellcheck source=lib/functions/general/git.sh
+source "${SRC}"/lib/functions/general/git.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/rootfs/apt.sh
-# shellcheck source=lib/functions/rootfs/apt.sh
-source "${SRC}"/lib/functions/rootfs/apt.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/general/downloads.sh
+# shellcheck source=lib/functions/general/downloads.sh
+source "${SRC}"/lib/functions/general/downloads.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/rootfs/distro-specific.sh
-# shellcheck source=lib/functions/rootfs/distro-specific.sh
-source "${SRC}"/lib/functions/rootfs/distro-specific.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/general/cleaning.sh
+# shellcheck source=lib/functions/general/cleaning.sh
+source "${SRC}"/lib/functions/general/cleaning.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/rootfs/rootfs-desktop.sh
-# shellcheck source=lib/functions/rootfs/rootfs-desktop.sh
-source "${SRC}"/lib/functions/rootfs/rootfs-desktop.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/general/chroot-helpers.sh
+# shellcheck source=lib/functions/general/chroot-helpers.sh
+source "${SRC}"/lib/functions/general/chroot-helpers.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/rootfs/post-tweaks.sh
-# shellcheck source=lib/functions/rootfs/post-tweaks.sh
-source "${SRC}"/lib/functions/rootfs/post-tweaks.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/extras/buildpkg.sh
+# shellcheck source=lib/functions/extras/buildpkg.sh
+source "${SRC}"/lib/functions/extras/buildpkg.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/rootfs/customize.sh
-# shellcheck source=lib/functions/rootfs/customize.sh
-source "${SRC}"/lib/functions/rootfs/customize.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/extras/fel.sh
+# shellcheck source=lib/functions/extras/fel.sh
+source "${SRC}"/lib/functions/extras/fel.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/rootfs/distro-agnostic.sh
-# shellcheck source=lib/functions/rootfs/distro-agnostic.sh
-source "${SRC}"/lib/functions/rootfs/distro-agnostic.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/compilation/debs.sh
+# shellcheck source=lib/functions/compilation/debs.sh
+source "${SRC}"/lib/functions/compilation/debs.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/rootfs/boot_logo.sh
-# shellcheck source=lib/functions/rootfs/boot_logo.sh
-source "${SRC}"/lib/functions/rootfs/boot_logo.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/compilation/uboot.sh
+# shellcheck source=lib/functions/compilation/uboot.sh
+source "${SRC}"/lib/functions/compilation/uboot.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/general/chroot-helpers.sh
-# shellcheck source=lib/functions/general/chroot-helpers.sh
-source "${SRC}"/lib/functions/general/chroot-helpers.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/compilation/sources.sh
+# shellcheck source=lib/functions/compilation/sources.sh
+source "${SRC}"/lib/functions/compilation/sources.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/general/repo.sh
-# shellcheck source=lib/functions/general/repo.sh
-source "${SRC}"/lib/functions/general/repo.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/compilation/extra-drivers.sh
+# shellcheck source=lib/functions/compilation/extra-drivers.sh
+source "${SRC}"/lib/functions/compilation/extra-drivers.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/general/cleaning.sh
-# shellcheck source=lib/functions/general/cleaning.sh
-source "${SRC}"/lib/functions/general/cleaning.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/compilation/utils-compilation.sh
+# shellcheck source=lib/functions/compilation/utils-compilation.sh
+source "${SRC}"/lib/functions/compilation/utils-compilation.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/general/git.sh
-# shellcheck source=lib/functions/general/git.sh
-source "${SRC}"/lib/functions/general/git.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/compilation/patching.sh
+# shellcheck source=lib/functions/compilation/patching.sh
+source "${SRC}"/lib/functions/compilation/patching.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/general/host.sh
-# shellcheck source=lib/functions/general/host.sh
-source "${SRC}"/lib/functions/general/host.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/compilation/kernel.sh
+# shellcheck source=lib/functions/compilation/kernel.sh
+source "${SRC}"/lib/functions/compilation/kernel.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/general/downloads.sh
-# shellcheck source=lib/functions/general/downloads.sh
-source "${SRC}"/lib/functions/general/downloads.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/compilation/atf.sh
+# shellcheck source=lib/functions/compilation/atf.sh
+source "${SRC}"/lib/functions/compilation/atf.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/multi/build-all.sh
-# shellcheck source=lib/functions/multi/build-all.sh
-source "${SRC}"/lib/functions/multi/build-all.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/cli/cli-entrypoint.sh
+# shellcheck source=lib/functions/cli/cli-entrypoint.sh
+source "${SRC}"/lib/functions/cli/cli-entrypoint.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
### lib/functions/cli/utils-cli.sh
# shellcheck source=lib/functions/cli/utils-cli.sh
source "${SRC}"/lib/functions/cli/utils-cli.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/cli/cli-entrypoint.sh
-# shellcheck source=lib/functions/cli/cli-entrypoint.sh
-source "${SRC}"/lib/functions/cli/cli-entrypoint.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/logging/errors.sh
+# shellcheck source=lib/functions/logging/errors.sh
+source "${SRC}"/lib/functions/logging/errors.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/bsp/bsp-cli.sh
-# shellcheck source=lib/functions/bsp/bsp-cli.sh
-source "${SRC}"/lib/functions/bsp/bsp-cli.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/logging/runners.sh
+# shellcheck source=lib/functions/logging/runners.sh
+source "${SRC}"/lib/functions/logging/runners.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/bsp/bsp-desktop.sh
-# shellcheck source=lib/functions/bsp/bsp-desktop.sh
-source "${SRC}"/lib/functions/bsp/bsp-desktop.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/logging/capture.sh
+# shellcheck source=lib/functions/logging/capture.sh
+source "${SRC}"/lib/functions/logging/capture.sh
+
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/logging/traps.sh
+# shellcheck source=lib/functions/logging/traps.sh
+source "${SRC}"/lib/functions/logging/traps.sh
+
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/logging/logging.sh
+# shellcheck source=lib/functions/logging/logging.sh
+source "${SRC}"/lib/functions/logging/logging.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
### lib/functions/bsp/utils-bsp.sh
# shellcheck source=lib/functions/bsp/utils-bsp.sh
source "${SRC}"/lib/functions/bsp/utils-bsp.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/image/loop.sh
-# shellcheck source=lib/functions/image/loop.sh
-source "${SRC}"/lib/functions/image/loop.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/bsp/bsp-desktop.sh
+# shellcheck source=lib/functions/bsp/bsp-desktop.sh
+source "${SRC}"/lib/functions/bsp/bsp-desktop.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/image/initrd.sh
-# shellcheck source=lib/functions/image/initrd.sh
-source "${SRC}"/lib/functions/image/initrd.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/bsp/bsp-cli.sh
+# shellcheck source=lib/functions/bsp/bsp-cli.sh
+source "${SRC}"/lib/functions/bsp/bsp-cli.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/image/rootfs-to-image.sh
-# shellcheck source=lib/functions/image/rootfs-to-image.sh
-source "${SRC}"/lib/functions/image/rootfs-to-image.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/main/default-build.sh
+# shellcheck source=lib/functions/main/default-build.sh
+source "${SRC}"/lib/functions/main/default-build.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/image/partitioning.sh
-# shellcheck source=lib/functions/image/partitioning.sh
-source "${SRC}"/lib/functions/image/partitioning.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/main/config-prepare.sh
+# shellcheck source=lib/functions/main/config-prepare.sh
+source "${SRC}"/lib/functions/main/config-prepare.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
### lib/functions/main/rootfs-image.sh
# shellcheck source=lib/functions/main/rootfs-image.sh
source "${SRC}"/lib/functions/main/rootfs-image.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/main/config-prepare.sh
-# shellcheck source=lib/functions/main/config-prepare.sh
-source "${SRC}"/lib/functions/main/config-prepare.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/configuration/aggregation.sh
+# shellcheck source=lib/functions/configuration/aggregation.sh
+source "${SRC}"/lib/functions/configuration/aggregation.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/main/default-build.sh
-# shellcheck source=lib/functions/main/default-build.sh
-source "${SRC}"/lib/functions/main/default-build.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/configuration/main-config.sh
+# shellcheck source=lib/functions/configuration/main-config.sh
+source "${SRC}"/lib/functions/configuration/main-config.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/compilation/sources.sh
-# shellcheck source=lib/functions/compilation/sources.sh
-source "${SRC}"/lib/functions/compilation/sources.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/configuration/interactive.sh
+# shellcheck source=lib/functions/configuration/interactive.sh
+source "${SRC}"/lib/functions/configuration/interactive.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/compilation/uboot.sh
-# shellcheck source=lib/functions/compilation/uboot.sh
-source "${SRC}"/lib/functions/compilation/uboot.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/configuration/menu.sh
+# shellcheck source=lib/functions/configuration/menu.sh
+source "${SRC}"/lib/functions/configuration/menu.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/compilation/atf.sh
-# shellcheck source=lib/functions/compilation/atf.sh
-source "${SRC}"/lib/functions/compilation/atf.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/configuration/config-desktop.sh
+# shellcheck source=lib/functions/configuration/config-desktop.sh
+source "${SRC}"/lib/functions/configuration/config-desktop.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/compilation/utils-compilation.sh
-# shellcheck source=lib/functions/compilation/utils-compilation.sh
-source "${SRC}"/lib/functions/compilation/utils-compilation.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/multi/build-all.sh
+# shellcheck source=lib/functions/multi/build-all.sh
+source "${SRC}"/lib/functions/multi/build-all.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/compilation/kernel.sh
-# shellcheck source=lib/functions/compilation/kernel.sh
-source "${SRC}"/lib/functions/compilation/kernel.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/image/initrd.sh
+# shellcheck source=lib/functions/image/initrd.sh
+source "${SRC}"/lib/functions/image/initrd.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/compilation/debs.sh
-# shellcheck source=lib/functions/compilation/debs.sh
-source "${SRC}"/lib/functions/compilation/debs.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/image/rootfs-to-image.sh
+# shellcheck source=lib/functions/image/rootfs-to-image.sh
+source "${SRC}"/lib/functions/image/rootfs-to-image.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/compilation/extra-drivers.sh
-# shellcheck source=lib/functions/compilation/extra-drivers.sh
-source "${SRC}"/lib/functions/compilation/extra-drivers.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/image/loop.sh
+# shellcheck source=lib/functions/image/loop.sh
+source "${SRC}"/lib/functions/image/loop.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/compilation/patching.sh
-# shellcheck source=lib/functions/compilation/patching.sh
-source "${SRC}"/lib/functions/compilation/patching.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/image/partitioning.sh
+# shellcheck source=lib/functions/image/partitioning.sh
+source "${SRC}"/lib/functions/image/partitioning.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/logging/capture.sh
-# shellcheck source=lib/functions/logging/capture.sh
-source "${SRC}"/lib/functions/logging/capture.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/rootfs/post-tweaks.sh
+# shellcheck source=lib/functions/rootfs/post-tweaks.sh
+source "${SRC}"/lib/functions/rootfs/post-tweaks.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/logging/runners.sh
-# shellcheck source=lib/functions/logging/runners.sh
-source "${SRC}"/lib/functions/logging/runners.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/rootfs/rootfs-desktop.sh
+# shellcheck source=lib/functions/rootfs/rootfs-desktop.sh
+source "${SRC}"/lib/functions/rootfs/rootfs-desktop.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/logging/errors.sh
-# shellcheck source=lib/functions/logging/errors.sh
-source "${SRC}"/lib/functions/logging/errors.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/rootfs/distro-agnostic.sh
+# shellcheck source=lib/functions/rootfs/distro-agnostic.sh
+source "${SRC}"/lib/functions/rootfs/distro-agnostic.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/logging/logging.sh
-# shellcheck source=lib/functions/logging/logging.sh
-source "${SRC}"/lib/functions/logging/logging.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/rootfs/boot_logo.sh
+# shellcheck source=lib/functions/rootfs/boot_logo.sh
+source "${SRC}"/lib/functions/rootfs/boot_logo.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/logging/traps.sh
-# shellcheck source=lib/functions/logging/traps.sh
-source "${SRC}"/lib/functions/logging/traps.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/rootfs/apt.sh
+# shellcheck source=lib/functions/rootfs/apt.sh
+source "${SRC}"/lib/functions/rootfs/apt.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/extras/fel.sh
-# shellcheck source=lib/functions/extras/fel.sh
-source "${SRC}"/lib/functions/extras/fel.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/rootfs/customize.sh
+# shellcheck source=lib/functions/rootfs/customize.sh
+source "${SRC}"/lib/functions/rootfs/customize.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/extras/buildpkg.sh
-# shellcheck source=lib/functions/extras/buildpkg.sh
-source "${SRC}"/lib/functions/extras/buildpkg.sh
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/rootfs/create-cache.sh
+# shellcheck source=lib/functions/rootfs/create-cache.sh
+source "${SRC}"/lib/functions/rootfs/create-cache.sh
+
+# no errors tolerated. set -e is invoked before each sourced file to make sure.
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
+### lib/functions/rootfs/distro-specific.sh
+# shellcheck source=lib/functions/rootfs/distro-specific.sh
+source "${SRC}"/lib/functions/rootfs/distro-specific.sh
-set -e # no errors tolerated. one last time for the win!
+# no errors tolerated. one last time for the win!
+#set -o pipefail # trace ERR through pipes - will be enabled "soon"
+#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+set -o errtrace # trace ERR through - enabled
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
# This file is/was autogenerated by lib/tools/gen-library.sh; don't modify manually
diff --git a/lib/tools/gen-library.sh b/lib/tools/gen-library.sh
index fd6f200e7..8abfad05e 100755
--- a/lib/tools/gen-library.sh
+++ b/lib/tools/gen-library.sh
@@ -20,7 +20,11 @@ AUTOGEN_INCLUDES_HEADER
find lib/functions -type f -name \*.sh | while read -r path; do
ref="$(echo -n "${path}")"
cat <<- AUTOGEN_INCLUDES_EACH >> "${TARGET_SH}"
- set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
+ # no errors tolerated. invoked before each sourced file to make sure.
+ #set -o pipefail # trace ERR through pipes - will be enabled "soon"
+ #set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+ set -o errtrace # trace ERR through - enabled
+ set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
### ${path}
# shellcheck source=${ref}
source "\${SRC}"/${path}
@@ -30,7 +34,11 @@ done
cat <<- AUTOGEN_INCLUDES_FOOTER >> "${TARGET_SH}"
- set -e # no errors tolerated. one last time for the win!
+ # no errors tolerated. one last time for the win!
+ #set -o pipefail # trace ERR through pipes - will be enabled "soon"
+ #set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
+ set -o errtrace # trace ERR through - enabled
+ set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
# This file is/was autogenerated by ${0}; don't modify manually
AUTOGEN_INCLUDES_FOOTER
From f9e02b2152c1c82a74312ccf48ef530dac167512 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 22 Jan 2022 10:32:08 +0000
Subject: [PATCH] armbian-next: always use UPPERCASE labels for FAT32 UEFI
filesystems (rpi4b, uefi-*)
---
config/sources/families/bcm2711.conf | 2 +-
lib/functions/image/partitioning.sh | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/config/sources/families/bcm2711.conf b/config/sources/families/bcm2711.conf
index eac9895d4..0a1322ac3 100644
--- a/config/sources/families/bcm2711.conf
+++ b/config/sources/families/bcm2711.conf
@@ -1,7 +1,7 @@
enable_extension "flash-kernel"
export LINUXFAMILY=bcm2711
export ARCH=arm64
-export UEFI_FS_LABEL="rpicfg" # Windows/Mac users will see this if they mount the SD card. Configurable
+export UEFI_FS_LABEL="RPICFG" # Windows/Mac users will see this if they mount the SD card. Configurable, but should be uppercase always
export SKIP_BOOTSPLASH="yes" # video is init-ed before us
export KERNELDIR='linux-rpi' # Avoid sharing a source tree with others, until we know it's safe.
export FK__PUBLISHED_KERNEL_VERSION="raspi" # flash kernel (FK) configuration
diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh
index 92f5940c1..4090d96e1 100644
--- a/lib/functions/image/partitioning.sh
+++ b/lib/functions/image/partitioning.sh
@@ -66,7 +66,7 @@ prepare_partitions() {
UEFISIZE=${UEFISIZE:-0}
BIOSSIZE=${BIOSSIZE:-0}
UEFI_MOUNT_POINT=${UEFI_MOUNT_POINT:-/boot/efi}
- UEFI_FS_LABEL="${UEFI_FS_LABEL:-armbiefi}"
+ UEFI_FS_LABEL="${UEFI_FS_LABEL:-ARMBIEFI}" # Should be always uppercase
call_extension_method "pre_prepare_partitions" "prepare_partitions_custom" << 'PRE_PREPARE_PARTITIONS'
*allow custom options for mkfs*
@@ -293,7 +293,7 @@ PREPARE_IMAGE_SIZE
if [[ -n $uefipart ]]; then
display_alert "Creating EFI partition" "FAT32 ${UEFI_MOUNT_POINT} on ${LOOP}p${uefipart} label ${UEFI_FS_LABEL}"
check_loop_device "${LOOP}p${uefipart}"
- mkfs.fat -F32 -n "${UEFI_FS_LABEL}" ${LOOP}p${uefipart} 2>&1
+ mkfs.fat -F32 -n "${UEFI_FS_LABEL^^}" ${LOOP}p${uefipart} 2>&1 # "^^" makes variable UPPERCASE, required for FAT32.
mkdir -p "${MOUNT}${UEFI_MOUNT_POINT}"
mount ${LOOP}p${uefipart} "${MOUNT}${UEFI_MOUNT_POINT}"
echo "UUID=$(blkid -s UUID -o value ${LOOP}p${uefipart}) ${UEFI_MOUNT_POINT} vfat defaults 0 2" >> $SDCARD/etc/fstab
From acbc2f21da023796c5a72e3b78e0b20f09cf5ed0 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 20 Jan 2022 23:41:18 +0000
Subject: [PATCH] armbian-next: shellfmt after rebase onto master
---
config/sources/families/media.conf | 83 +++++++-------------------------------
1 file changed, 15 insertions(+), 68 deletions(-)
diff --git a/config/sources/families/media.conf b/config/sources/families/media.conf
index fe5e96c60..7c5a76af6 100644
--- a/config/sources/families/media.conf
+++ b/config/sources/families/media.conf
@@ -1,100 +1,47 @@
source "${BASH_SOURCE%/*}/include/rockchip64_common.inc"
-if [[ $BOARD == station-p2 || $BOARD == station-m2 || $BOARD == bananapir2pro ]]; then
+if [[ $BOARD == station-p2 || $BOARD == station-m2 ]]; then
BOOTSOURCE='https://github.com/150balbes/u-boot-rk'
BOOTBRANCH='branch:rk356x'
BOOTPATCHDIR="u-boot-station-p2"
-elif [[ $BOARD == quartz64a ]]; then
- BOOTSOURCE='https://github.com/150balbes/u-boot-rk'
- BOOTBRANCH='branch:rk35xx'
- BOOTPATCHDIR="u-boot-station-p2"
-elif [[ $BOARD == station-m3 ]]; then
- BOOTSOURCE='https://github.com/150balbes/u-boot-rk'
- BOOTBRANCH='branch:rk3588'
- BOOTPATCHDIR="u-boot-station-p2"
-else
- BOOTBRANCH="tag:v2022.07"
- BOOTPATCHDIR="u-boot-media"
fi
-SKIP_BOOTSPLASH="yes"
-
case $BRANCH in
legacy)
KERNELDIR='linux-rockchip64'
- if [[ $BOARD == station-p2 || $BOARD == station-m2 || $BOARD == bananapir2pro ]]; then
+ if [[ $BOARD == station-p2 || $BOARD == station-m2 ]]; then
KERNELSOURCE='https://github.com/150balbes/rockchip-kernel'
KERNELBRANCH='branch:kernel-4.19'
KERNELPATCHDIR='station-p2-'$BRANCH
- LINUXFAMILY=station-p2
LINUXCONFIG='linux-station-p2-'$BRANCH
+ LINUXFAMILY=station-p2
EXTRAWIFI="no"
WIREGUARD="no"
- elif [[ $BOARD == station-m3 ]]; then
- KERNELSOURCE='https://github.com/150balbes/rockchip-kernel'
- KERNELBRANCH='branch:kernel-5.10'
- LINUXFAMILY=station-m3
- LINUXCONFIG='linux-station-m3-'$BRANCH
- KERNELPATCHDIR='station-m3-'$BRANCH
- AUFS="no"
- elif [[ $BOARD == jetson-nano ]]; then
- KERNELDIR='linux-nano'
- KERNELSOURCE='https://github.com/150balbes/Jetson-Nano'
- KERNELBRANCH='branch:4.9.201'
- KERNELPATCHDIR='jetson-nano-'$BRANCH
- LINUXFAMILY=jetson-nano
- LINUXCONFIG='linux-jetson-nano-'$BRANCH
- EXTRAWIFI="no"
- BOOT_FDT_FILE="none"
- SRC_CMDLINE='console=ttyS0,115200n8 console=tty0 tegraid=21.1.2.0.0 ddr_die=4096M@2048M section=512M memtype=0 vpr_resize usb_port_owner_info=0 lane_owner_info=0 emc_max_dvfs=0 touch_id=0@63 video=tegrafb debug_uartport=lsport,4 earlyprintk=uart8250-32bit,0x70006000 maxcpus=4 usbcore.old_scheme_first=1 lp0_vec=0x1000@0xff780000 core_edp_mv=1075 core_edp_ma=4000 tegra_fbmem=0x800000@0x92ca9000 is_hdmi_initialised=1 earlycon=uart8250,mmio32,0x70006000 fbcon=map:0'
- MODULES_INITRD="jetson-nano-legacy"
else
- if [[ $BOARD == nanopct4 ]]; then
- KERNELSOURCE='https://github.com/friendlyarm/kernel-rockchip'
- KERNELBRANCH='branch:nanopi4-linux-v4.4.y'
- KERNELPATCHDIR='rk3399-'$BRANCH
- LINUXFAMILY=rk3399
- LINUXCONFIG='linux-rk3399-'$BRANCH
- else
- KERNELSOURCE='https://github.com/ayufan-rock64/linux-kernel'
- KERNELBRANCH='tag:4.4.202-1237-rockchip-ayufan'
- KERNELPATCHDIR='rockchip64-'$BRANCH
- LINUXFAMILY=rockchip64
- LINUXCONFIG='linux-rockchip64-'$BRANCH
- fi
+ KERNELSOURCE='https://github.com/ayufan-rock64/linux-kernel'
+ KERNELBRANCH='tag:4.4.202-1237-rockchip-ayufan'
+ KERNELPATCHDIR='rockchip64-'$BRANCH
+ LINUXCONFIG='linux-rockchip64-'$BRANCH
+ LINUXFAMILY=rockchip64
fi
- ;;
+ ;;
current)
-
- KERNELBRANCH="branch:linux-5.18.y"
- LINUXCONFIG='linux-media-'$BRANCH
-
- if [[ $BOARD == station-p2 || $BOARD == station-m2 || $BOARD == quartz64a || $BOARD == bananapir2pro ]]; then
- KERNELPATCHDIR='station-p2-'$BRANCH
- LINUXFAMILY=station-p2
- else
+ KERNELBRANCH="branch:linux-5.15.y"
KERNELPATCHDIR='media-'$BRANCH
LINUXFAMILY=media
-
- if [[ $BOARD == jetson-nano ]]; then
- MODULES_INITRD="jetson-nano-current"
- fi
- fi
- ;;
+ LINUXCONFIG='linux-media-'$BRANCH
+ ;;
edge)
+ SKIP_BOOTSPLASH="yes"
+ KERNELBRANCH="branch:linux-5.16.y"
KERNELPATCHDIR='media-'$BRANCH
- KERNELBRANCH='branch:linux-5.19.y'
LINUXFAMILY=media
LINUXCONFIG='linux-media-'$BRANCH
-
- if [[ $BOARD == jetson-nano ]]; then
- MODULES_INITRD="jetson-nano-edge"
- fi
- ;;
+ ;;
esac
prepare_boot_configuration
From 407ecdb1b9108b57afea57b3ca6a17ed86ef1fcc Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 20 Jan 2022 23:35:46 +0000
Subject: [PATCH] armbian-next: manual merge (4) of all lib/*.sh changes
between revisions 23afccf56e295610340188dc2613143d5323659e and
e610f00bc7fdcab5ba4c648fa21148518b4b767b
- plus ooops
---
config/sources/families/bcm2711.conf | 26 ++++++++++++-----------
config/sources/families/include/sunxi_common.inc | 2 +-
config/sources/families/jethub.conf | 2 +-
lib/functions/configuration/main-config.sh | 2 +-
lib/functions/general/git.sh | 27 +++++++++++++++---------
lib/functions/general/host.sh | 20 ------------------
6 files changed, 34 insertions(+), 45 deletions(-)
diff --git a/config/sources/families/bcm2711.conf b/config/sources/families/bcm2711.conf
index 74e80cd03..eac9895d4 100644
--- a/config/sources/families/bcm2711.conf
+++ b/config/sources/families/bcm2711.conf
@@ -1,13 +1,10 @@
enable_extension "flash-kernel"
export LINUXFAMILY=bcm2711
export ARCH=arm64
-export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}" # config is per family and branch
-export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}" # patches per family and branch
-export UEFI_FS_LABEL="RPICFG" # Windows/Mac users will see this if they mount the SD card. UPPERCASE
-export SKIP_BOOTSPLASH="yes" # video is init-ed before us
-export KERNELDIR='linux-rpi' # Avoid sharing a source tree with others, until we know it's safe.
-export RASPI_DISTRO_KERNEL=no # use default distor kernel? default is no, build from source.
-export FK__PUBLISHED_KERNEL_VERSION="raspi" # flash kernel (FK) configuration
+export UEFI_FS_LABEL="rpicfg" # Windows/Mac users will see this if they mount the SD card. Configurable
+export SKIP_BOOTSPLASH="yes" # video is init-ed before us
+export KERNELDIR='linux-rpi' # Avoid sharing a source tree with others, until we know it's safe.
+export FK__PUBLISHED_KERNEL_VERSION="raspi" # flash kernel (FK) configuration
export FK__KERNEL_PACKAGES=""
export RASPI_ROOT_FS_LABEL="armbian"
export CPUMIN=500000
@@ -16,19 +13,24 @@ export GOVERNOR=ondemand
case "${BRANCH}" in
- ddk)
- # Use distro's default kernel (ddk). Disables kernel building.
- export RASPI_DISTRO_KERNEL=yes
+ legacy | ddk)
+ export RASPI_DISTRO_KERNEL=yes # This will cause board to include distro's prebuilt kernel, not from source
;;
current)
+ export RASPI_DISTRO_KERNEL=no
export KERNELSOURCE='https://github.com/raspberrypi/linux'
export KERNELBRANCH="branch:rpi-5.15.y"
+ export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
+ export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
;;
edge)
+ export RASPI_DISTRO_KERNEL=no
export KERNELSOURCE='https://github.com/raspberrypi/linux'
export KERNELBRANCH="branch:rpi-5.16.y"
+ export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
+ export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
;;
esac
@@ -40,7 +42,7 @@ prepare_partitions_custom__add_rootfs_raspi_label_to_mkfs() {
pre_initramfs_flash_kernel__write_raspi_cmdline() {
cat <<- EOD > "${FIRMWARE_DIR}/cmdline.txt"
- root=LABEL=${RASPI_ROOT_FS_LABEL} rootfstype=ext4 elevator=deadline rootwait fixrtc cgroup_enable=memory cgroup_memory=1 console=tty1
+ root=LABEL=${RASPI_ROOT_FS_LABEL} rootfstype=ext4 elevator=deadline rootwait fixrtc cgroup_enable=memory cgroup_memory=1 console=tty1 logo.nologo loglevel=1
EOD
}
@@ -55,7 +57,7 @@ pre_flash_kernel__symlink_dtb_and_kernel() {
Kernel-Flavors: any
EOD
- ## @TODO: rpardini: a horrible hack. I'll sort this out together with overlays, later. This is pressing.
+ ## @TODO: rpardini: a horrible hack. I'll sort this out together with overlays, later.
local oneDTB dtbBase
for oneDTB in "${MOUNT}"/boot/dtb/broadcom/*.dtb; do
dtbBase=$(basename "${oneDTB}")
diff --git a/config/sources/families/include/sunxi_common.inc b/config/sources/families/include/sunxi_common.inc
index 641cceb1c..eabacf86b 100644
--- a/config/sources/families/include/sunxi_common.inc
+++ b/config/sources/families/include/sunxi_common.inc
@@ -20,7 +20,7 @@ esac
case "$KERNEL_VERSION_LEVEL" in
- 5.10 | 5.15)
+ 5.10 | 5.15 | 5.16)
KERNELSOURCE=$MAINLINE_KERNEL_SOURCE
KERNELSOURCENAME='name=origin'
KERNELBRANCH="branch:linux-${KERNEL_VERSION_LEVEL}.y"
diff --git a/config/sources/families/jethub.conf b/config/sources/families/jethub.conf
index e747ed57c..16481c176 100644
--- a/config/sources/families/jethub.conf
+++ b/config/sources/families/jethub.conf
@@ -172,7 +172,7 @@ family_tweaks() {
display_alert "Adding JetHome repository and authentication key" "/etc/apt/sources.list.d/jethome.list" "info"
cp "${SRC}"/packages/bsp/jethub/jethome.gpg "${SDCARD}/etc/apt/trusted.gpg.d/"
- echo "deb http://repo.jethome.ru"$([[ $BETA == yes ]] && echo "/beta" )" ${RELEASE} jethome-${RELEASE}" \
+ echo "deb http://repo.jethome.ru"$([[ $BETA == yes ]] && echo "/beta")" ${RELEASE} jethome-${RELEASE}" \
>> "${SDCARD}"/etc/apt/sources.list.d/jethome.list
}
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 759deaf5d..d4995a6b7 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -32,7 +32,7 @@ function do_main_configuration() {
[[ -z $EXIT_PATCHING_ERROR ]] && EXIT_PATCHING_ERROR="" # exit patching if failed
[[ -z $HOST ]] && HOST="$BOARD" # set hostname to the board
cd "${SRC}" || exit
- [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=11
+ [[ -z "${ROOTFSCACHE_VERSION}" ]] && ROOTFSCACHE_VERSION=12
[[ -z "${CHROOT_CACHE_VERSION}" ]] && CHROOT_CACHE_VERSION=7
BUILD_REPOSITORY_URL=$(improved_git remote get-url $(improved_git remote 2> /dev/null | grep origin) 2> /dev/null)
BUILD_REPOSITORY_COMMIT=$(improved_git describe --match=d_e_a_d_b_e_e_f --always --dirty 2> /dev/null)
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index f66b5ea90..e4a03f278 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -72,31 +72,38 @@ waiter_local_repo() {
display_alert "Checking git sources" "$dir $name/$branch" "info"
- # Check the exception for 5.15 sunxi. We will remove this after a while.
- if [ "$dir" == "linux-mainline/5.15" ] &&
- [ "$(git remote show | grep megous || true)" == "megous" ]; then
- display_alert "Remove mistakenly created and excessively large" "$dir" "info"
- rm -rf .git ./*
- fi
-
if [ "$(git rev-parse --git-dir 2> /dev/null)" != ".git" ]; then
git init -q .
# Run in the sub shell to avoid mixing environment variables.
if [ -n "$VAR_SHALLOW_ORIGINAL" ]; then
- display_alert "Unshallowing original:" "${VAR_SHALLOW_ORIGINAL}" "debug"
(
$VAR_SHALLOW_ORIGINAL
display_alert "Add original git sources" "$dir $name/$branch" "info"
- if [ "$(git ls-remote -h $url $branch | awk -F'/' '{if (NR == 1) print $NF}' || true)" != "$branch" ]; then
+ if [ "$(git ls-remote -h $url $branch |
+ awk -F'/' '{if (NR == 1) print $NF}')" != "$branch" ]; then
display_alert "Bad $branch for $url in $VAR_SHALLOW_ORIGINAL"
exit 177
fi
git remote add -t $branch $name $url
- git fetch --shallow-exclude=$start_tag $name
+
+ # Handle an exception if the initial tag is the top of the branch
+ # As v5.16 == HEAD
+ if $(
+ git ls-remote -t $url ${start_tag}\* |
+ awk -F'/' '$NF !~ /v[4-5][.][1-9]{1,2}[.][1]$/ {
+ exit 1
+ }'
+ ); then
+ git fetch --shallow-exclude=$start_tag $name
+ else
+ git fetch --depth 1 $name
+ fi
git fetch --deepen=1 $name
+ # For a shallow clone, this works quickly and saves space.
+ git gc
)
[ "$?" == "177" ] && exit
diff --git a/lib/functions/general/host.sh b/lib/functions/general/host.sh
index d262d4baa..d292fcf10 100644
--- a/lib/functions/general/host.sh
+++ b/lib/functions/general/host.sh
@@ -153,26 +153,6 @@ prepare_host() {
if [ -n "${EXTRA_BUILD_DEPS}" ]; then hostdeps+=" ${EXTRA_BUILD_DEPS}"; fi
- # distribution packages are buggy, download from author
-
- # build aarch64
- if [[ $(dpkg --print-architecture) == amd64 ]]; then
-
- if [[ ! -f /etc/apt/sources.list.d/aptly.list ]]; then
- display_alert "Updating from external repository" "aptly" "info"
- if [ x"" != x"${http_proxy}" ]; then
- apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options http-proxy="${http_proxy}" --recv-keys ED75B5A4483DA07C > /dev/null 2>&1
- else
- apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys ED75B5A4483DA07C > /dev/null 2>&1
- fi
- echo "deb http://repo.aptly.info/ nightly main" > /etc/apt/sources.list.d/aptly.list
- else
- sed "s/squeeze/nightly/" -i /etc/apt/sources.list.d/aptly.list
- fi
-
- # build aarch64
- fi
-
display_alert "Installing build dependencies"
# don't prompt for apt cacher selection
sudo echo "apt-cacher-ng apt-cacher-ng/tunnelenable boolean false" | sudo debconf-set-selections
From cdf0389ba5f0a747f4c1f9feee9527001aa61a35 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 16 Jan 2022 23:02:52 +0100
Subject: [PATCH] atf: fix for `set -e` mode; fix CROSS_COMPILE quoting
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
lib/functions/compilation/atf.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/functions/compilation/atf.sh b/lib/functions/compilation/atf.sh
index 73fa4a574..10d9bdec3 100644
--- a/lib/functions/compilation/atf.sh
+++ b/lib/functions/compilation/atf.sh
@@ -51,7 +51,7 @@ compile_atf() {
# Check: https://github.com/armbian/build/issues/1157
CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${toolchain2}:${PATH}" \
make ENABLE_BACKTRACE="0" $target_make $CTHREADS \
- CROSS_COMPILE=$CCACHE $ATF_COMPILER 2>&1 || {
+ CROSS_COMPILE="$CCACHE $ATF_COMPILER" 2>&1 || {
exit_with_error "ATF compilation failed"
}
@@ -80,4 +80,6 @@ compile_atf() {
# copy license file to pack it to u-boot package later
[[ -f license.md ]] && cp license.md "${atftempdir}"/
+
+ return 0 # avoid error due to short-circuit above
}
From eea2f5f4041541f8055be549eea4cf8c2f32a901 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 16 Jan 2022 23:03:45 +0100
Subject: [PATCH] logging: predict the future location of .img file
- otherwise it's really unhelpful
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
lib/functions/image/rootfs-to-image.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/functions/image/rootfs-to-image.sh b/lib/functions/image/rootfs-to-image.sh
index 96e6c9ea4..f1d327a84 100644
--- a/lib/functions/image/rootfs-to-image.sh
+++ b/lib/functions/image/rootfs-to-image.sh
@@ -193,7 +193,7 @@ POST_UMOUNT_FINAL_IMAGE
fi
fi
- display_alert "Done building" "${DESTIMG}/${version}.img" "info"
+ display_alert "Done building" "${FINALDEST}/${version}.img" "info" # A bit predicting the future, since it's still in DESTIMG at this point.
# Previously, post_build_image passed the .img path as an argument to the hook. Now its an ENV var.
export FINAL_IMAGE_FILE="${DESTIMG}/${version}.img"
From 873136d95f303e1acfce017ad7d38464ee0058ec Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 15 Jan 2022 19:37:27 +0100
Subject: [PATCH] uefi: alias `BRANCH=ddk` to `current`'s
`DISTRO_GENERIC_KERNEL=yes`
- no real change, just to match rpi4b's BRANCH=style
- opens space for Armbian-built `current` soon
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
config/boards/uefi-arm64.conf | 4 +---
config/boards/uefi-x86.conf | 4 +---
config/sources/families/include/uefi_common.inc | 4 ++--
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/config/boards/uefi-arm64.conf b/config/boards/uefi-arm64.conf
index 5a705cdeb..523e488ce 100644
--- a/config/boards/uefi-arm64.conf
+++ b/config/boards/uefi-arm64.conf
@@ -1,6 +1,4 @@
# aarch64 via UEFI for all UEFI-enabled boards
export BOARD_NAME="UEFI arm64"
export BOARDFAMILY="uefi-arm64"
-export KERNEL_TARGET="current,edge"
-
-export BOOT_LOGO=desktop
+export KERNEL_TARGET="ddk,current,edge"
diff --git a/config/boards/uefi-x86.conf b/config/boards/uefi-x86.conf
index d6153e717..186e5fdba 100644
--- a/config/boards/uefi-x86.conf
+++ b/config/boards/uefi-x86.conf
@@ -1,6 +1,4 @@
# x86_64 via UEFI/BIOS for all boards
export BOARD_NAME="UEFI x86"
export BOARDFAMILY="uefi-x86"
-export KERNEL_TARGET="current,edge"
-
-export BOOT_LOGO=desktop
+export KERNEL_TARGET="ddk,current,edge"
diff --git a/config/sources/families/include/uefi_common.inc b/config/sources/families/include/uefi_common.inc
index 28ec78ffc..907e55ad1 100644
--- a/config/sources/families/include/uefi_common.inc
+++ b/config/sources/families/include/uefi_common.inc
@@ -3,16 +3,16 @@ export SERIALCON="tty1" # Cant reasonably expect UEFI s
export SKIP_BOOTSPLASH="yes" # No splash.
export UEFI_GRUB_TIMEOUT=${UEFI_GRUB_TIMEOUT:-3} # Default 3-seconds timeout for GRUB menu.
export BOARD_FIRMWARE_INSTALL="-full" # Install full firmware for UEFI boards
+export DISTRO_GENERIC_KERNEL=no # no, build from source; yes: use distro
case "${BRANCH}" in
- current)
+ current | ddk)
# This will force `unset KERNELSOURCE` later; no kernel will be built.
# Instead, the distro's default linux-generic kernel will be installed.
export DISTRO_GENERIC_KERNEL=yes
;;
edge)
- export DISTRO_GENERIC_KERNEL=no
export LINUXCONFIG="linux-uefi-${LINUXFAMILY}-${BRANCH}"
export KERNELBRANCH="branch:linux-5.15.y"
export KERNELPATCHDIR="uefi-${LINUXFAMILY}-${BRANCH}" # Might be empty.
From fe8e12e095465e7098e5f4cff98fdb4ee80769ff Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 15 Jan 2022 02:46:02 +0100
Subject: [PATCH] rpi: `legacy`->`ddk` (distro default kernel), remove
overclock
- common vars in bcm2711.conf moved to top
- removed overclock/overvolt that was leftover my old setup
- confirmed: works with rpi3b too, should work with CM4/CM3 and others
- use valid UPPERCASE FAT label for RPICFG (in place of `rpicfg`)
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
config/boards/rpi4b.wip | 12 ++----------
config/sources/families/bcm2711.conf | 25 ++++++++++++-------------
2 files changed, 14 insertions(+), 23 deletions(-)
diff --git a/config/boards/rpi4b.wip b/config/boards/rpi4b.wip
index 56a785a25..b471e3421 100644
--- a/config/boards/rpi4b.wip
+++ b/config/boards/rpi4b.wip
@@ -1,8 +1,8 @@
# Broadcom BCM2711 quad core 1-8Gb RAM SoC USB3 GBE USB-C WiFi/BT
export BOARD_NAME="Raspberry Pi 4"
export BOARDFAMILY="bcm2711"
-export KERNEL_TARGET="legacy,current,edge"
-export FK__MACHINE_MODEL="Raspberry Pi 4 Model B" # flash kernel (FK) configuration
+export KERNEL_TARGET="ddk,current,edge"
+export FK__MACHINE_MODEL="Raspberry Pi 4 Model B" # this is passed to flash-kernel.
export ASOUND_STATE="asound.state.rpi"
# configure stuff at the appropriate time in flash-kernel
@@ -24,14 +24,6 @@ pre_initramfs_flash_kernel__write_raspi_config() {
# bootloader logs to serial, second stage
# enable_uart=1
- # overclock. requires decent thermals. COMMENT OUT IF DON'T USE A GREAT COOLER OR HEATSINK.
- over_voltage=6
- arm_freq=2000
-
- # uncomment to disable wifi or bt.
- #dtoverlay=disable-wifi
- #dtoverlay=disable-bt
-
# gpu and 3d stuff.
gpu_mem=256
dtoverlay=vc4-fkms-v3d
diff --git a/config/sources/families/bcm2711.conf b/config/sources/families/bcm2711.conf
index 55bad2a14..74e80cd03 100644
--- a/config/sources/families/bcm2711.conf
+++ b/config/sources/families/bcm2711.conf
@@ -1,10 +1,13 @@
enable_extension "flash-kernel"
export LINUXFAMILY=bcm2711
export ARCH=arm64
-export UEFI_FS_LABEL="rpicfg" # Windows/Mac users will see this if they mount the SD card. Configurable
-export SKIP_BOOTSPLASH="yes" # video is init-ed before us
-export KERNELDIR='linux-rpi' # Avoid sharing a source tree with others, until we know it's safe.
-export FK__PUBLISHED_KERNEL_VERSION="raspi" # flash kernel (FK) configuration
+export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}" # config is per family and branch
+export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}" # patches per family and branch
+export UEFI_FS_LABEL="RPICFG" # Windows/Mac users will see this if they mount the SD card. UPPERCASE
+export SKIP_BOOTSPLASH="yes" # video is init-ed before us
+export KERNELDIR='linux-rpi' # Avoid sharing a source tree with others, until we know it's safe.
+export RASPI_DISTRO_KERNEL=no # use default distor kernel? default is no, build from source.
+export FK__PUBLISHED_KERNEL_VERSION="raspi" # flash kernel (FK) configuration
export FK__KERNEL_PACKAGES=""
export RASPI_ROOT_FS_LABEL="armbian"
export CPUMIN=500000
@@ -13,23 +16,19 @@ export GOVERNOR=ondemand
case "${BRANCH}" in
- legacy)
- export RASPI_DISTRO_KERNEL=yes # This will cause board to include distro's prebuilt kernel, not from source
+ ddk)
+ # Use distro's default kernel (ddk). Disables kernel building.
+ export RASPI_DISTRO_KERNEL=yes
;;
current)
- export RASPI_DISTRO_KERNEL=no
export KERNELSOURCE='https://github.com/raspberrypi/linux'
export KERNELBRANCH="branch:rpi-5.15.y"
- export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
- export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
;;
+
edge)
- export RASPI_DISTRO_KERNEL=no
export KERNELSOURCE='https://github.com/raspberrypi/linux'
export KERNELBRANCH="branch:rpi-5.16.y"
- export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
- export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
;;
esac
@@ -56,7 +55,7 @@ pre_flash_kernel__symlink_dtb_and_kernel() {
Kernel-Flavors: any
EOD
- ## @TODO: rpardini: a horrible hack. I'll sort this out together with overlays, later.
+ ## @TODO: rpardini: a horrible hack. I'll sort this out together with overlays, later. This is pressing.
local oneDTB dtbBase
for oneDTB in "${MOUNT}"/boot/dtb/broadcom/*.dtb; do
dtbBase=$(basename "${oneDTB}")
From 1390b62e7c08fc0d0e834854ddd5d19c5243aa8d Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 15 Jan 2022 02:37:48 +0100
Subject: [PATCH] armbian-next: shellfmt again after rebase
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
config/boards/rpi4b.wip | 2 +-
config/sources/families/bcm2711.conf | 40 ++++++++++++++++++------------------
2 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/config/boards/rpi4b.wip b/config/boards/rpi4b.wip
index 9afe14f75..56a785a25 100644
--- a/config/boards/rpi4b.wip
+++ b/config/boards/rpi4b.wip
@@ -9,7 +9,7 @@ export ASOUND_STATE="asound.state.rpi"
pre_initramfs_flash_kernel__write_raspi_config() {
# for serial console, there is also 'BOOT_UART=1' in 'rpi-eeprom-config' but that is for an earlier stage.
# look at with it rpi-eeprom-config, change with 'EDITOR=nano rpi-eeprom-config --edit'
- cat <<-EOD >"${FIRMWARE_DIR}/config.txt"
+ cat <<- EOD > "${FIRMWARE_DIR}/config.txt"
[pi4]
max_framebuffers=2
diff --git a/config/sources/families/bcm2711.conf b/config/sources/families/bcm2711.conf
index 31ecdf529..55bad2a14 100644
--- a/config/sources/families/bcm2711.conf
+++ b/config/sources/families/bcm2711.conf
@@ -13,24 +13,24 @@ export GOVERNOR=ondemand
case "${BRANCH}" in
-legacy)
- export RASPI_DISTRO_KERNEL=yes # This will cause board to include distro's prebuilt kernel, not from source
- ;;
+ legacy)
+ export RASPI_DISTRO_KERNEL=yes # This will cause board to include distro's prebuilt kernel, not from source
+ ;;
-current)
- export RASPI_DISTRO_KERNEL=no
- export KERNELSOURCE='https://github.com/raspberrypi/linux'
- export KERNELBRANCH="branch:rpi-5.15.y"
- export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
- export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
- ;;
-edge)
- export RASPI_DISTRO_KERNEL=no
- export KERNELSOURCE='https://github.com/raspberrypi/linux'
- export KERNELBRANCH="branch:rpi-5.16.y"
- export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
- export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
- ;;
+ current)
+ export RASPI_DISTRO_KERNEL=no
+ export KERNELSOURCE='https://github.com/raspberrypi/linux'
+ export KERNELBRANCH="branch:rpi-5.15.y"
+ export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
+ export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
+ ;;
+ edge)
+ export RASPI_DISTRO_KERNEL=no
+ export KERNELSOURCE='https://github.com/raspberrypi/linux'
+ export KERNELBRANCH="branch:rpi-5.16.y"
+ export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
+ export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
+ ;;
esac
# Add a label to the root partition - this is common, should refactor into a separate segment
@@ -40,7 +40,7 @@ prepare_partitions_custom__add_rootfs_raspi_label_to_mkfs() {
}
pre_initramfs_flash_kernel__write_raspi_cmdline() {
- cat <<-EOD >"${FIRMWARE_DIR}/cmdline.txt"
+ cat <<- EOD > "${FIRMWARE_DIR}/cmdline.txt"
root=LABEL=${RASPI_ROOT_FS_LABEL} rootfstype=ext4 elevator=deadline rootwait fixrtc cgroup_enable=memory cgroup_memory=1 console=tty1
EOD
}
@@ -50,7 +50,7 @@ pre_flash_kernel__symlink_dtb_and_kernel() {
display_alert "Preparing DTBs and Kernel..." "bcm2711" "info"
mkdir -p "${MOUNT}"/etc/flash-kernel/dtbs
- cat <<-EOD >>"${MOUNT}"/etc/flash-kernel/db
+ cat <<- EOD >> "${MOUNT}"/etc/flash-kernel/db
# Armbian kernels have a different flavour than expected.
Machine: ${FK__MACHINE_MODEL}
Kernel-Flavors: any
@@ -85,7 +85,7 @@ extension_prepare_config__prepare_rpi_flash_kernel() {
fi
if [[ "${RASPI_DISTRO_KERNEL}" == "yes" ]]; then # and firmware.
- unset KERNELSOURCE # Make sure Armbian will not try to compile from source.
+ unset KERNELSOURCE # Make sure Armbian will not try to compile from source.
export FK__KERNEL_PACKAGES="${FK__KERNEL_PACKAGES} linux-tools-raspi linux-raspi linux-image-raspi "
# Ubuntu Impish+ split the kernel modules, add the extra ones too.
if [[ "$RELEASE" =~ ^(impish|jammy)$ ]]; then
From 03b4020135b5915e54895f5dcd53250df25d57e5 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Tue, 11 Jan 2022 11:36:25 +0100
Subject: [PATCH] armbian-next: manual merge (3) of all lib/*.sh changes
between revisions 1035905760884fbea567717684c38faae3ef28a4 and
e4e4ab0791e60e1e7a204dd0409fa29a1cf7a376
- missed non lib change on Several improvements for RPi builds (#3391)
- I just realized I will have to drop all non lib changes
---
config/boards/rpi4b.wip | 2 +-
config/sources/families/bcm2711.conf | 35 +++++++++++++++++++++++------------
lib/functions/compilation/debs.sh | 2 +-
lib/functions/general/downloads.sh | 19 +++++++++++--------
lib/functions/general/host.sh | 14 +++++++++++---
5 files changed, 47 insertions(+), 25 deletions(-)
diff --git a/config/boards/rpi4b.wip b/config/boards/rpi4b.wip
index 56a785a25..9afe14f75 100644
--- a/config/boards/rpi4b.wip
+++ b/config/boards/rpi4b.wip
@@ -9,7 +9,7 @@ export ASOUND_STATE="asound.state.rpi"
pre_initramfs_flash_kernel__write_raspi_config() {
# for serial console, there is also 'BOOT_UART=1' in 'rpi-eeprom-config' but that is for an earlier stage.
# look at with it rpi-eeprom-config, change with 'EDITOR=nano rpi-eeprom-config --edit'
- cat <<- EOD > "${FIRMWARE_DIR}/config.txt"
+ cat <<-EOD >"${FIRMWARE_DIR}/config.txt"
[pi4]
max_framebuffers=2
diff --git a/config/sources/families/bcm2711.conf b/config/sources/families/bcm2711.conf
index 950e90b14..31ecdf529 100644
--- a/config/sources/families/bcm2711.conf
+++ b/config/sources/families/bcm2711.conf
@@ -7,19 +7,30 @@ export KERNELDIR='linux-rpi' # Avoid sharing a source tree with o
export FK__PUBLISHED_KERNEL_VERSION="raspi" # flash kernel (FK) configuration
export FK__KERNEL_PACKAGES=""
export RASPI_ROOT_FS_LABEL="armbian"
+export CPUMIN=500000
+export CPUMAX=2000000
+export GOVERNOR=ondemand
case "${BRANCH}" in
- current)
- export RASPI_DISTRO_KERNEL=yes # This will cause board to include distro's prebuilt kernel, not from source
- ;;
+legacy)
+ export RASPI_DISTRO_KERNEL=yes # This will cause board to include distro's prebuilt kernel, not from source
+ ;;
- edge)
- export RASPI_DISTRO_KERNEL=no
- export KERNELBRANCH="branch:linux-5.15.y"
- export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
- export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
- ;;
+current)
+ export RASPI_DISTRO_KERNEL=no
+ export KERNELSOURCE='https://github.com/raspberrypi/linux'
+ export KERNELBRANCH="branch:rpi-5.15.y"
+ export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
+ export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
+ ;;
+edge)
+ export RASPI_DISTRO_KERNEL=no
+ export KERNELSOURCE='https://github.com/raspberrypi/linux'
+ export KERNELBRANCH="branch:rpi-5.16.y"
+ export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
+ export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
+ ;;
esac
# Add a label to the root partition - this is common, should refactor into a separate segment
@@ -29,7 +40,7 @@ prepare_partitions_custom__add_rootfs_raspi_label_to_mkfs() {
}
pre_initramfs_flash_kernel__write_raspi_cmdline() {
- cat <<- EOD > "${FIRMWARE_DIR}/cmdline.txt"
+ cat <<-EOD >"${FIRMWARE_DIR}/cmdline.txt"
root=LABEL=${RASPI_ROOT_FS_LABEL} rootfstype=ext4 elevator=deadline rootwait fixrtc cgroup_enable=memory cgroup_memory=1 console=tty1
EOD
}
@@ -39,7 +50,7 @@ pre_flash_kernel__symlink_dtb_and_kernel() {
display_alert "Preparing DTBs and Kernel..." "bcm2711" "info"
mkdir -p "${MOUNT}"/etc/flash-kernel/dtbs
- cat <<- EOD >> "${MOUNT}"/etc/flash-kernel/db
+ cat <<-EOD >>"${MOUNT}"/etc/flash-kernel/db
# Armbian kernels have a different flavour than expected.
Machine: ${FK__MACHINE_MODEL}
Kernel-Flavors: any
@@ -74,7 +85,7 @@ extension_prepare_config__prepare_rpi_flash_kernel() {
fi
if [[ "${RASPI_DISTRO_KERNEL}" == "yes" ]]; then # and firmware.
- unset KERNELSOURCE # Make sure Armbian will not try to compile from source.
+ unset KERNELSOURCE # Make sure Armbian will not try to compile from source.
export FK__KERNEL_PACKAGES="${FK__KERNEL_PACKAGES} linux-tools-raspi linux-raspi linux-image-raspi "
# Ubuntu Impish+ split the kernel modules, add the extra ones too.
if [[ "$RELEASE" =~ ^(impish|jammy)$ ]]; then
diff --git a/lib/functions/compilation/debs.sh b/lib/functions/compilation/debs.sh
index d696b9d86..2932264c0 100644
--- a/lib/functions/compilation/debs.sh
+++ b/lib/functions/compilation/debs.sh
@@ -14,7 +14,7 @@ compile_firmware() {
fetch_from_repo "https://github.com/armbian/firmware" "armbian-firmware-git" "branch:master"
if [[ -n $FULL ]]; then
- fetch_from_repo "$MAINLINE_FIRMWARE_SOURCE" "linux-firmware-git" "branch:master"
+ fetch_from_repo "$MAINLINE_FIRMWARE_SOURCE" "linux-firmware-git" "branch:main"
# cp : create hardlinks
cp -af --reflink=auto "${SRC}"/cache/sources/linux-firmware-git/* "${firmwaretempdir}/${plugin_dir}/lib/firmware/"
fi
diff --git a/lib/functions/general/downloads.sh b/lib/functions/general/downloads.sh
index 74659ead8..5d36282c0 100644
--- a/lib/functions/general/downloads.sh
+++ b/lib/functions/general/downloads.sh
@@ -1,19 +1,22 @@
function webseed() {
# list of mirrors that host our files
unset text
- WEBSEED=("$(curl -s https://redirect.armbian.com/mirrors | jq '.[] |.[] | values' | grep https | awk '!a[$0]++')")
+ # Hardcoded to EU mirrors since
+ local CCODE=$(curl -s redirect.armbian.com/geoip | jq '.continent.code' -r)
+ WEBSEED=($(curl -s https://redirect.armbian.com/mirrors | jq -r '.'${CCODE}' | .[] | values'))
# aria2 simply split chunks based on sources count not depending on download speed
# when selecting china mirrors, use only China mirror, others are very slow there
if [[ $DOWNLOAD_MIRROR == china ]]; then
- WEBSEED=("https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/")
+ WEBSEED=(
+ https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/
+ )
elif [[ $DOWNLOAD_MIRROR == bfsu ]]; then
- WEBSEED=("https://mirrors.bfsu.edu.cn/armbian-releases/")
+ WEBSEED=(
+ https://mirrors.bfsu.edu.cn/armbian-releases/
+ )
fi
- for toolchain in "${WEBSEED[@]}"; do
- # use only live, tnahosting return ok also when file is absent
- if [[ $(wget -S --spider "${toolchain}${1}" 2>&1 > /dev/null | grep 'HTTP/1.1 200 OK') && ${toolchain} != *tnahosting* ]]; then
- text="${text} ${toolchain}${1}"
- fi
+ for toolchain in ${WEBSEED[@]}; do
+ text="${text} ${toolchain}${1}"
done
text="${text:1}"
echo "${text}"
diff --git a/lib/functions/general/host.sh b/lib/functions/general/host.sh
index 6766aa78a..d262d4baa 100644
--- a/lib/functions/general/host.sh
+++ b/lib/functions/general/host.sh
@@ -23,7 +23,7 @@ prepare_host_basic() {
if [[ -n $install_pack ]]; then
display_alert "Installing basic packages" "$install_pack"
- apt-get -qq update && apt-get install -qq -y --no-install-recommends $install_pack
+ sudo bash -c "apt-get -qq update && apt-get install -qq -y --no-install-recommends $install_pack"
fi
}
@@ -329,12 +329,15 @@ function fetch_and_build_host_tools() {
}
# Installing debian packages in the armbian build system.
-# The function accepts three optional parameters:
+# The function accepts four optional parameters:
+# autoupdate - If the installation list is not empty then update first.
# upgrade, clean - the same name for apt
# verbose - detailed log for the function
#
# list="pkg1 pkg2 pkg3 pkgbadname pkg-1.0 | pkg-2.0 pkg5 (>= 9)"
# install_pkg_deb upgrade verbose $list
+# or
+# install_pkg_deb autoupdate $list
#
# If the package has a bad name, we will see it in the log file.
# If there is an LOG_OUTPUT_FILE variable and it has a value as
@@ -347,6 +350,7 @@ install_pkg_deb() {
local list=""
local log_file
local for_install
+ local need_autoup=false
local need_upgrade=false
local need_clean=false
local need_verbose=false
@@ -359,6 +363,10 @@ install_pkg_deb() {
list=$(
for p in $*; do
case $p in
+ autoupdate)
+ need_autoup=true
+ continue
+ ;;
upgrade)
need_upgrade=true
continue
@@ -413,7 +421,7 @@ install_pkg_deb() {
fi
if [ -n "$for_install" ]; then
- if ! $need_upgrade; then
+ if $need_autoup; then
apt-get -q update
apt-get -y upgrade
fi
From 1f2306a3ad4f0abf5730bb5eb26a70c979d86ff3 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 9 Jan 2022 15:22:10 +0100
Subject: [PATCH] rockship: fixes for `set -e` mode in rockship armhf family
and bsp tweaks
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
config/sources/families/rockchip.conf | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/config/sources/families/rockchip.conf b/config/sources/families/rockchip.conf
index 089fa5450..5870ed1fb 100644
--- a/config/sources/families/rockchip.conf
+++ b/config/sources/families/rockchip.conf
@@ -68,11 +68,15 @@ uboot_custom_postprocess() {
family_tweaks() {
if [[ $BOARD == tinkerboard ]]; then
- chroot $SDCARD /bin/bash -c "apt-get -y -qq install rfkill bluetooth bluez bluez-tools"
- chroot $SDCARD /bin/bash -c "systemctl --no-reload enable tinker-bluetooth.service >/dev/null 2>&1"
- sed -i -e "/#load-module module-alsa-sink/r $SRC/packages/bsp/rockchip/pulseaudio.txt" $SDCARD/etc/pulse/default.pa > /dev/null 2>&1
+ chroot $SDCARD /bin/bash -c "apt-get -y -qq install rfkill bluetooth bluez bluez-tools" 2>&1
+ chroot $SDCARD /bin/bash -c "systemctl --no-reload enable tinker-bluetooth.service" 2>&1
+ if [[ -f "$SDCARD/etc/pulse/default.pa" ]]; then
+ sed -i -e "/#load-module module-alsa-sink/r $SRC/packages/bsp/rockchip/pulseaudio.txt" "$SDCARD/etc/pulse/default.pa" 2>&1
+ else
+ display_alert "Can't find pulseaudio config" "${BOARD} - family_tweaks" "warn"
+ fi
fi
-
+ return 0
}
family_tweaks_bsp() {
@@ -87,8 +91,8 @@ family_tweaks_bsp() {
install -m 755 $SRC/packages/bsp/rockchip/hdmi-hotplug $destination/usr/local/bin
# Peripheral access for specific groups
- addgroup --system --quiet --gid 997 gpio
- addgroup --system --quiet --gid 998 i2c
+ addgroup --system --quiet --gid 997 gpio || display_alert "Failed to create 997 group gid" "gpio" "warn"
+ addgroup --system --quiet --gid 998 i2c || display_alert "Failed to create 997 group gid" "gpio" "warn"
cp $SRC/packages/bsp/rockchip/70-gpio.rules $destination/etc/udev/rules.d
cp $SRC/packages/bsp/rockchip/71-i2c.rules $destination/etc/udev/rules.d
@@ -105,4 +109,5 @@ family_tweaks_bsp() {
mkdir -p $destination/etc/initramfs-tools/hooks
install -m 550 $SRC/packages/bsp/rockchip/ap6330-initramfs-firmware $destination/etc/initramfs-tools/hooks
+ return 0 # exit with success
}
From 7bfb222e11c2a658ce29df17d17981fce8e03382 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 9 Jan 2022 15:21:40 +0100
Subject: [PATCH] armhf: enable building armhf targets on amd64 using system
toolchains
- SKIP_EXTERNAL_TOOLCHAINS=yes on amd64 should use the same system toolchains as an arm64 build
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
config/sources/armhf.conf | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/config/sources/armhf.conf b/config/sources/armhf.conf
index 89ce1441a..2d4682408 100644
--- a/config/sources/armhf.conf
+++ b/config/sources/armhf.conf
@@ -43,4 +43,8 @@ fi
[[ -z $KERNELSOURCE ]] && KERNELSOURCE=$MAINLINE_KERNEL_SOURCE
[[ -z $KERNELBRANCH ]] && KERNELBRANCH='branch:linux-5.4.y'
+## System toolchains don't have the -none- variant, remove it
+[[ "${SKIP_EXTERNAL_TOOLCHAINS}" == "yes" ]] && [[ "${UBOOT_COMPILER}" = *none* ]] && UBOOT_COMPILER="${UBOOT_COMPILER//-none-/-}"
+[[ "${SKIP_EXTERNAL_TOOLCHAINS}" == "yes" ]] && [[ "${ATF_COMPILER}" = *none* ]] && ATF_COMPILER="${ATF_COMPILER//-none-/-}"
+
true # don't fail due to conditional above.
From 79348c956a29a2077e017c2d83e129beed99208d Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 9 Jan 2022 15:20:50 +0100
Subject: [PATCH] logging: better logging about family_tweaks and
family_tweaks_bsp
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
lib/functions/bsp/bsp-cli.sh | 8 +++++++-
lib/functions/rootfs/distro-agnostic.sh | 8 +++++---
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/lib/functions/bsp/bsp-cli.sh b/lib/functions/bsp/bsp-cli.sh
index d4bb3daab..71f0ea765 100644
--- a/lib/functions/bsp/bsp-cli.sh
+++ b/lib/functions/bsp/bsp-cli.sh
@@ -285,7 +285,11 @@ create_board_package() {
sed -i 's/#no-auto-down/no-auto-down/g' "${destination}"/etc/network/interfaces.default
# execute $LINUXFAMILY-specific tweaks
- [[ $(type -t family_tweaks_bsp) == function ]] && family_tweaks_bsp 2>&1
+ if [[ $(type -t family_tweaks_bsp) == function ]]; then
+ display_alert "Running family_tweaks_bsp" "${LINUXFAMILY}" "debug"
+ family_tweaks_bsp 2>&1
+ display_alert "Done with family_tweaks_bsp" "${LINUXFAMILY}" "debug"
+ fi
call_extension_method "post_family_tweaks_bsp" << 'POST_FAMILY_TWEAKS_BSP'
*family_tweaks_bsp overrrides what is in the config, so give it a chance to override the family tweaks*
@@ -304,6 +308,8 @@ POST_FAMILY_TWEAKS_BSP
mkdir -p "${DEB_STORAGE}/"
rsync --remove-source-files -rq "${destination}.deb" "${DEB_STORAGE}/" 2>&1
+ display_alert "Done building BSP CLI package" "${destination}" "debug"
+
# cleanup
rm -rf ${bsptempdir}
}
diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
index 6249376b7..d348e4d39 100644
--- a/lib/functions/rootfs/distro-agnostic.sh
+++ b/lib/functions/rootfs/distro-agnostic.sh
@@ -397,10 +397,12 @@ POST_INSTALL_KERNEL_DEBS
# copy boot splash images
cp "${SRC}"/packages/blobs/splash/armbian-u-boot.bmp "${SDCARD}"/boot/boot.bmp
- display_alert "Running tweaks" "$BOARD :: $LINUXFAMILY" "info"
-
# execute $LINUXFAMILY-specific tweaks
- [[ $(type -t family_tweaks) == function ]] && family_tweaks
+ if [[ $(type -t family_tweaks) == function ]]; then
+ display_alert "Running family_tweaks" "$BOARD :: $LINUXFAMILY" "debug"
+ family_tweaks
+ display_alert "Done with family_tweaks" "$BOARD :: $LINUXFAMILY" "debug"
+ fi
call_extension_method "post_family_tweaks" << 'FAMILY_TWEAKS'
*customize the tweaks made by $LINUXFAMILY-specific family_tweaks*
From eca8ea1ba1b44474c3fd1baae9bdacae5ef7e431 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 8 Jan 2022 21:26:08 +0100
Subject: [PATCH] kernel: unblock cross compilation, warn about headers package
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
lib/functions/compilation/kernel.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index 291cf7285..e0bce0699 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -95,8 +95,7 @@ compile_kernel() {
toolchain=$(find_toolchain "$KERNEL_COMPILER" "$KERNEL_USE_GCC")
[[ -z $toolchain ]] && exit_with_error "Could not find required toolchain" "${KERNEL_COMPILER}gcc $KERNEL_USE_GCC"
else
- display_alert "'Reverse Cross compilation'" "target ${ARCH} on host $(dpkg --print-architecture)"
- exit_with_error "Architecture [$ARCH] is not supported"
+ display_alert "Unhandled cross compilation combo" "target ${ARCH} on host $(dpkg --print-architecture) - headers might not work" "warn"
fi
kernel_compiler_version="$(eval env PATH="${toolchain}:${PATH}" "${KERNEL_COMPILER}gcc" -dumpversion)"
From 739a4fe4d589a9d9ce58a725ed1d7db76b9aab3b Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 8 Jan 2022 20:02:23 +0100
Subject: [PATCH] logging: fixes for sunxi/megous stuff with `set -e`
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
config/sources/families/include/sunxi64_common.inc | 6 ++++--
config/sources/families/include/sunxi_common.inc | 6 ++++--
lib/functions/general/git.sh | 8 ++++----
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/config/sources/families/include/sunxi64_common.inc b/config/sources/families/include/sunxi64_common.inc
index 4d16fa449..4c44d37bf 100644
--- a/config/sources/families/include/sunxi64_common.inc
+++ b/config/sources/families/include/sunxi64_common.inc
@@ -74,6 +74,7 @@ setup_write_uboot_platform() {
# default settings for kernel variables of the original kernel
# VAR_SHALLOW_ORIGINAL=var_origin_kernel
+# Note: rpardini: this is called via VAR_SHALLOW_ORIGINAL during fetch_from_repo via waiter_local_repo
var_origin_kernel() {
url=$MAINLINE_KERNEL_SOURCE
name='origin'
@@ -81,8 +82,7 @@ var_origin_kernel() {
start_tag="v$KERNEL_VERSION_LEVEL"
# checking the reachability of the initial tag
- if [ "$(git ls-remote --tags $url $start_tag |
- awk -F'/' '{if (NR == 1) print $NF}')" != "$start_tag" ]; then
+ if [ "$(git ls-remote --tags $url $start_tag | awk -F'/' '{if (NR == 1) print $NF}' || true)" != "$start_tag" ]; then
exit 177
fi
@@ -90,4 +90,6 @@ var_origin_kernel() {
# a bifurcation point at which all previous merge branches converge.
# This is due to the subsequent extraction of `megous`
[ "$KERNEL_VERSION_LEVEL" == "5.12" ] && start_tag="v5.12-rc7"
+
+ return 0 # don't fail due to short-circuit above
}
diff --git a/config/sources/families/include/sunxi_common.inc b/config/sources/families/include/sunxi_common.inc
index 7b9907a58..641cceb1c 100644
--- a/config/sources/families/include/sunxi_common.inc
+++ b/config/sources/families/include/sunxi_common.inc
@@ -81,6 +81,7 @@ setup_write_uboot_platform() {
# default settings for kernel variables of the original kernel
# VAR_SHALLOW_ORIGINAL=var_origin_kernel
+# Note: rpardini: this is called via VAR_SHALLOW_ORIGINAL during fetch_from_repo via waiter_local_repo
var_origin_kernel() {
url=$MAINLINE_KERNEL_SOURCE
name='origin'
@@ -88,8 +89,7 @@ var_origin_kernel() {
start_tag="v$KERNEL_VERSION_LEVEL"
# checking the reachability of the initial tag
- if [ "$(git ls-remote --tags $url $start_tag |
- awk -F'/' '{if (NR == 1) print $NF}')" != "$start_tag" ]; then
+ if [ "$(git ls-remote --tags $url $start_tag | awk -F'/' '{if (NR == 1) print $NF}' || true)" != "$start_tag" ]; then
exit 177
fi
@@ -97,4 +97,6 @@ var_origin_kernel() {
# a bifurcation point at which all previous merge branches converge.
# This is due to the subsequent extraction of `megous`
[ "$KERNEL_VERSION_LEVEL" == "5.12" ] && start_tag="v5.12-rc7"
+
+ return 0 # don't fail due to short-circuit above
}
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index 9fb0dfcf3..f66b5ea90 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -74,7 +74,7 @@ waiter_local_repo() {
# Check the exception for 5.15 sunxi. We will remove this after a while.
if [ "$dir" == "linux-mainline/5.15" ] &&
- [ "$(git remote show | grep megous)" == "megous" ]; then
+ [ "$(git remote show | grep megous || true)" == "megous" ]; then
display_alert "Remove mistakenly created and excessively large" "$dir" "info"
rm -rf .git ./*
fi
@@ -84,12 +84,12 @@ waiter_local_repo() {
# Run in the sub shell to avoid mixing environment variables.
if [ -n "$VAR_SHALLOW_ORIGINAL" ]; then
+ display_alert "Unshallowing original:" "${VAR_SHALLOW_ORIGINAL}" "debug"
(
$VAR_SHALLOW_ORIGINAL
display_alert "Add original git sources" "$dir $name/$branch" "info"
- if [ "$(git ls-remote -h $url $branch |
- awk -F'/' '{if (NR == 1) print $NF}')" != "$branch" ]; then
+ if [ "$(git ls-remote -h $url $branch | awk -F'/' '{if (NR == 1) print $NF}' || true)" != "$branch" ]; then
display_alert "Bad $branch for $url in $VAR_SHALLOW_ORIGINAL"
exit 177
fi
@@ -109,7 +109,7 @@ waiter_local_repo() {
clean_up_repo $work_dir
fi
- if [ "$name" != "$(git remote show | grep $name)" ]; then
+ if [ "$name" != "$(git remote show | grep $name || true)" ]; then
git remote add -t $branch $name $url
fi
From 9fc0bd5788857c43c3f4d6e217928539ccd894a9 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 8 Jan 2022 15:01:03 +0100
Subject: [PATCH] logging: fix shellcheck references generation
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
lib/library-functions.sh | 94 ++++++++++++++++++++++++------------------------
lib/tools/gen-library.sh | 2 +-
2 files changed, 48 insertions(+), 48 deletions(-)
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index 46f984a97..564af3c42 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -3,237 +3,237 @@
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/configuration/menu.sh
-# shellcheck source=functions/configuration/menu.sh
+# shellcheck source=lib/functions/configuration/menu.sh
source "${SRC}"/lib/functions/configuration/menu.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/configuration/interactive.sh
-# shellcheck source=functions/configuration/interactive.sh
+# shellcheck source=lib/functions/configuration/interactive.sh
source "${SRC}"/lib/functions/configuration/interactive.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/configuration/config-desktop.sh
-# shellcheck source=functions/configuration/config-desktop.sh
+# shellcheck source=lib/functions/configuration/config-desktop.sh
source "${SRC}"/lib/functions/configuration/config-desktop.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/configuration/main-config.sh
-# shellcheck source=functions/configuration/main-config.sh
+# shellcheck source=lib/functions/configuration/main-config.sh
source "${SRC}"/lib/functions/configuration/main-config.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/configuration/aggregation.sh
-# shellcheck source=functions/configuration/aggregation.sh
+# shellcheck source=lib/functions/configuration/aggregation.sh
source "${SRC}"/lib/functions/configuration/aggregation.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/create-cache.sh
-# shellcheck source=functions/rootfs/create-cache.sh
+# shellcheck source=lib/functions/rootfs/create-cache.sh
source "${SRC}"/lib/functions/rootfs/create-cache.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/apt.sh
-# shellcheck source=functions/rootfs/apt.sh
+# shellcheck source=lib/functions/rootfs/apt.sh
source "${SRC}"/lib/functions/rootfs/apt.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/distro-specific.sh
-# shellcheck source=functions/rootfs/distro-specific.sh
+# shellcheck source=lib/functions/rootfs/distro-specific.sh
source "${SRC}"/lib/functions/rootfs/distro-specific.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/rootfs-desktop.sh
-# shellcheck source=functions/rootfs/rootfs-desktop.sh
+# shellcheck source=lib/functions/rootfs/rootfs-desktop.sh
source "${SRC}"/lib/functions/rootfs/rootfs-desktop.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/post-tweaks.sh
-# shellcheck source=functions/rootfs/post-tweaks.sh
+# shellcheck source=lib/functions/rootfs/post-tweaks.sh
source "${SRC}"/lib/functions/rootfs/post-tweaks.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/customize.sh
-# shellcheck source=functions/rootfs/customize.sh
+# shellcheck source=lib/functions/rootfs/customize.sh
source "${SRC}"/lib/functions/rootfs/customize.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/distro-agnostic.sh
-# shellcheck source=functions/rootfs/distro-agnostic.sh
+# shellcheck source=lib/functions/rootfs/distro-agnostic.sh
source "${SRC}"/lib/functions/rootfs/distro-agnostic.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/boot_logo.sh
-# shellcheck source=functions/rootfs/boot_logo.sh
+# shellcheck source=lib/functions/rootfs/boot_logo.sh
source "${SRC}"/lib/functions/rootfs/boot_logo.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/general/chroot-helpers.sh
-# shellcheck source=functions/general/chroot-helpers.sh
+# shellcheck source=lib/functions/general/chroot-helpers.sh
source "${SRC}"/lib/functions/general/chroot-helpers.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/general/repo.sh
-# shellcheck source=functions/general/repo.sh
+# shellcheck source=lib/functions/general/repo.sh
source "${SRC}"/lib/functions/general/repo.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/general/cleaning.sh
-# shellcheck source=functions/general/cleaning.sh
+# shellcheck source=lib/functions/general/cleaning.sh
source "${SRC}"/lib/functions/general/cleaning.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/general/git.sh
-# shellcheck source=functions/general/git.sh
+# shellcheck source=lib/functions/general/git.sh
source "${SRC}"/lib/functions/general/git.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/general/host.sh
-# shellcheck source=functions/general/host.sh
+# shellcheck source=lib/functions/general/host.sh
source "${SRC}"/lib/functions/general/host.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/general/downloads.sh
-# shellcheck source=functions/general/downloads.sh
+# shellcheck source=lib/functions/general/downloads.sh
source "${SRC}"/lib/functions/general/downloads.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/multi/build-all.sh
-# shellcheck source=functions/multi/build-all.sh
+# shellcheck source=lib/functions/multi/build-all.sh
source "${SRC}"/lib/functions/multi/build-all.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/cli/utils-cli.sh
-# shellcheck source=functions/cli/utils-cli.sh
+# shellcheck source=lib/functions/cli/utils-cli.sh
source "${SRC}"/lib/functions/cli/utils-cli.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/cli/cli-entrypoint.sh
-# shellcheck source=functions/cli/cli-entrypoint.sh
+# shellcheck source=lib/functions/cli/cli-entrypoint.sh
source "${SRC}"/lib/functions/cli/cli-entrypoint.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/bsp/bsp-cli.sh
-# shellcheck source=functions/bsp/bsp-cli.sh
+# shellcheck source=lib/functions/bsp/bsp-cli.sh
source "${SRC}"/lib/functions/bsp/bsp-cli.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/bsp/bsp-desktop.sh
-# shellcheck source=functions/bsp/bsp-desktop.sh
+# shellcheck source=lib/functions/bsp/bsp-desktop.sh
source "${SRC}"/lib/functions/bsp/bsp-desktop.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/bsp/utils-bsp.sh
-# shellcheck source=functions/bsp/utils-bsp.sh
+# shellcheck source=lib/functions/bsp/utils-bsp.sh
source "${SRC}"/lib/functions/bsp/utils-bsp.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/image/loop.sh
-# shellcheck source=functions/image/loop.sh
+# shellcheck source=lib/functions/image/loop.sh
source "${SRC}"/lib/functions/image/loop.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/image/initrd.sh
-# shellcheck source=functions/image/initrd.sh
+# shellcheck source=lib/functions/image/initrd.sh
source "${SRC}"/lib/functions/image/initrd.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/image/rootfs-to-image.sh
-# shellcheck source=functions/image/rootfs-to-image.sh
+# shellcheck source=lib/functions/image/rootfs-to-image.sh
source "${SRC}"/lib/functions/image/rootfs-to-image.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/image/partitioning.sh
-# shellcheck source=functions/image/partitioning.sh
+# shellcheck source=lib/functions/image/partitioning.sh
source "${SRC}"/lib/functions/image/partitioning.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/main/rootfs-image.sh
-# shellcheck source=functions/main/rootfs-image.sh
+# shellcheck source=lib/functions/main/rootfs-image.sh
source "${SRC}"/lib/functions/main/rootfs-image.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/main/config-prepare.sh
-# shellcheck source=functions/main/config-prepare.sh
+# shellcheck source=lib/functions/main/config-prepare.sh
source "${SRC}"/lib/functions/main/config-prepare.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/main/default-build.sh
-# shellcheck source=functions/main/default-build.sh
+# shellcheck source=lib/functions/main/default-build.sh
source "${SRC}"/lib/functions/main/default-build.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/compilation/sources.sh
-# shellcheck source=functions/compilation/sources.sh
+# shellcheck source=lib/functions/compilation/sources.sh
source "${SRC}"/lib/functions/compilation/sources.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/compilation/uboot.sh
-# shellcheck source=functions/compilation/uboot.sh
+# shellcheck source=lib/functions/compilation/uboot.sh
source "${SRC}"/lib/functions/compilation/uboot.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/compilation/atf.sh
-# shellcheck source=functions/compilation/atf.sh
+# shellcheck source=lib/functions/compilation/atf.sh
source "${SRC}"/lib/functions/compilation/atf.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/compilation/utils-compilation.sh
-# shellcheck source=functions/compilation/utils-compilation.sh
+# shellcheck source=lib/functions/compilation/utils-compilation.sh
source "${SRC}"/lib/functions/compilation/utils-compilation.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/compilation/kernel.sh
-# shellcheck source=functions/compilation/kernel.sh
+# shellcheck source=lib/functions/compilation/kernel.sh
source "${SRC}"/lib/functions/compilation/kernel.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/compilation/debs.sh
-# shellcheck source=functions/compilation/debs.sh
+# shellcheck source=lib/functions/compilation/debs.sh
source "${SRC}"/lib/functions/compilation/debs.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/compilation/extra-drivers.sh
-# shellcheck source=functions/compilation/extra-drivers.sh
+# shellcheck source=lib/functions/compilation/extra-drivers.sh
source "${SRC}"/lib/functions/compilation/extra-drivers.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/compilation/patching.sh
-# shellcheck source=functions/compilation/patching.sh
+# shellcheck source=lib/functions/compilation/patching.sh
source "${SRC}"/lib/functions/compilation/patching.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/logging/capture.sh
-# shellcheck source=functions/logging/capture.sh
+# shellcheck source=lib/functions/logging/capture.sh
source "${SRC}"/lib/functions/logging/capture.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/logging/runners.sh
-# shellcheck source=functions/logging/runners.sh
+# shellcheck source=lib/functions/logging/runners.sh
source "${SRC}"/lib/functions/logging/runners.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/logging/errors.sh
-# shellcheck source=functions/logging/errors.sh
+# shellcheck source=lib/functions/logging/errors.sh
source "${SRC}"/lib/functions/logging/errors.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/logging/logging.sh
-# shellcheck source=functions/logging/logging.sh
+# shellcheck source=lib/functions/logging/logging.sh
source "${SRC}"/lib/functions/logging/logging.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/logging/traps.sh
-# shellcheck source=functions/logging/traps.sh
+# shellcheck source=lib/functions/logging/traps.sh
source "${SRC}"/lib/functions/logging/traps.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/extras/fel.sh
-# shellcheck source=functions/extras/fel.sh
+# shellcheck source=lib/functions/extras/fel.sh
source "${SRC}"/lib/functions/extras/fel.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/extras/buildpkg.sh
-# shellcheck source=functions/extras/buildpkg.sh
+# shellcheck source=lib/functions/extras/buildpkg.sh
source "${SRC}"/lib/functions/extras/buildpkg.sh
diff --git a/lib/tools/gen-library.sh b/lib/tools/gen-library.sh
index 10a62fa70..fd6f200e7 100755
--- a/lib/tools/gen-library.sh
+++ b/lib/tools/gen-library.sh
@@ -18,7 +18,7 @@ cat <<- AUTOGEN_INCLUDES_HEADER > "${TARGET_SH}"
AUTOGEN_INCLUDES_HEADER
find lib/functions -type f -name \*.sh | while read -r path; do
- ref="$(echo -n "${path}" | sed -e 's/lib\///g')"
+ ref="$(echo -n "${path}")"
cat <<- AUTOGEN_INCLUDES_EACH >> "${TARGET_SH}"
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### ${path}
From 49cdd43f9fa208e13607eae9dad138d4d49a0a5f Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 8 Jan 2022 13:56:36 +0100
Subject: [PATCH] logging: manual merge (2) of all lib/*.sh changes between
revisions 117633687e9942ade647a8b7d3f80f01e3145193 and
30830388555e463402161a6e0d6993dd6fb0544e
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
lib/functions/cli/utils-cli.sh | 8 ++++----
lib/functions/general/host.sh | 14 ++++++++------
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/lib/functions/cli/utils-cli.sh b/lib/functions/cli/utils-cli.sh
index 593237601..d9f6a571c 100644
--- a/lib/functions/cli/utils-cli.sh
+++ b/lib/functions/cli/utils-cli.sh
@@ -93,12 +93,12 @@ function handle_docker_vagrant() {
[[ "${codename}" =~ focal|hirsute ]] && DOCKER_BINARY="docker containerd docker.io"
display_alert "Docker not installed." "Installing" "Info"
- echo "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/${codeid} ${codename} stable" > /etc/apt/sources.list.d/docker.list
+ sudo bash -c "echo \"deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/${codeid} ${codename} stable\" > /etc/apt/sources.list.d/docker.list"
- curl -fsSL "https://download.docker.com/linux/${codeid}/gpg" | apt-key add -qq - > /dev/null 2>&1
+ sudo bash -c "curl -fsSL \"https://download.docker.com/linux/${codeid}/gpg\" | apt-key add -qq - > /dev/null 2>&1 "
export DEBIAN_FRONTEND=noninteractive
- apt-get update
- apt-get install -y -qq --no-install-recommends ${DOCKER_BINARY}
+ sudo apt-get update
+ sudo apt-get install -y -qq --no-install-recommends ${DOCKER_BINARY}
display_alert "Add yourself to docker group to avoid root privileges" "" "wrn"
"${SRC}/compile.sh" "$@"
exit $?
diff --git a/lib/functions/general/host.sh b/lib/functions/general/host.sh
index ef681d301..6766aa78a 100644
--- a/lib/functions/general/host.sh
+++ b/lib/functions/general/host.sh
@@ -178,7 +178,7 @@ prepare_host() {
sudo echo "apt-cacher-ng apt-cacher-ng/tunnelenable boolean false" | sudo debconf-set-selections
LOG_OUTPUT_FILE="${DEST}"/${LOG_SUBPATH}/hostdeps.log
- install_pkg_deb "upgrade $hostdeps"
+ install_pkg_deb "$hostdeps"
unset LOG_OUTPUT_FILE
update-ccache-symlinks
@@ -383,11 +383,10 @@ install_pkg_deb() {
log_file="${SRC}/output/${LOG_SUBPATH}/install.log"
fi
- apt-get -q update
- if [ "$?" != "0" ]; then echo "apt cannot update" >> $log_file; fi
+ # This is necessary first when there is no apt cache.
if $need_upgrade; then
- apt-get -y upgrade
- if [ "$?" != "0" ]; then echo "apt cannot upgrade" >> $log_file; fi
+ apt-get -q update || echo "apt cannot update" >> $tmp_file
+ apt-get -y upgrade || echo "apt cannot upgrade" >> $tmp_file
fi
# If the package is not installed, check the latest
@@ -414,7 +413,10 @@ install_pkg_deb() {
fi
if [ -n "$for_install" ]; then
-
+ if ! $need_upgrade; then
+ apt-get -q update
+ apt-get -y upgrade
+ fi
apt-get install -qq -y --no-install-recommends $for_install
echo -e "\nPackages installed:" >> $log_file
dpkg-query -W \
From 496713bb6f122440105626db767b39db7dd41e2f Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 8 Jan 2022 13:35:51 +0100
Subject: [PATCH] logging: renaming function files a bit more consistently
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
lib/functions/cli/{cli-utils.sh => utils-cli.sh} | 0
.../{compilation-utils.sh => utils-compilation.sh} | 0
.../{distro_agnostic.sh => distro-agnostic.sh} | 0
.../{distro_specific.sh => distro-specific.sh} | 0
lib/library-functions.sh | 28 +++++++++++-----------
5 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/lib/functions/cli/cli-utils.sh b/lib/functions/cli/utils-cli.sh
similarity index 100%
rename from lib/functions/cli/cli-utils.sh
rename to lib/functions/cli/utils-cli.sh
diff --git a/lib/functions/compilation/compilation-utils.sh b/lib/functions/compilation/utils-compilation.sh
similarity index 100%
rename from lib/functions/compilation/compilation-utils.sh
rename to lib/functions/compilation/utils-compilation.sh
diff --git a/lib/functions/rootfs/distro_agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh
similarity index 100%
rename from lib/functions/rootfs/distro_agnostic.sh
rename to lib/functions/rootfs/distro-agnostic.sh
diff --git a/lib/functions/rootfs/distro_specific.sh b/lib/functions/rootfs/distro-specific.sh
similarity index 100%
rename from lib/functions/rootfs/distro_specific.sh
rename to lib/functions/rootfs/distro-specific.sh
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index 61f800a56..46f984a97 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -37,20 +37,15 @@ set -e # no errors tolerated. set -e is invoked before each sourced file to make
source "${SRC}"/lib/functions/rootfs/apt.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/rootfs/distro_agnostic.sh
-# shellcheck source=functions/rootfs/distro_agnostic.sh
-source "${SRC}"/lib/functions/rootfs/distro_agnostic.sh
+### lib/functions/rootfs/distro-specific.sh
+# shellcheck source=functions/rootfs/distro-specific.sh
+source "${SRC}"/lib/functions/rootfs/distro-specific.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/rootfs-desktop.sh
# shellcheck source=functions/rootfs/rootfs-desktop.sh
source "${SRC}"/lib/functions/rootfs/rootfs-desktop.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/rootfs/distro_specific.sh
-# shellcheck source=functions/rootfs/distro_specific.sh
-source "${SRC}"/lib/functions/rootfs/distro_specific.sh
-
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/post-tweaks.sh
# shellcheck source=functions/rootfs/post-tweaks.sh
@@ -61,6 +56,11 @@ set -e # no errors tolerated. set -e is invoked before each sourced file to make
# shellcheck source=functions/rootfs/customize.sh
source "${SRC}"/lib/functions/rootfs/customize.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
+### lib/functions/rootfs/distro-agnostic.sh
+# shellcheck source=functions/rootfs/distro-agnostic.sh
+source "${SRC}"/lib/functions/rootfs/distro-agnostic.sh
+
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/boot_logo.sh
# shellcheck source=functions/rootfs/boot_logo.sh
@@ -102,9 +102,9 @@ set -e # no errors tolerated. set -e is invoked before each sourced file to make
source "${SRC}"/lib/functions/multi/build-all.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/cli/cli-utils.sh
-# shellcheck source=functions/cli/cli-utils.sh
-source "${SRC}"/lib/functions/cli/cli-utils.sh
+### lib/functions/cli/utils-cli.sh
+# shellcheck source=functions/cli/utils-cli.sh
+source "${SRC}"/lib/functions/cli/utils-cli.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/cli/cli-entrypoint.sh
@@ -177,9 +177,9 @@ set -e # no errors tolerated. set -e is invoked before each sourced file to make
source "${SRC}"/lib/functions/compilation/atf.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/compilation/compilation-utils.sh
-# shellcheck source=functions/compilation/compilation-utils.sh
-source "${SRC}"/lib/functions/compilation/compilation-utils.sh
+### lib/functions/compilation/utils-compilation.sh
+# shellcheck source=functions/compilation/utils-compilation.sh
+source "${SRC}"/lib/functions/compilation/utils-compilation.sh
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/compilation/kernel.sh
From 3c36aa6e495d06ab1fc599585e14c3a66ec14f03 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 8 Jan 2022 01:46:22 +0100
Subject: [PATCH] logging: removing leftover empty file after all the moving
around
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
lib/functions/image.sh | 1 -
lib/library-functions.sh | 5 -----
2 files changed, 6 deletions(-)
diff --git a/lib/functions/image.sh b/lib/functions/image.sh
deleted file mode 100644
index 8b1378917..000000000
--- a/lib/functions/image.sh
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index 1f4a18415..61f800a56 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -146,11 +146,6 @@ set -e # no errors tolerated. set -e is invoked before each sourced file to make
# shellcheck source=functions/image/partitioning.sh
source "${SRC}"/lib/functions/image/partitioning.sh
-set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
-### lib/functions/image.sh
-# shellcheck source=functions/image.sh
-source "${SRC}"/lib/functions/image.sh
-
set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/main/rootfs-image.sh
# shellcheck source=functions/main/rootfs-image.sh
From 5d19b3686e732d07ac0d49abba76e03b42f4309e Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 8 Jan 2022 01:16:55 +0100
Subject: [PATCH] logging: really insist on set -e during library loading
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
lib/library-functions.sh | 54 +++++++++++++++++++++++++++++++++++++++++++++---
lib/tools/gen-library.sh | 6 +++---
2 files changed, 54 insertions(+), 6 deletions(-)
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index 3a3953118..1f4a18415 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -1,198 +1,246 @@
#!/usr/bin/env bash
# This file is/was autogenerated by lib/tools/gen-library.sh; don't modify manually
-set -e # no errors tolerated
-
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/configuration/menu.sh
# shellcheck source=functions/configuration/menu.sh
source "${SRC}"/lib/functions/configuration/menu.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/configuration/interactive.sh
# shellcheck source=functions/configuration/interactive.sh
source "${SRC}"/lib/functions/configuration/interactive.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/configuration/config-desktop.sh
# shellcheck source=functions/configuration/config-desktop.sh
source "${SRC}"/lib/functions/configuration/config-desktop.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/configuration/main-config.sh
# shellcheck source=functions/configuration/main-config.sh
source "${SRC}"/lib/functions/configuration/main-config.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/configuration/aggregation.sh
# shellcheck source=functions/configuration/aggregation.sh
source "${SRC}"/lib/functions/configuration/aggregation.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/create-cache.sh
# shellcheck source=functions/rootfs/create-cache.sh
source "${SRC}"/lib/functions/rootfs/create-cache.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/apt.sh
# shellcheck source=functions/rootfs/apt.sh
source "${SRC}"/lib/functions/rootfs/apt.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/distro_agnostic.sh
# shellcheck source=functions/rootfs/distro_agnostic.sh
source "${SRC}"/lib/functions/rootfs/distro_agnostic.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/rootfs-desktop.sh
# shellcheck source=functions/rootfs/rootfs-desktop.sh
source "${SRC}"/lib/functions/rootfs/rootfs-desktop.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/distro_specific.sh
# shellcheck source=functions/rootfs/distro_specific.sh
source "${SRC}"/lib/functions/rootfs/distro_specific.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/post-tweaks.sh
# shellcheck source=functions/rootfs/post-tweaks.sh
source "${SRC}"/lib/functions/rootfs/post-tweaks.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/customize.sh
# shellcheck source=functions/rootfs/customize.sh
source "${SRC}"/lib/functions/rootfs/customize.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/rootfs/boot_logo.sh
# shellcheck source=functions/rootfs/boot_logo.sh
source "${SRC}"/lib/functions/rootfs/boot_logo.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/general/chroot-helpers.sh
# shellcheck source=functions/general/chroot-helpers.sh
source "${SRC}"/lib/functions/general/chroot-helpers.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/general/repo.sh
# shellcheck source=functions/general/repo.sh
source "${SRC}"/lib/functions/general/repo.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/general/cleaning.sh
# shellcheck source=functions/general/cleaning.sh
source "${SRC}"/lib/functions/general/cleaning.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/general/git.sh
# shellcheck source=functions/general/git.sh
source "${SRC}"/lib/functions/general/git.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/general/host.sh
# shellcheck source=functions/general/host.sh
source "${SRC}"/lib/functions/general/host.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/general/downloads.sh
# shellcheck source=functions/general/downloads.sh
source "${SRC}"/lib/functions/general/downloads.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/multi/build-all.sh
# shellcheck source=functions/multi/build-all.sh
source "${SRC}"/lib/functions/multi/build-all.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/cli/cli-utils.sh
# shellcheck source=functions/cli/cli-utils.sh
source "${SRC}"/lib/functions/cli/cli-utils.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/cli/cli-entrypoint.sh
# shellcheck source=functions/cli/cli-entrypoint.sh
source "${SRC}"/lib/functions/cli/cli-entrypoint.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/bsp/bsp-cli.sh
# shellcheck source=functions/bsp/bsp-cli.sh
source "${SRC}"/lib/functions/bsp/bsp-cli.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/bsp/bsp-desktop.sh
# shellcheck source=functions/bsp/bsp-desktop.sh
source "${SRC}"/lib/functions/bsp/bsp-desktop.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/bsp/utils-bsp.sh
# shellcheck source=functions/bsp/utils-bsp.sh
source "${SRC}"/lib/functions/bsp/utils-bsp.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/image/loop.sh
# shellcheck source=functions/image/loop.sh
source "${SRC}"/lib/functions/image/loop.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/image/initrd.sh
# shellcheck source=functions/image/initrd.sh
source "${SRC}"/lib/functions/image/initrd.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/image/rootfs-to-image.sh
# shellcheck source=functions/image/rootfs-to-image.sh
source "${SRC}"/lib/functions/image/rootfs-to-image.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/image/partitioning.sh
# shellcheck source=functions/image/partitioning.sh
source "${SRC}"/lib/functions/image/partitioning.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/image.sh
# shellcheck source=functions/image.sh
source "${SRC}"/lib/functions/image.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/main/rootfs-image.sh
# shellcheck source=functions/main/rootfs-image.sh
source "${SRC}"/lib/functions/main/rootfs-image.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/main/config-prepare.sh
# shellcheck source=functions/main/config-prepare.sh
source "${SRC}"/lib/functions/main/config-prepare.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/main/default-build.sh
# shellcheck source=functions/main/default-build.sh
source "${SRC}"/lib/functions/main/default-build.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/compilation/sources.sh
# shellcheck source=functions/compilation/sources.sh
source "${SRC}"/lib/functions/compilation/sources.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/compilation/uboot.sh
# shellcheck source=functions/compilation/uboot.sh
source "${SRC}"/lib/functions/compilation/uboot.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/compilation/atf.sh
# shellcheck source=functions/compilation/atf.sh
source "${SRC}"/lib/functions/compilation/atf.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/compilation/compilation-utils.sh
# shellcheck source=functions/compilation/compilation-utils.sh
source "${SRC}"/lib/functions/compilation/compilation-utils.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/compilation/kernel.sh
# shellcheck source=functions/compilation/kernel.sh
source "${SRC}"/lib/functions/compilation/kernel.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/compilation/debs.sh
# shellcheck source=functions/compilation/debs.sh
source "${SRC}"/lib/functions/compilation/debs.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/compilation/extra-drivers.sh
# shellcheck source=functions/compilation/extra-drivers.sh
source "${SRC}"/lib/functions/compilation/extra-drivers.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/compilation/patching.sh
# shellcheck source=functions/compilation/patching.sh
source "${SRC}"/lib/functions/compilation/patching.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/logging/capture.sh
# shellcheck source=functions/logging/capture.sh
source "${SRC}"/lib/functions/logging/capture.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/logging/runners.sh
# shellcheck source=functions/logging/runners.sh
source "${SRC}"/lib/functions/logging/runners.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/logging/errors.sh
# shellcheck source=functions/logging/errors.sh
source "${SRC}"/lib/functions/logging/errors.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/logging/logging.sh
# shellcheck source=functions/logging/logging.sh
source "${SRC}"/lib/functions/logging/logging.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/logging/traps.sh
# shellcheck source=functions/logging/traps.sh
source "${SRC}"/lib/functions/logging/traps.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/extras/fel.sh
# shellcheck source=functions/extras/fel.sh
source "${SRC}"/lib/functions/extras/fel.sh
+set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### lib/functions/extras/buildpkg.sh
# shellcheck source=functions/extras/buildpkg.sh
source "${SRC}"/lib/functions/extras/buildpkg.sh
-# This file is/was autogenerated by lib/tools/gen-library.sh; don't modify manually - thanks
+
+set -e # no errors tolerated. one last time for the win!
+# This file is/was autogenerated by lib/tools/gen-library.sh; don't modify manually
diff --git a/lib/tools/gen-library.sh b/lib/tools/gen-library.sh
index 49ba242be..10a62fa70 100755
--- a/lib/tools/gen-library.sh
+++ b/lib/tools/gen-library.sh
@@ -15,13 +15,12 @@ cat <<- AUTOGEN_INCLUDES_HEADER > "${TARGET_SH}"
#!/usr/bin/env bash
# This file is/was autogenerated by ${0}; don't modify manually
- set -e # no errors tolerated
-
AUTOGEN_INCLUDES_HEADER
find lib/functions -type f -name \*.sh | while read -r path; do
ref="$(echo -n "${path}" | sed -e 's/lib\///g')"
cat <<- AUTOGEN_INCLUDES_EACH >> "${TARGET_SH}"
+ set -e # no errors tolerated. set -e is invoked before each sourced file to make sure.
### ${path}
# shellcheck source=${ref}
source "\${SRC}"/${path}
@@ -31,7 +30,8 @@ done
cat <<- AUTOGEN_INCLUDES_FOOTER >> "${TARGET_SH}"
- # This file is/was autogenerated by ${0}; don't modify manually - thanks
+ set -e # no errors tolerated. one last time for the win!
+ # This file is/was autogenerated by ${0}; don't modify manually
AUTOGEN_INCLUDES_FOOTER
echo "done."
From dc2dd8dd4ced5244a5c615fe815b08455b119bbb Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 7 Jan 2022 23:35:25 +0100
Subject: [PATCH] logging: shellfmt again after rebasing master
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
config/boards/jetson-nano.conf | 1 -
config/sources/families/jetson-nano.conf | 66 ++++++++++++++++++++++++++++++++
extensions/flash-kernel.sh | 4 +-
lib/functions/configuration/menu.sh | 2 -
lib/library-functions.sh | 1 -
5 files changed, 68 insertions(+), 6 deletions(-)
diff --git a/config/boards/jetson-nano.conf b/config/boards/jetson-nano.conf
index 476b90bfb..fc2779817 100644
--- a/config/boards/jetson-nano.conf
+++ b/config/boards/jetson-nano.conf
@@ -8,4 +8,3 @@ BOOT_LOGO="desktop"
BOOT_FDT_FILE="nvidia/tegra210-p3450-0000.dtb"
SRC_EXTLINUX="yes"
SRC_CMDLINE="console=ttyS0,115200n8 console=tty0"
-
diff --git a/config/sources/families/jetson-nano.conf b/config/sources/families/jetson-nano.conf
new file mode 100644
index 000000000..f4710d751
--- /dev/null
+++ b/config/sources/families/jetson-nano.conf
@@ -0,0 +1,66 @@
+ARCH=arm64
+KERNEL_IMAGE_TYPE=Image
+ATF_COMPILE="no"
+OFFSET=16
+BOOTDELAY=0
+BOOTBRANCH="tag:v2021.07"
+BOOTPATCHDIR="u-boot-rockchip64"
+UBOOT_TARGET_MAP=";;u-boot.bin"
+
+CPUMIN=504000
+CPUMAX=2132000
+GOVERNOR=ondemand
+
+case $BRANCH in
+
+ legacy)
+ KERNELDIR='linux-nano'
+ KERNELSOURCE='https://github.com/150balbes/Jetson-Nano'
+ KERNELBRANCH='branch:4.9.201'
+ EXTRAWIFI="no"
+ BOOT_FDT_FILE="tegra210-p3448-0000-p3449-0000-a02.dtb"
+ ;;
+
+ current)
+ KERNELBRANCH="branch:linux-5.10.y"
+ KERNELPATCHDIR='rockchip64-'$BRANCH
+ ;;
+
+ edge)
+ KERNELBRANCH="branch:linux-5.15.y"
+ KERNELPATCHDIR='rockchip64-'$BRANCH
+ ;;
+
+esac
+
+write_uboot_platform() {
+ dd if=$1/u-boot.bin of=$2 bs=32k seek=1 status=noxfer > /dev/null 2>&1
+}
+
+family_tweaks() {
+
+ case $BRANCH in
+
+ legacy)
+
+ install -m 755 $SRC/packages/blobs/jetson/tegra21x_xusb_firmware $SDCARD/lib/firmware/tegra21x_xusb_firmware
+ install -m 755 $SRC/packages/blobs/jetson/asound.conf.tegrahda $SDCARD/etc/asound.conf.tegrahda
+ install -m 755 $SRC/packages/blobs/jetson/asound.conf.tegrahda $SDCARD/etc/asound.conf
+ install -m 755 $SRC/packages/blobs/jetson/asound.conf.tegrasndt210ref $SDCARD/etc/asound.conf.tegrasndt210ref
+ install -m 755 $SRC/packages/blobs/jetson/tegra-hda.conf $SDCARD/usr/share/alsa/cards/tegra-hda.conf
+ install -m 755 $SRC/packages/blobs/jetson/tegra-snd-t210r.conf $SDCARD/usr/share/alsa/cards/tegra-snd-t210r.conf
+
+ sed -e 's/exit 0//g' -i $SDCARD/etc/rc.local
+ echo "su -c 'echo 255 > /sys/devices/pwm-fan/target_pwm'" >> $SDCARD/etc/rc.local
+ echo "exit 0" >> $SDCARD/etc/rc.local
+
+ ;;
+
+ edge)
+
+ cp -R $SRC/packages/blobs/jetson/firmware/* $SDCARD/lib/firmware/
+
+ ;;
+ esac
+
+}
diff --git a/extensions/flash-kernel.sh b/extensions/flash-kernel.sh
index 0390a3b37..847eb37b7 100644
--- a/extensions/flash-kernel.sh
+++ b/extensions/flash-kernel.sh
@@ -84,7 +84,7 @@ function pre_update_initramfs__setup_flash_kernel() {
local update_initramfs_cmd="update-initramfs -c -k all"
display_alert "Updating flash-kernel initramfs..." "$update_initramfs_cmd" ""
- chroot_custom "$chroot_target" "$update_initramfs_cmd" || {
+ chroot_custom "$chroot_target" "$update_initramfs_cmd" || {
display_alert "Failed to run '$update_initramfs_cmd'" "Check logs" "err"
exit 29
}
@@ -97,7 +97,7 @@ function pre_update_initramfs__setup_flash_kernel() {
local flash_kernel_cmd="flash-kernel --machine '${FK__MACHINE_MODEL}'"
display_alert "flash-kernel" "${FK__MACHINE_MODEL}" "info"
- chroot_custom "$chroot_target" "${flash_kernel_cmd}" || {
+ chroot_custom "$chroot_target" "${flash_kernel_cmd}" || {
display_alert "Failed to run '${flash_kernel_cmd}'" "Check logs" "err"
exit 29
}
diff --git a/lib/functions/configuration/menu.sh b/lib/functions/configuration/menu.sh
index 6d6f0b266..2d4ac1462 100644
--- a/lib/functions/configuration/menu.sh
+++ b/lib/functions/configuration/menu.sh
@@ -57,7 +57,6 @@ show_developer_warning() {
SHOW_WARNING=no
}
-
# Stuff that was in config files
function distro_menu() {
# create a select menu for choosing a distribution based EXPERT status
@@ -84,4 +83,3 @@ function distros_options() {
distro_menu "${distrib_dir}"
done
}
-
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index 285f7e84e..3a3953118 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -195,5 +195,4 @@ source "${SRC}"/lib/functions/extras/fel.sh
# shellcheck source=functions/extras/buildpkg.sh
source "${SRC}"/lib/functions/extras/buildpkg.sh
-
# This file is/was autogenerated by lib/tools/gen-library.sh; don't modify manually - thanks
From ce5bebdb917d1e3c88e36899c268207779716965 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 7 Jan 2022 23:28:12 +0100
Subject: [PATCH] logging: manual merge of all lib/*.sh changes between
revisions f6143eff670d435cc8d15b52335b1b70ccb91e1c and
f3388b9aee0d1564a28fbc661c6e7b0415a6dfd0
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
lib/functions/bsp/bsp-cli.sh | 34 ++--
lib/functions/compilation/extra-drivers.sh | 8 +-
lib/functions/extras/buildpkg.sh | 173 +++++++++++++++-----
lib/functions/general/git.sh | 4 +-
lib/functions/general/host.sh | 251 ++++++++++++++++++-----------
lib/functions/main/default-build.sh | 2 +-
lib/functions/rootfs/distro_agnostic.sh | 5 +-
7 files changed, 316 insertions(+), 161 deletions(-)
diff --git a/lib/functions/bsp/bsp-cli.sh b/lib/functions/bsp/bsp-cli.sh
index 67baede0d..d4bb3daab 100644
--- a/lib/functions/bsp/bsp-cli.sh
+++ b/lib/functions/bsp/bsp-cli.sh
@@ -6,7 +6,7 @@ create_board_package() {
# @TODO: these traps are a real trap.
#trap "rm -rf \"${bsptempdir}\" ; exit 0" 0 1 2 3 15
- local destination=${bsptempdir}/${RELEASE}/${BSP_CLI_PACKAGE_FULLNAME}
+ local destination=${bsptempdir}/${BSP_CLI_PACKAGE_FULLNAME}
mkdir -p "${destination}"/DEBIAN
cd $destination
@@ -59,7 +59,7 @@ create_board_package() {
Replaces: zram-config, base-files, armbian-tools-$RELEASE, linux-${RELEASE}-root-legacy-$BOARD (<< $REVISION~), linux-${RELEASE}-root-current-$BOARD (<< $REVISION~), linux-${RELEASE}-root-edge-$BOARD (<< $REVISION~)
Breaks: linux-${RELEASE}-root-legacy-$BOARD (<< $REVISION~), linux-${RELEASE}-root-current-$BOARD (<< $REVISION~), linux-${RELEASE}-root-edge-$BOARD (<< $REVISION~)
Recommends: bsdutils, parted, util-linux, toilet
- Description: Tweaks for Armbian $RELEASE on $BOARD
+ Description: Armbian board support files for $BOARD
EOF
# set up pre install script
@@ -229,10 +229,15 @@ create_board_package() {
mv /usr/lib/chromium-browser/master_preferences.dpkg-dist /usr/lib/chromium-browser/master_preferences
fi
- sed -i "s/^PRETTY_NAME=.*/PRETTY_NAME=\"${VENDOR} $REVISION "${RELEASE^}"\"/" /etc/os-release
- echo "${VENDOR} ${REVISION} ${RELEASE^} \\l \n" > /etc/issue
- echo "${VENDOR} ${REVISION} ${RELEASE^}" > /etc/issue.net
+ # Read release value
+ if [ -f /etc/lsb-release ]; then
+ RELEASE=\$(cat /etc/lsb-release | grep CODENAME | cut -d"=" -f2 | sed 's/.*/\u&/')
+ sed -i "s/^PRETTY_NAME=.*/PRETTY_NAME=\"${VENDOR} $REVISION "\${RELEASE}"\"/" /etc/os-release
+ echo "${VENDOR} ${REVISION} \${RELEASE} \\l \n" > /etc/issue
+ echo "${VENDOR} ${REVISION} \${RELEASE}" > /etc/issue.net
+ fi
+ # Reload services
systemctl --no-reload enable armbian-hardware-monitor.service armbian-hardware-optimize.service armbian-zram-config.service >/dev/null 2>&1
exit 0
EOF
@@ -253,8 +258,11 @@ create_board_package() {
activate update-initramfs
EOF
- # read distribution support status
- set_distribution_status
+ # copy distribution support status
+ local releases=($(find ${SRC}/config/distributions -mindepth 1 -maxdepth 1 -type d))
+ for i in ${releases[@]}; do
+ echo "$(echo $i | sed 's/.*\///')=$(cat $i/support)" >> "${destination}"/etc/armbian-distribution-status
+ done
# armhwinfo, firstrun, armbianmonitor, etc. config file
cat <<- EOF > "${destination}"/etc/armbian-release
@@ -264,8 +272,6 @@ create_board_package() {
BOARDFAMILY=${BOARDFAMILY}
BUILD_REPOSITORY_URL=${BUILD_REPOSITORY_URL}
BUILD_REPOSITORY_COMMIT=${BUILD_REPOSITORY_COMMIT}
- DISTRIBUTION_CODENAME=${RELEASE}
- DISTRIBUTION_STATUS=${DISTRIBUTION_STATUS}
VERSION=$REVISION
LINUXFAMILY=$LINUXFAMILY
ARCH=$ARCHITECTURE
@@ -275,12 +281,6 @@ create_board_package() {
KERNEL_IMAGE_TYPE=$KERNEL_IMAGE_TYPE
EOF
- if [[ $BUILD_DESKTOP == yes ]]; then
- cat <<- EOF >> "${destination}"/etc/armbian-release
- DESKTOP=$DESKTOP_ENVIRONMENT
- EOF
- fi
-
# this is required for NFS boot to prevent deconfiguring the network on shutdown
sed -i 's/#no-auto-down/no-auto-down/g' "${destination}"/etc/network/interfaces.default
@@ -301,8 +301,8 @@ POST_FAMILY_TWEAKS_BSP
# create board DEB file
fakeroot_dpkg_deb_build "${destination}" "${destination}.deb"
- mkdir -p "${DEB_STORAGE}/${RELEASE}/"
- rsync --remove-source-files -rq "${destination}.deb" "${DEB_STORAGE}/${RELEASE}/" 2>&1
+ mkdir -p "${DEB_STORAGE}/"
+ rsync --remove-source-files -rq "${destination}.deb" "${DEB_STORAGE}/" 2>&1
# cleanup
rm -rf ${bsptempdir}
diff --git a/lib/functions/compilation/extra-drivers.sh b/lib/functions/compilation/extra-drivers.sh
index 69e287d81..d45913f32 100644
--- a/lib/functions/compilation/extra-drivers.sh
+++ b/lib/functions/compilation/extra-drivers.sh
@@ -49,12 +49,18 @@ prepare_extra_kernel_drivers() {
fi
if [[ "${version}" == "4.19."* ]] && [[ "$LINUXFAMILY" == sunxi* || "$LINUXFAMILY" == meson64 ||
- "$LINUXFAMILY" == mvebu64 || "$LINUXFAMILY" == mt7623 || "$LINUXFAMILY" == mvebu || "$LINUXFAMILY" == rk35xx ]]; then
+ "$LINUXFAMILY" == mvebu64 || "$LINUXFAMILY" == mt7623 || "$LINUXFAMILY" == mvebu ]]; then
display_alert "Adjusting" "packaging" "info"
cd "$kerneldir" || exit
process_patch_file "${SRC}/patch/misc/general-packaging-4.19.y.patch" "applying"
fi
+ if [[ "${version}" == "4.19."* ]] && [[ "$LINUXFAMILY" == rk35xx ]]; then
+ display_alert "Adjusting" "packaging" "info"
+ cd "$kerneldir" || exit
+ process_patch_file "${SRC}/patch/misc/general-packaging-4.19.y-rk35xx.patch" "applying"
+ fi
+
if [[ "${version}" == "4.14."* ]] && [[ "$LINUXFAMILY" == s5p6818 || "$LINUXFAMILY" == mvebu64 ||
"$LINUXFAMILY" == imx7d || "$LINUXFAMILY" == odroidxu4 || "$LINUXFAMILY" == mvebu ]]; then
display_alert "Adjusting" "packaging" "info"
diff --git a/lib/functions/extras/buildpkg.sh b/lib/functions/extras/buildpkg.sh
index 2e97d652b..af92f1b84 100644
--- a/lib/functions/extras/buildpkg.sh
+++ b/lib/functions/extras/buildpkg.sh
@@ -9,9 +9,17 @@
# This file is a part of the Armbian build script
# https://github.com/armbian/build/
-# create_chroot_for_buildpkg <target_dir> <release> <arch>
+# Functions:
+
+# create_chroot
+# chroot_prepare_distccd
+# chroot_build_packages
+# chroot_installpackages_local
+# chroot_installpackages
+
+# create_chroot <target_dir> <release> <arch>
#
-create_chroot_for_buildpkg() {
+create_chroot() {
local target_dir="$1"
local release=$2
local arch=$3
@@ -34,18 +42,33 @@ create_chroot_for_buildpkg() {
components['impish']='main,universe,multiverse'
components['jammy']='main,universe,multiverse'
display_alert "Creating build chroot" "$release/$arch" "info"
- local includes="ccache,locales,git,ca-certificates,devscripts,libfile-fcntllock-perl,debhelper,rsync,python3,distcc"
+ local includes="ccache,locales,git,ca-certificates,devscripts,libfile-fcntllock-perl,debhelper,rsync,python3,distcc,apt-utils"
+
# perhaps a temporally workaround
- [[ $release == buster || $release == bullseye || $release == focal || $release == hirsute || $release == sid ]] && includes=${includes}",perl-openssl-defaults,libnet-ssleay-perl"
+ case $release in
+ buster | bullseye | focal | hirsute | sid)
+ includes=${includes}",perl-openssl-defaults,libnet-ssleay-perl"
+ ;;
+ esac
+
if [[ $NO_APT_CACHER != yes ]]; then
local mirror_addr="http://localhost:3142/${apt_mirror[${release}]}"
else
local mirror_addr="http://${apt_mirror[${release}]}"
fi
+
mkdir -p "${target_dir}"
cd "${target_dir}"
- debootstrap --variant=buildd --components="${components[${release}]}" --arch="${arch}" $DEBOOTSTRAP_OPTION --foreign --include="${includes}" "${release}" "${target_dir}" "${mirror_addr}"
- [[ $? -ne 0 || ! -f "${target_dir}"/debootstrap/debootstrap ]] && exit_with_error "Create chroot first stage failed"
+
+ debootstrap --variant=buildd \
+ --components="${components[${release}]}" \
+ --arch="${arch}" $DEBOOTSTRAP_OPTION \
+ --foreign \
+ --include="${includes}" "${release}" "${target_dir}" "${mirror_addr}"
+
+ [[ $? -ne 0 || ! -f "${target_dir}"/debootstrap/debootstrap ]] &&
+ exit_with_error "Create chroot first stage failed"
+
cp /usr/bin/${qemu_binary[$arch]} "${target_dir}"/usr/bin/
[[ ! -f "${target_dir}"/usr/share/keyrings/debian-archive-keyring.gpg ]] &&
mkdir -p "${target_dir}"/usr/share/keyrings/ &&
@@ -53,6 +76,7 @@ create_chroot_for_buildpkg() {
chroot "${target_dir}" /bin/bash -c "/debootstrap/debootstrap --second-stage"
[[ $? -ne 0 || ! -f "${target_dir}"/bin/bash ]] && exit_with_error "Create chroot second stage failed"
+
create_sources_list "$release" "${target_dir}"
[[ $NO_APT_CACHER != yes ]] &&
echo 'Acquire::http { Proxy "http://localhost:3142"; };' > "${target_dir}"/etc/apt/apt.conf.d/02proxy
@@ -60,8 +84,10 @@ create_chroot_for_buildpkg() {
APT::Install-Recommends "0";
APT::Install-Suggests "0";
EOF
- [[ -f "${target_dir}"/etc/locale.gen ]] && sed -i "s/^# en_US.UTF-8/en_US.UTF-8/" "${target_dir}"/etc/locale.gen
+ [[ -f "${target_dir}"/etc/locale.gen ]] &&
+ sed -i "s/^# en_US.UTF-8/en_US.UTF-8/" "${target_dir}"/etc/locale.gen
chroot "${target_dir}" /bin/bash -c "locale-gen; update-locale LANG=en_US:en LC_ALL=en_US.UTF-8"
+
printf '#!/bin/sh\nexit 101' > "${target_dir}"/usr/sbin/policy-rc.d
chmod 755 "${target_dir}"/usr/sbin/policy-rc.d
rm "${target_dir}"/etc/resolv.conf 2> /dev/null
@@ -74,7 +100,17 @@ create_chroot_for_buildpkg() {
mkdir -p "${target_dir}"/var/lock
fi
chroot "${target_dir}" /bin/bash -c "/usr/sbin/update-ccache-symlinks"
- [[ $release == bullseye || $release == focal || $release == hirsute || $release == sid ]] && chroot "${target_dir}" /bin/bash -c "ln -s /usr/bin/python3 /usr/bin/python"
+
+ display_alert "Upgrading packages in" "${target_dir}" "info"
+ chroot "${target_dir}" /bin/bash -c "apt-get -q update; apt-get -q -y upgrade; apt-get clean"
+ date +%s > "$target_dir/root/.update-timestamp"
+
+ case $release in
+ bullseye | focal | hirsute | sid)
+ chroot "${target_dir}" /bin/bash -c "apt-get install python-is-python3"
+ ;;
+ esac
+
touch "${target_dir}"/root/.debootstrap-complete
display_alert "Debootstrap complete" "${release}/${arch}" "info"
} #############################################################################
@@ -133,27 +169,63 @@ chroot_build_packages() {
for arch in $target_arch; do
display_alert "Starting package building process" "$release/$arch" "info"
- local target_dir
- target_dir="${SRC}/cache/buildpkg/${release}-${arch}-v${CHROOT_CACHE_VERSION}"
+ local t_name=${release}-${arch}-v${CHROOT_CACHE_VERSION}
local distcc_bindaddr="127.0.0.2"
- [[ ! -f "${target_dir}"/root/.debootstrap-complete ]] && create_chroot_for_buildpkg "${target_dir}" "${release}" "${arch}"
- [[ ! -f "${target_dir}"/root/.debootstrap-complete ]] && exit_with_error "Creating chroot failed" "${release}/${arch}"
+ # Create a clean environment archive if it does not exist.
+ if [ ! -f "${SRC}/cache/buildpkg/${t_name}.tar.xz" ]; then
+ local tmp_dir=$(mktemp -d "${SRC}"/.tmp/debootstrap-XXXXX)
+ create_chroot "${tmp_dir}/${t_name}" "${release}" "${arch}"
+ display_alert "Create a clean Environment archive" "${t_name}.tar.xz" "info"
+ (
+ tar -cp --directory="${tmp_dir}/" ${t_name} |
+ pv -p -b -r -s "$(du -sb "${tmp_dir}/${t_name}" | cut -f1)" |
+ pixz -4 > "${SRC}/cache/buildpkg/${t_name}.tar.xz"
+ )
+ rm -rf $tmp_dir
+ fi
- [[ -f /var/run/distcc/"${release}-${arch}".pid ]] && kill "$(< "/var/run/distcc/${release}-${arch}.pid")" > /dev/null 2>&1
+ # Unpack the clean environment archive, if it exists.
+ if [ -f "${SRC}/cache/buildpkg/${t_name}.tar.xz" ]; then
+ local tmp_dir=$(mktemp -d "${SRC}"/.tmp/build-XXXXX)
+ (
+ cd $tmp_dir
+ display_alert "Unpack the clean environment" "${t_name}.tar.xz" "info"
+ tar -xJf "${SRC}/cache/buildpkg/${t_name}.tar.xz" ||
+ exit_with_error "Is not extracted" "${SRC}/cache/buildpkg/${t_name}.tar.xz"
+ )
+ target_dir="$tmp_dir/${t_name}"
+ else
+ exit_with_error "Creating chroot failed" "${release}/${arch}"
+ fi
+
+ [[ -f /var/run/distcc/"${release}-${arch}".pid ]] &&
+ kill "$(< "/var/run/distcc/${release}-${arch}.pid")" > /dev/null 2>&1
chroot_prepare_distccd "${release}" "${arch}"
# DISTCC_TCP_DEFER_ACCEPT=0
- DISTCC_CMDLIST=/tmp/distcc/${release}-${arch}/cmdlist TMPDIR=/tmp/distcc distccd --daemon \
- --pid-file "/var/run/distcc/${release}-${arch}.pid" --listen $distcc_bindaddr --allow 127.0.0.0/24 \
+ DISTCC_CMDLIST=/tmp/distcc/${release}-${arch}/cmdlist \
+ TMPDIR=/tmp/distcc distccd --daemon \
+ --pid-file "/var/run/distcc/${release}-${arch}.pid" \
+ --listen $distcc_bindaddr --allow 127.0.0.0/24 \
--log-file "/tmp/distcc/${release}-${arch}.log" --user distccd
+ [[ -d $target_dir ]] ||
+ exit_with_error "Clean Environment is not visible" "$target_dir"
+
local t=$target_dir/root/.update-timestamp
if [[ ! -f ${t} || $((($(date +%s) - $(< "${t}")) / 86400)) -gt 7 ]]; then
display_alert "Upgrading packages" "$release/$arch" "info"
systemd-nspawn -a -q -D "${target_dir}" /bin/bash -c "apt-get -q update; apt-get -q -y upgrade; apt-get clean"
date +%s > "${t}"
+ display_alert "Repack a clean Environment archive after upgrading" "${t_name}.tar.xz" "info"
+ rm "${SRC}/cache/buildpkg/${t_name}.tar.xz"
+ (
+ tar -cp --directory="${tmp_dir}/" ${t_name} |
+ pv -p -b -r -s "$(du -sb "${tmp_dir}/${t_name}" | cut -f1)" |
+ pixz -4 > "${SRC}/cache/buildpkg/${t_name}.tar.xz"
+ )
fi
for plugin in "${SRC}"/packages/extras-buildpkgs/*.conf; do
@@ -186,12 +258,30 @@ chroot_build_packages() {
display_alert "Packages are up to date" "$package_name $release/$arch" "info"
continue
fi
+
+ # Delete the environment if there was a build in it.
+ # And unpack the clean environment again.
+ if [[ -f "${target_dir}"/root/build.sh ]] && [[ -d $tmp_dir ]]; then
+ rm -rf $tmp_dir
+ local tmp_dir=$(mktemp -d "${SRC}"/.tmp/build-XXXXX)
+ (
+ cd $tmp_dir
+ display_alert "Unpack the clean environment" "${t_name}.tar.xz" "info"
+ tar -xJf "${SRC}/cache/buildpkg/${t_name}.tar.xz" ||
+ exit_with_error "Is not extracted" "${SRC}/cache/buildpkg/${t_name}.tar.xz"
+ )
+ target_dir="$tmp_dir/${t_name}"
+ fi
+
display_alert "Building packages" "$package_name $release/$arch" "ext"
+ ts=$(date +%s)
local dist_builddeps_name="package_builddeps_${release}"
[[ -v $dist_builddeps_name ]] && package_builddeps="${package_builddeps} ${!dist_builddeps_name}"
# create build script
+ LOG_OUTPUT_FILE=/root/build-"${package_name}".log
create_build_script
+ unset LOG_OUTPUT_FILE
fetch_from_repo "$package_repo" "extra/$package_name" "$package_ref"
@@ -209,26 +299,31 @@ chroot_build_packages() {
built_ok+=("$package_name:$release/$arch")
fi
mv "${target_dir}"/root/*.deb "${plugin_target_dir}" 2> /dev/null
+ mv "${target_dir}"/root/*.log "$DEST/${LOG_SUBPATH}/"
+ te=$(date +%s)
+ display_alert "Build time $package_name " " $(($te - $ts)) sec." "info"
done
+ # Delete a temporary directory
+ if [ -d $tmp_dir ]; then rm -rf $tmp_dir; fi
# cleanup for distcc
kill $(< /var/run/distcc/${release}-${arch}.pid)
done
done
if [[ ${#built_ok[@]} -gt 0 ]]; then
display_alert "Following packages were built without errors" "" "info"
- for p in "${built_ok[@]}"; do
+ for p in ${built_ok[@]}; do
display_alert "$p"
done
fi
if [[ ${#failed[@]} -gt 0 ]]; then
display_alert "Following packages failed to build" "" "wrn"
- for p in "${failed[@]}"; do
+ for p in ${failed[@]}; do
display_alert "$p"
done
fi
} #############################################################################
-# create build script # @TODO: what is this?
+# create build script
create_build_script() {
cat <<- EOF > "${target_dir}"/root/build.sh
#!/bin/bash
@@ -248,32 +343,10 @@ create_build_script() {
export DEBEMAIL="$MAINTAINERMAIL"
$(declare -f display_alert)
- cd /root/build
- if [[ -n "${package_builddeps}" ]]; then
- # can be replaced with mk-build-deps
- deps=()
- installed=\$(
- dpkg-query -W -f '\${db:Status-Abbrev}|\${binary:Package}\n' '*' 2>/dev/null | \
- grep '^ii' | \
- awk -F '|' '{print \$2}' | \
- cut -d ':' -f 1
- )
-
- for packet in $package_builddeps
- do
- grep -q -x -e "\$packet" <<< "\$installed" || deps+=("\$packet")
- done
-
- if [[ \${#deps[@]} -gt 0 ]]; then
- display_alert "Installing build dependencies"
- apt-get -y -q update
- apt-get -y -q \
- --no-install-recommends \
- --show-progress \
- -o DPKG::Progress-Fancy=1 install "\${deps[@]}"
- fi
- fi
+ LOG_OUTPUT_FILE=$LOG_OUTPUT_FILE
+ $(declare -f install_pkg_deb)
+ cd /root/build
display_alert "Copying sources"
rsync -aq /root/sources/"${package_name}" /root/build/
@@ -281,6 +354,16 @@ create_build_script() {
# copy overlay / "debianization" files
[[ -d "/root/overlay/${package_name}/" ]] && rsync -aq /root/overlay/"${package_name}" /root/build/
+ package_builddeps="$package_builddeps"
+ if [ -z "\$package_builddeps" ]; then
+ # Calculate build dependencies by a standard function and
+ # еxclude special comparison characters like "|" "(>= 9)"
+ package_builddeps="\$(dpkg-checkbuilddeps |& awk -F":" '{gsub(/[|]|[(].*[)]/, " ", \$0); print \$NF}')"
+ fi
+ if [[ -n "\${package_builddeps}" ]]; then
+ install_pkg_deb \${package_builddeps}
+ fi
+
# set upstream version
[[ -n "${package_upstream_version}" ]] && debchange --preserve --newversion "${package_upstream_version}" "Import from upstream"
@@ -289,7 +372,9 @@ create_build_script() {
debchange -l~armbian"${REVISION}"+ "Custom $VENDOR release"
display_alert "Building package"
- dpkg-buildpackage -b -us -j2
+ # Set the number of build threads and certainly send
+ # the standard error stream to the log file.
+ dpkg-buildpackage -b -us -j${NCPU_CHROOT:-2} 2>>\$LOG_OUTPUT_FILE
if [[ \$? -eq 0 ]]; then
cd /root/build
diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh
index 2b70de167..9fb0dfcf3 100644
--- a/lib/functions/general/git.sh
+++ b/lib/functions/general/git.sh
@@ -339,8 +339,8 @@ fetch_from_repo() {
fingerprint_image() {
cat <<- EOF > "${1}"
--------------------------------------------------------------------------------
- Title: ${VENDOR} $REVISION ${BOARD^} $DISTRIBUTION $RELEASE $BRANCH
- Kernel: Linux $VER
+ Title: ${VENDOR} $REVISION ${BOARD^} $BRANCH
+ Kernel: Linux $VER
Build date: $(date +'%d.%m.%Y')
Maintainer: $MAINTAINER <$MAINTAINERMAIL>
Authors: https://www.armbian.com/authors
diff --git a/lib/functions/general/host.sh b/lib/functions/general/host.sh
index 5156c4ed8..ef681d301 100644
--- a/lib/functions/general/host.sh
+++ b/lib/functions/general/host.sh
@@ -43,17 +43,6 @@ prepare_host() {
else
local offline=false
fi
- # build aarch64
- if [[ $(dpkg --print-architecture) != arm64 ]]; then
-
- if [[ $(dpkg --print-architecture) != amd64 ]]; then
- display_alert "Please read documentation to set up proper compilation environment"
- display_alert "https://www.armbian.com/using-armbian-tools/"
- exit_with_error "Running this tool on non x86_64 build host is not supported"
- fi
-
- # build aarch64
- fi
# wait until package manager finishes possible system maintanace
wait_for_package_manager
@@ -69,35 +58,38 @@ prepare_host() {
# packages list for host
# NOTE: please sync any changes here with the Dockerfile and Vagrantfile
- # build aarch64
+ local hostdeps="acl aptly aria2 bc binfmt-support bison btrfs-progs \
+ build-essential ca-certificates ccache cpio cryptsetup curl \
+ debian-archive-keyring debian-keyring debootstrap device-tree-compiler \
+ dialog dirmngr dosfstools dwarves f2fs-tools fakeroot flex gawk \
+ gcc-arm-linux-gnueabihf gdisk gnupg1 gpg imagemagick jq kmod libbison-dev \
+ libc6-dev-armhf-cross libelf-dev libfdt-dev libfile-fcntllock-perl \
+ libfl-dev liblz4-tool libncurses-dev libpython2.7-dev libssl-dev \
+ libusb-1.0-0-dev linux-base locales lzop ncurses-base ncurses-term \
+ nfs-kernel-server ntpdate p7zip-full parted patchutils pigz pixz \
+ pkg-config pv python3-dev python3-distutils qemu-user-static rsync swig \
+ systemd-container u-boot-tools udev unzip uuid-dev wget whiptail zip \
+ zlib1g-dev"
+
if [[ $(dpkg --print-architecture) == amd64 ]]; then
- local hostdeps="wget ca-certificates device-tree-compiler pv bc lzop zip binfmt-support build-essential ccache debootstrap ntpdate \
- gawk gcc-arm-linux-gnueabihf qemu-user-static u-boot-tools uuid-dev zlib1g-dev unzip libusb-1.0-0-dev fakeroot \
- parted pkg-config libncurses5-dev whiptail debian-keyring debian-archive-keyring f2fs-tools libfile-fcntllock-perl rsync libssl-dev \
- nfs-kernel-server btrfs-progs ncurses-term p7zip-full kmod dosfstools libc6-dev-armhf-cross imagemagick \
- curl patchutils liblz4-tool libpython2.7-dev linux-base swig aptly acl python3-dev python3-distutils \
- locales ncurses-base pixz dialog systemd-container udev libfdt-dev libelf-dev lib32stdc++6 libc6-i386 lib32ncurses5 lib32tinfo5 \
- bison libbison-dev flex libfl-dev cryptsetup gpg gnupg cpio aria2 pigz dirmngr python3-distutils jq distcc gdisk dwarves"
+ hostdeps+=" distcc lib32ncurses-dev lib32stdc++6 libc6-i386 zlib1g:i386"
+ grep -q i386 <(dpkg --print-foreign-architectures) || dpkg --add-architecture i386
+
+ elif [[ $(dpkg --print-architecture) == arm64 ]]; then
+
+ hostdeps+=" gcc-arm-linux-gnueabi gcc-arm-none-eabi libc6 libc6-amd64-cross qemu"
- # build aarch64
else
- local hostdeps="wget ca-certificates device-tree-compiler pv bc lzop zip binfmt-support build-essential ccache debootstrap ntpdate \
- gawk gcc-arm-linux-gnueabihf gcc-arm-linux-gnueabi gcc-arm-none-eabi \
- qemu-user-static u-boot-tools uuid-dev zlib1g-dev unzip libusb-1.0-0-dev fakeroot \
- parted pkg-config libncurses5-dev whiptail debian-keyring debian-archive-keyring f2fs-tools libfile-fcntllock-perl rsync libssl-dev \
- nfs-kernel-server btrfs-progs ncurses-term p7zip-full kmod dosfstools libc6-amd64-cross libc6-dev-armhf-cross imagemagick \
- curl patchutils liblz4-tool libpython2.7-dev linux-base swig aptly acl python3-dev \
- locales ncurses-base pixz dialog systemd-container udev libfdt-dev libelf-dev libc6 qemu \
- bison libbison-dev flex libfl-dev cryptsetup gpg gnupg cpio aria2 pigz \
- dirmngr python3-distutils jq gdisk dwarves"
+ display_alert "Please read documentation to set up proper compilation environment"
+ display_alert "https://www.armbian.com/using-armbian-tools/"
+ exit_with_error "Running this tool on non x86_64 build host is not supported"
- # build aarch64
fi
# Add support for Ubuntu 20.04, 21.04 and Mint 20.x
- if [[ $HOSTRELEASE =~ ^(focal|impish|hirsute|jammy|ulyana|ulyssa|bullseye|uma)$ ]]; then
+ if [[ $HOSTRELEASE =~ ^(focal|impish|hirsute|ulyana|ulyssa|bullseye|uma)$ ]]; then
hostdeps+=" python2 python3"
ln -fs /usr/bin/python2.7 /usr/bin/python2
ln -fs /usr/bin/python2.7 /usr/bin/python
@@ -112,7 +104,7 @@ prepare_host() {
#
# NO_HOST_RELEASE_CHECK overrides the check for a supported host system
# Disable host OS check at your own risk. Any issues reported with unsupported releases will be closed without discussion
- if [[ -z $HOSTRELEASE || "buster bullseye focal impish hirsute jammy debbie tricia ulyana ulyssa uma" != *"$HOSTRELEASE"* ]]; then
+ if [[ -z $HOSTRELEASE || "buster bullseye focal impish hirsute debbie tricia ulyana ulyssa uma" != *"$HOSTRELEASE"* ]]; then
if [[ $NO_HOST_RELEASE_CHECK == yes ]]; then
display_alert "You are running on an unsupported system" "${HOSTRELEASE:-(unknown)}" "wrn"
display_alert "Do not report any errors, warnings or other issues encountered beyond this point" "" "wrn"
@@ -129,17 +121,6 @@ prepare_host() {
fi
fi
- # build aarch64
- if [[ $(dpkg --print-architecture) == amd64 ]]; then
-
- if [[ -z $HOSTRELEASE || $HOSTRELEASE =~ ^(focal|debbie|buster|bullseye|impish|hirsute|ulyana|ulyssa|uma)$ ]]; then
- hostdeps="${hostdeps/lib32ncurses5 lib32tinfo5/lib32ncurses6 lib32tinfo6}"
- fi
-
- grep -q i386 <(dpkg --print-foreign-architectures) || dpkg --add-architecture i386
- # build aarch64
- fi
-
if systemd-detect-virt -q -c; then
display_alert "Running in container" "$(systemd-detect-virt)" "info"
# disable apt-cacher unless NO_APT_CACHER=no is not specified explicitly
@@ -159,12 +140,10 @@ prepare_host() {
# Skip verification if you are working offline
if ! $offline; then
- # warning: apt-cacher-ng will fail if installed and used both on host and in container/chroot environment with shared network
+ # warning: apt-cacher-ng will fail if installed and used both on host and in
+ # container/chroot environment with shared network
# set NO_APT_CACHER=yes to prevent installation errors in such case
- if [[ $NO_APT_CACHER != yes ]]; then hostdeps="$hostdeps apt-cacher-ng"; fi
-
- local deps=()
- local installed=$(dpkg-query -W -f '${db:Status-Abbrev}|${binary:Package}\n' '*' 2> /dev/null | grep '^ii' | awk -F '|' '{print $2}' | cut -d ':' -f 1)
+ if [[ $NO_APT_CACHER != yes ]]; then hostdeps+=" apt-cacher-ng"; fi
export EXTRA_BUILD_DEPS=""
call_extension_method "add_host_dependencies" <<- 'ADD_HOST_DEPENDENCIES'
@@ -172,9 +151,7 @@ prepare_host() {
you can add packages to install, space separated, to ${EXTRA_BUILD_DEPS} here.
ADD_HOST_DEPENDENCIES
- for packet in $hostdeps ${EXTRA_BUILD_DEPS}; do
- if ! grep -q -x -e "$packet" <<< "$installed"; then deps+=("$packet"); fi
- done
+ if [ -n "${EXTRA_BUILD_DEPS}" ]; then hostdeps+=" ${EXTRA_BUILD_DEPS}"; fi
# distribution packages are buggy, download from author
@@ -196,18 +173,15 @@ prepare_host() {
# build aarch64
fi
- if [[ ${#deps[@]} -gt 0 ]]; then
- display_alert "Installing build dependencies"
- # don't prompt for apt cacher selection
- sudo echo "apt-cacher-ng apt-cacher-ng/tunnelenable boolean false" | sudo debconf-set-selections
- display_alert "Updating apt host-side" "apt update" "info"
- apt-get -q update 2>&1
- display_alert "Upgrading apt host-side" "apt upgrade" "info"
- apt-get -y upgrade 2>&1
- display_alert "Installing host-side dependency packages" "apt upgrade" "info"
- apt-get -q -y --no-install-recommends install -o Dpkg::Options::='--force-confold' "${deps[@]}" 2>&1
- update-ccache-symlinks
- fi
+ display_alert "Installing build dependencies"
+ # don't prompt for apt cacher selection
+ sudo echo "apt-cacher-ng apt-cacher-ng/tunnelenable boolean false" | sudo debconf-set-selections
+
+ LOG_OUTPUT_FILE="${DEST}"/${LOG_SUBPATH}/hostdeps.log
+ install_pkg_deb "upgrade $hostdeps"
+ unset LOG_OUTPUT_FILE
+
+ update-ccache-symlinks
export FINAL_HOST_DEPS="$hostdeps ${EXTRA_BUILD_DEPS}"
call_extension_method "host_dependencies_ready" <<- 'HOST_DEPENDENCIES_READY'
@@ -223,16 +197,6 @@ prepare_host() {
ntpdate -s "${NTP_SERVER:-pool.ntp.org}"
fi
- # build aarch64
- if [[ $(dpkg --print-architecture) == amd64 ]]; then
-
- if [[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' 'zlib1g:i386' 2> /dev/null) != *ii* ]]; then
- apt-get install -qq -y --no-install-recommends zlib1g:i386 > /dev/null 2>&1
- fi
-
- # build aarch64
- fi
-
# create directory structure
mkdir -p "${SRC}"/{cache,output} "${USERPATCHES_PATH}"
if [[ -n $SUDO_USER ]]; then
@@ -243,20 +207,11 @@ prepare_host() {
find "${SRC}"/output "${USERPATCHES_PATH}" -type d ! -group sudo -exec chgrp --quiet sudo {} \;
find "${SRC}"/output "${USERPATCHES_PATH}" -type d ! -perm -g+w,g+s -exec chmod --quiet g+w,g+s {} \;
fi
- # @TODO: rpardini: _very_ important spot, this is where ".tmp" is created. A _huge_ opportunity for tmpfs here.
- display_alert "Creating directory structure: .tmp" "${SRC}/.tmp" "debug"
- display_alert "Creating directory structure: DEST" "${DEST}" "debug"
- mkdir -p "${DEST}"/debs-beta/extra "${DEST}"/debs/extra "${DEST}"/{config,debug,patch} \
- "${USERPATCHES_PATH}"/overlay "${SRC}"/cache/{sources,hash,hash-beta,toolchain,utility,rootfs} \
- "${SRC}"/.tmp "${WORKDIR}"
-
- display_alert "Setting TMPDIR" "${WORKDIR}" "debug"
- export TMPDIR="${WORKDIR}"
+ mkdir -p "${DEST}"/debs-beta/extra "${DEST}"/debs/extra "${DEST}"/{config,debug,patch} "${USERPATCHES_PATH}"/overlay "${SRC}"/cache/{sources,hash,hash-beta,toolchain,utility,rootfs} "${SRC}"/.tmp
# build aarch64
if [[ $(dpkg --print-architecture) == amd64 ]]; then
if [[ "${SKIP_EXTERNAL_TOOLCHAINS}" != "yes" ]]; then
- display_alert "Warning! SKIP_EXTERNAL_TOOLCHAINS is not yes. This is deprecated, upgrade!" "please set SKIP_EXTERNAL_TOOLCHAINS=yes" "deprecation"
# bind mount toolchain if defined
if [[ -d "${ARMBIAN_CACHE_TOOLCHAIN_PATH}" ]]; then
@@ -301,21 +256,20 @@ prepare_host() {
fi
done
else
- display_alert "Ignoring toolchains" "SKIP_EXTERNAL_TOOLCHAINS=${SKIP_EXTERNAL_TOOLCHAINS}" "info"
- fi
- fi # check offline
-
- # enable arm binary format so that the cross-architecture chroot environment will work
- if [[ $KERNEL_ONLY != yes ]]; then
- modprobe -q binfmt_misc
- mountpoint -q /proc/sys/fs/binfmt_misc/ || mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
- if [[ "$(arch)" != "aarch64" ]]; then
- test -e /proc/sys/fs/binfmt_misc/qemu-arm || update-binfmts --enable qemu-arm
- test -e /proc/sys/fs/binfmt_misc/qemu-aarch64 || update-binfmts --enable qemu-aarch64
+ display_alert "Ignoring toolchains" "SKIP_EXTERNAL_TOOLCHAINS: ${SKIP_EXTERNAL_TOOLCHAINS}" "info"
fi
fi
- # build aarch64
+ fi # check offline
+
+ # enable arm binary format so that the cross-architecture chroot environment will work
+ if [[ $KERNEL_ONLY != yes ]]; then
+ modprobe -q binfmt_misc
+ mountpoint -q /proc/sys/fs/binfmt_misc/ || mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
+ if [[ "$(arch)" != "aarch64" ]]; then
+ test -e /proc/sys/fs/binfmt_misc/qemu-arm || update-binfmts --enable qemu-arm
+ test -e /proc/sys/fs/binfmt_misc/qemu-aarch64 || update-binfmts --enable qemu-aarch64
+ fi
fi
[[ ! -f "${USERPATCHES_PATH}"/customize-image.sh ]] && cp "${SRC}"/config/templates/customize-image.sh.template "${USERPATCHES_PATH}"/customize-image.sh
@@ -373,3 +327,110 @@ function fetch_and_build_host_tools() {
BUILD_HOST_TOOLS
}
+
+# Installing debian packages in the armbian build system.
+# The function accepts three optional parameters:
+# upgrade, clean - the same name for apt
+# verbose - detailed log for the function
+#
+# list="pkg1 pkg2 pkg3 pkgbadname pkg-1.0 | pkg-2.0 pkg5 (>= 9)"
+# install_pkg_deb upgrade verbose $list
+#
+# If the package has a bad name, we will see it in the log file.
+# If there is an LOG_OUTPUT_FILE variable and it has a value as
+# the full real path to the log file, then all the information will be there.
+#
+# The LOG_OUTPUT_FILE variable must be defined in the calling function
+# before calling the install_pkg_deb function and unset after.
+#
+install_pkg_deb() {
+ local list=""
+ local log_file
+ local for_install
+ local need_upgrade=false
+ local need_clean=false
+ local need_verbose=false
+ local _line=${BASH_LINENO[0]}
+ local _function=${FUNCNAME[1]}
+ local _file=$(basename "${BASH_SOURCE[1]}")
+ local tmp_file=$(mktemp /tmp/install_log_XXXXX)
+ export DEBIAN_FRONTEND=noninteractive
+
+ list=$(
+ for p in $*; do
+ case $p in
+ upgrade)
+ need_upgrade=true
+ continue
+ ;;
+ clean)
+ need_clean=true
+ continue
+ ;;
+ verbose)
+ need_verbose=true
+ continue
+ ;;
+ \| | \(* | *\)) continue ;;
+ esac
+ echo " $p"
+ done
+ )
+
+ if [ -d $(dirname $LOG_OUTPUT_FILE) ]; then
+ log_file=${LOG_OUTPUT_FILE}
+ else
+ log_file="${SRC}/output/${LOG_SUBPATH}/install.log"
+ fi
+
+ apt-get -q update
+ if [ "$?" != "0" ]; then echo "apt cannot update" >> $log_file; fi
+ if $need_upgrade; then
+ apt-get -y upgrade
+ if [ "$?" != "0" ]; then echo "apt cannot upgrade" >> $log_file; fi
+ fi
+
+ # If the package is not installed, check the latest
+ # up-to-date version in the apt cache.
+ # Exclude bad package names and send a message to the log.
+ for_install=$(
+ for p in $list; do
+ if $(dpkg-query -W -f '${db:Status-Abbrev}' $p |& awk '/ii/{exit 1}'); then
+ apt-cache show $p -o APT::Cache::AllVersions=no |&
+ awk -v p=$p -v tmp_file=$tmp_file \
+ '/^Package:/{print $2} /^E:/{print "Bad package name: ",p >>tmp_file}'
+ fi
+ done
+ )
+
+ # This information should be logged.
+ if [ -s $tmp_file ]; then
+ echo -e "\nInstalling packages in function: $_function" "[$_file:$_line]" \
+ >> $log_file
+ echo -e "\nIncoming list:" >> $log_file
+ printf "%-30s %-30s %-30s %-30s\n" $list >> $log_file
+ echo "" >> $log_file
+ cat $tmp_file >> $log_file
+ fi
+
+ if [ -n "$for_install" ]; then
+
+ apt-get install -qq -y --no-install-recommends $for_install
+ echo -e "\nPackages installed:" >> $log_file
+ dpkg-query -W \
+ -f '${binary:Package;-27} ${Version;-23}\n' \
+ $for_install >> $log_file
+
+ fi
+
+ # We will show the status after installation all listed
+ if $need_verbose; then
+ echo -e "\nstatus after installation:" >> $log_file
+ dpkg-query -W \
+ -f '${binary:Package;-27} ${Version;-23} [ ${Status} ]\n' \
+ $list >> $log_file
+ fi
+
+ if $need_clean; then apt-get clean; fi
+ rm $tmp_file
+}
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index d85e8650c..5d868a381 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -80,7 +80,7 @@ main_default_build_single() {
overlayfs_wrapper "cleanup"
# create board support package
- if [[ -n "${RELEASE}" && ! -f "${DEB_STORAGE}/$RELEASE/${BSP_CLI_PACKAGE_FULLNAME}.deb" && "${REPOSITORY_INSTALL}" != *armbian-bsp-cli* ]]; then
+ if [[ -n "${RELEASE}" && ! -f "${DEB_STORAGE}/${BSP_CLI_PACKAGE_FULLNAME}.deb" && "${REPOSITORY_INSTALL}" != *armbian-bsp-cli* ]]; then
LOG_SECTION="create_board_package" do_with_logging create_board_package
fi
diff --git a/lib/functions/rootfs/distro_agnostic.sh b/lib/functions/rootfs/distro_agnostic.sh
index a226ce0eb..6249376b7 100644
--- a/lib/functions/rootfs/distro_agnostic.sh
+++ b/lib/functions/rootfs/distro_agnostic.sh
@@ -316,7 +316,7 @@ POST_INSTALL_KERNEL_DEBS
# install board support packages
if [[ "${REPOSITORY_INSTALL}" != *bsp* ]]; then
- install_deb_chroot "${DEB_STORAGE}/$RELEASE/${BSP_CLI_PACKAGE_FULLNAME}.deb"
+ install_deb_chroot "${DEB_STORAGE}/${BSP_CLI_PACKAGE_FULLNAME}.deb"
else
install_deb_chroot "${CHOSEN_ROOTFS}" "remote"
fi
@@ -570,6 +570,9 @@ FAMILY_TWEAKS
# build logo in any case
boot_logo
+ # disable MOTD for first boot - we want as clean 1st run as possible
+ chmod -x "${SDCARD}"/etc/update-motd.d/*
+
return 0 # make sure to exit with success
}
From 9486f6117f1011dbeefd44fdda9e1d9e7f3c7425 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sun, 26 Dec 2021 12:39:03 +0100
Subject: [PATCH] logging: generic do_capturing_defs wrapper; Python parser
- enabled by passing CONFIG_DEFS_ONLY=yes; in this case does not build anything
- [WiP] Python3 info reader / matrix expander
- multithreaded version
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
compile.sh | 2 +-
config/boards/virtual-qemu.wip | 2 +-
lib/functions/cli/cli-entrypoint.sh | 9 +-
lib/functions/configuration/main-config.sh | 32 ++++---
lib/functions/logging/capture.sh | 22 +++++
lib/functions/logging/traps.sh | 4 +
lib/functions/main/config-prepare.sh | 4 +-
lib/functions/main/default-build.sh | 2 +-
lib/library-functions.sh | 4 +
lib/tools/info.py | 140 +++++++++++++++++++++++++++++
10 files changed, 204 insertions(+), 17 deletions(-)
diff --git a/compile.sh b/compile.sh
index d4d07cfe0..27d598bd2 100755
--- a/compile.sh
+++ b/compile.sh
@@ -36,7 +36,7 @@ fi
source "${SRC}"/lib/single.sh
# hook up the error handler early, we wanna see stack for all errors.
-trap 'main_error_monitor "$?" "$(show_caller_full)" "$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}")"; exit 48' ERR EXIT
+trap 'main_error_monitor "$?" "$(show_caller_full)" "$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}")"' ERR EXIT
# And execute the main entrypoint.
cli_entrypoint "$@"
diff --git a/config/boards/virtual-qemu.wip b/config/boards/virtual-qemu.wip
index 0573bfa0b..4d7121221 100644
--- a/config/boards/virtual-qemu.wip
+++ b/config/boards/virtual-qemu.wip
@@ -33,7 +33,7 @@ EXTRAWIFI='no'
ROOTFS_TYPE="ext4"
PACKAGE_LIST_DESKTOP_BOARD="spice-vdagent"
-post_build_image_modify() {
+post_build_image_modify() { # @TODO: rpardini: hmm, wonder why there is a failsafe? function leaking in build-all?
if [[ ${BOARD} == "virtual-qemu" ]]; then
local IMAGE_PATH=${1}
diff --git a/lib/functions/cli/cli-entrypoint.sh b/lib/functions/cli/cli-entrypoint.sh
index d5434ee1d..99adc61a4 100644
--- a/lib/functions/cli/cli-entrypoint.sh
+++ b/lib/functions/cli/cli-entrypoint.sh
@@ -108,7 +108,14 @@ function cli_entrypoint() {
do_main_build_all_ng
else
# configuration etc
- prepare_and_config_main_build_single
+ do_capturing_defs prepare_and_config_main_build_single # this sets CAPTURED_VARS
+
+ if [[ "${CONFIG_DEFS_ONLY}" == "yes" ]]; then
+ echo "${CAPTURED_VARS}" # to stdout!
+ return 0
+ else
+ unset CAPTURED_VARS
+ fi
# Allow for custom user-invoked functions. @TODO: check this with extensions usage?
if [[ -z $1 ]]; then
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 4632fd488..759deaf5d 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -377,7 +377,7 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
# Dependent desktop packages
# Myy : Sources packages from file here
- # Myy : FIXME Rename aggregate_all to aggregate_all_desktop
+ # Myy : FIXME Rename aggregate_all to aggregate_all_desktop # @TODO: rpardini: already done?
if [[ $BUILD_DESKTOP == "yes" ]]; then
PACKAGE_LIST_DESKTOP+="$(one_line aggregate_all_desktop "packages" " ")"
echo -e "\nGroups selected ${DESKTOP_APPGROUPS_SELECTED} -> PACKAGES :" >> "${LOG_OUTPUT_FILE}"
@@ -446,7 +446,7 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
[[ -n $APT_PROXY_ADDR ]] && display_alert "Using custom apt-cacher-ng address" "$APT_PROXY_ADDR" "info"
- # Build final package list after possible override
+ display_alert "Build final package list" "after possible override" "debug"
PACKAGE_LIST="$PACKAGE_LIST $PACKAGE_LIST_RELEASE $PACKAGE_LIST_ADDITIONAL"
PACKAGE_MAIN_LIST="$(cleanup_list PACKAGE_LIST)"
@@ -505,28 +505,38 @@ Packages will still be installed after this is called, so it is the last chance
to confirm or change any packages.
POST_AGGREGATE_PACKAGES
- # debug
- cat <<- EOF >> "${DEST}"/${LOG_SUBPATH}/output.log
+ local build_script_env_file="${DEST}/${LOG_SUBPATH}/output.log"
+ display_alert "Writing build config summary to" "${build_script_env_file}" "debug"
+ # debug
+ local debug_dpkg_arch debug_uname debug_virt debug_src_mount debug_src_perms debug_src_temp_perms
+ debug_dpkg_arch="$(dpkg --print-architecture)"
+ debug_uname="$(uname -a)"
+ debug_virt="$(systemd-detect-virt)"
+ debug_src_mount="$(findmnt -o TARGET,SOURCE,FSTYPE,AVAIL -T "${SRC}")"
+ debug_src_perms="$(getfacl -p "${SRC}")"
+ debug_src_temp_perms="$(getfacl -p "${SRC}"/.tmp 2> /dev/null)"
+
+ cat <<- EOF >> "${build_script_env_file}"
## BUILD SCRIPT ENVIRONMENT
Repository: $REPOSITORY_URL
Version: $REPOSITORY_COMMIT
Host OS: $HOSTRELEASE
- Host arch: $(dpkg --print-architecture)
- Host system: $(uname -a)
- Virtualization type: $(systemd-detect-virt)
+ Host arch: ${debug_dpkg_arch}
+ Host system: ${debug_uname}
+ Virtualization type: ${debug_virt}
## Build script directories
Build directory is located on:
- $(findmnt -o TARGET,SOURCE,FSTYPE,AVAIL -T "${SRC}")
+ ${debug_src_mount}
Build directory permissions:
- $(getfacl -p "${SRC}")
+ ${debug_src_perms}
Temp directory permissions:
- $(getfacl -p "${SRC}"/.tmp 2> /dev/null)
+ ${debug_src_temp_perms}
## BUILD CONFIGURATION
@@ -554,4 +564,6 @@ POST_AGGREGATE_PACKAGES
CPU configuration: $CPUMIN - $CPUMAX with $GOVERNOR
EOF
+
+ display_alert "Done with main-config.sh" "do_main_configuration" "debug"
}
diff --git a/lib/functions/logging/capture.sh b/lib/functions/logging/capture.sh
new file mode 100644
index 000000000..660068c89
--- /dev/null
+++ b/lib/functions/logging/capture.sh
@@ -0,0 +1,22 @@
+function do_capturing_defs() {
+ # make sure to local with a value, otherwise they will appear in the list...
+ local pre_exec_vars="" exit_code=0 post_exec_vars="" new_vars_list="" onevar="" all_vars_array=()
+ pre_exec_vars="$(compgen -A variable | grep -E '[[:upper:]]+' | grep -v -e "^BASH_" | sort)"
+
+ # run parameters passed
+ "$@" || exit_code=$?
+
+ post_exec_vars="$(compgen -A variable | grep -E '[[:upper:]]+' | grep -v -e "^BASH_" | sort)"
+ new_vars_list="$(comm -13 <(echo "$pre_exec_vars") <(echo "${post_exec_vars}"))"
+
+ for onevar in ${new_vars_list}; do
+ # @TODO: rpardini: handle arrays and maps specially?
+ all_vars_array+=("$(declare -p "${onevar}")")
+ done
+ #IFS=$'\n'
+ CAPTURED_VARS="${all_vars_array[*]}"
+ #display_alert "Vars defined during ${*@Q}:" "${CAPTURED_VARS}" "debug"
+ unset all_vars_array post_exec_vars new_vars_list pre_exec_vars onevar join_by
+
+ return ${exit_code}
+}
diff --git a/lib/functions/logging/traps.sh b/lib/functions/logging/traps.sh
index 9a5daa670..47878a0b0 100644
--- a/lib/functions/logging/traps.sh
+++ b/lib/functions/logging/traps.sh
@@ -49,6 +49,10 @@ function main_error_monitor() {
fi
#trap - ERR # remove this trap
local errcode="${1}"
+ # If there's no error, do nothing.
+ if [[ $errcode -eq 0 ]]; then
+ return 0
+ fi
local stack_caller="${2}"
local full_stack_caller="${3}"
display_alert "main_error_monitor: ${errcode}! stack:" "${stack_caller}" "err"
diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh
index 196142608..32be7355d 100644
--- a/lib/functions/main/config-prepare.sh
+++ b/lib/functions/main/config-prepare.sh
@@ -102,8 +102,7 @@ function prepare_and_config_main_build_single() {
source "${SRC}/config/boards/${BOARD}.${BOARD_TYPE}"
LINUXFAMILY="${BOARDFAMILY}"
- # @TODO: interesting. this sourced the board config. What sources the family?
-
+ # @TODO: interesting. this sourced the board config. What sources the family? do_main_configuration!
[[ -z $KERNEL_TARGET ]] && exit_with_error "Board configuration does not define valid kernel config"
@@ -174,7 +173,6 @@ function prepare_and_config_main_build_single() {
export CHOSEN_KSRC=linux-source-${BRANCH}-${LINUXFAMILY}
display_alert "Done with prepare_and_config_main_build_single" "${BOARD}.${BOARD_TYPE}" "info"
-
}
# cli-bsp also uses this
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index e9f3af0ed..d85e8650c 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -18,7 +18,7 @@ main_default_build_single() {
LOG_SECTION="fetch_sources_kernel_uboot_atf" do_with_logging fetch_sources_kernel_uboot_atf
LOG_SECTION="fetch_and_build_host_tools" do_with_logging fetch_and_build_host_tools
- for option in $(tr ',' ' ' <<< "$CLEAN_LEVEL"); do
+ for option in $(tr ',' ' ' <<< "${CLEAN_LEVEL}"); do
if [[ $option != sources ]]; then
LOG_SECTION="cleaning" do_with_logging cleaning "$option"
fi
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index f9bb093a4..285f7e84e 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -167,6 +167,10 @@ source "${SRC}"/lib/functions/compilation/extra-drivers.sh
# shellcheck source=functions/compilation/patching.sh
source "${SRC}"/lib/functions/compilation/patching.sh
+### lib/functions/logging/capture.sh
+# shellcheck source=functions/logging/capture.sh
+source "${SRC}"/lib/functions/logging/capture.sh
+
### lib/functions/logging/runners.sh
# shellcheck source=functions/logging/runners.sh
source "${SRC}"/lib/functions/logging/runners.sh
diff --git a/lib/tools/info.py b/lib/tools/info.py
new file mode 100755
index 000000000..308d482e7
--- /dev/null
+++ b/lib/tools/info.py
@@ -0,0 +1,140 @@
+#!/bin/env python3
+import concurrent.futures
+import glob
+import json
+import os
+import re
+import subprocess
+import sys
+from pathlib import Path
+
+
+def eprint(*args, **kwargs):
+ print(*args, file=sys.stderr, **kwargs)
+
+
+def armbian_value_parse_list(item_value):
+ return item_value.split()
+
+
+def get_all_boards_list_from_armbian(src_path):
+ ret = []
+ for file in glob.glob(src_path + "/config/boards/*.*"):
+ stem = Path(file).stem
+ if stem != "README":
+ ret.append(stem)
+ return ret
+
+
+def armbian_value_parse_newline_map(item_value):
+ lines = item_value.split("\n")
+ ret = []
+ for line in lines:
+ ret.append(line.split(";"))
+ return ret
+
+
+def map_to_armbian_params(map_params):
+ ret = []
+ for param in map_params:
+ ret.append(param + "=" + map_params[param])
+ return ret
+
+
+def run_armbian_compile_and_parse(path_to_compile_sh, compile_params):
+ result = subprocess.run(
+ [path_to_compile_sh] + map_to_armbian_params(compile_params),
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, universal_newlines=True
+ )
+
+ # Now parse it with regex-power!
+ # regex = r"^declare (..) (.*?)=\"(.*?)\"$" # old multiline version
+ regex = r"declare (..) (.*?)=\"(.*?)\""
+ test_str = result.stdout
+ matches = re.finditer(regex, test_str, re.DOTALL | re.MULTILINE)
+ all_keys = {}
+
+ for matchNum, match in enumerate(matches, start=1):
+ flags = match.group(1)
+ key = match.group(2)
+ value = match.group(3)
+
+ if ("_LIST" in key) or ("_DIRS" in key):
+ value = armbian_value_parse_list(value)
+ elif "_TARGET_MAP" in key:
+ value = armbian_value_parse_newline_map(value)
+
+ all_keys[key] = value
+
+ return {"in": compile_params, "out": all_keys, "logs": result.stderr.split("\n")}
+
+
+# Find the location of compile.sh, relative to this Python script.
+this_script_full_path = os.path.realpath(__file__)
+eprint("Real path to this script", this_script_full_path)
+
+armbian_src_path = os.path.realpath(os.path.join(os.path.dirname(this_script_full_path), "..", ".."))
+eprint("Real path to Armbian SRC", armbian_src_path)
+
+compile_sh_full_path = os.path.realpath(os.path.join(armbian_src_path, "compile.sh"))
+eprint("Real path to compile.sh", compile_sh_full_path)
+
+# Make sure it exists
+if not os.path.exists(compile_sh_full_path):
+ raise Exception("Can't find compile.sh")
+
+common_compile_params = {
+ "KERNEL_ONLY": "no",
+ "BUILD_MINIMAL": "no",
+ "DEB_COMPRESS": "none",
+ "CLOUD_IMAGE": "yes",
+ "CLEAN_LEVEL": "debs",
+ "SHOW_LOG": "yes",
+ "CONFIG_DEFS_ONLY": "yes",
+ "KERNEL_CONFIGURE": "no",
+ "EXPERT": "yes"
+}
+
+board_compile_params = {
+ "BOARD": "uefi-x86",
+ "BRANCH": "current",
+ "RELEASE": "impish",
+ "BUILD_DESKTOP": "no"
+}
+
+
+def get_info_for_one_board(board_name, common_params):
+ eprint("Getting info for board '{}'".format(board_name))
+ try:
+ parsed = run_armbian_compile_and_parse(compile_sh_full_path, common_params | {"BOARD": board_name})
+ # print(json.dumps(parsed, indent=4, sort_keys=True))
+ return parsed
+ except:
+ eprint("Failed get info for board '{}'".format(board_name))
+ return None
+
+
+if True:
+ all_boards = get_all_boards_list_from_armbian(armbian_src_path)
+ # print(json.dumps(all_boards, indent=4, sort_keys=True))
+
+ every_info = []
+ with concurrent.futures.ProcessPoolExecutor(max_workers=32) as executor:
+ every_future = []
+ for board in all_boards:
+ all_params = common_compile_params | board_compile_params
+ eprint("Submitting future for board {}".format(board))
+ future = executor.submit(get_info_for_one_board, board, all_params)
+ every_future.append(future)
+
+ eprint("Waiting for all futures...")
+ executor.shutdown(wait=True)
+ eprint("Done, all futures awaited")
+
+ for future in every_future:
+ info = future.result()
+ if info is not None:
+ every_info.append(info)
+
+# info = get_info_for_one_board(board, all_params)
+print(json.dumps(every_info, indent=4, sort_keys=True))
From 328c4f75664d68f01579467631672c5645466cdc Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Sat, 25 Dec 2021 17:12:19 +0100
Subject: [PATCH] logging: move some interactive parts of config into its own
functions
- mostly from config-prepare;
- there is still a lot of others in main-config
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
lib/functions/configuration/interactive.sh | 178 +++++++++++++++++++++
lib/functions/configuration/main-config.sh | 2 +-
lib/functions/configuration/menu.sh | 29 ++++
lib/functions/main/config-prepare.sh | 241 ++++-------------------------
lib/library-functions.sh | 5 +
5 files changed, 247 insertions(+), 208 deletions(-)
diff --git a/lib/functions/configuration/interactive.sh b/lib/functions/configuration/interactive.sh
new file mode 100644
index 000000000..1f6989ae9
--- /dev/null
+++ b/lib/functions/configuration/interactive.sh
@@ -0,0 +1,178 @@
+function interactive_config_prepare_terminal() {
+ if [[ $BUILD_ALL != "yes" && -z $ROOT_FS_CREATE_ONLY ]]; then
+ if [[ -t 0 ]]; then # "-t fd return True if file descriptor fd is open and refers to a terminal". 0 = stdin, 1 = stdout, 2 = stderr, 3+ custom
+ # override stty size, if stdin is a terminal.
+ [[ -n $COLUMNS ]] && stty cols $COLUMNS
+ [[ -n $LINES ]] && stty rows $LINES
+ export TTY_X=$(($(stty size | awk '{print $2}') - 6)) # determine terminal width
+ export TTY_Y=$(($(stty size | awk '{print $1}') - 6)) # determine terminal height
+ fi
+ fi
+
+ # We'll use this title on all menus
+ export backtitle="Armbian building script, https://www.armbian.com | https://docs.armbian.com | (c) 2013-2021 Igor Pecovnik "
+}
+
+function interactive_config_ask_kernel() {
+ # @TODO: rpardini: should be refactored into 'menu' or something
+ # if KERNEL_ONLY, KERNEL_CONFIGURE, BOARD, BRANCH or RELEASE are not set, display selection menu
+ if [[ -z $KERNEL_ONLY ]]; then
+ options+=("yes" "U-boot and kernel packages")
+ options+=("no" "Full OS image for flashing")
+ KERNEL_ONLY=$(dialog_if_terminal --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags \
+ --menu "Select what to build" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
+ unset options
+ fi
+
+ if [[ -z $KERNEL_CONFIGURE ]]; then
+ options+=("no" "Do not change the kernel configuration")
+ options+=("yes" "Show a kernel configuration menu before compilation")
+ options+=("prebuilt" "Use precompiled packages from Armbian repository")
+ KERNEL_CONFIGURE=$(dialog_if_terminal --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags \
+ --menu "Select the kernel configuration" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
+ unset options
+ fi
+}
+
+function interactive_config_ask_board_list() {
+ if [[ -z $BOARD ]]; then
+ WIP_STATE=supported
+ WIP_BUTTON='CSC/WIP/EOS/TVB'
+ STATE_DESCRIPTION=' - boards with high level of software maturity'
+ temp_rc=$(mktemp) # @TODO: this is a _very_ early call to mktemp - no TMPDIR set yet - it needs to be cleaned-up somehow
+
+ while true; do
+ options=()
+ if [[ $WIP_STATE == supported ]]; then
+ for board in "${SRC}"/config/boards/*.conf; do
+ options+=("$(basename "${board}" | cut -d'.' -f1)" "$(head -1 "${board}" | cut -d'#' -f2)")
+ done
+ else
+ for board in "${SRC}"/config/boards/*.wip; do
+ options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(WIP)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
+ done
+ for board in "${SRC}"/config/boards/*.csc; do
+ options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(CSC)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
+ done
+ for board in "${SRC}"/config/boards/*.eos; do
+ options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(EOS)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
+ done
+ for board in "${SRC}"/config/boards/*.tvb; do
+ options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(TVB)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
+ done
+ fi
+
+ if [[ $WIP_STATE != supported ]]; then
+ cat <<- 'EOF' > "${temp_rc}"
+ dialog_color = (RED,WHITE,OFF)
+ screen_color = (WHITE,RED,ON)
+ tag_color = (RED,WHITE,ON)
+ item_selected_color = (WHITE,RED,ON)
+ tag_selected_color = (WHITE,RED,ON)
+ tag_key_selected_color = (WHITE,RED,ON)
+ EOF
+ else
+ echo > "${temp_rc}"
+ fi
+ BOARD=$(DIALOGRC=$temp_rc dialog_if_terminal --stdout --title "Choose a board" --backtitle "$backtitle" --scrollbar \
+ --colors --extra-label "Show $WIP_BUTTON" --extra-button \
+ --menu "Select the target board. Displaying:\n$STATE_DESCRIPTION" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
+ STATUS=$?
+ if [[ $STATUS == 3 ]]; then
+ if [[ $WIP_STATE == supported ]]; then
+ [[ $SHOW_WARNING == yes ]] && show_developer_warning
+ STATE_DESCRIPTION=' - \Z1(CSC)\Zn - Community Supported Configuration\n - \Z1(WIP)\Zn - Work In Progress
+ \n - \Z1(EOS)\Zn - End Of Support\n - \Z1(TVB)\Zn - TV boxes'
+ WIP_STATE=unsupported
+ WIP_BUTTON='matured'
+ EXPERT=yes
+ else
+ STATE_DESCRIPTION=' - boards with high level of software maturity'
+ WIP_STATE=supported
+ WIP_BUTTON='CSC/WIP/EOS'
+ EXPERT=no
+ fi
+ continue
+ elif [[ $STATUS == 0 ]]; then
+ break
+ fi
+ unset options
+ done
+ fi
+}
+
+function interactive_config_ask_branch() {
+ # @TODO: rpardini, again, refactor into menu/interactive config stuff
+ if [[ -z $BRANCH ]]; then
+ options=()
+ [[ $KERNEL_TARGET == *current* ]] && options+=("current" "Recommended. Come with best support")
+ [[ $KERNEL_TARGET == *legacy* ]] && options+=("legacy" "Old stable / Legacy")
+ [[ $KERNEL_TARGET == *edge* && $EXPERT = yes ]] && options+=("edge" "\Z1Bleeding edge from @kernel.org\Zn")
+
+ # do not display selection dialog if only one kernel branch is available
+ if [[ "${#options[@]}" == 2 ]]; then
+ BRANCH="${options[0]}"
+ else
+ BRANCH=$(dialog_if_terminal --stdout --title "Choose a kernel" --backtitle "$backtitle" --colors \
+ --menu "Select the target kernel branch\nExact kernel versions depend on selected board" \
+ $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
+ fi
+ unset options
+ [[ $BRANCH == dev && $SHOW_WARNING == yes ]] && show_developer_warning
+ else
+ [[ $BRANCH == next ]] && KERNEL_TARGET="next"
+ # next = new legacy. Should stay for backward compatibility, but be removed from menu above
+ # or we left definitions in board configs and only remove menu
+ fi
+ return 0
+}
+
+function interactive_config_ask_release() {
+ if [[ $KERNEL_ONLY != yes && -z $RELEASE ]]; then
+ options=()
+ distros_options
+ RELEASE=$(dialog_if_terminal --stdout --title "Choose a release package base" --backtitle "$backtitle" \
+ --menu "Select the target OS release package base" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
+ echo "options : ${options}"
+ unset options
+ fi
+}
+
+function interactive_config_ask_desktop_build() {
+ # don't show desktop option if we choose minimal build
+ [[ $BUILD_MINIMAL == yes ]] && BUILD_DESKTOP=no
+
+ if [[ $KERNEL_ONLY != yes && -z $BUILD_DESKTOP ]]; then
+ # read distribution support status which is written to the armbian-release file
+ set_distribution_status
+ options=()
+ options+=("no" "Image with console interface (server)")
+ options+=("yes" "Image with desktop environment")
+ BUILD_DESKTOP=$(dialog_if_terminal --stdout --title "Choose image type" --backtitle "$backtitle" --no-tags \
+ --menu "Select the target image type" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
+ unset options
+ [[ -z $BUILD_DESKTOP ]] && exit_with_error "No option selected"
+ if [[ ${BUILD_DESKTOP} == "yes" ]]; then
+ BUILD_MINIMAL=no
+ SELECTED_CONFIGURATION="desktop"
+ fi
+ fi
+ return 0
+}
+
+function interactive_config_ask_standard_or_minimal() {
+ if [[ $KERNEL_ONLY != yes && $BUILD_DESKTOP == no && -z $BUILD_MINIMAL ]]; then
+ options=()
+ options+=("no" "Standard image with console interface")
+ options+=("yes" "Minimal image with console interface")
+ BUILD_MINIMAL=$(dialog_if_terminal --stdout --title "Choose image type" --backtitle "$backtitle" --no-tags \
+ --menu "Select the target image type" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
+ unset options
+ [[ -z $BUILD_MINIMAL ]] && exit_with_error "No option selected"
+ if [[ $BUILD_MINIMAL == "yes" ]]; then
+ SELECTED_CONFIGURATION="cli_minimal"
+ else
+ SELECTED_CONFIGURATION="cli_standard"
+ fi
+ fi
+}
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 612003391..4632fd488 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -430,7 +430,7 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
but before assembling any package lists.
USER_CONFIG
- display_alert "Extension initialization" "extension_prepare_config" "debug"
+ display_alert "Extensions: prepare configuration" "extension_prepare_config" "debug"
call_extension_method "extension_prepare_config" <<- 'EXTENSION_PREPARE_CONFIG'
*allow extensions to prepare their own config, after user config is done*
Implementors should preserve variable values pre-set, but can default values an/or validate them.
diff --git a/lib/functions/configuration/menu.sh b/lib/functions/configuration/menu.sh
index 32939ae36..6d6f0b266 100644
--- a/lib/functions/configuration/menu.sh
+++ b/lib/functions/configuration/menu.sh
@@ -56,3 +56,32 @@ show_developer_warning() {
[[ $? -ne 0 ]] && exit_with_error "Error switching to the expert mode"
SHOW_WARNING=no
}
+
+
+# Stuff that was in config files
+function distro_menu() {
+ # create a select menu for choosing a distribution based EXPERT status
+
+ local distrib_dir="${1}"
+
+ if [[ -d "${distrib_dir}" && -f "${distrib_dir}/support" ]]; then
+ local support_level="$(cat "${distrib_dir}/support")"
+ if [[ "${support_level}" != "supported" && $EXPERT != "yes" ]]; then
+ :
+ else
+ local distro_codename="$(basename "${distrib_dir}")"
+ local distro_fullname="$(cat "${distrib_dir}/name")"
+ local expert_infos=""
+ [[ $EXPERT == "yes" ]] && expert_infos="(${support_level})"
+ options+=("${distro_codename}" "${distro_fullname} ${expert_infos}")
+ fi
+ fi
+
+}
+
+function distros_options() {
+ for distrib_dir in "config/distributions/"*; do
+ distro_menu "${distrib_dir}"
+ done
+}
+
diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh
index bdc642ded..196142608 100644
--- a/lib/functions/main/config-prepare.sh
+++ b/lib/functions/main/config-prepare.sh
@@ -11,19 +11,7 @@ function prepare_and_config_main_build_single() {
fi
display_alert "Determined DEST:" "${DEST}" "debug"
- if [[ $BUILD_ALL != "yes" && -z $ROOT_FS_CREATE_ONLY ]]; then
- if [[ -t 0 ]]; then # "-t fd return True if file descriptor fd is open and refers to a terminal". 0 = stdin, 1 = stdout, 2 = stderr, 3+ custom
- display_alert "stdin is a terminal" "or is it?" "warning"
- # override stty size, if stdin is a terminal.
- [[ -n $COLUMNS ]] && stty cols $COLUMNS
- [[ -n $LINES ]] && stty rows $LINES
- TTY_X=$(($(stty size | awk '{print $2}') - 6)) # determine terminal width
- TTY_Y=$(($(stty size | awk '{print $1}') - 6)) # determine terminal height
- fi
- fi
-
- # We'll use this title on all menus
- backtitle="Armbian building script, https://www.armbian.com | https://docs.armbian.com | (c) 2013-2021 Igor Pecovnik "
+ interactive_config_prepare_terminal
# Warnings mitigation
[[ -z $LANGUAGE ]] && export LANGUAGE="en_US:en" # set to english if not set
@@ -47,20 +35,14 @@ function prepare_and_config_main_build_single() {
# Mark a timestamp, for next build.
date +"%d_%m_%Y-%H_%M_%S" > "${DEST}"/${LOG_SUBPATH}/timestamp
- if [[ $PROGRESS_DISPLAY == none ]]; then
- display_alert "Output will be silenced." "PROGRESS_DISPLAY=none" "warning"
- export OUTPUT_VERYSILENT=yes
- elif [[ $PROGRESS_DISPLAY == dialog ]]; then # @TODO: WHO SETS THIS?? this is key to solving the logging cray-cray
- export OUTPUT_DIALOG=yes
- fi
-
- # PROGRESS_LOG_TO_FILE is either yes, or unset.
+ # PROGRESS_LOG_TO_FILE is either yes, or unset. (@TODO: this is still used in buildpkg)
if [[ $PROGRESS_LOG_TO_FILE != yes ]]; then unset PROGRESS_LOG_TO_FILE; fi
SHOW_WARNING=yes
display_alert "Starting single build process" "${BOARD}" "info"
+ # @TODO: rpardini: ccache belongs in compilation, not config. I think.
if [[ $USE_CCACHE != no ]]; then
CCACHE=ccache
export PATH="/usr/lib/ccache:$PATH"
@@ -71,6 +53,7 @@ function prepare_and_config_main_build_single() {
CCACHE=""
fi
+ # @TODO: rpardini: refactor this into 'repo' stuff. Out of configuration, I think.
if [[ -n $REPOSITORY_UPDATE ]]; then
# select stable/beta configuration
if [[ $BETA == yes ]]; then
@@ -93,91 +76,12 @@ function prepare_and_config_main_build_single() {
exit
fi
- # if KERNEL_ONLY, KERNEL_CONFIGURE, BOARD, BRANCH or RELEASE are not set, display selection menu
- if [[ -z $KERNEL_ONLY ]]; then
- options+=("yes" "U-boot and kernel packages")
- options+=("no" "Full OS image for flashing")
- KERNEL_ONLY=$(dialog_if_terminal --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags \
- --menu "Select what to build" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
- unset options
- [[ -z $KERNEL_ONLY ]] && exit_with_error "No option selected"
- fi
-
- if [[ -z $KERNEL_CONFIGURE ]]; then
- options+=("no" "Do not change the kernel configuration")
- options+=("yes" "Show a kernel configuration menu before compilation")
- options+=("prebuilt" "Use precompiled packages from Armbian repository")
- KERNEL_CONFIGURE=$(dialog_if_terminal --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags \
- --menu "Select the kernel configuration" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
- unset options
- [[ -z $KERNEL_CONFIGURE ]] && exit_with_error "No option selected"
- fi
+ interactive_config_ask_kernel
+ [[ -z $KERNEL_ONLY ]] && exit_with_error "No option selected: KERNEL_ONLY"
+ [[ -z $KERNEL_CONFIGURE ]] && exit_with_error "No option selected: KERNEL_CONFIGURE"
- if [[ -z $BOARD ]]; then
- WIP_STATE=supported
- WIP_BUTTON='CSC/WIP/EOS/TVB'
- STATE_DESCRIPTION=' - boards with high level of software maturity'
- temp_rc=$(mktemp) # @TODO: this is a _very_ early call to mktemp - no TMPDIR set yet - it needs to be cleaned-up somehow
-
- while true; do
- options=()
- if [[ $WIP_STATE == supported ]]; then
- for board in "${SRC}"/config/boards/*.conf; do
- options+=("$(basename "${board}" | cut -d'.' -f1)" "$(head -1 "${board}" | cut -d'#' -f2)")
- done
- else
- for board in "${SRC}"/config/boards/*.wip; do
- options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(WIP)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
- done
- for board in "${SRC}"/config/boards/*.csc; do
- options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(CSC)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
- done
- for board in "${SRC}"/config/boards/*.eos; do
- options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(EOS)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
- done
- for board in "${SRC}"/config/boards/*.tvb; do
- options+=("$(basename "${board}" | cut -d'.' -f1)" "\Z1(TVB)\Zn $(head -1 "${board}" | cut -d'#' -f2)")
- done
- fi
-
- if [[ $WIP_STATE != supported ]]; then
- cat <<- 'EOF' > "${temp_rc}"
- dialog_color = (RED,WHITE,OFF)
- screen_color = (WHITE,RED,ON)
- tag_color = (RED,WHITE,ON)
- item_selected_color = (WHITE,RED,ON)
- tag_selected_color = (WHITE,RED,ON)
- tag_key_selected_color = (WHITE,RED,ON)
- EOF
- else
- echo > "${temp_rc}"
- fi
- BOARD=$(DIALOGRC=$temp_rc dialog_if_terminal --stdout --title "Choose a board" --backtitle "$backtitle" --scrollbar \
- --colors --extra-label "Show $WIP_BUTTON" --extra-button \
- --menu "Select the target board. Displaying:\n$STATE_DESCRIPTION" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
- STATUS=$?
- if [[ $STATUS == 3 ]]; then
- if [[ $WIP_STATE == supported ]]; then
- [[ $SHOW_WARNING == yes ]] && show_developer_warning
- STATE_DESCRIPTION=' - \Z1(CSC)\Zn - Community Supported Configuration\n - \Z1(WIP)\Zn - Work In Progress
- \n - \Z1(EOS)\Zn - End Of Support\n - \Z1(TVB)\Zn - TV boxes'
- WIP_STATE=unsupported
- WIP_BUTTON='matured'
- EXPERT=yes
- else
- STATE_DESCRIPTION=' - boards with high level of software maturity'
- WIP_STATE=supported
- WIP_BUTTON='CSC/WIP/EOS'
- EXPERT=no
- fi
- continue
- elif [[ $STATUS == 0 ]]; then
- break
- fi
- unset options
- [[ -z $BOARD ]] && exit_with_error "No board selected"
- done
- fi
+ interactive_config_ask_board_list
+ [[ -z $BOARD ]] && exit_with_error "No board selected: BOARD"
if [[ -f $SRC/config/boards/${BOARD}.conf ]]; then
BOARD_TYPE='conf'
@@ -191,80 +95,28 @@ function prepare_and_config_main_build_single() {
BOARD_TYPE='tvb'
fi
+ # @TODO: rpardini: this is when Alice enters the hole. Sourcing stuff, extensions getting activated, etc.
+
display_alert "Sourcing board configuration" "${BOARD}.${BOARD_TYPE}" "info"
# shellcheck source=/dev/null
source "${SRC}/config/boards/${BOARD}.${BOARD_TYPE}"
LINUXFAMILY="${BOARDFAMILY}"
- [[ -z $KERNEL_TARGET ]] && exit_with_error "Board configuration does not define valid kernel config"
+ # @TODO: interesting. this sourced the board config. What sources the family?
- if [[ -z $BRANCH ]]; then
- options=()
- [[ $KERNEL_TARGET == *current* ]] && options+=("current" "Recommended. Come with best support")
- [[ $KERNEL_TARGET == *legacy* ]] && options+=("legacy" "Old stable / Legacy")
- [[ $KERNEL_TARGET == *edge* && $EXPERT = yes ]] && options+=("edge" "\Z1Bleeding edge from @kernel.org\Zn")
- # do not display selection dialog if only one kernel branch is available
- if [[ "${#options[@]}" == 2 ]]; then
- BRANCH="${options[0]}"
- else
- BRANCH=$(dialog_if_terminal --stdout --title "Choose a kernel" --backtitle "$backtitle" --colors \
- --menu "Select the target kernel branch\nExact kernel versions depend on selected board" \
- $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
- fi
- unset options
- [[ -z $BRANCH ]] && exit_with_error "No kernel branch selected"
- [[ $BRANCH == dev && $SHOW_WARNING == yes ]] && show_developer_warning
- else
- [[ $BRANCH == next ]] && KERNEL_TARGET="next"
- # next = new legacy. Should stay for backward compatibility, but be removed from menu above
- # or we left definitions in board configs and only remove menu
- [[ $KERNEL_TARGET != *$BRANCH* ]] && exit_with_error "Kernel branch not defined for this board" "$BRANCH"
- fi
+ [[ -z $KERNEL_TARGET ]] && exit_with_error "Board configuration does not define valid kernel config"
- if [[ $KERNEL_ONLY != yes && -z $RELEASE ]]; then
- options=()
- distros_options
- RELEASE=$(dialog_if_terminal --stdout --title "Choose a release package base" --backtitle "$backtitle" \
- --menu "Select the target OS release package base" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
- echo "options : ${options}"
- [[ -z $RELEASE ]] && exit_with_error "No release selected"
- unset options
- fi
+ interactive_config_ask_branch
+ [[ -z $BRANCH ]] && exit_with_error "No kernel branch selected: BRANCH"
+ [[ $KERNEL_TARGET != *$BRANCH* ]] && exit_with_error "Kernel branch not defined for this board" "$BRANCH"
- # don't show desktop option if we choose minimal build
- [[ $BUILD_MINIMAL == yes ]] && BUILD_DESKTOP=no
-
- if [[ $KERNEL_ONLY != yes && -z $BUILD_DESKTOP ]]; then
- # read distribution support status which is written to the armbian-release file
- set_distribution_status
- options=()
- options+=("no" "Image with console interface (server)")
- options+=("yes" "Image with desktop environment")
- BUILD_DESKTOP=$(dialog_if_terminal --stdout --title "Choose image type" --backtitle "$backtitle" --no-tags \
- --menu "Select the target image type" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
- unset options
- [[ -z $BUILD_DESKTOP ]] && exit_with_error "No option selected"
- if [[ ${BUILD_DESKTOP} == "yes" ]]; then
- BUILD_MINIMAL=no
- SELECTED_CONFIGURATION="desktop"
- fi
- fi
+ interactive_config_ask_release
+ [[ -z $RELEASE ]] && exit_with_error "No release selected: RELEASE"
- if [[ $KERNEL_ONLY != yes && $BUILD_DESKTOP == no && -z $BUILD_MINIMAL ]]; then
- options=()
- options+=("no" "Standard image with console interface")
- options+=("yes" "Minimal image with console interface")
- BUILD_MINIMAL=$(dialog_if_terminal --stdout --title "Choose image type" --backtitle "$backtitle" --no-tags \
- --menu "Select the target image type" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
- unset options
- [[ -z $BUILD_MINIMAL ]] && exit_with_error "No option selected"
- if [[ $BUILD_MINIMAL == "yes" ]]; then
- SELECTED_CONFIGURATION="cli_minimal"
- else
- SELECTED_CONFIGURATION="cli_standard"
- fi
- fi
+ interactive_config_ask_desktop_build
+
+ interactive_config_ask_standard_or_minimal
#prevent conflicting setup
if [[ $BUILD_DESKTOP == "yes" ]]; then
@@ -284,6 +136,7 @@ function prepare_and_config_main_build_single() {
do_main_configuration
+ # @TODO: this does not belong in configuration. it's a compilation thing. move there
# optimize build time with 100% CPU usage
CPUS=$(grep -c 'processor' /proc/cpuinfo)
if [[ $USEALLCORES != no ]]; then
@@ -305,20 +158,20 @@ function prepare_and_config_main_build_single() {
IMAGE_TYPE=user-built
fi
- BOOTSOURCEDIR="${BOOTDIR}/$(branch2dir "${BOOTBRANCH}")"
- LINUXSOURCEDIR="${KERNELDIR}/$(branch2dir "${KERNELBRANCH}")"
- [[ -n $ATFSOURCE ]] && ATFSOURCEDIR="${ATFDIR}/$(branch2dir "${ATFBRANCH}")"
+ export BOOTSOURCEDIR="${BOOTDIR}/$(branch2dir "${BOOTBRANCH}")"
+ export LINUXSOURCEDIR="${KERNELDIR}/$(branch2dir "${KERNELBRANCH}")"
+ [[ -n $ATFSOURCE ]] && export ATFSOURCEDIR="${ATFDIR}/$(branch2dir "${ATFBRANCH}")"
- BSP_CLI_PACKAGE_NAME="armbian-bsp-cli-${BOARD}${EXTRA_BSP_NAME}"
- BSP_CLI_PACKAGE_FULLNAME="${BSP_CLI_PACKAGE_NAME}_${REVISION}_${ARCH}"
- BSP_DESKTOP_PACKAGE_NAME="armbian-bsp-desktop-${BOARD}${EXTRA_BSP_NAME}"
- BSP_DESKTOP_PACKAGE_FULLNAME="${BSP_DESKTOP_PACKAGE_NAME}_${REVISION}_${ARCH}"
+ export BSP_CLI_PACKAGE_NAME="armbian-bsp-cli-${BOARD}${EXTRA_BSP_NAME}"
+ export BSP_CLI_PACKAGE_FULLNAME="${BSP_CLI_PACKAGE_NAME}_${REVISION}_${ARCH}"
+ export BSP_DESKTOP_PACKAGE_NAME="armbian-bsp-desktop-${BOARD}${EXTRA_BSP_NAME}"
+ export BSP_DESKTOP_PACKAGE_FULLNAME="${BSP_DESKTOP_PACKAGE_NAME}_${REVISION}_${ARCH}"
- CHOSEN_UBOOT=linux-u-boot-${BRANCH}-${BOARD}
- CHOSEN_KERNEL=linux-image-${BRANCH}-${LINUXFAMILY}
- CHOSEN_ROOTFS=${BSP_CLI_PACKAGE_NAME}
- CHOSEN_DESKTOP=armbian-${RELEASE}-desktop-${DESKTOP_ENVIRONMENT}
- CHOSEN_KSRC=linux-source-${BRANCH}-${LINUXFAMILY}
+ export CHOSEN_UBOOT=linux-u-boot-${BRANCH}-${BOARD}
+ export CHOSEN_KERNEL=linux-image-${BRANCH}-${LINUXFAMILY}
+ export CHOSEN_ROOTFS=${BSP_CLI_PACKAGE_NAME}
+ export CHOSEN_DESKTOP=armbian-${RELEASE}-desktop-${DESKTOP_ENVIRONMENT}
+ export CHOSEN_KSRC=linux-source-${BRANCH}-${LINUXFAMILY}
display_alert "Done with prepare_and_config_main_build_single" "${BOARD}.${BOARD_TYPE}" "info"
@@ -338,32 +191,6 @@ function set_distribution_status() {
return 0 # due to last stmt above being a shortcut conditional
}
-function distro_menu() {
- # create a select menu for choosing a distribution based EXPERT status
-
- local distrib_dir="${1}"
-
- if [[ -d "${distrib_dir}" && -f "${distrib_dir}/support" ]]; then
- local support_level="$(cat "${distrib_dir}/support")"
- if [[ "${support_level}" != "supported" && $EXPERT != "yes" ]]; then
- :
- else
- local distro_codename="$(basename "${distrib_dir}")"
- local distro_fullname="$(cat "${distrib_dir}/name")"
- local expert_infos=""
- [[ $EXPERT == "yes" ]] && expert_infos="(${support_level})"
- options+=("${distro_codename}" "${distro_fullname} ${expert_infos}")
- fi
- fi
-
-}
-
-function distros_options() {
- for distrib_dir in "config/distributions/"*; do
- distro_menu "${distrib_dir}"
- done
-}
-
# Some utility functions
branch2dir() {
[[ "${1}" == "head" ]] && echo "HEAD" || echo "${1##*:}"
diff --git a/lib/library-functions.sh b/lib/library-functions.sh
index b41fa1a8f..f9bb093a4 100644
--- a/lib/library-functions.sh
+++ b/lib/library-functions.sh
@@ -7,6 +7,10 @@ set -e # no errors tolerated
# shellcheck source=functions/configuration/menu.sh
source "${SRC}"/lib/functions/configuration/menu.sh
+### lib/functions/configuration/interactive.sh
+# shellcheck source=functions/configuration/interactive.sh
+source "${SRC}"/lib/functions/configuration/interactive.sh
+
### lib/functions/configuration/config-desktop.sh
# shellcheck source=functions/configuration/config-desktop.sh
source "${SRC}"/lib/functions/configuration/config-desktop.sh
@@ -187,4 +191,5 @@ source "${SRC}"/lib/functions/extras/fel.sh
# shellcheck source=functions/extras/buildpkg.sh
source "${SRC}"/lib/functions/extras/buildpkg.sh
+
# This file is/was autogenerated by lib/tools/gen-library.sh; don't modify manually - thanks
From 078ad44f58e718d842b6a14d3f441560ac685022 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 24 Dec 2021 08:43:34 +0100
Subject: [PATCH] logging: use chroot_custom for grub and flash-kernel
extension logging
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
extensions/flash-kernel.sh | 20 +++++++++-----------
extensions/grub.sh | 4 ++--
2 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/extensions/flash-kernel.sh b/extensions/flash-kernel.sh
index 2941d3a57..0390a3b37 100644
--- a/extensions/flash-kernel.sh
+++ b/extensions/flash-kernel.sh
@@ -16,7 +16,6 @@ function extension_prepare_config__prepare_flash_kernel() {
export CLOUD_INIT_CONFIG_LOCATION="/boot/firmware" # use /boot/firmware for cloud-init as well
export VER="${FK__PUBLISHED_KERNEL_VERSION}" # For the VERSION
export EXTRA_BSP_NAME="${EXTRA_BSP_NAME}-fk${FK__PUBLISHED_KERNEL_VERSION}" # Unique bsp name.
- echo "-- starting" > "${DEST}"/"${LOG_SUBPATH}"/flash-kernel.log # Zero out the log for this extension.
}
function post_install_kernel_debs__install_kernel_and_flash_packages() {
@@ -24,7 +23,7 @@ function post_install_kernel_debs__install_kernel_and_flash_packages() {
if [[ "${FK__EXTRA_PACKAGES}" != "" ]]; then
display_alert "Installing flash-kernel extra packages" "${FK__EXTRA_PACKAGES}"
- chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get ${APT_EXTRA_DIST_PARAMS} -yqq --no-install-recommends install ${FK__EXTRA_PACKAGES}" || {
+ chroot_sdcard_apt_get_install "${FK__EXTRA_PACKAGES}" || {
display_alert "Failed to install flash-kernel's extra packages." "${EXTENSION}" "err"
exit 28
}
@@ -32,7 +31,7 @@ function post_install_kernel_debs__install_kernel_and_flash_packages() {
if [[ "${FK__KERNEL_PACKAGES}" != "" ]]; then
display_alert "Installing flash-kernel kernel packages" "${FK__KERNEL_PACKAGES}"
- chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get ${APT_EXTRA_DIST_PARAMS} -yqq --no-install-recommends install ${FK__KERNEL_PACKAGES}" || {
+ chroot_sdcard_apt_get_install "${FK__KERNEL_PACKAGES}" || {
display_alert "Failed to install flash-kernel's kernel packages." "${EXTENSION}" "err"
exit 28
}
@@ -44,7 +43,7 @@ function post_install_kernel_debs__install_kernel_and_flash_packages() {
umount "${SDCARD}"/sys
mkdir -p "${SDCARD}"/sys/firmware/efi
- chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get ${APT_EXTRA_DIST_PARAMS} -yqq --no-install-recommends install ${FK__TOOL_PACKAGE}" || {
+ chroot_sdcard_apt_get_install "${FK__TOOL_PACKAGE}" || {
display_alert "Failed to install flash-kernel package." "${EXTENSION}" "err"
exit 28
}
@@ -74,9 +73,8 @@ function pre_update_initramfs__setup_flash_kernel() {
# hack, umount the chroot's /sys, otherwise flash-kernel tries to EFI flash due to the build host (!) being EFI
umount "$chroot_target/sys"
- echo "-- flash-kernel disabling hooks"
- chroot "$chroot_target" /bin/bash -c "chmod -v -x /etc/kernel/postinst.d/initramfs-tools" 2>&1
- chroot "$chroot_target" /bin/bash -c "chmod -v -x /etc/initramfs/post-update.d/flash-kernel" 2>&1
+ chroot_custom "$chroot_target" chmod -v -x "/etc/kernel/postinst.d/initramfs-tools"
+ chroot_custom "$chroot_target" chmod -v -x "/etc/initramfs/post-update.d/flash-kernel"
export FIRMWARE_DIR="${MOUNT}"/boot/firmware
call_extension_method "pre_initramfs_flash_kernel" <<- 'PRE_INITRAMFS_FLASH_KERNEL'
@@ -86,7 +84,7 @@ function pre_update_initramfs__setup_flash_kernel() {
local update_initramfs_cmd="update-initramfs -c -k all"
display_alert "Updating flash-kernel initramfs..." "$update_initramfs_cmd" ""
- chroot "$chroot_target" /bin/bash -c "$update_initramfs_cmd" 2>&1 || {
+ chroot_custom "$chroot_target" "$update_initramfs_cmd" || {
display_alert "Failed to run '$update_initramfs_cmd'" "Check logs" "err"
exit 29
}
@@ -99,14 +97,14 @@ function pre_update_initramfs__setup_flash_kernel() {
local flash_kernel_cmd="flash-kernel --machine '${FK__MACHINE_MODEL}'"
display_alert "flash-kernel" "${FK__MACHINE_MODEL}" "info"
- chroot "$chroot_target" /bin/bash -c "${flash_kernel_cmd}" 2>&1 || {
+ chroot_custom "$chroot_target" "${flash_kernel_cmd}" || {
display_alert "Failed to run '${flash_kernel_cmd}'" "Check logs" "err"
exit 29
}
display_alert "Re-enabling" "initramfs-tools/flash-kernel hook for kernel"
- chroot "$chroot_target" /bin/bash -c "chmod -v +x /etc/kernel/postinst.d/initramfs-tools" 2>&1
- chroot "$chroot_target" /bin/bash -c "chmod -v +x /etc/initramfs/post-update.d/flash-kernel" 2>&1
+ chroot_custom "$chroot_target" chmod -v +x "/etc/kernel/postinst.d/initramfs-tools"
+ chroot_custom "$chroot_target" chmod -v +x "/etc/initramfs/post-update.d/flash-kernel"
umount_chroot "$chroot_target/"
rm "$chroot_target"/usr/bin/"$QEMU_BINARY"
diff --git a/extensions/grub.sh b/extensions/grub.sh
index a0355f5bb..3f0478454 100644
--- a/extensions/grub.sh
+++ b/extensions/grub.sh
@@ -96,14 +96,14 @@ pre_umount_final_image__install_grub() {
if [[ "${UEFI_GRUB_TARGET_BIOS}" != "" ]]; then
display_alert "Installing GRUB BIOS..." "${UEFI_GRUB_TARGET_BIOS} device ${LOOP}" ""
- chroot "$chroot_target" /bin/bash -c "grub-install --target=${UEFI_GRUB_TARGET_BIOS} ${LOOP}" 2>&1 || {
+ chroot_custom "$chroot_target" grub-install --target=${UEFI_GRUB_TARGET_BIOS} "${LOOP}" || {
exit_with_error "${install_grub_cmdline} failed!"
}
fi
local install_grub_cmdline="update-initramfs -c -k all && update-grub && grub-install --target=${UEFI_GRUB_TARGET} --no-nvram --removable" # nvram is global to the host, even across chroot. take care.
display_alert "Installing GRUB EFI..." "${UEFI_GRUB_TARGET}" ""
- chroot "$chroot_target" /bin/bash -c "$install_grub_cmdline" 2>&1 || {
+ chroot_custom "$chroot_target" "$install_grub_cmdline" || {
exit_with_error "${install_grub_cmdline} failed!"
}
From e4cc689b82986aa917ccf71cefcae121261559bd Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Fri, 24 Dec 2021 01:43:23 +0100
Subject: [PATCH] logging: use line buffering, fix runner output color for GHA
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
lib/functions/logging/logging.sh | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index 765dda74f..b075a76ab 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -25,7 +25,7 @@ function logging_error_show_log() {
local prefix_sed_cmd="s/^/${prefix_sed_contents}/;"
display_alert " 👇👇👇 Showing logfile below 👇👇👇" "${logfile_to_show}" "err"
# shellcheck disable=SC2002 # my cat is great. thank you, shellcheck.
- cat "${logfile_to_show}" | grep -v -e "^$" | sed -e "${prefix_sed_cmd}" 1>&2 # write it TO stderr!!
+ cat "${logfile_to_show}" | grep -v -e "^$" | sed -e "${prefix_sed_cmd}" 1>&2 # write it to stderr!!
display_alert " 👆👆👆 Showing logfile above 👆👆👆" "${logfile_to_show}" "err"
display_alert "🦞 Error Msg" "$message" "err"
display_alert "🐞 Error stacktrace" "$stacktrace" "err"
@@ -55,16 +55,21 @@ function do_with_logging() {
# this is mostly handled by redirecting stderr to stdout: 2>&1
local exit_code=176 # fail by default...
- local prefix_sed_contents
- prefix_sed_contents="$(logging_echo_prefix_for_pv "tool") $(echo -n -e "${gray_color}")"
- local prefix_sed_cmd="s/^/${prefix_sed_contents}/;"
if [[ "${SHOW_LOG}" == "yes" ]]; then
+ local prefix_sed_contents
+ local tool_color="${gray_color}" # default to gray... (should be ok on terminals)
+ if [[ "${CI}" == "true" ]]; then # ... but that is too dark for Github Actions
+ tool_color="${normal_color}"
+ fi
+ prefix_sed_contents="$(logging_echo_prefix_for_pv "tool") $(echo -n -e "${tool_color}")"
+ local prefix_sed_cmd="s/^/${prefix_sed_contents}/;"
+
# This is sick. Create a 3rd file descriptor sending it to sed. https://unix.stackexchange.com/questions/174849/redirecting-stdout-to-terminal-and-file-without-using-a-pipe
# Also terrible: don't hold a reference to cwd by changing to SRC always
exec 3> >(
cd "${SRC}" || exit 2
#grep --line-buffered -v "^$" | \
- sed -e "${prefix_sed_cmd}"
+ sed -u -e "${prefix_sed_cmd}"
)
"$@" >&3
exit_code=$? # hopefully this is the pipe
From b1cfead3ac2957d5e19a3f10010a814ef0e70297 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 22 Dec 2021 01:19:47 +0100
Subject: [PATCH] logging: wrap dpkg-deb; set TMPDIR (not in chroot); refactor
kernel make
- And a huge amount of @TODO's added
- Add "debug" and "deprecation" `display_alert()` levels
- insist that `install_common` is now `install_distribution_agnostic`
- unrelated: realtek 8822CS is EXTRAWIFI=yes only now, sorry.
- many debug statements for desktop
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
config/sources/amd64.conf | 2 +-
lib/functions/bsp/bsp-cli.sh | 2 +-
lib/functions/bsp/bsp-desktop.sh | 4 +-
lib/functions/compilation/compilation-utils.sh | 2 +-
lib/functions/compilation/debs.sh | 9 +--
lib/functions/compilation/extra-drivers.sh | 4 +-
lib/functions/compilation/kernel.sh | 86 ++++++++++++++++----------
lib/functions/compilation/uboot.sh | 2 +-
lib/functions/configuration/main-config.sh | 20 ++++--
lib/functions/general/host.sh | 11 +++-
lib/functions/image/loop.sh | 2 +-
lib/functions/logging/logging.sh | 5 ++
lib/functions/logging/runners.sh | 19 ++++--
lib/functions/main/config-prepare.sh | 3 +-
lib/functions/main/rootfs-image.sh | 2 +-
lib/functions/rootfs/apt.sh | 13 ++--
lib/functions/rootfs/distro_agnostic.sh | 2 +-
17 files changed, 122 insertions(+), 66 deletions(-)
diff --git a/config/sources/amd64.conf b/config/sources/amd64.conf
index b7a20d2c3..510d1b6b6 100644
--- a/config/sources/amd64.conf
+++ b/config/sources/amd64.conf
@@ -4,7 +4,7 @@ export QEMU_BINARY="qemu-x86_64-static" # Hopefully you have this installed.
export KERNEL_COMPILER=' ' # hack: use single space for host gcc. won't work on arm64 hosts
export KERNEL_USE_GCC=' ' # more hacks.
export KERNEL_IMAGE_TYPE="bzImage" # Ubuntu Standard
-export KERNEL_EXTRA_TARGETS="modules" # default is "modules dtb" but x86_64 has no DTB
+export KERNEL_EXTRA_TARGETS=" " # default is "dtbs" but x86_64 has no DTB. use a space for no target
#export INITRD_ARCH=amd64 # Used by u-boot for mkimage in initramfs. No u-boot for x86 yet.
export UBOOT_USE_GCC="none" # required by configuration.sh
diff --git a/lib/functions/bsp/bsp-cli.sh b/lib/functions/bsp/bsp-cli.sh
index b65f0b89e..67baede0d 100644
--- a/lib/functions/bsp/bsp-cli.sh
+++ b/lib/functions/bsp/bsp-cli.sh
@@ -300,7 +300,7 @@ POST_FAMILY_TWEAKS_BSP
find "${destination}" ! -type l -print0 2> /dev/null | xargs -0r chmod 'go=rX,u+rw,a-s'
# create board DEB file
- fakeroot dpkg-deb -b -Z${DEB_COMPRESS} "${destination}" "${destination}.deb" 2>&1
+ fakeroot_dpkg_deb_build "${destination}" "${destination}.deb"
mkdir -p "${DEB_STORAGE}/${RELEASE}/"
rsync --remove-source-files -rq "${destination}.deb" "${DEB_STORAGE}/${RELEASE}/" 2>&1
diff --git a/lib/functions/bsp/bsp-desktop.sh b/lib/functions/bsp/bsp-desktop.sh
index 8de8b9927..baa585d7f 100644
--- a/lib/functions/bsp/bsp-desktop.sh
+++ b/lib/functions/bsp/bsp-desktop.sh
@@ -84,7 +84,7 @@ create_desktop_package() {
mkdir -p "${DEB_STORAGE}/${RELEASE}"
cd "${destination}"
cd ..
- fakeroot dpkg-deb -b -Z${DEB_COMPRESS} "${destination}" "${DEB_STORAGE}/${RELEASE}/${CHOSEN_DESKTOP}_${REVISION}_all.deb" > /dev/null
+ fakeroot_dpkg_deb_build "${destination}" "${DEB_STORAGE}/${RELEASE}/${CHOSEN_DESKTOP}_${REVISION}_all.deb"
# cleanup
rm -rf "${tmp_dir}"
@@ -146,7 +146,7 @@ create_bsp_desktop_package() {
mkdir -p "${DEB_STORAGE}/${RELEASE}"
cd "${destination}"
cd ..
- fakeroot dpkg-deb -b -Z${DEB_COMPRESS} "${destination}" "${DEB_STORAGE}/${RELEASE}/${package_name}.deb" > /dev/null
+ fakeroot_dpkg_deb_build "${destination}" "${DEB_STORAGE}/${RELEASE}/${package_name}.deb"
# cleanup
rm -rf "${tmp_dir}"
diff --git a/lib/functions/compilation/compilation-utils.sh b/lib/functions/compilation/compilation-utils.sh
index 13f7138d3..e9ff44a09 100644
--- a/lib/functions/compilation/compilation-utils.sh
+++ b/lib/functions/compilation/compilation-utils.sh
@@ -92,7 +92,7 @@ overlayfs_wrapper() {
local description="$3"
mkdir -p /tmp/overlay_components/ /tmp/armbian_build/
local tempdir workdir mergeddir
- tempdir=$(mktemp -d --tmpdir="/tmp/overlay_components/")
+ tempdir=$(mktemp -d --tmpdir="/tmp/overlay_components/") # @TODO: WORKDIR? otherwise uses host's root disk, which might be small
workdir=$(mktemp -d --tmpdir="/tmp/overlay_components/")
mergeddir=$(mktemp -d --suffix="_$description" --tmpdir="/tmp/armbian_build/")
mount -t overlay overlay -o lowerdir="$srcdir",upperdir="$tempdir",workdir="$workdir" "$mergeddir"
diff --git a/lib/functions/compilation/debs.sh b/lib/functions/compilation/debs.sh
index 793bf9eeb..d696b9d86 100644
--- a/lib/functions/compilation/debs.sh
+++ b/lib/functions/compilation/debs.sh
@@ -12,6 +12,7 @@ compile_firmware() {
mkdir -p "${firmwaretempdir}/${plugin_dir}/lib/firmware"
fetch_from_repo "https://github.com/armbian/firmware" "armbian-firmware-git" "branch:master"
+
if [[ -n $FULL ]]; then
fetch_from_repo "$MAINLINE_FIRMWARE_SOURCE" "linux-firmware-git" "branch:master"
# cp : create hardlinks
@@ -42,11 +43,11 @@ compile_firmware() {
# pack
mv "armbian-firmware${FULL}" "armbian-firmware${FULL}_${REVISION}_all"
display_alert "Building firmware package" "armbian-firmware${FULL}_${REVISION}_all" "info"
- fakeroot dpkg-deb -b -Z${DEB_COMPRESS} "armbian-firmware${FULL}_${REVISION}_all" 2>&1
+ fakeroot_dpkg_deb_build "armbian-firmware${FULL}_${REVISION}_all"
mv "armbian-firmware${FULL}_${REVISION}_all" "armbian-firmware${FULL}"
rsync -rq "armbian-firmware${FULL}_${REVISION}_all.deb" "${DEB_STORAGE}/"
- # remove temp directory
+ # remove temp directory - @TODO: maybe not, just leave thrash behind.
rm -rf "${firmwaretempdir}"
}
@@ -121,7 +122,7 @@ compile_armbian-zsh() {
chmod 755 "${tmp_dir}/${armbian_zsh_dir}"/DEBIAN/postinst
- fakeroot dpkg-deb -b -Z${DEB_COMPRESS} "${tmp_dir}/${armbian_zsh_dir}" 2>&1
+ fakeroot_dpkg_deb_build "${tmp_dir}/${armbian_zsh_dir}"
rsync --remove-source-files -rq "${tmp_dir}/${armbian_zsh_dir}.deb" "${DEB_STORAGE}/"
rm -rf "${tmp_dir}"
@@ -176,7 +177,7 @@ compile_armbian-config() {
ln -sf /usr/sbin/armbian-config "${tmp_dir}/${armbian_config_dir}"/usr/bin/armbian-config
ln -sf /usr/sbin/softy "${tmp_dir}/${armbian_config_dir}"/usr/bin/softy
- fakeroot dpkg-deb -b -Z${DEB_COMPRESS} "${tmp_dir}/${armbian_config_dir}" > /dev/null
+ fakeroot_dpkg_deb_build "${tmp_dir}/${armbian_config_dir}"
rsync --remove-source-files -rq "${tmp_dir}/${armbian_config_dir}.deb" "${DEB_STORAGE}/"
rm -rf "${tmp_dir}"
}
diff --git a/lib/functions/compilation/extra-drivers.sh b/lib/functions/compilation/extra-drivers.sh
index 39d092bbc..69e287d81 100644
--- a/lib/functions/compilation/extra-drivers.sh
+++ b/lib/functions/compilation/extra-drivers.sh
@@ -545,14 +545,12 @@ prepare_extra_kernel_drivers() {
fi
# Bluetooth support for Realtek 8822CS (hci_ver 0x8) chipsets
- # For sunxi, these two patches are applied in a series.
- if linux-version compare "${version}" ge 5.11 && [[ "$LINUXFAMILY" != sunxi* ]] ; then
+ if linux-version compare "${version}" ge 5.11 && [ "$EXTRAWIFI" == yes ]; then
display_alert "Adding" "Bluetooth support for Realtek 8822CS (hci_ver 0x8) chipsets" "info"
process_patch_file "${SRC}/patch/misc/bluetooth-rtl8822cs-hci_ver-0x8.patch" "applying"
process_patch_file "${SRC}/patch/misc/Bluetooth-hci_h5-Add-power-reset-via-gpio-in-h5_btrt.patch" "applying"
-
fi
# Wireless drivers for Realtek 8723DS chipsets
diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh
index df9c85ee2..291cf7285 100644
--- a/lib/functions/compilation/kernel.sh
+++ b/lib/functions/compilation/kernel.sh
@@ -1,3 +1,39 @@
+function run_kernel_make() {
+ declare -a common_make_params_quoted common_make_envs full_command
+
+ common_make_envs=(
+ "CCACHE_BASEDIR=\"$(pwd)\"" # Base directory for ccache, for cache reuse
+ "PATH=\"${toolchain}:${PATH}\"" # Insert the toolchain first into the PATH.
+ )
+
+ common_make_params_quoted=(
+ "$CTHREADS" # Parallel compile, "-j X" for X cpus
+ "LOCALVERSION=-${LINUXFAMILY}" # Kernel param
+ "KDEB_PKGVERSION=${REVISION}" # deb package version
+ "KDEB_COMPRESS=${DEB_COMPRESS}" # dpkg compression for deb
+ "BRANCH=${BRANCH}" # @TODO: rpardini: Wonder what BRANCH is used for during packaging?
+ "ARCH=${ARCHITECTURE}" # Why?
+ "KBUILD_DEBARCH=${ARCH}" # Where used?
+ "DEBFULLNAME=${MAINTAINER}" # For changelog generation
+ "DEBEMAIL=${MAINTAINERMAIL}" # idem
+ "CROSS_COMPILE=${CCACHE} ${KERNEL_COMPILER}" # Prefix for tool invocations.
+ )
+
+ # last statement, so it passes the result to calling function.
+ full_command=("${KERNEL_MAKE_RUNNER:-run_host_command_logged}" "${common_make_envs[@]}" make "$@" "${common_make_params_quoted[@]@Q}")
+ display_alert "Kernel make" "${full_command[*]}" "debug"
+ # echo "${full_command[@]}" >&2 # last-resort bash-quoting debugging
+ "${full_command[@]}" # and exit with it's code, since it's the last statement
+}
+
+function run_kernel_make_dialog() {
+ KERNEL_MAKE_RUNNER="run_host_command_dialog" run_kernel_make "$@"
+}
+
+function run_kernel_make_long_running() {
+ KERNEL_MAKE_RUNNER="run_host_command_logged_long_running" run_kernel_make "$@"
+}
+
compile_kernel() {
if [[ $CLEAN_LEVEL == *make* ]]; then
display_alert "Cleaning" "$LINUXSOURCEDIR" "info"
@@ -18,14 +54,16 @@ compile_kernel() {
rm -f localversion
# read kernel version
- local version hash
+ local version hash pre_patch_version
version=$(grab_version "$kerneldir")
+ pre_patch_version="${version}"
+ display_alert "Pre-patch kernel version" "${pre_patch_version}" "debug"
# read kernel git hash
hash=$(improved_git --git-dir="$kerneldir"/.git rev-parse HEAD)
# Apply a series of patches if a series file exists
- if test -f "${SRC}"/patch/kernel/${KERNELPATCHDIR}/series.conf; then
+ if test -f "${SRC}"/patch/kernel/"${KERNELPATCHDIR}"/series.conf; then
display_alert "series.conf file visible. Apply"
series_conf="${SRC}"/patch/kernel/${KERNELPATCHDIR}/series.conf
@@ -33,7 +71,7 @@ compile_kernel() {
apply_patch_series "${kerneldir}" "$series_conf"
fi
- # build 3rd party drivers
+ # build 3rd party drivers; # @TODO: does it build? or only patch?
prepare_extra_kernel_drivers
advanced_patch "kernel" "$KERNELPATCHDIR" "$BOARD" "" "$BRANCH" "$LINUXFAMILY-$BRANCH"
@@ -61,7 +99,8 @@ compile_kernel() {
exit_with_error "Architecture [$ARCH] is not supported"
fi
- display_alert "Compiler version" "${KERNEL_COMPILER}gcc $(eval env PATH="${toolchain}:${PATH}" "${KERNEL_COMPILER}gcc" -dumpversion)" "info"
+ kernel_compiler_version="$(eval env PATH="${toolchain}:${PATH}" "${KERNEL_COMPILER}gcc" -dumpversion)"
+ display_alert "Compiler version" "${KERNEL_COMPILER}gcc ${kernel_compiler_version}" "info"
# copy kernel config
local COPY_CONFIG_BACK_TO=""
@@ -93,28 +132,26 @@ compile_kernel() {
fi
# hack for deb builder. To pack what's missing in headers pack.
- cp "${SRC}"/patch/misc/headers-debian-byteshift.patch /tmp
+ cp "${SRC}"/patch/misc/headers-debian-byteshift.patch /tmp # @TODO: ok, but why /tmp? It's leaking there.
display_alert "Kernel configuration" "${LINUXCONFIG}" "info"
if [[ $KERNEL_CONFIGURE != yes ]]; then
if [[ $BRANCH == default ]]; then
- run_host_command_logged CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${PATH}" \
- make "ARCH=$ARCHITECTURE" "CROSS_COMPILE=\"$CCACHE $KERNEL_COMPILER\"" silentoldconfig
+ run_kernel_make silentoldconfig # This will exit with generic error if it fails.
else
# TODO: check if required
- run_host_command_logged CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${PATH}" \
- make "ARCH=$ARCHITECTURE" "CROSS_COMPILE=\"$CCACHE $KERNEL_COMPILER\"" olddefconfig || {
+ run_kernel_make olddefconfig || {
exit_with_error "Error kernel olddefconfig"
}
fi
else
- run_host_command_logged CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${PATH}" \
- make "$CTHREADS" "ARCH=$ARCHITECTURE" "CROSS_COMPILE=\"$CCACHE $KERNEL_COMPILER\"" oldconfig
+ display_alert "Starting kernel oldconfig+menuconfig" "${LINUXCONFIG}" "debug"
+
+ run_kernel_make oldconfig
# No logging for this. this is UI piece
- CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${PATH}" \
- make "$CTHREADS" "ARCH=$ARCHITECTURE" "CROSS_COMPILE=\"$CCACHE $KERNEL_COMPILER\"" "${KERNEL_MENUCONFIG:-menuconfig}" || {
+ run_kernel_make_dialog "${KERNEL_MENUCONFIG:-menuconfig}" || {
exit_with_error "Error kernel menuconfig failed"
}
@@ -127,8 +164,7 @@ compile_kernel() {
# export defconfig too if requested
if [[ $KERNEL_EXPORT_DEFCONFIG == yes ]]; then
- run_host_command_logged CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${PATH}" \
- make "ARCH=$ARCHITECTURE" "CROSS_COMPILE=\"$CCACHE $KERNEL_COMPILER\"" savedefconfig
+ run_kernel_make savedefconfig
[[ -f defconfig ]] && cp defconfig "${DEST}/config/${LINUXCONFIG}.defconfig"
fi
@@ -142,11 +178,7 @@ compile_kernel() {
fi
display_alert "Compiling Kernel" "${LINUXCONFIG} ${KERNEL_IMAGE_TYPE}" "info"
- # shellcheck disable=SC2086 # sorry gotta expand the targets somewhere
- run_host_command_logged_long_running CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${PATH}" \
- make "$CTHREADS" "ARCH=$ARCHITECTURE" "CROSS_COMPILE=\"$CCACHE $KERNEL_COMPILER\"" \
- "$SRC_LOADADDR" "LOCALVERSION=\"-$LINUXFAMILY\"" \
- $KERNEL_IMAGE_TYPE ${KERNEL_EXTRA_TARGETS:-modules dtbs} || {
+ run_kernel_make_long_running "${KERNEL_IMAGE_TYPE}" modules "${KERNEL_EXTRA_TARGETS:-dtbs}" || {
exit_with_error "Failure during kernel compile" "@host"
}
@@ -164,17 +196,7 @@ compile_kernel() {
display_alert "Creating kernel packages" "${LINUXCONFIG} $kernel_packaging_target" "info"
# produce deb packages: image, headers, firmware, dtb
- run_host_command_logged_long_running CCACHE_BASEDIR="$(pwd)" env PATH="${toolchain}:${PATH}" \
- make "$CTHREADS" $kernel_packaging_target \
- "KDEB_PKGVERSION=$REVISION" \
- "KDEB_COMPRESS=${DEB_COMPRESS}" \
- "BRANCH=$BRANCH" \
- "LOCALVERSION=\"-${LINUXFAMILY}\"" \
- "KBUILD_DEBARCH=$ARCH" \
- "ARCH=$ARCHITECTURE" \
- "DEBFULLNAME=\"$MAINTAINER\"" \
- "DEBEMAIL=\"$MAINTAINERMAIL\"" \
- "CROSS_COMPILE=\"$CCACHE $KERNEL_COMPILER\"" || {
+ run_kernel_make_long_running $kernel_packaging_target || {
exit_with_error "Failure during kernel packaging" "@host"
}
@@ -259,7 +281,7 @@ create_linux-source_package() {
Description: This package provides the source code for the Linux kernel $version
EOF
- fakeroot dpkg-deb -b -Z${DEB_COMPRESS} -z0 "${sources_pkg_dir}" "${sources_pkg_dir}.deb"
+ fakeroot_dpkg_deb_build -z0 "${sources_pkg_dir}" "${sources_pkg_dir}.deb"
rsync --remove-source-files -rq "${sources_pkg_dir}.deb" "${DEB_STORAGE}/"
te=$(date +%s)
diff --git a/lib/functions/compilation/uboot.sh b/lib/functions/compilation/uboot.sh
index 666a84033..183298c4b 100644
--- a/lib/functions/compilation/uboot.sh
+++ b/lib/functions/compilation/uboot.sh
@@ -222,7 +222,7 @@ compile_uboot() {
[[ -n $atftempdir && -f $atftempdir/license.md ]] && cp "${atftempdir}/license.md" "$uboottempdir/${uboot_name}/usr/lib/u-boot/LICENSE.atf" 2>&1
display_alert "Building u-boot deb" "${uboot_name}.deb"
- fakeroot dpkg-deb -b -Z${DEB_COMPRESS} "$uboottempdir/${uboot_name}" "$uboottempdir/${uboot_name}.deb" 2>&1
+ fakeroot_dpkg_deb_build "$uboottempdir/${uboot_name}" "$uboottempdir/${uboot_name}.deb"
rm -rf "$uboottempdir/${uboot_name}"
[[ -n $atftempdir ]] && rm -rf "${atftempdir}"
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index 14953a5fe..612003391 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -190,7 +190,7 @@ function do_main_configuration() {
it is often used to in turn override those.
POST_FAMILY_CONFIG
- display_alert "Handling some" "desktop config stuff 1" "warning"
+ display_alert "Handling some" "desktop config stuff 1" "debug"
# Myy : Once we got a list of selected groups, parse the PACKAGE_LIST inside configuration.sh
DESKTOP_ELEMENTS_DIR="${SRC}/config/desktop/${RELEASE}"
@@ -216,6 +216,7 @@ function do_main_configuration() {
fi
fi
+ display_alert "Handling some" "desktop config stuff 2" "debug"
if [[ $BUILD_DESKTOP == "yes" ]]; then
# Expected environment variables :
@@ -226,6 +227,7 @@ function do_main_configuration() {
desktop_environment_check_if_valid
fi
+ display_alert "Handling some" "desktop config stuff 3" "debug"
if [[ $BUILD_DESKTOP == "yes" && -z $DESKTOP_ENVIRONMENT_CONFIG_NAME ]]; then
# FIXME Check for empty folders, just in case the current maintainer
@@ -249,6 +251,7 @@ function do_main_configuration() {
exit_with_error "No desktop configuration selected... Do you really want a desktop environment ?"
fi
fi
+ display_alert "Handling some" "desktop config stuff 4" "debug"
if [[ $BUILD_DESKTOP == "yes" ]]; then
DESKTOP_ENVIRONMENT_PACKAGE_LIST_DIRPATH="${DESKTOP_ENVIRONMENT_DIRPATH}/${DESKTOP_ENVIRONMENT_CONFIG_NAME}"
@@ -266,6 +269,7 @@ function do_main_configuration() {
options+=("${appgroup}" "${appgroup^}" off)
done
+ # FIXME: pardini: here's a subshell to run dialog. in the middle of the main config. refactor this away
DESKTOP_APPGROUPS_SELECTED=$(
show_select_menu \
"Choose desktop softwares to add" \
@@ -277,15 +281,18 @@ function do_main_configuration() {
unset options
fi
- #exit_with_error 'Testing'
+ display_alert "Done with" "desktop config stuff - END" "debug"
# set unique mounting directory
MOUNT_UUID=$(uuidgen)
- SDCARD="${SRC}/.tmp/rootfs-${MOUNT_UUID}"
- MOUNT="${SRC}/.tmp/mount-${MOUNT_UUID}"
- DESTIMG="${SRC}/.tmp/image-${MOUNT_UUID}"
- # dropbear needs to be configured differently
+ # Super-global variables, used everywhere. They're not _created_ here, since this is config stage, not build.
+ export WORKDIR="${SRC}/.tmp/work-${MOUNT_UUID}" # WORKDIR at this stage. It will become TMPDIR later. It has special significance to `mktemp` and others!
+ export SDCARD="${SRC}/.tmp/rootfs-${MOUNT_UUID}" # SDCARD (which is NOT an sdcard, but will be, maybe, one day) is where we work the rootfs before final imaging. "rootfs" stage.
+ export MOUNT="${SRC}/.tmp/mount-${MOUNT_UUID}" # MOUNT ("mounted on the loop") is the mounted root on final image (via loop). "image" stage
+ export DESTIMG="${SRC}/.tmp/image-${MOUNT_UUID}" # DESTIMG is where the backing image (raw, huge, sparse file) is kept
+
+ # dropbear needs to be configured differently # @TODO: rpardini: yes, and? are you a lost leftover comment from a previous era?
[[ $CRYPTROOT_ENABLE == yes && $RELEASE == xenial ]] && exit_with_error "Encrypted rootfs is not supported in Xenial"
[[ $RELEASE == stretch && $CAN_BUILD_STRETCH != yes ]] && exit_with_error "Building Debian Stretch images with selected kernel is not supported"
[[ $RELEASE == bionic && $CAN_BUILD_STRETCH != yes ]] && exit_with_error "Building Ubuntu Bionic images with selected kernel is not supported"
@@ -423,6 +430,7 @@ desktop/${RELEASE}/environments/${DESKTOP_ENVIRONMENT}/appgroups
but before assembling any package lists.
USER_CONFIG
+ display_alert "Extension initialization" "extension_prepare_config" "debug"
call_extension_method "extension_prepare_config" <<- 'EXTENSION_PREPARE_CONFIG'
*allow extensions to prepare their own config, after user config is done*
Implementors should preserve variable values pre-set, but can default values an/or validate them.
diff --git a/lib/functions/general/host.sh b/lib/functions/general/host.sh
index 3e750ebe7..5156c4ed8 100644
--- a/lib/functions/general/host.sh
+++ b/lib/functions/general/host.sh
@@ -243,11 +243,20 @@ prepare_host() {
find "${SRC}"/output "${USERPATCHES_PATH}" -type d ! -group sudo -exec chgrp --quiet sudo {} \;
find "${SRC}"/output "${USERPATCHES_PATH}" -type d ! -perm -g+w,g+s -exec chmod --quiet g+w,g+s {} \;
fi
- mkdir -p "${DEST}"/debs-beta/extra "${DEST}"/debs/extra "${DEST}"/{config,debug,patch} "${USERPATCHES_PATH}"/overlay "${SRC}"/cache/{sources,hash,hash-beta,toolchain,utility,rootfs} "${SRC}"/.tmp
+ # @TODO: rpardini: _very_ important spot, this is where ".tmp" is created. A _huge_ opportunity for tmpfs here.
+ display_alert "Creating directory structure: .tmp" "${SRC}/.tmp" "debug"
+ display_alert "Creating directory structure: DEST" "${DEST}" "debug"
+ mkdir -p "${DEST}"/debs-beta/extra "${DEST}"/debs/extra "${DEST}"/{config,debug,patch} \
+ "${USERPATCHES_PATH}"/overlay "${SRC}"/cache/{sources,hash,hash-beta,toolchain,utility,rootfs} \
+ "${SRC}"/.tmp "${WORKDIR}"
+
+ display_alert "Setting TMPDIR" "${WORKDIR}" "debug"
+ export TMPDIR="${WORKDIR}"
# build aarch64
if [[ $(dpkg --print-architecture) == amd64 ]]; then
if [[ "${SKIP_EXTERNAL_TOOLCHAINS}" != "yes" ]]; then
+ display_alert "Warning! SKIP_EXTERNAL_TOOLCHAINS is not yes. This is deprecated, upgrade!" "please set SKIP_EXTERNAL_TOOLCHAINS=yes" "deprecation"
# bind mount toolchain if defined
if [[ -d "${ARMBIAN_CACHE_TOOLCHAIN_PATH}" ]]; then
diff --git a/lib/functions/image/loop.sh b/lib/functions/image/loop.sh
index c248a0065..296697b44 100644
--- a/lib/functions/image/loop.sh
+++ b/lib/functions/image/loop.sh
@@ -31,7 +31,7 @@ write_uboot_to_loop_image() {
local loop=$1 revision
display_alert "Preparing u-boot bootloader" "$loop" "info"
- TEMP_DIR=$(mktemp -d || exit 1)
+ TEMP_DIR=$(mktemp -d) # set-e is in effect. no need to exit on errors explicitly
chmod 700 ${TEMP_DIR}
revision=${REVISION}
if [[ -n $UPSTREM_VER ]]; then
diff --git a/lib/functions/logging/logging.sh b/lib/functions/logging/logging.sh
index 01d6b67d7..765dda74f 100644
--- a/lib/functions/logging/logging.sh
+++ b/lib/functions/logging/logging.sh
@@ -119,6 +119,11 @@ display_alert() {
inline_logs_color="\e[0;32m"
;;
+ debug | deprecation)
+ level_indicator="✨" # "🌴" 🥑
+ inline_logs_color="\e[1;33m"
+ ;;
+
*)
level_indicator="🌿" # "✨" 🌿 🪵
inline_logs_color="\e[1;37m"
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index 2c99ae571..97b13ddef 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -16,7 +16,7 @@ function chroot_sdcard_apt_get() {
# please, please, unify around this function. if SDCARD is not enough, I'll make a mount version.
function chroot_sdcard() {
- run_host_command_logged_raw chroot "${SDCARD}" /bin/bash -e -c "$*"
+ TMPDIR="" run_host_command_logged_raw chroot "${SDCARD}" /bin/bash -e -c "$*"
}
function chroot_custom_long_running() {
@@ -24,10 +24,10 @@ function chroot_custom_long_running() {
shift
local _exit_code=1
if [[ "${SHOW_LOG}" == "yes" ]] || [[ "${CI}" == "true" ]]; then
- run_host_command_logged_raw chroot "${target}" /bin/bash -e -c "$*"
+ TMPDIR="" run_host_command_logged_raw chroot "${target}" /bin/bash -e -c "$*"
_exit_code=$?
else
- run_host_command_logged_raw chroot "${target}" /bin/bash -e -c "$*" | pv -N "$(logging_echo_prefix_for_pv "${INDICATOR:-compile}")" --progress --timer --line-mode --force --cursor --delay-start 0 -i "0.5"
+ TMPDIR="" run_host_command_logged_raw chroot "${target}" /bin/bash -e -c "$*" | pv -N "$(logging_echo_prefix_for_pv "${INDICATOR:-compile}")" --progress --timer --line-mode --force --cursor --delay-start 0 -i "0.5"
_exit_code=$?
fi
return $_exit_code
@@ -36,7 +36,13 @@ function chroot_custom_long_running() {
function chroot_custom() {
local target=$1
shift
- run_host_command_logged_raw chroot "${target}" /bin/bash -e -c "$*"
+ TMPDIR="" run_host_command_logged_raw chroot "${target}" /bin/bash -e -c "$*"
+}
+
+# for deb building.
+function fakeroot_dpkg_deb_build() {
+ display_alert "Building .deb package" "$(basename "${3:-${2:-${1}}}" || true)" "debug"
+ run_host_command_logged_raw fakeroot dpkg-deb -b "-Z${DEB_COMPRESS}" "$@" 2>&1
}
# for long-running, host-side expanded bash invocations.
@@ -60,6 +66,11 @@ function run_host_command_logged() {
run_host_command_logged_raw /bin/bash -e -c "$*"
}
+# for interactive, dialog-like host-side invocations. no redirections performed, but same bash usage and expansion, for consistency.
+function run_host_command_dialog() {
+ /bin/bash -e -c "$*"
+}
+
# do NOT use directly, it does NOT expand the way it should (through bash)
function run_host_command_logged_raw() {
# Log the command to the current logfile, so it has context of what was run.
diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh
index c03c16d84..bdc642ded 100644
--- a/lib/functions/main/config-prepare.sh
+++ b/lib/functions/main/config-prepare.sh
@@ -9,6 +9,7 @@ function prepare_and_config_main_build_single() {
else
DEST="${SRC}"/output
fi
+ display_alert "Determined DEST:" "${DEST}" "debug"
if [[ $BUILD_ALL != "yes" && -z $ROOT_FS_CREATE_ONLY ]]; then
if [[ -t 0 ]]; then # "-t fd return True if file descriptor fd is open and refers to a terminal". 0 = stdin, 1 = stdout, 2 = stderr, 3+ custom
@@ -116,7 +117,7 @@ function prepare_and_config_main_build_single() {
WIP_STATE=supported
WIP_BUTTON='CSC/WIP/EOS/TVB'
STATE_DESCRIPTION=' - boards with high level of software maturity'
- temp_rc=$(mktemp)
+ temp_rc=$(mktemp) # @TODO: this is a _very_ early call to mktemp - no TMPDIR set yet - it needs to be cleaned-up somehow
while true; do
options=()
diff --git a/lib/functions/main/rootfs-image.sh b/lib/functions/main/rootfs-image.sh
index a5ce58de8..9996d4b94 100644
--- a/lib/functions/main/rootfs-image.sh
+++ b/lib/functions/main/rootfs-image.sh
@@ -52,7 +52,7 @@ PRE_INSTALL_DISTRIBUTION_SPECIFIC
# install distribution and board specific applications
LOG_SECTION="distro" do_with_logging install_distribution_specific
- LOG_SECTION="install_common" do_with_logging install_distribution_agnostic
+ LOG_SECTION="install_distribution_agnostic" do_with_logging install_distribution_agnostic
# install locally built packages
[[ $EXTERNAL_NEW == compile ]] && LOG_SECTION="packages_local" do_with_logging chroot_installpackages_local
diff --git a/lib/functions/rootfs/apt.sh b/lib/functions/rootfs/apt.sh
index dd26c8b65..29833851a 100644
--- a/lib/functions/rootfs/apt.sh
+++ b/lib/functions/rootfs/apt.sh
@@ -3,16 +3,18 @@ apt_purge_unneeded_packages() {
display_alert "No longer needed packages" "purge" "info"
chroot_sdcard_apt_get autoremove
}
-# this is called by distributions.sh->install_common(), and thus already under a logging manager.
+
install_deb_chroot() {
local package=$1
local variant=$2
local transfer=$3
local name
local desc
+
if [[ ${variant} != remote ]]; then
# @TODO: this can be sped up significantly by mounting debs readonly directly in chroot /root/debs and installing from there
# also won't require cleanup later
+
name="/root/"$(basename "${package}")
[[ ! -f "${SDCARD}${name}" ]] && cp "${package}" "${SDCARD}${name}"
desc=""
@@ -21,11 +23,10 @@ install_deb_chroot() {
desc=" from repository"
fi
- # @TODO: this is mostly duplicated in distributions.sh->install_common(), refactor into "chroot_apt_get()"
display_alert "Installing${desc}" "${name/\/root\//}"
- [[ $NO_APT_CACHER != yes ]] && local apt_extra="-o Acquire::http::Proxy=\"http://${APT_PROXY_ADDR:-localhost:3142}\" -o Acquire::http::Proxy::localhost=\"DIRECT\""
+
# when building in bulk from remote, lets make sure we have up2date index
- [[ $BUILD_ALL == yes && ${variant} == remote ]] && chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get $apt_extra -yqq update"
+ [[ $BUILD_ALL == yes && ${variant} == remote ]] && chroot_sdcard_apt_get update
# install in chroot via apt-get, not dpkg, so dependencies are also installed from repo if needed.
chroot_sdcard_apt_get --no-install-recommends install "${name}" || {
@@ -33,8 +34,8 @@ install_deb_chroot() {
}
# @TODO: mysterious. store installed/downloaded packages in deb storage. only used for u-boot deb. why?
- [[ ${variant} == remote && ${transfer} == yes ]] && rsync -rq "${SDCARD}"/var/cache/apt/archives/*.deb ${DEB_STORAGE}/
+ [[ ${variant} == remote && ${transfer} == yes ]] && rsync -rq "${SDCARD}"/var/cache/apt/archives/*.deb "${DEB_STORAGE}"/
- # IMPORTANT! Do not use conditional above as last statement in a function, since it determines the result of the function.
+ # IMPORTANT! Do not use short-circuit above as last statement in a function, since it determines the result of the function.
return 0
}
diff --git a/lib/functions/rootfs/distro_agnostic.sh b/lib/functions/rootfs/distro_agnostic.sh
index 50e6e4923..a226ce0eb 100644
--- a/lib/functions/rootfs/distro_agnostic.sh
+++ b/lib/functions/rootfs/distro_agnostic.sh
@@ -1,5 +1,5 @@
install_distribution_agnostic() {
- display_alert "Applying common tweaks" "install_common" "info"
+ display_alert "Installing distro-agnostic part of rootfs" "install_distribution_agnostic" "debug"
# install rootfs encryption related packages separate to not break packages cache
# @TODO: terrible, this does not use apt-cacher, extract to extension and fix
From 9869508b622be33fe5114313c02d107b500f79aa Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 22 Dec 2021 19:39:26 +0100
Subject: [PATCH] logging: don't bail out on patching error
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
lib/functions/compilation/patching.sh | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/lib/functions/compilation/patching.sh b/lib/functions/compilation/patching.sh
index 7114cf0cd..52d00010f 100644
--- a/lib/functions/compilation/patching.sh
+++ b/lib/functions/compilation/patching.sh
@@ -87,14 +87,15 @@ process_patch_file() {
# detect and remove files which patch will create
lsdiff -s --strip=1 "${patch}" | grep '^+' | awk '{print $2}' | xargs -I % sh -c 'rm -f %'
- patch --batch -p1 -N < "${patch}" 2>&1
-
- if [[ $? -ne 0 ]]; then
+ # @TODO: try patching with `git am` first, so git contains the patch commit info/msg. -- For future git-based hashing.
+ # shellcheck disable=SC2015 # noted, thanks. I need to handle exit code here.
+ patch --batch -p1 -N < "${patch}" && {
+ display_alert "* $status $(basename "${patch}")" "" "info"
+ } || {
display_alert "* $status $(basename "${patch}")" "failed" "wrn"
[[ $EXIT_PATCHING_ERROR == yes ]] && exit_with_error "Aborting due to" "EXIT_PATCHING_ERROR"
- else
- display_alert "* $status $(basename "${patch}")" "" "info"
- fi
+ }
+ return 0 # short-circuit above, avoid exiting with error
}
# apply_patch_series <target dir> <full path to series file>
From 91806c9e0934a7d4a01425bf76c013dca110f5f0 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Wed, 22 Dec 2021 01:18:23 +0100
Subject: [PATCH] logging: bunch of fixes; no-stdin; traps; better stacks
- mostly no-stdin dialog handling (desktop et al)
- let ERR trap run together with unmount trap (EXIT etc)
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
compile.sh | 2 +-
lib/extensions.sh | 13 ++++++++++---
lib/functions/configuration/main-config.sh | 3 ++-
lib/functions/configuration/menu.sh | 13 ++++++++++---
lib/functions/general/repo.sh | 2 +-
lib/functions/logging/traps.sh | 5 ++---
lib/functions/main/config-prepare.sh | 17 +++++++++--------
lib/functions/rootfs/create-cache.sh | 11 ++++++-----
8 files changed, 41 insertions(+), 25 deletions(-)
diff --git a/compile.sh b/compile.sh
index f6a2cd8f5..d4d07cfe0 100755
--- a/compile.sh
+++ b/compile.sh
@@ -36,7 +36,7 @@ fi
source "${SRC}"/lib/single.sh
# hook up the error handler early, we wanna see stack for all errors.
-trap 'main_error_monitor "$?" "$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}")" "$(show_caller_full)"; exit 48' ERR EXIT
+trap 'main_error_monitor "$?" "$(show_caller_full)" "$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}")"; exit 48' ERR EXIT
# And execute the main entrypoint.
cli_entrypoint "$@"
diff --git a/lib/extensions.sh b/lib/extensions.sh
index 4ea9bb111..1f7cd2db8 100644
--- a/lib/extensions.sh
+++ b/lib/extensions.sh
@@ -339,12 +339,19 @@ get_extension_hook_stracktrace() {
show_caller_full() {
{
- local frame=0
- while caller $frame; do
- ((frame++))
+ local i=0
+ local line_no
+ local function_name
+ local file_name
+ echo "" # line break
+ while caller $i; do
+ ((i++))
+ done | while read -r line_no function_name file_name; do
+ echo -e "\t$file_name:$line_no\tat\t$function_name"
done
} || true # always success
}
+
# can be called by board, family, config or user to make sure an extension is included.
# single argument is the extension name.
# will look for it in /userpatches/extensions first.
diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh
index e7487efe5..14953a5fe 100644
--- a/lib/functions/configuration/main-config.sh
+++ b/lib/functions/configuration/main-config.sh
@@ -190,8 +190,9 @@ function do_main_configuration() {
it is often used to in turn override those.
POST_FAMILY_CONFIG
- # Myy : Once we got a list of selected groups, parse the PACKAGE_LIST inside configuration.sh
+ display_alert "Handling some" "desktop config stuff 1" "warning"
+ # Myy : Once we got a list of selected groups, parse the PACKAGE_LIST inside configuration.sh
DESKTOP_ELEMENTS_DIR="${SRC}/config/desktop/${RELEASE}"
DESKTOP_CONFIGS_DIR="${DESKTOP_ELEMENTS_DIR}/environments"
DESKTOP_CONFIG_PREFIX="config_"
diff --git a/lib/functions/configuration/menu.sh b/lib/functions/configuration/menu.sh
index 12880526c..32939ae36 100644
--- a/lib/functions/configuration/menu.sh
+++ b/lib/functions/configuration/menu.sh
@@ -1,5 +1,12 @@
# Stuff involving dialog
+# Pardini: dialog_if_terminal prints error and exits if stdin is not a terminal, or if running under CI.
+function dialog_if_terminal() {
+ [[ ! -t 0 ]] && exit_with_error "stdin is not a terminal. can't use dialog." "dialog_if_terminal ${*}" "err"
+ [[ "${CI}" == "true" ]] && exit_with_error "CI=true. can't use dialog." "dialog_if_terminal ${*}" "err"
+ dialog "$@"
+}
+
# Myy : Menu configuration for choosing desktop configurations
show_menu() {
provided_title=$1
@@ -11,7 +18,7 @@ show_menu() {
#echo "Provided menuname : $provided_menuname"
#echo "Provided options : " "${@:4}"
#echo "TTY X: $TTY_X Y: $TTY_Y"
- dialog --stdout --title "$provided_title" --backtitle "${provided_backtitle}" \
+ dialog_if_terminal --stdout --title "$provided_title" --backtitle "${provided_backtitle}" \
--menu "$provided_menuname" $TTY_Y $TTY_X $((TTY_Y - 8)) "${@:4}"
}
@@ -20,7 +27,7 @@ show_select_menu() {
provided_title=$1
provided_backtitle=$2
provided_menuname=$3
- dialog --stdout --title "${provided_title}" --backtitle "${provided_backtitle}" \
+ dialog_if_terminal --stdout --title "${provided_title}" --backtitle "${provided_backtitle}" \
--checklist "${provided_menuname}" $TTY_Y $TTY_X $((TTY_Y - 8)) "${@:4}"
}
@@ -44,7 +51,7 @@ show_developer_warning() {
- Forum posts related to dev kernel, CSC, WIP and EOS boards
should be created in the \Z2\"Community forums\"\Zn section
"
- DIALOGRC=$temp_rc dialog --title "Expert mode warning" --backtitle "${backtitle}" --colors --defaultno --no-label "I do not agree" \
+ DIALOGRC=$temp_rc dialog_if_terminal --title "Expert mode warning" --backtitle "${backtitle}" --colors --defaultno --no-label "I do not agree" \
--yes-label "I understand and agree" --yesno "$warn_text" "${TTY_Y}" "${TTY_X}"
[[ $? -ne 0 ]] && exit_with_error "Error switching to the expert mode"
SHOW_WARNING=no
diff --git a/lib/functions/general/repo.sh b/lib/functions/general/repo.sh
index f54d59562..be3121527 100644
--- a/lib/functions/general/repo.sh
+++ b/lib/functions/general/repo.sh
@@ -193,7 +193,7 @@ repo-manipulate() {
LIST=("${new_list[@]}")
LIST_LENGTH=$((${#LIST[@]} / 2))
exec 3>&1
- TARGET_VERSION=$(dialog --cancel-label "Cancel" --backtitle "BACKTITLE" --no-collapse --title "Remove packages from repositories" --clear --menu "Delete" $((9 + ${LIST_LENGTH})) 82 65 "${LIST[@]}" 2>&1 1>&3)
+ TARGET_VERSION=$(dialog_if_terminal --cancel-label "Cancel" --backtitle "BACKTITLE" --no-collapse --title "Remove packages from repositories" --clear --menu "Delete" $((9 + ${LIST_LENGTH})) 82 65 "${LIST[@]}" 2>&1 1>&3)
exitstatus=$?
exec 3>&-
if [[ $exitstatus -eq 0 ]]; then
diff --git a/lib/functions/logging/traps.sh b/lib/functions/logging/traps.sh
index fa1abd262..9a5daa670 100644
--- a/lib/functions/logging/traps.sh
+++ b/lib/functions/logging/traps.sh
@@ -1,12 +1,11 @@
# unmount_on_exit - used during rootfs building, to avoid leaving mounted stuff behind
#
unmount_on_exit() {
- trap - ERR # Also remove any error trap. it's too late for that.
set +e # we just wanna plow through this, ignoring errors.
trap - INT TERM EXIT # remove the trap
local stack_here
- stack_here="$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}")"
+ stack_here="$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}" || true)"
display_alert "trap caught, shutting down" "${stack_here}" "err"
if [[ "${ERROR_DEBUG_SHELL}" == "yes" ]]; then
ERROR_DEBUG_SHELL=no # dont do it twice
@@ -39,7 +38,7 @@ unmount_on_exit() {
exit_with_error "generic error during build_rootfs_image: ${stack_here}" || true # but don't trigger error again
fi
- return 47 # trap returns error. # exit successfully. we're already handling a trap here.
+ return 49 # trap returns error.
}
# added by main_default_build_single to show details about errors when they happen and exit. exit might trigger the above.
diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh
index 0dd34a875..c03c16d84 100644
--- a/lib/functions/main/config-prepare.sh
+++ b/lib/functions/main/config-prepare.sh
@@ -11,7 +11,8 @@ function prepare_and_config_main_build_single() {
fi
if [[ $BUILD_ALL != "yes" && -z $ROOT_FS_CREATE_ONLY ]]; then
- if [[ -t 1 ]]; then # "-t fd return True if file descriptor fd is open and refers to a terminal"
+ if [[ -t 0 ]]; then # "-t fd return True if file descriptor fd is open and refers to a terminal". 0 = stdin, 1 = stdout, 2 = stderr, 3+ custom
+ display_alert "stdin is a terminal" "or is it?" "warning"
# override stty size, if stdin is a terminal.
[[ -n $COLUMNS ]] && stty cols $COLUMNS
[[ -n $LINES ]] && stty rows $LINES
@@ -95,7 +96,7 @@ function prepare_and_config_main_build_single() {
if [[ -z $KERNEL_ONLY ]]; then
options+=("yes" "U-boot and kernel packages")
options+=("no" "Full OS image for flashing")
- KERNEL_ONLY=$(dialog --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags \
+ KERNEL_ONLY=$(dialog_if_terminal --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags \
--menu "Select what to build" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
unset options
[[ -z $KERNEL_ONLY ]] && exit_with_error "No option selected"
@@ -105,7 +106,7 @@ function prepare_and_config_main_build_single() {
options+=("no" "Do not change the kernel configuration")
options+=("yes" "Show a kernel configuration menu before compilation")
options+=("prebuilt" "Use precompiled packages from Armbian repository")
- KERNEL_CONFIGURE=$(dialog --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags \
+ KERNEL_CONFIGURE=$(dialog_if_terminal --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags \
--menu "Select the kernel configuration" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
unset options
[[ -z $KERNEL_CONFIGURE ]] && exit_with_error "No option selected"
@@ -150,7 +151,7 @@ function prepare_and_config_main_build_single() {
else
echo > "${temp_rc}"
fi
- BOARD=$(DIALOGRC=$temp_rc dialog --stdout --title "Choose a board" --backtitle "$backtitle" --scrollbar \
+ BOARD=$(DIALOGRC=$temp_rc dialog_if_terminal --stdout --title "Choose a board" --backtitle "$backtitle" --scrollbar \
--colors --extra-label "Show $WIP_BUTTON" --extra-button \
--menu "Select the target board. Displaying:\n$STATE_DESCRIPTION" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
STATUS=$?
@@ -206,7 +207,7 @@ function prepare_and_config_main_build_single() {
if [[ "${#options[@]}" == 2 ]]; then
BRANCH="${options[0]}"
else
- BRANCH=$(dialog --stdout --title "Choose a kernel" --backtitle "$backtitle" --colors \
+ BRANCH=$(dialog_if_terminal --stdout --title "Choose a kernel" --backtitle "$backtitle" --colors \
--menu "Select the target kernel branch\nExact kernel versions depend on selected board" \
$TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
fi
@@ -223,7 +224,7 @@ function prepare_and_config_main_build_single() {
if [[ $KERNEL_ONLY != yes && -z $RELEASE ]]; then
options=()
distros_options
- RELEASE=$(dialog --stdout --title "Choose a release package base" --backtitle "$backtitle" \
+ RELEASE=$(dialog_if_terminal --stdout --title "Choose a release package base" --backtitle "$backtitle" \
--menu "Select the target OS release package base" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
echo "options : ${options}"
[[ -z $RELEASE ]] && exit_with_error "No release selected"
@@ -239,7 +240,7 @@ function prepare_and_config_main_build_single() {
options=()
options+=("no" "Image with console interface (server)")
options+=("yes" "Image with desktop environment")
- BUILD_DESKTOP=$(dialog --stdout --title "Choose image type" --backtitle "$backtitle" --no-tags \
+ BUILD_DESKTOP=$(dialog_if_terminal --stdout --title "Choose image type" --backtitle "$backtitle" --no-tags \
--menu "Select the target image type" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
unset options
[[ -z $BUILD_DESKTOP ]] && exit_with_error "No option selected"
@@ -253,7 +254,7 @@ function prepare_and_config_main_build_single() {
options=()
options+=("no" "Standard image with console interface")
options+=("yes" "Minimal image with console interface")
- BUILD_MINIMAL=$(dialog --stdout --title "Choose image type" --backtitle "$backtitle" --no-tags \
+ BUILD_MINIMAL=$(dialog_if_terminal --stdout --title "Choose image type" --backtitle "$backtitle" --no-tags \
--menu "Select the target image type" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
unset options
[[ -z $BUILD_MINIMAL ]] && exit_with_error "No option selected"
diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh
index ab900d508..f969159cf 100644
--- a/lib/functions/rootfs/create-cache.sh
+++ b/lib/functions/rootfs/create-cache.sh
@@ -239,13 +239,13 @@ function create_new_rootfs_cache() {
[[ -d "${MOUNT}" ]] &&
display_alert "Mount point" "$(echo -e "$freespace" | grep $MOUNT | head -1 | awk '{print $5}')" "info"
- # create list of installed packages for debug purposes
- chroot $SDCARD /bin/bash -c "dpkg --get-selections" | grep -v deinstall | awk '{print $1}' | cut -f1 -d':' > ${cache_fname}.list 2>&1
+ # create list of installed packages for debug purposes - this captures it's own stdout.
+ chroot "${SDCARD}" /bin/bash -c "dpkg --get-selections" | grep -v deinstall | awk '{print $1}' | cut -f1 -d':' > "${cache_fname}.list"
# creating xapian index that synaptic runs faster
if [[ $BUILD_DESKTOP == yes ]]; then
display_alert "Recreating Synaptic search index" "Please wait" "info"
- chroot $SDCARD /bin/bash -c "[[ -f /usr/sbin/update-apt-xapian-index ]] && /usr/sbin/update-apt-xapian-index -u"
+ chroot_sdcard "[[ -f /usr/sbin/update-apt-xapian-index ]] && /usr/sbin/update-apt-xapian-index -u || true"
fi
# this is needed for the build process later since resolvconf generated file in /run is not saved
@@ -260,7 +260,7 @@ function create_new_rootfs_cache() {
umount_chroot "$SDCARD"
tar cp --xattrs --directory=$SDCARD/ --exclude='./dev/*' --exclude='./proc/*' --exclude='./run/*' --exclude='./tmp/*' \
- --exclude='./sys/*' . | pv -p -b -r -s $(du -sb $SDCARD/ | cut -f1) -N "$(logging_echo_prefix_for_pv "store_rootfs") $display_name" | lz4 -5 -c > $cache_fname
+ --exclude='./sys/*' . | pv -p -b -r -s "$(du -sb $SDCARD/ | cut -f1)" -N "$(logging_echo_prefix_for_pv "store_rootfs") $display_name" | lz4 -5 -c > "$cache_fname"
# sign rootfs cache archive that it can be used for web cache once. Internal purposes
if [[ -n "${GPG_PASS}" && "${SUDO_USER}" ]]; then
@@ -268,6 +268,7 @@ function create_new_rootfs_cache() {
echo "${GPG_PASS}" | sudo -H -u ${SUDO_USER} bash -c "gpg --passphrase-fd 0 --armor --detach-sign --pinentry-mode loopback --batch --yes ${cache_fname}" || exit 1
fi
+ return 0 # protect against possible future short-circuiting above this
}
# get_package_list_hash
@@ -278,7 +279,7 @@ get_package_list_hash() {
local list_content
read -ra package_arr <<< "${DEBOOTSTRAP_LIST} ${PACKAGE_LIST}"
read -ra exclude_arr <<< "${PACKAGE_LIST_EXCLUDE}"
- (
+ (
(
printf "%s\n" "${package_arr[@]}"
printf -- "-%s\n" "${exclude_arr[@]}"
From 70b9182fb02337c6c8d023469571acb2f1462317 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 20 Dec 2021 23:29:18 +0100
Subject: [PATCH] logging: trap ERR very early, pass-in caller info
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
compile.sh | 3 +++
lib/extensions.sh | 13 ++++++++-----
lib/functions/logging/runners.sh | 2 +-
lib/functions/logging/traps.sh | 28 +++++++++++++++++-----------
lib/functions/main/default-build.sh | 2 --
5 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/compile.sh b/compile.sh
index 23919ae91..f6a2cd8f5 100755
--- a/compile.sh
+++ b/compile.sh
@@ -35,5 +35,8 @@ fi
# shellcheck source=lib/single.sh
source "${SRC}"/lib/single.sh
+# hook up the error handler early, we wanna see stack for all errors.
+trap 'main_error_monitor "$?" "$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}")" "$(show_caller_full)"; exit 48' ERR EXIT
+
# And execute the main entrypoint.
cli_entrypoint "$@"
diff --git a/lib/extensions.sh b/lib/extensions.sh
index d8b3aed9c..4ea9bb111 100644
--- a/lib/extensions.sh
+++ b/lib/extensions.sh
@@ -328,7 +328,8 @@ get_extension_hook_stracktrace() {
source="${source#"lib/functions/"}"
source="${source#"lib/"}"
# add to the list
- arrow="$([[ "$final_stack" != "" ]] && echo "-> ")"
+ # shellcheck disable=SC2015 # i know. thanks. I won't write an if here
+ arrow="$([[ "$final_stack" != "" ]] && echo "-> " || true)"
final_stack="${source}:${line} ${arrow} ${final_stack} "
done
# output the result, no newline
@@ -337,10 +338,12 @@ get_extension_hook_stracktrace() {
}
show_caller_full() {
- local frame=0
- while caller $frame; do
- ((frame++))
- done
+ {
+ local frame=0
+ while caller $frame; do
+ ((frame++))
+ done
+ } || true # always success
}
# can be called by board, family, config or user to make sure an extension is included.
# single argument is the extension name.
diff --git a/lib/functions/logging/runners.sh b/lib/functions/logging/runners.sh
index ef0c2389c..2c99ae571 100644
--- a/lib/functions/logging/runners.sh
+++ b/lib/functions/logging/runners.sh
@@ -49,7 +49,7 @@ function run_host_command_logged_long_running() {
run_host_command_logged_raw /bin/bash -e -c "$*"
_exit_code=$?
else
- run_host_command_logged_raw /bin/bash -e -c "$*" | pv -N "$(logging_echo_prefix_for_pv "${INDICATOR:-compile}")" --progress --timer --line-mode --force --cursor --delay-start 0 -i "0.5"
+ run_host_command_logged_raw /bin/bash -e -c "$*" | pv -N "$(logging_echo_prefix_for_pv "${INDICATOR:-compile}") " --progress --timer --line-mode --force --cursor --delay-start 0 -i "2"
_exit_code=$?
fi
return $_exit_code
diff --git a/lib/functions/logging/traps.sh b/lib/functions/logging/traps.sh
index 9edd1d956..fa1abd262 100644
--- a/lib/functions/logging/traps.sh
+++ b/lib/functions/logging/traps.sh
@@ -5,9 +5,9 @@ unmount_on_exit() {
set +e # we just wanna plow through this, ignoring errors.
trap - INT TERM EXIT # remove the trap
- local stacktrace
- stacktrace="$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}")"
- display_alert "trap caught, shutting down" "${stacktrace}" "err"
+ local stack_here
+ stack_here="$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}")"
+ display_alert "trap caught, shutting down" "${stack_here}" "err"
if [[ "${ERROR_DEBUG_SHELL}" == "yes" ]]; then
ERROR_DEBUG_SHELL=no # dont do it twice
display_alert "MOUNT" "${MOUNT}" "err"
@@ -36,7 +36,7 @@ unmount_on_exit() {
# if we've been called by exit_with_error itself, don't recurse.
if [[ "${ALREADY_EXITING_WITH_ERROR:-no}" != "yes" ]]; then
- exit_with_error "generic error during build_rootfs_image: ${stacktrace}" || true # but don't trigger error again
+ exit_with_error "generic error during build_rootfs_image: ${stack_here}" || true # but don't trigger error again
fi
return 47 # trap returns error. # exit successfully. we're already handling a trap here.
@@ -44,11 +44,17 @@ unmount_on_exit() {
# added by main_default_build_single to show details about errors when they happen and exit. exit might trigger the above.
function main_error_monitor() {
- trap - ERR # remove this trap
- local stacktrace
- stacktrace="$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}" || true)"
- display_alert "main_error_monitor! '$*'" "${stacktrace}" "err"
- show_caller_full >&2 || true
- display_alert "main_error_monitor2! '$*'" "${stacktrace}" "err"
- exit 46
+ if [[ "${ALREADY_EXITING_WITH_ERROR}" == "yes" ]]; then
+ display_alert "second run detected" "ERR trap" "err"
+ #exit 46
+ fi
+ #trap - ERR # remove this trap
+ local errcode="${1}"
+ local stack_caller="${2}"
+ local full_stack_caller="${3}"
+ display_alert "main_error_monitor: ${errcode}! stack:" "${stack_caller}" "err"
+ display_alert "main_error_monitor: ${errcode}! full:" "${full_stack_caller}" "err"
+ ALREADY_EXITING_WITH_ERROR=yes
+ exit 45
+ return 44
}
diff --git a/lib/functions/main/default-build.sh b/lib/functions/main/default-build.sh
index 2bd62724f..e9f3af0ed 100644
--- a/lib/functions/main/default-build.sh
+++ b/lib/functions/main/default-build.sh
@@ -10,8 +10,6 @@ main_default_build_single() {
exit 0
fi
- trap 'main_error_monitor $?' ERR
-
if [[ $CLEAN_LEVEL == *sources* ]]; then
cleaning "sources"
fi