NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
Linux Host Configuration - Ubuntu
This article provides information on how to set-up a Ubuntu machine for Linux development.
- 1 Installing Ubuntu
- 2 Setting the Root Password
- 3 Adding a New User
- 4 Working with Proxies
- 5 Installing a Samba Server
- 6 Installing a TFTP Server
- 7 Installing a NFS Server
- 8 Installing Git
- 9 Recommended Ubuntu Packages For Development
At the time of writing the current version of Ubuntu is 9.04. To install Ubuntu 9.04 on the host machine please refer to the this page
Make sure your Ubuntu system is up-to-date:
sudo apt-get update sudo apt-get upgrade
Setting the Root Password
During the installation of Ubuntu, the installation wizard will ask you to create a primary user account. However, unlike other Linux distributions Ubuntu will not ask you to set a root password. It is not required that you set a root password because the primary user account is added to the "sudoers" group and users that are part of the sudoers group may perform superuser commands from within a terminal shell by prefixing the command with "sudo". When using sudo you will be asked for a password which is just your user password. Given that the primary user account can use sudo to execute superuser commands, we can use sudo to set a root password. The benefit of this is simply so you can switch to superuser if there are several commands you need to execute with superuser permissions.
To set a root password, in a terminal shell, execute the following command. Note that first you will be asked for the user password to execute "sudo" and then you will be asked for the root password.
sudo passwd root
Adding a New User
If multiple people will be using the machine you will need to create accounts for them.
- Go to System -> Adminstration -> Users and Groups.
- Click on "unlock", enter your password.
- Click the "Add User" button.
- Enter user info.
- To enable sudo capability go to the "User Privileges" tab and click the "Administer the system" box.
Working with Proxies
Applying System Wide Proxy Settings
- Go to System -> Preferences -> Network Proxy
- Enter your proxy info
- Click "Apply System-Wide..."
Ideally this would solve all proxy issues, but as of Ubuntu 10.04 LTS that does not seem to be the issue! Many programs still seem to have issues...
Ubuntu Software Center
- No known workarounds to make it work behind a proxy (Please contribute if you know of one!)
- Can use System -> Administration -> Synaptic Package Manager instead
Synaptic Package Manager
- Go to Settings -> Preferences -> Network to enter proxy info
- For command line use (i.e. "sudo apt-get") some additional configuration is necessary.
- Run command "gksudo gedit /etc/apt/apt.conf"
- Enter the following text:
- Acquire::http::Proxy "http://yourproxyaddress:proxyport";
Other command line utilities (wget, etc)
- To fix for all users on the PC, open /etc/environment, i.e. "sudo gedit /etc/environment"
- Add the following lines:
Installing a Samba Server
The samba server provides a way to access the contents of a Linux machine’s file-system from a Windows machine over a network connection. This provides a very useful way for sharing files between a Windows machine and a Linux machine. To install a Samba server, in a terminal shell, execute the following command.
sudo apt-get install samba
The default configuration of the samba server does not allow any access to the Linux machine’s file-system from a Windows machine for security reasons. Therefore, it is necessary to configure samba and specify which directories you wish to allow access to and who can access them. To keep things simple, we shall configure samba such that only users with user accounts on the Linux machine have read/write access to their home directories.
To allow users to access their home directories via samba, you need to edit “/etc/samba/smb.conf” with root permissions.
sudo gedit /etc/samba/smb.conf
Now locate the following text:
#======================= Share Definitions ======================= # Un-comment the following (and tweak the other settings below to suit) # to enable the default home directory shares. This will share each # user's home directory as \\server\username ;[homes] ; comment = Home Directories ; browseable = no
Un-comment the bottom 3 lines shown above by removing the ";" and select "yes" for "browseable" as shown below:
#======================= Share Definitions ======================= # Un-comment the following (and tweak the other settings below to suit) # to enable the default home directory shares. This will share each # user's home directory as \\server\username [homes] comment = Home Directories browseable = yes
The above change will only allow users to view their home directories. Hence, to allow users to write to their home directory via samba, find the following text in the file “/etc/samba/smb.conf”.
# By default, the home directories are exported read-only. Change the # next parameter to 'no' if you want to be able to write to them. ; read only = yes
Un-comment the line "read only" above and set "read only" equal to "no" as shown below.
# By default, the home directories are exported read-only. Change the # next parameter to 'no' if you want to be able to write to them. read only = no
Save the changes to the file “/etc/samba/smb.conf” and restart the samba server by executing the following command to make the new configuration take effect.
sudo /etc/init.d/samba restart
Finally, to enable users to use samba, each user must be added as a samba user. For example, to add the UNIX user “joe” as a samba user the following command would be executed. The “smbpasswd” command will ask you for a password for the new samba user. You may use the UNIX password you have for the UNIX account.
sudo smbpasswd -a joe
To access your home directory using samba from a Windows host, on the Windows host open Windows Explorer and in the address box enter “\\<ubuntu-ip-address>\joe.” After entering the IP address in the Windows Explorer address box, if your username and password are different from that of your Windows username and password, you will be asked to enter the samba username and password for the account you wish to access.
Installing a TFTP Server
TFTP is a simple protocol for downloading files from another machine. When doing embedded Linux development TFTP is often used for booting the kernel such that one does not have to reflash the kernel every time a change is made and a new kernel is built.
Installing a TFTP server allows other machines on the same network to download files by simply using the IP address of the machine running the TFTP server.
To install a TFTP server you can simply execute the following command.
sudo apt-get install tftpd-hpa
The configuration for the TFTP server can be found in the file /etc/inetd.conf. The contents of this file should be something like the following.
tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot
The above shows that the default configuration for the TFTP server exports the contents of the directory /var/lib/tftpboot (other common locations include /tftpboot or /srv/tftp). You may change the directory that is exported by simply editing this file.
If you make edits to the /etc/inetd.conf file then you must make sure that no TFTP daemons are running and then you should re-invoke inetd as follows:
sudo killall in.tftpd sudo /usr/sbin/inetd
If security is not a concern, you may want to make it easy to put your kernel images in the tftp directory:
sudo chmod ugo+rwx /var/lib/tftpboot
Note: The command above for inetd does not have a "restart" option. The sudo /usr/sbin/inetd command will cause inetd to re-read the /etc/inetd.conf file. Once another device tries to access the TFTP then inetd will respond by launching a TFTP daemon (in.tftpd). Once another device has used TFTP you would see the daemon running when using the following command.
ps aux | grep tftp
If a TFTP server is running you should see something like the following.
root 3725 0.0 0.0 2328 680 ? Ss 16:23 0:00 /usr/sbin/in.tftpd -s /var/lib/tftpboot
Installing a NFS Server
The network file-system (NFS) server allows other machines on the same network to mount a file-system exported by the NFS server over a network connection. To install a NFS server, in a terminal shell, execute the following command.
sudo apt-get install nfs-kernel-server
The directories that are exported by the NFS server and can be mounted by other machines on the same network are listed in the file “/etc/exports.”
sudo vim /etc/exports
By default no directories are exported. If a user “joe” wished created a directory called “nfs-export” in his home directory and wished to export this using the NFS server so that other machines could mounted this directory and access the contents, the following could be added to the “/etc/exports” file.
The option “rw” permits read and write accesses to this directory when mounted as an NFS volume as long as the user mounting the directory has the appropriate file-level permissions within the directory itself. The option “sync” prevents the NFS server from responding to external accesses until local accesses have been completed. There are many other options that can be used in addition to these and it is recommended that the man page for “exports” is read for more details.
If you are exporting a file system for target hardware to root mount, you likely need to allow root access to your exported host file system. This is a security issue in some environments. The symptom that indicates you need to allow root access is you are asked for a password when logging into the target hardware as root, and no password is set.
The NFS server does not monitor changes to the “/etc/exports” file and so after modifying the file it is necessary to force the NFS server to export all the directories listed in the file “/etc/exports.” To force the NFS server to export all the directories listed in the file “/etc/exports,” execute the following command in a terminal shell.
sudo /usr/sbin/exportfs -va
Git is a software tool that is used widely in the linux community for source code management of software projects. There are many open-source projects utilizing Git for source code management, including the linux kernel as well as the Git project itself. To install Git on an Ubuntu machine see this article.
Recommended Ubuntu Packages For Development
Packages for Linux Kernel Development
- mtd-utils - This package is needed for building flash file-systems. To install execute the following command.
sudo apt-get install mtd-utils
- ncurses-dev - This package is needed for using the Linux kernel "make menuconfig". To install execute the following command.
sudo apt-get install ncurses-dev
Packages for Android Development
- Packages for Google Android Development can be found on this page
Packages for GStreamer Development
- gst-dmai TI DMAI GStreamer recommended packages
sudo apt-get install build-essential subversion sed coreutils texinfo docbook-utils gawk sudo apt-get install help2man diffstat file texi2html bison flex gettext libglib2.0-dev gperf sudo apt-get install autoconf automake libtool uboot-mkimage