Quantcast

Linaro linux-source has no makefiles - help?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Linaro linux-source has no makefiles - help?

Larry Martin
I am trying to recompile a kernel module on board my Air Storm running
Linaro (3.5.0-2-linaro-omap).  I have installed kernel source but did
not get any makefiles with that.  Can somebody tell me what I'm missing?

My setup was made by following these instructions:

http://gumstix.org/getting-started-guide/241-get-an-image.html
http://gumstix.org/getting-started-guide/242-create-a-bootable-microsd-card.html 


After running apt-get install linux-source, I have a source tree in
/usr/src but no Makefile anywhere:

> root@linaro-alip:~# ls /usr/src/linux-source-3.2.0/deb*
> root@linaro-alip:~# ls -F /usr/src/linux-source-3.2.0/deb*
> /usr/src/linux-source-3.2.0/debian:
> changelog          control           copyright   rules*    source/
> commit-templates/  control-scripts/  debian.env  rules.d/  tests/
> compat             control.stub      docs/       scripts/  tools/
>
> /usr/src/linux-source-3.2.0/debian.master:
> NOTES      changelog.historical  control.d/       copyright       etc/
> abi/       config/               control.stub     d-i/            rules.d/
> changelog  control               control.stub.in  deviations.txt
> root@linaro-alip:/usr/src# cd linux-source-3.2.0
> root@linaro-alip:/usr/src/linux-source-3.2.0# find -name Makefile
 >

The Debian build instructions I can find say to "make scripts" or to
copy a .config from Linaro and do "make modules".  That does not work
without makefiles:

> root@linaro-alip:/usr/src/linux-source-3.2.0/debian# make ARCH=arm CROSS_COMPILE="" uImage
> make: *** No rule to make target `uImage'.  Stop.

root@linaro-alip:/usr/src/linux-source-3.2.0# find Makefile
find: `Makefile': No such file or directory

Can anyone point me to a procedure that works for building modules on
board Linaro, or tell me what I need to do to generate the Makefiles?

Thanks,
Larry

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linaro linux-source has no makefiles - help?

Ash Charles
The Linaro kernel uses debian packaging so there are a few extra hoops
to jump through :(.  I made some notes when I stepped through the
process before and have given them below.  YMMV though---they are my
on-the-fly notes so who knows what I missed ;-)!
More recently though, Linaro made their kernel CI script available
which nicely encapsulates the steps...
https://wiki.linaro.org/JohnRigby/KernelCi
(I patched in some stuff for Overo here:
https://github.com/ashcharles/ubuntu-kernel-ci)

The notes....

== Kernel Package ==
Note, if you just want to test a kernel image on hardware, stop here
and look at this page instead:
https://wiki.linaro.org/Resources/HowTo/KernelDeploy

To build a kernel debian:
 $ dch --changelog debian.linaro/changelog --package linux-omap3 -v
2.6.38-1002.4
 $ fdr clean
 $ fdr updateconfigs
 $ debuild -eCROSS_COMPILE=arm-linux-gnueabi- -k$GPGKEY -b -aarmel
On the target,
 # dpkg -i <my-kernel.deb>

To build a kernel normally
(https://wiki.linaro.org/Resources/HowTo/KernelDeploy):
 1. Get a config from an existing build e.g.:
 $ scp [hidden email]:/media/rootfs/boot/config-2.6.38-1002-linaro-omap
.config
-- OR --
 $ cat debian.linaro/config/config.common.ubuntu
debian.linaro/config/armel/config.common.armel
debian.linaro/config/armel/config.linaro-omap > .config
2. Build
 $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage modules -j8
3. Install
 $ cp arch/arm/boot/uImage /media/boot/
 $ make ARCH=arm INSTALL_MOD_PATH=/media/rootfs/ modules_install
 $ make ARCH=arm INSTALL_FW_PATH=/media/rootfs/ firmware_install
4. Run (at the u-boot prompt)
 # setenv loadbootscript ''
 # setenv console 'ttyO2,115200n8'
 # saveenv
 # run bootcmd
5. Generate an initramfs (from running target)
 # update-initramfs -c -k `uname -r`
 # mount /dev/mmcblk0p1 /mnt
 # mkimage -A arm -T ramdisk -C none -n "MY RAMDISK" -d
/boot/initrd.img-`uname -r` /mnt/uInitrd
(see https://wiki.linaro.org/Resources/HowTo/KernelDeviceTree for dtb)

On Thu, Jun 20, 2013 at 6:00 AM, Larry Martin <[hidden email]> wrote:

> I am trying to recompile a kernel module on board my Air Storm running
> Linaro (3.5.0-2-linaro-omap).  I have installed kernel source but did
> not get any makefiles with that.  Can somebody tell me what I'm missing?
>
> My setup was made by following these instructions:
>
> http://gumstix.org/getting-started-guide/241-get-an-image.html
> http://gumstix.org/getting-started-guide/242-create-a-bootable-microsd-card.html
>
>
> After running apt-get install linux-source, I have a source tree in
> /usr/src but no Makefile anywhere:
>
>> root@linaro-alip:~# ls /usr/src/linux-source-3.2.0/deb*
>> root@linaro-alip:~# ls -F /usr/src/linux-source-3.2.0/deb*
>> /usr/src/linux-source-3.2.0/debian:
>> changelog          control           copyright   rules*    source/
>> commit-templates/  control-scripts/  debian.env  rules.d/  tests/
>> compat             control.stub      docs/       scripts/  tools/
>>
>> /usr/src/linux-source-3.2.0/debian.master:
>> NOTES      changelog.historical  control.d/       copyright       etc/
>> abi/       config/               control.stub     d-i/            rules.d/
>> changelog  control               control.stub.in  deviations.txt
>> root@linaro-alip:/usr/src# cd linux-source-3.2.0
>> root@linaro-alip:/usr/src/linux-source-3.2.0# find -name Makefile
>  >
>
> The Debian build instructions I can find say to "make scripts" or to
> copy a .config from Linaro and do "make modules".  That does not work
> without makefiles:
>
>> root@linaro-alip:/usr/src/linux-source-3.2.0/debian# make ARCH=arm CROSS_COMPILE="" uImage
>> make: *** No rule to make target `uImage'.  Stop.
>
> root@linaro-alip:/usr/src/linux-source-3.2.0# find Makefile
> find: `Makefile': No such file or directory
>
> Can anyone point me to a procedure that works for building modules on
> board Linaro, or tell me what I need to do to generate the Makefiles?
>
> Thanks,
> Larry
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> gumstix-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gumstix-users

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linaro linux-source has no makefiles - help?

Larry Martin
In reply to this post by Larry Martin
Hi, Ash -

Thanks for the help.  For the record, dch and debuild are in devscripts, though I have not found fdr yet.  This command got me closer to a solution:

   apt-get install devscripts fakeroot autotools-dev

But the answer to my original question is that the Makefiles are in the Headers tree, not in the Source tree.  In the current prebuilt Linaro image (which only works on Storm level COMs), that is /usr/src/linux-headers-3.5.0-2-linaro-omap.  There is a link to "source" that has to be adjusted per system.  I just ran 'make scripts' there and stuff seemed to happen, so i think I may be on the way.

Best regards,
Larry
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linaro linux-source has no makefiles - help?

Ash Charles
Oops!
fdr is an alias to 'fakeroot debian/rules'

On Thu, Jun 20, 2013 at 9:52 AM, Larry Martin <[hidden email]> wrote:

> Hi, Ash -
>
> Thanks for the help.  For the record, dch and debuild are in devscripts,
> though I have not found fdr yet.  This command got me closer to a solution:
>
>    apt-get install devscripts fakeroot autotools-dev
>
> But the answer to my original question is that the Makefiles are in the
> Headers tree, not in the Source tree.  In the current prebuilt Linaro image
> (which only works on Storm level COMs), that is
> /usr/src/linux-headers-3.5.0-2-linaro-omap.  There is a link to "source"
> that has to be adjusted per system.  I just ran 'make scripts' there and
> stuff seemed to happen, so i think I may be on the way.
>
> Best regards,
> Larry
>
>
>
> --
> View this message in context: http://gumstix.8.x6.nabble.com/Linaro-linux-source-has-no-makefiles-help-tp4967421p4967426.html
> Sent from the Gumstix mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> gumstix-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gumstix-users

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linaro linux-source has no makefiles - help?

Larry Martin
I can now natively compile kernel modules in my Linaro image on Air Storm.  This is a summary of the steps:

* Follow the instructions to download a Linaro image and write it to an SD card (mine was 8 GB):

http://gumstix.org/getting-started-guide/241-get-an-image.html
http://gumstix.org/getting-started-guide/242-create-a-bootable-microsd-card.html

* Assemble a system with network and a Storm COM.  Boot and get into the console.  Verify that the image already includes the linux-headers package:

     # ls /usr/src
     linux-headers-3.5.0-2-linaro-omap
     ...

* install the linux-sources package.  I am not sure if this is necessary, or which other packages may have been necessary.  I don't think I really needed git or the Debian developer tools.

     # apt-get install linux-source

This creates a skeleton in /usr/src/linux-source-3.2.0, along with a big source tarball.  Unfortunately, my kernel is not 3.2.0:

     # uname -r
     3.5.0-2-linaro-omap

* Get the Gumstix sources for 3.5.0.  This is the same as the ZIP button on https://github.com/gumstix/linux/tree/omap-3.5

     # cd
     # apt-get install wget
     # mkdir build
     # cd build
     # wget https://github.com/gumstix/linux/archive/omap-3.5.zip
     # unzip omap-3.5.zip

* Review some critical links:

     Make sure /lib/modules/blah/build points to /usr/src/linux-headers~blah.
         The particulars may vary by system and over time.
     # ls -l /lib/modules/3.5.0-2-linaro-omap/build
     lrwxrwxrwx 1 root root 42 Dec 10  2012 /lib/modules/3.5.0-2-linaro-omap/build -> /usr/src/linux-headers-3.5.0-2-linaro-omap

     Make sure /usr/src/linux-headers~blah/source points to the base of your source tree
         The particulars may vary by system and over time.
     # ls -l /usr/src/linux-headers-3.5.0-2-linaro-omap/source
     lrwxrwxrwx 1 root root 26 Jun 21 16:05 /usr/src/linux-headers-3.5.0-2-linaro-omap/source -> /root/build/linux-omap-3.5

* Make a basic config builder.  I am not sure if the later step that makes defconfig overwrites this or not

     # cd
     # cat > get_config
     ## see https://wiki.linaro.org/Resources/HowTo/KernelDeploy
     BASE="https://git.linaro.org/gitweb?p=ubuntu/linux-linaro-oneiric.git;a=blob_plain;"
     COMMON_UBUNTU="${BASE}f=debian.linaro/config/config.common.ubuntu;hb=HEAD"
     FLAVOR_OMAP="${BASE}f=debian.linaro/config/armel/config.flavour.linaro-omap;hb=HEAD"
     curl "$COMMON_UBUNTU" "$COMMON_ARMEL" "$FLAVOR_OMAP" > .config
     ^D
     # chmod a+x get_config

* You should now have all the sources and makefiles you need, and /usr/linux-source-blah seems irrelevant.
Run basic make commands in the correct places:

     # cd /usr/src/linux-headers-3.5.0-2-linaro-omap
     # make scripts
     # cd ~/build/linux-omap-3.5
     # ~/get_config
     # make ARCH=arm CROSS_COMPILE="" omap2plus_defconfig

* Make sure your top level Makefile agrees with your kernel
  (thanks to the kernel module Programming Guide: http://linux.die.net/lkmpg/x380.html)

     # cd ~/build/linux-omap-3.5
     # uname -r
     3.5.0-2-linaro-omap
     # head Makefile
     VERSION = 3
     PATCHLEVEL = 5
     SUBLEVEL = 0
     EXTRAVERSION = -2-linaro-omap

     Edit the Makefile if necessary, using vi if you have not installed anything else.
     Note that EXTRAVERSION is a string that holds everything after the N.N.N pattern.

* Make modules, just to be sure stuff builds.  You can ^C out after a few compiles work.
Modules built this way will not load into your kernel.  This is just a quick check that
everything is in place.

     # cd ~/build/linux-omap-3.5
     # make ARCH=arm CROSS_COMPILE="" modules

* Now make the modules you care about.  This form of the Make command sets your build environment
to the -C path but points back your sources via the M path.

     # cd ~/build/linux-omap-3.5/drivers/usb/gadget
     # make ARCH=arm CROSS_COMPILE="" -C /lib/modules/3.5.0-2-linaro-omap/build M=`pwd` modules
     ...
     CC      /root/build/linux-omap-3.5/drivers/usb/gadget/g_printer.mod.o
     LD [M]  /root/build/linux-omap-3.5/drivers/usb/gadget/g_printer.ko
     ...

(thanks to: http://forums.opensuse.org/english/other-forums/development/programming-scripting/427677-kernel-module-devlopment-insmod-issues.html)

* Try your module

     # insmod g_printer.ko
     # lsmod
     Module                  Size  Used by
     g_printer              30375  0

If insmod fails, look in dmesg for detailed error messages and Google them.

That's my guide to native kernel module compilation on Linaro.

Thanks,
Larry
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linaro linux-source has no makefiles - help?

emann
Thanks for posting your guide. I followed these steps and I am now able to build the gpio-event-driver (there were lots of missing header files before doing this).
Loading...