diff options
Diffstat (limited to 'libre/linux-libre/PKGBUILD')
-rw-r--r-- | libre/linux-libre/PKGBUILD | 81 |
1 files changed, 63 insertions, 18 deletions
diff --git a/libre/linux-libre/PKGBUILD b/libre/linux-libre/PKGBUILD index 0476f4bab..4326cd192 100644 --- a/libre/linux-libre/PKGBUILD +++ b/libre/linux-libre/PKGBUILD @@ -4,6 +4,7 @@ # Contributor: Michał Masłowski <mtjm@mtjm.eu> # Contributor: Márcio Silva <coadde@parabola.nu> # Contributor: Luke Shumaker <lukeshu@sbcglobal.net> +# Contributor: Luke R. <g4jc@openmailbox.org> # Based on linux package @@ -24,6 +25,9 @@ arch=('i686' 'x86_64' 'armv7h') url="http://linux-libre.fsfla.org/" license=('GPL2') makedepends=('xmlto' 'docbook-xsl' 'kmod' 'inetutils' 'bc') +if [ "$CARCH" = "armv7h" ]; then + makedepends+=('uboot-tools') +fi options=('!strip') source=("http://linux-libre.fsfla.org/pub/linux-libre/releases/${_pkgbasever}/linux-libre-${_pkgbasever}.tar.xz" "http://linux-libre.fsfla.org/pub/linux-libre/releases/${_pkgbasever}/linux-libre-${_pkgbasever}.tar.xz.sign" @@ -69,6 +73,7 @@ _replacesoldmodules=("${_replacesoldmodules[@]/\%/${_kernelname}}") case "$CARCH" in i686|x86_64) KARCH=x86;; + armv7h) KARCH=arm;; esac prepare() { @@ -93,8 +98,8 @@ prepare() { # Make the radeon driver load without the firmwares # http://www.fsfla.org/pipermail/linux-libre/2015-August/003098.html - if [ "${CARCH}" = "i686" && "${CARCH}" = "x86_64" ]; then ## This patch is only needed for x86 computers, so we disable it for others - patch -Np1 -i ../0001-drm-radeon-Make-the-driver-load-without-the-firmwares.patch + if [ "${CARCH}" != "armv7h" ]; then ## This patch is only needed for x86 computers, so we disable it for others + patch -Np1 -i ../0001-drm-radeon-Make-the-driver-load-without-the-firmwares.patch fi cat "${srcdir}/config.${CARCH}" > ./.config @@ -123,18 +128,27 @@ prepare() { build() { cd "${srcdir}/${_srcname}" - make ${MAKEFLAGS} LOCALVERSION= bzImage modules + if [ "${CARCH}" != "armv7h" ]; then + make ${MAKEFLAGS} LOCALVERSION= bzImage modules + else + make ${MAKEFLAGS} LOCALVERSION= zImage modules dtbs + fi } _package() { pkgdesc="The ${pkgbase^} kernel and modules" [ "${pkgbase}" = "linux-libre" ] && groups=('base') - depends=('coreutils' 'linux-libre-firmware' 'kmod' 'mkinitcpio>=0.7') + depends=('coreutils' 'linux-libre-firmware' 'kmod') + if [ "${CARCH}" != "armv7h" ]; then + depends+=('mkinitcpio>=0.7') + fi optdepends=('crda: to set the correct wireless channels of your country') provides=("${_replacesarchkernel[@]/%/=${_archpkgver}}") conflicts=("${_replacesarchkernel[@]}" "${_replacesoldkernels[@]}" "${_replacesoldmodules[@]}") replaces=("${_replacesarchkernel[@]}" "${_replacesoldkernels[@]}" "${_replacesoldmodules[@]}") - backup=("etc/mkinitcpio.d/${pkgbase}.preset") + if [ "$CARCH" != "armv7h" ]; then + backup=("etc/mkinitcpio.d/${pkgbase}.preset") + fi install=linux.install cd "${srcdir}/${_srcname}" @@ -145,30 +159,51 @@ _package() { _basekernel=${_basekernel%.*} mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot} + if [ "${CARCH}" = "armv7h" ]; then + mkdir -p "${pkgdir}"/boot/dtbs + fi make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}" modules_install - cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}" + if [ "${CARCH}" != "armv7h" ]; then + cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}" + else + cp arch/$KARCH/boot/zImage "${pkgdir}/boot/vmlinuz-${pkgbase}" + cp arch/$KARCH/boot/dts/*.dtb "${pkgdir}/boot/dtbs" + + for _arm in armada-{370-smileplug,370-mirabox,xp-openblocks-ax3-4} dove-{d3plug.cubox}; do + cat arch/$KARCH/boot/zImage arch/$KARCH/boot/dts/${_arm}.dtb > myimage-${_arm} + mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n "${pkgname}" -d myimage-${_arm} "${pkgdir}/boot/uImage-${pkgbase}-${_arm}" + done + fi # set correct depmod command for install - cp -f "${startdir}/${install}" "${startdir}/${install}.pkg" - true && install=${install}.pkg + if [ "$CARCH" != "armv7h" ]; then + cp -f "${startdir}/${install}" "${startdir}/${install}.pkg" + true && install=${install}.pkg + fi sed \ -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/" \ -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/" \ -i "${startdir}/${install}" - # install mkinitcpio preset file for kernel - install -D -m644 "${srcdir}/linux.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset" - 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" + if [ "$CARCH" != "armv7h" ]; then + # install mkinitcpio preset file for kernel + install -D -m644 "${srcdir}/linux.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset" + 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" + fi # remove build and source links rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build} # remove the firmware rm -rf "${pkgdir}/lib/firmware" + if [ "$CARCH" = "armv7h" ]; then + # gzip -9 all modules to save 100MB of space + find "${pkgdir}" -name '*.ko' |xargs -P 2 -n 1 gzip -9 + fi # make room for external modules ln -s "../extramodules-${_basekernel}${_kernelname}" "${pkgdir}/lib/modules/${_kernver}/extramodules" # add real version for building modules and running depmod from post_install/upgrade @@ -182,8 +217,10 @@ _package() { mkdir -p "${pkgdir}/usr" mv "${pkgdir}/lib" "${pkgdir}/usr/" - # add vmlinux - install -D -m644 vmlinux "${pkgdir}/usr/lib/modules/${_kernver}/build/vmlinux" + if [ "$CARCH" != "armv7h" ]; then + # add vmlinux + install -D -m644 vmlinux "${pkgdir}/usr/lib/modules/${_kernver}/build/vmlinux" + fi } _package-headers() { @@ -212,6 +249,14 @@ _package-headers() { # copy arch includes for external modules mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}" cp -a arch/${KARCH}/include "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/" + if [ "$CARCH" = "armv7h" ]; then + mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/mach-omap2" + cp -a arch/${KARCH}/mach-omap2/include "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/mach-omap2/" + mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/mach-mvebu" + cp -a arch/${KARCH}/mach-mvebu/include "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/mach-mvebu/" + mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/plat-omap" + cp -a arch/${KARCH}/plat-omap/include "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/plat-omap/" + fi # copy files necessary for later builds cp Module.symvers "${pkgdir}/usr/lib/modules/${_kernver}/build" |