USE_LLVM := 1 CROSS_GCC := arm-none-eabi- ifeq ($(USE_LLVM),1) COMPILER := LLVM=1 else COMPILER := CROSS_COMPILE=$(CROSS_GCC) endif #CROSS_COMPILE ?= armv4l- CROSS_COMPILE ?= arm-linux-gnueabihf- PATCHDIR := ${HOME}/linux-stericsson build_dir := $(CURDIR)/build-$(MACHINE) output_dir := $(HOME) rootfs := $(HOME)/rootfs-h3600.cpio rootfsbase := $(shell basename $(rootfs)) install_dir := $(build_dir)/install config_file := $(build_dir)/.config strip := $(CROSS_COMPILE)strip objcopy := $(CROSS_COMPILE)objcopy makejobs := $(shell grep '^processor' /proc/cpuinfo | sort -u | wc -l) makethreads := $(shell dc -e "$(makejobs) 1 + p") make_parallel := -j$(makethreads) -l$(makejobs) make_options := -f Makefile \ ARCH=arm \ $(make_parallel) \ $(COMPILER) \ KBUILD_OUTPUT=$(build_dir) .PHONY: help help: @echo "**** Common Makefile ****" @echo "make config - configure the kernel" @echo "make build - build the kernel and produce a RAMdisk image" @echo @echo "example:" @echo "make -f $(MACHINE).mak config" @echo "make -f $(MACHINE).mak build" .PHONY: have-rootfs have-rootfs: @if [ ! -f $(rootfs) ] ; then \ echo "ERROR: no rootfs at $(rootfs)" ; \ echo "This is needed to boot the system." ; \ echo "ABORTING." ; \ exit 1 ; \ else \ echo "Rootfs available at $(rootfs)" ; \ fi .PHONY: have-crosscompiler have-crosscompiler: @if [ $(USE_LLVM) -eq 1 ] ; then \ echo "LLVM OK" ; \ else \ echo -n "Check that $(CROSS_COMPILE)gcc is available..." ; \ which $(CROSS_COMPILE)gcc > /dev/null ; \ if [ ! $$? -eq 0 ] ; then \ echo "ERROR: cross-compiler $(CROSS_COMPILE)gcc not in PATH=$$PATH!" ; \ echo "ABORTING." ; \ exit 1 ; \ else \ echo "OK" ;\ fi \ fi config-base: FORCE @mkdir -p $(build_dir) $(MAKE) $(make_options) h3600_defconfig config-initramfs: config-base FORCE @cp $(rootfs) $(build_dir)/$(rootfsbase) # Configure in the initramfs $(CURDIR)/scripts/config --file $(config_file) \ --enable BLK_DEV_INITRD \ --set-str INITRAMFS_SOURCE $(rootfsbase) \ --enable RD_GZIP \ --enable INITRAMFS_COMPRESSION_GZIP config-earlydebug: config-base FORCE $(CURDIR)/scripts/config --file $(config_file) \ --enable DEBUG_KERNEL \ --enable DEBUG_LL \ --enable EARLY_PRINTK \ --set-str CMDLINE "earlyprintk" config-kasan: config-base FORCE $(CURDIR)/scripts/config --file $(config_file) \ --enable KASAN \ --enable KASAN_OUTLINE \ --enable STACKTRACE \ --enable SLUB_DEBUG_ON \ --enable TEST_KASAN config-cfi: config-base $(CURDIR)/scripts/config --file $(config_file) \ --enable CFI_CLANG \ --enable CFI_PERMISSIVE \ --enable LKDTM config-mainlined-features: config-base FORCE # Then reconfigure various stuff $(CURDIR)/scripts/config --file $(config_file) \ --enable PREEMPT \ --enable NO_HZ_IDLE \ --enable IRDA \ --enable DEVTMPFS \ --enable FRAMEBUFFER_CONSOLE \ --enable LOGO \ --enable DMADEVICES \ --enable DMA_SA11X0 \ --enable DMATEST \ --enable DEBUG_FS # --enable FRAMEBUFFER_CONSOLE_ROTATION # Russell's patch stack config-russell: config-base FORCE $(CURDIR)/scripts/config --file $(config_file) \ --enable SOUND \ --enable SND \ --enable SND_SOC \ --enable SND_SOC_SA11X0_SSP \ --enable SND_SA11X0_H3XXX config-openembedded: config-base FORCE # Then reconfigure various stuff $(CURDIR)/scripts/config --file $(config_file) \ --enable KEYBOARD_IPAQ_MICRO \ --enable INPUT_EVDEV \ --enable INPUT_TOUCHSCREEN \ --enable TOUCHSCREEN_IPAQ_MICRO \ --enable POWER_SUPPLY \ --enable BATTERY_IPAQ_MICRO \ --enable NEW_LEDS \ --enable LEDS_CLASS \ --enable-after LEDS_CLASS LEDS_TRIGGERS \ --enable-after LEDS_TRIGGERS LEDS_TRIGGER_HEARTBEAT \ --enable-after LEDS_CLASS LEDS_IPAQ_MICRO \ --enable BACKLIGHT_LCD_SUPPORT \ --enable BACKLIGHT_CLASS_DEVICE \ --enable BACKLIGHT_IPAQ_MICRO \ --enable JFFS2_SUMMARY \ --enable JFFS2_COMPRESSION_OPTIONS \ --enable JFFS2_LZO \ --enable AEABI \ --enable OABI_COMPAT config: have-rootfs config-base config-mainlined-features config-initramfs config-cfi FORCE $(CURDIR)/scripts/config --file $(config_file) \ --set-str CMDLINE "console=ttySA0,115200n8 console=tty0" \ --disable CMDLINE_FROM_BOOTLOADER \ --disable CMDLINE_EXTEND \ --enable CMDLINE_FORCE \ --enable KEYBOARD_IPAQ_MICRO \ --enable INPUT_EVDEV \ --enable INPUT_TOUCHSCREEN \ --enable TOUCHSCREEN_IPAQ_MICRO \ --enable POWER_SUPPLY \ --enable BATTERY_IPAQ_MICRO \ --enable NEW_LEDS \ --enable LEDS_CLASS \ --enable-after LEDS_CLASS LEDS_TRIGGERS \ --enable-after LEDS_TRIGGERS LEDS_TRIGGER_HEARTBEAT \ --enable-after LEDS_CLASS LEDS_IPAQ_MICRO \ --enable BACKLIGHT_LCD_SUPPORT \ --enable BACKLIGHT_CLASS_DEVICE \ --enable BACKLIGHT_IPAQ_MICRO \ --enable JFFS2_SUMMARY \ --enable JFFS2_COMPRESSION_OPTIONS \ --enable JFFS2_LZO \ --enable AEABI \ --enable OABI_COMPAT \ --enable SA1100_H3800 yes "" | make $(make_options) oldconfig # Russell is skeptic about these. # --enable AEABI # --enable OABI_COMPAT menuconfig: FORCE if [ ! -d $(build_dir) ] ; then \ echo "no build dir" ; \ exit 1 ; \ fi $(MAKE) $(make_options) menuconfig $(MAKE) $(make_options) savedefconfig saveconfig: config-base config-mainlined-features config-openembedded FORCE yes "" | make $(make_options) oldconfig $(MAKE) $(make_options) savedefconfig cp $(build_dir)/defconfig arch/arm/configs/$(MACHINE)_defconfig build-zimage: have-crosscompiler FORCE $(MAKE) $(make_options) zImage $(make_flags) build: have-rootfs have-crosscompiler build-zimage FORCE @echo "Copy zImage to $(output_dir)/zImage" @cp -f $(build_dir)/arch/arm/boot/zImage $(output_dir)/zImage headers: have-rootfs have-crosscompiler build-zimage FORCE $(MAKE) $(make_options) headers_install INSTALL_HDR_PATH=/tmp clean: $(MAKE) -f Makefile clean rm -rf $(build_dir) # Rules without commands or prerequisites that do not match a file name # are considered to always change when make runs. This means that any rule # that depends on FORCE will always be remade also. FORCE: