[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ltib] How to check linux header files availability before compiling
From: |
Stuart Hughes |
Subject: |
Re: [Ltib] How to check linux header files availability before compiling ? |
Date: |
Wed, 16 Jun 2010 19:32:25 +0100 |
User-agent: |
Thunderbird 2.0.0.16 (X11/20080707) |
Hi Franz,
The fragment with 'headers_install' is not in the Savannah LTIB version,
so this must be a change they have made.
You will need to ask them about this, and why they changed. It's quite
possible that later kernels have changed the interface. I am aware of
headers_install, it's been around for a while. However in practice I
found this not to be sufficient to give a full set of header files for
the kernel (even for userspace).
If you do asked them, please mention to them that they could/should
submit a patch to this list with a rationale for the change. If this
really is progress, it would be good to include for everyone's benefit.
In the mean time, a sure file check in your .spec file (such as just
checking for /usr/src/linux/include) is probably a good work-around as
it would work in either case.
Regards, Stuart
Franz TRIERWEILER wrote:
> Hi,
>
> In the log file, I see:
>
> +
> KERNEL_HDR_PATH=/home/test/ltib/tmp/kernel//opt/freescale/rootfs/arm/usr/src/linux
> + install -d
> /home/test/ltib/tmp/kernel//opt/freescale/rootfs/arm/usr/src/linux/include
> + make ARCH=arm CROSS_COMPILE= 'HOSTCC=ccache /usr/bin/gcc -B/usr/bin/'
> INSTALL_HDR_PATH=/home$
> CHK include/linux/version.h
> HOSTCC scripts/unifdef
> INSTALL include/asm-generic (34 files)
> INSTALL include/drm (12 files)
> INSTALL include/mtd (5 files)
> INSTALL include/linux/byteorder (2 files)
> INSTALL include/scsi (4 files)
> INSTALL include/linux/dvb (8 files)
> INSTALL include/linux/can (4 files)
> INSTALL include/rdma (1 file)
> INSTALL include/sound (9 files)
> INSTALL include/video (3 files)
> INSTALL include/linux/hdlc (1 file)
> INSTALL include/xen (1 file)
> INSTALL include (0 file)
> INSTALL include/linux/netfilter (58 files)
> INSTALL include/linux/isdn (1 file)
> INSTALL include/linux/netfilter_bridge (16 files)
> INSTALL include/linux/netfilter_arp (2 files)
> INSTALL include/linux/netfilter_ipv6 (21 files)
> INSTALL include/linux/netfilter_ipv4 (46 files)
> INSTALL include/linux/raid (2 files)
> INSTALL include/linux/nfsd (6 files)
> INSTALL include/linux/spi (1 file)
> INSTALL include/linux/tc_act (6 files)
> INSTALL include/linux/sunrpc (1 file)
> INSTALL include/linux/tc_ematch (4 files)
> INSTALL include/linux/usb (8 files)
> INSTALL include/linux/wimax (1 file)
> INSTALL include/linux (371 files)
> INSTALL include/asm (32 files)
> INSTALL include/asm-generic (34 files)
> INSTALL include/drm (12 files)
> INSTALL include/mtd (5 files)
> INSTALL include/linux/byteorder (2 files)
> INSTALL include/scsi (4 files)
> INSTALL include/linux/dvb (8 files)
> INSTALL include/linux/can (4 files)
> INSTALL include/rdma (1 file)
> INSTALL include/sound (9 files)
> INSTALL include/video (3 files)
> INSTALL include/linux/hdlc (1 file)
> INSTALL include/xen (1 file)
> INSTALL include (0 file)
> INSTALL include/linux/netfilter (58 files)
> INSTALL include/linux/isdn (1 file)
> INSTALL include/linux/netfilter_bridge (16 files)
> INSTALL include/linux/netfilter_arp (2 files)
> INSTALL include/linux/netfilter_ipv6 (21 files)
> INSTALL include/linux/netfilter_ipv4 (46 files)
> INSTALL include/linux/raid (2 files)
> INSTALL include/linux/nfsd (6 files)
> INSTALL include/linux/spi (1 file)
> INSTALL include/linux/tc_act (6 files)
> INSTALL include/linux/sunrpc (1 file)
> INSTALL include/linux/tc_ematch (4 files)
> INSTALL include/linux/usb (8 files)
> INSTALL include/linux/wimax (1 file)
> INSTALL include/linux (371 files)
> INSTALL include/asm (32 files)
>
> ...
> ...
> ...
> Processing files: kernel-2.6.31-imx_09.12.00
> Finding Provides: (using /opt/freescale/ltib/usr/lib/rpm/find-provides)...
> Finding Requires: (using /opt/freescale/ltib/usr/lib/rpm/find-requires)...
> PreReq: rpmlib(PayloadFilesHavePrefix) <= 4.0-1
> rpmlib(CompressedFileNames) <= 3.0.4-1
> Requires(rpmlib): rpmlib(PayloadFilesHavePrefix) <= 4.0-1
> rpmlib(CompressedFileNames) <= 3.0.4$
> Wrote: /home/test/ltib/rpm/RPMS/arm/kernel-2.6.31-imx_09.12.00.arm.rpm
> Executing(%clean): /bin/sh -e /home/test/ltib/tmp/rpm-tmp.59865
> + umask 022
> + cd /home/test/ltib/rpm/BUILD
> + cd linux-2.6.31
> + rm -rf /home/test/ltib/tmp/kernel
> + '[' -z '' ']'
> + rm -f /home/test/ltib/rpm/BUILD/linux
> + exit 0
> Executing(--clean): /bin/sh -e /home/test/ltib/tmp/rpm-tmp.59865
> + umask 022
> + cd /home/test/ltib/rpm/BUILD
> + rm -rf linux-2.6.31
> + exit 0
> Build time for kernel-2.6.31: 173 seconds
>
>
>
> Thus the install is performed through a Makefile, not through the cp -a
> set of commands since make does not return error:
>
>
> if ! make ARCH=$LINTARCH CROSS_COMPILE= HOSTCC="$BUILDCC"
> INSTALL_HDR_PATH=${KERNEL_HDR_PATH} headers_install
> then
> for i in asm-${LINTARCH} asm-generic config linux math-emu media
> mtd net pcmcia rxrpc scsi sound video
> do
> if [ -d include/$i ]
> then
> cp -a include/$i ${KERNEL_HDR_PATH}/include
> fi
> done
>
> for i in asm config linux
> do
> if [ -d $KBOUT/include/$i ]
> then
> cp -a $KBOUT/include/$i ${KERNEL_HDR_PATH}/include
> fi
> done
> fi
> fi
>
> In the log, I see: INSTALL include/linux (371 files)... it looks as if
> there a fine selection of files since I have about 1,000 files in the
> rpm/BUILD of the linux kernel. Well, I have now to dive into the cryptic
> kernel makefile and spend hours to find out how files from ./include are
> selected.
>
> I also use uCLinux on another board and the autoconf.h file is properly
> copied.
>
> Franz
>
>
> 2010/6/15 Stuart Hughes <address@hidden <mailto:address@hidden>>
>
> My apologies Franz,
>
> To get a log:
>
> $ ./ltib -p kernel 2>&1 | tee logfile
>
> The .spec.in <http://spec.in> should copy that file (it does on
> other kernels). Looking
> at it it should be done here:
>
> > for i in asm-${LINTARCH} asm-generic config linux math-emu
> media
> > mtd net pcmcia rxrpc scsi sound video
> > do
> > if [ -d include/$i ]
> > then
> > cp -a include/$i ${KERNEL_HDR_PATH}/include
> > fi
> > done
>
> When i is linux and it has a sub-dir include, then it should be copied
> (IIRC).
>
> Regards, Stuart
>
>
> Franz TRIERWEILER wrote:
> > Hi Stuart,
> >
> > (Note I am FranZ, not FranK :-) )
> >
> > Yes, it is a Freescale BSP. I can see autoconf.h in the kernel
> sources
> > (in the rpm/BUILD/linux-2.6.31/include/linux).
> >
> > I tried to find a log for the rpm package install but did not find it.
> > Which log corresponds to the kernel header package? I only know
> the host
> > config but it is for LTIb first install, thus it is no use.
> >
> > I checked the kernel-common.tmpl and I believe everything happens
> here:
> >
> > if [ -n "$PKG_KERNEL_WANT_HEADERS" ]
> > then
> > KERNEL_HDR_PATH=$RPM_BUILD_ROOT/%{pfx}/usr/src/linux
> > install -d ${KERNEL_HDR_PATH}/include
> > if ! make ARCH=$LINTARCH CROSS_COMPILE= HOSTCC="$BUILDCC"
> > INSTALL_HDR_PATH=${KERNEL_HDR_PATH} headers_install
> > then
> > for i in asm-${LINTARCH} asm-generic config linux math-emu
> media
> > mtd net pcmcia rxrpc scsi sound video
> > do
> > if [ -d include/$i ]
> > then
> > cp -a include/$i ${KERNEL_HDR_PATH}/include
> > fi
> > done
> >
> > for i in asm config linux
> > do
> > if [ -d $KBOUT/include/$i ]
> > then
> > cp -a $KBOUT/include/$i ${KERNEL_HDR_PATH}/include
> > fi
> > done
> > fi
> > fi
> >
> > In my opinion, the subdir ./linux should be copied (this is where
> > autoconf.h is), but is not entirely copied...
> >
> > Do you have a kernel-common.tmpl file I could check as a reference?
> >
> > Regards,
> > Franz
> >
> >
> > 2010/6/14 Stuart Hughes <address@hidden <mailto:address@hidden>
> <mailto:address@hidden <mailto:address@hidden>>>
> >
> > Hi Frank,
> >
> > Maybe there was an error during rpm install that prevented the
> copy of
> > that header (can/did you check the build log)?
> >
> > Carefully check that the source that is being copied from is
> the right
> > place. If the kernel is built out-of-tree, this location
> should be the
> > copy source directory. Presumably this is a Freescale BSP?
> maybe they
> > changed/broke something in that copy (it may be worth checking
> > kernel-common.tmpl).
> >
> > Regarrds, Stuart
> >
> >
> > Franz TRIERWEILER wrote:
> > > Hi Stuart,
> > >
> > > $ rpm --root `pwd`/rootfs -qf /usr/src/linux/include/linux/
> > > acct.h
> > >
> > > returned kernel-2.6.31-imx_09.12.00
> > >
> > > My kernel is: 2.6.31-203-gee1fdae, as returned by uname -r
> on the
> > > Freescale board.
> > >
> > > I also forced a kernel rebuild but autoconf.h is still missing.
> > >
> > > Regards,
> > > Franz
> > >
> > >
> > > 2010/6/11 Stuart Hughes <address@hidden <mailto:address@hidden>
> <mailto:address@hidden <mailto:address@hidden>>
> > <mailto:address@hidden <mailto:address@hidden>
> <mailto:address@hidden <mailto:address@hidden>>>>
> > >
> > > Hi Frank,
> > >
> > > That's odd. I now recall that in the old days the check
> was for
> > > config.h and it changed to autoconf.h
> > > http://www.mail-archive.com/address@hidden/msg09210.html
> > >
> > > I just took a look at mpc8349itx BSP building a
> kernel.org <http://kernel.org>
> > <http://kernel.org>
> > > <http://kernel.org> 2.6.34-rc3
> > > kernel, with install kernel headers and I see:
> > >
> > > $ find rootfs/usr/src/linux/ -name autoconf.h
> > > rootfs/usr/src/linux/include/linux/autoconf.h
> > >
> > > Can you verify your headers are coming from the kernel. I
> > just ran
> > > this:
> > >
> > > $ rpm --root `pwd`/rootfs -qf
> > /usr/src/linux/include/linux/autoconf.h
> > > kernel-local-1
> > >
> > > You can try:
> > > $ rpm --root `pwd`/rootfs -qf
> /usr/src/linux/include/linux/acct.h
> > >
> > > Unless someone else knows otherwise, I think autoconf.h
> should
> > still get
> > > installed. It may be worth forcing a kernel re-build and
> > logging it.
> > > Maybe an error in the install script (or other) is
> causing the
> > copy of
> > > this file to be bypassed for your kernel sources (BTW
> what kernel
> > > version/sources is this?)
> > >
> > > Regards, Stuart
> > >
> > >
> > > Franz TRIERWEILER wrote:
> > > > Hi Stuart,
> > > >
> > > > I confirm that I do have the interfaces on my rootfs:
> > > >
> > > > :~/ltib/rootfs/usr/src/linux/include/linux$ ls
> > > > acct.h dccp.h if_bridge.h
> > > > llc.h param.h som.h
> > > > adb.h dlmconstants.h if_cablemodem.h
> > > > loop.h parport.h sonet.h
> > > > adfs_fs.h dlm_device.h if_ec.h
> > > > lp.h patchkey.h sonypi.h
> > > > affs_hardblocks.h dlm.h if_eql.h
> > > > magic.h pci.h soundcard.h
> > > > .....
> > > > .....
> > > > .....
> > > >
> > > > :~/ltib/rootfs/usr/src/linux/include/linux$ ls auto*
> > > > auto_fs4.h auto_fs.h
> > > >
> > > > But no autoconf.h !
> > > >
> > > > Indeed, the following options are checked in LTIB:
> > > >
> > > > │ │ [*] Always
> rebuild the
> > > > kernel
> > > > │ │
> > > > │ │ [ ] Produce cscope
> > > > index
> > > > │ │
> > > > │ │ [*] Include kernel
> > > > headers
> > > > │ │
> > > > │ │ [ ] Configure the
> > > > kernel
> > > > │ │
> > > > │ │ --- Leave the
> sources
> > after
> > > > building
> > > > │ │
> > > >
> > > > Maybe should not we just check the availability of
> > > > rootfs/usr/src/linux/include/linux directory instead
> of a single
> > > file in
> > > > order to know if kernel headers are available ?
> > > >
> > > > regards,
> > > > Franz
> > > >
> > > > 2010/6/11 Stuart Hughes <address@hidden
> <mailto:address@hidden> <mailto:address@hidden <mailto:address@hidden>>
> > <mailto:address@hidden <mailto:address@hidden>
> <mailto:address@hidden <mailto:address@hidden>>>
> > > <mailto:address@hidden <mailto:address@hidden>
> <mailto:address@hidden <mailto:address@hidden>>
> > <mailto:address@hidden <mailto:address@hidden>
> <mailto:address@hidden <mailto:address@hidden>>>>>
> > > >
> > > > Hi Franz,
> > > >
> > > > This file will always be in
> > > rpm/BUILD/linux-xxxxxx/include/linux if left
> > > > unpacked. However the interface should be through
> > > rootfs/usr/src/linux
> > > > (DEV_IMAGE...). This is the public interface for
> kernel
> > headers.
> > > > Confirm that you have these installed on your rootfs
> > (there is
> > > an option
> > > > in LTIB to install kernel headers).
> > > >
> > > > If you do have kernel headers installed, It's possible
> > that later
> > > > kernels do not install this file any more? maybe
> a kernel
> > > expert on the
> > > > list knows (I vaguely remember something like this).
> > > >
> > > > Unfortunately today's best practice is tomorrows
> > > > _rug_pulled_from_under_your_feet.
> > > >
> > > > Regards, Stuart
> > > >
> > > >
> > > > Franz TRIERWEILER wrote:
> > > > > Hi Stuart,
> > > > >
> > > > > I included and tested this. What's weird with my
> LTIB is
> > > that the
> > > > > autoconf.h file is never copied to
> > KHDR_DIR/linux/autoconf.h
> > > even
> > > > when I
> > > > > select 'Include kernel headers' in LTIB.
> > > > >
> > > > > Instead, this file is with the kernel sources in
> > > > > rpm/BUILD/linux-xxxxxx/include/linux
> > > > >
> > > > > Thus: why ?
> > > > >
> > > > > Of course, I could check the availability of another
> > file but I
> > > > want to
> > > > > comply with the best practice.
> > > > >
> > > > > Franz
> > > > >
> > > > > 2010/6/9 Stuart Hughes <address@hidden
> <mailto:address@hidden>
> > <mailto:address@hidden <mailto:address@hidden>>
> <mailto:address@hidden <mailto:address@hidden> <mailto:address@hidden
> <mailto:address@hidden>>>
> > > <mailto:address@hidden <mailto:address@hidden>
> <mailto:address@hidden <mailto:address@hidden>>
> > <mailto:address@hidden <mailto:address@hidden>
> <mailto:address@hidden <mailto:address@hidden>>>>
> > > > <mailto:address@hidden <mailto:address@hidden>
> <mailto:address@hidden <mailto:address@hidden>>
> > <mailto:address@hidden <mailto:address@hidden>
> <mailto:address@hidden <mailto:address@hidden>>>
> > > <mailto:address@hidden <mailto:address@hidden>
> <mailto:address@hidden <mailto:address@hidden>>
> > <mailto:address@hidden <mailto:address@hidden>
> <mailto:address@hidden <mailto:address@hidden>>>>>>
> > > > >
> > > > > Hi Franz,
> > > > >
> > > > > I normally use this in the .spec file %build
> section:
> > > > >
> > > > >
> > > > > %Build
> > > > > KHDR_DIR=$DEV_IMAGE/usr/src/linux/include
> > > > > if [ ! -f $KHDR_DIR/linux/autoconf.h ]
> > > > > then
> > > > > cat <<TXT
> > > > >
> > > > > No file: $KHDR_DIR/linux/autoconf.h
> > > > >
> > > > > You need to build the kernel and have
> 'Include kernel
> > > headers' set
> > > > > to build this package
> > > > >
> > > > > TXT
> > > > > exit 1
> > > > > fi
> > > > >
> > > > > Regards, Stuart
> > > > >
> > > > >
> > > > > Franz TRIERWEILER wrote:
> > > > > > Hi,
> > > > > >
> > > > > > My package Makefile needs to set gcc
> include path to
> > > the kernel
> > > > > headers
> > > > > > (rootfs/usr/src/linux/include). I would
> like the
> > > > availability of these
> > > > > > files to be checked before gcc prints a
> cryptic
> > error.
> > > > > >
> > > > > > Is there a way of checking linux header
> availability
> > > before
> > > > compiling?
> > > > > > (my makefile is not generated by ./configure).
> > > > > >
> > > > > > Must I specify this in the package
> dependencies?
> > > > > >
> > > > > > Is there a LTIB parameter I can catch from the
> > Makefile to
> > > > set the
> > > > > path
> > > > > > automatically ?
> > > > > >
> > > > > > Thanks,
> > > > > > Franz
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>