OpenWrt Forum Archive

Topic: Setup a development environment for OpenWrt with the VMware Player

The content of this topic has been archived between 18 Aug 2016 and 21 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Setup a development environment for OpenWrt with the VMware Player


Setup a development environment for OpenWrt on Windows using a Virtual Maschine (VMware Player).


1. download and install the free VMware Player for Windows

2. download a official and free Ubuntu VMware image (743MB, username: ubuntu/password: ubuntu)
Mirror: http://nbd.name/files/Ubuntu-6.06.1-desktop-i386.zip (thanks nbd!)

3. double click the Ubuntu-6.06.1-desktop-i386.vmx file (use bridged networking (default) - a working DHCP server is required)

4. install some extra packages with the Synaptic package manager (maybe it's a good idea to enable the multiverse and universe repositories too)
gcc g++ binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils subversion libncurses5-dev ncurses-term zlib1g-dev

5. upgrade Ubuntu (recommended)

6. checkout WhiteRussian's latest, stable source code from the subversion branch

cd ~
svn co https://svn.openwrt.org/openwrt/branches/whiterussian/openwrt/ whiterussian

7. run menuconfig, than just select exit and yes (this is the default config)

cd ~/whiterussian
make menuconfig

8. build WhiteRussian

make world

9. after some time the build is finished and the images are in the bin/ directory and packages are in bin/packages/

Have fun and peace smile

(Last edited by forum2006 on 6 May 2007, 17:23)

Use the package repository (~/whiterussian/bin/packages/ directory) from within your Virtual Maschine

1. install the apache2 package

2. create a public_html directory and make sure it has the right permissions

cd ~
mkdir public_html
chmod 0755 public_html

3. create a symbolic link to your package directory

cd ~/public_html
ln -sf ~/whiterussian/bin whiterussian

4. on the router you have to do the following
4.1. change /etc/ipkg.conf file to (only the first line have to be changed):

src whiterussian http://ubuntu-desktop/~ubuntu/whiterussian/packages
src non-free http://downloads.openwrt.org/whiterussian/packages/non-free
dest root /
dest ram /tmp

4.2. run

ipkg update

4.3. now you can install packages from your local package repository you just build

ipkg install foobar

(Last edited by forum2006 on 3 Dec 2006, 14:35)

Disable the useless GDB build (optional):

Index: toolchain/Makefile
===================================================================
--- toolchain/Makefile    (revision 5755)
+++ toolchain/Makefile    (working copy)
@@ -1,6 +1,6 @@
 # Main makefile for the toolchain
 include $(TOPDIR)/rules.mk
-TARGETS:=sed utils binutils gcc uClibc ipkg-utils gdb
+TARGETS:=sed utils binutils gcc uClibc ipkg-utils
 
 TARGETS_INSTALL:=$(patsubst %,%-install,$(TARGETS))
 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))

Setup a local download mirror for the source tarballs

I found it annoying to download the source tarballs every time I build WhiteRussian. So, I decided to write a small patch.

Index: scripts/download.pl
===================================================================
--- scripts/download.pl    (revision 5755)
+++ scripts/download.pl    (working copy)
@@ -9,6 +9,7 @@
 use strict;
 use warnings;
 
+my @LOCAL_SITES = ( "http://localhost/~ubuntu/sources" );
 my $target = shift @ARGV;
 my $filename = shift @ARGV;
 my $md5sum = shift @ARGV;
@@ -77,7 +78,7 @@
     unlink "$target/$filename.md5sum";
 }
 
