例如,想要看 arch/arm/boot/compressed/head.S预处理后是什么样子
第一步:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage -j4 V=1
然后找到编译 arch/arm/boot/compressed/head.o的那一条完整命令
arm-linux-gnueabihf-gcc -Wp,-MD,arch/arm/boot/compressed/.head.o.d -nostdinc -isystem /home/fang/ti-processor-sdk-linux-am335x-evm-04.00.00.04/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/../lib/gcc/arm-linux-gnueabihf/6.2.1/include -I./arch/arm/include -I./arch/arm/include/generated/uapi -I./arch/arm/include/generated -I./include -I./arch/arm/include/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -D__ASSEMBLY__ -fno-PIE -mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp -marm -D__LINUX_ARM_ARCH__=7 -march=armv7-a -include asm/unified.h -msoft-float -DCC_HAVE_ASM_GOTO -DZIMAGE -DTEXT_OFFSET=0x00008000 -c -o arch/arm/boot/compressed/head.o arch/arm/boot/compressed/head.S
第二步:应用-E选项
将上面的完整命令,改一改
arm-linux-gnueabihf-gcc -nostdinc -isystem /home/fang/ti-processor-sdk-linux-am335x-evm-04.00.00.04/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/../lib/gcc/arm-linux-gnueabihf/6.2.1/include -I./arch/arm/include -I./arch/arm/include/generated/uapi -I./arch/arm/include/generated -I./include -I./arch/arm/include/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -D__ASSEMBLY__ -fno-PIE -mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp -marm -D__LINUX_ARM_ARCH__=7 -march=armv7-a -include asm/unified.h -msoft-float -DCC_HAVE_ASM_GOTO -DZIMAGE -DTEXT_OFFSET=0x00008000 -E arch/arm/boot/compressed/head.S -o arch/arm/boot/compressed/head.i
这样,arch/arm/boot/compressed/head.i就是预处理head.S后的内容了