diff options
Diffstat (limited to 'libre/linux-libre/PKGBUILD')
-rwxr-xr-x[-rw-r--r--] | libre/linux-libre/PKGBUILD | 190 |
1 files changed, 110 insertions, 80 deletions
diff --git a/libre/linux-libre/PKGBUILD b/libre/linux-libre/PKGBUILD index ae3f19ae1..0487c2e84 100644..100755 --- a/libre/linux-libre/PKGBUILD +++ b/libre/linux-libre/PKGBUILD @@ -3,54 +3,56 @@ # Maintainer: Thomas Baechler <thomas@archlinux.org> # Maintainer (Parabola): Nicolás Reynolds <fauno@kiwwwi.com.ar> # Maintainer (Parabola): Sorin-Mihai Vârgolici <smv@yobicore.org> -# Maintainer (Parabola): André Silva <andre.paulista@adinet.com.uy> +# Maintainer (Parabola): André Silva <emulatorman@lavabit.com> # Maintainer (Parabola): Michał Masłowski <mtjm@mtjm.eu> -# Contributor (Parabola): Márcio Silva <coadde@adinet.com.uy> - -pkgbase=linux-libre -pkgname=('linux-libre' 'linux-libre-headers' 'linux-libre-docs') # Build stock -LIBRE kernel -# pkgname=linux-custom # Build kernel with a different name -_kernelname=-LIBRE -_basekernel=3.4 -#_sublevel=6 -#pkgver=${_basekernel}.${_sublevel} -pkgver=${_basekernel} +# Maintainer (Parabola): Márcio Silva <coadde@lavabit.com> + +pkgbase=linux-libre # Build stock -LIBRE kernel +#pkgbase=linux-libre-custom # Build kernel with a different name +_basekernel=3.6 +_sublevel=6 +pkgver=${_basekernel}.${_sublevel} +pkgrel=1 _lxopkgver=${_basekernel}.5 # nearly always the same as pkgver -pkgrel=1.2 arch=('i686' 'x86_64' 'mips64el') url="http://linux-libre.fsfla.org/" license=('GPL2') makedepends=('xmlto' 'docbook-xsl') options=('!strip') source=("http://linux-libre.fsfla.org/pub/linux-libre/releases/${_basekernel}-gnu/linux-libre-${_basekernel}-gnu.tar.xz" - #"http://linux-libre.fsfla.org/pub/linux-libre/releases/${pkgver}-gnu/patch-${_basekernel}-gnu-${pkgver}-gnu.xz" + "http://linux-libre.fsfla.org/pub/linux-libre/releases/${pkgver}-gnu/patch-${_basekernel}-gnu-${pkgver}-gnu.xz" # the main kernel config files 'config.i686' 'config.x86_64' # standard config files for mkinitcpio ramdisk - "${pkgname}.preset" + "${pkgbase}.preset" 'Kbuild' 'Kbuild.platforms' 'boot-logo.patch' 'change-default-console-loglevel.patch' - 'i915-fix-ghost-tv-output.patch' - "http://www.linux-libre.fsfla.org/pub/linux-libre/lemote/gnewsense/pool/linux-patches-${_lxopkgver}-gnu_0loongsonlibre_mipsel.tar.bz2") -md5sums=('a5e128ca059cceb8b69148b41ff4ac6f' - #'6d9d139e4b53802615833372728cc0e4' - '631bee7d8e6e125f859fc51200699685' - '54f6db6c3b747fbee10cb02460ba66f0' + 'module-symbol-waiting-3.6.patch' + 'module-init-wait-3.6.patch' + "http://www.linux-libre.fsfla.org/pub/linux-libre/lemote/gnewsense/pool/debuginfo/linux-patches-${_lxopkgver}-gnu_0loongsonlibre_mipsel.tar.bz2") +md5sums=('a2312edd0265b5b07bd4b50afae2b380' + '887e4a0fd0fb10da9410f5d1a75466b8' + 'e4a3a4677e1fac6ecf0e0fb44c41ca08' + '68fc36a4efb6ade0eca409b9444fef0c' 'e49ac236dfeef709f91a3d993ea7b62c' '2967cecc3af9f954ccc822fd63dca6ff' '8267264d9a8966e57fdacd1fa1fc65c4' '04b21c79df0a952c22d681dd4f4562df' '9d3c56a4b999c8bfbd4018089a62f662' - '263725f20c0b9eb9c353040792d644e5' - 'de092ff42e61e88a67f50c351c2ad7c0') + '670931649c60fcb3ef2e0119ed532bd4' + '8a71abc4224f575008f974a099b5cf6f' + '16173f50a1a39e908825fe6fe90ac103') if [ "$CARCH" != "mips64el" ]; then # Don't use the Loongson-specific patches on non-mips64el arches. unset source[${#source[@]}-1] unset md5sums[${#md5sums[@]}-1] fi +_kernelname=${pkgbase#linux-libre} +_localversionname=-LIBRE + build() { cd "${srcdir}/linux-${_basekernel}" @@ -61,21 +63,16 @@ build() { # Add freedo as boot logo patch -Np1 -i "${srcdir}/boot-logo.patch" - # Some chips detect a ghost TV output - # mailing list discussion: http://lists.freedesktop.org/archives/intel-gfx/2011-April/010371.html - # Arch Linux bug report: FS#19234 - # - # It is unclear why this patch wasn't merged upstream, it was accepted, - # then dropped because the reasoning was unclear. However, it is clearly - # needed. - patch -Np1 -i "${srcdir}/i915-fix-ghost-tv-output.patch" - - # Patch submitted upstream, waiting for inclusion: # set DEFAULT_CONSOLE_LOGLEVEL to 4 (same value as the 'quiet' kernel param) # remove this when a Kconfig knob is made available by upstream # (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227) patch -Np1 -i "${srcdir}/change-default-console-loglevel.patch" + # fix module initialisation + # https://bugs.archlinux.org/task/32122 + patch -Np1 -i "${srcdir}/module-symbol-waiting-3.6.patch" + patch -Np1 -i "${srcdir}/module-init-wait-3.6.patch" + if [ "$CARCH" == "mips64el" ]; then sed -i "s|^EXTRAVERSION.*|EXTRAVERSION =-libre|" Makefile sed -r "s|^( SUBLEVEL = ).*|\1$_sublevel|" \ @@ -88,10 +85,10 @@ build() { # https://git.kernel.org/?p=linux/hotplug/udev.git;a=blob_plain;f=README # and make USB storage support builtin (e.g. for booting from USB # disks without slowly loading an initramfs) - sed -ri -e "s|CONFIG_MIPS32_N32=.*|CONFIG_MIPS32_N32=y|g" \ + sed -ri \ -e "s|CONFIG_MIPS32_N32=.*|CONFIG_MIPS32_N32=y|g" \ -e "s|CONFIG_UEVENT_HELPER_PATH=.*|CONFIG_UEVENT_HELPER_PATH=\"\"|g" \ - -e "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" \ + -e "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_localversionname}\"|g" \ -e "s;(CONFIG_USB(_COMMON|_EHCI_HCD|_OHCI_HCD|_STORAGE.*|_UAS)?)=.*;\1=y;g" \ ./.config else @@ -99,12 +96,16 @@ build() { fi if [ "${_kernelname}" != "" ]; then - sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config + sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_localversionname}\"|g" ./.config + sed -i "s|CONFIG_LOCALVERSION_AUTO=.*|CONFIG_LOCALVERSION_AUTO=n|" ./.config fi # set extraversion to pkgrel sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" Makefile + # don't run depmod on 'make install'. We'll do this ourselves in packaging + sed -i '2iexit 0' scripts/depmod.sh + # get kernel version make prepare @@ -116,15 +117,22 @@ build() { #make oldconfig # using old config from previous kernel version # ... or manually edit .config + # rewrite configuration + yes "" | make config >/dev/null + + # save configuration for later reuse + if [ "${CARCH}" = "x86_64" ]; then + cat .config > "${startdir}/config.x86_64.last" + else + cat .config > "${startdir}/config.i686.last" + fi + #################### # stop here # this is useful to configure the kernel - #msg "Stopping build" - #return 1 + #msg "Stopping build"; return 1 #################### - yes "" | make config - # build! if [ "$CARCH" == "mips64el" ]; then # The build system passes it directly to linker, disable to avoid @@ -132,22 +140,22 @@ build() { export LDFLAGS="" # bzImage is arch-specific and not supported on mips; vmlinux is # useful for oprofile. - make ${MAKEFLAGS} vmlinux vmlinuz modules + make ${MAKEFLAGS} LOCALVERSION= vmlinux vmlinuz modules else - make ${MAKEFLAGS} bzImage modules + make ${MAKEFLAGS} LOCALVERSION= bzImage modules fi } -package_linux-libre() { - pkgdesc="The Linux-libre Kernel and modules" - groups=('base') - depends=('coreutils' 'kmod') +_package() { + pkgdesc="The ${pkgbase} kernel and modules" + [ "${pkgbase}" = "linux-libre" ] && groups=('base') + depends=('coreutils' 'linux-libre-firmware' 'kmod') optdepends=('crda: to set the correct wireless channels of your country') - provides=('kernel26' "linux=$pkgver") - conflicts=('kernel26' 'kernel26-libre' 'linux') - replaces=('kernel26' 'kernel26-libre' 'linux') - backup=("etc/mkinitcpio.d/${pkgname}.preset") - install=${pkgname}.install + provides=("kernel26${_kernelname}=${pkgver}" "linux${_kernelname}=${pkgver}") + conflicts=("kernel26${_kernelname}" "kernel26-libre${_kernelname}" "linux${_kernelname}") + replaces=("kernel26${_kernelname}" "kernel26-libre${_kernelname}" "linux${_kernelname}") + backup=("etc/mkinitcpio.d/${pkgbase}.preset") + install=${pkgbase}.install if [ "$CARCH" = "mips64el" ]; then optdepends+=('mkinitcpio: to make the initramfs (needs reinstall of this package)') conflicts+=('mkinitcpio<0.7') @@ -161,35 +169,42 @@ package_linux-libre() { [ $CARCH = "mips64el" ] && KARCH=mips # get kernel version - _kernver="$(make kernelrelease)" + _kernver="$(make LOCALVERSION= kernelrelease)" + _basekernel=${_kernver%%-*} + _basekernel=${_basekernel%.*} mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot} - make INSTALL_MOD_PATH="${pkgdir}" modules_install + make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}" modules_install if [ "$CARCH" == "mips64el" ]; then - cp vmlinuz "${pkgdir}/boot/vmlinuz-${pkgname}" - cp vmlinux "${pkgdir}/boot/vmlinux-${pkgname}" + cp vmlinuz "${pkgdir}/boot/vmlinuz-${pkgbase}" + cp vmlinux "${pkgdir}/boot/vmlinux-${pkgbase}" else - cp "arch/${KARCH}/boot/bzImage" "${pkgdir}/boot/vmlinuz-${pkgname}" + cp "arch/${KARCH}/boot/bzImage" "${pkgdir}/boot/vmlinuz-${pkgbase}" fi # add vmlinux install -D -m644 vmlinux "${pkgdir}/usr/src/linux-${_kernver}/vmlinux" # install fallback mkinitcpio.conf file and preset file for kernel - install -D -m644 "${srcdir}/${pkgname}.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset" + install -D -m644 "${srcdir}/${pkgbase}.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset" # set correct depmod command for install sed \ - -e "s|ALL_kver=.*|ALL_kver=\"/boot/vmlinuz-${pkgname}\"|g" \ - -e "s|default_image=.*|default_image=\"/boot/initramfs-${pkgname}.img\"|g" \ - -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-${pkgname}-fallback.img\"|g" \ - -i "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset" + -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/" \ + -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/" \ + -i "${startdir}/${pkgbase}.install" + sed \ + -e "1s|'linux*.*'|'${pkgbase}'|" \ + -e "s|ALL_kver=.*|ALL_kver=\"/boot/vmlinuz-${pkgbase}\"|" \ + -e "s|default_image=.*|default_image=\"/boot/initramfs-${pkgbase}.img\"|" \ + -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-${pkgbase}-fallback.img\"|" \ + -i "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset" # mkinitcpio 0.7 relies on bzImage to find the kernel version if [ "$CARCH" == "mips64el" ]; then - sed -e "s|ALL_kver=.*|ALL_kver=\"${_kernver}\"|g" \ - -i "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset" + sed -e "s|ALL_kver=.*|ALL_kver=\"${_kernver}\"|" \ + -i "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset" fi # remove build and source links @@ -199,17 +214,23 @@ package_linux-libre() { # gzip -9 all modules to save 100MB of space find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \; # make room for external modules - ln -s "../extramodules-${_basekernel}${_kernelname:--LIBRE}" "${pkgdir}/lib/modules/${_kernver}/extramodules" + ln -s "../extramodules-${_basekernel}${_localversionname:--LIBRE}" "${pkgdir}/lib/modules/${_kernver}/extramodules" # add real version for building modules and running depmod from post_install/upgrade - mkdir -p "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--LIBRE}" - echo "${_kernver}" > "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--LIBRE}/version" + mkdir -p "${pkgdir}/lib/modules/extramodules-${_basekernel}${_localversionname:--LIBRE}" + echo "${_kernver}" > "${pkgdir}/lib/modules/extramodules-${_basekernel}${_localversionname:--LIBRE}/version" + + # Now we call depmod... + depmod -b "$pkgdir" -F System.map "$_kernver" + + # move module tree /lib -> /usr/lib + mv "$pkgdir/lib" "$pkgdir/usr" } -package_linux-libre-headers() { - pkgdesc="Header files and scripts for building modules for linux-libre kernel" - provides=('kernel26-headers' "linux-headers=${pkgver}") - conflicts=('kernel26-headers' 'kernel26-libre-headers' 'linux-headers') - replaces=('kernel26-headers' 'kernel26-libre-headers' 'linux-headers') +_package-headers() { + pkgdesc="Header files and scripts for building modules for ${pkgbase} kernel" + provides=("kernel26${_kernelname}-headers=${pkgver}" "linux${_kernelname}-headers=${pkgver}") + conflicts=("kernel26${_kernelname}-headers" "kernel26-libre${_kernelname}-headers" "linux${_kernelname}-headers") + replaces=("kernel26${_kernelname}-headers" "kernel26-libre${_kernelname}-headers" "linux${_kernelname}-headers") KARCH=x86 [ $CARCH = "mips64el" ] && KARCH=mips @@ -217,13 +238,13 @@ package_linux-libre-headers() { # In case of repackaging this is empty if [ -z "${_kernver}" ]; then cd "${srcdir}/linux-${_basekernel}" - _kernver="$(make kernelrelease)" + _kernver="$(make LOCALVERSION= kernelrelease)" fi - mkdir -p "${pkgdir}/lib/modules/${_kernver}" + install -dm755 "${pkgdir}/usr/lib/modules/${_kernver}" - cd "${pkgdir}/lib/modules/${_kernver}" - ln -sf ../../../usr/src/linux-${_kernver} build + cd "${pkgdir}/usr/lib/modules/${_kernver}" + ln -sf ../../../src/linux-${_kernver} build cd "${srcdir}/linux-${_basekernel}" install -D -m644 Makefile \ @@ -273,7 +294,7 @@ package_linux-libre-headers() { cp drivers/media/video/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/" - for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102; do + for i in bt8xx cpia2 cx25840 cx88 em28xx pwc saa7134 sn9c102; do mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}" cp -a drivers/media/video/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}" done @@ -356,11 +377,11 @@ package_linux-libre-headers() { fi } -package_linux-libre-docs() { - pkgdesc="Kernel hackers manual - HTML documentation that comes with the Linux-libre kernel." - provides=('kernel26-docs' "linux-docs=$pkgver") - conflicts=('kernel26-docs' 'kernel26-libre-docs' 'linux-docs') - replaces=('kernel26-docs' 'kernel26-libre-docs' 'linux-docs') +_package-docs() { + pkgdesc="Kernel libre hackers manual - HTML documentation that comes with the ${pkgbase} kernel" + provides=("kernel26${_kernelname}-docs=${pkgver}" "linux${_kernelname}-docs=${pkgver}") + conflicts=("kernel26${_kernelname}-docs" "kernel26-libre${_kernelname}-docs" "linux${_kernelname}-docs") + replaces=("kernel26${_kernelname}-docs" "kernel26-libre${_kernelname}-docs" "linux${_kernelname}-docs") cd "${srcdir}/linux-${_basekernel}" @@ -372,3 +393,12 @@ package_linux-libre-docs() { # remove a file already in linux package rm -f "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile" } + +pkgname=("${pkgbase}" "${pkgbase}-headers" "${pkgbase}-docs") +for _p in ${pkgname[@]}; do + eval "package_${_p}() { + _package${_p#${pkgbase}} + }" +done + +# vim:set ts=8 sts=2 sw=2 et: |