Embedding Redhat Linux in a Diskonchip - HOWTO
Total Page:16
File Type:pdf, Size:1020Kb
Embedding Redhat Linux in a DiskOnChip - HOWTO Don Davies, Prosig Ltd ( [email protected]) October 2002 Describes the configuration and setup of a development environment for a Single Board Computer running Redhat Linux from a DiskOnChip device. Contents 1.0 Introduction ..........................................................................................................3 1.1 Hardware Details..................................................................................................3 1.2 System Configuration ...........................................................................................4 2.0 DOS Development Environment...........................................................................5 2.1 DiskOnChip Tools ................................................................................................5 2.2 Boot Loader..........................................................................................................6 2.3 MS-DOS System Startup......................................................................................6 3.0 Linux Development Environment ......................................................................7 3.1 Custom Kernel Configuration ............................................................................8 3.2 Building Custom Kernel ..................................................................................10 3.3 Booting Custom Kernel ...................................................................................10 3.4 Formatting DiskOnChip for Linux ....................................................................12 3.5 Embedded system Utilities..............................................................................12 a. BusyBox ( www.busybox.net )........................................................................13 b. TinyLogin ( http://tinylogin.busybox.net ) ........................................................13 c. wu-ftpd ( www.wu-ftpd.org ) ............................................................................14 d. TELNET server ...............................................................................................14 3.6 Linux System for DiskOnChip .........................................................................15 3.7 Making the DiskOnChip Bootable ...................................................................15 3.8 Application Startup .............................................................................................16 4.0 Summary............................................................................................................17 Appendix A................................................................................................................19 1.0 Introduction Central to the development of the PROTOR distributed vibration monitoring system is the setup and configuration of an embedded single board computer for remote monitoring applications. The embedded processor sits within a special purpose chassis along with data acquisition and conditioning modules. External communication is via Ethernet and internal via both PC-104 and USB. These units may be installed in potentially harsh environments and so a system which supports solid-state storage rather than a mechanical device is required. These units also run Linux as this provides the most reliable, best cost-performance platform for a remote monitoring applications. This note describes the setup and configuration of a development system for a suitable single board computer which supports the solid-state DiskOnChip device from M- Systems Inc. The note also shows how to access the DiskOnChip from within a Linux environment and how to make the system bootable from DiskOnChip so that no hard disk is required. In order to run Linux from a DiskOnChip device some details are provided on the essential files needed from a standard Redhat Linux distribution, together with some useful utilities which allow a fully functional, small-footprint Linux system to be stored and run from a 32MB DiskOnChip device. 1.1 Hardware Details The single board computer chosen as the embedded processor for these units is the Nova 7892 card by ICP Electronics Inc (www.icpacquire.com ). This card meets all the general requirements of an SBC for use within PROTOR. Other cards with similar facilities are available from other manufacturers. · Footprint 146mm x 203mm ( 5.25" footprint) · CPU Supports Socket 370 Celeron and Pentium III CPUs · Memory Supports one 168-pin DIMM socket ( upto 256Mbytes) · Ethernet On-board Intel 82559 10/100 Mbps interface with RJ45 connector. · PC-104 Supports PC-104 expansion · USB Supports 2 USB Ports · Solid-state storage Supports M-System DiskOnChip For the PROTOR application the NOVA-7892 card has been populated with an 866MHz Pentium III CPU and 64Mbytes of memory. For initial development a standard IDE hard disk is used. The eventual embedded application code is to run under Linux from DiskOnChip. A general development system for the embedded system was assembled which consisted of : · Nova 7892 SBC · Pentium III CPU · 64Mbytes memory · 4Gbyte IDE Disk · 32Mbyte DiskOnChip · 1.4Mbyte floppy drive · CD-ROM drive 1.2 System Configuration In order for the DiskOnChip device to be recognised by the system BIOS and therefore useable within this environment it must firstly be initialised and formatted. Unfortunately the tools necessary to perform this action are DOS based. Therefore, for this development environment, the hard disk for the system is best partitioned with a small 32Mbyte partition was reserved at the beginning of the disk for DOS. The rest of the disk was reserved for the Linux system and Linux swap partition. The following is an example configuration. Disk /dev/hda: 255 heads, 63 sectors, 524 cylinders Units = cylinders of 16065 * 512 bytes Device Boot Start End Blocks Id System /dev/hda1 5 495 3911827+ 83 Linux /dev/hda2 * 1 4 32098+ 4 FAT16 <32M /dev/hda3 496 524 265072+ 82 Linux swap The system was initially booted from a standard DOS boot floppy. The hard disk partitioned and the initial DOS partition (C:\) formatted and made bootable. 2.0 DOS Development Environment As mentioned in the previous section a simple DOS development environment is required for the initialisation and formatting of the DiskOnChip device. This environment is only required for the initial setup of the device. Once the DiskOnChip has been formatted, Linux loaded and made bootable then DOS is no longer required. The following describes the tools needed for the DOS environment in order to simplify the DiskOnChip development. 2.1 DiskOnChip Tools In order to initialise and format a new DiskOnChip device a set of tools provided by the DiskOnChip manufacturers, M-Systems must be obtained. These tools ( called TrueFFS or True Flash File System ) are DOS utilities and must be downloaded from the web site http://www.m-sys.com/content/Developer/DOS.asp and installed into the DOS partition provided on the development system for this purpose. Of the software provided my M-Systems, DFORMAT is probably the main tool required to get started with the DiskOnChip. DFORMAT initializes a "virgin" DiskOnChip and prepares it for the application's needs. DFORMAT provides the following. · Bad block scanning · Partitioning the DiskOnChip to disk and binary partitions · Setting hardware protection configurations · BIOS related operations · Boot replacement operations Note. M-Systems provide two versions of these tools (the latest release v5.0.4 and an older release v4.2). The following sections describe the configuration of Linux using MTD device support. Currently this software only works with the older (V4.2) TrueFFS format utility and so the newer (v5.0.4) should not be used. You can try the format of the DiskOnChip device with the following command DFORMAT /WIN:D600 /S:DOC42.EXB Note this command is for the v4.2 toolset. If a higher version is used then the EXB filename will need to change accordingly. If the device is recognised then the format utility will show the capacity and show progress as the device is formatted. Following the format the DiskOnChip device should be acccessible as device D:\ from DOS. 2.2 Boot Loader In order to simplify the development and booting of Linux kernels and to allow simple co- existence with DOS then the widely available DOS Linux loader module LOADLIN is recommended to be downloaded and installed within the DOS partition. Loadlin is a simple DOS based utility that loads the Linux kernel into memory from DOS. This allows a number of development Linux kernels to be built , copied to the DOS partition and loaded. Loadlin may be downloaded from ftp://ftp.linux.sh/pub/loadlin.exe. 2.3 MS-DOS System Startup To facilitate DiskOnChip development the AUTOEXEC.BAT and CONFIG.SYS files within the DOS partition may be customised to allow various utilities and boot options to be readily available from the menu presented at boot time. The following are typical entries which may be added to any existing files. CONFIG.SYS . [MENU] MENUITEM=LLOCAL,Boot Linux 2.4.7 kernel(MTD) root on /dev/hda1 MENUITEM=FFORMAT5,Format DiskOnChip2000 with TrueFFS v5.0 MENUITEM=FFORMAT4,Format DiskOnChip2000 with TrueFFS v4.2 MENUITEM=MSDOS,Exit to MSDOS MENUDEFAULT=LLOCAL,5 [LLOCAL] [FFORMAT5] [FFORMAT4] [MSDOS] [COMMON] AUTOEXEC.BAT . SET PATH=c:\;C:\DOS;c:\DOC-V42 GOTO %CONFIG% :FFORMAT5 echo "formatting DiskOnChip2000 using doc504.exb" cd \DOC-V50 dformat /win:d600 /s:doc504.exb /y goto end :FFORMAT4 echo "formatting DiskOnChip2000 using