Guest User

Untitled

a guest
Dec 29th, 2025
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.48 KB | None | 0 0
  1. CROSS_COMPILE ?= arm-linux-gnu-
  2. build_dir := $(CURDIR)/build-nexus7
  3. output_dir := $(HOME)
  4. rootfs := $(HOME)/rootfs-nexus7.cpio
  5. rootfsbase := $(shell basename $(rootfs))
  6. install_dir := $(build_dir)/install
  7. config_file := $(build_dir)/.config
  8. dtb := $(build_dir)/arch/arm/boot/dts/qcom/qcom-apq8064-asus-nexus7-flo.dtb
  9. #dtb := $(build_dir)/arch/arm/boot/dts/qcom-apq8064-asus-nexus7-flo.dtb
  10. makejobs := $(shell grep '^processor' /proc/cpuinfo | sort -u | wc -l)
  11. makethreads := $(shell dc -e "$(makejobs) 1 + p")
  12.  
  13.  
  14. make_options := -f Makefile \
  15. -j$(makethreads) -l$(makejobs) \
  16. ARCH=arm \
  17. CROSS_COMPILE=$(CROSS_COMPILE) \
  18. KBUILD_OUTPUT=$(build_dir)
  19.  
  20. .PHONY: help
  21. help:
  22. @echo "**** Common Makefile ****"
  23. @echo "make config [PLATFORM=foo] - configure for platform \"foo\""
  24. @echo "make build - build the kernel and produce a RAMdisk image"
  25. @echo
  26. @echo "example:"
  27. @echo "make -f nexus7.mak config"
  28. @echo "make -f nexus7.mak build"
  29.  
  30. .PHONY: have-rootfs
  31. have-rootfs:
  32. @if [ ! -f $(rootfs) ] ; then \
  33. echo "ERROR: no rootfs at $(rootfs)" ; \
  34. echo "This is needed to boot the system." ; \
  35. echo "ABORTING." ; \
  36. exit 1 ; \
  37. else \
  38. echo "Rootfs available at $(rootfs)" ; \
  39. fi
  40. @if [ ! -r $(rootfs) ] ; then \
  41. echo "ERROR: rootfs at $(rootfs) not readable" ; \
  42. echo "ABORTING." ; \
  43. exit 1 ; \
  44. fi
  45.  
  46. .PHONY: have-crosscompiler
  47. have-crosscompiler:
  48. @echo -n "Check that $(CROSS_COMPILE)gcc is available..."
  49. @which $(CROSS_COMPILE)gcc > /dev/null ; \
  50. if [ ! $$? -eq 0 ] ; then \
  51. echo "ERROR: cross-compiler $(CROSS_COMPILE)gcc not in PATH=$$PATH!" ; \
  52. echo "ABORTING." ; \
  53. exit 1 ; \
  54. else \
  55. echo "OK" ;\
  56. fi
  57.  
  58. config-base: FORCE
  59. @mkdir -p $(build_dir)
  60. @cp $(rootfs) $(build_dir)/$(rootfsbase)
  61. $(MAKE) $(make_options) qcom_defconfig
  62.  
  63. config-initramfs: config-base
  64. # Configure in the initramfs
  65. $(CURDIR)/scripts/config --file $(config_file) \
  66. --enable BLK_DEV_INITRD \
  67. --set-str INITRAMFS_SOURCE $(rootfsbase) \
  68. --enable RD_GZIP \
  69. --enable INITRAMFS_COMPRESSION_GZIP
  70.  
  71. # For early printk
  72. config-earlydebug: config-base
  73. $(CURDIR)/scripts/config --file $(config_file) \
  74. --enable DEBUG_LL \
  75. --enable EARLY_PRINTK \
  76. --enable DEBUG_QCOM_UARTDM \
  77. --disable DEBUG_ICEDCC \
  78. --disable DEBUG_SEMIHOSTING \
  79. --disable DEBUG_LL_UART_8250 \
  80. --disable DEBUG_LL_UART_PL01X \
  81. --set-val DEBUG_UART_PHYS 0x16640000 \
  82. --set-val DEBUG_UART_VIRT 0xf0040000
  83.  
  84. config-mainlined-features: config-base
  85. # Then reconfigure various stuff
  86. $(CURDIR)/scripts/config --file $(config_file) \
  87. --enable MMC \
  88. --enable MMC_ARMMMCI \
  89. --enable NEW_LEDS \
  90. --enable LEDS_CLASS \
  91. --enable LEDS_GPIO \
  92. --enable LEDS_TRIGGERS \
  93. --enable LEDS_TRIGGER_HEARTBEAT \
  94. --enable IIO \
  95. --enable IIO_BUFFER \
  96. --enable IIO_BUFFER_CB \
  97. --enable IIO_KFIFO_BUF \
  98. --enable IIO_TRIGGERED_BUFFER \
  99. --enable IIO_CONFIGFS \
  100. --enable IIO_TRIGGER \
  101. --enable IIO_SW_TRIGGER \
  102. --enable IIO_HRTIMER_TRIGGER \
  103. --enable INV_MPU6050_IIO \
  104. --enable INV_MPU6050_I2C \
  105. --disable INV_MPU6050_SPI \
  106. --enable QCOM_PM8XXX_XOADC \
  107. --enable PM \
  108. --enable HWMON \
  109. --enable SENSORS_IIO_HWMON \
  110. --enable EEPROM_AT24 \
  111. --enable SND_SOC \
  112. --enable SND_SOC_QCOM \
  113. --enable DRM \
  114. --enable DRM_PANEL_JDI_LT070ME05000 \
  115. --enable FB_SIMPLE \
  116. --enable BACKLIGHT_LCD_SUPPORT \
  117. --enable FRAMEBUFFER_CONSOLE \
  118. --enable LOGO \
  119. --enable REGULATOR_QCOM_RPM \
  120. --enable REGULATOR_QCOM_SMD_RPM \
  121. --enable REGULATOR_QCOM_SPMI \
  122. --enable REGULATOR_GPIO \
  123. --enable QCOM_WCNSS_CTRL \
  124. --enable EXTCON_QCOM_SPMI_MISC
  125.  
  126. config-sensors: config-base
  127. # Then reconfigure various stuff
  128. $(CURDIR)/scripts/config --file $(config_file) \
  129. --enable I2C \
  130. --enable I2C_GPIO \
  131. --enable IIO \
  132. --enable IIO_BUFFER \
  133. --enable IIO_BUFFER_CB \
  134. --enable IIO_KFIFO_BUF \
  135. --enable IIO_TRIGGERED_BUFFER \
  136. --enable IIO_CONFIGFS \
  137. --enable IIO_TRIGGER \
  138. --enable IIO_SW_TRIGGER \
  139. --enable IIO_HRTIMER_TRIGGER \
  140. --enable INV_MPU6050_IIO \
  141. --enable INV_MPU6050_I2C \
  142. --enable AK8975
  143.  
  144. config: have-rootfs config-base config-mainlined-features config-initramfs config-sensors config-earlydebug FORCE
  145. # Reconfigure a bit
  146. $(CURDIR)/scripts/config --file $(build_dir)/.config \
  147. --enable ARCH_MSM8X60
  148. yes "" | make $(make_options) oldconfig
  149.  
  150. menuconfig: FORCE
  151. if [ ! -d $(build_dir) ] ; then \
  152. echo "no build dir" ; \
  153. exit 1 ; \
  154. fi
  155. $(MAKE) $(make_options) menuconfig
  156.  
  157. saveconfig: config-base config-mainlined-features FORCE
  158. yes "" | make $(make_options) oldconfig
  159. $(MAKE) $(make_options) savedefconfig
  160. cp $(build_dir)/defconfig arch/arm/configs/qcom_defconfig
  161.  
  162. build-zimage: have-crosscompiler
  163. $(MAKE) $(make_options) zImage CONFIG_DEBUG_SECTION_MISMATCH=y
  164.  
  165. build-dtbs: FORCE
  166. $(MAKE) $(make_options) dtbs
  167.  
  168. build: have-rootfs build-zimage build-dtbs FORCE
  169. @echo "Copy zImage to $(output_dir)/zImage"
  170. @cp -f $(build_dir)/arch/arm/boot/zImage $(output_dir)/zImage
  171. @if [ ! -r $(dtb) ] ; then \
  172. echo "NO DTB in $(dtb)!" ; \
  173. exit 1 ; \
  174. fi
  175. @echo "Catenate DTB onto zImage $(output_dir)/zImage..."
  176. cat $(dtb) >> $(output_dir)/zImage
  177. # cat $(fixup) $(build_dir)/arch/arm/boot/zImage $(dtb) > $(output_dir)/zImage
  178.  
  179. clean:
  180. $(MAKE) -f Makefile clean
  181. rm -rf $(build_dir)
  182.  
  183. # Rules without commands or prerequisites that do not match a file name
  184. # are considered to always change when make runs. This means that any rule
  185. # that depends on FORCE will always be remade also.
  186. FORCE:
  187.  
Advertisement
Add Comment
Please, Sign In to add comment