auto make System.map to C header file
生活随笔
收集整理的這篇文章主要介紹了
auto make System.map to C header file
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
#!/bin/bash# auto make System.map to C header file
# 說明:
# 該腳本主要是將Linux內核生成的System.map文件中的符號、地址存入結構體中,
# 目前認為也許可以在內核驅動中直接調用對應的函數。以前在學習裸板開發中就有
# 使用Uboot中提供的printf來寫程序的先例,那么這里應該也是可以的,不過這里沒
# 有什么實用性,因為5W個函數,但這個結構體就要用掉進200kByte空間。
#
# 2016-3-19 深圳 南山平山村 曾劍鋒if [ $# -ne 1 ]; thenecho "USAGE:"echo " systemMap.sh <your system.Map file>"exit -1
ficat > systemMap.h << EOF
#ifndef __SYSTEM_MAP_H__
#define __SYSTEM_MAP_H__typedef struct System_header {
EOFcat $1 | awk '{print "\t unsigned int "$3";"}' | sort | uniq | grep -v "[\.&]" >> systemMap.hcat >> systemMap.h << EOF
} System_header;System_header system_header = {
EOFcat $1 | awk '{print $3 " \t= " "0x"$1","}' | sort -n -k1 | uniq | grep -v "[\.&]" | sed -e "s/^/\\t\./g" >> systemMap.h cat >> systemMap.h << EOF
};
#endif // __SYSTEM_MAP_H__
EOF# cat systemMap.h
# #ifndef __SYSTEM_MAP_H__
# #define __SYSTEM_MAP_H__
#
# typedef struct System_header {
# unsigned int a_aidl_bdis_tmr;
# unsigned int aalg_list;
# unsigned int ablkcipher_decrypt;
# unsigned int ablkcipher_decrypt_done;
# unsigned int ablkcipher_encrypt;
# unsigned int ablkcipher_encrypt_done;
# ......
# } System_header;
#
# System_header system_header = {
# .a_aidl_bdis_tmr = 0xc0a62660,
# .aalg_list = 0xc09f2a28,
# .ablkcipher_decrypt = 0xc04c3568,
# .ablkcipher_decrypt_done = 0xc04c1480,
# .ablkcipher_encrypt = 0xc04c34d4,
# .ablkcipher_encrypt_done = 0xc04c14f0,
# ......
# };
# #endif // __SYSTEM_MAP_H_
?
總結
以上是生活随笔為你收集整理的auto make System.map to C header file的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ReactJS学习笔记——npm、JSX
- 下一篇: Creating-Observables