cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ccdoss
Participant
Participant
7,748 Views
Registered: ‎10-24-2008

Built Linux...Now what?

Hello,

 

I have built Linux for Xilinx according to the instructions on http://xilinx.wikidot.com. I am using a ML405, and used the base configuration (DTS) that comes with the xilinx kernel.

 

I'd like to ultimately create apps that host USB devices through the Cypress USB controller. I see that the drivers are there in the kernel. However, I'm not sure how to make sure the kernel can see the EPC peripheral.

 

How do I create applications to interact with the peripherals on the board?

0 Kudos
Reply
10 Replies
vneethv
Participant
Participant
7,722 Views
Registered: ‎05-31-2010

If the driver is already present in the kernel, then u gotta write the app and put it as a part of the ramdisk.

then download the ramdisk and start working !!

0 Kudos
Reply
ccdoss
Participant
Participant
7,701 Views
Registered: ‎10-24-2008

Thank you for the response. I guess my next question is how does one create linux apps that use drivers. I've created apps before, but not that use drivers. I am guessing I may need to use embedded linux development. I have and am searching for some docs and tutorials on this, but any pointers you may have that could shorten the process would be greatly appreciated.

0 Kudos
Reply
linnj
Xilinx Employee
Xilinx Employee
7,698 Views
Registered: ‎09-10-2008

In my opinion now you should be buying some embedded linux books or finding some tutorials on the web as we can't teach all that in a forum.

 

If you go to free-electrons.com/docs they have a bunch of good tutorials.  I also recommend Embedded Linux Primer, the book.  There's a lot of information out there that will help, but it takes some digging.

 

Thanks.

 

 

0 Kudos
Reply
ccdoss
Participant
Participant
7,650 Views
Registered: ‎10-24-2008

Thank you for the free-electrons.com reference. I am going through the tutorials now. I do have one more question, though.

I've built the kernel, and have now built the requisite "hello world" application. How do I download the program to the board? Do I need to make it part of the kernel and/or ramdisk elf, or download it separately?

0 Kudos
Reply
vneethv
Participant
Participant
7,627 Views
Registered: ‎05-31-2010

you gotta download a ramdisk; put ur application anywhere in that ..and compile the simpleImage with ramdisk..or use the uramdisk..

once linux's up..u can simply browse to the application location from the shell and execute it,,

0 Kudos
Reply
ccdoss
Participant
Participant
7,594 Views
Registered: ‎10-24-2008

Okay, here's what I did:

  1. Created "helloworld.c" file.
  2. Compiled using ELDK commands: ppc_4xx-gcc -o hello helloworld.c
  3. Tried to execute hello on my Ubuntu system. It said it can't execute binary (expected since I cross compiled).
  4. Created a new file system by doing commands in box below.
  5. Before copying, I copied my hello executable to the /mnt/old-disk/bin directory.
  6. mv ramdisk.image.gz arch/powerpc/boot
  7. I then compiled the linux kernel and loaded onto the board.
  8. I looked in contents of bin directory, and was "hello" executable was there.
  9. I then cd /bin, and issued ./hello command. I received a command not found error.

What am I doing wrong?

    dd if=/dev/zero of=initrd.img bs=1M count=8
    mke2fs -F -v -m0 initrd.img
    mkdir /mnt/new-disk
    mount -o loop initrd.img /mnt/new-disk

    mkdir /mnt/old-disk
    gunzip ramdisk.image.gz
    mount -o loop ramdisk.image /mnt/old-disk

    cp -rf /mnt/old-disk/* /mnt/new-disk
    umount /mnt/old-disk
    umount /mnt/new-disk

    gzip -9 initrd.img
    mv initrd.img ramdisk.image.gz

mkdir /mnt/new-disk
mount -o loop initrd.img /mnt/new-disk

0 Kudos
Reply
vneethv
Participant
Participant
7,590 Views
Registered: ‎05-31-2010

while compiling the helloworld.c use -statis keyword.

statically link the code..the libraries mightnt be available in ur ramdisk..! juz have a try..

0 Kudos
Reply
vneethv
Participant
Participant
7,589 Views
Registered: ‎05-31-2010

sorry..spelling mistake :)

 

i meant

 

ppc_4xx-gcc -o hello -static helloworld.c

0 Kudos
Reply
ccdoss
Participant
Participant
7,580 Views
Registered: ‎10-24-2008

WOW!! That worked!!! Of course, my helloworld program is 800K, but it works.

0 Kudos
Reply
timo-ge
Explorer
Explorer
2,250 Views
Registered: ‎11-12-2007

The next interesting point to me would be,  where to copy which libraries  to the ramdisk to avoid static linking. 

0 Kudos
Reply