rootfsイメージをinitramfsに解凍するのが遅いのはなぜですか?

rootfsイメージをinitramfsに解凍するのが遅いのはなぜですか?

新しいGentooをインストールしましたが、時間がかかる唯一の起動手順は次のとおりです。

Trying to unpack rootfs image as initramfs...

起動に約10秒かかります。このステップがなぜ時間がかかるのかを知るためにinitramfsを読んでみましたが、まだ私にとってはとても神秘的です。私のブートパーティションにinitramfsがあります。

~ $ cd /boot/
malcolm@Host-002 /boot $ ls
grub                                       lost+found
initramfs-genkernel-x86_64-4.12.12-gentoo  System.map-genkernel-x86_64-4.12.12-gentoo
kernel-genkernel-x86_64-4.12.12-gentoo

grub2-mkconfig -o /boot/grub/grub.cfginitramfs-genkernelを見つけましたが、それは私のものです/boot/grub/grub.cfg

menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuent$
        load_video
        if [ "x$grub_platform" = xefi ]; then
                set gfxpayload=keep
        fi
    insmod gzio
        insmod part_gpt
        insmod ext2
        set root='hd0,gpt2'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --$
        else
          search --no-floppy --fs-uuid --set=root 80e1a69b-be52-4845-a6c7-4f7e8353bc1e
        fi
    echo    'Loading Linux x86_64-4.12.12-gentoo ...'
        linux   /kernel-genkernel-x86_64-4.12.12-gentoo root=UUID=2eb28949-50a7-4178-9d0a-309$
        echo    'Loading initial ramdisk ...'
        initrd  /initramfs-genkernel-x86_64-4.12.12-gentoo
}

混乱し、それが何を意味するのかわかりませんunpacking roots image as initramfs。システムをロードするために必要なツールをロードするにはinitramfsが必要なので、システムがinitramfs-genkernelをブートパーティションに解凍すると仮定しました。このrootfsイメージは何ですか?

私はこれが非常に混乱した質問であることを知っていますが、私もそうです。より良い質問の作成方法についてアドバイスをいただきありがとうございます。

編集する:

/var/log/dmesginitramfsを取り巻く本当のポイント

[    0.275512] pci_bus 0000:00: resource 4 [io  0x0000-0x0cf7 window]
[    0.275514] pci_bus 0000:00: resource 5 [io  0x0d00-0xffff window]
[    0.275515] pci_bus 0000:00: resource 6 [mem 0x000a0000-0x000bffff window]
[    0.275516] pci_bus 0000:00: resource 7 [mem 0xd0000000-0xfebfffff window]
[    0.275517] pci_bus 0000:00: resource 8 [mem 0xfed40000-0xfed4bfff window]
[    0.275518] pci_bus 0000:03: resource 0 [io  0x2000-0x2fff]
[    0.275519] pci_bus 0000:03: resource 1 [mem 0xd0100000-0xd02fffff]
[    0.275520] pci_bus 0000:03: resource 2 [mem 0xd0300000-0xd04fffff 64bit pref]
[    0.275521] pci_bus 0000:04: resource 1 [mem 0xf1000000-0xf10fffff]
[    0.275611] NET: Registered protocol family 2
[    0.275839] TCP established hash table entries: 65536 (order: 7, 524288 bytes)
[    0.276037] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes)
[    0.276238] TCP: Hash tables configured (established 65536 bind 65536)
[    0.276353] UDP hash table entries: 4096 (order: 5, 131072 bytes)
[    0.276455] UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes)
[    0.276597] NET: Registered protocol family 1
[    0.276691] pci 0000:00:02.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
[    0.277288] PCI: CLS 64 bytes, default 64
[    0.277324] Trying to unpack rootfs image as initramfs...
[    5.396096] Freeing initrd memory: 38272K
[    5.396183] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[    5.396270] software IO TLB [mem 0xba0af000-0xbe0af000] (64MB) mapped at [ffff918efa0af000$
[    5.396465] RAPL PMU: API unit is 2^-32 Joules, 4 fixed counters, 655360 ms ovfl timer
[    5.396587] RAPL PMU: hw unit of domain pp0-core 2^-14 Joules
[    5.396670] RAPL PMU: hw unit of domain package 2^-14 Joules
[    5.396752] RAPL PMU: hw unit of domain dram 2^-14 Joules
[    5.396835] RAPL PMU: hw unit of domain pp1-gpu 2^-14 Joules
[    5.397284] audit: initializing netlink subsys (disabled)
[    5.397435] audit: type=2000 audit(1513038122.396:1): state=initialized audit_enabled=0 re$
[    5.397762] Initialise system trusted keyrings
[    5.397883] workingset: timestamp_bits=46 max_order=21 bucket_order=0
[    5.398161] SELinux:  Registering netfilter hooks
[    5.398739] Key type asymmetric registered

ログには5秒が表示されますが、起動および出力時に表示される実際の時間は約10秒です。

ベストアンサー1

アーカイブの解凍は、2つのこと(IMHO)によって異なります。

  1. 使用されるアルゴリズム
  2. アーカイブのファイルサイズ

だから、初期のメモリディスクが大きすぎると思います。

プロセスを高速化するには、サイズを最小限に抑え、サポートされているさまざまなアーカイブアルゴリズムを使用して、どちらが設定に最適かを確認できます。

私にとって、それはLZ4圧縮を使用し、initラムディスクを持たない最小のカーネルです。これにより、grubからhp envy 14(1.8GHZのamd apu)のsysv initまで0.9秒かかりました。プロセスの最適化に興味がある場合は、ここでカーネルと初期化ラムディスクのサイズを最小限に抑える良いガイドを見つけることができます。https://www.dotslashlinux.com/post/the-linux-kernel-configuration-guide-part-1-introduction/

おすすめ記事