old-www/HOWTO/Disk-on-Chip-HOWTO/devtools.html

441 lines
7.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Install Development ToolChain on DiskOnChip</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Booting Linux from DiskOnChip HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Install Linux and LILO on DiskOnChip"
HREF="install.html"><LINK
REL="NEXT"
TITLE="References"
HREF="refs.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Booting Linux from DiskOnChip HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="install.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="refs.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="devtools"
></A
>6. Install Development ToolChain on DiskOnChip</H1
><P
>This section may be left out if the requirement is not to have a development environment on the DiskOnChip. The following steps will install the necessary libraries and tools that are required for developing and executing programs on DiskOnChip. This will completely eliminate the concept of having a host system and target system since now the complete application development can be done on the target system itself. For this purpose we will use uClibc which is a C library that has been developed primarily for embedded systems. Also since our root filesystem that was created in the previous section is bulky (35 MB) we will remove the unnecessary files and make it smaller, approximately 11MB.</P
><P
>We will use the Buildroot package from www.uclibc.org to replace the existing bulky root filesystem of DOC with a tiny filesystem and to install the necessary development ToolChain which includes uClibc library, gcc, g++, make, ncurses, busybox, GNU tar, GNU grep and the GNU coreutils . For more details on Buildroot refer to <A
HREF="http://buildroot.uclinux.org/buildroot.html"
TARGET="_top"
>http://buildroot.uclinux.org/buildroot.html</A
>. The <A
HREF="http://www.uclibc.org"
TARGET="_top"
>http://www.uclibc.org</A
> website provides a precompiled package containing all the tools, which can be downloaded and used. We will use the precompiled package, which is available as <TT
CLASS="filename"
>root_fs</TT
> image. Refer to the <A
HREF="http://www.uclibc.org/FAQ.html"
TARGET="_top"
>uClibc FAQ</A
> for more details.</P
><P
>Follow these steps in order to get the software working on your DOS:</P
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="getimage"
></A
>6.1. Step1: Obtain the latest copy of root_fs_i386.ext2</H2
><P
>Download <TT
CLASS="filename"
>root_fs_i386.ext2.tar.gz</TT
> from <A
HREF="www.uclibc.org/downloads/root_fs_i386.ext2.tar.gz"
TARGET="_top"
>www.uclibc.org/downloads/root_fs_i386.ext2.tar.gz</A
>.</P
><P
>It is around 22MB in size. This actually gets decompressed to a 100MB size file.</P
><P
>Untar the file in <TT
CLASS="filename"
>/usr/src</TT
>:</P
><P
><B
CLASS="command"
>tar <TT
CLASS="option"
>-xvzf</TT
> <TT
CLASS="filename"
>root_fs_i386.ext2.tar.gz</TT
></B
> </P
><P
>This will create a file <TT
CLASS="filename"
>root_fs_i386.ext2</TT
>.</P
><P
>We need to mount this file using a loopback device. Do the following steps:</P
><P
><B
CLASS="command"
>mkdir <TT
CLASS="filename"
>root_fs</TT
></B
> </P
><P
><B
CLASS="command"
>mount <TT
CLASS="option"
>-o</TT
> <TT
CLASS="parameter"
><I
>loop</I
></TT
> <TT
CLASS="filename"
>root_fs_i386.ext2 root_fs</TT
></B
> </P
><P
>Now you can access the content of the file <TT
CLASS="filename"
>root_fs_i386.ext2</TT
> through the <TT
CLASS="filename"
>root_fs</TT
> directory. <TT
CLASS="filename"
>The root_fs</TT
> directory contains a number of directories which makes the root filesystem, like <TT
CLASS="filename"
>bin</TT
>, <TT
CLASS="filename"
>var</TT
>, <TT
CLASS="filename"
>sbin</TT
>, <TT
CLASS="filename"
>opt</TT
>, <TT
CLASS="filename"
>root</TT
>, <TT
CLASS="filename"
>home</TT
>, <TT
CLASS="filename"
>etc</TT
>, <TT
CLASS="filename"
>usr</TT
>, <TT
CLASS="filename"
>lib</TT
>, <TT
CLASS="filename"
>tmp</TT
>, <TT
CLASS="filename"
>dev</TT
>, and <TT
CLASS="filename"
>proc</TT
>.</P
><P
>The <TT
CLASS="filename"
>usr</TT
> and <TT
CLASS="filename"
>lib</TT
> directories contain the development tools like <B
CLASS="command"
>gcc</B
> and <B
CLASS="command"
>g++</B
>.</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="fs_swap"
></A
>6.2. Step2: Replace the root filesystem of the DiskOnChip</H2
><P
>Replace the <TT
CLASS="filename"
>bin</TT
>, <TT
CLASS="filename"
>var</TT
>, <TT
CLASS="filename"
>sbin</TT
>, <TT
CLASS="filename"
>etc</TT
>, <TT
CLASS="filename"
>lib</TT
>, <TT
CLASS="filename"
>usr</TT
>, <TT
CLASS="filename"
>proc</TT
>, <TT
CLASS="filename"
>mnt</TT
>, <TT
CLASS="filename"
>home</TT
> and <TT
CLASS="filename"
>opt</TT
> directories of the DiskOnChip with the ones of the <TT
CLASS="filename"
>root_fs</TT
> image.</P
><DIV
CLASS="warning"
><P
></P
><TABLE
CLASS="warning"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/warning.gif"
HSPACE="5"
ALT="Warning"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Do not replace boot and dev!</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>The <TT
CLASS="filename"
>boot</TT
> directory of the DiskOnChip has to be kept intact since it contains the kernel image, <TT
CLASS="filename"
>initrd</TT
> image and Map file that is used by LILO to load the kernel into memory.</P
><P
>The <TT
CLASS="filename"
>dev</TT
> directory should also not be replaced since it contains the device nodes for DOC (The replacement task will take 5-10 minutes.)</P
></TD
></TR
></TABLE
></DIV
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="DOS_fstab"
></A
>6.3. Step3: Modify etc/fstab of DiskOnChip root file system</H2
><P
>Open the newly replaced <TT
CLASS="filename"
>/mnt/doc/etc/fstab</TT
> and edit the line where the mount point is <TT
CLASS="filename"
>/</TT
>. Change that line to:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;/dev/msys/fla1 / ext2 rw.noauto 0 1
</PRE
></FONT
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="reboot"
></A
>6.4. Step4: Reboot</H2
><P
>Reboot from DiskOnChip and enjoy the uClibc development environment.</P
><P
>You will get the message</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;Welcome to the Erik.s uClibc development environment.
</PRE
></FONT
></TD
></TR
></TABLE
><P
>The entire root filesystem + boot directory + development tools take 84Mb of space.</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="install.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="refs.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Install Linux and LILO on DiskOnChip</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>References</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>