Magellan Linux

Diff of /trunk/linux-libc-headers/headers.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 434 by niro, Mon Oct 2 10:17:08 2006 UTC revision 435 by niro, Fri Mar 16 00:06:55 2007 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2  #  #
3  # Minimal Sanitized Headers - Version 00.91  # Minimal Sanitized Headers - Version 01.00
4  #  #
5  # Submit bugreports via http://headers.cross-lfs.org  # Submit bugreports via http://headers.cross-lfs.org
6  #  #
# Line 25  Line 25 
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  #  #
# Line 92  Line 89 
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    
# Line 135  make_headers() { Line 134  make_headers() {
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
# Line 213  make_headers() { Line 213  make_headers() {
213      -e '/#include <linux.uaccess.h>/d' \      -e '/#include <linux.uaccess.h>/d' \
214      -e '/#include <linux.byteorder.generic.h>/d' \      -e '/#include <linux.byteorder.generic.h>/d' \
215      -e '/endif .* __KERNEL__/d' \      -e '/endif .* __KERNEL__/d' \
216        -e 's/|| !defined (__KERNEL__)//g' \
217      -e 's/|| !defined(__KERNEL__)//g' \      -e 's/|| !defined(__KERNEL__)//g' \
218      -e 's/!defined(__KERNEL__) ..//g' \      -e 's/!defined(__KERNEL__) ..//g' \
219      -e 's/|| defined(__KERNEL__)//g' \      -e 's/|| defined(__KERNEL__)//g' \
220      -e 's/defined(__KERNEL__) ..//g' \      -e 's/defined(__KERNEL__) ..//g' \
221        -e 's/|| defined (__KERNEL__)//g' \
222      -e 's/#ifdef linux/#ifdef __linux__/g' \      -e 's/#ifdef linux/#ifdef __linux__/g' \
223      -e 's/#ifndef linux/#ifndef __linux__/g' \      -e 's/#ifndef linux/#ifndef __linux__/g' \
224      -e '/#include <asm.machtypes.h>/d' \      -e '/#include <asm.machtypes.h>/d' \
# Line 247  make_headers() { Line 249  make_headers() {
249   done   done
250  }  }
251    
252    check_headers() {
253     for file in $CHECKHEADERS; do
254     TEST="`find * -name $file`"
255     if [ "$TEST" != "" ]; then
256     echo "$file was found"
257     else
258     echo "$file was not located." >> $CURRENT_DIR/missing_headers
259     fi
260     done
261    }
262    check_headers2() {
263     for file in $CHECKHEADERS; do
264     TEST="`find * -print0  | grep -FzZ $file`"
265     if [ "$TEST" != "" ]; then
266     echo "$file was found"
267     else
268     echo "$file was not located." >> $CURRENT_DIR/missing_headers
269     fi
270     done
271    }
272    
273  clean_header() {  clean_header() {
274   header=$1   header=$1
275   sed -e '/^$/N;/\n$/D' \   sed -e '/^$/N;/\n$/D' \
276        -e 's@#if  defined@#if defined@g' \
277        -e 's@#if  !defined@#if !defined@g' \
278         $header > $header.new         $header > $header.new
279   mv $header.new $header   mv $header.new $header
280  }  }
# Line 422  change_header() { Line 447  change_header() {
447  # Input Check  # Input Check
448  #  #
449  if [ "$1" = "" ]; then  if [ "$1" = "" ]; then
450   usage          usage
451  fi  fi
452    
 # Setup Version  
 #  
 VERSION=$1  
 shift  
   
