summaryrefslogtreecommitdiff
path: root/kernels/linux-libre-lts-knock/PKGBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'kernels/linux-libre-lts-knock/PKGBUILD')
-rw-r--r--kernels/linux-libre-lts-knock/PKGBUILD104
1 files changed, 22 insertions, 82 deletions
diff --git a/kernels/linux-libre-lts-knock/PKGBUILD b/kernels/linux-libre-lts-knock/PKGBUILD
index 4868b72b0..20d9dbfbe 100644
--- a/kernels/linux-libre-lts-knock/PKGBUILD
+++ b/kernels/linux-libre-lts-knock/PKGBUILD
@@ -11,7 +11,6 @@
pkgbase=linux-libre-lts-knock # Build stock -lts-knock kernel
_pkgbasever=3.10-gnu
_pkgver=3.10.53-gnu
-_lxopkgver=3.10.53-gnu # nearly always the same as _pkgver
_knockpatchver=3.10
_replaces=('kernel26%' 'kernel26-libre%' 'linux%' 'linux-libre%-kmod-alx') # '%' gets replaced with _kernelname
@@ -28,38 +27,36 @@ source=("http://linux-libre.fsfla.org/pub/linux-libre/releases/${_pkgbasever}/li
"http://linux-libre.fsfla.org/pub/linux-libre/releases/${_pkgver}/patch-${_pkgbasever}-${_pkgver}.xz"
"http://gnunet.org/sites/default/files/tcp_stealth_${_knockpatchver}.diff"
# the main kernel config files
- 'config.i686' 'config.x86_64'
+ 'config.i686' 'config.x86_64' 'config.mips64el'
# standard config files for mkinitcpio ramdisk
'linux.preset'
- 'Kbuild'
- 'Kbuild.platforms'
'logo_linux_'{clut224.ppm,vga16.ppm,mono.pbm}
'change-default-console-loglevel.patch'
'criu-no-expert.patch'
- "http://www.linux-libre.fsfla.org/pub/linux-libre/lemote/gnewsense/pool/debuginfo/linux-patches-${_lxopkgver}_0loongsonlibre_mipsel.tar.xz")
+ # loongson-community patch: http://linux-libre.fsfla.org/pub/linux-libre/lemote/gnewsense/pool/debuginfo/
+ '3.10.50-33c9ab76eb-loongson-community.patch')
md5sums=('d562fd52580a3b6b18b6eeb5921d1d5c'
'4840f0db6af66cbce923b1043971c256'
'26380d6f05471ef8e065a77d87588009'
'25ad0606de251a5734f4535c61452a56'
'158cb922d9b43028f6c45c696e773915'
+ ''
'eb14dcfd80c00852ef81ded6e826826a'
- '2967cecc3af9f954ccc822fd63dca6ff'
- '8267264d9a8966e57fdacd1fa1fc65c4'
'071d4939e9ef4256e4c027ef3c864903'
'2ae9ef17f45b39ff9e6e172c0c97d263'
'96c2ae40e3b1cdd90fe7e6dba8078922'
'f3def2cefdcbb954c21d8505d23cc83c'
'd50c1ac47394e9aec637002ef3392bd1'
- '200668954d1cee93fb649196e3df8bde')
-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}
_replaces=("${_replaces[@]/\%/${_kernelname}}")
+case "$CARCH" in
+ i686|x86_64) KARCH=x86;;
+ mips64el) KARCH=mips;;
+esac
+
prepare() {
cd "${srcdir}/${_srcname}"
@@ -87,27 +84,10 @@ prepare() {
# patch from fedora
patch -Np1 -i "${srcdir}/criu-no-expert.patch"
- if [ "$CARCH" == "mips64el" ]; then
- sed -i "s|^EXTRAVERSION.*|EXTRAVERSION =-libre-lts-knock|" Makefile
- sed -r "s|^( SUBLEVEL = ).*|\1$_sublevel|" \
- < "${srcdir}/lxo-config.patch" > lxo-config.patch
- msg2 "Adding loongson-community patches"
- patch -Np1 -i ${srcdir}/${_basekernel}*-*-loongson-community.patch
- patch -Np0 -i lxo-config.patch
-
- # ensure N32, add localversion, remove uevent helper as per
- # 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" \
- -e "s|CONFIG_UEVENT_HELPER_PATH=.*|CONFIG_UEVENT_HELPER_PATH=\"\"|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
- cat "${srcdir}/config.${CARCH}" > ./.config # simpler
- fi
+ # Adding loongson-community patch
+ patch -p1 -i ${srcdir}/3.10.50-33c9ab76eb-loongson-community.patch
+
+ cat "${srcdir}/config.${CARCH}" > ./.config
if [ "${_kernelname}" != "" ]; then
sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
@@ -139,10 +119,12 @@ build() {
yes "" | make config >/dev/null
# save configuration for later reuse
- if [ "${CARCH}" = "x86_64" ]; then
- cat .config > "${startdir}/config.x86_64.last"
- else
+ if [ "${CARCH}" = "i686" ]; then
cat .config > "${startdir}/config.i686.last"
+ elif [ "${CARCH}" = "x86_64" ]; then
+ cat .config > "${startdir}/config.x86_64.last"
+ elif [ "${CARCH}" = "mips64el" ]; then
+ cat .config > "${startdir}/config.mips64el.last"
fi
####################
@@ -152,16 +134,7 @@ build() {
####################
# build!
- if [ "$CARCH" == "mips64el" ]; then
- # The build system passes it directly to linker, disable to avoid
- # having unknown -Wl,... options.
- export LDFLAGS=""
- # bzImage is arch-specific and not supported on mips; vmlinux is
- # useful for oprofile.
- make ${MAKEFLAGS} LOCALVERSION= vmlinux vmlinuz modules
- else
- make ${MAKEFLAGS} LOCALVERSION= bzImage modules
- fi
+ make ${MAKEFLAGS} LOCALVERSION= bzImage modules
}
_package() {
@@ -174,16 +147,8 @@ _package() {
replaces=( "${_replaces[@]}")
backup=("etc/mkinitcpio.d/${pkgbase}.preset")
install=linux.install
- if [ "$CARCH" = "mips64el" ]; then
- optdepends+=('mkinitcpio: to make the initramfs (needs reinstall of this package)')
- conflicts+=('mkinitcpio<0.7')
- else
- depends+=('mkinitcpio>=0.7')
- fi
cd "${srcdir}/${_srcname}
- KARCH=x86
- [ $CARCH = "mips64el" ] && KARCH=mips
# get kernel version
_kernver="$(make LOCALVERSION= kernelrelease)"
@@ -193,12 +158,7 @@ _package() {
mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot}
make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}" modules_install
- if [ "$CARCH" == "mips64el" ]; then
- cp vmlinuz "${pkgdir}/boot/vmlinuz-${pkgbase}"
- cp vmlinux "${pkgdir}/boot/vmlinux-${pkgbase}"
- else
- cp arch/${KARCH}/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}"
- fi
+ cp arch/${KARCH}/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}"
# add vmlinux
install -D -m644 vmlinux "${pkgdir}/usr/src/linux-${_kernver}/vmlinux"
@@ -220,12 +180,6 @@ _package() {
-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}\"|" \
- -i "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
- fi
-
# remove build and source links
rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}
# remove the firmware
@@ -251,9 +205,6 @@ _package-headers() {
conflicts=("${_replaces[@]/%/-headers}")
replaces=( "${_replaces[@]/%/-headers}")
- KARCH=x86
- [ $CARCH = "mips64el" ] && KARCH=mips
-
# in case of repackaging this is empty
if [ -z "${_kernver}" ]; then
cd "${srcdir}/linux-${_basekernel}"
@@ -288,12 +239,6 @@ _package-headers() {
cp Module.symvers "${pkgdir}/usr/src/linux-${_kernver}"
cp -a scripts "${pkgdir}/usr/src/linux-${_kernver}"
- if [ "$CARCH" = "mips64el" ]; then
- cp arch/${KARCH}/Kbuild "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
- cp -a arch/${KARCH}/loongson "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
- cp ${srcdir}/Kbuild.platforms "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
- fi
-
# fix permissions on scripts dir
chmod og-w -R "${pkgdir}/usr/src/linux-${_kernver}/scripts"
mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions"
@@ -397,12 +342,7 @@ _package-headers() {
done
# 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,microblaze,mn10300,openrisc,parisc,powerpc,ppc,s390,score,sh,sh64,sparc,sparc64,tile,unicore32,um,v850,xtensa}
- if [ "$CARCH" = "mips64el" ]; then
- rm -rf ${pkgdir}/usr/src/linux-${_kernver}/arch/x86
- else
- rm -rf ${pkgdir}/usr/src/linux-${_kernver}/arch/mips
- fi
+ find "${pkgdir}"/usr/lib/modules/${_kernver}/build/arch -mindepth 1 -maxdepth 1 -type d -not -name "$KARCH" -exec rm -rf {} +
}
_package-docs() {