linux kernel 实现多平台编译 (linux 内核调试)
[复制链接]
1、在kconfig中添加编译平台
Index: arch/arm/mach-hi3516a/Kconfig
===================================================================
--- arch/arm/mach-hi3516a/Kconfig (revision 106)
+++ arch/arm/mach-hi3516a/Kconfig (working copy)
@@ -33,6 +33,17 @@
please select HAVE_ARM_LOCAL_TIMER.
endchoice
+
+config MACH_UPANO_HI3516A_SENSOR
+ bool "hi3516a sensor module"
+ default y
+ depends on MACH_HI3516A
+
+config MACH_UPANO_HI3516A_MAIN
+ bool "hi3516a main module"
+ default y
+ depends on MACH_HI3516A
+
config DEFAULT_BUSCLK
int "DEFAULT_BUSCLK"
default "50000000"
|
2、添加对应的.config文件
A + arch/arm/configs/hi3516a_test1_defconfig
A + arch/arm/configs/hi3516a_test2_defconfig
CONFIG_MACH_HI3516A=y
CONFIG_HAVE_SP804_LOCAL_TIMER_HI3516A=y
# CONFIG_HAVE_ARM_LOCAL_TIMER_HI3516A is not set
# CONFIG_MACH_HI3516A_TEST1 is not set
CONFIG_MACH_HI3516A_TEST2=y
|
在.config 中添加对应的平台配置
3、在kernel 启动的时候打印系统信息的时候,添加打印出板子的平台信息
Index: arch/arm/kernel/setup.c
===================================================================
--- arch/arm/kernel/setup.c (revision 106)
+++ arch/arm/kernel/setup.c (working copy)
@@ -474,6 +474,14 @@
cpu_cache = *list->cache;
#endif
+#if defined(CONFIG_MACH_HI3516A_TEST1)
+ printk("BOARD_TYPE := HI3516A_TEST1\n");
+#elif defined(CONFIG_MACH_HI3516A_TEST2)
+ printk("BOARD_TYPE := HI3516A_TEST2\n");
+#else
+ printk("BOARD_TYPE := Unknown board\n");
+#endif
+
printk("CPU: %s [%08x] revision %d (ARMv%s), cr=%08lx\n",
cpu_name, read_cpuid_id(), read_cpuid_id() & 15,
proc_arch[cpu_architecture()], cr_alignment);
|
4、更新内核启动信息
init/main.c--->start_kernel--->setup_arch--->arch/arm/kernel/setup.c--->setup_arch--->setup_processor
|