CROSS_COMPILE ?= arm-none-eabi- PLATFORM ?= href500 PATCHDIR := /proj/fairbanks_lx/users/coresw/linux-next-patches build_dir := $(CURDIR)/build-u8500 output_dir := $(HOME) rootfs := $(PATCHDIR)/rootfs-u8500.cpio genflash := $(PATCHDIR)/generate-flash-script.sh gentxt := $(PATCHDIR)/generate-command-txt.sh install_dir := $(build_dir)/install config_file := $(build_dir)/.config strip := $(CROSS_COMPILE)strip objcopy := $(CROSS_COMPILE)objcopy ARCH ?= arm make_options := -f Makefile \ ARCH=$(ARCH) \ CROSS_COMPILE=$(CROSS_COMPILE) \ KBUILD_OUTPUT=$(build_dir) .PHONY: help help: @echo "**** Common Makefile ****" @echo "make config [PLATFORM=foo] - configure for platform \"foo\"" @echo "make build - build the kernel and produce a RAMdisk image" @echo @echo "example:" @echo "make -f u8500.mak PLATFORM=href500 config" @echo "make -f u8500.mak PLATFORM=href500 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: @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 .PHONY: have-mkimage have-mkimage: @echo -n "Check that mkimage is available..." @which mkimage > /dev/null ; \ if [ ! $$? -eq 0 ] ; then \ echo "ERROR: mkimage not in PATH=$$PATH!" ; \ echo "This toom creates the uImage and comes from the uboot tools" ; \ echo "On Ubuntu/Debian sudo apt-get install uboot-mkimage" ; \ echo "ABORTING." ; \ exit 1 ; \ else \ echo "OK" ;\ fi .PHONY: have-gencommands have-gencommands: FORCE @if [ ! -f $(genflash) ] ; then \ echo "ERROR: missing $(genflash)" ; \ echo "This is needed to generate the \"flash.scr\" file" ; \ echo "ABORTING." ; \ exit 1 ; \ else \ echo "flash.scr generator available at $(genflash)" ; \ fi @if [ ! -f $(gentxt) ] ; then \ echo "ERROR: missing $(gentxt)" ; \ echo "This is needed to generate the \"command.txt\" file" ; \ echo "ABORTING." ; \ exit 1 ; \ else \ echo "command.txt generator available at $(gentxt)" ; \ fi # For early printk # --enable DEBUG_LL # --enable EARLY_PRINTK # --set-str CMDLINE "root=/dev/ram0 console=ttyAMA2,115200n8 earlyprintk" # --set-str UX500_DEBUG_UART 2 # This currently does not work # --enable TICK_ONESHOT # --enable NO_HZ # --enable HIGH_RES_TIMERS # This needs the CPU hotplug and CPUfreq patches # --enable HOTPLUG_CPU # --enable CPU_FREQ config: have-rootfs FORCE @mkdir -p $(build_dir) @cp $(rootfs) $(build_dir) $(MAKE) $(make_options) u8500_defconfig # Reconfigure a bit $(CURDIR)/scripts/config --file $(build_dir)/.config \ --enable BLK_DEV_INITRD \ --set-str INITRAMFS_SOURCE rootfs-u8500.cpio \ --enable RD_GZIP \ --enable INITRAMFS_COMPRESSION_GZIP \ --enable DEBUG_FS \ --enable DMADEVICES \ --enable STE_DMA40 \ --enable RTC_CLASS \ --enable RTC_DRV_PL031 \ --enable HW_RANDOM \ --enable HW_RANDOM_NOMADIK \ --enable I2C \ --enable I2C_NOMADIK \ --enable MFD_TC35892 \ --enable GPIO_TC35892 \ --enable MFD_STMPE \ --enable INPUT_KEYBOARD \ --enable KEYBOARD_NOMADIK \ --enable KEYBOARD_STMPE \ --enable INPUT_TOUCHSCREEN \ --enable TOUCHSCREEN_BU21013 \ --enable INPUT_MISC \ --enable INPUT_AB8500_PONKEY \ --enable GPIO_STMPE \ --enable AB8500_CORE \ --enable REGULATOR \ --enable REGULATOR_AB8500 \ --enable RTC_DRV_AB8500 \ --enable MMC \ --enable MMC_BLOCK \ --enable MMC_BLOCK_BOUNCE \ --enable MMC_ARMMMCI \ --enable EXT3_FS \ --enable FAT_FS \ --enable VFAT_FS \ --enable NLS \ --enable NLS_CODEPAGE_437 \ --enable NLS_ISO8859_1 yes "" | make $(make_options) oldconfig menuconfig: FORCE $(MAKE) $(make_options) menuconfig build: have-rootfs have-gencommands have-crosscompiler have-mkimage FORCE $(MAKE) $(make_options) -j 4 uImage CONFIG_DEBUG_SECTION_MISMATCH=y # $(MAKE) $(make_options) -j 4 modules # Copy to output dir cp -f $(build_dir)/arch/arm/boot/uImage $(output_dir)/uImage # Generate flash.scr $(genflash) $(PLATFORM) $(output_dir)/uImage $(output_dir)/flash.scr # Generate legacy command.txt $(gentxt) $(PLATFORM) $(output_dir)/uImage $(output_dir)/command.txt regressiontest: config $(MAKE) $(make_options) realview_defconfig $(MAKE) $(make_options) -j 4 vmlinux CONFIG_DEBUG_SECTION_MISMATCH=y $(MAKE) $(make_options) -j 4 modules $(MAKE) $(make_options) versatile_defconfig $(MAKE) $(make_options) -j 4 vmlinux CONFIG_DEBUG_SECTION_MISMATCH=y $(MAKE) $(make_options) -j 4 modules $(MAKE) $(make_options) integrator_defconfig $(MAKE) $(make_options) -j 4 vmlinux CONFIG_DEBUG_SECTION_MISMATCH=y $(MAKE) $(make_options) -j 4 modules TAGS: FORCE $(MAKE) $(make_options) TAGS clean: $(MAKE) -f Makefile clean rm -f $(module_files) rm -rf build # 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: