59 Commits

Author SHA1 Message Date
Ricardo Pardini
fdde912ebf uboot: debug u-boot directory contents before/after patching
- with DEBUG=yes, allows us to see what is leftover in directory during builds
- with new cleaning in separate commit, there shouldn't be any leftovers _at all_
2025-01-05 16:38:43 +01:00
Ricardo Pardini
79db9984f1 uboot: completely clean before building each target; slower but correct
- with this, every u-boot build will be a full rebuild.
  - still, building u-boot is pretty fast
  - and it is better to be a bit slower and actually produce correct results
2025-01-05 16:38:43 +01:00
Ricardo Pardini
7aeb48f172 u-boot: add per-target and general metadata files to u-boot package
- incl some indicative fdt/extlinux/gpt info
- include full config and defconfig for each target
- mark the old .config file as legacy (it was always the last-target's config)
- fix: savedefconfig after build, not before (as target_map might change it)
- fix: some very old u-boots (2011, odroidc1) do not have `savedefconfig` at all, so make it optional
- fix: same for `.config` -- very old u-boots worked different (`boards.cfg`?)
2025-01-05 16:38:43 +01:00
Ricardo Pardini
a55c8bfcb2 u-boot: check the produced platform_install.sh (created from functions like write_uboot_platform) for shellcheck errors
- we've some smelly stuff in write_uboot_platform for some families that we'd rather catch early
- implement small syntax fixes in setup_write_uboot_platform
2024-12-09 14:12:44 +01:00
ColorfulRhino
7e9adb3811 cli: uboot: Move uboot_cflags variable to before its first use 2024-07-18 11:42:16 +02:00
ColorfulRhino
5bb665f965 cli: uboot: Remove HOME workaround for old tinkerboard/xt-q8l-v10 U-Boot
This temporary workaround was only needed for tinkerboard and xt-q8l-v10 version 2022.04 U-Boot. The version has since bumped to 2024.07 and builds fine without this.
2024-07-08 13:02:15 +02:00
Ricardo Pardini
4232661c37 u-boot: embed armbian artifact version in CONFIG_LOCALVERSION
- we're hacking at it anyway, so why not use it to uniquely identify the exact build
2024-07-07 13:06:56 +02:00
Ricardo Pardini
d9b67b37d5 u-boot: use pipetty in place of unbuffer
- unbuffer never solved anything; pipetty might
2024-07-03 06:44:16 +02:00
Patrick Yavitz
e81998fa81 cli: uboot.sh: Copy over itb from atftempdir
Signed-off-by: Patrick Yavitz <pyavitz@armbian.com>
2024-07-01 19:15:00 +02:00
Ricardo Pardini
21a6b2cab3 u-boot: add HOME env for make invocations to avoid binman/Python problems with older u-boot versions
- this avoids trouble building certain older versions with binman
  - as it tries to `os.path.join(os.getenv('HOME'), 'bin')` and gets a `None` and dies
- naming names: `tinkerboard` & `xt-q8l-v10` (BOARDFAMILY=rockchip), which _actually use_ binman & 22.04 combo
2024-06-30 21:23:04 +02:00
ColorfulRhino
792d9d9dc3 cli: uboot: Include PYTHONPATH in env for compiling U-Boot
- Also group all u-boot make environment variables together for easier maintainability
- Fixes u-boot requiring `pyelftools`
- Fixes commit 04f619dc06
2024-06-30 09:22:17 +02:00
Ricardo Pardini
40371934d2 lib & config: give shellcheck directions (to /dev/null for dynamic, to repo-relative path for static) for all sourced references
- in preparation for tightening the shellcheck severity level
  - it needs to be able to follow all sources; dynamic ones are ignored, static ones need root-relative prefix
2024-05-19 19:41:35 +02:00
Ricardo Pardini
49e86b2cff u-boot: call olddefconfig after config hooks; use pipetty instead of unbuffer for make
- also: cli `uboot-config` produces a defconfig diff (useful to create post_config_uboot_target)
2024-03-02 20:48:01 +01:00
Gunjan Gupta
2341940cbe Fix broken compilation for boards with multiple targets 2024-02-04 16:23:09 +01:00
Gunjan Gupta
473548220c uboot: make sure patches work for custom uboot builds too 2024-02-04 11:22:27 +01:00
Gunjan Gupta
d9d6524e7f Add hook to allow forcing uboot update 2024-01-30 12:00:24 +01:00
Ricardo Pardini
0047f8e3bd dpkg-deb: rename fakeroot_dpkg_deb_build -> dpkg_deb_build 2023-10-13 18:04:56 +02:00
Ricardo Pardini
2142f73b97 hashed-OCI-revisioned-debs: introduce "reversioning" of .deb packages
> tl-dr:
> - maximize OCI cache hit ratio across nightlies/releases/PRs/etc;
> - publish simple `Version:`'s that don't include a crazy hash in repo and images
> - introduce `output/packages-hashed` directory
> - radically change the `output/debs` directory structure

- simplify artifact's `prepare_version()` method for `deb` and `deb-tar` artifacts:
  - `artifact_base_dir` and `artifact_final_file` will now be auto-calculated; thus removed from each artifact (except `rootfs`)
  - `artifact_deb_repo` ("global", "jammy", "bookworm") is now required; "global" means common across all RELEASES
  - `artifact_deb_arch` is now required, "all" is arch-independent, otherwise use `${ARCH}`
  - `artifact_map_debs` is now auto-calculated based on the above, and shouldn't be specified manually
  - `artifact_final_version_reversioned` is optional, and can force the final version of the artifact (specific for the `base-files` case)
  - artifacts that need special handling for reversioning can add function names to `artifact_debs_reversion_functions` array (`base-files` and `bsp-cli` cases)
  - artifacts `prepare_version()` should set `artifact_version`, but _never_ include it in other variables; `artifact_version` is now changed by framework after `prepare_version()` returns
- no longer use/refer/mention `${REVISION}` when building packages. All packages should be `${REVISION}`-agnostic.
- `${REVISION}` (actually, `artifact_final_version_reversioned`) will be automatically swapped in the `control` file during reversioning
- `fakeroot_dpkg_deb_build()` now takes exactly two arguments: the directory to pack, and the deb ID (key of `artifact_map_packages` dict); add this change in all the artifact's code for this
- `obtain_complete_artifact()`:
  - automatically adds `-Rxxxx` "revisioning-hash" to `artifact_version`, by hashing the revisioning functions and any `artifact_debs_reversion_functions` set
  - calculates more complex subdirectory paths for both the `output/packages-hashed` and `output/debs`/`output/debs-beta` directories
    - with the new subdirectories we can be sure a re-version is already done correctly and can skip it (eg, for partial `download-debs` re-runs)
    - in the future we can automatically clean/remove old versions that are no longer relevant based on the dir structure
    - exports a lot more information to JSON, including the new subdirectory paths
  - comment-out code that implemented `skip_unpack_if_found_in_caches`, I'm very unsure why we had this in the first place
- `obtain_artifact_from_remote_cache()`
  - for `deb` type artifacts, OCI won't preserve the subdirectory structure, so move downloaded files to the correct subdirectory manually
  - this is not needed for `deb-tar`, since that can preserve the dir structure itself
- introduce `artifacts-reversion.sh` and its main function `artifact_reversion_for_deployment()`
  - this has the logic for reversioning .deb's, by `ar`-unpacking them, changing `control.tar` (and possibly `data.tar`), handling `.xz` compression, etc.
  - also handles hashing those functions, for consistency. Any changes in reversioning code actually change the artifact itself so we're not caught by surprise
  - by default, it changes `control` file only:
    - replace `Version:` (which is the hash-version originally) with `artifact_final_version_reversioned` (which is mostly just `${REVISION}`)
    - add a custom field `Armbian-Original-Hash:` with the original hash-version
  - `artifact_reversion_for_deployment()` is called by
    - new CLI wrapper `cli_obtain_complete_artifact()`, used for CLI building of specific artifact, but also for `download-artifact`
    - `build_artifact_for_image()` used during image build
- `armbian-bsp-cli-deb.sh`: move `${REVISION}` related stuff from the main package build to new reversioning functions.
- `artifact-armbian-base-files.sh`: move `${REVISION}` related stuff from the main package build to new reversioning functions.
- `kernel`:
  - add some custom fields to `DEBIAN/control`:
    - `Armbian-Kernel-Version:` / `Armbian-Kernel-Version-Family:` (for future use: cleanup of usage of `Source: ` field which should be removed)
  - declutter the `Description:` field, moving long description out of the first line
  - obtain `IMAGE_INSTALLED_KERNEL_VERSION` from the reversioned deb (this is still a hack and has not been fixed)
- `uboot`:
  - declutter the `Description:` field, moving long description out of the first line
  - use the reversioned .deb when deploying u-boot to the image
- `main_default_build_packages()` now stores reversioned values and complete paths to reversioned .deb's
- `list_installed_packages()` now compares custom field `Armbian-Original-Hash: `, and not the `Version:` to make sure debs in the image are the ones we want
- `install_artifact_deb_chroot()` is a new wrapper around `install_deb_chroot()` for easy handling of reversioned debs
  - use it everywhere `install_deb_chroot()` was used in `distro-agnostic.sh` and `distro-specific.sh`
2023-08-12 09:58:32 +02:00
Ricardo Pardini
7129f7ac28 uboot: drop CHOSEN_UBOOT, change deployment directory, remove uboot_name as temp_dir prefix
- change deployment dir to not include REVISION or ARCH
- get rid uboot's CHOSEN_UBOOT, REVISION and ARCH in the directory name.
- no two u-boot debs can be installed in the same machine anyway
2023-08-12 09:58:32 +02:00
Ricardo Pardini
a592ab763c hashed-OCI-revisioned-debs: build debs in PACKAGES_HASHED_STORAGE, not DEB_STORAGE (temp commit, will be rewritten by a later commit)
- fakeroot_dpkg_deb_build() now only takes a single argument, the unpacked package dir
2023-08-12 09:58:32 +02:00
Ricardo Pardini
3970058720 uboot: allow adding/changing uboot CFLAGS with post_config_uboot_target() hook 2023-07-12 00:51:21 +02:00
Ricardo Pardini
38149f278f debs: remove Installed-Size: 1 from control files; Installed-Size is properly calculated at fakeroot_dpkg_deb_build() for all packages 2023-07-05 21:22:47 +02:00
Ricardo Pardini
079549b7fb u-boot: log what the BOOTCONFIG is when building 2023-07-01 14:50:05 +02:00
Gunjan Gupta
8278dc5e42 allwinner: Enable crust compilation 2023-06-20 21:36:31 +02:00
Ricardo Pardini
bffcfc4f66 uboot: introduce hook post_config_uboot_target
- runs after other configuration changes, but before actually compiling a target
- useful to hack into `.config` for a specific target
2023-06-02 19:33:12 +02:00
Ricardo Pardini
d890b418c7 kernel/uboot/atf: introduce kernel-patch, uboot-patch, atf-patch, uboot-config, kernel-config CLI commands; enhanced manual patching; block deprecated ways
- all interactive commands now **don't build the artifact** anymore; just patches/.configs are produced and then build ends
  - user is required to put the produced patches in the right place and build again, for full consistency
- split ATF and U-BOOT manual patching process; use CLI command `atf-patch` to patch ATF, and `uboot-patch` to patch u-boot
- non-interactive artifact builds are now 100% sans-stdin
- introduce `uboot-config` CLI command; still experimental, only produces a defconfig and not a patch
- reworked `userpatch_create()` to be (hopefully) more useful:
  - detects a previous patch and offers to apply it before continuing
  - enters a loop showing the diff, and only proceeds when user indicates he's happy with the patch
  - produces `mbox`-formatted patches via `format-patch` and standard Armbian parameters
  - uses MAINTAINER and MAINTAINERMAIL instead of git configuration (so it works in containers)
- don't allow image builds with any patching or configuring _at all_ (it has been deprecated with a warning for months already, and results are inconsistent)
2023-05-01 22:46:55 +02:00
Ricardo Pardini
6b1055dc9d uboot: WiP: introduce UBOOT_CONFIGURE=yes -- saves defconfig to output/ folder, nothing else (no patches, etc) 2023-04-03 21:21:03 +02:00
Ricardo Pardini
ed0b406265 lib: fix: replace undue export statements with declare -g 2023-03-31 09:12:44 +02:00
Ricardo Pardini
ff657fcf90 artifacts (all): require prefixing of artifact_version with artifact_prefix_version (which is ${REVISION}--) 2023-03-17 08:32:11 +01:00
Ricardo Pardini
bdec7c7c23 compilation: uboot: manage shopt nullglob same way as IFS, so UBOOT_TARGET_MAP's with * somewhere are not skipped [fixed]
- add some debugs
- don't fail for no good reason (shopt -p has some crazy exit code logic)
2023-03-10 10:49:45 -03:00
Igor Pečovnik
b7b8eb7b72
Add / modify (c) in bash scripts (#4922)
* Add / modify (c) in bash scripts

Signed-off-by: Igor <igor@armbian.com>

* Add (c) to the source config files

---------

Signed-off-by: Igor <igor@armbian.com>
2023-03-09 18:30:40 +01:00
Ricardo Pardini
9bffa5e749
armbian-next: artifacts: firmware/rootfs and actual usage of artifacts during image build
- artifacts: introduce `ARTIFACT_IGNORE_CACHE=yes`
- artifacts: introduce `DONT_BUILD_ARTIFACTS`, list of artifacts that if not found cached, fail the build
- kernel_package_source() is no more
- a long dissertation about kernels, families, and the universe
- artifacts: actually use rootfs artifact for image build
- artifacts: detangle via artifact_base_dir
- artifacts: rootfs: use folders in artifact_name; include cache_type
- artifacts: some cleanups / validations
- rootfs artifact; drop old rootfs cli
- artifacts: new CLI shortcuts; remove old firmware CLI
- artifacts: full firmware & usage
- use firmware artifacts in image build and install its debs
- kernel artifact sans legacy; use tmpdir for .deb target for all packages
- legacy artifact versions is no more; pack/unpack now in common obtain;
- artifacts: uboot: cleanup legacy renaming, use artifact version directly
- artifacts: add firmware (small) artifact
- deploy uboot to loop from artifact; allow tty to artifact; todos for cleaning
- fixes, kernel dtb/headers conditional; remove `.git` from Makefile url; use mapfile for finding files to hash
  - completely remove KERNEL_HAS_WORKING_HEADERS_FULL_SOURCE and `kernel_package_callback_linux_headers_full_source()`
  - don't use realpath for artifact_file_relative
  - curb some warnings
  - fix: only install headers & dtbs if such exist
- kernel .config hook modification hash versioning
- OCI_TARGET_BASE vs per-artifact defaults; only deploy to remote from CLI with OTB
- artifact revolver & installing into image
  - add artifact_map_packages and artifact_map_debs dicts
  - revolver accumulates all info
  - REPOSITORY_INSTALL is no more (for uboot/kernel, later others)
  - rename `VER` to `IMAGE_INSTALLED_KERNEL_VERSION`
2023-02-18 07:46:03 -03:00
Ricardo Pardini
ca6bf9046b
armbian-next: remove all traces of Vagrant and FEL boot 2023-02-18 07:46:00 -03:00
Ricardo Pardini
184380f01b
armbian-next: u-boot: fix: check gcc version before trying to downgrade certain errors to warnings 2023-02-18 07:45:41 -03:00
Ricardo Pardini
388c76c91b
armbian-next: shellcheck: squash more shellcheck warnings; some long-lost variables being used; some unset's that are better reset's, etc 2023-02-18 07:45:33 -03:00
Ricardo Pardini
6258ea566a
armbian-next: shellcheck: squash a bunch of 'critical' warnings 2023-02-18 07:45:29 -03:00
Ricardo Pardini
ed98d21040
armbian-next: u-boot: downgrade more errors to warnings, so we can build some legacy u-boot's 2023-02-18 07:45:24 -03:00
Ricardo Pardini
bef7f8fee4
armbian-next: artifacts: introduce kernel/u-boot artifacts; git ref2info; "memoizer"; some hashing
- artifacts: u-boot/kernel - pt7 - adapt legacy/artifact versions; use common `capture_rename_legacy_debs_into_artifacts()`
- artifacts: u-boot - pt6: add artifact for u-boot
  - use artifact version / reason in actual u-boot .deb if present
- artifacts: kernel - pt5: tune kernel version, refactor
- artifacts: kernel - pt4: squash unrelated bugs that show up; move `prepare_compilation_vars()` to default build
- artifacts: kernel - pt3: drivers+patches+.config hashing
  - split file hashing function from drivers-harness; fix it so filenames are relative and sorted; sort from ${SRC}, always
  - aplit prepare_kernel_config_core_or_userpatches() from `kernel_config_initialize()`
- artifacts: kernel - pt2:  memoizing git ref2info
- artifacts: kernel - pt1:  versioning
2023-02-18 07:45:20 -03:00
Ricardo Pardini
f43732a8e9
armbian-next: use unified methods for tmp dir handling all around (except ATF, which is special) 2023-02-18 07:44:29 -03:00
Ricardo Pardini
eda272045d
armbian-next: [focal-host] remove usages of declare -I, not supported under focal's bash
- this is bad/terrible and will cause a lot of shellcheck errors... but such is life
2023-02-18 07:41:49 -03:00
Ricardo Pardini
9370c19a44
armbian-next: drop old code for patching & fasthash
- split the modification time stuff to general
2023-02-18 07:41:05 -03:00
Ricardo Pardini
76e276c6a9
armbian-next: Python patching delusion, pt1 & pt2 & pt3
- WiP: Python patching delusion, pt 1: finding & parsing patches; apply & git commit with pygit2; Markdown summaries (also for aggregation); git-to-patches tool
  - Python: Markdown aggregation and patching summaries; collapsible; SummarizedMarkdownWriter
  - Python: Markdown aggregation and patching summaries
  - Python: reorg a bit into common/armbian_utils; define the `ASSET_LOG_BASE` in preparation for Markdown delusion
  - Python patching: initial apply patches & initial commit patches to git (using pygit2)
  - Python patching: add basic `series.conf` support
  - Python patching: force use of utf-8; better error handling; use realpath of dirs
  - Python patching: `git-to-patches` initial hack. not proud. half-reused some of the patches-to-git
  - Python patching: "tag" the git commits with info for extracting later; introduce REWRITE_PATCHES/rewrite_patches_in_place
  - Python patching: commented-out, recover-bad-patches hacks
  - Python patching: shorten the signature
  - Python patching: allow BASE_GIT_TAG as well as BASE_GIT_REVISION
  - Python patching: git-archeology for patches missing descriptions; avoid UTF-8 in header/desc (not diff)
  - Python patching: use modern-er email.utils.parsedate_to_datetime to parse commit date
  - Python patching: unify PatchInPatchFile; better git-commiting; re-exporting patches from Git (directly)
  - Python patching: switch to GitPython
    - GitPython is like 100x slower than pygit2, but actually allows for date & committer
    - also allows to remove untracked files before starting
  - Python aggregation: fix missing `AGGREGATED_APT_SOURCES_DICT`
  - Python patching: add `unidecode` dependency to pip3 install
  - Python patching: don't try archeology if SRC is not a Git Repo (eg, in Docker)
  - Python patching: don't try archeology if not applying patches to git
- WiP: Python patching delusion, pt2: actually use for u-boot & kernel patching
  - Python patching: much better problem handling/logging; lenient with recreations (kernel)
  - Python patching: don't force SHOW_LOG for u-boot patching
  - Python patching: don't bomb for no reason when there are no patches to apply
  - Python patching: fully (?) switch kernel patching to Python
  - Python patching: more logging fixups
  - Python patching: capture `kernel_git_revision` from `fetch_from_repo()`'s `checked_out_revision`
  - Python patching: fully switch u-boot patching to Python
  - Python aggregation/patching: colored logging; patching: always reset to git revision
  - Python aggregation/patching: better logging; introduce u-boot Python patching
- Python patching pt3: recovers and better Markdown
  - Python patching: detect, and rescue, `wrong_strip_level` problem; don't try to export patches that didn't apply, bitch instead
  - Python patching: Markdown patching summary table, complete with emoji
  - Python patching: include the problem breakdown in Markdown summary
  - Python patching: sanity check against half-bare, half-mbox patches
  - Python patching: try to recover from 1) bad utf-8 encoded patches; 2) bad unidiff patches; add a few sanity checks
  - Python patching: try, and fail, to apply badly utf-8 encoded patches directly as bytes [reverted]
  - Python patching: try to recover from patch *parse* failures; show summary; better logging
      - set `GIT_ARCHEOLOGY=yes` to do archeology, default not

