From 2095d81f0b2afe34cef32d8677d50351b97a1c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Fabian=20Silva=20Delgado?= Date: Wed, 26 Aug 2015 06:38:46 -0300 Subject: linux-libre: fix issues for armv7h --- libre/linux-libre/PKGBUILD | 81 ++++++++++++++++++++++++++++++++--------- libre/linux-libre/linux.install | 42 +++++++++++++-------- 2 files changed, 90 insertions(+), 33 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 # Contributor: Márcio Silva # Contributor: Luke Shumaker +# Contributor: Luke R. # 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" diff --git a/libre/linux-libre/linux.install b/libre/linux-libre/linux.install index 32514d892..2f90d8bf6 100644 --- a/libre/linux-libre/linux.install +++ b/libre/linux-libre/linux.install @@ -8,30 +8,42 @@ post_install () { # updating module dependencies echo ">>> Updating module dependencies. Please wait ..." depmod ${KERNEL_VERSION} - echo ">>> Generating initial ramdisk, using mkinitcpio. Please wait..." - mkinitcpio -p linux-libre${KERNEL_NAME} + if [ $(uname -m) != armv7h ]; then + echo ">>> Generating initial ramdisk, using mkinitcpio. Please wait..." + mkinitcpio -p linux-libre${KERNEL_NAME} + else + echo "NOTE: Using this kernel requires an updated U-Boot!" + fi } post_upgrade() { - if findmnt --fstab -uno SOURCE /boot &>/dev/null && ! mountpoint -q /boot; then - echo "WARNING: /boot appears to be a separate partition but is not mounted." - fi + if [ $(uname -m) != armv7h ]; then + if findmnt --fstab -uno SOURCE /boot &>/dev/null && ! mountpoint -q /boot; then + echo "WARNING: /boot appears to be a separate partition but is not mounted." + fi - # updating module dependencies - echo ">>> Updating module dependencies. Please wait ..." - depmod ${KERNEL_VERSION} - echo ">>> Generating initial ramdisk, using mkinitcpio. Please wait..." - mkinitcpio -p linux-libre${KERNEL_NAME} + # updating module dependencies + echo ">>> Updating module dependencies. Please wait ..." + depmod ${KERNEL_VERSION} + echo ">>> Generating initial ramdisk, using mkinitcpio. Please wait..." + mkinitcpio -p linux-libre${KERNEL_NAME} - if [ $(vercmp $2 3.13) -lt 0 ]; then - echo ">>> WARNING: AT keyboard support is no longer built into the kernel." - echo ">>> In order to use your keyboard during early init, you MUST" - echo ">>> include the 'keyboard' hook in your mkinitcpio.conf." - fi + if [ $(vercmp $2 3.13) -lt 0 ]; then + echo ">>> WARNING: AT keyboard support is no longer built into the kernel." + echo ">>> In order to use your keyboard during early init, you MUST" + echo ">>> include the 'keyboard' hook in your mkinitcpio.conf." + fi + else + # updating module dependencies + echo ">>> Updating module dependencies. Please wait ..." + depmod ${KERNEL_VERSION} + fi } +if [ $(uname -m) != armv7h ]; then post_remove() { # also remove the compat symlinks rm -f boot/initramfs-linux-libre${KERNEL_NAME}.img rm -f boot/initramfs-linux-libre${KERNEL_NAME}-fallback.img } +fi -- cgit v1.1-4-g5e80