milis/talimatname/genel/k/kernel/talimat

218 lines
8.1 KiB
Plaintext
Raw Normal View History

2017-11-16 10:18:08 +01:00
# Tanım: Kararli kernel sürümü
2016-02-24 01:27:23 +01:00
# URL: http://www.kernel.org
2017-10-27 20:46:27 +02:00
# Paketçi: milisarge
# Gerekler: linux-firmware intel-ucode
2016-02-24 01:27:23 +01:00
2017-10-28 14:10:23 +02:00
isim=kernel
2017-11-16 10:18:08 +01:00
_basekernel=4.13
surum=4.13.12
2017-10-28 14:10:23 +02:00
devir=1
2017-06-03 03:34:14 +02:00
2017-11-16 10:18:08 +01:00
kaynak=(http://www.kernel.org/pub/linux/kernel/v4.x/linux-$_basekernel.tar.xz
2017-10-28 14:10:23 +02:00
http://www.kernel.org/pub/linux/kernel/v4.x/patch-${surum}.xz
2017-11-16 10:18:08 +01:00
https://github.com/copperhead/linux-hardened/releases/download/4.13.12.a/linux-hardened-${surum}.a.patch
2017-06-03 03:34:14 +02:00
config
aufs4-loopback.patch
aufs4-base.patch
aufs4-mmap.patch
aufs4-standalone.patch
aufs4-kbuild.patch
aufs4.patch
config.aufs
lockdep-debug.patch
tmpfs-idr.patch
vfs-ino.patch
change-default-console-loglevel.patch
i8042-fix-aliases.patch)
2017-10-27 23:59:41 +02:00
derle() {
2017-06-03 03:42:49 +02:00
2017-11-16 10:18:08 +01:00
cd "${SRC}/linux-$_basekernel"
2017-10-28 14:10:23 +02:00
cp "${SRC}/patch-$surum.xz" .
unxz patch-$surum.xz
2017-06-03 03:34:14 +02:00
# güncel kernel yama
2017-10-28 14:10:23 +02:00
patch -p1 -i "patch-${surum}"
2017-06-03 03:34:14 +02:00
2017-11-16 10:18:08 +01:00
# güvenli kernel yaması
patch -p1 -i "${SRC}/linux-hardened-${surum}.a.patch"
2017-06-03 03:34:14 +02:00
patch -p1 -i "${SRC}/i8042-fix-aliases.patch"
#çalışan sistem aufs yamaları
patch -p1 -i "${SRC}/aufs4.patch"
patch -p1 -i "${SRC}/aufs4-base.patch"
patch -p1 -i "${SRC}/aufs4-kbuild.patch"
patch -p1 -i "${SRC}/aufs4-loopback.patch"
patch -p1 -i "${SRC}/aufs4-mmap.patch"
patch -p1 -i "${SRC}/aufs4-standalone.patch"
2017-11-16 10:18:08 +01:00
#patch -p1 -i "${SRC}/lockdep-debug.patch"
2017-06-03 03:34:14 +02:00
patch -p1 -i "${SRC}/tmpfs-idr.patch"
patch -p1 -i "${SRC}/vfs-ino.patch"
2017-11-16 10:18:08 +01:00
#fix error: too few arguments to function 'loop_switch' error with RC aufs patches
sed -i "s|return loop_switch(lo, NULL);|return loop_switch(lo, NULL, NULL);|g" drivers/block/loop.c
2017-06-03 03:34:14 +02:00
cat "${SRC}/config" > ./.config
cat "${SRC}/config.aufs" >> ./.config
2017-06-03 18:24:48 +02:00
# kernel sürümüne devir sayısı eklemek için
2017-06-03 03:34:14 +02:00
# set extraversion to release
2017-10-28 14:10:23 +02:00
#sed -ri "s|^(EXTRAVERSION =).*|\1 -${devir}|" Makefile
2017-06-03 03:34:14 +02:00
cd "${SRC}/linux-${_basekernel}"
export KBUILD_BUILD_USER="milisarge"
export KBUILD_BUILD_HOST="`uname -m`.milislinux.org"
2017-11-16 10:18:08 +01:00
# ayarları onaylama
yes "" | make oldconfig >/dev/null
2017-06-03 03:34:14 +02:00
2017-11-16 10:18:08 +01:00
# derleme
2017-06-03 03:34:14 +02:00
make ${MAKEFLAGS} bzImage modules
KARCH=x86
# get kernel version
2017-06-03 15:58:02 +02:00
#_kernver="$(make kernelrelease)"
2017-10-28 14:10:23 +02:00
#KERNEL_VERSION="${surum}-milis"
_kernver="${surum}-milis"
2017-06-03 03:34:14 +02:00
mkdir -p "${PKG}"/{lib/modules,lib/firmware,boot}
make INSTALL_MOD_PATH="${PKG}" modules_install
2017-10-28 14:10:23 +02:00
cp arch/$KARCH/boot/bzImage "${PKG}/boot/kernel-${surum}"
2017-06-03 03:34:14 +02:00
2017-11-16 10:18:08 +01:00
# vmlinux un source a eklenmesi,modül derlerken bu geçici silinecek
2017-06-03 03:34:14 +02:00
install -D -m644 vmlinux "${PKG}/usr/src/linux-${_kernver}/vmlinux"
2017-11-16 10:18:08 +01:00
# derleme kalıntılarının temizlenmesi
2017-06-03 03:34:14 +02:00
rm -f "${PKG}"/lib/modules/${_kernver}/{source,build}
2017-11-16 10:18:08 +01:00
# firmwarelerin temizlenmesi
2017-06-03 03:34:14 +02:00
rm -rf "${PKG}/lib/firmware"
2017-11-16 10:18:08 +01:00
# modüllerin sıkıştırılarak ek yer kazanılması
2017-06-03 03:34:14 +02:00
find "${PKG}" -name '*.ko' -exec gzip -9 {} \;
2017-11-16 10:18:08 +01:00
#linux-headers / linux modülleri
2017-06-03 03:34:14 +02:00
install -dm755 "${PKG}/lib/modules/${_kernver}"
cd "${PKG}/lib/modules/${_kernver}"
ln -sf ../../../usr/src/linux-${_kernver} build
cd "${SRC}/linux-${_basekernel}"
install -D -m644 Makefile \
"${PKG}/usr/src/linux-${_kernver}/Makefile"
install -D -m644 kernel/Makefile \
"${PKG}/usr/src/linux-${_kernver}/kernel/Makefile"
install -D -m644 .config \
"${PKG}/usr/src/linux-${_kernver}/.config"
mkdir -p "${PKG}/usr/src/linux-${_kernver}/include"
for i in acpi asm-generic config crypto drm generated linux math-emu \
media net pcmcia scsi sound trace uapi video xen; do
cp -a include/${i} "${PKG}/usr/src/linux-${_kernver}/include/"
done
# copy arch includes for external modules
mkdir -p "${PKG}/usr/src/linux-${_kernver}/arch/x86"
cp -a arch/x86/include "${PKG}/usr/src/linux-${_kernver}/arch/x86/"
# copy files necessary for later builds, like nvidia and vmware
cp Module.symvers "${PKG}/usr/src/linux-${_kernver}"
cp -a scripts "${PKG}/usr/src/linux-${_kernver}"
# fix permissions on scripts dir
chmod og-w -R "${PKG}/usr/src/linux-${_kernver}/scripts"
mkdir -p "${PKG}/usr/src/linux-${_kernver}/.tmp_versions"
mkdir -p "${PKG}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel"
cp arch/${KARCH}/Makefile "${PKG}/usr/src/linux-${_kernver}/arch/${KARCH}/"
cp arch/${KARCH}/kernel/asm-offsets.s "${PKG}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel/"
# add headers for lirc package
# pci
for i in bt8xx cx88 saa7134; do
mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/media/pci/${i}"
cp -a drivers/media/pci/${i}/*.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/pci/${i}"
done
# usb
for i in cpia2 em28xx pwc; do
mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/media/usb/${i}"
cp -a drivers/media/usb/${i}/*.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/usb/${i}"
done
# i2c
mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/media/i2c"
cp drivers/media/i2c/*.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/i2c/"
for i in cx25840; do
mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/media/i2c/${i}"
cp -a drivers/media/i2c/${i}/*.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/i2c/${i}"
done
2017-11-16 10:18:08 +01:00
2017-06-03 03:34:14 +02:00
# add dm headers
mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/md"
cp drivers/md/*.h "${PKG}/usr/src/linux-${_kernver}/drivers/md"
# add inotify.h
mkdir -p "${PKG}/usr/src/linux-${_kernver}/include/linux"
cp include/linux/inotify.h "${PKG}/usr/src/linux-${_kernver}/include/linux/"
# add wireless headers
mkdir -p "${PKG}/usr/src/linux-${_kernver}/net/mac80211/"
cp net/mac80211/*.h "${PKG}/usr/src/linux-${_kernver}/net/mac80211/"
# add dvb headers for external modules
mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/media/dvb-core"
cp drivers/media/dvb-core/*.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/dvb-core/"
# and...
mkdir -p "${PKG}/usr/src/linux-${_kernver}/include/config/dvb/"
cp include/config/dvb/*.h "${PKG}/usr/src/linux-${_kernver}/include/config/dvb/"
# add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends/"
cp drivers/media/dvb-frontends/lgdt330x.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends/"
cp drivers/media/i2c/msp3400-driver.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/i2c/"
# add dvb headers
mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/media/usb/dvb-usb"
cp drivers/media/usb/dvb-usb/*.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/usb/dvb-usb/"
mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends"
cp drivers/media/dvb-frontends/*.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends/"
mkdir -p "${PKG}/usr/src/linux-${_kernver}/drivers/media/tuners"
cp drivers/media/tuners/*.h "${PKG}/usr/src/linux-${_kernver}/drivers/media/tuners/"
# add xfs and shmem for aufs building
mkdir -p "${PKG}/usr/src/linux-${_kernver}/fs/xfs/libxfs"
mkdir -p "${PKG}/usr/src/linux-${_kernver}/mm"
cp fs/xfs/libxfs/xfs_sb.h "${PKG}/usr/src/linux-${_kernver}/fs/xfs/libxfs/xfs_sb.h"
#aufs4-util need
sed -i "s:__user::g" "${PKG}/usr/src/linux-${_kernver}/include/uapi/linux/aufs_type.h"
# copy in Kconfig files
for i in `find . -name "Kconfig*"`; do
mkdir -p "${PKG}"/usr/src/linux-${_kernver}/`echo ${i} | sed 's|/Kconfig.*||'`
cp ${i} "${PKG}/usr/src/linux-${_kernver}/${i}"
done
chown -R root.root "${PKG}/usr/src/linux-${_kernver}"
find "${PKG}/usr/src/linux-${_kernver}" -type d -exec chmod 755 {} \;
# strip scripts directory
find "${PKG}/usr/src/linux-${_kernver}/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
case "$(file -bi "${binary}")" in
*application/x-sharedlib*) # Libraries (.so)
/usr/bin/strip ${STRIP_SHARED} "${binary}";;
*application/x-archive*) # Libraries (.a)
/usr/bin/strip ${STRIP_STATIC} "${binary}";;
*application/x-executable*) # Binaries
/usr/bin/strip ${STRIP_BINARIES} "${binary}";;
esac
done
# remove unneeded architectures
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}
2016-02-24 01:27:23 +01:00
}