diff options
Diffstat (limited to 'libre/linux-libre/PKGBUILD')
-rw-r--r-- | libre/linux-libre/PKGBUILD | 126 |
1 files changed, 76 insertions, 50 deletions
diff --git a/libre/linux-libre/PKGBUILD b/libre/linux-libre/PKGBUILD index d676ff269..f9efa84dd 100644 --- a/libre/linux-libre/PKGBUILD +++ b/libre/linux-libre/PKGBUILD @@ -7,35 +7,35 @@ # Maintainer (Parabola): Michał Masłowski <mtjm@mtjm.eu> # Maintainer (Parabola): Márcio Silva <coadde@lavabit.com> -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 +pkgbase=linux-libre # Build stock -LIBRE kernel +#pkgbase=linux-libre-custom # Build kernel with a different name _basekernel=3.5 -#_sublevel=6 -#pkgver=${_basekernel}.${_sublevel} -pkgver=${_basekernel} +_sublevel=1 +pkgver=${_basekernel}.${_sublevel} +pkgrel=1 _lxopkgver=${_basekernel}.0 # nearly always the same as pkgver -pkgrel=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' 'avmfritz-only-few-bytes-are-transfered-on-a-conn.patch' "http://www.linux-libre.fsfla.org/pub/linux-libre/lemote/gnewsense/pool/debuginfo/linux-patches-${_lxopkgver}-gnu_0loongsonlibre_mipsel.tar.bz2") + +_kernelname=${pkgbase#linux-libre} +_localversionname=-LIBRE md5sums=('2407fc9563a74acaf38aa0c06516eb1c' - '7f0b7950bc9d2a20cdb6b850e6e4eb5a' + '67b650dd355fbca16035510df063420b' 'a796ea383eb136cb38fab0a52b6d2f52' 'e49ac236dfeef709f91a3d993ea7b62c' '2967cecc3af9f954ccc822fd63dca6ff' @@ -67,6 +67,7 @@ build() { patch -Np1 -i "${srcdir}/change-default-console-loglevel.patch" # fix avmfritz capi20 functionallity + # will be added to 3.5.2 # https://bugzilla.kernel.org/show_bug.cgi?id=45271 patch -Np1 -i "${srcdir}/avmfritz-only-few-bytes-are-transfered-on-a-conn.patch" @@ -85,7 +86,8 @@ build() { sed -ri -e "s|CONFIG_MIPS32_N32=.*|CONFIG_MIPS32_N32=y|g" \ -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_LOCALVERSION_AUTO=.*|CONFIG_LOCALVERSION_AUTO=n|" \ -e "s;(CONFIG_USB(_COMMON|_EHCI_HCD|_OHCI_HCD|_STORAGE.*|_UAS)?)=.*;\1=y;g" \ ./.config else @@ -93,7 +95,8 @@ 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 @@ -113,15 +116,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 @@ -129,22 +139,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') +_package() { + pkgdesc="The ${pkgbase} kernel and modules" + [ "${pkgbase}" = "linux-libre" ] && groups=('base') depends=('coreutils' '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') @@ -158,35 +168,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}/linux-lts.install" + sed \ + -e "1s|'linux-libre.*'|'${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 @@ -208,11 +225,11 @@ package_linux-libre() { depmod -b "$pkgdir" -F System.map "$_kernver" } -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 @@ -220,7 +237,7 @@ 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 install -dm755 "${pkgdir}/usr/lib/modules/${_kernver}" @@ -359,11 +376,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 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}" @@ -375,3 +392,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: |