453  while [ $# -gt 0 ]; do  while [ $# -gt 0 ]; do
454   case $1 in   case $1 in
455    
456     check)
457     CHECK=yes
458     ;;
459    
460   file)   file)
461   FILE="yes"   FILE=yes
462   ;;   ;;
463    
464   dump)   dump)
465   DUMP="yes"   DUMP=yes
466     ;;
467    
468     patchfile=*)
469     TEMPPATCH=`echo $1 | awk -F= '{print $2;}'`
470     if [ "$PATCHES" = "" ]; then
471     PATCHES="$TEMPPATCH"
472     else
473     PATCHES="$PATCHES $TEMPPATCH"
474     fi
475   ;;   ;;
476    
477   dumponly)   dumponly)
478   DUMP="yes"   DUMP=yes
479   DUMPONLY="yes"   DUMPONLY=yes
480     ;;
481    
482     version=*)
483     VERSION=`echo $1 | awk -F= '{print $2;}'`
484   ;;   ;;
485    
486   *)   *)
# Line 455  while [ $# -gt 0 ]; do Line 492  while [ $# -gt 0 ]; do
492  done  done
493    
494  # Checking for all the tools we need  # Checking for all the tools we need
495    TEST=`whereis awk | cut -f2 -d:`
496    if [ "$TEST" = "" ]; then
497     echo "Missing awk"
498     exit 254
499    fi
500  TEST=`whereis cp | cut -f2 -d:`  TEST=`whereis cp | cut -f2 -d:`
501  if [ "$TEST" = "" ]; then  if [ "$TEST" = "" ]; then
502   echo "Missing cp."   echo "Missing cp."
503   exit 254   exit 253
504  fi  fi
505  TEST=`whereis install | cut -f2 -d:`  TEST=`whereis install | cut -f2 -d:`
506  if [ "$TEST" = "" ]; then  if [ "$TEST" = "" ]; then
507   echo "Missing install."   echo "Missing install."
508   exit 253   exit 252
509  fi  fi
510  TEST=`whereis mv | cut -f2 -d:`  TEST=`whereis mv | cut -f2 -d:`
511  if [ "$TEST" = "" ]; then  if [ "$TEST" = "" ]; then
512   echo "Missing mv."   echo "Missing mv."
513   exit 252   exit 251
514  fi  fi
515  TEST=`whereis pwd | cut -f2 -d:`  TEST=`whereis pwd | cut -f2 -d:`
516  if [ "$TEST" = "" ]; then  if [ "$TEST" = "" ]; then
517   echo "Missing pwd."   echo "Missing pwd."
518   exit 251   exit 250
519  fi  fi
520  TEST=`whereis sed | cut -f2 -d:`  TEST=`whereis sed | cut -f2 -d:`
521  if [ "$TEST" = "" ]; then  if [ "$TEST" = "" ]; then
522   echo "Missing sed."   echo "Missing sed."
523   exit 250   exit 249
524  fi  fi
525  TEST=`whereis rm | cut -f2 -d:`  TEST=`whereis rm | cut -f2 -d:`
526  if [ "$TEST" = "" ]; then  if [ "$TEST" = "" ]; then
527   echo "Missing rm."   echo "Missing rm."
528   exit 249   exit 248
529  fi  fi
530  TEST=`whereis rmdir | cut -f2 -d:`  TEST=`whereis rmdir | cut -f2 -d:`
531  if [ "$TEST" = "" ]; then  if [ "$TEST" = "" ]; then
532   echo "Missing rmdir."   echo "Missing rmdir."
533   exit 248   exit 247
534  fi  fi
535  TEST=`whereis tar | cut -f2 -d:`  TEST=`whereis tar | cut -f2 -d:`
536  if [ "$TEST" = "" ]; then  if [ "$TEST" = "" ]; then
537   echo "Missing tar."   echo "Missing tar."
538   exit 247   exit 246
539  fi  fi
540  TEST=`whereis unifdef | cut -f2 -d:`  TEST=`whereis unifdef | cut -f2 -d:`
541  if [ "$TEST" = "" ]; then  if [ "$TEST" = "" ]; then
542   echo "Missing unifdef."   echo "Missing unifdef."
543   exit 246   exit 245
544  fi  fi
545  TEST=`whereis wget | cut -f2 -d:`  TEST=`whereis wget | cut -f2 -d:`
546  if [ "$TEST" = "" ]; then  if [ "$TEST" = "" ]; then
547   echo "Missing wget."   echo "Missing wget."
548   exit 245   exit 244
549  fi  fi
550    
551  # Set Linux Version  # Set Linux Version
# Line 514  LINUXVERSION="$P1.$P2" Line 556  LINUXVERSION="$P1.$P2"
556    
557  # Our Working Directories  # Our Working Directories
558  CURRENT_DIR=`pwd -P`  CURRENT_DIR=`pwd -P`
559  ORIGDIR="$CURRENT_DIR/linux-headers-$VERSION.orig/include"  ORIGDIR=$CURRENT_DIR/linux-headers-$VERSION.orig/include
560  NEWDIR="$CURRENT_DIR/linux-headers-$VERSION/include"  NEWDIR=$CURRENT_DIR/linux-headers-$VERSION/include
561    
562  # Headers to Sanitize  # Headers to Sanitize
563  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)
564       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)
565       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)
566       console.h constants.h const.h contregs.h coprocessor.h core.h cpudata.h cpufeature.h cpu-features.h cpu.h  
567       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)
568       elf.h entry.h ep7211.h ep7212.h errno-base.h errno.h ev96100.h ev96100int.h fcntl.h fixmap.h fls64.h  
569       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)
570       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)
571       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  
572       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)
      leds.h linkage.h local.h locks.h lowcore.h m32102.h m32104ut_pld.h m32700ut_lan.h m32700ut_lcd.h  
      m32700ut_pld.h m32r.h m32r_mp_fpga.h ma1.h machdep.h mach-types.h machvec.h macrology.h ma.h map.h  
      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  
      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"  
