#!/bin/bash

#                    auto make System.map to C header file
# 说明:
# 该脚本主要是将Linux内核生成的System.map文件中的符号、地址存入结构体中,
# 目前认为也许可以在内核驱动中直接调用对应的函数。以前在学习裸板开发中就有
# 使用Uboot中提供的printf来写程序的先例,那么这里应该也是可以的,不过这里没
# 有什么实用性,因为5W个函数,但这个结构体就要用掉进200kByte空间。
#
# -- 深圳 南山平山村 曾剑锋 if [ $# -ne ]; then
echo "USAGE:"
echo " systemMap.sh <your system.Map file>"
exit -
fi cat > systemMap.h << EOF
#ifndef __SYSTEM_MAP_H__
#define __SYSTEM_MAP_H__ typedef struct System_header {
EOF cat $ | awk '{print "\t unsigned int "$3";"}' | sort | uniq | grep -v "[\.&]" >> systemMap.h cat >> systemMap.h << EOF
} System_header; System_header system_header = {
EOF cat $ | 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的更多相关文章

  1. 进度记录 和 安装imagick时Cannot locate header file MagickWand.h错误的解决

    修改php.ini文件,已使php支持扩展的功能 [root@localhost imagick-2.2.2]# ./configure --with-php-config=/usr/local/ph ...

  2. System.map详解

    system.map内容格式为:线性地址类型符号 具体内容如下: 00100000 A phys_startup_32 c0100000 T startup_32 c0100000 A _text   ...

  3. 内核编译之vmlinuz vmlinux system.map initrd

    一.vmlinuz  vmlinuz是可引导的.压缩的内核.“vm”代表“Virtual Memory”.Linux 支持虚拟内存,不像老的操作系统比如DOS有640KB内存的限制.Linux能够使用 ...

  4. System.map

    System.map是一个特定内核的内核符号表.它是你当前运行的内核的System.map的链接. 内核符号表是怎么创建的呢? System.map是由“nm vmlinux”产生并且不相关的符号被滤 ...

  5. 原文:I don’t want to see another “using namespace xxx;” in a header file ever again

    http://stackoverflow.com/questions/5849457/using-namespace-in-c-headers http://stackoverflow.com/que ...

  6. System.map文件【转】

    转自:http://blog.csdn.net/david104/article/details/7194185 当运行GNU链接器gld(ld)时若使用了"-M"选项,或者使用n ...

  7. System.BadImageFormatException: Could not load file or assembly

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319>InstallUtil.exe C:\_PRODUKCIJA\Debug\DynamicHtmlT ...

  8. 【iOS】The differences between Class Extension and Header File 类扩展与头文件的区别

    . As the name suggests, they extend the class. A class continuation is another name. The class exten ...

  9. c++预编译问题:fatal error C1083: Cannot open precompiled header file: 'Debug/DllTest.pch': No such file or d

    1)单独编译StdAfx.cpp 2)编译所有(即按Ctrl+F7) 这时因为该模块没有包括预编译头文件“stdafx.h”的缘故.VC用一个stdafx.cpp包含头文件stdafx.h,然后在st ...

随机推荐

  1. Android UI学习1:控件和基本事件的响应

    在任何一个 GUI 系统中,控制界面上的控件(通常称为控件)都是一个基本的内容.对于 Android 应用程序,控件称为 View. 在 Android 中,在处理 UI 中的各种元素的时候,两个程序 ...

  2. opencv学习笔记(02)——遍历图像(指针法)

    #include <opencv2\core\core.hpp> #include <opencv2\highgui\highgui.hpp> #include <ope ...

  3. jQuery 的 json 格式的处理问题

    在实际的使用中时常会发生一些ajax验证的诡异事件,如我在一个文件中使用json传送数据,结果出现了当数据发送到服务器端时(后端主要呈现的是对json数据对象的数据库查询操作),结果显示的是数据已经插 ...

  4. JavaScript console 用法大全

    对于前端开发者来说,在开发过程中需要监控某些表达式或变量的值的时候,用 debugger 会显得过于笨重,取而代之则是会将值输出到控制台上方便调试.最常用的语句就是console.log(expres ...

  5. Linux安装oracle 10g常见问题之——ORA-01078,LRM-00109,ORA-01102

    [oracle@toughhou database]$ sqlplus /nolog SQL> conn / as sysdba SQL> startup ORA-01078: failu ...

  6. dictionary 和 hashtable 区别

    区别:1,Dictionary支持泛型,而Hashtable不支持. 2,Dictionary没有装填因子(Load Facto)概念,当容量不够时才扩容(扩容跟Hashtable一样,也是两倍于当前 ...

  7. Spring.net Could not load type from string value问题解决办法

    Spring.net Could not load type from string value "xxx" 错误原因可能有: 1.spring.net配置错误,注意要区别配置文件 ...

  8. hdu 3631

    最短路  执行一遍 Floyd算法    比赛的时候没有想到, 用了优化的Dijkstra  超时到死 #include <cstdio> #include <cstring> ...

  9. express 3.0.x 中默认不支持flash() 的解决方法

    Express 3.x默认已经不支持req.flash(),如果要用flash()需要这样兼容 1.flash 消息暂存在session中,需要cookieParser 和 session中间件来声明 ...

  10. STL,ATL,WTL之间的联系和区别

    STL即 Standard Template Library (标准模板库) STL是惠普实验室开发的一系列软件的统称.它是由Alexander Stepanov.Meng Lee和David R M ...