-foreach my $mirror (@ARGV) {
+foreach my $mirror (@LOCAL_SITES, @ARGV) {
     if ($mirror =~ /^\@SF\/(.+)$/) {
         # give sourceforge a few more tries, because it redirects to different mirrors
         for (1 .. 5) {
cd ~/whiterussian
patch -p0 < local-download.patch

Once you have finished a build copy the downloaded tarballs from ~/whiterussian/dl/ to your webservers directory:

cd ~/whiterussian/dl
mkdir -p ~/public_html/sources
cp -fpR * ~/public_html/sources

Next time you start a new build with the same packages selected it downloads the source tarballs from your local webserver (e.g. http://localhost/~ubuntu/sources). If it doesn't find a file it tries to download it from the internet.

(Last edited by forum2006 on 11 Dec 2006, 18:45)

Once you have done a full build and changed minor things in the packages or the kernel you do not have to rebuild the full buildroot (including the toolchain) again.

To rebuild just the packages and the kernel after your changes do:

make clean world

This leaves the toolchain untouched.

(Last edited by forum2006 on 16 Dec 2006, 19:13)

forum2006 wrote:

I found it annoying to download the source tarballs every time I build WhiteRussian

Alternative approach: just create a symlink from 'dl' to a fixed place on your system, e.g.

$ cd path/to/openwrt
$ mkdir ~/openwrt-dl
$ ln -s ~/openwrt-dl dl

If you zap and re-untar the source, remember to add this symlink in each time.

HI Forum2006,

I am really a new babie, kind like that Feisty. :-)

I just folowed your guide and start the journey.

Can you help to clarify several dummiy questions?
1. What's the good description of the difference among ImageBuilder, SDK, and Whiterussian.tar.bz2 and your SVN CO?

Imagebuilder: I tried it several times. it seems a tool for us to create our own .bin .trx image with selected ipk packages along with given kennerl files The major benefit would be to save some space and tailor to our own. Anthing else?

Please spend a couple of your valuable minutes for help.

Happy holidays!
Peng

BTW, I really need a mentor.... on this.

HI,

What's the difference of using "make world" and "make"?

thanks
peng

What is wrong with SVN repository???

>> svn co https://svn.openwrt.org/openwrt/branches/whiterussian/openwrt/ whiterussian

svn: REPORT request failed on '/openwrt/!svn/vcc/default'
svn: REPORT of '/openwrt/!svn/vcc/default': 400 Bad Request (https://svn.openwrt.org)

Must have been a blip, it works for me at the moment.

$ svn co https://svn.openwrt.org/openwrt/branches/whiterussian/openwrt/ whiterussian
Error validating server certificate for 'https://svn.openwrt.org:443':
 - The certificate hostname does not match.
Certificate information:
 - Hostname: openwrt.org
 - Valid: from Oct 22 14:48:20 2006 GMT until Oct 23 14:48:20 2007 GMT
 - Issuer: Equifax Secure Inc., US
 - Fingerprint: e6:a2:a6:4d:ad:ff:b4:00:11:ba:a7:80:c4:cd:1d:1a:d3:0b:83:88
(R)eject, accept (t)emporarily or accept (p)ermanently? p
A    whiterussian/rules.mk
A    whiterussian/toolchain
A    whiterussian/toolchain/utils
A    whiterussian/toolchain/utils/include
A    whiterussian/toolchain/utils/include/elf.h
...

Shooot, it must be me, I'm still getting that error, but funny - it only happens on the Linux box, tortoisSVN works fine from an XP box?

Grrr any help? I have no idea whats up, I do know it is NOT the repository any longer as the XP svn works fine, it is something with the Limux but I have been using the same exact machine for over a year. Always worked just fine smile

Thanks
Boyan

[root@nagios root]# svn co https://svn.openwrt.org/openwrt/branches/whiterussian/openwrt/ whiterussian
svn: REPORT request failed on '/openwrt/!svn/vcc/default'
svn: REPORT of '/openwrt/!svn/vcc/default': 400 Bad Request (https://svn.openwrt.org)
[root@nagios root]#

(Last edited by ds18s20 on 23 Jan 2007, 05:12)

What sort of Linux box? Mine is Ubuntu 6.06

$ svn --version
svn, version 1.3.1 (r19032)
   compiled May  8 2006, 07:38:44

Copyright (C) 2000-2006 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).
The following repository access (RA) modules are available:

* ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol.
  - handles 'http' scheme
  - handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme

Check if your version is the same, and that it does have https support compiled in.

The only other possibility I can think of is maybe your Linux box is behind some sort of transparent proxy, and the 400 error is coming from the proxy, not the remote server. However this is unlikely given that it should be an SSL-protected session

# svn --version
svn, version 1.4.2 (r22196)
   compiled Jan 23 2007, 08:56:53

Copyright (C) 2000-2006 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).

The following repository access (RA) modules are available:

* ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol.
  - handles 'http' scheme
  - handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme

Very strange, it looks like mine does have all those modules compiled and even it is a latter version but still no go. I will take the machine to another network and see if it works. It is Redhad 9

It is Redhad 9

Ah, an archaeologist smile Also worth checking how up-to-date your openssl is.

/bin/busybox httpd -p 80 -h /home/foo/trunk/bin/packages

(much easier than bothering to use apache for something so simple)

- presumes your distro includes busybox (at least gentoo and debian/ubuntu do)

Shouldnt there be a way to just install openwrt without a full linux ubuntu install? Dont quite thing it needs kde..

Hi,

What one could do in this situation is use a Ubuntu Mini CD image, install debootstrap and do it that way.  Be aware that this guide is quite advanced.

A few conventions - anything that is in a code block is to be executed by you.  If any lines in the code block have a pound sign (#) inside it, you don't have to type it, but if you do nothing will happen - it's a comment.

Here's the steps I took:

1) Go to http://www.crealabs.it/ubuntu-mini-remix/ and download any image - the latest image would be the best one.

2) If you're going to use VMware Player, go to http://www.easyvmx.com/new-easyvmx.shtml to generate a .vmx file and corresponding hard drive images (you'll need at least 6gb for the system and a build environment, and get the path you downloaded the Ubuntu Mini ISO to and set that up as the CD-ROM).  Otherwise, just create the VM in whatever VMware/VirtualBox/etc product you use.  I recommend using SCSI drives (this guide assumes you have) and a minimum of 512mb of RAM.

3) Boot the new VM and select "Try Ubuntu without changing my computer".  Go grab something to drink - this will take a few minutes.

4) You may find that it gets stuck on the loading screen.  Hit Alt+F1 and you'll be greeted by a friendly... terminal.

