Почему использование cpio для initramfs?

Сделайте файл неизменным с i атрибут.

chattr +i file.desktop

посмотрите man chattr для получения дополнительной информации.

11
26.06.2019, 17:18
3 ответа

Я не на 100% уверен, но поскольку начальный электронный диск должен быть распакован ядром во время начальной загрузки, cpio используется, потому что это уже реализовано в коде ядра.

9
27.01.2020, 19:57
  • 1
    На 100% убедитесь. linux/init/initramfs.c распаковывает a cpio -H newc архив. глюк –  ephemient 13.02.2011, 03:29
  • 2
    --------121--------111388----@ephemient Это - действительно что-то. Если больше не будет ответа, появляющегося через несколько дней, то я приму это cpio используется в качестве конвенции и что мы должны использовать cpio. –  phunehehe 13.02.2011, 04:57
  • 3
    Какие-либо идеи, почему newc является выбранным форматом? –  CMCDragonkai 01.02.2016, 06:33
  • 4
    Согласно документации ядра, cpio был реализован только ради initramdisk, таким образом, они, возможно, реализовали любой другой формат. –  lvella 24.07.2017, 21:57

Из того, что я помню своих старых дней SysV, cpio мог обработать dev файлы, но tar не мог; это сделало cpio 'необработанной' предпочтительной утилитой резервного копирования, прежде чем дамп пришел. Было также легче обработать частичный filesets и жесткие ссылки, таким образом, возрастающие резервные копии были легче. Я думаю, что tar GNU догнал cpio функции поэтому теперь, это - просто вопрос пользователя comfortability. И cpio и tar должны быть установлены по умолчанию.

3
27.01.2020, 19:57
  • 1
    cpio смогите обрабатывать tar- архивы формата, и наоборот в некоторых случаях, но это не имеет значения. Ядро может только распаковать newc- стиль cpio- архивы формата, который нет tar Я знаю о продуктах. –  ephemient 14.02.2011, 23:44

ЦитированиеDocumentation/filesystems/ramfs-rootfs-initramfs.txt:

Why cpio rather than tar?

This decision was made back in December, 2001. The discussion started here:

http://www.uwsg.iu.edu/hypermail/linux/kernel/0112.2/1538.html

And spawned a second thread (specifically on tar vs cpio), starting here:

http://www.uwsg.iu.edu/hypermail/linux/kernel/0112.2/1587.html

The quick and dirty summary version (which is no substitute for reading the above threads) is:

1) cpio is a standard. It's decades old (from the AT&T days), and already widely used on Linux (inside RPM, Red Hat's device driver disks). Here's a Linux Journal article about it from 1996:

http://www.linuxjournal.com/article/1213

It's not as popular as tar because the traditional cpio command line tools require _truly_hideous_ command line arguments. But that says nothing either way about the archive format, and there are alternative tools, such as:

http://freecode.com/projects/afio

2) The cpio archive format chosen by the kernel is simpler and cleaner (and thus easier to create and parse) than any of the (literally dozens of) various tar archive formats. The complete initramfs archive format is explained in buffer-format.txt, created in usr/gen_init_cpio.c, and extracted in init/initramfs.c. All three together come to less than 26k total of human-readable text.

3) The GNU project standardizing on tar is approximately as relevant as Windows standardizing on zip. Linux is not part of either, and is free to make its own technical decisions.

4) Since this is a kernel internal format, it could easily have been
something brand new. The kernel provides its own tools to create and extract this format anyway. Using an existing standard was preferable, but not essential.

5) Al Viro made the decision (quote: "tar is ugly as hell and not going to be supported on the kernel side"):

http://www.uwsg.iu.edu/hypermail/linux/kernel/0112.2/1540.html

explained his reasoning:

http://www.uwsg.iu.edu/hypermail/linux/kernel/0112.2/1550.html http://www.uwsg.iu.edu/hypermail/linux/kernel/0112.2/1638.html

and, most importantly, designed and implemented the initramfs code.

13
27.01.2020, 19:57

Теги

Похожие вопросы