Kernel

Linux核心路徑和壓縮

  • October 27, 2019

我正在嘗試查找 Linux 核心路徑,以找出它在工業 Raspberry Pi 中使用的壓縮類型。

我正在執行命令cat /proc/cmdline並獲取輸出:

dwc_otg.lpm_enable=0 smsc95xx.macaddr=18:83:C4:04:49:C5 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait noinitrd elevator=deadline bcm2708_fb.fbwidth=1920 bcm2708_fb.fbheight=1080

的內容/boot是(Linux核心鏡像應該在這裡):

total 24948
-rwxr-xr-x 1 root root   15747 Jul 31  2018 bcm2710-rpi-cm3.dtb
-rwxr-xr-x 1 root root    3667 Jul 31  2018 bcm2710-rpi-cm3.dts
-rwxr-xr-x 1 root root   50192 Feb 10  2017 bootcode.bin
-rwxr-xr-x 1 root root     391 Oct  7  2019 boot.scr
-rwxr-xr-x 1 root root     136 Jan  1  1980 cmdline.txt
-rwxr-xr-x 1 root root     103 Jul 31  2018 config.txt
-rwxr-xr-x 1 root root       4 Oct  7  2019 console_status
-rwxr-xr-x 1 root root   18693 Aug 21  2015 COPYING.linux
-rwxr-xr-x 1 root root   39946 Jul 31  2018 dt-blob.bin
-rwxr-xr-x 1 root root   62963 Jul 31  2018 dt-blob.dts
-rwxr-xr-x 1 root root    2527 Nov 25  2016 fixup_cd.dat
-rwxr-xr-x 1 root root    6617 Feb 10  2017 fixup.dat
-rwxr-xr-x 1 root root    9751 Nov 25  2016 fixup_db.dat
-rwxr-xr-x 1 root root    9749 Nov 25  2016 fixup_x.dat
-rwxr-xr-x 1 root root     512 Jan  1  1980 FSCK0000.REC
-rwxr-xr-x 1 root root     512 Jan  1  1980 FSCK0001.REC
-rwxr-xr-x 1 root root     512 Jan  1  1980 FSCK0002.REC
-rwxr-xr-x 1 root root     512 Jan  1  1980 FSCK0003.REC
-rwxr-xr-x 1 root root     145 Nov 25  2016 issue.txt
-rwxr-xr-x 1 root root 4228952 Feb 10  2017 kernel7.img
-rwxr-xr-x 1 root root 4128712 Nov 25  2016 kernel.img
-rwxr-xr-x 1 root root    1494 Nov 18  2015 LICENCE.broadcom
-rwxr-xr-x 1 root root   18974 Nov 25  2016 LICENSE.oracle
drwxr-xr-x 2 root root    8192 Jul 31  2018 overlays
-rwxr-xr-x 1 root root  633636 Nov 25  2016 start_cd.elf
-rwxr-xr-x 1 root root 4954692 Nov 25  2016 start_db.elf
-rwxr-xr-x 1 root root 2830532 Feb 10  2017 start.elf
-rwxr-xr-x 1 root root 3904260 Nov 25  2016 start_x.elf
drwxr-xr-x 2 root root     512 Feb 10  2017 System Volume Information
-rwxr-xr-x 1 root root     383 Jan  1 01:00 tb_config
-rwxr-xr-x 1 root root   35700 Jan  1 01:00 tb_config_tmp
-rwxr-xr-x 1 root root     391 Jul 31  2018 tmp_boot.cmd_servic_off
-rwxr-xr-x 1 root root     438 Jul 31  2018 tmp_boot.cmd_servic_on
-rwxr-xr-x 1 root root  340632 Feb 10  2017 u-boot.bin
-rwxr-xr-x 1 root root 4228672 Feb 10  2017 zImage

但我看不出它們之間的關係……有人可以幫我辨識圖像並解釋命令的輸出cat /proc/cmdline嗎?

更新

在我的帶有 Arch Linux 的筆記型電腦中,這種關係很清楚:

輸入:cat/proc/cmdline

輸出:BOOT_IMAGE=/vmlinuz-linux root=UUID=[...] rw quiet

/boot我可以找到:

-rw-r--r-- 1 root root 6289792 oct 18 02:15 vmlinuz-linux

您正在查找zImage列表底部呼叫的文件。

如果我沒記錯的話,那是gzip引導載入程序載入的壓縮核心映像。

我在快速搜尋中找到的最佳參考是https://en.wikipedia.org/wiki/Vmlinux

如果有人有更好的參考,請隨時編輯或評論。

引用自:https://unix.stackexchange.com/questions/548523