5) The following is optional and saves putting 'sudo' in front of everything, but you can do that if you wish:

sudo su -

6) Open the disk partitioner with the following command (I recommend having twice your RAM allocation for swap and the rest for root.  Some basic math will cover this.)

cfdisk

Be sure to set the first partition as bootable.  Write and quit.

7) Create a new ext3 filesystem on the root partition, format the swap on the swap partition and enable the swap partition now:

mkfs -j /dev/sda1
mkswap /dev/sda2
swapon /dev/sda2

8) At the time of writing, the latest image was for Intrepid (8.10).  It would be better if we were using the Jaunty (9.04) repositories, so let's set them up and update the local package lists:

cat >/etc/apt/sources.list <<EOF
deb http://archive.ubuntu.com/ubuntu jaunty main
EOF
apt-get update

9) Let's install debootstrap - it'll ask for a few dependencies to be updated, it's safe to allow them:

apt-get install debootstrap

10) Now comes the fun bit.  Let's mount the root partition and start the process off.  Once it starts, you might want to go and do something else for awhile, this can take some time depending on how fast your Internet connection is:

mount /dev/sda1 /mnt
debootstrap /mnt jaunty

If you wish to connect to a different repository, add the address for this as an extra parameter.  For instance, if you wish to use Ubuntu's AARNet mirror as the repository, the last command becomes:

debootstrap /mnt jaunty http://mirror.aarnet.edu.au/ubuntu

11) It gets more fun.  Once this is done, you will need to add a few more packages to the new setup.  Let's set up an environment and change the root directory to enter our new environment:

cp /etc/apt/sources.list /mnt/etc/apt
mount --bind /proc /mnt/proc
mount --bind /dev /mnt/dev
chroot /mnt

This allows access to the /proc directory (for the kernel install to create the initial ram disk) and the /dev directory (so grub knows where to find hard drives).

12) Let's update the package list and install the required packages:

