Author Topic: Compiling modules and drivers (and c programs)  (Read 7533 times)

ehagerup1

  • Guest
Compiling modules and drivers (and c programs)
« on: January 14, 2010, 04:41:23 pm »
In case this helps anyone else here are the steps I took to allow me to compile drivers and modules on the GadgetPC as well as C and C++ programs.  I by no means am a linux expert and if anyone notices any ways I could have improved the process let me know.  I\'m always looking to learn new things to learn:

update-initramfs -c -k 2.6.30.4\\
plug in usb drive to ubuntu virtual
copy full source directory of ~/linux/2.6.30.4 to /media/EXT3/usr/src/
ie: cp -r ~/linux/2.6.30.4 /media/EXT3/usr/src/
ln -s /usr/src/2.6.30.4/ /lib/modules/2.6.30.4/build
execute "apt-get install make gcc"
or if you don\'t have internet yet on it you can download the .deb files for the debian repositories and execut:
"dpkg -i filename"
Be prepaired to deal with a long chain of dependencies.  Also make sure to download the armel packagess

You should now be able to execute the make command.

You may encounter issues with running out of RAM when compiling some things.  To fix do the following:

Back on the virtual execute the . ~/linux30.sh script again.
When you get to the configuration find the option to enable swap.  Can\'t remember where it is, but it is in there somewhere.
save config
Execute "make"
when complete copy the uImage over the old uImage in the FAT partition.
Next, find another usb drive, or if you still have room on your original one you can use that.
plug it into the ubuntu virtual
execute "sudo fdisk /dev/sdc" or whichever letter was assigned to the drive.
execute "n"
execute "p"
execute partition number "1" or other if that is already used
specify the blocks you want it on.
execute "t"
select the partition number
execute "82"
execute "w"
you can now remove the flash drive
boot the gadget pc and insert the second flash drive.

ehagerup1

  • Guest
Re: Compiling modules and drivers (and c programs)
« Reply #1 on: January 14, 2010, 04:43:35 pm »
ran out of chars:

boot the gadget pc and insert the second flash drive.
Make a swap drive by execuring "mkswap /dev/sdb1" or appropriate drive name assigned by OS.
execute "swapon /dev/sdb1" or appropriate drive name assigned by OS.
You will now have as much memory as you need (up to ~4 gb as addressible by 32bit CPU".  Verify by executing "top"


Also, I was messing around with c# on it (mono) and was quite impressed with its performance. Was able to run my Kalman filter program which contains *A LOT* of math including pricey power and sqrt functions at over 400 hertz.

Also, to the GadgetPC developers, can you outline your driver compilation process for the ARM 9?
« Last Edit: January 14, 2010, 04:45:19 pm by ehagerup1 »

vitaliy

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: Compiling modules and drivers (and c programs)
« Reply #2 on: January 15, 2010, 02:23:56 am »
Quote
Also, to the GadgetPC developers, can you outline your driver compilation process for the ARM 9?

Usually, we compile driver sources on a PC wmware ubuntu platform using a cross-compiler



Brytano15

  • Guest
Re: Compiling modules and drivers (and c programs)
« Reply #3 on: January 24, 2010, 01:06:08 am »
I think he is requesting more information than that. I am also wondering, I am considering to develope a lot for the gadgetpc.

vitaliy

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: Compiling modules and drivers (and c programs)
« Reply #4 on: January 24, 2010, 12:57:12 pm »
For example, to compile a driver for Sierra USB modem
the following screenshot shows a typical scenario
http://www.bipom.com/support/gadgetpc/sierra.png
« Last Edit: January 24, 2010, 12:57:35 pm by vitaliy »

steveukman

  • Guest
Re: Compiling modules and drivers (and c programs)
« Reply #5 on: May 26, 2010, 02:13:22 pm »
Great post ... thanks.
I am curious about getting mono installed on the GadgetPC.  How easy was it to cross compile the binaries?  I am finding the process somewhat challenging.  I have some avionics telemetry code in C# that I would really like to port over, so any tips on getting mono running would be great.
Thanks
Steve

vitaliy

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: Compiling modules and drivers (and c programs)
« Reply #6 on: May 29, 2010, 03:14:55 am »
Quote
I am curious about getting mono installed on the GadgetPC.  How easy was it to cross compile the binaries?
Note, GadgetPC can run Debian installation.
I guess the fastest way is to try to install \'mono\' under Debian using standard methods

apt-get install monodevelop nunit mono-devel
apt-get install monodoc

Also, no needs to cross compile. It is possible to compile
on GadgetPC using a native gcc compiler.

I don\'t know if GPC resources will be enough to run \'mono\' virtual machine. It is only 32 MB system.




jdac

  • Guest
Re: Compiling modules and drivers (and c programs)
« Reply #7 on: May 31, 2010, 03:24:00 am »
Hi!
I\'m confused about how to obtain a working compiler for Debian:

1) When using the "advanced" method of installing Debian, not using Virtual Machines but instead downloading the following files from the ftp:

