Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at d784cfe697abdfd53f332d39d0cffcf03cbcafaa 53 lines 1.4 kB view raw
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Provide kernel headers useful to build tracing programs 4 * such as for running eBPF tracing tools. 5 * 6 * (Borrowed code from kernel/configs.c) 7 */ 8 9#include <linux/kernel.h> 10#include <linux/module.h> 11#include <linux/kobject.h> 12#include <linux/init.h> 13 14/* 15 * Define kernel_headers_data and kernel_headers_data_end, within which the 16 * compressed kernel headers are stored. The file is first compressed with xz. 17 */ 18 19asm ( 20" .pushsection .rodata, \"a\" \n" 21" .global kernel_headers_data \n" 22"kernel_headers_data: \n" 23" .incbin \"kernel/kheaders_data.tar.xz\" \n" 24" .global kernel_headers_data_end \n" 25"kernel_headers_data_end: \n" 26" .popsection \n" 27); 28 29extern char kernel_headers_data[]; 30extern char kernel_headers_data_end[]; 31 32static struct bin_attribute kheaders_attr __ro_after_init = 33 __BIN_ATTR_SIMPLE_RO(kheaders.tar.xz, 0444); 34 35static int __init ikheaders_init(void) 36{ 37 kheaders_attr.private = kernel_headers_data; 38 kheaders_attr.size = (kernel_headers_data_end - 39 kernel_headers_data); 40 return sysfs_create_bin_file(kernel_kobj, &kheaders_attr); 41} 42 43static void __exit ikheaders_cleanup(void) 44{ 45 sysfs_remove_bin_file(kernel_kobj, &kheaders_attr); 46} 47 48module_init(ikheaders_init); 49module_exit(ikheaders_cleanup); 50 51MODULE_LICENSE("GPL v2"); 52MODULE_AUTHOR("Joel Fernandes"); 53MODULE_DESCRIPTION("Echo the kernel header artifacts used to build the kernel");