Remove stuff from /usr/src, use /usr/lib/modules/$version/build instead.

This commit is contained in:
Thomas Bächler 2014-01-25 14:10:07 +00:00
parent 8fe0e5f47f
commit e00cfd02fb
1 changed files with 57 additions and 60 deletions

117
PKGBUILD
View File

@ -147,7 +147,7 @@ _package() {
cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}" cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}"
# add vmlinux # add vmlinux
install -D -m644 vmlinux "${pkgdir}/usr/src/linux-${_kernver}/vmlinux" install -D -m644 vmlinux "${pkgdir}/usr/lib/modules/${_kernver}/build/vmlinux"
# set correct depmod command for install # set correct depmod command for install
cp -f "${startdir}/${install}" "${startdir}/${install}.pkg" cp -f "${startdir}/${install}" "${startdir}/${install}.pkg"
@ -193,124 +193,121 @@ _package-headers() {
install -dm755 "${pkgdir}/usr/lib/modules/${_kernver}" install -dm755 "${pkgdir}/usr/lib/modules/${_kernver}"
cd "${pkgdir}/usr/lib/modules/${_kernver}"
ln -sf ../../../src/linux-${_kernver} build
cd "${srcdir}/${_srcname}" cd "${srcdir}/${_srcname}"
install -D -m644 Makefile \ install -D -m644 Makefile \
"${pkgdir}/usr/src/linux-${_kernver}/Makefile" "${pkgdir}/usr/lib/modules/${_kernver}/build/Makefile"
install -D -m644 kernel/Makefile \ install -D -m644 kernel/Makefile \
"${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile" "${pkgdir}/usr/lib/modules/${_kernver}/build/kernel/Makefile"
install -D -m644 .config \ install -D -m644 .config \
"${pkgdir}/usr/src/linux-${_kernver}/.config" "${pkgdir}/usr/lib/modules/${_kernver}/build/.config"
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/include"
for i in acpi asm-generic config crypto drm generated keys linux math-emu \ for i in acpi asm-generic config crypto drm generated keys linux math-emu \
media net pcmcia scsi sound trace uapi video xen; do media net pcmcia scsi sound trace uapi video xen; do
cp -a include/${i} "${pkgdir}/usr/src/linux-${_kernver}/include/" cp -a include/${i} "${pkgdir}/usr/lib/modules/${_kernver}/build/include/"
done done
# copy arch includes for external modules # copy arch includes for external modules
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/x86" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/x86"
cp -a arch/x86/include "${pkgdir}/usr/src/linux-${_kernver}/arch/x86/" cp -a arch/x86/include "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/x86/"
# copy files necessary for later builds, like nvidia and vmware # copy files necessary for later builds, like nvidia and vmware
cp Module.symvers "${pkgdir}/usr/src/linux-${_kernver}" cp Module.symvers "${pkgdir}/usr/lib/modules/${_kernver}/build"
cp -a scripts "${pkgdir}/usr/src/linux-${_kernver}" cp -a scripts "${pkgdir}/usr/lib/modules/${_kernver}/build"
# fix permissions on scripts dir # fix permissions on scripts dir
chmod og-w -R "${pkgdir}/usr/src/linux-${_kernver}/scripts" chmod og-w -R "${pkgdir}/usr/lib/modules/${_kernver}/build/scripts"
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/.tmp_versions"
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/kernel"
cp arch/${KARCH}/Makefile "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/" cp arch/${KARCH}/Makefile "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/"
if [ "${CARCH}" = "i686" ]; then if [ "${CARCH}" = "i686" ]; then
cp arch/${KARCH}/Makefile_32.cpu "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/" cp arch/${KARCH}/Makefile_32.cpu "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/"
fi fi
cp arch/${KARCH}/kernel/asm-offsets.s "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel/" cp arch/${KARCH}/kernel/asm-offsets.s "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/kernel/"
# add headers for lirc package # add headers for lirc package
# pci # pci
for i in bt8xx cx88 saa7134; do for i in bt8xx cx88 saa7134; do
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/pci/${i}" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/pci/${i}"
cp -a drivers/media/pci/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/pci/${i}" cp -a drivers/media/pci/${i}/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/pci/${i}"
done done
# usb # usb
for i in cpia2 em28xx pwc sn9c102; do for i in cpia2 em28xx pwc sn9c102; do
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/usb/${i}" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/usb/${i}"
cp -a drivers/media/usb/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/usb/${i}" cp -a drivers/media/usb/${i}/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/usb/${i}"
done done
# i2c # i2c
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/i2c" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/i2c"
cp drivers/media/i2c/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/i2c/" cp drivers/media/i2c/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/i2c/"
for i in cx25840; do for i in cx25840; do
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/i2c/${i}" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/i2c/${i}"
cp -a drivers/media/i2c/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/i2c/${i}" cp -a drivers/media/i2c/${i}/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/i2c/${i}"
done done
# add docbook makefile # add docbook makefile
install -D -m644 Documentation/DocBook/Makefile \ install -D -m644 Documentation/DocBook/Makefile \
"${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile" "${pkgdir}/usr/lib/modules/${_kernver}/build/Documentation/DocBook/Makefile"
# add dm headers # add dm headers
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/md" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/md"
cp drivers/md/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/md" cp drivers/md/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/md"
# add inotify.h # add inotify.h
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/linux" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/include/linux"
cp include/linux/inotify.h "${pkgdir}/usr/src/linux-${_kernver}/include/linux/" cp include/linux/inotify.h "${pkgdir}/usr/lib/modules/${_kernver}/build/include/linux/"
# add wireless headers # add wireless headers
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/net/mac80211/"
cp net/mac80211/*.h "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/" cp net/mac80211/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/net/mac80211/"
# add dvb headers for external modules # add dvb headers for external modules
# in reference to: # in reference to:
# http://bugs.archlinux.org/task/9912 # http://bugs.archlinux.org/task/9912
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb-core" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-core"
cp drivers/media/dvb-core/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb-core/" cp drivers/media/dvb-core/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-core/"
# and... # and...
# http://bugs.archlinux.org/task/11194 # http://bugs.archlinux.org/task/11194
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/include/config/dvb/"
cp include/config/dvb/*.h "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/" cp include/config/dvb/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/include/config/dvb/"
# add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
# in reference to: # in reference to:
# http://bugs.archlinux.org/task/13146 # http://bugs.archlinux.org/task/13146
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends/" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-frontends/"
cp drivers/media/dvb-frontends/lgdt330x.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends/" cp drivers/media/dvb-frontends/lgdt330x.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-frontends/"
cp drivers/media/i2c/msp3400-driver.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/i2c/" cp drivers/media/i2c/msp3400-driver.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/i2c/"
# add dvb headers # add dvb headers
# in reference to: # in reference to:
# http://bugs.archlinux.org/task/20402 # http://bugs.archlinux.org/task/20402
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/usb/dvb-usb" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/usb/dvb-usb"
cp drivers/media/usb/dvb-usb/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/usb/dvb-usb/" cp drivers/media/usb/dvb-usb/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/usb/dvb-usb/"
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-frontends"
cp drivers/media/dvb-frontends/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends/" cp drivers/media/dvb-frontends/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-frontends/"
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/tuners" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/tuners"
cp drivers/media/tuners/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/tuners/" cp drivers/media/tuners/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/tuners/"
# add xfs and shmem for aufs building # add xfs and shmem for aufs building
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/fs/xfs"
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/mm" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/mm"
cp fs/xfs/xfs_sb.h "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h" cp fs/xfs/xfs_sb.h "${pkgdir}/usr/lib/modules/${_kernver}/build/fs/xfs/xfs_sb.h"
# copy in Kconfig files # copy in Kconfig files
for i in `find . -name "Kconfig*"`; do for i in $(find . -name "Kconfig*"); do
mkdir -p "${pkgdir}"/usr/src/linux-${_kernver}/`echo ${i} | sed 's|/Kconfig.*||'` mkdir -p "${pkgdir}"/usr/lib/modules/${_kernver}/build/`echo ${i} | sed 's|/Kconfig.*||'`
cp ${i} "${pkgdir}/usr/src/linux-${_kernver}/${i}" cp ${i} "${pkgdir}/usr/lib/modules/${_kernver}/build/${i}"
done done
chown -R root.root "${pkgdir}/usr/src/linux-${_kernver}" chown -R root.root "${pkgdir}/usr/lib/modules/${_kernver}/build"
find "${pkgdir}/usr/src/linux-${_kernver}" -type d -exec chmod 755 {} \; find "${pkgdir}/usr/lib/modules/${_kernver}/build" -type d -exec chmod 755 {} \;
# strip scripts directory # strip scripts directory
find "${pkgdir}/usr/src/linux-${_kernver}/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do find "${pkgdir}/usr/lib/modules/${_kernver}/build/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
case "$(file -bi "${binary}")" in case "$(file -bi "${binary}")" in
*application/x-sharedlib*) # Libraries (.so) *application/x-sharedlib*) # Libraries (.so)
/usr/bin/strip ${STRIP_SHARED} "${binary}";; /usr/bin/strip ${STRIP_SHARED} "${binary}";;
@ -322,7 +319,7 @@ _package-headers() {
done done
# remove unneeded architectures # remove unneeded architectures
rm -rf "${pkgdir}"/usr/src/linux-${_kernver}/arch/{alpha,arc,arm,arm26,arm64,avr32,blackfin,c6x,cris,frv,h8300,hexagon,ia64,m32r,m68k,m68knommu,metag,mips,microblaze,mn10300,openrisc,parisc,powerpc,ppc,s390,score,sh,sh64,sparc,sparc64,tile,unicore32,um,v850,xtensa} rm -rf "${pkgdir}"/usr/lib/modules/${_kernver}/build/arch/{alpha,arc,arm,arm26,arm64,avr32,blackfin,c6x,cris,frv,h8300,hexagon,ia64,m32r,m68k,m68knommu,metag,mips,microblaze,mn10300,openrisc,parisc,powerpc,ppc,s390,score,sh,sh64,sparc,sparc64,tile,unicore32,um,v850,xtensa}
} }
_package-docs() { _package-docs() {
@ -333,13 +330,13 @@ _package-docs() {
cd "${srcdir}/${_srcname}" cd "${srcdir}/${_srcname}"
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}" mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build"
cp -al Documentation "${pkgdir}/usr/src/linux-${_kernver}" cp -al Documentation "${pkgdir}/usr/lib/modules/${_kernver}/build"
find "${pkgdir}" -type f -exec chmod 444 {} \; find "${pkgdir}" -type f -exec chmod 444 {} \;
find "${pkgdir}" -type d -exec chmod 755 {} \; find "${pkgdir}" -type d -exec chmod 755 {} \;
# remove a file already in linux package # remove a file already in linux package
rm -f "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile" rm -f "${pkgdir}/usr/lib/modules/${_kernver}/build/Documentation/DocBook/Makefile"
} }
pkgname=("${pkgbase}" "${pkgbase}-headers" "${pkgbase}-docs") pkgname=("${pkgbase}" "${pkgbase}-headers" "${pkgbase}-docs")