Commit Graph

62 Commits

Author SHA1 Message Date
Alex Simkin b47445c990 add CRYPTROOT_AUTOUNLOCK option and fix CRYPTROOT for uefi builds
fixes #6280
2025-11-02 20:15:19 +01:00
Jianfeng Liu d890a4b3f3 partitioning: allow single root partition for all filesystem type 2025-10-17 19:33:52 +02:00
Rolf Leggewie aec8988419 lib / partitioning.sh: remove some whitespace at end-of-line 2025-09-04 01:59:32 +08:00
Mecid 02fb49bced Make the Partition Type UUID if-chain more readable 2025-09-04 01:59:32 +08:00
Mecid Urganci 61526350f3 Partitioning UFS: Add rockchip support 2025-09-04 01:59:32 +08:00
alex3d df6a133a14 partitioning: fix compressed BTRFS creation 2025-05-18 17:43:21 +02:00
Franklyn Tackitt 4a8199b992 partitioning: Use btrfs set-default MOUNT/subvolume
This simplifies the code, removing the need to grep/cut the output of btrfs subvolume list
2025-05-05 06:15:50 +02:00
Franklyn Tackitt 76470b1dad partitioning: Rely on the btrfs default subvolume for remounting
This allows changes to the default subvolume in `btrfs_root_add_subvolumes`
 to propagate as needed into the final image.
2025-05-05 06:15:50 +02:00
Franklyn Tackitt 9f37e55980 partitioning: Add BTRFS_ROOT_SUBVOLUME switch
This allows changing the default root subvolume from @ to any user
 defined subvolume name
2025-05-05 06:15:50 +02:00
FantasyGmm 76229701ca Adding Variables to Set the Sector Size for UFS Devices 2025-04-19 13:19:13 +02:00
Igor Velkov ab6587ac05 If rootfs placed on btrfs filesystem, place root on @ subvolume
It makes possible to work with snapshots of a root filesystem
2025-04-16 23:33:07 +02:00
Igor Pecovnik 5cc3e2e872 Fix handling loop devices 2025-01-08 13:17:47 +01:00
M.Schmidt 6607728e24 improve(lvm,cryptroot): export private key with a structurally equal naming scheme; cleanup 2024-12-13 10:01:19 +01:00
M.Schmidt 590b75fd6f improve(lvm+cryptroot extensions): enable possibility for LVM on LUKS 2024-12-13 10:01:19 +01:00
M.Schmidt 3ec24d40e8 fix(lvm,cryptroot extensions): introduce another variable to keep track of the physical partition/uuid and rootdevice/uuid seperately 2024-12-13 10:01:19 +01:00
user 502e139598 New option: CRYPTROOT_MAPPER. Make ROOT_MAPPER name for CRYPTROOT changable. 2024-11-05 16:35:02 +01:00
user 817519210b Fix partitioning root UUID bug in /etc/crypttab. 2024-11-05 16:35:02 +01:00
rafael dcff6cf71d fixes #7210 for extensions that modify rootdevice 2024-09-14 21:44:52 +02:00
ColorfulRhino b8dbe607e5 partitioning: Declare `rootpart` as local variable
The others like `uefipart` and `bootpart` are also defined as local var. Establish consistency.
2024-08-05 20:39:57 +02:00
ColorfulRhino 1092d60d3e partitioning: Set correct partition type UUID for root filesystem
Previously, only the type "Generic Linux filesystem" was used.
Use the correct type "Linux root ($ARCHITECTURE)" for the root filesystem.
2024-08-05 20:39:57 +02:00
ColorfulRhino a027c4be37 partitioning: Add check to use legacy BIOS boot partition with GPT only, not MBR
Exit with an error message if trying to add this partition to an MBR disk.
2024-08-05 20:39:57 +02:00
ColorfulRhino 01d8716bf9 partitioning: Output the partitioning options to the debug log 2024-08-05 20:39:57 +02:00
ColorfulRhino 0b6d61f4c4 partitioning: Add some comments to improve readbility 2024-08-05 20:39:57 +02:00
ColorfulRhino d638276fcc partitioning: Reduce `commit` mount option for btrfs and ext4 to 120
Mount option `commit=600` (=10 minutes) seems pretty high.
Reduce it to 120 for ext4 (default for ext4 is `commit=5`)
and 120 for btrfs (default for btrfs is `commit=30`) to reduce
risk of losing data on power loss.