apt-get update
apt-get install build-essential bison libncurses5-dev ncurses-term zlib1g-dev unzip subversion linux-image-2.6-386 grub patch bzip2 flex autoconf gettext texinfo sharutils libncurses5-dev

13) Next you'll need to set up grub to boot your new system:

mkdir /boot/grub
cp /usr/lib/grub/i386-pc/stage{1,2} /boot/grub
cp /usr/lib/grub/i386-pc/e2fs_stage1_5 /boot/grub
cat >/boot/grub/menu.lst <<EOF
default 0
timeout 2
title whaddayathink
root (hd0,0)
kernel $(echo vmlinuz*) root=/dev/sda1
initrd $(echo initrd.img*)
EOF
grub

Once in grub, type the following to set up your new system:

root (hd0,0)
setup (hd0)
quit

14) Finally, we'll set a few configuration options and leave the environment:

# Enter your password for the root account
passwd root
# You'll need an unpriviledged account to build OpenWrt:
adduser builder
# Pick a name for your building VM:
hostname constructor
# Set up hard drive mounts
cat >/etc/fstab <<EOF
/dev/sda1       /       ext3    defaults        0       1
/dev/sda2       none    swap    defaults        0       0
exit

15) Restart, and boot into your new system:

shutdown -r now

(Last edited by thirdwheel on 21 Aug 2009, 06:40)

it is possible to play with qemu on those firmware

  A demo with openwrt-kamikaze-8.09 or  dd-wrt-v24 is shown here :
http://wjhowto.googlepages.com/runningo … -wrtinqemu

  use untrx and unsquashfs-lzma to extract the rootfs 
(get tools from http://www.bitsum.com/files/firmware_mod_tools.tar.gz )
qemu-mipsel-static from http://dev.openbossa.org/mamona/qemu/

screenshots
   kamikaze :  http://wjhowto.googlepages.com/QEMU-Tes … e-8.09.png
   dd-wrt :     http://wjhowto.googlepages.com/qemu-puppy-dd-wrt24.png

(Last edited by wj on 22 Sep 2009, 13:19)

This is a pretty old guide but is still sticky'D, so I thought a mod or the op could update it?

Section 2) remove the mirror link and update the original link to this appliance: (Ubuntu 8.04 LTS login: user/user)
http://www.vmware.com/appliances/directory/128623

Section 4) Give a specfic command line to run the package installs:
sudo apt-get install gcc g++ binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils subversion libncurses5-dev ncurses-term zlib1g-dev gawk

Section 6) Replace outdated SVN instructions:
Backfire 10.03 branch:
svn co svn://svn.openwrt.org/openwrt/branches/backfire

or
Kamikaze 8.09 branch
svn co svn://svn.openwrt.org/openwrt/branches/8.09

Section 7) update cd ~/whiterussian to appropriate directory

Neither of the vmware image links are valid, can I use any Ubuntu 8.04 LTS release or were these special packages that had applications preinstalled for the purpose of this guide?  I searched the vmware site for 8.04 LTS and the download size is much smaller than what was originally posted.

*edit* Nevermind, I went ahead and just downloaded unbuntu 10.04 LTS, ran updates and installed the necessary packages.  Everything seems to be working OK, though the appliance logged me in as root and it caused the make menuconfig to fail as it doesn't like you running it as root.

Given how old this guide is I think things have changed, the guide doesn't mention anything about the OpenWrt selection screen.

(Last edited by fusioncases on 19 Aug 2010, 15:41)

Thanks for the information.But after installing the Wm player where do i get the white russian's latest stable code?

hi guys,
anyone had any problem with gdbserver?i have followed: http://wiki.openwrt.org/doc/devel/gdb



in menuconfig enable gdb

Advanced configuration options (for developers) → Toolchain Options → Build gdb
and gdbserver

Utilities → gdbserver


however when i try to start it :

root@OpenWrt:/# gdbserver
/bin/ash: gdbserver: not found


any hidden step that went missing?

Uhm yes, you need to isntall the generated gdbserver package on the target...