supernoob
Posts: 8
Joined: Tue Jun 19, 2012 4:25 pm

Start coding with vbox simulator

Tue Jun 19, 2012 4:43 pm

Hi all.
A premise: sorry for the banality of questions but I have no idea where to start :shock: .

I already wrote programs using C but I've never used (seriously) linux.
I place a preorder for an RPI and, just to not waste time I start with RPI virtualbox emulator from nick's post http://www.raspberrypi.org/phpBB3/viewt ... f=9&t=2961

All work fine. Thanks to nick's work I have the qemu-rpi working 8-)
Now, I need to know:
1] does rpi machine has the capability to execute python scripts? Python seems to be not installed.
2] how I could transfer file from host to qemu fs ?
3] what about developing and debugging C program for RPI simulator ?
4] is there a way to check/simulate behaviour of GPIOs (something like "led bitmap")?

THANKS to all !
Regards

antiloquax
Posts: 406
Joined: Sun Nov 20, 2011 11:37 am
Contact: Website

Re: Start coding with vbox simulator

Wed Jun 20, 2012 4:10 am

supernoob wrote: 1] does rpi machine has the capability to execute python scripts? Python seems to be not installed.
Which OS are you using? Debian has Python already installed. For Arch you'll need to do

Code: Select all

pacman -S python
To check, at a terminal, type:

Code: Select all

python
if Python is there and you are in the directory where a Python program (called hello.py, for example) is saved, you can run it by typing:

Code: Select all

 python hello.py

2] how I could transfer file from host to qemu fs ?
There are various ways. The easiest is to mount the filesystem (when not running qemu). First, make a directory in /mnt (called "qemu" or something). Then, if you are in the directory where the filesystem image is saved (as RPi.img, for example), type:

Code: Select all

mount RPi.img /mnt/qemu
You can the work directly on the file-system - moving files in and out. When you are done, do:

Code: Select all

umount /mnt/qemu
and start qemu

supernoob
Posts: 8
Joined: Tue Jun 19, 2012 4:25 pm

Re: Start coding with vbox simulator

Wed Jun 20, 2012 8:12 am

Thanks for your answer :D .

2]
qemu image is a .qcow2...
when I try with

Code: Select all

sudo mkdir /mnt/shared
sudo mount debian.qcow2 /mnt/shared
I get

Code: Select all