- armbian-next: Python `pip` dependencies handling, similar to `hostdeps`
  - same scheme for Dockerfile caching
  - @TODO: still using global/shared environment; should move to a dir under `cache` or some kinda venv
- WiP: add `python3-pip` to hostdeps; remove `python-setuptools`
  - remove `python-setuptools` (Python2, no longer exists in Sid) from hostdeps
  - add `python3-pip` to hostdeps; part of virtualenv saga
- WiP: split `kernel.sh` a bit, into `kernel-patching.sh`, `kernel-config.sh` and `kernel-make.sh`
  - `advanced_patch()`: rename vars for clarity; no real changes
- Python patching: introduce FAST_ARCHEOLOGY; still trying for Markdown links
2023-02-18 07:40:52 -03:00
Ricardo Pardini
fd043d707a
armbian-next: squash some warn loggings that were undue; remove $SUDO_USER handling in prepare-host.sh
- squash warning about `NO_APT_CACHER` when in Docker
2023-02-18 07:40:43 -03:00
Ricardo Pardini
074857ede3
armbian-next: u-boot: use git worktree for u-boot; full mainline clone for bare
- share a single `.git` for all u-boots
- all fetches are done against it, maximizing cache hit ratio drastically
- also reduces the size of each working copy by more than 70%
- split uboot's git stuff into uboot-git.sh
- split `uboot_prepare_git()` from `compile_uboot()`
2023-02-18 07:40:39 -03:00
Ricardo Pardini
4a9529dd34
armbian-next: qemu-uboot-arm64 and qemu-uboot-x86 new boards
- sharing most UEFI code, will replace the `virtual` one soon
- x86: patch uboot defconfig to use the `q35` machine type, not `i440fx`
  - separate x86 bootscript, due to non-uInitrd-ness of it
  - hack ramdisk load address both in u-boot source and bootscript
  - use 32-bit u-boot, not 64-bit
- grub: introduce `UEFI_GRUB=skip`, does not deploy GRUB (but does the kernel packages, etc)
- auto-enable qcow2 output for these
- works with both distro's and Armbian's kernels
2023-02-18 07:40:33 -03:00
Ricardo Pardini
b951f7b873
armbian-next: u-boot: introduce hook pre_config_uboot_target()
- useful for hacking at Python versions and other compilation-time hacks
2023-02-18 07:40:32 -03:00
Ricardo Pardini
b2d02071bd
armbian-next: better ccache logs/stats/Docker-support/use in u-boot/kernel
- introduce `SHOW_CCACHE=yes` for detailed ccache statistics and logging
- fix: kernel build is done under "env -i", so pass CCACHE_DIR down to Make if CCACHE_DIR is set...
- split from kernel.sh, show stats also for u-boot targets; show compile time
- add volume definition (under `${SRC}/cache/ccache`); auto-use that in Docker builds via `CCACHE_DIR`
- better logging for `do_with_ccache_statistics()`
- there's some CCACHE_DIR code from before; unify @TODO
2023-02-18 07:40:19 -03:00
Ricardo Pardini
81376df4b7
armbian-next: u-boot: use scripts/config instead of seding into the .config (BOOTDELAY, CONFIG_LOGLEVEL=6, etc); v2022.10+ only 2023-02-18 07:40:16 -03:00
Ricardo Pardini
d502402c1a
armbian-next: show more complete gcc versions in logs 2023-02-18 07:40:04 -03:00
Ricardo Pardini
98eae22665
armbian-next: uboot: use CFLAGS/KCFLAGS everywhere; run make through unbuffer (from expect package) for full color logging 2023-02-18 07:39:14 -03:00