vmlinuzファイルから.configファイルをインポートできますか?

vmlinuzファイルから.configファイルをインポートできますか?

私はArch Linuxを使用し、カスタムカーネルを/boot/vmlinuz-linux1。テキストエディタで最初のカーネル設定と比較できるように、2番目のファイルからカーネル設定ファイルをどのように/boot/vmlinuz-linux検索できますか?.configvmlinuz

ベストアンサー1

私が知っている限り、設定オプション(設定メニューの項目として利用可能)を使用してコンパイルする場合にのみ、.config カーネルから設定ファイルを抽出できます。この設定オプションのドキュメントは次のとおりです。CONFIG_IKCONFIGGeneral setup > Kernel .config support

CONFIG_IKCONFIG:                                                                                                                                                                      

This option enables the complete Linux kernel ".config" file
contents to be saved in the kernel. It provides documentation
of which kernel options are used in a running kernel or in an
on-disk kernel.  This information can be extracted from the kernel
image file with the script scripts/extract-ikconfig and used as
input to rebuild the current kernel or to build another kernel.
It can also be extracted from a running kernel by reading
/proc/config.gz if enabled (below).

最後の文は、CONFIG_IKCONFIG_PROC擬似ファイルシステムのファイルを介して実行されているカーネルの構成にアクセスできる追加の構成オプションを示しています。proc

カーネルが でコンパイルされていないと、CONFIG_IKCONFIGその設定を簡単に検索できないようです。それ以外の場合は簡単です。

gunzip /proc/config.gz > .config

選択して現在カーネルをCONFIG_IKCONFIG_PROC実行している場合、または/boot/vmlinuz-linux

scripts/extract-ikconfig /boot/vmlinuz-linux

スクリプトはextract-ikconfigカーネルソースコードに付属しており、フォルダにありますscripts

おすすめ記事