Guide to Hacking the OSD: Workstation Setup
From The Neuros Technology Wiki
|Previous Chapter||Table of Contents||Next Chapter|
This chapter is fairly Debian-specific. I've provided generic ways to perform these steps where possible. Your help in adding details for your preferred distro is much appreciated.
This thread on LinuxQuestions.org addresses how to open the firewall for NFS on RedHat Linux.
System Dependencies for Compilation
(NOTE: you need to follow this step only if you are not using the Virtual Machine Development Environment)
The following is a list of system dependencies that are required for setting up the OSD environment on your PC. Make sure that these packages are installed prior to setting up your development environment. If you're using a Mac, you can find alternative instructions on the MacWorkstationSetup page.
- ncurses (generally you want ncurses-dev too)
- lrelease (found in Qt developlment tools Debian/Ubuntu qt4-dev-tools )
- lupdate (found in Qt development tools Debian/Ubuntu qt4-dev-tools )
Configuring serial communications with the OSD
(Only in rare cases you might want to skip this step. That is, if you don't care about changing uboot parameters and doing all you work from telnet is ok for you)
In order to see and interact with the OSD's debug console, you'll need a serial communications program. This guide covers one called Minicom. If you're running Debian (or most Debian-based distros), you can apt-get install minicom. If you're using a Mac, you can find alternative instructions on the MacWorkstationSetup page.
One alternative program you can use is kermit. Skip this section and see the kermit configuration page for more information on this other program if you are using it.
You'll need to be a member of the dialout group in order to use the serial ports. If you're not a member already (use id to check), add yourself.
Next, determine the name of the serial device you connected the OSD to. Standard PC serial ports are called ttyS0, ttyS1, etc. If you've connected the OSD to a port on the back of your machine, it's probably one of those. USB serial devices are called ttyUSB0, ttyUSB1, etc. You can check dmesg for help:
anthony@Feynman:~$ dmesg | grep tty serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A 00:07: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A usb 2-4: pl2303 converter now attached to ttyUSB0
My OSD is connected to the USB serial adaptor, which the kernel has kindly told us is ttyUSB0. In front of the device name, put /dev giving the full name of /dev/ttyUSB0.
With that settled, it's time to actually configure Minicom. Replace ttyUSB0 with whatever your serial port is called:
- Run minicom -s /dev/ttyUSB0
- Select "Serial port setup"
- If "Serial Device" does not show /dev/ttyUSB0, type A and then edit it. Press enter to finish editing.
- Type E for "Bps/Par/Bits"
- Type I for 115,200 bps
- Type Q for 8-N-1
- Press enter to go back to the previous dialog
- If hardware flow control is "Yes", press F to change it to "No". This is important!
- If software flow control is "Yes", press G to change it to "No".
- Press enter to go back to the menu
- Select "Modem and Dialing"
- Type A, control-W, enter. This will clear the "init string". Note that the clearing may not show on screen until after you hit enter.
- Type B, control-W, enter. This will clear the "reset string"
- Press enter to go back to the menu.
- Select "Save setup a _dev_ttyUSB0"
- Select "Exit from Minicom"
Next, test it out:
- Run minicom /dev/ttyUSB0
- Power up your OSD
- When you see uboot countdown message press a key to stop it. If it stops minicom is set correctly.
- Try also typing at uboot prompt for further confirmation.
Configuring the Ethernet Cross-connect
This section only applies to those in the Hardware Setup chapter who wish to connect the OSD's Ethernet port directly to an Ethernet port on your computer.
TODO: Write this section.
NOTE: The OSD has an uplink auto-sensing Ethernet port. It will detect if the Cat5 is wired straight-through or crossover and adapt accordingly. A crossover cable is good to have, but not necessary.
((NOTE: If you don't intend to Netboot your OSD, but want to just produce software for it and run it off media cards, or if you want to produce and flash UPK packages, you don't need to follow this step. You also don't need it if you are using the Virtual Machine Development Environment method, since TFTP will be setup from inside the VM already))
What is /srv?/srv is the standard location for site-specific data served by your machine. For more information, look at the Filesystem Hierarchy Standard.Install the atftpd TFTP server. On Debian, apt-get install atftpd works. If you're using Debian, you'll be asked some configuration questions (you may not be asked all of these, depending on your Debconf priority level. You can see them all with dpkg-reconfigure -plow atftpd):
- I suggest letting the server be started by inetd.
- The 300 second default server timeout is fine.
- Leave the port to listen on as 69.
- Leave the retry timeout at 5.
- Feel free to lower the maximum number of threads.
- Enable timeout, tsize, block size, and multicast support.
- Leave the multicast port range and address alone.
- Leave the TTL as 1.
- LOG_NOTICE is a good verbosity level.
- Important. Set the base directory to /srv/tftp
- Log to a file instead of syslog (makes it much easier to find the logs); accept the default name.
If you're not running Debian, the command line options corresponding to the above are:
--daemon --port 69 --tftpd-timeout 300 --retry-timeout 5 --mcast-port 1758 --mcast-addr 126.96.36.199-255 --mcast-ttl 1 --maxthread 20 --verbose=5 --logfile /var/log/atftpd.log /srv/tftp
Next, go ahead and create /srv/tftp. Also, confirm that any firewall on your machine is allowing UDP port 69. A quick-and-dirty way to do this is:
# iptables -I INPUT -p udp --dport 69 -j ACCEPT # iptables -I OUTPUT -p udp --sport 69 -j ACCEPT
However, if you're running a firewall on your workstation, you should spend some time figuring out the correct way to open the port required for TFTP.
TFTP Timeout ISSUE
see solution here.
((NOTE: If you don't intend to Netboot your OSD, but want to just produce software for it and run it off media cards, or if you want to produce and flash UPK packages, you don't need to follow this step. You also don't need it if you are using the Virtual Machine Development Environment method, since NFS will be setup from inside the VM already))
NFS can be a tad bit tricky to configure right. The first thing to remember is that NFS uses several dynamically allocated port numbers; in general, NFS and firewalls do not play along.
Installing the NFS server is fairly simple on Debian (and, indeed on most Linux distros — if it isn't already installed, that is):
- The package you need is called nfs-kernel-server. Go ahead and install it.
- Make sure that Portmap is set to listen on all IP addresses:
- Run dpkg-reconfigure -plow portmap.
- When asked "Should portmap be bound to the loopback address?", answer "no".
- Restart nfs by running /etc/init.d/nfs-kernel-server restart
The next step is to export a directory to become the OSD's root filesystem. This part is standard on any distro. First, mkdir /srv/neuros-osd-rootfs. Now, there are several different ways to configure your NFS export. Starting with the most secure:
- If you know your OSD's IP address, use your OSD's IP address below where it says network-acl. Additionally, you may use "rw" instead of "ro" to allow your OSD to write to the share. Beware that there are some security implications of this and that it also makes your NFS environment not at all match the normal flash environment (which is read-only).
- Network AddressThe quick method I describe in this section of determining your network address is actually only partially correct. The netmask can have things besides "255" and "0" in it. However, if you've configured a netmask like that, you probably already know enough networking to figure the network address on your own. If not, ask Google or install the ipsc, whatmask, etc. program.If you do not know your OSD's IP address (because, for example, it'll be configured with DHCP), the easiest thing to use is your-network/your-netmask for network-acl. If you don't know what those two numbers are, here's how to find out:
- Run /sbin/ifconfig. Look for your ethernet interface. It'll probably be called "eth0". It's the one which is not "lo."
- The number after "mask" is your-netmask. It should look something like 255.255.255.0.
- Look at the number after "inet addr". If your netmask is 255.255.255.0, change the last number to a 0. If your netmask is 255.255.0.0, change the last two numbers to 0, etc. This is your-network So, in my case, I have an inet addr of 192.168.65.14 and a netmask of 255.255.255.0 giving me a your-network of 192.168.65.0 (and a network-acl of 192.168.65.0/255.255.255.0).
- If you completely don't want to deal with this access control stuff, and just want to make it wide open, leave the network-acl blank. I strongly recommend that you do not use a rw mount in this case.
Now, edit /etc/exports and add this line (replacing network-acl as specified above):
Arizona requires an additional export mounted rw:
Finally, run /etc/init.d/nfs-kernel-server reload
|Previous Chapter||Table of Contents||Next Chapter|