Linux kernel: linux2.6.30.4_18May2010.tar.bz2
RootFS (Debian Lenny): debian_rootfs_22Feb2010.tar.bz2

then, when i try "apt-get install gcc" some packages get downloaded and then i get a "file not found" from apt-get, because the files it tries to fetch aren\'t in the repository, and i\'m not sure what to do next.
Should i try an older kernel/rootFS combination?
If so, which one is known to be "problem free" when installing gcc natively on the GadgetPC?
and

2) I\'m not clear whether the Ubuntu Virtual Machine that can be downloaded from the ftp (i downloaded UbuntuARM_Rev102_28Oct2009) already has the cross-compiler installed or is separate installation required? The "gcc" in that VM generates regular intel binaries according to the "file" command, and i don\'t know if there\'s a cross-compiler somewhere around already that i\'m missing

Thanks!

vitaliy

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: Compiling modules and drivers (and c programs)
« Reply #8 on: May 31, 2010, 08:59:10 am »
Quote
then, when i try "apt-get install gcc" some packages get downloaded and then i get a "file not found" from apt-get, because the files it tries to fetch aren\'t in the repository, and i\'m not sure what to do next.

Try

chmod -R a+w /var/cache/man
mkdir -p /var/log/apt/
apt-get update
apt-get install build-essential

Quote
2) I\'m not clear whether the Ubuntu Virtual Machine that can be downloaded from the ftp (i downloaded UbuntuARM_Rev102_28Oct2009) already has the cross-compiler installed or is separate installation required? The "gcc" in that VM generates regular intel binaries according to the "file" command, and i don\'t know if there\'s a cross-compiler somewhere around already that i\'m missing

A cross-compiler is pre-installed
Of course, if you run gcc it will run a native x86 compiler
To complie for Gadget PC you need to run a cross-compiler for ARM.
Please look at /home/mini/app/hello . This is a test example with a correct make file.
To compile you need to execute the following commands
cd /home/mini/app/hello
make clean
make

Note, you can compile Linux executables for GadgetPC under Windows
using ARM development system from BiPOM. It\'s FREE



« Last Edit: May 31, 2010, 09:00:11 am by vitaliy »

steveukman

  • Guest
Re: Compiling modules and drivers (and c programs)
« Reply #9 on: June 01, 2010, 02:03:34 pm »
Vitaliy,

Thanks for the suggestions on apt-getting the mono package onto a Debian-Gadget.  That certainly seems much easier than building the runtime per the mono site suggestions.  I have quite an investment in C# utilities that I would like to port if possible, so it is worth the experimentation to to me to try and get a CLI runtime.
Thanks
Steve

jdac

  • Guest
Re: Compiling modules and drivers (and c programs)
« Reply #10 on: June 13, 2010, 08:46:56 pm »
Thanks for all your help Mr Vitaliy, I was able to install the build-essential package (along with gcc,g++,make and all the other good stuff in it)  without problems with your help.