mount: /home/rpi/debian/debian.qcow2 is not a block device (maybe try `-o loop'?)
How I could solve ?
Many thanks!!!

ghans
Posts: 7880
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Start coding with vbox simulator

Wed Jun 20, 2012 9:51 am

I'm pretty sure you can't mount qcow2 images under linux yet.

In your virtual arm-qemu machine type:

Code: Select all

 sudo apt-get install openssh-server 
perhaps it's already installed. Shutdown the qemu-arm VM.

And then restart the qemu-arm vm with TCP Port redirection. (Look in the Manpages or online) . Port 22 should be enough.

On your host , select "connect to network drive" and select either SFTP or SSH in your GUI.
Type "localhost" as adress.
Enter root user and password.
Ta Da !

You've now mounted the drive of your VM !

Bonus : you can use the VM and its drive at the same time !

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

antiloquax
Posts: 406
Joined: Sun Nov 20, 2011 11:37 am
Contact: Website

Re: Start coding with vbox simulator

Wed Jun 20, 2012 10:40 am

Thanks ghans - that's a very useful tip!
mark

ghans
Posts: 7880
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Start coding with vbox simulator

Thu Jun 21, 2012 12:10 pm

As for debugging , you may use , of course, use the GNU debugger gdb.
Or download Eclipse CDT - a popular IDE (will be very slow) .
Then there is Code::Blocks , then there is NetBeans (NB: Not tested any of them)

For the time being stick to Geany (vim ! emacs !) and commandline development ? IDK

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

supernoob
Posts: 8
Joined: Tue Jun 19, 2012 4:25 pm

Re: Start coding with vbox simulator

Wed Aug 01, 2012 1:38 pm

I did not find a method to deal with network management.
So I solve the problem in other way: :D
1] redirecting hostport 3232 to guestport22 with:

Code: Select all

-redir tcp:3232::22
So, launchDebian script should be modified (with: sudo leafpad launchDebian) with:

Code: Select all

sudo qemu-system-arm -M versatilepb -cpu arm1176 -m 256 -hda debian.qcow2 -kernel zImageDeb -append "root=/dev/sda" -usbdevice tablet -redir tcp:3232::22
2] installing SSH on guest and SSHFS on host machine
3] creating a new dir inside /media (/media/rpi)
4] mounting guest's /home in /media/rpi with:

Code: Select all

sudo sshfs root@localhost:/home /media/ras_pi -p 3232
Password is always the same: "password" :lol:

Have FUN,
Supernoob

P.S.
I work behind a proxy. So, in order to work with apt-get, I have to made some changes..
HOST:
I've created the file /etc/apt.conf and wrote:

Code: Select all

Acquire::http::proxy "http://user:password@proxyserver:port";
GUEST:
I've modified the file /etc/bash.bashrc with

Code: Select all

export http_proxy=http://username:password@proxyserver.net:port/
export ftp_proxy=http://username:password@proxyserver.netport/

ghans
Posts: 7880
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Start coding with vbox simulator

Sun Aug 05, 2012 11:05 am

Hello again supernoob,
nice to see that you got everything working.

Admin request - Please change the topic : This way of developing apps has nothing to do with vbox (VirtualBox)
and therefore could be mistaken for the popular solution which really uses that specific virtualization software.

@supernoob
Do you have settled for any IDE ?
I forgot to mention scratchbox2 (which is not a IDE) , a very useful tool for cross-developing.
What is the problem you faced with port redirection ?

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

supernoob
Posts: 8
Joined: Tue Jun 19, 2012 4:25 pm

Re: Start coding with vbox simulator

Fri Aug 10, 2012 8:32 am

Hi ghans,
nice to meet you again.

No, for the moment I haven't any IDE..
To be honest, I was searching the way to use X (that is not present).
How I could install it ??

So, I migrate to another qemu images (running on windows) that have X installed.
May be they are different distros ?

By the way, the problem I'm faceing now is keyboard :o .
There's no way (obviously for me :cry: ) to get the pipe.. I read a lot of howto but nothing works.
I also try to modify /etc/default/keyboard and restart X without success.
HOW I can do...

Working with linux is very interesting but often frustrating.
There are many very confused (for me obviously :? ) information on the internet...
Often it is not clear if a hint only works on a certain distribution or even on other ...
Often hints are very technical and difficult to understand...

In short, this is life from supernoob ... :D

ghans
Posts: 7880
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Start coding with vbox simulator

Fri Aug 10, 2012 9:26 am

I hope you are using Debian ! Please make sure .

Else , this

Code: Select all

sudo dpkg-reconfigure keyboard-configuration
setxkbmap us
might not work and just confuse you further ;)

You can check if X11 is available by typing startx .

Else

Code: Select all

sudo apt-get update
apt-get install lxde
should give you LXDE (which means X11 and a desktop enviroment)

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

supernoob
Posts: 8
Joined: Tue Jun 19, 2012 4:25 pm

Re: Start coding with vbox simulator

Wed Aug 22, 2012 11:08 am

Thanks Ghans.
Yes I have Debian. All was ok with apt-get install lxde.

I've received the board and I'm entusiast !

In order to not make mistakes while learning, I have created a new user and associate it to some groups.
I did a copy of all file and folder of user <pi> (including hidden files as .bashrc .dbus and so on)

The bad is that new user do not have same look of default user.
In fact, prompt and color associated to filetypes and so on is different...

What I'm doing wrong ?

I googled a lot. Sorry for the very stupid question..

Return to “General programming discussion”