Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CROSS_COMPILE ?= arm-linux-gnu-
- build_dir := $(CURDIR)/build-nexus7
- output_dir := $(HOME)
- rootfs := $(HOME)/rootfs-nexus7.cpio
- rootfsbase := $(shell basename $(rootfs))
- install_dir := $(build_dir)/install
- config_file := $(build_dir)/.config
- dtb := $(build_dir)/arch/arm/boot/dts/qcom/qcom-apq8064-asus-nexus7-flo.dtb
- #dtb := $(build_dir)/arch/arm/boot/dts/qcom-apq8064-asus-nexus7-flo.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 nexus7.mak config"
- @echo "make -f nexus7.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
- @if [ ! -r $(rootfs) ] ; then \
- echo "ERROR: rootfs at $(rootfs) not readable" ; \
- echo "ABORTING." ; \
- exit 1 ; \
- 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-base: FORCE
- @mkdir -p $(build_dir)
- @cp $(rootfs) $(build_dir)/$(rootfsbase)
- $(MAKE) $(make_options) qcom_defconfig
- config-initramfs: config-base
- # 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
- # For early printk
- config-earlydebug: config-base
- $(CURDIR)/scripts/config --file $(config_file) \
- --enable DEBUG_LL \
- --enable EARLY_PRINTK \
- --enable DEBUG_QCOM_UARTDM \
- --disable DEBUG_ICEDCC \
- --disable DEBUG_SEMIHOSTING \
- --disable DEBUG_LL_UART_8250 \
- --disable DEBUG_LL_UART_PL01X \
- --set-val DEBUG_UART_PHYS 0x16640000 \
- --set-val DEBUG_UART_VIRT 0xf0040000
- config-mainlined-features: config-base
- # Then reconfigure various stuff
- $(CURDIR)/scripts/config --file $(config_file) \
- --enable MMC \
- --enable MMC_ARMMMCI \
- --enable NEW_LEDS \
- --enable LEDS_CLASS \
- --enable LEDS_GPIO \
- --enable LEDS_TRIGGERS \
- --enable LEDS_TRIGGER_HEARTBEAT \
- --enable IIO \
- --enable IIO_BUFFER \
- --enable IIO_BUFFER_CB \
- --enable IIO_KFIFO_BUF \
- --enable IIO_TRIGGERED_BUFFER \
- --enable IIO_CONFIGFS \
- --enable IIO_TRIGGER \
- --enable IIO_SW_TRIGGER \
- --enable IIO_HRTIMER_TRIGGER \
- --enable INV_MPU6050_IIO \
- --enable INV_MPU6050_I2C \
- --disable INV_MPU6050_SPI \
- --enable QCOM_PM8XXX_XOADC \
- --enable PM \
- --enable HWMON \
- --enable SENSORS_IIO_HWMON \
- --enable EEPROM_AT24 \
- --enable SND_SOC \
- --enable SND_SOC_QCOM \
- --enable DRM \
- --enable DRM_PANEL_JDI_LT070ME05000 \
- --enable FB_SIMPLE \
- --enable BACKLIGHT_LCD_SUPPORT \
- --enable FRAMEBUFFER_CONSOLE \
- --enable LOGO \
- --enable REGULATOR_QCOM_RPM \
- --enable REGULATOR_QCOM_SMD_RPM \
- --enable REGULATOR_QCOM_SPMI \
- --enable REGULATOR_GPIO \
- --enable QCOM_WCNSS_CTRL \
- --enable EXTCON_QCOM_SPMI_MISC
- config-sensors: config-base
- # Then reconfigure various stuff
- $(CURDIR)/scripts/config --file $(config_file) \
- --enable I2C \
- --enable I2C_GPIO \
- --enable IIO \
- --enable IIO_BUFFER \
- --enable IIO_BUFFER_CB \
- --enable IIO_KFIFO_BUF \
- --enable IIO_TRIGGERED_BUFFER \
- --enable IIO_CONFIGFS \
- --enable IIO_TRIGGER \
- --enable IIO_SW_TRIGGER \
- --enable IIO_HRTIMER_TRIGGER \
- --enable INV_MPU6050_IIO \
- --enable INV_MPU6050_I2C \
- --enable AK8975
- config: have-rootfs config-base config-mainlined-features config-initramfs config-sensors config-earlydebug FORCE
- # Reconfigure a bit
- $(CURDIR)/scripts/config --file $(build_dir)/.config \
- --enable ARCH_MSM8X60
- yes "" | make $(make_options) oldconfig
- menuconfig: FORCE
- if [ ! -d $(build_dir) ] ; then \
- echo "no build dir" ; \
- exit 1 ; \
- fi
- $(MAKE) $(make_options) menuconfig
- saveconfig: config-base config-mainlined-features FORCE
- yes "" | make $(make_options) oldconfig
- $(MAKE) $(make_options) savedefconfig
- cp $(build_dir)/defconfig arch/arm/configs/qcom_defconfig
- build-zimage: have-crosscompiler
- $(MAKE) $(make_options) zImage CONFIG_DEBUG_SECTION_MISMATCH=y
- build-dtbs: FORCE
- $(MAKE) $(make_options) dtbs
- build: have-rootfs build-zimage build-dtbs FORCE
- @echo "Copy zImage to $(output_dir)/zImage"
- @cp -f $(build_dir)/arch/arm/boot/zImage $(output_dir)/zImage
- @if [ ! -r $(dtb) ] ; then \
- echo "NO DTB in $(dtb)!" ; \
- exit 1 ; \
- fi
- @echo "Catenate DTB onto zImage $(output_dir)/zImage..."
- cat $(dtb) >> $(output_dir)/zImage
- # cat $(fixup) $(build_dir)/arch/arm/boot/zImage $(dtb) > $(output_dir)/zImage
- 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:
Advertisement
Add Comment
Please, Sign In to add comment