ARCH := arm CROSS_COMPILE := arm-linux-gnueabihf- build_dir := $(CURDIR)/build-simone output_dir := $(HOME) modules_out_dir := /mnt/simone 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") tftproot := /var/lib/tftpboot make_options := -f Makefile \ -j$(makethreads) -l$(makejobs) \ ARCH=arm \ CROSS_COMPILE=$(CROSS_COMPILE) \ KBUILD_OUTPUT=$(build_dir) \ INSTALL_MOD_PATH=$(modules_out_dir) make_flags := CONFIG_DEBUG_SECTION_MISMATCH=y .PHONY: help help: @echo "**** Common Makefile ****" @echo "make config - configure for platform \"foo\"" @echo "make build - build the kernel and produce a RAMdisk image" @echo @echo "example:" @echo "make -f simone.mak config" @echo "make -f simone.mak build" .PHONY: have-crosscompiler have-crosscompiler: @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 config-base: FORCE @mkdir -p $(build_dir) $(MAKE) $(make_options) ep93xx_defconfig $(CURDIR)/scripts/config --file $(config_file) \ --enable EP93XX_SDCE0_PHYS_OFFSET \ --enable MACH_SIM_ONE \ --enable SPI \ --enable SPI_EP93XX \ --enable MMC \ --enable MMC_SPI \ --enable EXT4_FS \ --enable DMADEVICES \ --enable DMA_ENGINE \ --enable EP93XX_DMA \ --enable FB \ --enable FB_EP93XX \ --enable FB_MODE_HELPERS \ --enable LOGO \ --enable I2C \ --enable I2C_GPIO \ --enable DEBUG_FS config-debian: config-base $(CURDIR)/scripts/config --file $(config_file) \ --enable DEVTMPFS \ --enable CGROUPS \ --enable CGROUP_FREEZER \ --enable CGROUP_DEVICE \ --enable CPUSETS \ --enable PROC_PID_CPUSET \ --enable CGROUP_CPUACCT \ --enable RESOURCE_COUNTERS \ --enable CGROUP_MEM_RES_CTLR \ --enable CGROUP_MEM_RES_CTLR_DISABLED \ --enable CGROUP_MEM_RES_CTLR_SWAP \ --enable CGROUP_SCHED \ --enable FAIR_GROUP_SCHED \ --enable BLK_CGROUP \ --enable NAMESPACES \ --enable SCHED_AUTOGROUP \ --enable FHANDLE \ --enable SWAP \ --module AUTOFS4_FS config-kasan: config-base $(CURDIR)/scripts/config --file $(config_file) \ --enable KASAN \ --enable KASAN_OUTLINE \ --enable STACKTRACE \ --enable SLUB \ --enable SLUB_DEBUG_ON \ --enable TEST_KASAN config-earlydebug: config-base $(CURDIR)/scripts/config --file $(config_file) \ --enable DEBUG_KERNEL \ --enable DEBUG_LL \ --enable EARLY_PRINTK \ --set-str CMDLINE "earlyprintk" config-gpiokeys: config-base $(CURDIR)/scripts/config --file $(config_file) \ --enable INPUT \ --enable INPUT_KEYBOARD \ --enable KEYBOARD_GPIO config: config-base config-gpiokeys config-earlydebug yes "" | make $(make_options) oldconfig allconfig: config make $(make_options) allmodconfig menuconfig: FORCE if [ ! -d $(build_dir) ] ; then \ echo "no build dir" ; \ exit 1 ; \ fi $(MAKE) $(make_options) menuconfig $(MAKE) $(make_options) savedefconfig saveconfig: FORCE yes "" | make $(make_options) oldconfig $(MAKE) $(make_options) savedefconfig cp $(build_dir)/defconfig arch/arm/configs/ep93xx_defconfig build-zimage: have-crosscompiler FORCE $(MAKE) $(make_options) zImage $(make_flags) build-modules: have-crosscompiler FORCE $(MAKE) $(make_options) modules $(make_flags) $(MAKE) $(make_options) modules_install $(make_flags) build: have-crosscompiler build-zimage FORCE @echo "Copy vmlinux to $(output_dir)/vmlinux" @cp -f $(build_dir)/vmlinux $(output_dir)/vmlinux @echo "Copy zImage to $(output_dir)/zImage" @cp -f $(build_dir)/arch/arm/boot/zImage $(output_dir)/zImage @which mkimage > /dev/null ; \ if [ ! $$? -eq 0 ] ; then \ echo "mkimage not in PATH=$$PATH" ; \ echo "This tool creates the uImage and comes from the uboot tools" ; \ echo "On Ubuntu/Debian sudo apt-get install uboot-mkimage" ; \ echo "SKIPPING uImage GENERATION" ; \ else \ mkimage \ -A arm \ -O linux \ -T kernel \ -C none \ -a 0xc0008000 \ -e 0xc0008000 \ -n "SIM.ONE kernel" \ -d $(output_dir)/zImage \ $(output_dir)/uImage ; \ fi # If we have a TFTP boot directory if [ -w $(tftproot) ] ; then \ cp $(output_dir)/uImage $(tftproot) ; \ echo "set serverip 169.254.1.1 ; set ipaddr 169.254.1.2 ; tftpboot 0xc1000000 uImage ; bootm" ; \ fi 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: