#!/bin/bash # grab version info from kernel makefile KVER=$(grep ^VERSION Makefile |cut -c 11-) KPAT=$(grep ^PATCHLEVEL Makefile |cut -c 14-) KSUB=$(grep ^SUBLEVEL Makefile |cut -c 12-) # path to headers KDIR=../kernel-userspace-headers-$KVER.$KPAT.$KSUB # prep rm -f include/uapi/linux/Kbuild # export headers make INSTALL_HDR_PATH=$KDIR headers_install_all find $KDIR -name ..install.cmd -exec rm -f {} \; find $KDIR -name .install -exec rm -f {} \; cp --parents include/linux/pci_ids.h $KDIR # package headers tar -cJvf kernel-userspace-headers-$KVER.$KPAT.$KSUB.tar.xz $KDIR