milis/talimatname/temel-ek/kernel-lts/talimat

224 lines
8.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Description: uzun donem kararli kernel surumu
# URL: http://www.kernel.org
# Packagers: milisarge
name=kernel-lts
_kernelname=${name#linux}
_basekernel=4.10
version=4.10.9
release=1
source=(http://www.kernel.org/pub/linux/kernel/v4.x/linux-4.10.tar.xz
http://www.kernel.org/pub/linux/kernel/v4.x/patch-${version}.xz
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)
build() {
cd "${SRC}/linux-${_basekernel}"
# güncel kernel yama
patch -p1 -i "${SRC}/patch-${version}"
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"
patch -p1 -i "${SRC}/lockdep-debug.patch"
patch -p1 -i "${SRC}/tmpfs-idr.patch"
patch -p1 -i "${SRC}/vfs-ino.patch"
cat "${SRC}/config" > ./.config
cat "${SRC}/config.aufs" >> ./.config
if [ "${_kernelname}" != "" ]; then
sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
fi
# set extraversion to release
sed -ri "s|^(EXTRAVERSION =).*|\1 -${release}|" Makefile
cd "${SRC}/linux-${_basekernel}"
export KBUILD_BUILD_USER="milisarge"
export KBUILD_BUILD_HOST="`uname -m`.milislinux.org"
# get kernel version
make prepare
# rewrite configuration
yes "" | make config >/dev/null
# build!
make ${MAKEFLAGS} bzImage modules
KARCH=x86
# get kernel version
_kernver="$(make kernelrelease)"
mkdir -p "${PKG}"/{lib/modules,lib/firmware,boot}
make INSTALL_MOD_PATH="${PKG}" modules_install
cp arch/$KARCH/boot/bzImage "${PKG}/boot/vmlinuz-${name}"
# add vmlinux
install -D -m644 vmlinux "${PKG}/usr/src/linux-${_kernver}/vmlinux"
# remove build and source links
rm -f "${PKG}"/lib/modules/${_kernver}/{source,build}
# remove the firmware
rm -rf "${PKG}/lib/firmware"
# gzip -9 all modules to save 100MB of space
find "${PKG}" -name '*.ko' -exec gzip -9 {} \;
# make room for external modules
ln -s "../extramodules-${_basekernel}${_kernelname:-}" "${PKG}/lib/modules/${_kernver}/extramodules"
# add real version for building modules and running depmod from post_install/upgrade
mkdir -p "${PKG}/lib/modules/extramodules-${_basekernel}${_kernelname:-}"
echo "${_kernver}" > "${PKG}/lib/modules/extramodules-${_basekernel}${_kernelname:-}/version"
#linux-headers
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
# add docbook makefile
install -D -m644 Documentation/DocBook/Makefile \
"${PKG}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
# 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}
}