Hello, Roman Riabenko via <[email protected]> writes:
> Hello. > > I observe that uboot does not read files that are at the same time > compressed and inlined when built with CONFIG_FS_BTRFS=y, > CONFIG_CMD_BTRFS=y, and CONFIG_ZSTD=y. (In btrfs, inlining is storing > the file directly in metadata to conserve space.) uboot can read > inlined files, and can read compressed files, but fails when it is > compressed and inlined at the same time. So, I have to remember to > defragment extlinux.conf in order to boot from a btrfs-formatted > partition with compression and inlining enabled when the file gets > small. > > $ sudo guix system delete-generations > deleting /var/guix/profiles/system-71-link > building /gnu/store/d72pav3b9mfczd6ajsqf8rlyqyzv180d-extlinux.conf.drv... > building > /gnu/store/qsg0svs0la42ciqmh4l4mbcify41p98y-install-bootloader.scm.drv... > $ guix shell compsize -- sudo compsize /boot/extlinux/extlinux.conf > Processed 1 file, 0 regular extents (0 refs), 1 inline, 1 fragments. > Type Perc Disk Usage Uncompressed Referenced > TOTAL 60% 497B 826B 826B > zstd 60% 497B 826B 826B > $ sudo btrfs filesystem defragment --nocomp /boot/extlinux/extlinux.conf > $ guix shell compsize -- sudo compsize /boot/extlinux/extlinux.conf > Processed 1 file, 0 regular extents (0 refs), 1 inline, 1 fragments. > Type Perc Disk Usage Uncompressed Referenced > TOTAL 100% 826B 826B 826B > none 100% 826B 826B 826B > > Unfortunately, I often forget to do that. I would appreciate any advice > on how could I prevent this from happening. > > I have tried setting "compression none" property on the file and on the > directory "/boot/extlinux" to prevent compression. However, the file is > copied from the store, where it is compressed, so the attribute does > not apply to it. Thus, it is still necessary to uncompress it after > copying when it is small. So, I will state in advance I do not know how to solve this "properly", but few possible hacks do come to mind, in no specific order: 1. Put the /boot/extlinux directory on separate partition that is not BTRFS. 2. Write a simple extension service for activation-service-type which will do the decompress for you on every activation (effectively on reconfigure and on boot). 3. Write a wrapper script and use it instead of direct Guix invocation. That wrapper script can do the decompression. > > Here is the part of the system configuration that recompiles uboot with > btrfs and zstd support. > > (define u-boot-a64-olinuxino-emmc-btrfs > (package > (inherit u-boot-a64-olinuxino-emmc) > (arguments > (substitute-keyword-arguments > (package-arguments u-boot-a64-olinuxino-emmc) > ((#:phases phases) > #~(modify-phases #$phases > (add-after 'unpack 'add-btrfs-kconfig > (lambda _ > (let ((defconfig "configs/a64-olinuxino-emmc_defconfig")) > (when (file-exists? defconfig) > (let ((port (open-file defconfig "a"))) > (with-output-to-port port > (lambda () > (display "\nCONFIG_FS_BTRFS=y\n") > (display "CONFIG_CMD_BTRFS=y\n") > (display "CONFIG_ZSTD=y\n"))) > (close-port port)))))))))))) > > Roman > Hope this helps, Tomas -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.