Sources:
- https://www.kernel.org/doc/html/latest/admin-guide/ext4.html
- https://wiki.archlinux.org/title/Btrfs#Commit_interval
- https://btrfs.readthedocs.io/en/latest/Administration.html
2024-07-09 11:31:51 +02:00
Ricardo Pardini 1ff783d867 fix: partitioning: disable `orphan_file` (`FEATURE_C12`) for ext4 filesystems on 1.47+ e2fsprogs host
- otherwise:
  ```
  fsck.ext4 -a -C0 /dev/mmcblk0p1
  /dev/mmcblk0p1 has unsupported feature(s): FEATURE_C12
  e2fsck: Get a newer version of e2fsck!
  ```
- `orphan_file` can only be disabled on recent-enough e2fsprogs, thus check version and compare
2024-06-27 14:25:20 +02:00
Igor Pecovnik 75ce67f329 Run shellfmt to complete code 2024-06-22 19:22:24 +02:00
Alex Shumsky bbd5699e13 partitioning: fix race condition on loop device allocation 2024-06-21 22:14:01 -04:00
Igor 33906869c0
Improve loop devices management by allocating random free device instead of next one (#6345) 2024-03-06 01:09:54 +01:00
BlitzKrieg 85eced8d64 Adds --partscan parameter to losetup command for forcing the kernel to scan partition table. #6333 2024-03-02 21:00:55 +01:00
Rafael 94d4c007d1
Feature lvm support (#6204)
* using the configured volume group name
* added LVM support
* ensuring /boot never on LVM volume, created hook to setup root device
* preparing root device via extension, not assuming any particular partition for root
* using tab spacing
* using global parameter to require a boot partition
* using boot require, moving cryptroot code to extension
* adds crypt image suffix
---------

Co-authored-by: rafael <rvalle@privaz.io>
2024-02-01 20:01:58 +01:00
Alex Shumsky eee0d33bbc partitioning: allow to disable boot partition if bootloader known to support rootfs 2024-01-22 21:18:15 +01:00
Alex Shumsky 86a743ad83 partitioning: do not force image size estimation for (potentially) compressed btrfs rootfs 2024-01-22 21:18:15 +01:00
Ricardo Pardini bba856bb57 partitioning: efi: introduce `UEFI_MOUNT_POINT_SKIP_FSTAB`, if set to yes, skips /etc/fstab entry for the ESP
- sometimes we just don't want the ESP listed in the fstab, otherwise works the same
2023-10-14 00:03:12 +02:00
Ricardo Pardini 7008b14cd5 RFC: partitioning: stop disabling `64bit` and `metadata_csum` for mkfs.ext4
- this has been a contention point for many years
2023-08-22 08:16:24 +02:00
Gunjan Gupta 2bf0ddc034 Fix intermitent loop device not available error when CRYPTROOT_ENABLE is enabled 2023-07-22 02:18:49 +05:30
Ricardo Pardini a4c703dfb0 partitioning: declare global readonly `ROOT_PART_UUID` for later hooks
- re-use local `root_part_uuid` instead of running blkid multiple times
2023-07-18 14:21:01 +02:00
Ricardo Pardini c5fe25aa17 partitioning: move hook call `image_specific_armbian_env_ready()` after the end of related manipulations
- depending on rootpart/extlinux/boot.ini it might not have run or had any effect
2023-07-04 03:09:07 +05:30
Igor Velkov 9b68c4e42a Add support for nilfs2 fs based image
Signed-off-by: Igor Velkov <iav@iav.lv>
2023-05-16 08:51:05 +02:00
Ricardo Pardini b18cd8aaf4 logging: curb some warnings into info's 2023-05-09 10:04:57 +02:00
Ricardo Pardini ed0b406265 lib: fix: replace undue `export` statements with `declare -g` 2023-03-31 09:12:44 +02: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
Vyacheslav Bocharov fad48ac670
Fix "No space left on device" while rsync root files to image 2023-02-27 22:34:17 +03:00
Ricardo Pardini 68d76d6f3a
armbian-next: squash some shellcheck warnings; don't `local` and assign subshell value in same statement, that masks errors (`declare`/`local` almost-always works) 2023-02-18 07:45:31 -03:00
Ricardo Pardini 6258ea566a
armbian-next: shellcheck: squash a bunch of 'critical' warnings 2023-02-18 07:45:29 -03:00
Ricardo Pardini 72c61f2f68
armbian-next: replace bare `sync` invocations by introducing `wait_for_disk_sync()`; sync early at start of build
- wait 10s for sync call; otherwise warn user to be patient
- wait_for_sync "reason for sync" everywhere
- add @TODO for /run/user/0 etc and XDG_RUNTIME_DIR in chroot
2023-02-18 07:43:53 -03:00
Ricardo Pardini af7ace7e57
armbian-next: don't leak `.raw` image if failure before move; show rootfs-tmpfs info
- add escapings and TODO's around the area...
2023-02-18 07:43:26 -03:00
Ricardo Pardini e633ff584a
armbian-next: debug note about fstab with tmpfs in chroot 2023-02-18 07:43:03 -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 d24d3327a8
armbian-next: the great cli entrypoint (+docker) rewrite; introduce `USE_LOCAL_APT_DEB_CACHE` replacing `apt-cacher-ng`
- armbian-next: introduce `USE_LOCAL_APT_DEB_CACHE` (default `=yes`) as alternative/in addition to `apt-cacher-ng` (eg, in Docker)
  - this uses `cache/aptcache/${RELEASE}-${ARCH}` (in the host) for
      - apt cache, by bind-mounting it to `${SDCARD}/var/cache/apt` in the `chroot_sdcard_apt_get()` runner and its usages
      - debootstrap, by passing it `--cache-dir`
  - utility function to help understand what is happening to cache during usage
  - apt itself mantains this cache, removing old packages when new ones are installed. apt does this _by default_
      - introduce `DONT_MAINTAIN_APT_CACHE=yes` to skip out of automatic apt maintenance of apt cache, eg, during `remove`s
      - don't do `apt clean` and such if using local cache, that would clean the cache, not the chroot
  - clean up `install_deb_chroot()` a little, find an unrelated bug there
- WiP: the great cli entrypoint (+docker) rewrite, Phase 6: relaunching structure; re-pass ARMBIAN_BUILD_UUID; use ARMBIAN_COMMAND for log filename; fix for output/logs dir perms
- WiP: the great cli entrypoint (+docker) rewrite, Phase 5: cleanups 4/x; better logging, check & force `DEST_LANG`
- WiP: the great cli entrypoint (+docker) rewrite, Phase 5: cleanups 3/x; don't write to stderr in generated Dockerfile
  - it's `drastic red` on non-buildx dockers
- WiP: the great cli entrypoint (+docker) rewrite, Phase 5: cleanups 2/x, logging
- WiP: the great cli entrypoint (+docker) rewrite, Phase 5: cleanups 1/x
  - source configs in a logging section.
  - Docker: silent, fast retries to make sure `docker system df` works
  - shut-up `chown` (no `-v`) output related to  `SET_OWNER_TO_UID`
  - ask user to wait while `DESTIMG` is rsync'ed to `FINALDEST` -- it's potentially very slow
  - use green apple for Mac logging, instead of red apple which might imply error...
- WiP: the great cli entrypoint (+docker) rewrite, Phase 4: run as non-root, maybe-with-Docker
  - introduce `is_docker_ready_to_go()`; if it is, and we're not root, use Docker instead of sudo. <- GOOD IDEA? BAD IDEA? lol
  - introduce `SET_OWNER_TO_UID` var to be passed to Docker/sudo so written files are owned by the launching user, not root.
    - introduce `mkdir_recursive_and_set_uid_owner()` and `reset_uid_owner()` to reset owner based on `SET_OWNER_TO_UID`
    - use it for userpatches files created, logs, and output files, including images and debs.
  - @TODOs ref. `$SUDO_USER` which I think the old version of this?
  - add a lot of @TODOs, ref being able to relaunch something that's not `build` inside Docker, also add/change params and configs and command.
    - initially add `ARMBIAN_DOCKER_RELAUNCH_EXTRA_ARGS`
- WiP: the great cli entrypoint (+docker) rewrite, Phase 3: rpardini is demented, v3
- WiP: the great cli entrypoint (+docker) rewrite, Phase 2: rpardini is demented
- WiP: the great cli entrypoint (+docker) rewrite, Phase 1
- armbian-next: WiP: Docker: actually use the GHA-image as base; pull it every 24hs.
  - using image in my private repo.
  - this has significant speedup to "start building time" on the 1st run
  - move some Linux specific stuff to its own if
  - add comments and todo
- armbian-next: WiP: Docker, high-WiP, beginnings of Armbian mount dict, with linux/darwin preferences
- armbian-next: WiP: Docker, configure `BUILDKIT_COLORS`
- armbian-next: WiP: Docker, make docker image from Dockerfile more compact by flattening layers
- armbian-next: `logging`: add whale indicator if build running under Docker
- armbian-next: WiP: `docker`: working with `bookworm`, `sid`, and `jammy` on Darwin & Linux; works with `bullseye` on Linux only
- armbian-next: WiP: `docker`: force ARMBIAN_RUNNING_IN_CONTAINER both in Dockerfile and passed as `--env`; apt update and install in same layer; back to jammy
- armbian-next: introduce `armbian_is_running_in_container()` and `armbian_is_host_running_systemd()`, replacing `systemd-detect-virt` in multiple spots
- WiP: try with debian:bullseye -- can't detect docker at all
- armbian-next: WiP: 2nd stab at new Docker support; Darwin still works; Linux `docker.io` working
  - gen .dockerignore together with Dockerfile
  - split in funcs
  - hacks for Linux and `/dev/loop` stuff, CONTAINER_COMPAT=yes
  - mac still works, Linux stuff would break it but I if'fed
- armbian-next: the secrets of `CONTAINER_COMPAT` revealed; add size checking to check_loop_device() and avoid retry when `mknod`ing
  - this fails for the right reasons now, causing retries, which are then retried and work ;-)
  - this is related to building under Docker on Linux, using docker.io package (not docker-ce)
- armbian-next: remove `.dockerignore` and add it to `.gitignore`; it's going to be auto-generated
- armbian-next: `.dockerignore`: Docker context should only have minimal files and folders, to speed up Dockerfile build
  - IMPORTANT: `.dockerignore` is going to be generated from now on: so this is the last commit with changes before removal
-  armbian-next: WiP: initial stab at new Docker support; really run the passed cmdline; add Dockerfile to gitignore
-  armbian-next: WiP: initial stab at new Docker support; generate Dockerfile; introduce REQUIREMENTS_DEFS_ONLY
  - uses REQUIREMENTS_DEFS_ONLY
  - works on Docker Desktop on Mac;
  - linux TBA
- armbian-next: don't error out if `.git` not present; other small fixes
- armbian-next: general "work or at least don't misbehave when run on a very bare ubuntu:latest instance"
  - can't assume things, for example:
  - that `sudo` will be available; it might not, and might be already root, no reason to fail
  - that `/etc/timezone` will exist
  - that `systemd-detect-virt` will be available
  - that `git` will be available
  - that `locale-gen` will be available
2023-02-18 07:39:43 -03:00
Ricardo Pardini 2c6751f584
armbian-next: show `mkfs` ext2/ext4 output (remove `-q`), it's being run under the logging manager already 2023-02-18 07:39:42 -03:00