Bug 1565486 - Support early microcode enabled initrd images in VFS
Summary: Support early microcode enabled initrd images in VFS
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: mc
Version: 27
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jindrich Novy
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-10 06:32 UTC by Pavol Šimo
Modified: 2018-07-03 08:11 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-06-26 12:29:16 UTC
Type: Bug


Attachments (Terms of Use)
uinitrd extfs (1.94 KB, text/plain)
2018-07-03 08:11 UTC, Pavol Šimo
no flags Details

Description Pavol Šimo 2018-04-10 06:32:24 UTC
Description of problem:
With early_microcode="yes" (dracut system default setting) the initrd image has to be preprocessed with skipcpio (/usr/lib/dracut/skipcpio from dracut package) to get the real contents of initrd image.

Steps to Reproduce:
1. press ENTER on /boot/initramfs*.img

Actual results:
mc displays only 2 files: early_cpio and kernel/x86/microcode/<microcode_file>

Expected results:
browse structure of original cpio initrd image, ie. about 1900 files

Additional info:
Example view command (mc.ext):
View=%view{ascii} /usr/lib/dracut/skipcpio %p | zcat | cpio -tv 2>/dev/null

Comment 1 Tomasz Kłoczko 2018-04-10 13:51:56 UTC
Just tested this on my system.

# file initramfs-4.16.0-0.rc7.git1.1.fc29.x86_64.img 
initramfs-4.16.0-0.rc7.git1.1.fc29.x86_64.img: ASCII cpio archive (SVR4 with no CRC)

and according to the type of the file mc reads it as cpio archive.
Using only "file" command result it is hard to figure out that it is initrd which consist from two parts.
If you have any idea about how to distinguish that cpio initrd should be processed using additionally skipcpio it may be possible to try implement more accurate mc vfs view.

In other words .. I have no idea how to solve this :-/
If initrd could return some output which would point that it is initrd it may be used as kind of "entry point".

It is hard to classify this as bug. More like something which would be good to handle it.

Tar for example has an option which could be used to add some label/comment to the arcvive

       -V, --label=TEXT
              Create archive with volume name TEXT.  If listing or extracting, use TEXT as a globbing pattern for volume name.

[root@domek boot]# tar cf test.tar -V "this is config file" config-4.15.0-1.fc28.x86_64 
[root@domek boot]# tar zfv test.tar
V--------- 0/0               0 2018-04-10 14:38 this is config file--Volume Header--
-rw-r--r-- root/root    194171 2018-01-29 10:26 config-4.15.0-1.fc28.x86_64

I don't see anything similar in cpio format.

Comment 2 Pavol Šimo 2018-05-11 06:31:13 UTC
I think there is actually only one method: check for presence of file early_cpio in the archive. When it is present, the archive has to be preprocessed.
Optionally check contents of the file (contains "1\n", bytes 0x31 0x0A) but this check can be safely ommited (initrd without early microcode doesn't contain this file).

Comment 3 Tomasz Kłoczko 2018-05-12 07:24:55 UTC
feel free to implement this.
I have no time to do this.

Comment 4 Tomasz Kłoczko 2018-06-26 12:29:16 UTC
Closing this ticket as it is not per se bug and no one is able provide way how to distinguish between regular cpio and cpio which is initrd.

Comment 5 Pavol Šimo 2018-07-03 08:11:16 UTC
Created attachment 1456139 [details]
uinitrd extfs

After copying the attachment as file /usr/libexec/mc/extfs.d/uinitrd, adding line

uinitrd

to the file /usr/libexec/mc/extfs.d/README.extfs and adding next section to /etc/mc/mc.ext I'm able to view both early_cpio files (actually only microcode file + early_cpio file as indicator, virtually moved into early_cpio/ folder) and contents of real initramfs:

# initrd
regex/^(initramfs.*\.img|initrd(-.+)?\.img(-.+)?)$
    Open=%cd %p/uinitrd://
    View=%view{ascii} /usr/lib/dracut/skipcpio %p | zcat | cpio -tv 2>/dev/null


Note You need to log in before you can comment on or make changes to this bug.