talimat 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. # Tanım: Kararli kernel sürümü
  2. # URL: http://www.kernel.org
  3. # Paketçi: milisarge
  4. # Gerekler: linux-firmware intel-ucode elfutils
  5. # Grup: sistem
  6. isim=kernel
  7. _basekernel=4.19
  8. surum=4.19.2
  9. devir=1
  10. kaynak=(http://www.kernel.org/pub/linux/kernel/v4.x/linux-$_basekernel.tar.xz
  11. http://www.kernel.org/pub/linux/kernel/v4.x/patch-${surum}.xz
  12. config
  13. aufs4-loopback.patch
  14. aufs4-base.patch
  15. aufs4-mmap.patch
  16. aufs4-standalone.patch
  17. aufs4-kbuild.patch
  18. aufs4.patch
  19. config.aufs
  20. tmpfs-idr.patch
  21. vfs-ino.patch
  22. rtlwifi.patch)
  23. derle() {
  24. cd "${SRC}/linux-$_basekernel"
  25. cp "${SRC}/patch-$surum.xz" .
  26. unxz patch-$surum.xz
  27. # güncel kernel yama
  28. patch -p1 -i "patch-${surum}"
  29. # güvenli kernel yaması
  30. #patch -p1 -i "${SRC}/linux-hardened-${surum}.a.patch"
  31. #çalışan sistem aufs yamaları
  32. patch -p1 -i "${SRC}/aufs4.patch"
  33. patch -p1 -i "${SRC}/aufs4-base.patch"
  34. patch -p1 -i "${SRC}/aufs4-kbuild.patch"
  35. patch -p1 -i "${SRC}/aufs4-loopback.patch"
  36. patch -p1 -i "${SRC}/aufs4-mmap.patch"
  37. patch -p1 -i "${SRC}/aufs4-standalone.patch"
  38. patch -p1 -i "${SRC}/tmpfs-idr.patch"
  39. patch -p1 -i "${SRC}/vfs-ino.patch"
  40. patch -p1 -i "${SRC}/rtlwifi.patch"
  41. cat "${SRC}/config" > ./.config
  42. cat "${SRC}/config.aufs" >> ./.config
  43. # kernel sürümüne devir sayısı eklemek için
  44. # set extraversion to release
  45. #sed -ri "s|^(EXTRAVERSION =).*|\1 -${devir}|" Makefile
  46. cd "${SRC}/linux-${_basekernel}"
  47. export KBUILD_BUILD_USER="milisarge"
  48. export KBUILD_BUILD_HOST="`uname -m`.milislinux.org"
  49. # ayarları onaylama
  50. yes "" | make oldconfig >/dev/null
  51. # derleme
  52. make -j2 bzImage modules || make -j2 bzImage modules
  53. KARCH=x86
  54. # get kernel version
  55. #_kernver="$(make kernelrelease)"
  56. #KERNEL_VERSION="${surum}-milis"
  57. _kernver="${surum}-milis"
  58. mkdir -p "${PKG}"/{lib/modules,lib/firmware,boot}
  59. make INSTALL_MOD_PATH="${PKG}" modules_install
  60. cp arch/$KARCH/boot/bzImage "${PKG}/boot/kernel-${surum}"
  61. # vmlinux un source a eklenmesi,modül derlerken bu geçici silinecek
  62. #install -D -m644 vmlinux "${PKG}/usr/src/linux-${_kernver}/vmlinux"
  63. # derleme kalıntılarının temizlenmesi
  64. rm -f "${PKG}"/lib/modules/${_kernver}/{source,build}
  65. # firmwarelerin temizlenmesi
  66. rm -rf "${PKG}/lib/firmware"
  67. # modüllerin sıkıştırılarak ek yer kazanılması
  68. find "${PKG}" -name '*.ko' -exec gzip -9 {} \;
  69. #linux-headers / linux modülleri
  70. install -dm755 "${PKG}/lib/modules/${_kernver}"
  71. cd "${PKG}/lib/modules/${_kernver}"
  72. ln -sf ../../../usr/src/linux-${_kernver} build
  73. cd "${SRC}/linux-${_basekernel}"
  74. install -D -m644 Makefile \
  75. "${PKG}/usr/src/linux-${_kernver}/Makefile"
  76. install -D -m644 kernel/Makefile \
  77. "${PKG}/usr/src/linux-${_kernver}/kernel/Makefile"
  78. install -D -m644 .config \
  79. "${PKG}/usr/src/linux-${_kernver}/.config"
  80. ######################
  81. mkdir -p "${PKG}/usr/src/linux-${_kernver}/include"
  82. for i in acpi asm-generic config crypto drm generated linux math-emu \
  83. media net pcmcia scsi rdma soc sound trace uapi video xen; do
  84. cp -a include/${i} "${PKG}/usr/src/linux-${_kernver}/include/"
  85. done
  86. # copy arch includes for external modules
  87. mkdir -p "${PKG}/usr/src/linux-${_kernver}/arch/x86"
  88. cp -a arch/x86/include "${PKG}/usr/src/linux-${_kernver}/arch/x86/"
  89. # copy files necessary for later builds, like nvidia and vmware
  90. cp Module.symvers "${PKG}/usr/src/linux-${_kernver}"
  91. cp -a scripts "${PKG}/usr/src/linux-${_kernver}"
  92. # fix permissions on scripts dir
  93. chmod og-w -R "${PKG}/usr/src/linux-${_kernver}/scripts"
  94. mkdir -p "${PKG}/usr/src/linux-${_kernver}/.tmp_versions"
  95. mkdir -p "${PKG}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel"
  96. cp arch/${KARCH}/Makefile "${PKG}/usr/src/linux-${_kernver}/arch/${KARCH}/"
  97. cp arch/${KARCH}/kernel/asm-offsets.s "${PKG}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel/"
  98. # add headers for lirc package
  99. # pci
  100. for i in bt8xx cx88 saa7134; do
  101. mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/media/pci/${i}"
  102. cp -a drivers/media/pci/${i}/*.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/pci/${i}"
  103. done
  104. # usb
  105. for i in cpia2 em28xx pwc; do
  106. mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/media/usb/${i}"
  107. cp -a drivers/media/usb/${i}/*.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/usb/${i}"
  108. done
  109. # i2c
  110. mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/media/i2c"
  111. cp drivers/media/i2c/*.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/i2c/"
  112. for i in cx25840; do
  113. mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/media/i2c/${i}"
  114. cp -a drivers/media/i2c/${i}/*.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/i2c/${i}"
  115. done
  116. # add docbook makefile
  117. #install -D -m644 Documentation/DocBook/Makefile \
  118. # "${PKG}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
  119. # add dm headers
  120. mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/md"
  121. cp drivers/md/*.h "${PKG}/usr/src/linux-${_kernver}/drivers/md"
  122. # add inotify.h
  123. mkdir -p "${PKG}/usr/src/linux-${_kernver}/include/linux"
  124. cp include/linux/inotify.h "${PKG}/usr/src/linux-${_kernver}/include/linux/"
  125. # add wireless headers
  126. mkdir -p "${PKG}/usr/src/linux-${_kernver}/net/mac80211/"
  127. cp net/mac80211/*.h "${PKG}/usr/src/linux-${_kernver}/net/mac80211/"
  128. # add dvb headers for external modules
  129. #mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/media/dvb-core"
  130. #cp drivers/media/dvb-core/*.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/dvb-core/"
  131. # and...
  132. mkdir -p "${PKG}/usr/src/linux-${_kernver}/include/config/dvb/"
  133. cp include/config/dvb/*.h "${PKG}/usr/src/linux-${_kernver}/include/config/dvb/"
  134. # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
  135. mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends/"
  136. cp drivers/media/dvb-frontends/lgdt330x.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends/"
  137. cp drivers/media/i2c/msp3400-driver.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/i2c/"
  138. # add dvb headers
  139. mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/media/usb/dvb-usb"
  140. cp drivers/media/usb/dvb-usb/*.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/usb/dvb-usb/"
  141. mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends"
  142. cp drivers/media/dvb-frontends/*.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends/"
  143. mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/media/tuners"
  144. cp drivers/media/tuners/*.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/tuners/"
  145. # add xfs and shmem for aufs building
  146. mkdir -p "${PKG}/usr/src/linux-${_kernver}/fs/xfs/libxfs"
  147. mkdir -p "${PKG}/usr/src/linux-${_kernver}/mm"
  148. cp fs/xfs/libxfs/xfs_sb.h "${PKG}/usr/src/linux-${_kernver}/fs/xfs/libxfs/xfs_sb.h"
  149. #aufs4-util need
  150. sed -i "s:__user::g" "${PKG}/usr/src/linux-${_kernver}/include/uapi/linux/aufs_type.h"
  151. # copy in Kconfig files
  152. for i in `find . -name "Kconfig*"`; do
  153. mkdir -p "${PKG}"/usr/src/linux-${_kernver}/`echo ${i} | sed 's|/Kconfig.*||'`
  154. cp ${i} "${PKG}/usr/src/linux-${_kernver}/${i}"
  155. done
  156. chown -R root.root "${PKG}/usr/src/linux-${_kernver}"
  157. find "${PKG}/usr/src/linux-${_kernver}" -type d -exec chmod 755 {} \;
  158. # strip scripts directory
  159. find "${PKG}/usr/src/linux-${_kernver}/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
  160. case "$(file -bi "${binary}")" in
  161. *application/x-sharedlib*) # Libraries (.so)
  162. /usr/bin/strip ${STRIP_SHARED} "${binary}";;
  163. *application/x-archive*) # Libraries (.a)
  164. /usr/bin/strip ${STRIP_STATIC} "${binary}";;
  165. *application/x-executable*) # Binaries
  166. /usr/bin/strip ${STRIP_BINARIES} "${binary}";;
  167. esac
  168. done
  169. # add objtool, nvidia needed
  170. install -Dt "${PKG}/usr/src/linux-${_kernver}/tools/objtool" tools/objtool/objtool
  171. # remove unneeded architectures
  172. rm -rf "${PKG}"/usr/src/linux-${_kernver}/arch/{alpha,arm,arm26,arm64,avr32,blackfin,c6x,cris,frv,h8300,hexagon,ia64,m32r,m68k,m68knommu,mips,microblaze,mn10300,openrisc,parisc,powerpc,ppc,s390,score,sh,sh64,sparc,sparc64,tile,unicore32,um,v850,xtensa}
  173. }