CROSS_COMPILE ?= arm-none-eabi- #CROSS_COMPILE ?= arm-linux-gnueabihf- build_dir := $(CURDIR)/build-nomadik output_dir := $(HOME) rootfs := $(HOME)/rootfs-nhk8815.cpio install_dir := $(build_dir)/install config_file := $(build_dir)/.config strip := $(CROSS_COMPILE)strip objcopy := $(CROSS_COMPILE)objcopy rootfsbase := $(shell basename $(rootfs)) #dtb := $(build_dir)/arch/arm/boot/dts/ste-nomadik-nhk15.dtb dtb := $(build_dir)/arch/arm/boot/dts/ste-nomadik-s8815.dtb makejobs := $(shell grep '^processor' /proc/cpuinfo | sort -u | wc -l) makethreads := $(shell dc -e "$(makejobs) 1 + p") make_options := -f Makefile \ -j$(makethreads) -l$(makejobs) \ ARCH=arm \ 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 nomadik.mak config" @echo "make -f nomadik.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: @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-pristine: have-rootfs @mkdir -p $(build_dir) @cp $(rootfs) $(build_dir) $(MAKE) $(make_options) nhk8815_defconfig yes "" | make $(make_options) oldconfig config-base: FORCE @mkdir -p $(build_dir) @if [ -r $(config_file) ] ; then \ rm $(config_file) ; \ fi $(MAKE) $(make_options) nhk8815_defconfig # Config options needed to bring up rootfs on distros config-distro: config-base have-rootfs @cp $(rootfs) $(build_dir)/$(rootfsbase) $(CURDIR)/scripts/config --file $(config_file) \ --enable PARTITION_ADVANCED \ --enable LDM_PARTITION \ --enable MSDOS_PARTITION \ --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 \ --enable AUTOFS4_FS \ --enable BSD_PROCESS_ACCT \ --enable BSD_PROCESS_ACCT_V3 \ --enable TASKSTATS \ --enable TASK_DELAY_ACCT \ --enable TASK_XACCT \ --enable TASK_IO_ACCOUNTING \ --enable BUILD_BIN2C \ --enable IKCONFIG \ --enable IKCONFIG_PROC \ --enable PAGE_COUNTER \ --enable MEMCG \ --enable MEMCG_SWAP \ --enable MEMCG_SWAP_ENABLED \ --enable MEMCG_KMEM \ --enable CGROUP_PERF \ --enable CGROUP_WRITEBACK \ --enable USER_NS \ --enable BLK_DEV_BSG \ --enable BLK_DEV_BSGLIB \ --enable BLK_DEV_INTEGRITY \ --enable NET_INGRESS \ --enable IP_ADVANCED_ROUTER \ --set-str UEVENT_HELPER_PATH "" \ --enable WANT_DEV_COREDUMP \ --enable DEV_COREDUMP \ --enable CHR_DEV_SG \ --enable KEYS \ --enable ENCRYPTED_KEYS \ --enable SECURITY \ --enable SECURITYFS \ --enable SECURITY_NETWORK \ --enable SECURITY_NETWORK_XFRM \ --enable SECURITY_PATH \ --enable INTEGRITY \ --enable CRYPTO_USER_API \ --enable CRYPTO_USER_API_HASH \ --enable CRYPTO_USER_API_SKCIPHER \ --enable CRYPTO_USER_API_AEAD \ --enable ARM_CRYPTO \ --enable CRYPTO_SHA1_ARM \ --enable CRYPTO_SHA256_ARM \ --enable CRYPTO_SHA512_ARM \ --enable CRYPTO_AES_ARM \ --enable BINARY_PRINTF \ --enable MD \ --enable BLK_DEV_DM_BUILTIN \ --enable BLK_DEV_DM \ --enable DM_CRYPT \ --enable DM_UEVENT config-bfq: config-base @echo "Enabling BFQ" $(CURDIR)/scripts/config --file $(config_file) \ --enable IOSCHED_BFQ \ --enable DEFAULT_BFQ \ --disable IOSCHED_DEADLINE \ --disable IOSCHED_CFQ config-initramfs: config-base have-rootfs @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-mainlined-features: config-base # Then reconfigure various stuff $(CURDIR)/scripts/config --file $(config_file) \ --enable DEBUG_FS \ --disable MMC_DEBUG \ --disable DEBUG_GPIO \ --enable MTD \ --enable MTD_PARTITIONS \ --enable MTD_CMDLINE_PARTS \ --enable MTD_NAND \ --enable MTD_NAND_FSMC \ --enable HW_RANDOM \ --enable HW_RANDOM_NOMADIK \ --enable RTC \ --enable RTC_DRV_PL031 \ --enable DMADEVICES \ --enable AMBA_PL08X \ --enable I2C_NOMADIK \ --enable MMC \ --enable MMC_ARMMMCI \ --enable NOMADIK_MTU_SCHED_CLOCK \ --enable NEW_LEDS \ --enable LEDS_CLASS \ --enable LEDS_GPIO \ --enable LEDS_TRIGGERS \ --enable LEDS_TRIGGER_HEARTBEAT \ --enable KEYBOARD_GPIO \ --enable REGULATOR \ --enable NO_HZ_COMMON \ --enable NO_HZ_IDLE \ --enable HIGH_RES_TIMERS \ --enable IIO \ --enable IIO_ST_ACCEL_3AXIS \ --enable IIO_ST_ACCEL_I2C_3AXIS \ --disable IIO_ST_ACCEL_SPI_3AXIS \ --enable MFD_STMPE \ --enable STMPE_I2C \ --enable KEYBOARD_STMPE \ --enable GPIO_STMPE \ --enable IIO_BUFFER \ --enable IIO_TRIGGER \ --enable MFD \ --enable MFD_STW481X \ --enable PWM \ --enable PWM_SYSFS \ --enable PWM_STMPE \ --enable BACKLIGHT_LCD_SUPPORT \ --enable BACKLIGHT_CLASS_DEVICE \ --enable BACKLIGHT_PWM \ --enable SPI \ --enable SPI_MASTER \ --enable SPI_GPIO \ --disable FB_ARMCLCD \ --enable CMA \ --enable FB \ --enable DRM \ --enable DRM_PL111 \ --enable FRAMEBUFFER_CONSOLE \ --enable DRM_PANEL \ --enable DRM_PANEL_TPO_TPG110 \ --enable DRM_BRIDGE \ --enable DRM_PANEL_BRIDGE \ --enable LOGO \ --enable INPUT_TOUCHSCREEN \ --enable TOUCHSCREEN_TSC2004 # For early printk config-earlydebug: config-base $(CURDIR)/scripts/config --file $(config_file) \ --enable DEBUG_LL \ --enable EARLY_PRINTK \ --set-str CMDLINE "root=/dev/ram0 console=ttyAMA1,115200n8 earlyprintk" config-devicetree: config-base # Configure in the optional device tree if available if [ -r $(dtb) ] ; then \ $(CURDIR)/scripts/config --file $(config_file) \ --enable USE_OF \ --enable ARM_APPENDED_DTB \ --enable ARM_ATAG_DTB_COMPAT \ --enable ATAGS \ --enable PROC_DEVICETREE ; \ fi config-multiplatform: config-base $(CURDIR)/scripts/config --file $(config_file) \ --disable ARCH_MULTI_V7 \ --enable ARCH_MULTI_V5 \ --enable ARCH_NOMADIK config-dmatest: config-base config-mainlined-features $(CURDIR)/scripts/config --file $(config_file) \ --enable DMATEST config: have-rootfs config-base config-mainlined-features config-devicetree config-multiplatform config-initramfs config-earlydebug config-dmatest # config: config-base config-mainlined-features config-devicetree config-multiplatform config-distro FORCE # Reconfigure a bit $(CURDIR)/scripts/config --file $(config_file) \ --enable DEBUG_FS \ --enable COMMON_CLK_DEBUG \ --enable USB_SUPPORT \ --enable USB \ --enable USB_MUSB_HDRC \ --enable USB_MUSB_HOST \ --enable USB_MUSB_NOMADIK yes "" | make $(make_options) oldconfig menuconfig: FORCE $(MAKE) $(make_options) menuconfig saveconfig: config-base config-mainlined-features config-devicetree config-multiplatform FORCE yes "" | make $(make_options) oldconfig $(MAKE) $(make_options) savedefconfig cp $(build_dir)/defconfig arch/arm/configs/nhk8815_defconfig updateconfig: config-base FORCE yes "" | make $(make_options) oldconfig $(MAKE) $(make_options) savedefconfig cp $(build_dir)/defconfig arch/arm/configs/nhk8815_defconfig check-bindings: FORCE $(MAKE) $(make_options) dt_binding_check -k $(make_flags) $(MAKE) $(make_options) dtbs_check -k $(make_flags) build-zimage: have-crosscompiler FORCE $(MAKE) $(make_options) -j 4 zImage CONFIG_DEBUG_SECTION_MISMATCH=y build-dtbs: FORCE $(MAKE) $(make_options) -j 4 dtbs CONFIG_DEBUG_SECTION_MISMATCH=y build: have-rootfs have-crosscompiler build-zimage build-dtbs FORCE @echo "Copy zImage to $(output_dir)/zImage..." @if [ -r $(build_dir)/arch/arm/boot/zImage ] ; then \ cp $(build_dir)/arch/arm/boot/zImage $(output_dir)/zImage ; \ fi @if [ -r $(dtb) ] ; then \ echo "Catenate DTB onto zImage ..." ; \ cat $(dtb) >> $(output_dir)/zImage ; \ fi # Generate uImage mkimage \ -A arm \ -O linux \ -T kernel \ -C none \ -a 0x00008000 \ -e 0x00008000 \ -n "Nomadik Linux kernel" \ -d $(output_dir)/zImage \ $(output_dir)/uImage # If we have a TFTP boot directory @if [ -w /var/lib/tftpboot ] ; then \ echo "copy uImage to /var/lib/tftpboot" ; \ cp $(output_dir)/uImage /var/lib/tftpboot ; \ fi @echo "Boot from serial:" @echo "loady" @echo "In minicom type Control-AS to access the upload feature, select ymodem, select uImage" @echo "bootm" @echo "Config networking after boot:" @echo "ifconfig eth0 hw ether 12:34:56:78:90:12" @echo "ifconfig eth0 169.254.1.2 netmask 255.255.255.0 up" @echo "route add default gw 169.254.1.1" @echo "Boot from ethernet:" @echo "setenv bootargs console=ttyAMA1,115200n8 root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 init=/sbin/init" @echo "setenv serverip 169.254.1.1;setenv ipaddr 169.254.1.2;setenv bootfile uImage;tftpboot;bootm" 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: