295 Star 1.8K Fork 235

GVP泰晓科技/Linux Lab

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
extract-ikconfig 842 Bytes
一键复制 编辑 原始数据 按行查看 历史
falcon 提交于 2021-02-01 09:41 +08:00 . Update author contact information
#!/bin/bash
#
# extract-ikconfig -- a more human readable script to extract kernel config.gz
#
# Author: Wu Zhangjin <lzufalcon@163.com>, 2019.07.19
# Copyright (C) 2016-2021 Wu Zhangjin <falcon@ruma.tech>
#
# ref: kernel/configs.c: .rodata ( ... IKCFG_ST.........................IKCFG_ED ... )
# ^ kernel/config_data.gz ^
# scripts/extract-ikconfig
#
# Check invocation:
me=${0##*/}
img=$1
if [ $# -ne 1 -o ! -s "$img" ]; then
echo "Usage: $me <kernel-image>" >&2
exit 2
fi
pos=$(grep -abo "IKCFG_ST" $img)
[ $? -ne 0 ] && echo "$me: Cannot find kernel config." >&2 && exit 1
pos=${pos%%:*}
kcfg_start=$(($pos+8))
pos=$(grep -abo "IKCFG_ED" $img)
pos=${pos%%:*}
kcfg_end=$(($pos-1))
kcfg_bytes=$(($kcfg_end-$kcfg_start+1))
dd if=$img bs=1 skip=$kcfg_start count=$kcfg_bytes | zcat
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/tinylab/linux-lab.git
git@gitee.com:tinylab/linux-lab.git
tinylab
linux-lab
Linux Lab
next

搜索帮助