{ "version": "https://jsonfeed.org/version/1.1", "user_comment": "This feed allows you to read the posts from this site in any feed reader that supports the JSON Feed format. To add this feed to your reader, copy the following URL -- https://matoken.org/blog/tag/initramfs/feed/json/ -- and add it your reader.", "home_page_url": "https://matoken.org/blog/tag/initramfs/", "feed_url": "https://matoken.org/blog/tag/initramfs/feed/json/", "language": "ja", "title": "initramfs – matoken's blog", "description": "Is there no plan B?", "icon": "https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9.jpeg", "items": [ { "id": "http://matoken.org/blog/?p=3141", "url": "https://matoken.org/blog/2021/03/25/change-the-linux-kernel-initramfs-compression-format-on-debian/", "title": "Debian \u3067 Linux Kernel \u306e initramfs \u306e\u5727\u7e2e\u5f62\u5f0f\u3092\u5909\u66f4\u3059\u308b\ud83d\udc27\ud83d\udddc\ufe0f", "content_html": "
\u5148\u65e5\u300cDebian sid\u3067Linux Kernel(5.11)\u3092build\u3059\u308b\u30e1\u30e2 \u300d\u3092\u66f8\u3044\u305f\u306e\u3067\u3059\u304c\uff0cTwitter\u3067@henrich\u3055\u3093\u304b\u3089\u3053\u3093\u306a\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\uff0e
\n\n\n\n/boot\u306e\u5bb9\u91cf\u306e\u305f\u3081\u306b\u306finitramfs\u306e\u5727\u7e2e\u3092gzip\u304b\u3089xz\u3084zstd\u306b\u3059\u308b\u306e\u3082\u3042\u308a\u3067\u3059\u306d
\n\u2014 henrich (@henrich) March 23, 2021
\u305d\u3046\u3044\u3048\u3070\u5727\u7e2e\u5f62\u5f0f\u8272\u3005\u3042\u3063\u305f\u306a\u3068\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\uff0e
\n$ grep COMPRESS /etc/initramfs-tools/initramfs.conf\n# COMPRESS: [ gzip | bzip2 | lz4 | lzma | lzop | xz | zstd ]\nCOMPRESS=gzip\n$ file --mime-type /boot/initrd.img-`uname -r`\n/boot/initrd.img-5.11.8+: application/gzip\n\u8a2d\u5b9a\u306f gzip \u3067\uff0c\u5b9f\u969b\u306e\u30d5\u30a1\u30a4\u30eb\u3082gzip\u306b\u306a\u3063\u3066\u3044\u307e\u3059\uff0e
\n\u5727\u7e2e\u5f62\u5f0f\u306f gzip \u4ee5\u5916\u306b bzip2, lz4, lzma, lzop, xz, zstd \u304c\u9078\u3079\u308b\u3088\u3046\u3067\u3059\uff0e
$ ls -1sS --block-size=1 ./initrd.img-5.11.8+.*\n183033856 ./initrd.img-5.11.8+.raw\n 81076224 ./initrd.img-5.11.8+.lz4\n 78315520 ./initrd.img-5.11.8+.lzop\n 54329344 ./initrd.img-5.11.8+.gzip\n 51761152 ./initrd.img-5.11.8+.zstd\n 50081792 ./initrd.img-5.11.8+.bz2\n 36548608 ./initrd.img-5.11.8+.xz\n 36540416 ./initrd.img-5.11.8+.lzma\n\u5bb9\u91cf\u304c\u3069\u306e\u304f\u3089\u3044\u306b\u306a\u308b\u306e\u304b\u5404\u30a2\u30fc\u30ab\u30a4\u30d0\u3067\u5727\u7e2e\u3057\u3066\u307f\u307e\u3057\u305f\uff0e
\n$ \\time -f %e cat ./initrd.img-5.11.8+.raw > /dev/null\n0.03\n$ \\time -f %e lz4cat ./initrd.img-5.11.8+.lz4 > /dev/null\n0.38\n$ \\time -f %e lzop -d -c ./initrd.img-5.11.8+.lzop > /dev/null\n0.42\n$ \\time -f %e zstdcat ./initrd.img-5.11.8+.zstd > /dev/null\n0.44\n$ \\time -f %e zcat ./initrd.img-5.11.8+.gzip > /dev/null\n1.38\n$ \\time -f %e lzma -d -c ./initrd.img-5.11.8+.lzma > /dev/null\n3.22\n$ \\time -f %e xzcat ./initrd.img-5.11.8+.xz > /dev/null\n3.37\n$ \\time -f %e bzcat ./initrd.img-5.11.8+.bz2 > /dev/null\n9.39\n\u5c55\u958b\u6642\u9593\u3082\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u305f\uff0e
\n| \u5727\u7e2e\u5f62\u5f0f | \n\u5727\u7e2e\u30c7\u30fc\u30bf\u91cf(byte) | \n\u5c55\u958b\u6642\u9593(\u79d2) | \n
|---|---|---|
| \n raw \n | \n\n 183033856 \n | \n\n 0.03 \n | \n
| \n lz4 \n | \n\n 81076224 \n | \n\n 0.38 \n | \n
| \n lzop \n | \n\n 78315520 \n | \n\n 0.43 \n | \n
| \n gzip \n | \n\n 54329344 \n | \n\n 1.38 \n | \n
| \n zstd \n | \n\n 51761152 \n | \n\n 0.44 \n | \n
| \n bzip2 \n | \n\n 50081792 \n | \n\n 9.39 \n | \n
| \n xz \n | \n\n 36548608 \n | \n\n 3.37 \n | \n
| \n lzma \n | \n\n 36540416 \n | \n\n 3.22 \n | \n
\u5727\u7e2e\u30c7\u30fc\u30bf\u306e\u5727\u7e2e\u7387\u306a\u3069\u306f\u65e2\u5b9a\u5024\u306e\u307e\u307e\u3067\uff0c\u5c55\u958b\u6642\u9593\u306f \\time -f %e zcat ./initrd.img-5.11.8+.gzip > /dev/null \u82e5\u3057\u304f\u306f \\time -f %e lzma -d -c ./initrd.img-5.11.8+.lzma > /dev/null \u306e\u3088\u3046\u306b\u3057\u3066\u6e2c\u308a\u307e\u3057\u305f\uff0e
\u30b5\u30a4\u30ba\u3067\u306f raw > lz4 \u2252 lzop > gzip \u2252 zstd \u2252 bz2 > xz \u2252 lzma \u306a\u611f\u3058\u3067\uff0c
\n\u5c55\u958b\u901f\u5ea6\u306f bz2 > xz \u2252 lzma > gzip > zstd \u2252 lzop \u2252 lz4 > raw \u306a\u611f\u3058\u3067\u3059\uff0e
| \n Caution \n | \n\n\u6642\u9593\u306b\u3064\u3044\u3066\u306f\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u74b0\u5883\u3067\u8272\u3005\u52d5\u3044\u3066\u3044\u308b\u72b6\u614b\u30671\u56de\u3057\u304b\u6e2c\u3063\u3066\u3044\u306a\u3044\u306e\u3067\u76ee\u5b89\u7a0b\u5ea6\u306b\u3057\u3066\u304f\u3060\u3055\u3044\uff0e | \n
| \n Caution \n | \n\n\u3053\u3053\u3067\u306f\u65e2\u5b9a\u5024\u3067\u5727\u7e2e\u3057\u307e\u3057\u305f\u304c\uff0czstd, lz4, xz\u306b\u3064\u3044\u3066\u306finitramfs\u4f5c\u6210\u6642\u306b\u5727\u7e2e\u30aa\u30d7\u30b7\u30e7\u30f3\u306a\u3069\u304c\u65e2\u5b9a\u5024\u3068\u9055\u3046\u3088\u3046\u306a\u306e\u3067\u76ee\u5b89\u7a0b\u5ea6\u306b\u3057\u3066\u304f\u3060\u3055\u3044\uff0e | \n
\u5bb9\u91cf\u7684\u306b\u306fxz, lzma\u304c\u826f\u3055\u305d\u3046\u3067\u3059\u304c\u5c55\u958b\u6642\u9593\u304c\u3068\u3066\u3082\u5897\u3048\u305d\u3046\u3067\u3059\uff0ezstd\u306fgzip\u3088\u308a\u901f\u304f\u3066\u5c0f\u3055\u304f\u306a\u3063\u3066\u826f\u3055\u305d\u3046\u3067\u3059\uff0e
\n\u3068\u3044\u3046\u3053\u3068\u3067zstd\u306b\u3057\u3066\u307f\u307e\u3059\uff0e
$ sudo git -C /etc diff HEAD /etc/initramfs-tools/initramfs.conf\ndiff --git a/initramfs-tools/initramfs.conf b/initramfs-tools/initramfs.conf\nindex 01bdd85..a0c051b 100644\n--- a/initramfs-tools/initramfs.conf\n+++ b/initramfs-tools/initramfs.conf\n@@ -41,7 +41,7 @@ KEYMAP=n\n # COMPRESS: [ gzip | bzip2 | lz4 | lzma | lzop | xz | zstd ]\n #\n\n-COMPRESS=gzip\n+COMPRESS=zstd\n\n #\n # DEVICE: ...\n/etc/initramfs-tools/initramfs.conf \u3092\u7de8\u96c6\u3057\u3066\uff0c COMPRESS \u3092 zstd \u306b\u5909\u66f4\u3057\u307e\u3059\uff0e
$ update-initramfs -h\n\nUsage: update-initramfs {-c|-d|-u} [-k version] [-v] [-b directory]\n\nOptions:\n -k version Specify kernel version or 'all'\n -c Create a new initramfs\n -u Update an existing initramfs\n -d Remove an existing initramfs\n -b directory Set alternate boot directory\n -v Be verbose\n\nSee update-initramfs(8) for further details.\n\n$ sudo update-initramfs -k `uname -r` -u -v\nupdate-initramfs \u3067\u66f4\u65b0\u3092\u884c\u3044\u307e\u3059\uff0e
$ ls -s --block-size=1 /boot/initrd.img-5.11.8+\n54542336 /boot/initrd.img-5.11.8+\n$ ls -s --block-size=1 /boot/initrd.img-5.11.8+\n41611264 /boot/initrd.img-5.11.8+\n$ file --mime-type /boot/initrd.img-5.11.8+\n/boot/initrd.img-5.11.8+: application/zstd\n$ zstd -lv /boot/initrd.img-5.11.8+\n*** zstd command line interface 64-bits v1.4.8, by Yann Collet ***\n/boot/initrd.img-5.11.8+\n# Zstandard Frames: 1\nWindow Size: 8.00 MB (8388608 B)\nCompressed Size: 39.53 MB (41446437 B)\nDecompressed Size: 174.55 MB (183032320 B)\nRatio: 4.4161\nCheck: XXH64\n\u51fa\u6765\u4e0a\u304c\u3063\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u78ba\u8a8d\u3059\u308b\u3068 zstd \u306b\u306a\u3063\u3066\u3044\u307e\u3057\u305f\uff0e
\n\u518d\u8d77\u52d5\u3057\u3066\u3082\u554f\u984c\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f :)
\n\u4e0a\u3067\u78ba\u8a8d\u3057\u305f\u5bb9\u91cf\u3088\u308a\u5927\u5206\u5c0f\u3055\u5538\u3063\u3066\u3044\u308b\u306e\u306f\u5727\u7e2e\u30ec\u30d9\u30eb\u306e\u5dee\u3067\u3057\u3087\u3046\u304b?
$ grep zstd /usr/sbin/mkinitramfs\nzstd) compress=\"zstd -q -19 -T0\" ;;\nupdate-initramfs \u304b\u3089\u547c\u3070\u308c\u308b mkinitramfs \u3092\u78ba\u8a8d\u3059\u308b\u3068zstd\u306e\u5727\u7e2e\u30ec\u30d9\u30eb\u30aa\u30d7\u30b7\u30e7\u30f3\u306f -19 \u3067\u6700\u9ad8\u5727\u7e2e\u7387\u3067\u3057\u305f\uff0e(\u65e2\u5b9a\u5024\u306f -3 )
$ \\time -f%e zstdcat -T1 /boot/initrd.img-5.11.8+ > /dev/null\n0.50\n\u305d\u306e\u5206\u5c55\u958b\u6642\u9593\u3082\u5c11\u3057\u4f38\u3073\u3066\u3044\u305d\u3046\u3067\u3059\uff0e
\ncase \"${compress}\" in\ngzip) # If we're doing a reproducible build, use gzip -n\n if [ -n \"${SOURCE_DATE_EPOCH}\" ]; then\n compress=\"gzip -n\"\n # Otherwise, substitute pigz if it's available\n elif command -v pigz >/dev/null; then\n compress=pigz\n fi\n ;;\nlz4) compress=\"lz4 -9 -l\" ;;\nzstd) compress=\"zstd -q -19 -T0\" ;;\nxz) compress=\"xz --check=crc32\"\n # If we're not doing a reproducible build, enable multithreading\n test -z \"${SOURCE_DATE_EPOCH}\" && compress=\"$compress --threads=0\"\n ;;\nbzip2|lzma|lzop)\n # no parameters needed\n ;;\n*) echo \"W: Unknown compression command ${compress}\" >&2 ;;\nesac\n\u5468\u308a\u3092\u898b\u3066\u307f\u308b\u3068\uff0c lz4 \u306f -9 \u3067\u6700\u9ad8( -12 )\u3067\u306f\u306a\u3044\u3051\u3069\u65e2\u5b9a\u5024( 1 )\u3088\u308a\u5727\u7e2e\u7387\u3092\u9ad8\u304f\u3057\u3066\u3042\u308a\u307e\u3059\uff0exz\u306b\u306f\u6574\u5408\u6027\u30c1\u30a7\u30c3\u30af\u304c\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u3042\u308b\u3051\u3069\u5bb9\u91cf\u306b\u306f\u3042\u307e\u308a\u95a2\u4fc2\u306a\u3044\u304b\u306a?
\n\u305d\u306e\u4ed6\u306f\u65e2\u5b9a\u5024\u306e\u3088\u3046\u3067\u3059\uff0e
$ count=1;while [[ $count -lt 19 ]];do zstdcat /boot/initrd.img-5.11.8+ | zstd -T0 -$count -c - > /tmp/zstd-$count.zstd;count=$(( $count+1 ));done\n$ ls -1sS --block-size=1 /tmp/zstd-*\n56188928 /tmp/zstd-1.zstd\n53272576 /tmp/zstd-2.zstd\n51761152 /tmp/zstd-3.zstd\n51466240 /tmp/zstd-4.zstd\n50061312 /tmp/zstd-5.zstd\n49614848 /tmp/zstd-6.zstd\n47431680 /tmp/zstd-7.zstd\n46690304 /tmp/zstd-8.zstd\n46424064 /tmp/zstd-9.zstd\n45973504 /tmp/zstd-10.zstd\n45850624 /tmp/zstd-11.zstd\n45686784 /tmp/zstd-12.zstd\n45539328 /tmp/zstd-13.zstd\n45371392 /tmp/zstd-14.zstd\n45309952 /tmp/zstd-15.zstd\n44093440 /tmp/zstd-16.zstd\n42987520 /tmp/zstd-17.zstd\n41705472 /tmp/zstd-18.zstd\n41447424 /tmp/zstd-19.zstd\n$ ls -1S /tmp/zstd-* | xargs -I{} -n1 sh -c \"echo -n \\\"{} \\\"; \\time -f%e zstdcat -T0 {} > /dev/null\"\n/tmp/zstd-1.zstd 0.37\n/tmp/zstd-2.zstd 0.36\n/tmp/zstd-3.zstd 0.40\n/tmp/zstd-4.zstd 0.47\n/tmp/zstd-5.zstd 0.44\n/tmp/zstd-6.zstd 0.42\n/tmp/zstd-7.zstd 0.40\n/tmp/zstd-8.zstd 0.37\n/tmp/zstd-9.zstd 0.35\n/tmp/zstd-10.zstd 0.40\n/tmp/zstd-11.zstd 0.41\n/tmp/zstd-12.zstd 0.38\n/tmp/zstd-13.zstd 0.39\n/tmp/zstd-14.zstd 0.39\n/tmp/zstd-15.zstd 0.43\n/tmp/zstd-16.zstd 0.37\n/tmp/zstd-17.zstd 0.42\n/tmp/zstd-18.zstd 0.53\n/tmp/zstd-19.zstd 0.68\n\u5727\u7e2e\u30ec\u30d9\u30eb\u3054\u3068\u306e\u5bb9\u91cf\u3068\u5c55\u958b\u6642\u9593\u306f\u3053\u3093\u306a\u611f\u3058\u306b\u306a\u308a\u307e\u3057\u305f\uff0e\u8272\u3005\u52d5\u3044\u3066\u3044\u308b\u74b0\u5883\u306a\u306e\u3067\u304a\u304b\u3057\u305d\u3046\u306a\u3068\u3053\u308d\u304c\u3042\u308a\u307e\u3059\u304c\u5927\u4f53\u306e\u76ee\u5b89\u3068\u3057\u3066\uff0e
\nKernel 5.11.9 \u304c\u6765\u3066\u3044\u305f\u306e\u3067\u30d3\u30eb\u30c9\u3057\u3066\u307f\u307e\u3057\u305f\uff0e
\n$ wget https://cdn.kernel.org/pub/linux/kernel/v5.x/incr/patch-5.11.8-9.xz\n$ cd linux-5.11\n$ xzcat ../patch-5.11.8-9.xz | patch -p1\n$ grep ^COMPRESS= /etc/initramfs-tools/initramfs.conf\nCOMPRESS=zstd\n$ time make -j`nproc` bindeb-pkg\n$ ls -1sS ../*5.11.9*\n737300 ../linux-image-5.11.9+-dbg_5.11.9+-5_amd64.deb\n 59584 ../linux-image-5.11.9+_5.11.9+-5_amd64.deb\n 8040 ../linux-headers-5.11.9+_5.11.9+-5_amd64.deb\n 1124 ../linux-libc-dev_5.11.9+-5_amd64.deb\n 8 ../linux-5.11.9+_5.11.9+-5_amd64.buildinfo\n 4 ../linux-5.11.9+_5.11.9+-5_amd64.changes\n$ sudo apt install ../linux-image-5.11.9+_5.11.9+-5_amd64.deb ../linux-headers-5.11.9+_5.11.9+-5_amd64.deb ../linux\n-libc-dev_5.11.9+-5_amd64.deb\n$ file /boot/initrd.img-5.11.9+\n/boot/initrd.img-5.11.9+: Zstandard compressed data (v0.8+), Dictionary ID: None\n$ ls --block-size=1 -s /boot/initrd.img-5.11.9+\n41602048 /boot/initrd.img-5.11.9+\n$ sudo shutdown -r now 'kernel upgrade'\n\u554f\u984c\u306a\u304f zstd \u306b\u306a\u308a\u307e\u3057\u305f\uff0e
\nDebian\u306einitramfs\u306e\u5727\u7e2e\u5f62\u5f0f\u3092zstd\u306b\u3057\u3088\u3046\u3068\u3044\u3046\u30d0\u30b0\u30ec\u30dd\u30fc\u30c8\uff0ebullseye\u306f\u30d5\u30ea\u30fc\u30ba\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u5165\u3089\u306a\u3044\uff0e
\n$ dpkg-query -W initramfs-tools-core zstd\ninitramfs-tools-core 0.140\nzstd 1.4.8+dfsg-2.1\n$ lsb_release -dr\nDescription: Debian GNU/Linux bullseye/sid\nRelease: unstable\n$ uname -srm\nLinux 5.11.9+ x86_64\n