Jump to content

[Armbian build PR] - build script: configuration: Check if ROOTFS_TYPE is supported by build host


RSS Bot

Recommended Posts

Description

When trying to build an image with FIXED_IMAGE_SIZE=3000 ROOTFS_TYPE=f2fs with WSL2 as build host, I stumbled on an error pretty late in the build process when trying to mount the rootfs:

[πŸ’²|🌿] Creating rootfs [ f2fs on /dev/loop2p2 ]
[πŸ’²|πŸ”¨]
[πŸ’²|πŸ”¨]         F2FS-tools: mkfs.f2fs Ver: 1.14.0 (2020-08-24)
[πŸ’²|πŸ”¨]
[πŸ’²|πŸ”¨]   Info: Disable heap-based policy
[πŸ’²|πŸ”¨]   Info: Debug level = 0
[πŸ’²|πŸ”¨]   Info: Label = armbi_root
[πŸ’²|πŸ”¨]   Info: Trim is enabled
[πŸ’²|πŸ”¨]   Info: Segments per section = 1
[πŸ’²|πŸ”¨]   Info: Sections per zone = 1
[πŸ’²|πŸ”¨]   Info: sector size = 512
[πŸ’²|πŸ”¨]   Info: total sectors = 5586911 (2727 MB)
[πŸ’²|πŸ”¨]   Info: zone aligned segment0 blkaddr: 512
[πŸ’²|πŸ”¨]   Info: format version with
[πŸ’²|πŸ”¨]     "Linux version 6.1.21.2-microsoft-standard-WSL2+ (flash@DESKTOP-2VA4T55) (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #1 SMP Wed Jan 31 20:29:07 CET 2024"
[πŸ’²|πŸ”¨]   Info: [/dev/loop2p2] Discarding device
[πŸ’²|πŸ”¨]   Info: This device doesn't support BLKSECDISCARD
[πŸ’²|πŸ”¨]   Info: Discarded 2727 MB
[πŸ’²|πŸ”¨]   Info: Overprovision ratio = 3.860%
[πŸ’²|πŸ”¨]   Info: Overprovision segments = 108 (GC reserved = 59)
[πŸ’²|πŸ”¨]   Info: format successful
[πŸ’²|🌿] Mounting rootfs [ /dev/loop2p2 (UUID=02dfb13e-172d-44b1-b71c-25164f29cc0b) ]
[πŸ’²|πŸ”¨]   mount: /home/user/build-fork/.tmp/mount-bfedd4e1-02f1-4bac-99c1-88d420d40809: unknown filesystem type 'f2fs'.
[πŸ’²|πŸ’₯] Error 32 occurred in main shell [ at /home/flash/build-fork/lib/functions/logging/runners.sh:211
    run_host_command_logged_raw() --> lib/functions/logging/runners.sh:211
        run_host_command_logged() --> lib/functions/logging/runners.sh:193
             prepare_partitions() --> lib/functions/image/partitioning.sh:275
                do_with_logging() --> lib/functions/logging/section-logging.sh:81
         build_rootfs_and_image() --> lib/functions/main/rootfs-image.sh:86
   full_build_packages_rootfs_and_image() --> lib/functions/main/default-build.sh:36
          do_with_default_build() --> lib/functions/main/default-build.sh:42
         cli_standard_build_run() --> lib/functions/cli/cli-build.sh:25
        armbian_cli_run_command() --> lib/functions/cli/utils-cli.sh:136
                 cli_entrypoint() --> lib/functions/cli/entrypoint.sh:176
                           main() --> compile.sh:50
 ]
[πŸ’²|πŸ’₯] Cleaning up [ please wait for cleanups to finish ]

I found out that this is because the WSL2 kernel does not have support for the F2FS filesystem. f2fs-tools could be installed normally though. To make the build script exit at the beginning instead of at a late stage and to tell the user a more exact reason why it failed, I added a check if the chosen ROOTFS_TYPE is supported by the host the build script is running on.

The check checks /proc/filesystems which should be present in all Linux distros. But just in case /proc/filesystems is not present, the build won't fail and instead print a warning that the build might fail just like if it can't install python2.

How Has This Been Tested?

Build host: Linux version 6.1.21.2-microsoft-standard-WSL2+ (no F2FS support, but BTRFS and EXT4 support) Command: ./compile.sh build BOARD=nanopi-r5c BRANCH=edge BUILD_DESKTOP=no BUILD_MINIMAL=no KERNEL_CONFIGURE=no RELEASE=bookworm FIXED_IMAGE_SIZE=3000 ROOTFS_TYPE=f2fs

  • [x] Ran build with FIXED_IMAGE_SIZE=3000 ROOTFS_TYPE=f2fs --> build exits at an early stage with [πŸ’²|πŸ’₯] error! [ Filesystem type unsupported by build host: f2fs ]
  • [x] Ran build with ROOTFS_TYPE=btrfs --> build success
  • [x] Ran build without ROOTFS_TYPE option --> build success

Might need some testing with other more exotic build hosts like Docker.

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings

View the full article

Link to comment
Share on other sites

Γ—
Γ—
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines