配置CONFIG_DM9000
1.c源代码文件中包含
2.Makefile里面 driver/net/Makefile
3.include/config/auto.conf
4.inlcude/linux/autoconf.h 内容来源于.config
配置的时候y和m在源文件中体现不出来
在autoconf.h中y和m都是定义为1
#define CONFIG_DM9000 1
.config文件自动生成auto.conf---顶层Makefile使用
obj-$(CONFIG_DM9000)
.config文件自动生成autoconf.h,源文件使用
内核参考文档
linux2.6.22\trunk\Documentation\kbuild\makefiles.txt
a.c和b.c组成一个模块怎么搞
obj-m += ab.o
ab-objs := a.o b.o
内核make uImage目标在哪里
linux-2.6.22.6/arch/arm/Makefile'
顶层目录下Makefile包含了该Makefile
include $(srctree)/arch/$(ARCH)/Makefile
# commands to execute (from `/work/system/linux-2.6.22.6/arch/arm/Makefile', line 228):
$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
uImage依赖于vmlinux
zImage Image xipImage bootpImage uImage: vmlinux
$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
vmlinux依赖于哪些文件
vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
ifdef CONFIG_HEADERS_CHECK
$(Q)$(MAKE) -f $(srctree)/Makefile headers_check
endif
$(call if_changed_rule,vmlinux__)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@
$(Q)rm -f .old_version
$(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) 这些变量展开分别是什么东西?
$(vmlinux-lds):
mdb<43> p vmlinux-lds
Makefile:611 (origin: makefile) vmlinux-lds = arch/arm/kernel/vmlinux.lds
$(vmlinux-init) :
mdb<45> p vmlinux-init
Makefile:608 (origin: makefile) vmlinux-init = arch/arm/kernel/head.o arch/arm/kernel/init_task.o init/built-in.o
$(vmlinux-main) :
mdb<46> p vmlinux-main
Makefile:609 (origin: makefile) vmlinux-main = usr/built-in.o arch/arm/kernel/built-in.o arch/arm/mm/built-in.o arch/arm/common/built-in.o arch/arm/mach-s3c2410/built-in.o arch/arm/mach-s3c2400/built-in.o arch/arm/mach-s3c2412/built-in.o arch/arm/mach-s3c2440/built-in.o arch/arm/mach-s3c2442/built-in.o arch/arm/mach-s3c2443/built-in.o arch/arm/nwfpe/built-in.o arch/arm/plat-s3c24xx/built-in.o kernel/built-in.o mm/built-in.o fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o block/built-in.o arch/arm/lib/lib.a lib/lib.a arch/arm/lib/built-in.o lib/built-in.o drivers/built-in.o sound/built-in.o net/built-in.o
$(kallsyms.o) :
mdb<47> p kallsyms.o
Makefile:685 (origin: makefile) kallsyms.o = .tmp_kallsyms2.o
内核:处理u-boot传入的参数
最终目的:应用程序
这样看第一个文件就是head.S
生成的内核比较大,所以将其进行压缩,然后在内核前面放自解压的代码.
.section ".text.head", "ax"
.type stext, %function
ENTRY(stext)
msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | SVC_MODE @ ensure svc mode
@ and irqs disabled
mrc p15, 0, r9, c0, c0 @ get processor id
bl __lookup_processor_type @ r5=procinfo r9=cpuid
movs r10, r5 @ invalid processor (r5=0)?
beq __error_p @ yes, error 'p'
bl __lookup_machine_type @ r5=machinfo
movs r8, r5 @ invalid machine (r5=0)?
beq __error_a @ yes, error 'a'
bl __create_page_tables
__lookup_processor_type函数
.type __lookup_processor_type, %function
__lookup_processor_type:
adr r3, 3f
ldmda r3, {r5 - r7}
sub r3, r3, r7 @ get offset between virt&phys
add r5, r5, r3 @ convert virt addresses to
add r6, r6, r3 @ physical address space
1: ldmia r5, {r3, r4} @ value, mask
and r4, r4, r9 @ mask wanted bits
teq r3, r4
beq 2f
add r5, r5, #PROC_INFO_SZ @ sizeof(proc_info_list)
cmp r5, r6
blo 1b
mov r5, #0 @ unknown processor
2: mov pc, lr
内核版本命名的特点
嵌入式linux应用开发完全手册
16.1 版本及特点