1 |
#!/bin/bash |
#!/bin/bash |
2 |
# |
# |
3 |
# Minimal Sanitized Headers - Version 00.91 |
# Minimal Sanitized Headers - Version 01.02 |
4 |
# |
# |
5 |
# Submit bugreports via http://headers.cross-lfs.org |
# Submit bugreports via http://headers.cross-lfs.org |
6 |
# |
# |
25 |
# Theo Schneider |
# Theo Schneider |
26 |
# Roberto Nibali |
# Roberto Nibali |
27 |
# |
# |
|
# |
|
|
# As of Version 00.26 we no longer link to glibc headers, we link strictly |
|
|
# use Linux Headers. Glibc, dietlibc, and uclibc use byteswap.h which is |
|
|
# required for various headers. We have elected to link with the existing |
|
|
# ones. |
|
|
# |
|
|
# |
|
28 |
# LFS/CLFS Build notes |
# LFS/CLFS Build notes |
29 |
# |
# |
30 |
# You will also need to copy over asm-generic to ensure you have all the |
# You will also need to copy over asm-generic to ensure you have all the |
31 |
# necessary headers. In LLH they combine these into the asm-architecture |
# necessary headers. In LLH they asm-generic these into the asm-{architecture} |
32 |
# so there is no asm-generic. |
# so there is no asm-generic. |
33 |
# |
# |
34 |
|
# Headers Lists |
35 |
|
# As of version 01.00 we have removed the headers lists from the scripts |
36 |
|
# and put them into separate text files in lists directory. The file format |
37 |
|
# is one header per line. |
38 |
# |
# |
39 |
# Programs Required |
# Programs Required |
40 |
# |
# |
89 |
|
|
90 |
usage() { |
usage() { |
91 |
echo "usage:" |
echo "usage:" |
92 |
echo " $0 kernel_version {optional}" |
echo " $0 version=kernel_version {optional}" |
93 |
echo "example: $0" |
echo "example: $0" |
94 |
echo "" |
echo "" |
95 |
echo "Optional:" |
echo "Optional:" |
96 |
echo " dump - dump headers name then create headers package" |
echo " check - checks to see if the header exists in unsantized headers" |
97 |
echo " dumponly - dump headers name then exit" |
echo " dump - dump headers name then create headers package" |
98 |
echo " file - creates a file list" |
echo " dumponly - dump headers name then exit" |
99 |
|
echo " file - creates a file list" |
100 |
|
echo " patchfile={patch} - utilize this patch" |
101 |
exit 255 |
exit 255 |
102 |
} |
} |
103 |
|
|
134 |
-e 's/\b__user\b//g' \ |
-e 's/\b__user\b//g' \ |
135 |
-e 's/ inline / __inline__ /g' \ |
-e 's/ inline / __inline__ /g' \ |
136 |
-e 's/__kernel_sockaddr_/sockaddr_/g' \ |
-e 's/__kernel_sockaddr_/sockaddr_/g' \ |
137 |
|
-e 's/^#define $//' \ |
138 |
$header > $header.new |
$header > $header.new |
139 |
mv $header.new $header |
mv $header.new $header |
140 |
fi |
fi |
152 |
-e '/#include <asm.hpet.h>/d' \ |
-e '/#include <asm.hpet.h>/d' \ |
153 |
-e '/#include <asm.ide.h>/d' \ |
-e '/#include <asm.ide.h>/d' \ |
154 |
-e '/#include <asm.interrupt.h>/d' \ |
-e '/#include <asm.interrupt.h>/d' \ |
155 |
|
-e '/#include <asm.machtypes.h>/d' \ |
156 |
|
-e '/#include <asm.mach-types.h>/d' \ |
157 |
-e '/#include <asm.machvec_init.h>/d' \ |
-e '/#include <asm.machvec_init.h>/d' \ |
158 |
-e '/#include <asm.mtd-xip.h>/d' \ |
-e '/#include <asm.mtd-xip.h>/d' \ |
159 |
-e '/#include <asm.offset.h>/d' \ |
-e '/#include <asm.offset.h>/d' \ |
164 |
-e '/#include <asm.proc-fns.h>/d' \ |
-e '/#include <asm.proc-fns.h>/d' \ |
165 |
-e '/#include <asm.rwclock.h>/d' \ |
-e '/#include <asm.rwclock.h>/d' \ |
166 |
-e '/#include <asm.sections.h>/d' \ |
-e '/#include <asm.sections.h>/d' \ |
167 |
|
-e '/#include <asm.serial-bigsur.h>/d' \ |
168 |
|
-e '/#include <asm.serial-ec3104.h>/d' \ |
169 |
-e '/#include <asm.spinlock_types.h>/d' \ |
-e '/#include <asm.spinlock_types.h>/d' \ |
170 |
-e '/#include <asm.thread_info.h>/d' \ |
-e '/#include <asm.thread_info.h>/d' \ |
171 |
-e '/#include <asm.uaccess.h>/d' \ |
-e '/#include <asm.uaccess.h>/d' \ |
217 |
-e '/#include <linux.uaccess.h>/d' \ |
-e '/#include <linux.uaccess.h>/d' \ |
218 |
-e '/#include <linux.byteorder.generic.h>/d' \ |
-e '/#include <linux.byteorder.generic.h>/d' \ |
219 |
-e '/endif .* __KERNEL__/d' \ |
-e '/endif .* __KERNEL__/d' \ |
220 |
|
-e 's/|| !defined (__KERNEL__)//g' \ |
221 |
-e 's/|| !defined(__KERNEL__)//g' \ |
-e 's/|| !defined(__KERNEL__)//g' \ |
222 |
-e 's/!defined(__KERNEL__) ..//g' \ |
-e 's/!defined(__KERNEL__) ..//g' \ |
223 |
-e 's/|| defined(__KERNEL__)//g' \ |
-e 's/|| defined(__KERNEL__)//g' \ |
224 |
-e 's/defined(__KERNEL__) ..//g' \ |
-e 's/defined(__KERNEL__) ..//g' \ |
225 |
|
-e 's/|| defined (__KERNEL__)//g' \ |
226 |
-e 's/#ifdef linux/#ifdef __linux__/g' \ |
-e 's/#ifdef linux/#ifdef __linux__/g' \ |
227 |
-e 's/#ifndef linux/#ifndef __linux__/g' \ |
-e 's/#ifndef linux/#ifndef __linux__/g' \ |
|
-e '/#include <asm.machtypes.h>/d' \ |
|
|
-e '/#include <asm.serial-bigsur.h>/d' \ |
|
|
-e '/#include <asm.serial-ec3104.h>/d' \ |
|
228 |
$header > $header.new |
$header > $header.new |
229 |
mv $header.new $header |
mv $header.new $header |
230 |
|
|
250 |
done |
done |
251 |
} |
} |
252 |
|
|
253 |
|
check_headers() { |
254 |
|
for file in $CHECKHEADERS; do |
255 |
|
TEST="`find * -name $file`" |
256 |
|
if [ "$TEST" != "" ]; then |
257 |
|
echo "$file was found" |
258 |
|
else |
259 |
|
echo "$file was not located." >> $CURRENT_DIR/missing_headers |
260 |
|
fi |
261 |
|
done |
262 |
|
} |
263 |
|
check_headers2() { |
264 |
|
for file in $CHECKHEADERS; do |
265 |
|
TEST="`find * -print0 | grep -FzZ $file`" |
266 |
|
if [ "$TEST" != "" ]; then |
267 |
|
echo "$file was found" |
268 |
|
else |
269 |
|
echo "$file was not located." >> $CURRENT_DIR/missing_headers |
270 |
|
fi |
271 |
|
done |
272 |
|
} |
273 |
|
|
274 |
clean_header() { |
clean_header() { |
275 |
header=$1 |
header=$1 |
276 |
sed -e '/^$/N;/\n$/D' \ |
sed -e '/^$/N;/\n$/D' \ |
277 |
|
-e 's@#if defined@#if defined@g' \ |
278 |
|
-e 's@#if !defined@#if !defined@g' \ |
279 |
$header > $header.new |
$header > $header.new |
280 |
mv $header.new $header |
mv $header.new $header |
281 |
} |
} |
448 |
# Input Check |
# Input Check |
449 |
# |
# |
450 |
if [ "$1" = "" ]; then |
if [ "$1" = "" ]; then |
451 |
usage |
usage |
452 |
fi |
fi |
453 |
|
|
|
# Setup Version |
|
|
# |
|
|
VERSION=$1 |
|
|
shift |
|
|
|
|
454 |
while [ $# -gt 0 ]; do |
while [ $# -gt 0 ]; do |
455 |
case $1 in |
case $1 in |
456 |
|
|
457 |
|
check) |
458 |
|
CHECK=yes |
459 |
|
;; |
460 |
|
|
461 |
file) |
file) |
462 |
FILE="yes" |
FILE=yes |
463 |
;; |
;; |
464 |
|
|
465 |
dump) |
dump) |
466 |
DUMP="yes" |
DUMP=yes |
467 |
|
;; |
468 |
|
|
469 |
|
patchfile=*) |
470 |
|
TEMPPATCH=`echo $1 | awk -F= '{print $2;}'` |
471 |
|
if [ "$PATCHES" = "" ]; then |
472 |
|
PATCHES="$TEMPPATCH" |
473 |
|
else |
474 |
|
PATCHES="$PATCHES $TEMPPATCH" |
475 |
|
fi |
476 |
;; |
;; |
477 |
|
|
478 |
dumponly) |
dumponly) |
479 |
DUMP="yes" |
DUMP=yes |
480 |
DUMPONLY="yes" |
DUMPONLY=yes |
481 |
|
;; |
482 |
|
|
483 |
|
version=*) |
484 |
|
VERSION=`echo $1 | awk -F= '{print $2;}'` |
485 |
;; |
;; |
486 |
|
|
487 |
*) |
*) |
493 |
done |
done |
494 |
|
|
495 |
# Checking for all the tools we need |
# Checking for all the tools we need |
496 |
|
TEST=`whereis awk | cut -f2 -d:` |
497 |
|
if [ "$TEST" = "" ]; then |
498 |
|
echo "Missing awk" |
499 |
|
exit 254 |
500 |
|
fi |
501 |
TEST=`whereis cp | cut -f2 -d:` |
TEST=`whereis cp | cut -f2 -d:` |
502 |
if [ "$TEST" = "" ]; then |
if [ "$TEST" = "" ]; then |
503 |
echo "Missing cp." |
echo "Missing cp." |
504 |
exit 254 |
exit 253 |
505 |
fi |
fi |
506 |
TEST=`whereis install | cut -f2 -d:` |
TEST=`whereis install | cut -f2 -d:` |
507 |
if [ "$TEST" = "" ]; then |
if [ "$TEST" = "" ]; then |
508 |
echo "Missing install." |
echo "Missing install." |
509 |
exit 253 |
exit 252 |
510 |
fi |
fi |
511 |
TEST=`whereis mv | cut -f2 -d:` |
TEST=`whereis mv | cut -f2 -d:` |
512 |
if [ "$TEST" = "" ]; then |
if [ "$TEST" = "" ]; then |
513 |
echo "Missing mv." |
echo "Missing mv." |
514 |
exit 252 |
exit 251 |
515 |
fi |
fi |
516 |
TEST=`whereis pwd | cut -f2 -d:` |
TEST=`whereis pwd | cut -f2 -d:` |
517 |
if [ "$TEST" = "" ]; then |
if [ "$TEST" = "" ]; then |
518 |
echo "Missing pwd." |
echo "Missing pwd." |
519 |
exit 251 |
exit 250 |
520 |
fi |
fi |
521 |
TEST=`whereis sed | cut -f2 -d:` |
TEST=`whereis sed | cut -f2 -d:` |
522 |
if [ "$TEST" = "" ]; then |
if [ "$TEST" = "" ]; then |
523 |
echo "Missing sed." |
echo "Missing sed." |
524 |
exit 250 |
exit 249 |
525 |
fi |
fi |
526 |
TEST=`whereis rm | cut -f2 -d:` |
TEST=`whereis rm | cut -f2 -d:` |
527 |
if [ "$TEST" = "" ]; then |
if [ "$TEST" = "" ]; then |
528 |
echo "Missing rm." |
echo "Missing rm." |
529 |
exit 249 |
exit 248 |
530 |
fi |
fi |
531 |
TEST=`whereis rmdir | cut -f2 -d:` |
TEST=`whereis rmdir | cut -f2 -d:` |
532 |
if [ "$TEST" = "" ]; then |
if [ "$TEST" = "" ]; then |
533 |
echo "Missing rmdir." |
echo "Missing rmdir." |
534 |
exit 248 |
exit 247 |
535 |
fi |
fi |
536 |
TEST=`whereis tar | cut -f2 -d:` |
TEST=`whereis tar | cut -f2 -d:` |
537 |
if [ "$TEST" = "" ]; then |
if [ "$TEST" = "" ]; then |
538 |
echo "Missing tar." |
echo "Missing tar." |
539 |
exit 247 |
exit 246 |
540 |
fi |
fi |
541 |
TEST=`whereis unifdef | cut -f2 -d:` |
TEST=`whereis unifdef | cut -f2 -d:` |
542 |
if [ "$TEST" = "" ]; then |
if [ "$TEST" = "" ]; then |
543 |
echo "Missing unifdef." |
echo "Missing unifdef." |
544 |
exit 246 |
exit 245 |
545 |
fi |
fi |
546 |
TEST=`whereis wget | cut -f2 -d:` |
TEST=`whereis wget | cut -f2 -d:` |
547 |
if [ "$TEST" = "" ]; then |
if [ "$TEST" = "" ]; then |
548 |
echo "Missing wget." |
echo "Missing wget." |
549 |
exit 245 |
exit 244 |
550 |
fi |
fi |
551 |
|
|
552 |
# Set Linux Version |
# Set Linux Version |
557 |
|
|
558 |
# Our Working Directories |
# Our Working Directories |
559 |
CURRENT_DIR=`pwd -P` |
CURRENT_DIR=`pwd -P` |
560 |
ORIGDIR="$CURRENT_DIR/linux-headers-$VERSION.orig/include" |
ORIGDIR=$CURRENT_DIR/linux-headers-$VERSION.orig/include |
561 |
NEWDIR="$CURRENT_DIR/linux-headers-$VERSION/include" |
NEWDIR=$CURRENT_DIR/linux-headers-$VERSION/include |
562 |
|
|
563 |
# Headers to Sanitize |
# Headers to Sanitize |
564 |
ASM_HEADERS="8253pit.h addrs.h addrspace.h alternative.h anna.h a.out.h apicdef.h apic.h arch.h as85ep1.h asi.h asm-compat.h |
ASM_HEADERS=$(cat $CURRENT_DIR/lists/asm-headers) |
565 |
asm.h asmmacro-32.h asmmacro-64.h asmmacro.h assembler.h atomic.h auxvec.h barrier.h bitops.h bootparam.h |
ASM_ARCH_HEADERS=$(cat $CURRENT_DIR/lists/asm-arch-headers) |
566 |
break.h btfixup.h byteorder.h cachectl.h cacheflush.h cache.h checksum.h clinkage.h clps7111.h compat.h |
ASM_SYS_HEADERS=$(cat $CURRENT_DIR/lists/asm-sys-headers) |
567 |
console.h constants.h const.h contregs.h coprocessor.h core.h cpudata.h cpufeature.h cpu-features.h cpu.h |
|
568 |
cputable.h cputime.h cs89712.h current.h ddb5477.h dec21285.h delay.h desc.h div64.h domain.h ec3104.h eeh.h |
LINUX_HEADERS=$(cat $CURRENT_DIR/lists/linux-headers) |
569 |
elf.h entry.h ep7211.h ep7212.h errno-base.h errno.h ev96100.h ev96100int.h fcntl.h fixmap.h fls64.h |
|
570 |
fpga85e2c.h fpregdef.h fpu.h gentrap.h gic.h gio_defs.h glue.h gpio.h hal.h hardirq.h hardware.h hd64465.h |
NOSANTIZE_ASM_HEADERS=$(cat $CURRENT_DIR/lists/no_santize-asm-headers) |
571 |
head.h hubio.h hw_irq.h hwrpb.h hypervisor.h ia64regs.h imx-regs.h intrinsics.h io_apic.h ioctl.h ioctls.h |
NOSANTIZE_LINUX_HEADERS=$(cat $CURRENT_DIR/lists/no_santize-linux-headers) |
572 |
io_generic.h iomap.h iomd.h irc-regs.h irq.h irqs.h irq-sh73180.h irq-sh7780.h isadep.h iseries_io.h |
|
573 |
it8172.h it8172_int.h it8712.h ixp2000-regs.h jazz.h kbio.h kldir.h kmap_types.h kregs.h lasat.h ldt.h |
BLANK_HEADERS=$(cat $CURRENT_DIR/lists/blank-headers) |
574 |
leds.h linkage.h local.h locks.h lowcore.h m32102.h m32104ut_pld.h m32700ut_lan.h m32700ut_lcd.h |
|
575 |
m32700ut_pld.h m32r.h m32r_mp_fpga.h ma1.h machdep.h mach-types.h machvec.h macrology.h ma.h map.h |
ROOT_HEADERS=$(cat $CURRENT_DIR/lists/root-headers) |
576 |
mappi2_pld.h mappi3_pld.h math_emu.h me2.h mem-layout.h memory.h mips_mt.h mipsmtregs.h mipsregs.h mman.h |
SYS_HEADERS=$(cat $CURRENT_DIR/lists/sys-headers) |
|
mmsegment.h mmu_context.h mmu.h module.h motorola_pgalloc.h motorola_pgtable.h movs.h mpspec_def.h mpspec.h |
|
|
msr.h mtrr.h nodedata.h node.h numa.h nvram.h openprom.h openpromio.h oplib.h opsput_lan.h opsput_lcd.h |
|
|
opsput_pld.h pal.h param.h pda.h pdc.h pgalloc.h pgtable-2level.h pgtable-32.h pgtable-64.h pgtable-bits.h |
|
|
pgtable.h pgtable-hwdef.h pgtsrmmu.h pgtsun4c.h pgtsun4.h pil.h platform.h poll.h posix_types.h prctl.h |
|
|
processor.h procinfo.h psr.h pstate.h psw.h ptrace.h regdef.h reg.h registers.h reg_map.h reg_rdwr.h |
|
|
regs267x.h regs306x.h regs-clock.h regs-watchdog.h rs485.h rse.h rte_cb.h rte_ma1_cb.h rte_me2_cb.h |
|
|
rte_nb85e_cb.h rwlock.h scatterlist.h scratchpad.h segment.h semaphore.h sembuf.h serial.h serial-regs.h |
|
|
setup.h sgidefs.h shmbuf.h shmparam.h shub_mmr.h sigcontext.h siginfo.h signal.h sigp.h sim85e2c.h |
|
|
sim85e2.h sim85e2s.h sim.h sizes.h smp.h smtc.h sn_cpuid.h socket.h sockios.h spinlock.h spitfire.h |
|
|
spr-regs.h starfire.h stat.h string.h sun3-head.h sun3mmu.h sun3_pgalloc.h sun3_pgtable.h sv_addr_ag.h |
|
|
svinto.h synch.h sysasic.h syscall.h sysen.h sysirq.h system.h teg.h termbits.h termios.h timer-regs.h |
|
|
timex.h tlbflush.h tlb.h traps.h tsc.h types.h ubc.h unaligned.h unistd.h unwind.h upa.h user.h |
|
|
ustack.h v850e2_cache.h v850e2.h v850e_cache.h v850e.h v850e_intc.h vac-ops.h vaddrs.h visasm.h |
|
|
vm86.h vsyscall32.h vsyscall.h war.h wbflush.h" |
|
|
ASM_ARCH_HEADERS="asm-alpha/pci.h asm-alpha/console.h asm-alpha/hwrpb.h asm-mips/vr41xx/pci.h asm-mips/sysmips.h" |
|
|
ASM_SYS_HEADERS="io.h" |
|
|
LINUX_HEADERS="adb.h adfs_fs.h adfs_fs_i.h adfs_fs_sb.h affs_fs.h agpgart.h a.out.h apm_bios.h atalk.h atmapi.h |
|
|
atmarp.h atmclip.h atmdev.h atm_eni.h atm.h atm_idt77105.h atmioc.h atmlec.h atmmpc.h atm_nicstar.h |
|
|
atmppp.h atmsap.h atmsvc.h atm_tcp.h atm_zatm.h auto_fs4.h auto_fs.h auxvec.h backing-dev.h bfs_fs.h |
|
|
binfmts.h bitops.h blkpg.h blockgroup_lock.h cache.h calc64.h capability.h capi.h cdrom.h coda_fs_i.h |
|
|
coff.h compat.h cpu.h cramfs_fs.h cramfs_fs_sb.h crypto.h dcache.h dccp.h delay.h device.h devpts_fs.h |
|
|
dirent.h dm-ioctl.h dn.h dnotify.h dqblk_xfs.h efs_dir.h efs_fs.h efs_fs_i.h efs_fs_sb.h elf.h errno.h |
|
|
errqueue.h ethtool.h ext2_fs.h ext2_fs_sb.h ext3_fs.h ext3_fs_i.h ext3_fs_sb.h fb.h fcntl.h fd.h fdreg.h |
|
|
filter.h fs.h fs_struct.h fuse.h futex.h gameport.h gen_stats.h gfp.h hayesesp.h hdreg.h hiddev.h |
|
|
highmem.h hpfs_fs.h hrtimer.h icmp.h icmpv6.h idr.h if_arcnet.h if_arp.h if_bonding.h if_bridge.h |
|
|
if_cablemodem.h if_ec.h if_eql.h if_ether.h if_fc.h if_fddi.h if_frad.h if.h if_hippi.h if_infiniband.h |
|
|
if_ltalk.h if_packet.h if_plip.h if_ppp.h if_pppox.h if_shaper.h if_slip.h if_strip.h if_tr.h if_tun.h |
|
|
if_tunnel.h if_vlan.h if_wanpipe_common.h if_wanpipe.h in6.h inet_diag.h in.h init.h inotify.h input.h |
|
|
in_route.h interrupt.h ioctl.h ioport.h ip6_tunnel.h ipc.h ip.h ip_mp_alg.h ipsec.h ipv6.h ipv6_route.h |
|
|
ipx.h irda.h irq_cpustat.h irqflags.h irq.h irqreturn.h isdn.h iso_fs.h jffs2_fs_i.h jffs2_fs_sb.h |
|
|
jffs2.h jiffies.h joystick.h kdev_t.h kd.h kernelcapi.h kernel.h kernel_stat.h keyboard.h klist.h |
|
|
kmod.h ktime.h lapb.h limits.h linkage.h list.h llc.h loop.h lp.h major.h mempool.h mii.h minix_fs.h |
|
|
mm.h mod_devicetable.h module.h moduleparam.h mount.h msdos_fs.h msg.h ncp_fs_i.h ncp_fs_sb.h ncp.h |
|
|
ncp_mount.h ncp_no.h netdevice.h netfilter_arp.h netfilter_bridge.h netfilter_decnet.h netfilter.h |
|
|
netfilter_ipv4.h netfilter_ipv6.h net.h netlink.h netrom.h nfs2.h nfs4.h nfsacl.h nfs_fs.h nfs_fs_i.h |
|
|
nfs_fs_sb.h nfs.h nfs_xdr.h notifier.h numa.h openprom_fs.h page-flags.h param.h parport.h patchkey.h |
|
|
pcieport_if.h pci.h pci_ids.h pci_regs.h percpu_counter.h personality.h pfkeyv2.h pfn.h phy.h pid.h |
|
|
pipe_fs_i.h pkt_cls.h pkt_sched.h pm.h pmu.h poll.h posix_acl.h posix_types.h ppdev.h ppp-comp.h |
|
|
ppp_defs.h prctl.h preempt.h proc_fs.h profile.h ptrace.h qnx4_fs.h qnxtypes.h quota.h random.h raw.h |
|
|
rbtree.h reboot.h reiserfs_fs.h reiserfs_fs_i.h reiserfs_fs_sb.h romfs_fs.h rose.h route.h rtc.h |
|
|
rtnetlink.h sched.h sctp.h seccomp.h securebits.h security.h sem.h seqlock.h serial.h serial_reg.h |
|
|
shmem_fs.h shm.h skbuff.h slab.h smb_fs.h smb_fs_i.h smb_fs_sb.h smb.h smb_mount.h smbno.h smp_lock.h |
|
|
snmp.h sockios.h sonet.h soundcard.h statfs.h stddef.h stringify.h swap.h syscalls.h sysctl.h sysdev.h |
|
|
sysv_fs.h tcp.h termios.h threads.h timex.h tiocl.h tty.h udf_fs.h udf_fs_i.h udf_fs_sb.h udp.h ufs_fs.h |
|
|
ufs_fs_i.h ufs_fs_sb.h ultrasound.h unistd.h usbdevice_fs.h usb.h user.h utsname.h vfs.h videodev2.h |
|
|
videodev.h vmalloc.h vt.h wireless.h workqueue.h x25.h xdr.h xfrm.h" |
|
|
|
|
|
NOSANTIZE_ASM_HEADERS="types.h" |
|
|
NOSANTIZE_LINUX_HEADERS="nfs3.h types.h byteorder/big_endian.h byteorder/little_endian.h" |
|
|
|
|
|
BLANK_HEADERS="asm-sparc64/psr.h linux/autoconf.h linux/agp_backend.h linux/compiler.h linux/config.h linux/list.h |
|
|
linux/mmzone.h linux/pagemap.h linux/percpu.h linux/syscalls.h linux/uio.h linux/utime.h" |
|
|
ROOT_HEADERS="linux/elf.h linux/signal.h linux/string.h" |
|
|
SYS_HEADERS="linux/acct.h linux/resource.h linux/socket.h linux/stat.h linux/un.h linux/wait.h" |
|
577 |
|
|
578 |
REMOVE_HEADERS="asm-generic/page.h asm-mips/fpu.h net/raw.h net/rawv6.h asm-cris/arch-v10/atomic.h |
GLIBC_HEADERS=$(cat $CURRENT_DIR/lists/glibc-headers) |
579 |
asm-cris/arch-v32/atomic.h" |
|
580 |
|
COPY_HEADERS=$(cat $CURRENT_DIR/lists/copy-headers) |
581 |
|
|
582 |
|
REMOVE_HEADERS=$(cat $CURRENT_DIR/lists/remove-headers) |
583 |
|
|
584 |
if [ "$FILE" = "yes" ]; then |
if [ "$FILE" = "yes" ]; then |
585 |
echo "Files List to $CURRENT_DIR/asm-list..." |
echo "Files List to $CURRENT_DIR/asm-list..." |
641 |
|
|
642 |
echo "Decompressing Kernel Headers only..." |
echo "Decompressing Kernel Headers only..." |
643 |
rm -rf linux-$VERSION linux-headers-$VERSION linux-headers-$VERSION.orig |
rm -rf linux-$VERSION linux-headers-$VERSION linux-headers-$VERSION.orig |
644 |
tar jxf linux-$VERSION.tar.bz2 linux-$VERSION/include/* |
tar --wildcards -jxf linux-$VERSION.tar.bz2 linux-$VERSION/include/* |
645 |
|
if [ -e $CURRENT_DIR/patches/linux-$VERSION-REQUIRED-1.patch ]; then |
646 |
|
if [ "$PATCHES" = "" ]; then |
647 |
|
PATCHES="linux-$VERSION-REQUIRED-1.patch" |
648 |
|
else |
649 |
|
PATCHES="$PATCHES linux-$VERSION-REQUIRED-1.patch" |
650 |
|
fi |
651 |
|
fi |
652 |
|
if [ -e $CURRENT_DIR/patches/linux-$VERSION-mips_headers-1.patch ]; then |
653 |
|
if [ "$PATCHES" = "" ]; then |
654 |
|
PATCHES="linux-$VERSION-mips_headers-1.patch" |
655 |
|
else |
656 |
|
PATCHES="$PATCHES linux-$VERSION-mips_headers-1.patch" |
657 |
|
fi |
658 |
|
fi |
659 |
|
for PATCHFILE in $PATCHES; do |
660 |
|
if [ -e "$CURRENT_DIR/patches/$PATCHFILE" ]; then |
661 |
|
cd linux-$VERSION |
662 |
|
echo "Patching Kernel Headers with $PATCHFILE..." |
663 |
|
patch -Np1 -f -s -i $CURRENT_DIR/patches/$PATCHFILE |
664 |
|
cd .. |
665 |
|
fi |
666 |
|
done |
667 |
|
|
668 |
|
if [ "$CHECK" = "yes" ]; then |
669 |
|
cd linux-headers-$VERSION |
670 |
|
rm -f $CURRENT_DIR/missing_headers |
671 |
|
echo "Checking ASM..." |
672 |
|
CHECKHEADERS="$ASM_HEADERS $NOSANTIZE_ASM_HEADERS" |
673 |
|
check_headers |
674 |
|
CHECKHEADERS="$ASM_ARCH_HEADERS $NOSANTIZE_ASM_HEADERS" |
675 |
|
check_headers2 |
676 |
|
echo "Checking Linux..." |
677 |
|
CHECKHEADERS="$LINUX_HEADERS" |
678 |
|
check_headers |
679 |
|
CHECKHEADERS="$NOSANTIZE_LINUX_HEADERS" |
680 |
|
check_headers2 |
681 |
|
echo "Report is located at $CURRENT_DIR/missing_headers." |
682 |
|
rm -rf linux-headers-$VERSION |
683 |
|
cd $CURRENT_DIR |
684 |
|
exit 0 |
685 |
|
fi |
686 |
|
|
687 |
echo "Renaming directory to linux-headers-$VERSION..." |
echo "Renaming directory to linux-headers-$VERSION..." |
688 |
mv linux-$VERSION linux-headers-$VERSION.orig |
mv linux-$VERSION linux-headers-$VERSION.orig |
696 |
install -d $NEWDIR/$dir |
install -d $NEWDIR/$dir |
697 |
done |
done |
698 |
|
|
699 |
DONT_CHANGE="no" |
DONT_CHANGE=no |
700 |
TYPE="asm" |
TYPE=asm |
701 |
HEADERS="$ASM_HEADERS" |
HEADERS="$ASM_HEADERS" |
702 |
if [ "$HEADERS" != "" ]; then |
if [ "$HEADERS" != "" ]; then |
703 |
make_headers |
make_headers |
704 |
fi |
fi |
705 |
|
|
706 |
TYPE="asm" |
TYPE=asm |
707 |
HEADERS="$ASM_ARCH_HEADERS" |
HEADERS=$ASM_ARCH_HEADERS |
708 |
if [ "$HEADERS" != "" ]; then |
if [ "$HEADERS" != "" ]; then |
709 |
make_headers |
make_headers |
710 |
fi |
fi |
711 |
|
|
712 |
TYPE="linux" |
TYPE=linux |
713 |
HEADERS="$LINUX_HEADERS" |
HEADERS=$LINUX_HEADERS |
714 |
if [ "$HEADERS" != "" ]; then |
if [ "$HEADERS" != "" ]; then |
715 |
make_headers |
make_headers |
716 |
fi |
fi |
718 |
SETTYPE="byteorder dvb isdn lockd mtd netfilter netfilter_arp netfilter_bridge netfilter_ipv4 netfilter_ipv6 |
SETTYPE="byteorder dvb isdn lockd mtd netfilter netfilter_arp netfilter_bridge netfilter_ipv4 netfilter_ipv6 |
719 |
nfsd raid sunrpc tc_act tc_ematch" |
nfsd raid sunrpc tc_act tc_ematch" |
720 |
for type in $SETTYPE; do |
for type in $SETTYPE; do |
721 |
TYPE="linux" |
TYPE=linux |
722 |
cd $ORIGDIR/linux |
cd $ORIGDIR/linux |
723 |
if [ -e $ORIGDIR/linux/$type ]; then |
if [ -e $ORIGDIR/linux/$type ]; then |
724 |
HEADERS=`find $type | grep .h | sed -e '/big_endian.h/d' | sed -e '/little_endian.h/d' | sort -u ` |
HEADERS=`find $type | grep .h | sed -e '/big_endian.h/d' | sed -e '/little_endian.h/d' | sort -u ` |
728 |
fi |
fi |
729 |
done |
done |
730 |
|
|
731 |
SETTYPE="mtd scsi sound" |
SETTYPE="acpi mtd scsi sound" |
732 |
for type in $SETTYPE; do |
for type in $SETTYPE; do |
733 |
TYPE="$type" |
TYPE="$type" |
734 |
cd $ORIGDIR |
cd $ORIGDIR |
740 |
fi |
fi |
741 |
done |
done |
742 |
|
|
743 |
DONT_CHANGE="yes" |
DONT_CHANGE=yes |
744 |
TYPE="linux" |
TYPE=linux |
745 |
HEADERS="$NOSANTIZE_LINUX_HEADERS" |
HEADERS=$NOSANTIZE_LINUX_HEADERS |
746 |
if [ "$HEADERS" != "" ]; then |
if [ "$HEADERS" != "" ]; then |
747 |
make_headers |
make_headers |
748 |
fi |
fi |
749 |
|
|
750 |
TYPE="asm" |
TYPE=asm |
751 |
HEADERS="$NOSANTIZE_ASM_HEADERS" |
HEADERS=$NOSANTIZE_ASM_HEADERS |
752 |
if [ "$HEADERS" != "" ]; then |
if [ "$HEADERS" != "" ]; then |
753 |
make_headers |
make_headers |
754 |
fi |
fi |
859 |
cp $ORIGDIR/asm-ia64/page.h $NEWDIR/asm-ia64/page.h |
cp $ORIGDIR/asm-ia64/page.h $NEWDIR/asm-ia64/page.h |
860 |
PAGE_H=$NEWDIR/asm-ia64/page.h |
PAGE_H=$NEWDIR/asm-ia64/page.h |
861 |
echo "Processing include/asm-ia64/page.h..." |
echo "Processing include/asm-ia64/page.h..." |
862 |
unifdef -UCONFIG_IA64_PAGE_SIZE_4KB -UCONFIG_IA64_PAGE_SIZE_8KB \ |
unifdef -e -UCONFIG_IA64_PAGE_SIZE_4KB -UCONFIG_IA64_PAGE_SIZE_8KB \ |
863 |
-UCONFIG_IA64_PAGE_SIZE_16KB -UCONFIG_IA64_PAGE_SIZE_64KB $PAGE_H > $PAGE_H.new |
-UCONFIG_IA64_PAGE_SIZE_16KB -UCONFIG_IA64_PAGE_SIZE_64KB $PAGE_H > $PAGE_H.new |
864 |
cp $PAGE_H.new $PAGE_H |
cp $PAGE_H.new $PAGE_H |
865 |
sed -e 's/# error Unsupported page size./#define PAGE_SIZE\tsysconf (_SC_PAGE_SIZE)\nNeXtLiNe/' $PAGE_H > $PAGE_H.new |
sed -e 's/# error Unsupported page size./#define PAGE_SIZE\tsysconf (_SC_PAGE_SIZE)\nNeXtLiNe/' $PAGE_H > $PAGE_H.new |
1271 |
cp $SWAB_H.new $SWAB_H |
cp $SWAB_H.new $SWAB_H |
1272 |
sed -e 's/provide defaults when no architecture-specific optimization is detected/definitions that are not in glibc but required/g' $SWAB_H > $SWAB_H.new |
sed -e 's/provide defaults when no architecture-specific optimization is detected/definitions that are not in glibc but required/g' $SWAB_H > $SWAB_H.new |
1273 |
mv $SWAB_H.new $SWAB_H |
mv $SWAB_H.new $SWAB_H |
1274 |
echo "" >> $SWAB_H |
if [ "$LINUXCODE" -gt "132625" ]; then |
1275 |
echo "#define ___constant_swab16(x) __bswap_constant_16(x)" >> $SWAB_H |
echo "" >> $SWAB_H |
1276 |
echo "#define ___constant_swab32(x) __bswap_constant_32(x)" >> $SWAB_H |
echo "#define ___constant_swab16(x) __bswap_constant_16(x)" >> $SWAB_H |
1277 |
echo "#define ___constant_swab64(x) __bswap_constant_64(x)" >> $SWAB_H |
echo "#define ___constant_swab32(x) __bswap_constant_32(x)" >> $SWAB_H |
1278 |
echo "" >> $SWAB_H |
echo "#define ___constant_swab64(x) __bswap_constant_64(x)" >> $SWAB_H |
1279 |
echo "#define __swab16(x) bswap_16(x)" >> $SWAB_H |
echo "" >> $SWAB_H |
1280 |
echo "#define __swab32(x) bswap_32(x)" >> $SWAB_H |
echo "#define __swab16(x) bswap_16(x)" >> $SWAB_H |
1281 |
echo "#define __swab64(x) bswap_64(x)" >> $SWAB_H |
echo "#define __swab32(x) bswap_32(x)" >> $SWAB_H |
1282 |
echo "" >> $SWAB_H |
echo "#define __swab64(x) bswap_64(x)" >> $SWAB_H |
1283 |
echo "#define __swab16p(x) __swab16(*(x))" >> $SWAB_H |
echo "" >> $SWAB_H |
1284 |
echo "#define __swab32p(x) __swab32(*(x))" >> $SWAB_H |
echo "#define __swab16p(x) __swab16(*(x))" >> $SWAB_H |
1285 |
echo "#define __swab64p(x) __swab64(*(x))" >> $SWAB_H |
echo "#define __swab32p(x) __swab32(*(x))" >> $SWAB_H |
1286 |
echo "" >> $SWAB_H |
echo "#define __swab64p(x) __swab64(*(x))" >> $SWAB_H |
1287 |
echo "#define __swab16s(x) do { *(x) = __swab16p((x)); } while (0)" >> $SWAB_H |
echo "" >> $SWAB_H |
1288 |
echo "#define __swab32s(x) do { *(x) = __swab32p((x)); } while (0)" >> $SWAB_H |
echo "#define __swab16s(x) do { *(x) = __swab16p((x)); } while (0)" >> $SWAB_H |
1289 |
echo "#define __swab64s(x) do { *(x) = __swab64p((x)); } while (0)" >> $SWAB_H |
echo "#define __swab32s(x) do { *(x) = __swab32p((x)); } while (0)" >> $SWAB_H |
1290 |
echo "" >> $SWAB_H |
echo "#define __swab64s(x) do { *(x) = __swab64p((x)); } while (0)" >> $SWAB_H |
1291 |
|
echo "" >> $SWAB_H |
1292 |
|
fi |
1293 |
echo "#endif /* _LINUX_BYTEORDER_SWAB_H */" >> $SWAB_H |
echo "#endif /* _LINUX_BYTEORDER_SWAB_H */" >> $SWAB_H |
1294 |
clean_header $SWAB_H |
clean_header $SWAB_H |
1295 |
|
|
1310 |
echo "Fixing include/linux/types.h..." |
echo "Fixing include/linux/types.h..." |
1311 |
sed -e 's@#include <linux/posix_types.h>@#include <sys/types.h>\n#include <linux/posix_types.h>@' $TYPES_H > $TYPES_H.new |
sed -e 's@#include <linux/posix_types.h>@#include <sys/types.h>\n#include <linux/posix_types.h>@' $TYPES_H > $TYPES_H.new |
1312 |
cp $TYPES_H.new $TYPES_H |
cp $TYPES_H.new $TYPES_H |
1313 |
if [ "$LINUXVERSION" = "2.6" ]; then |
sed -e 's@typedef __u32 __kernel_dev_t;@typedef __u32 __kernel_dev_t;\n\n#if defined(WANT_KERNEL_TYPES) || !defined(__GLIBC__)@' $TYPES_H > $TYPES_H.new |
1314 |
sed -e 's@typedef __u32 __kernel_dev_t;@typedef __u32 __kernel_dev_t;\n\n#if defined(WANT_KERNEL_TYPES) || !defined(__GLIBC__)@' $TYPES_H > $TYPES_H.new |
cp $TYPES_H.new $TYPES_H |
1315 |
cp $TYPES_H.new $TYPES_H |
sed -e 's@#endif /. __KERNEL_STRICT_NAMES ./@\n#endif\n#endif\n\n@' $TYPES_H > $TYPES_H.new |
1316 |
sed -e 's@#endif /. __KERNEL_STRICT_NAMES ./@\n#endif\n#endif\n\n@' $TYPES_H > $TYPES_H.new |
cp $TYPES_H.new $TYPES_H |
|
cp $TYPES_H.new $TYPES_H |
|
|
fi |
|
1317 |
clean_header $TYPES_H |
clean_header $TYPES_H |
1318 |
|
|
1319 |
|
for files in $COPY_HEADERS; do |
1320 |
|
echo "$files" | { |
1321 |
|
IFS=':' read sfile dfile |
1322 |
|
echo "Copying $sfile to $dfile..." |
1323 |
|
cp $NEWDIR/$sfile $NEWDIR/$dfile |
1324 |
|
} |
1325 |
|
done |
1326 |
|
|
1327 |
for file in $REMOVE_HEADERS; do |
for file in $REMOVE_HEADERS; do |
1328 |
echo "Removing unused header $file..." |
echo "Removing unused header $file..." |
1329 |
rm -f $NEWDIR/$file |
rm -f $NEWDIR/$file |
1330 |
done |
done |
1331 |
|
|
1332 |
|
echo "Removing Headers that are replaced by glibc headers..." |
1333 |
|
for file in $GLIBC_HEADERS; do |
1334 |
|
rm $NEWDIR/$file |
1335 |
|
done |
1336 |
|
|
1337 |
if [ "$LINUXCODE" -gt "132625" ]; then |
if [ "$LINUXCODE" -gt "132625" ]; then |
1338 |
HEADER_FILE="videodev.h" |
HEADER_FILE="videodev.h" |
1339 |
HEADER_NAME="__LINUX_VIDEODEV_H" |
HEADER_NAME="__LINUX_VIDEODEV_H" |
1340 |
HEADER_UPDATE="#include <linux/types.h>" |
HEADER_UPDATE="#include <linux/types.h>" |
1341 |
change_header |
change_header |
1342 |
|
VIDEODEV_H=$NEWDIR/linux/videodev.h |
1343 |
|
sed -e '/CONFIG_VIDEO_V4L1_COMPAT/d' $VIDEODEV_H > $VIDEODEV_H.new |
1344 |
|
cp $VIDEODEV_H.new $VIDEODEV_H |
1345 |
|
clean_header $VIDEODEV_H |
1346 |
fi |
fi |
1347 |
|
|
1348 |
echo "Removing any Kbuild files..." |
echo "Removing any Kbuild files..." |
1380 |
creation="$CURRENT_DIR/linux-headers-$VERSION/creation" |
creation="$CURRENT_DIR/linux-headers-$VERSION/creation" |
1381 |
echo "Processed $count headers on `date +%m-%d-%Y` at `date +%r`" > $creation |
echo "Processed $count headers on `date +%m-%d-%Y` at `date +%r`" > $creation |
1382 |
echo "based on $VERSION kernel." >> $creation |
echo "based on $VERSION kernel." >> $creation |
1383 |
|
if [ -e "$CURRENT_DIR/patches/$PATCHFILE" ]; then |
1384 |
|
echo "Utilized patch - $PATCHFILE" >> $creation |
1385 |
|
fi |
1386 |
|
|
1387 |
bugreport="$CURRENT_DIR/linux-headers-$VERSION/bug-report" |
bugreport="$CURRENT_DIR/linux-headers-$VERSION/bug-report" |
1388 |
echo "Report bugs at http://headers.cross-lfs.org" > $bugreport |
echo "Report bugs at http://headers.cross-lfs.org" > $bugreport |
1401 |
|
|
1402 |
install -d $CURRENT_DIR/linux-headers-$VERSION/script |
install -d $CURRENT_DIR/linux-headers-$VERSION/script |
1403 |
cp $0 $CURRENT_DIR/linux-headers-$VERSION/script |
cp $0 $CURRENT_DIR/linux-headers-$VERSION/script |
1404 |
|
install -d $CURRENT_DIR/linux-headers-$VERSION/lists |
1405 |
|
cp $CURRENT_DIR/lists/* $CURRENT_DIR/linux-headers-$VERSION/lists |
1406 |
|
install -d $CURRENT_DIR/linux-headers-$VERSION/script/patches |
1407 |
|
if [ -e $CURRENT_DIR/patches/linux-$VERSION-REQUIRED-1.patch ]; then |
1408 |
|
cp $CURRENT_DIR/patches/linux-$VERSION-REQUIRED-1.patch $CURRENT_DIR/linux-headers-$VERSION/script/patches/linux-$VERSION-REQUIRED-1.patch |
1409 |
|
fi |
1410 |
|
if [ -e $CURRENT_DIR/patches/linux-$VERSION-mips_headers-1.patch ]; then |
1411 |
|
cp $CURRENT_DIR/patches/linux-$VERSION-mips_headers-1.patch $CURRENT_DIR/linux-headers-$VERSION/script/patches/linux-$VERSION-mips_headers-1.patch |
1412 |
|
fi |
1413 |
|
for PATCHFILE in $PATCHES; do |
1414 |
|
if [ -e "$CURRENT_DIR/patches/$PATCHFILE" ]; then |
1415 |
|
cp $CURRENT_DIR/patches/$PATCHFILE $CURRENT_DIR/linux-headers-$VERSION/script/patches/$PATCHFILE |
1416 |
|
fi |
1417 |
|
done |
1418 |
|
|
1419 |
cp license $CURRENT_DIR/linux-headers-$VERSION/license |
cp license $CURRENT_DIR/linux-headers-$VERSION/license |
1420 |
|
|