573    
574  REMOVE_HEADERS="asm-generic/page.h asm-mips/fpu.h net/raw.h net/rawv6.h asm-cris/arch-v10/atomic.h  ROOT_HEADERS=$(cat $CURRENT_DIR/lists/root-headers)
575          asm-cris/arch-v32/atomic.h"  SYS_HEADERS=$(cat $CURRENT_DIR/lists/sys-headers)
576    
577    GLIBC_HEADERS=$(cat $CURRENT_DIR/lists/glibc-headers)
578    
579    REMOVE_HEADERS=$(cat $CURRENT_DIR/lists/remove-headers)
580    
581  if [ "$FILE" = "yes" ]; then  if [ "$FILE" = "yes" ]; then
582   echo "Files List to $CURRENT_DIR/asm-list..."   echo "Files List to $CURRENT_DIR/asm-list..."
# Line 649  fi Line 638  fi
638    
639  echo "Decompressing Kernel Headers only..."  echo "Decompressing Kernel Headers only..."
640  rm -rf linux-$VERSION linux-headers-$VERSION linux-headers-$VERSION.orig  rm -rf linux-$VERSION linux-headers-$VERSION linux-headers-$VERSION.orig
641  tar jxf linux-$VERSION.tar.bz2 linux-$VERSION/include/*  tar --wildcards -jxf linux-$VERSION.tar.bz2 linux-$VERSION/include/*
642    if [ -e $CURRENT_DIR/patches/linux-$VERSION-REQUIRED-1.patch ]; then
643     if [ "$PATCHES" = "" ]; then
644     PATCHES="linux-$VERSION-REQUIRED-1.patch"
645     else
646     PATCHES="$PATCHES linux-$VERSION-REQUIRED-1.patch"
647     fi
648    fi
649    if [ -e $CURRENT_DIR/patches/linux-$VERSION-mips_headers-1.patch ]; then
650     if [ "$PATCHES" = "" ]; then
651     PATCHES="linux-$VERSION-mips_headers-1.patch"
652     else
653     PATCHES="$PATCHES linux-$VERSION-mips_headers-1.patch"
654     fi
655    fi
656    for PATCHFILE in $PATCHES; do
657     if [ -e "$CURRENT_DIR/patches/$PATCHFILE" ]; then
658     cd linux-$VERSION
659     echo "Patching Kernel Headers with $PATCHFILE..."
660     patch -Np1 -f -s -i $CURRENT_DIR/patches/$PATCHFILE
661     cd ..
662     fi
663    done
664    
665    if [ "$CHECK" = "yes" ]; then
666     cd linux-headers-$VERSION
667     rm -f $CURRENT_DIR/missing_headers
668     echo "Checking ASM..."
669     CHECKHEADERS="$ASM_HEADERS $NOSANTIZE_ASM_HEADERS"
670     check_headers
671     CHECKHEADERS="$ASM_ARCH_HEADERS $NOSANTIZE_ASM_HEADERS"
672     check_headers2
673     echo "Checking Linux..."
674     CHECKHEADERS="$LINUX_HEADERS"
675     check_headers
676     CHECKHEADERS="$NOSANTIZE_LINUX_HEADERS"
677     check_headers2
678     echo "Report is located at $CURRENT_DIR/missing_headers."
679     rm -rf linux-headers-$VERSION
680     cd $CURRENT_DIR
681     exit 0
682    fi
683    
684  echo "Renaming directory to linux-headers-$VERSION..."  echo "Renaming directory to linux-headers-$VERSION..."
685  mv linux-$VERSION linux-headers-$VERSION.orig  mv linux-$VERSION linux-headers-$VERSION.orig
# Line 663  for dir in $DIRS; do Line 693  for dir in $DIRS; do
693   install -d $NEWDIR/$dir   install -d $NEWDIR/$dir
694  done  done
695    
696  DONT_CHANGE="no"  DONT_CHANGE=no
697  TYPE="asm"  TYPE=asm
698  HEADERS="$ASM_HEADERS"  HEADERS="$ASM_HEADERS"
699  if [ "$HEADERS" != "" ]; then  if [ "$HEADERS" != "" ]; then
700   make_headers   make_headers
701  fi  fi
702    
703  TYPE="asm"  TYPE=asm
704  HEADERS="$ASM_ARCH_HEADERS"  HEADERS=$ASM_ARCH_HEADERS
705  if [ "$HEADERS" != "" ]; then  if [ "$HEADERS" != "" ]; then
706   make_headers   make_headers
707  fi  fi
708    
709  TYPE="linux"  TYPE=linux
710  HEADERS="$LINUX_HEADERS"  HEADERS=$LINUX_HEADERS
711  if [ "$HEADERS" != "" ]; then  if [ "$HEADERS" != "" ]; then
712   make_headers   make_headers
713  fi  fi
# Line 685  fi Line 715  fi
715  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
716   nfsd raid sunrpc tc_act tc_ematch"   nfsd raid sunrpc tc_act tc_ematch"
717  for type in $SETTYPE; do  for type in $SETTYPE; do
718   TYPE="linux"   TYPE=linux
719   cd $ORIGDIR/linux   cd $ORIGDIR/linux
720   if [ -e $ORIGDIR/linux/$type ]; then   if [ -e $ORIGDIR/linux/$type ]; then
721   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 `
# Line 707  for type in $SETTYPE; do Line 737  for type in $SETTYPE; do
737   fi   fi
738  done  done
739    
740  DONT_CHANGE="yes"  DONT_CHANGE=yes
741  TYPE="linux"  TYPE=linux
742  HEADERS="$NOSANTIZE_LINUX_HEADERS"  HEADERS=$NOSANTIZE_LINUX_HEADERS
743  if [ "$HEADERS" != "" ]; then  if [ "$HEADERS" != "" ]; then
744   make_headers   make_headers
745  fi  fi
746    
747  TYPE="asm"  TYPE=asm
748  HEADERS="$NOSANTIZE_ASM_HEADERS"  HEADERS=$NOSANTIZE_ASM_HEADERS
749  if [ "$HEADERS" != "" ]; then  if [ "$HEADERS" != "" ]; then
750   make_headers   make_headers
751  fi  fi
# Line 826  done Line 856  done
856  cp $ORIGDIR/asm-ia64/page.h $NEWDIR/asm-ia64/page.h  cp $ORIGDIR/asm-ia64/page.h $NEWDIR/asm-ia64/page.h
857  PAGE_H=$NEWDIR/asm-ia64/page.h  PAGE_H=$NEWDIR/asm-ia64/page.h
858  echo "Processing include/asm-ia64/page.h..."  echo "Processing include/asm-ia64/page.h..."
859  unifdef -UCONFIG_IA64_PAGE_SIZE_4KB -UCONFIG_IA64_PAGE_SIZE_8KB \  unifdef -e -UCONFIG_IA64_PAGE_SIZE_4KB -UCONFIG_IA64_PAGE_SIZE_8KB \
860   -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
861  cp $PAGE_H.new $PAGE_H  cp $PAGE_H.new $PAGE_H
862  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
# Line 1238  sed -e '/#ifndef __arch__swab16/,/#endif Line 1268  sed -e '/#ifndef __arch__swab16/,/#endif
1268  cp $SWAB_H.new $SWAB_H  cp $SWAB_H.new $SWAB_H
1269  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
1270  mv $SWAB_H.new $SWAB_H  mv $SWAB_H.new $SWAB_H
1271  echo "" >> $SWAB_H  if [ "$LINUXCODE" -gt "132625" ]; then
1272  echo "#define ___constant_swab16(x) __bswap_constant_16(x)" >> $SWAB_H   echo "" >> $SWAB_H
1273  echo "#define ___constant_swab32(x) __bswap_constant_32(x)" >> $SWAB_H   echo "#define ___constant_swab16(x) __bswap_constant_16(x)" >> $SWAB_H
1274  echo "#define ___constant_swab64(x) __bswap_constant_64(x)" >> $SWAB_H   echo "#define ___constant_swab32(x) __bswap_constant_32(x)" >> $SWAB_H
1275  echo "" >> $SWAB_H   echo "#define ___constant_swab64(x) __bswap_constant_64(x)" >> $SWAB_H
1276  echo "#define __swab16(x) bswap_16(x)" >> $SWAB_H   echo "" >> $SWAB_H
1277  echo "#define __swab32(x) bswap_32(x)" >> $SWAB_H   echo "#define __swab16(x) bswap_16(x)" >> $SWAB_H
1278  echo "#define __swab64(x) bswap_64(x)" >> $SWAB_H   echo "#define __swab32(x) bswap_32(x)" >> $SWAB_H
1279  echo "" >> $SWAB_H   echo "#define __swab64(x) bswap_64(x)" >> $SWAB_H
1280  echo "#define __swab16p(x) __swab16(*(x))" >> $SWAB_H   echo "" >> $SWAB_H
1281  echo "#define __swab32p(x) __swab32(*(x))" >> $SWAB_H   echo "#define __swab16p(x) __swab16(*(x))" >> $SWAB_H
1282  echo "#define __swab64p(x) __swab64(*(x))" >> $SWAB_H   echo "#define __swab32p(x) __swab32(*(x))" >> $SWAB_H
1283  echo "" >> $SWAB_H   echo "#define __swab64p(x) __swab64(*(x))" >> $SWAB_H
1284  echo "#define __swab16s(x) do { *(x) = __swab16p((x)); } while (0)" >> $SWAB_H   echo "" >> $SWAB_H
1285  echo "#define __swab32s(x) do { *(x) = __swab32p((x)); } while (0)" >> $SWAB_H   echo "#define __swab16s(x) do { *(x) = __swab16p((x)); } while (0)" >> $SWAB_H
1286  echo "#define __swab64s(x) do { *(x) = __swab64p((x)); } while (0)" >> $SWAB_H   echo "#define __swab32s(x) do { *(x) = __swab32p((x)); } while (0)" >> $SWAB_H
1287  echo "" >> $SWAB_H   echo "#define __swab64s(x) do { *(x) = __swab64p((x)); } while (0)" >> $SWAB_H
1288     echo "" >> $SWAB_H
1289    fi
1290  echo "#endif /* _LINUX_BYTEORDER_SWAB_H */" >> $SWAB_H  echo "#endif /* _LINUX_BYTEORDER_SWAB_H */" >> $SWAB_H
1291  clean_header $SWAB_H  clean_header $SWAB_H
1292    
# Line 1275  TYPES_H=$NEWDIR/linux/types.h Line 1307  TYPES_H=$NEWDIR/linux/types.h
1307  echo "Fixing include/linux/types.h..."  echo "Fixing include/linux/types.h..."
1308  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
1309  cp $TYPES_H.new $TYPES_H  cp $TYPES_H.new $TYPES_H
1310  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
1311   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
1312   cp $TYPES_H.new $TYPES_H  sed -e 's@#endif /. __KERNEL_STRICT_NAMES ./@\n#endif\n#endif\n\n@' $TYPES_H > $TYPES_H.new
1313   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  
1314  clean_header $TYPES_H  clean_header $TYPES_H
1315    
1316  for file in $REMOVE_HEADERS; do  for file in $REMOVE_HEADERS; do
# Line 1288  for file in $REMOVE_HEADERS; do Line 1318  for file in $REMOVE_HEADERS; do
1318   rm -f $NEWDIR/$file   rm -f $NEWDIR/$file
1319  done  done
1320    
1321    echo "Removing Headers that are replaced by glibc headers..."
1322    for file in $GLIBC_HEADERS; do
1323     rm $NEWDIR/$file
1324    done
1325    
1326  if [ "$LINUXCODE" -gt "132625" ]; then  if [ "$LINUXCODE" -gt "132625" ]; then
1327   HEADER_FILE="videodev.h"   HEADER_FILE="videodev.h"
1328   HEADER_NAME="__LINUX_VIDEODEV_H"   HEADER_NAME="__LINUX_VIDEODEV_H"
1329   HEADER_UPDATE="#include <linux/types.h>"   HEADER_UPDATE="#include <linux/types.h>"
1330   change_header   change_header
1331     VIDEODEV_H=$NEWDIR/linux/videodev.h
1332     sed -e '/CONFIG_VIDEO_V4L1_COMPAT/d' $VIDEODEV_H > $VIDEODEV_H.new
1333     cp $VIDEODEV_H.new $VIDEODEV_H
1334     clean_header $VIDEODEV_H
1335  fi  fi
1336    
1337  echo "Removing any Kbuild files..."  echo "Removing any Kbuild files..."
# Line 1330  echo "Processed $count headers..." Line 1369  echo "Processed $count headers..."
1369  creation="$CURRENT_DIR/linux-headers-$VERSION/creation"  creation="$CURRENT_DIR/linux-headers-$VERSION/creation"
1370  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
1371  echo "based on $VERSION kernel." >> $creation  echo "based on $VERSION kernel." >> $creation
1372    if [ -e "$CURRENT_DIR/patches/$PATCHFILE" ]; then
1373     echo "Utilized patch - $PATCHFILE" >> $creation
1374    fi
1375    
1376  bugreport="$CURRENT_DIR/linux-headers-$VERSION/bug-report"  bugreport="$CURRENT_DIR/linux-headers-$VERSION/bug-report"
1377  echo "Report bugs at http://headers.cross-lfs.org" > $bugreport  echo "Report bugs at http://headers.cross-lfs.org" > $bugreport
# Line 1348  echo "Thank you for you support of Linux Line 1390  echo "Thank you for you support of Linux
1390    
1391  install -d $CURRENT_DIR/linux-headers-$VERSION/script  install -d $CURRENT_DIR/linux-headers-$VERSION/script
1392  cp $0 $CURRENT_DIR/linux-headers-$VERSION/script  cp $0 $CURRENT_DIR/linux-headers-$VERSION/script
1393    install -d $CURRENT_DIR/linux-headers-$VERSION/lists
1394    cp $CURRENT_DIR/lists/* $CURRENT_DIR/linux-headers-$VERSION/lists
1395    install -d $CURRENT_DIR/linux-headers-$VERSION/script/patches
1396    if [ -e $CURRENT_DIR/patches/linux-$VERSION-REQUIRED-1.patch ]; then
1397     cp $CURRENT_DIR/patches/linux-$VERSION-REQUIRED-1.patch $CURRENT_DIR/linux-headers-$VERSION/script/patches/linux-$VERSION-REQUIRED-1.patch
1398    fi
1399    if [ -e $CURRENT_DIR/patches/linux-$VERSION-mips_headers-1.patch ]; then
1400     cp $CURRENT_DIR/patches/linux-$VERSION-mips_headers-1.patch $CURRENT_DIR/linux-headers-$VERSION/script/patches/linux-$VERSION-mips_headers-1.patch
1401    fi
1402    for PATCHFILE in $PATCHES; do
1403            if [ -e "$CURRENT_DIR/patches/$PATCHFILE" ]; then
1404     cp $CURRENT_DIR/patches/$PATCHFILE $CURRENT_DIR/linux-headers-$VERSION/script/patches/$PATCHFILE
1405            fi
1406    done
1407    
1408  cp license $CURRENT_DIR/linux-headers-$VERSION/license  cp license $CURRENT_DIR/linux-headers-$VERSION/license
1409    

Legend:
Removed from v.434  
changed lines
  Added in v.435