Software Development Guide (ZZ) Based on IQ80321 and ARM-Linux

xiaoxiao2021-03-06  21

1 Overview 1.1 Objectives and Scope Description The process of running ARM Linux on the Intel IQ80321 development board, including the establishment of a cross-compilation environment, compiling the kernel, making the root file system, and the method steps of the target machine. 1.2 Background Unit: Huazhong University of Technology Information Storage System Key Laboratory Wuhan East Lake Storage Technology Co., Ltd. Project: RAID Controller (RDC) RDC Core Software Developed in the X86 platform and the Redhat Linux environment. The product phase needs to be first transplanted to the IQ80321 platform. It is planned to complete the transplant at the end of July 2004. 1.3 Software and Hardware Environment Host (Host) Target Machine (Target) Hardware Environment PC Intel IQ80321 Operating System Redhat Linux 9.0 ARM-Linux 1.4 References [1] Intel IQ80321 I / O Processor Evaluation Platform Board Manual. Docume NT Number: 273521-006 November 7, 2002. [2] Redboot User's Guide. Document Version 1.5M, July 2001. [3] The Linux MTD, Jffs HOWTO. (Work In Progress) V 1.16 2001/08/13. Http: // ftp. Linux.org.uk/pub/people/dwmw2/mtd/cvs/mtd/mtd-jffs-howto.txt [4] Intel iQ80321 Development Kit:

http://www.intel.com/design/iio/docs/dvtl_iop321.htm [5] ARM Linux: http://www.intel.com/design/iIO/docs/dvtl_iop321.htm [5] ARM Linux: DVTL_IOP321.HTM [5] ARM Linux: http://www.arm.linux.org.uk/ [6] busybox: http://www.busybox.net/ [7] jffs: http://developer.axis .com / Software / Jffs / [8] jffs2: http://sources.redhat.com/jffs2/ [9] mtd: http://www.linux-mtd.infradead.org/ [10] "Step by step Produce an ARM-Linux cross-compilation environment, http://embdev.gotdns.org/articles/toolchain.html [11] Dong Xiaoming. LIPS Detailed Design Manual (Linux System Cut Guide). 2003.6. [12] Wookey, Chris Rutter, Jeff Sutherland, And Paul Web. The gnu Toolc Hain for arm targets howto. Http://www.aleph1.co.uk/armlinux/docs/toolch ain / Toolchhowto.pdf [13] 2 Cross-compilation Environment 2.1 Overview (References [12]) The Toolchain Actually Consists of a Number of Components. The Main One Is The Compiler Itself GCC, Which Can Be Native To The Host OR A Cross-Comp iler. This is supported by binutils , a set of tools for manipulating binaries. The se components are all you need for compiling the kernel, but almost anything else you comp ile also needs the C-library glibc. As you will realise if you think about for a mom ent it, Compiling The Compilem, Which Is The Main Reason Why Generating A Toolset IS Not a Simple Exercise. 2.2 Preparation 2.2.1 Directory Structure Description / Root / Login with root User Login, Home Directory, is also the current directory ARM / with this Work-related files are placed in this directory below ARM-Toolchain / Install the build-generated ARM toolchain (Toolchain) boot / storage Compile-generated kernel image files simultaneously put the root of the TFTP server here Build / compile here, Many temporary files and target files fakeroot / for target machine remote NFS mounted root file system src / storage package source code, including Linux kernel Source Code TARS / Store Compressed Pack of Each Package We write a Makefile for establishing a cross-compilation environment, which is some definitions in makefile.

TOPDIR = / root / arm prefix = $ (TOPDIR) / arm-toolchain buildpath = $ (TOPDIR) / build srcpath = $ (TOPDIR) / src tarpath = $ (topdir) / tars kernelpath = $ (srcpath) / Linux 2.2. 2 Define environment variables in ~ / .bashrc files to append the following lines (Note: Logout, re-login can take effect): Export target = arm-linux export prefix = / root / arm / arm-toolchain export path = $ prefix / BIN: $ PATH or directs the definition directly on the command line. 2.2.3 Selecting the Nuclear Version We now use the Linux kernel version of Linux-2.4.21-RMK1-DS0-DJ9. This is also a core version of the IQ80321 development board on the IQ80321 development board. This document takes this version as an example. More information about ARM-Linux and RMK Patch (including the latest progress), please refer to this website and mailing list: http://www.arm.linux.org.uk/ linux-arm-kernel @ lists When deciding which Linux kernel version of your project, be sure to consider whether the corresponding RMK and DS patches have been released.

In order to build the entire Linux kernel source with the supplied p atch, you must have the base kernel, the ARM Linux patch, the Montavista DS patch The annotation of the filenaming as follows:. Patch-2.4.X-rmkY -dsZ- DJV Means You Must Have: 1. Linux-2.4.x kernel Source 2. Patch-2.4.x-rmky to patches on top 3. Patch-2.4.x-rmky-dsz to patch on top of # 2 4. Patch- 2.4.x-RMKY-DSZ-DJV To Patch On Top of # 3 2.2.4 Download Source Code Project URL Linux Core FTP: //ftp.kernel.org/pub/linux/kernel/v2.4/ RMK Patch FTP : //ftp.arm.linux.org.uk/pub/armlinux/kernel/v2.4/ DS Patch ftp://source.mvista.com/pub/ds-patches/2.4/ http://csociety.ecn .purdue.edu / ~ deepak / patches / 2.4 / IOP patch ftp://source.mvista.com/pub/xscale/iop3xx/2.4/ linux-2.4.21 ftp://ftp.kernle.org/pub/linux / kernel/v2.4/linux-2.4.21.tar.gz patch-2.4.21-rmk1.bz2 ftp://ftp.arm.linux.org.uk/pub/armlinux/kernel/v2.4/patch -2.4.21-rmk1.bz 2 PATCH-2.4.21-RMK1-DS0.BZ2 ftp://aiedownload.intel.com/df-support/7060/ENG/PATCH-2_4_21-RMK1-DS0.BZ 2 ftp: //source.mvista.c OM / PUB / XSCALE / IOP3XX / 2.4 / PATCH-2.4.21-RMK1-DS0.BZ2 PATCH-2.4.21-RMK1-DS0-DJ9.bz2 ftp://aiedownload.intel.com/df-support/7183/ ENG / PATCH-2.4.21-RMK1-DS0-DJ 9.bz2 ftp://source.mvista.com/pub/xscale/iop3xx/2.4/patch-2.4.21-rmk1-ds0-dj9. BZ2 binutils-2.14 .tar.gz ftp://ftp.gnu.org/gnu/binutils/binutils-2.14.tar.gz gcc-core-2.95.3.tar.gz ftp: //ftp.gnu.org/gnu/gcc/ GCC-2.95.3 / GCC-CORE-2.95.3.TAR.GZ GCC-G 2.95.3.tar.gz fp: //ftp.gnu.org/gnu/gcc/gcc-2.95.3/gcc -g - 2.95.3.tar.gz glibc-2.2.4.tar.gz ftp://ftp.gnu.org/gnu/glibc/glibc-2.2.4.tar.gz glibc-linuxthreads-2.2.4. tar.gz ftp://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-2.2.4.tar.gz 2.3 Installation Note: The "#" of the lead is commented. The "/" of the row means continued.

2.3.1 Installing Linux header file # Decompression, patch # 解 缩 tar.gz package: TAR zxfv filename.tar.gz # or gzip -dc filename.tar.gz | tar xf - # Decompress Tar.bz2 Pack: TAR jxfv filename.tar.bz2 # or bzip2 -dc filename.tar.bz2 | tar xf - # 打 tar.gz format patch: gzip -dc patchfile.tar.gz | Patch -p1 # Tar.bz2 format patch: BZip2 -dc patchfile.tar.bz2 | patch -p1 [root @ lips root] # CD $ TOPDIR / SRC [root @ lips src] # tar zxfv $ topdir / tars / linux-2.4.21.tar.gz [root @ lips SRC] # cd Linux-2.4.21 [root @ lips Linux-2.4.21] # bzip2 -dc $ topdir / tars / patch-2.4.21-rmk1.bz2 | patch -p1 [root @ lips linux-2.4.21 ] # bzip2 -dc $ TOPDIR / TARS / PATCH-2.4.21-RMK1-DS0.B Z2 | Patch -p1 [root @ lips linux-2.4.21] # bzip2 -dc $ topdir / tars / patch-2.4.21 -RMK1-DS0-D j9.bz2 | patch -p1 [root @ lips linux-2.4.21] # cd .. [root @ lips src] # mv Linux-2.4.21 Linux-2.4.21-rmk1-ds0- DJ9 [root @ lips src] # ln -s Linux-2.4.21-RMK1-DS0-DJ9 Linux [root @ lips src] # cd Linux [root @ lips linux] # make mrproperty # Modify Makefile # Put Arch and Cross_Complie Definitions are modified as follows: Arch = arms_complie = $ (prefix) / bin / arm-linux- # View Linux / Arch / ARM / DEF-Configs directory, the file name below, indicating that the board has been supported # 产生 m = = arm xxx_config to generate the default configuration # 注意 这里 这里 这里 加 加 名 加 名 后 名 后] 加] # Make IQ80321_config * ** Default Configuration for iQ80321 Installed *** Next, You May Run 'make oldconfig' [root @ lips linux] # Yes "| Make Oldconfig [root @ lips linux] # Make include / linux / version.h # copy header File [root @ lips linux] # mkdir -p $ prefix / $ target / include [root @ lips linux] # cp -dpr incrude / linux / $ prefix / $ target / include / [root @ lips linux] # CP -DPR Include / ASM-ARM / $ Prefix / $ Target / include / asm [root @ lips linux] # CD $ prefix / $ target / [root @

LIPS ARM-Linux] # ln -s include sys-incrude 2.3.2 Compilation installation Binutils # Decompression [root @ lips arm] # cd src [root @ lips src] # tar zxfv $ topdir / tars / binutils-2.14.tar .gz # compile [root @ lips src] # mkdir -p $ topdir / build / binutils [root @ lips src] # CD $ topdir / build / binutils / [root @ lips binutils] # $ topdir / src / binutils-2.14 / configure / --target = $ target / --prefix = $ prefix [root @ lips binutils] # make all; make install # Output binutils path to environment variables [root @ lips binutils] # @ ot = $ prefix / BIN: $ PATH 2.3.3 Compiling the C compiler of GCC # 解压 缩 # Note: Why don't you use all-in-one GCC-2.95.3.tar.gz? # all-in-one GCC package Chill, Fortran, Java and other languages, although specified -ENABLE-LANGUAGES = C when configure, but compiles all all compiles, this is not what we need, and it will always have errors. So we only compile the C language compiler. This problem is also the next time the next compilation, we only compile C and C compilers.

[root @ lips binutils] # CD $ TOPDIR / SRC [root @ lips src] # TAR ZXFV $ TOPDIR / TARS / GCC-CORE-2.95.3.TAR.GZ # Modify GCC's T-Linux file # in t-linux Target_libgcc2_cflags in the file plus __gthr_posix_h and inh ibit_libc # here uses the SED tool to directly edit files, is to facilitate scripting to implement the entire process # SED 'S / replaced string / new string /' # In the shell, redirect #, that is, the content processed by the SED is output from the T-LINGUX.ORIG file input to the T-Linux-Core file [root @ lips src] # CD GCC-CORE-2.95. 3 / gcc / config / arm [root @ lips arm] # mv t-linux t-linux.orig [root @ lips arm] # sed 's / TARGET_LIBGCC2_CFLAGS = / TARGET_LIBGCC2_CFLAGS = -D__gthr_posix_h -Dinhibit_libc /' T-Linux-Core [root @ lips arm] # CP T-Linux-Core T-Linux # Compile [root @ lips arm] # mkdir $ topdir / build / gcc-core [root @ lips arm] # CD $ TOPDIR / BUILD / GCC-CORE / [ROOT @ lips gcc-core] # [root @ lips gcc-core] # $ TOPDIR / SRC / GCC-2.95.3 / configure / --target = $ target / --prefix = $ Prefix / --Nable-Languages ​​= C / --Disable-Shared / --disable-threads [root @ lips gcc-core] # Make All Install 2.3.4 Compile installation Glibc # Decompression [root @ lips gcc-core ] # CD $ TOPDIR / SRC / [ROOT @ lips src] # TAR ZXFV $ TOPDIR / TARS / GLIBC-2.2.4.tar.gz [root @ lips src] # CD Glibc-2.2.4 / [Root @ lips glibc-2.2.4] # TAR ZXFV $ TOPDIR / TARS / GLIBC- Linuxthreads-2.2.4. tar.gz # compile [root @ lips glibc-2.2.4] # mkdir $ topdir / build / glibc [root @ lips glibc-2.2.4] # CD $ TOPDIR / Build / glibc [root @ LiPS glibc] # cc = $ target-gcc ar = $ target-ar ranlib = $ target-ranlib / $ topdir / src / glibc-2.2.4 / configure / $ target / --prefix = $ prefix / $ target / - -ENABLE-Add-Ons [root @ lips glibc] # make all install 2.3.5 Compile installation GCC C, C compiler # Restore T-Linux file [root @ lips glibc] # CD $ TOPDIR / SRC / GCC-2.95 .3 / GCC / config / ARM / [root @

LiPS ARM] # CP T-Linux.orig T-Linux # Decompression [root @ lips arm] # CD $ TOPDIR / SRC / [Root @ lips src] # TAR ZXFV $ TOPDIR / TARS / GCC-G - 2.95.3 .tar.gz # compile [root @ lips src] # mkdir $ topdir / build / gcc-g [root @ lips src] # CD $ TOPDIR / BUILD / GCC-G / [root @ lips GCC-G ] # $ TOPDIR /src/gcc-2.95.3/configure / --target = $ target / --prefix = $ prefix / --enable-language = c, c / --with-incruded-gettext [root @ lips gcc-g ] # Make All Install 2.4 Using Cross-Compiling Environments [Reference ARM Linux 2.4, Linux / Documentation / ARM / Readme] if Wish To Cross-Compile, The Following Lines in THE Top Level Make File: Arch = with Arch = arm and cross_compile = to cross_compile = eg. Cross_compile = ARM-Linux - After the above process is completed, we can The necessary file package backup, copied to other hosts, can become a cross-development environment.

The following directory is required: $ TOPDIR / ARM-TOOLCHAIN ​​-> ARM-TOOLCHAIN-2.4.21-RMK1.TGZ $ TOPDIR / SRC / Linux -> Linux-2.4.21-RMK1-DS0-DJ9.TAR The corresponding position in .gz makefile needs to do some modifications according to the actual situation (which directory is unfained above): Arch = arms_complie = / rad / arm / Tool-chain / bin / arm-linux- ld = $ (Cross_Compile LD cc = $ (cross_compile) GCC kernelpath = / root / arm / src / linux 3 kernel 3.1 Overview KERNEL 3.2 compile core step # Configuring kernel # Copy default kernel configuration file [root @ lips gcc-g ] # CD $ TOPDIR / SRC / Linux [root @ lips linux] # cp arch / arm / defig-configs / iq80321 .config [root @ lips linux] # make menuconfig # Generally, no need to modify the default configuration # can consider adding according to specific situations Or removed some option # support Initrd mechanism Block Devices ---> <*> loopback device support [*] initial ruvice ---> <*> enhanced real time clock support # can remove these Option, there is currently no multi-device support (RAID AND LVM) ---> [] Multiple Devices Driver Support (RAID AND LVM) <> include IDE / ATA-2 Disk Support <> include IDE / atapi CDROM Support # Modify Makefile # If you have modified in front step (installation Linux header), you can skip here #. Confirm, if definition prefix = / usr / local / arm is here, you need to modify #. must Oppile defines path prefix cross_compile = $ (prefix) / bin / arm-linux- # make dep; make bzimage # The configuration file is .config 4 file system 4.1 Overview has the kernel, there must be a root file system (root filesystem) to make a Linux system running normally. The root file system is used to store the applications, scripts, configuration files, etc. needed during the system run.

4.2 BusyBOX Home: http://www.busybox.net/ Download: http://busybox.net/downloads/ Manual: http://www.busybox.net/downloads/busybox.html 4.2.1 Introduction Readme Busybox Combines tiny versions of many common UNIX utilities into a single small executable. It provides minimalist replacements for most of th e utilities you usually find in GNU coreutils, util-linux, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; h owever, the options that are included provide the expected functionality and beh ave very much like their GNU counterparts BusyBox has been written with size-optimization and limited resource s in mind It is also extremely modular so you can easily include or.. exclude co mmands (or features) at compile time. This makes it easy to customize your embe dded systems. to create a working system, just add / dev, / etc, and a Linu x kernel. BusyBox provides a fairly complete POSIX environment for Any Small or Embedded System. Busybox's current version is 1.00-pre10 (version 1.0 release has been postponed again). What is busybox? Why use busybox? As the manual said, Busybox is a "Swiss Army Swarf" embedded Linux. BUSYBOX after compiling only one binary executable Busybo X, it implements almost all common, must-have applications (such as init, shell, getty, ls, cp, etc.), and these applications are in the form of symbolic links. exist. For the user, the method of executing commands has not changed, and the command line call will be passed to BusyBox as a parameter to complete the corresponding function. Using Busybox greatly simplifies the production of root file systems. If there is no busybox, preparing a root file system for the target machine in a cross-development environment, you need to obtain the source code for these applications, and then put it in the previously prepared cross-compilation environment to compile it to perform the executable code, all The workload is very large. Use busybox to replace all those applications with a busybox.

4.2.2 BusyBox installation INSTALL 1) Run 'make config' or 'make menuconfig' and select the functionality that you wish to enable. 2) Run 'make dep' 3) Check the Makefile for any Makefile setting you wish to adjust for your system (things like like setting your cross compiler, adjusting optimizations, etc) 4) Run 'make' 5) Go get a drink of water, drink a soda, visit the bathroom, or whatever while it compiles. It does not take very long to compile, so you do not really need to waste too much time waiting ... 6) Run 'make install' or 'make PREFIX = / target install' to install busybox and all the needed links. Some people will prefer To Install Using Hardlinks and Will INSTALL TANT To Run 'Make Install-Hardlinks' ... First, configure Busybox.

[root @ LiPS busybox-1.00-pre10] # make menuconfig ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -> Build Options ---> Archival Utilities ---> Coreutils ---> Console Utilities ---> Debian Utilities ---> Editors ---> Finding Utilities ---> Init Utilities ---> login / password management utilities ---> miscellaneous utilities ---> Linux module utilities ---> networking utilities ---> process utilities ---> another bourne-like shell ---> system logging Utilities ---> Linux system utilities ---> debugging options ---> build options ---> [*] build busybox as a static binary (no shared libs) [*] Build With Large File Support (for Accessing Files > 2 GB) [*] Do you want to build busybox with a cross compiler? (/ Root / arm / arm-toolchain / bin / arm-linux-) Cross compiler prefix () Any extra cflags options for the compiler? Several options should pay attention to: Static compilation, save copy shared libraries; set the path to the cross compiler, according to our situation, set to / root / arm / arm-toolchain / bin / arm-linux-, $ P Refix / BIN / ARM- Linux- (same as settings in Linux / Makefile). Installation options ---> [*] Don't use / usr (/ root / arm / fakeroot) BusyBox Installation Prefix Settings Installation Path (/ Root / ARM / FAKEROOT). The meaning of not using / usr means that all installed in / bin and / sbin, not in / usr / bin and / usr / sbin The following installers. The remaining parts are used to configure the implemented tools, and can be selected as needed or using the default configuration. After the configuration is complete, like the Linux kernel, the current configuration information is saved in the .config file. Then, compile, install. [root @ lips busybox-1.00-pre10] # make dep; make; make install btw. BusyBox version stable (0.60.5) installation requires manual modification of config.h and mak es.

4.3 Root File System Content # / root / arm / fakeroot directory is the future root file system # now we already have bin sbin usr, let's add other content, # 关 是 和 和 和,,,, [root @ lips busybox-1.00-pre10] # cd / root / arm / fakeroot [root @ lips fakeroot] # mkdir dev etc lib mnt proc Root Tmp Var [root @ lips fakeroot] # ls bin dev etc lib mnt proc Root Sbin TMP usr var [root @ lips fakeroot] # 4.3.1 bin, sbin, usr / bin, usr / sbin bin and sbin The following is the content of Busybox compilation, USR is useless. [Root @ lips fakeroot] # ls bin sbin bin: [chown du gzip md5sum pwd tar uniq adduser chvt echo head mkdir readlink tee unzip ar clear egrep hexdump mkfifo reset telnet uptime arping cmp env hostname mknod rm test usleep ash cp expr id mktemp rmdir tftp vi awk cut false install more sed time wc basename date fgrep ip mount sh top wget bunzip2 dd find kill mv sleep touch which busybox deallocvt free killall openvt sort tr whoami bzcat deluser ftpget ln passwd strings true xargs cat df ftpput logger pidof su tty yes chgrp dirname grep login ping sync umount zcat chmod dmesg gunzip ls ps tail uname sbin: chroot hwclock ifup insmod modprobe reboot sulogin syslogd getty ifconfig inetd klogd pivot_root rmmod swapoff telnetd halt ifdown init lsmod poweroff route swapon [root @ lips fakeroot] # 4.3.2 DEV [root @ lips fakeroot] # ls dev / console kmem mtdblock1 null random system tyd2 zero initctl MEM MTDBLOCK2 PTMX RTC TTY TTYS0 Initrd MTDBLOCK0 MTDBLOCK3 PTS SHM TTY0 TTYS1 [root @

Lips Fakeroot] # # Basic / Dev Entries # FileName, Type, Major, Minor, Permission, Description # MEM Char 1 1 600 Physical Memory Access # kmem char 1 2 600 # null char 1 3 666 Null Device # Zero Char 1 5 666 null byte source # random char 1 8 644 Nondeterministic random number generator # initrd block 1 250 600 # tty0 char 4 0 600 Current virtual console # tty1 char 4 1 600 First virtual console # ttyS0 char 4 64 600 First UART serial port # ttyS1 char 4 65 600 SECOND UART Serial Port # Tty Char 5 0 666 Current Tty Device # Console Char 5 1 600 System Console # RTC Char 10 135 644 Real Time Clock # Ptmx Char 5 2 666 Unix98 Pty Master # MTDBLOCK0 Block 31 0 644 MTD # mtdblock1 block 31 1 644 MTD # mtdblock2 block 31 0 644 MTD # mtdblock3 block 31 1 644 MTD # pts / 0 char 136 0 640 UNIX98 PTY slave # pts / 1 char 136 1 640 UNIX98 PTY slave # initctl FIFO?? 600 # systty -> TTY0 # SHM / 4.3.3 etc [root @ lips fakeroot] # ls etc / fstab Hosts Issue NSSwitch.conf profile rc.d securetty syzfig group inittab issu.Net Passwd Protocols RPC Services [root @ lips fakeroot] # etc directory The configuration file and script are stored. Provide a few of several necessary documents to make the system are running frequently. As for the specific content of the configuration file, you can refer to the configuration file in the main unit Linux. Where rc.d is a directory where the script is stored, the sysconfig directory mainly stores the configuration and scripting of the network. These directory structures are not required, but only to continuing RedHat habits. The init and sysvinit implemented by busybox have a great difference, so its configuration file inittab should also make a large change.

[root @ lips fakeroot] # Cat etc / inittab # # inittab this file describes how the init process shouth run-level. # format: # : : : # # WARNING # The Busybox init is different with SysV init # :. This field has a non-traditional meaning for BusyBox init # The id field is used by BusyBox init to specify the controlling tty for # the! Specified process to run on. The contents of this field is # appended to "/ dev /" and used as-is. # : The runels field is completely ignored. # # system initialization. :: sysinit: / etc / Rc.d / rc.sysinit # / bin / sh infocations on successd Ttys # start an "askFirst" shell on the console (wherever this year be) :: askfirst: / bin / sh # stuff to do when restarting the init process: : restart: / sbin / init # stuff to do before rebooting :: ctrlatdder: / sbin / reboot :: shutdown: / bin / umount -a -r :: shutdown: / sbin / swapoff -a [root @ lips fakeroot] # 4.3.4 LIB [root @ lips fakeroot] # ls lib / libnss_files-2.2.4. So libnss_files.so libnss_files.so.2 modules [root @ lips fakeroot] # Because busybox is static compile, its run does not rely on additional library files. The library file here has only one libnss_files-2.2.4.so, which is necessary to cooperate with ETC / NSSWitch.conf. It is important to note that this library file is replicated from the cross-compilation environment ($ prefix / $ t arget / lib, ie / root / arm / arm-toolchain / arm-linux / lib), not Copy from the host / lib. [root @ lips fakeroot] # CP -DPR $ prefix / $ target / lib / libnss_files * lib [root @ lips fakeroot] # In addition, the modules directory is used to store the Linux kernel module that may be used in the system. 4.3.5 Other 5 Leading 5.1 Overview The role of the bootloader is to load and run the kernel, and the root file system is mounted from the specified location in the final phase, so that the system is transferred to normal operation. For example, LILO and GRUB are common guides software.

However, these software-designed software is not suitable for embedded systems, where we will use Redboot. Before guiding the target machine, you must first clarify two questions: First, where is the kernel image file (what device)? Second, where is the root file system (what is the root device), what is the file system type? The kernel and root file system of the host are typically located on disk partitions (such as / dev / hda1), type EXT2 or EXT3, etc. For IQ80321 (or most target machines), there is no large-capacity storage device such as a disk, replaced by a memory such as Flash Memory, limited capacity (here 8MB). Therefore, for the product, its kernel and root file system are located in Flash (MTD), and most of the types of JFFS2 are used. There are several ways to write the kernel to flash, such as through serial port, JTAG interface or network. In the following process, we choose to download the kernel file through the network using Redboot, and then write to Flash. At this time, the host needs to properly set the TFTP server. Since the process of writing files into flash is cumbersome (generally needed to use other tools or software), in order to facilitate frequent modification, testing, in software development stages, the root file system is usually stored in the host, the target machine passes the root file system through NFS remotely .

5.2 RedBoot http://sources.redhat.com/redboot/ 5.2.1 Introduction (Reference [2]) RedBoot is an acronym for "Red Hat Embedded Debug and Bootstrap", an d is the standard embedded system debug / bootstrap environment from Red H at, replacing the previous generation of debug firmware:. CygMon and GDB stubs It provides a complete bootstrap environment for a range of embed ded operating systems, such as embedded Linux and eCos, and includes fac ilities such as network downloading and debugging . It also provides a si mple flash file system for boot images. RedBoot provides a wide set of tools for downloading and executing p rograms on embedded target systems, as well as tools for manipulating th e target system's environment. It can be used for both product developm ent (debug support) and for end product deployment (flash and network bo oting) 5.2.2 RedBoot command RedBoot> help Manage aliases kept in FLASH memory alias name [value] Set / Query the system console baud rate baudrate [. - B ] Manage Machine Caches Cache [On | Off] Display / Switch Console Channel Channel [-1 | ] Compute A 32bit Checksum [POSIX Algorithm] for a Range of Memory Cksum -B -l Display (Hex Dump) a Range of Memory Dump -B [-l ] [-s] [-1 | 2 | 4] Execute An Image - with MMU Off Exec [-w Timeout] [-b [-l ]] [-r [-s ]] [-c "kernel command line"] [

] Manage Flash Images Fis {cmds} Manage Configuration Kept in Flash Memory Fconfig [-i] [-L] [-N] [-f] [-d] | [-d] nickname [value] Execute Code At a location Go [-W ] [Entry] Run Board Diagnostics Diag Help About Help? Help [] SET / CHANGE IP Addresses IP_ADDRESS [-L ] [-H ] load a file loading [ R] [-V] [-D] [-H ] [-M ] [-C ] [-b ] Compare Two Blocks of Memory MCMP -S < Location> -d -l [-1 | -2 | -4] Fill A Block of Memory with a pattern mfill -b -l -p [-1 | -2 | -4] NetWork Connectivity Test Ping [-V] [-N ] [-l ] [-r ] [-i ] - H reset The System Reset Display Redboot Version Information Version Display (HEX Dump) A Range of Memory X -B [-l ] [-s] [-1 | 2 | 4] 5.2.3 There are many ways to connect the target machine to connect the target machine. Here we demonstrate the serial port using the Minicom connection target machine. First, serial port parameters are set using Minicom -s: / dev / ttys1, 115200, 8n1. Save this setting as the default value and exit. Then use the minicom -o command to connect the IQ80321 development board serial port. -o (--noinit) Parameter represents the cancel transmission of the initialization MODEM instruction. Here seems to reset the IQ80321 board (the reset button on the panel), knock back to the car, should appear the Redboot> prompt, indicating that everything goes well. After the first connection, you need to use the fconfig command to set the network, serial port baud rate, etc. of the target machine. In addition, you will need to be familiar with FIS, which is the tool of the operation Flash provided by Redboot. The HELP command lists all commands that can be used under the Redboot prompt.

[root @ lips root] # minicom -o Welcome To Minicom 2.00.0 Options: History Buffer, F-Key Macros, Search History Buffer, I18N Compiled on Jan 25 2003, 00:15:18. Press Ctrl-a z for Help On Special Keys Ethernet Eth0: Mac Address 00:07: E9: 03: 39: F4 IP: 192.168.0.1/255.255.255.0, Gateway: 192.168.0.1 Default Server: 192.168.0.20, DNS Server IP: 192.168.0.1 Redboot (TM) Bootstrap and debug environment [ROM] Red Hat Certified Release, Version 1.61 - Built 16:46:58, Oct 23 2002 Platform: IQ80321 (Xscale) Copyright (C) 2000, 2001, 2002, Red Hat, Inc. Ram : 0x00000000-0X08000000, 0x0001B488-0X01FD1000 Available Flash: 0xF0000000 - 0xF0800000, 64 block of 0x00020000 BYTES EACH. # Note! ! These two lines show information is important, it can be seen: # (1) IQ80321 target board has 128M memory, Flash capacity is 8m. # (2) The available memory begins with address 0x0001b488. # (3) Flash Erase block size is 0x20000 (byte) RedBoot> RedBoot> fconfig Run script at boot:. false Use BOOTP for network configuration: false Gateway IP address: 192.168.0.1 Local IP address: 192.168.0.21 Local IP address mask: 255.255.255.0 Default server IP address: 192.168.0.20 Console baud rate: 115200 DNS server IP address: 192.168.0.1 GDB connection port: 9000 Force console for special debug messages: true Console number for special debug messages: 0 Network debug at boot time: false alias / admin: alias / Mobile: Alias ​​/ Motd: Hello. Redboot> Redboot> FIS *** INVALID 'FIS' Command: Too Few Arguments USAGE: FIS CREATE -B -L [-s ] [-f < Flash_addr>] [-e ] [-r ] [-n] Fis delete name fis erase -f -l fis free fis init [-f] fis list [ -c] [-d] FIS LOAD [-D] [-B <

Memory_load_address>] [-C] Name Fis Lock [-f -l ] [Name] FIS UNLOCK [-f -l ] [name] FIS WRITE -F - B -L redboot> 5.3 MTD and JFFS2 5.3.1 Preparing # Reconfigure Compile Host Core #Nearby MTD Support Memory Technology Devices (MTD) ---> <*> Memory Technology DEVICE (MTD) Support < *> Direct Char Device Access To MTD Devices (New) <*> CACHING DEVICE Access To MTD Devices (New) Self-Contained MTD Device Drivers ---> <*> Test Driver Using Ram (New) # (4096) MTDRAM Device Size In Kib (NEW) (8192) MTDRAM Device Size In Kib (New) (128) MTDRAM ERASE BLOCK SIZE IN KIB (New <*> MTD Emulation Using Block Device (New)) Add JFFS2 file system support file systems -> <*> Journalling Flash File System V2 (JFFS2) Support # 内 核 Adds the corresponding support, you also need mkfs.jffs2 tools, download # ftp://ftp.nluug.nl/pub/sunsite/distributions/ Altlinux / SiSyphus / files / i 586 / rpms / jffs2-2.0-alt1.i586.rpm # Install this RPM package, then there will be /sbin/mkfs.jffs2, and you can see the handbook [root @ lips tars] # rpm -IVH Jffs2-2.0-alt1.i586.rpm # Create a device node [root @ lips tars] # mkdir -p / dev / mtdblock [root @ lips tars] # mknod / dev / mtdblock / 0 B 31 0 # If there is already a JFFS2 file system image, how to see the content? [root @ LiPS TMP] # DD if = iq80310.jffs2 of = / dev / mtdblock / 0 12288 0 Records in 12288 0 records out [root @ lips tmp] # mount -t jffs2 / dev / mtdblock / 0 / mNT / [root @ lips TMP] # 5.3.2 HOWTO (Reference [3])

*** Putting a jffs file system on the flash devices: Now that you have successfully managed to detect your flash devices, you need to put a jffs on them Unlike mke2fs there is no utility th at will directly create a jffs file-system. onto the / dev / mtd0,1,2 ... device. you have to use a utility called mkfs.jffs available under mtd / util Get a directory ready with the stuff that you want to put under jffs. Let's assume that it's called / home / jffsstuff1 Just do: # / usr / src / mtd / util / mkfs.jffs -d / home / jffsstuff -o /tmp/jffs.image this makes a jffs image file. Then do (if your flash chips Are ERASE D, Else See Below: #CP / TMP/JFFS.Image / dev / mtd0, 1, 2 ... (as the case may be, most likey / dev / mtd0). You May Also Mount An ERSED MTDBLOCK Device Directly Without Puttin G A File System on It Device Intectively Under Your Shell Control (You Know- Copy Stuff To The Mounted Dir). If Your Flash Chips Are Not Erase d or you have been messing around with them earlier, your can not just copy the new image on top of the older one. Bad things may happen. Use the program mtd / util / erase to erase your device. # / usr / src / mtd / Util / Erase / DEV / MTD0, 1, 2, 3 WHERE Offset: Try 0 if you don't know (Start of MTD Device), Else Must Be in Decimal Bytes, But Must Start AT An Integral Erase Sector Boundary. Erase-Size: How MAX YOUT TO ERASE. Your Max Erase Size for Your Flash IS: (Total-Size / Your Mtd Device Erase Size- Look Under `Cat / PROC / mtd`

) Watch the messages on your console (assuming you have verbose turned on when you configured your kernel) You should not see any errors When your command prompt returns, do:.. #Cp /tmp/jffs.image / dev / mtd0,1 , 2 ... (as the case may be, most likely / dev / mtd0). Then loading the jffs module in by: #modprobe jffs dam in by: #mount -t jffs / dev / mtdblock0 / mnt / Jffs (Assuming / MNT / JFFS EXISTS, ELSE MAKE IT). Note: Note The Use of / dev / mtdblock0 NOT / DEV / MTD0. "Mount" Needs A Block Device Interface and / DEV / MTDBLOCK0, 1, 2, 3. .. is the price. *** mounting a jffs (1 or 2) f / or on p S as root device. * Note: this assumes That You Can Some How boot your kernel. This section not de DEAL with booting your kernel from an mtd partition or device. You may be doing this by bo oting your kernel off an IDE flash disk / CF disk etc. using lilo. This procedure is the same even when you want to boot the kernel directly off flash. This time you will just burn the kernel into the raw flash device after the "rdev "Step Below. 1. make Sure That You Can Detect your flash devices and read and wri teeth wegh the MTD Device Nodes (/ dev / mtdn). 2. make Sure Than You Can Mount The Required Jffs (1 OR 2) f / s on you r flash devices and copy files to it, unmount, reboot, re-mount and still see your files there (Also Do A "DIFF"

ON a COUPLE OF FILES To make Corrupted. 3. Compile All The Required MTD / Jffs (1/2) Support Into The Kernel 4. Tell The Kernel What Your Root device is going to be. do That by: # rdev / dev / mtdblock Where MTDBlock is where you have constructed your root fs That Yo U Want to Mount As root on reboot. 5. Run Your Boot Loader Init Program (LILO for lilo bootloader). 6. Reboot. Your jffs MTDBlock partition should be mounted as root. 5.3.3 mkfs.jffs2 (man page of mkfs.jffs2) mkfs.jffs2 (1) Name mkfs.jffs2 - Create A Jffs2 File System Image from Directory Synops Mkfs.jffs2 [-P, - PAD [= Size]] [-r, -d, - root directory] [-s, - page- size = size] [-e , - EraseBlock = Size] [-C, - Cleanmarker = size] [-n, - no-cleanmarkers] [-o, - output image.jffs2] | -l, - lit tle-endian] [ -B, - Big-endian] [-d, - devTable =

File] [-f, - fake time] [-q, - squash] [-u, - squash-uids] [-p, - squash-perms] [- h, - help] [-v , - verbose] [-V, - version] DESCRIPTION The program mkfs.jffs2 creates a JFFS2 (Second Journalling F lash File System) file system image and writes the resulting image to the file specified by the -o option or by default to the standard outp ut, unless the standard output is a terminal device in which case mkfs. jffs2 will abort. The file system image is created using the files and directo ries con- tained in the directory specified by the option -r or t he present directory, if the -r option is not specified. Files to be placed into the file system image are compressed using the zlib compression library. It is unlikely that JFFS2 images are useful except in conjuc tion with the MTD (Memory Technology Device) drivers In The Linux Ker Nel, Since The Jffs2 File System Driver In The Kernel Requires MTD Devic Es. Options Options Take Size Arguments Can Be Specified As Eithe R Decimal (EG, 65536), Octal (0200000), or HexideCIMAL (0x1000). -P, --PAD [= Size] Pad Output to size bytes with 0xFF. If size is NOT Specified, The Output Is Padded To The end of the final erase blo ck. -r, -d, --root = dir build file system from directory dir. The default is the cur- Rent Directory. -e, --raseblock = sIZE use erase block size sIZE. The default is 64 KiB. If you use a erase block size different than the erase block size of the tar- get MTD device, JFFS2 may not perform optimally. If the sIZE specified is below 4096, the Units Are Assumed to BE K Ib. -o, --output =

File Write Jffs2 Image to File File. Default. 5.4 NFSROOT [Reference Mount ", Linux / Documents /NFSROOT.TXT] KERNEL COMMAND LINE ---------- --------- When a boot loader (Either by loadlin, lilo or a network boot program) it has to be told what root fs debrough . and the name of the directory on the server to mount as root This can be established by a couple of kernel command line parameters:. root = / dev / nfs This is necessary to enable the pseudo-NFS-device Note that it's n ot A Real Device But Just A Synym To Tell The Kernel To Use NFS INSTEA D OF A Real Deal Deal Deal Deal Deal Deal Deal Deal Deal Deal Deal Deal Deal Deal Deal Deal Deal Deal Deal Deal Deal Deal Deal device The IP Address of the NFS Server. if this field is not given, The default address as determined by T HE `IP 'Variable (See Below) IS Used. One Use of this parameter is for example TO Allow Using Different Se Rvers for Rarp and NFS. Usually You Can Leave this Blank. name of the directory on the server to mount as root. if there is a "% s" token in the string, The Token Will be replaced by the ascii-representation of the client's ip address. ip = : : : : : : IP address of the client. If empty, the address will e ither be determined by RARP or BOOTP. What protocol is used de- pends on what has been enabled during kernel configuration and on the

parameter. If this parameter is not empty, neither RARP nor BOOTP will be used. IP address of the NFS server. If RARP is used to dete rmine the client address and this parameter is NOT empty only replies from the specified server are accepted. To use different RARP and NFS server, specify your RARP server here (or leave it blank), and specify your NFS server in the `nfsroot 'parameter (see above). If this entry is blank the address of the server IS Used Which Answered The Rarp or Bootp Request. ...... Host Setting 5.5.1 DHCP Server 5.5.2 NFS Server Setting the NFS server to output the / root / arm / fakeroot directory, as the root file system of the target. Modify the configuration file / etc / exports. For detailed syntax, please refer to Man Pen Exports (5). [root @ lips fakeroot] # cat / etc / exports / root / arm / fakeroot (rw, no_root_squash) [root @ lips fakeroot] # /etc/rc.d/init.d/nfs restart shutting down nfs mountd: [OK ] Shutting Down NFS Daemon: [OK] SHUTTING DOWN NFS Services: [OK] Starting NFS Services: [OK] Starting NFS Quotas: [OK] Starting NFS Daemon: [OK] Starting NFS MOUNTD: [OK] [root @ lips fakeroot] # 5.5.3 TFTP Server Setting the TFTP server to provide the target to download the kernel file. TFTP is controlled by XINETD service. By default, the TFTP server is closed by default. Modify / etc / xin ETD.D / TFTP configuration file: disable = no, modify its root directory by / tftpboot to / root / arm / boot, because we copied the generated Linux kernel file to this directory (of course you You can also do not modify this root directory, as long as you put the kernel here specified location). Then start the network service.

[Root @ lips fakeroot] # cat /etc/xinetd.d/tftp # default: off # description: The tftp server serves files using the trivial file trans fer / # protocol The tftp protocol is often used to boot diskless / # workstations. , download configuration files to network-aware prin ters, / # and to start the installation process for some operating systems. service tftp {disable = no socket_type = dgram protocol = udp wait = yes user = root server = / usr / sbin / in .TFTPD # server_args = -s / tftpboot server_args = -s / root / arm / boot per_source = 11 cps = 100 2 flags = ipv4} [root @ lips fakeroot] # /etc/rc.d/init.d/xinetd Restart Stopping Xinetd: [OK] Starting Xinetd: [OK] [root @ lips fakeroot] # 5.6 Boot Process: Remote NFS Root File System # These Note Taken in # 开 行 行 行 加 加 # # # # # # # # # # 是FLASH in the current file RedBoot> fis list Name FLASH addr Mem addr Length Entry point RedBoot 0xF0000000 0xF0000000 0x00040000 0x00000000 RedBoot config 0xF07C0000 0xF07C0000 0x00001000 0x00000000 FIS directory 0xF07E0000 0xF07E0000 0x00020000 0x00000000 RedBoot> FIS free 0xF0040000 .. 0xf07c0000 redboot> # Download zimage kernel file from the host TFTP server through the network, and load the memory address 0x100000 # -r: Download the RAW data # -b 0x100000: Load the downloaded file into the memory address (how to determine This address? We have known the size of the target board RAM and the start address of the available memory. The memory address determined here should be greater than the start address; in addition, we use 0x100000, 1m, such a Aligned address.

) # - h 192.168.0.20: Host (TFTP server) IP address # zimage: Linux kernel file name redboot> loading -r -b 0x100000 -h 192.168.0.20 zimage raw file loaded 0x00100000-0X001C71D7, Assumed entry at 0x00100000 # with FIS The crete command of the tool writes the kernel file in the memory, and is named kernel # -b 0x100000: The address in the memory (same as the front load command) # -l 0xe0000: Write data length (how to determine This length? According to the return information of the previous load command, you can know the file size loaded into the memory, then take a value of an Era Se Block size that is not less than file size and aligned with Flash. We already know the Erase Block of Flash used in the target board. Size is 0x2 0000, so this is 0xe0000. Special attention The idle start address of FLA SH is used by default.

Redboot> FIS CREATE -B 0x100000 -L 0xE0000 KERNEL ... ERASE from 0xf0040000-0xf0120000: ....... ... Program from 0x00100000-0X001E0000 AT 0xF0040000: ....... ... unlock from 0xf07e0000-0xf0800000:. ... Erase from 0xf07e0000-0xf0800000:. ... Program from 0x01fdf000-0x01fff000 at 0xf07e0000:. ... Lock from 0xf07e0000-0xf0800000:. # look RedBoot> fis list Name FLASH addr Mem addr Length Entry point RedBoot 0xF0000000 0xF0000000 0x00040000 0x00000000 RedBoot config 0xF07C0000 0xF07C0000 0x00001000 0x00000000 FIS directory 0xF07E0000 0xF07E0000 0x00020000 0x00000000 kernel 0xF0040000 0x00100000 0x000E0000 0x00100000 RedBoot> fis free 0xF0120000 .. 0xF07C0000 RedBoot> # then the kernel file is already in use FLASH # fis tool load command KERNEL from Flash into memory Redboot> FIS LOAD KERNEL # executes the last loaded kernel, the back is the kernel's boot parameter # console = ttys0, 115200: as the serial port TTYS0 of the target as a console, Baud rate 115200 # ip = 192.168.0.21: Set the IP address of the target machine # root = / dev / nfs: root device, set to remote NFS mount # nfsroot = 192.168.0.20: / root / arm / fakeroot: Provide NFS remote root file system The host IP address and absolute path (note that the NFS server and the exports path should have been properly set up) # 这After entering the command, if everything is normal, the kernel will start and mount the root file system Run Redboot> exec -c "console = TTYS0, 115200 IP = 192.168.0.21 root = / dev / nfs nfs root = 192.168.0.20: / Root / arm / fakeroot "Using Base Address 0x00100000 and length 0x000E0000 Uncompressing Linux ................................. ........................ done, booting the kernel. Linux Version 2.4.21-RMK1-DS0-DJ9 (root @

Lips) (GCC Version 2.95.3 200103 15) # 1 MON JUL 5 14:34:15 CST 2004 CPU: xscale-IOP80321 Revision 2 Machine: Intel iQ80321 Alloc_bootmem_low metable_init on node 0 Totalpages: 16384 zone (0): Zone (1): 0 Pages. Zone (2): 0 Pages. Kernel Command line: console = TTYS0, 115200 IP = 192.168.0.21 root = / dev / nfs nfsroot = 192.168.0.20: / root / arm / fakeroot Calibrating delay loop ... 599.65 BogoMIPS Memory: 64MB = 64MB total Memory: 62904KB available (1398K code, 261K data, 232K init) XScale Cache / TLB Locking Copyright (c) 2001 MontaVista Software, Inc. Dentry cache hash table entries: 8192 (Order: 4, 65536 BYtes) Inode Cache Hash Table Entries: 4096 (Order: 3, 32768 BYtes) Mount Cache Hash Table Entries: 512 (Order: 0, 4096 BYTES) Buffer-Cache Hash Table Entries: 4096 (Order: 2, 16384 BYtes) Page-Cache Hash Table Entries: 16384 (ORDER: 4, 65536 BYtes) POSIX Conformance Testing by Unifix PCI: Bus0: Fast Back to Back Transfers Disabled Linux Net4.0 for Linux 2.4 Based Upon Swansea UNIV . Ersity Computer Society NET3.039 Initializing RT netlink socket Intel IOP3xx AAU RAID Copyright (c) 2003 Intel Corporation Starting kswapd JFFS2 version 2.1 (C) 2001 Red Hat, Inc., designed by Axis Communicatio ns AB pty:. 256 Unix98 ptys configured Serial Driver Version 5.05c (2001-07-08) with MANY_PORTS Share_IRQ Seria L_PCI Enabled TTYS00 AT 0xFe800000X (IRQ =

28) is a 16550A Real Time Clock Driver v1.10e RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize Intel (R) PRO / 1000 Network Driver - version 5.0.43-k1 Copyright (c) 1999-2003 Intel Corporation. eth0: Intel (R) PRO / 1000 Network Connection Uniform Multi-Platform E-IDE driver Revision: 7.00beta4-2.4 ide: Assuming 33MHz system bus speed for PIO modes; override with idebus = xx cfi_cmdset_0001: Erase suspend on write enabled Using buffer write method Using RedBoot partition definition Creating 5 MTD partitions on "IOP3xx Flash": 0x00000000-0x00040000: "RedBoot" 0x00040000-0x00120000: "kernel" 0x00120000-0x007c0000: "unallocated space" 0x007c0000-0x007c1000: "RedBoot config" mtd: partition " RedBoot config "does not end on an erase block - force r ead-only 0x007e0000-0x00800000:" FIS directory "md: raid5 personality registered as nr 4 raid5: measuring checksumming speed iop3xx_aau: 223.200 MB / sec raid5: using function: IOP3XX_AAU (223.200 MB / SEC) MD: MD Driver 0.90.0 MAX_ MD_DEVS = 256, MD_SB_DISKS = 27 MD: Autodtection Raid Arrays. MD: Autorun ... Md: ... Autorun Done. Net4: Linux TCP / IP 1.0 for Net4.0 IP Protocols: ICMP, UDP, TCP IP: Routing Cache hash table of 512 buckets, 4Kbytes TCP: Hash tables configured (established 4096 bind 4096) IP-Config: Guessing netmask 255.255.255.0 IP-Config: Complete: device = eth0, addr = 192.168.0.21 <6> e1000: eth0 NIC Link IS UP 100 MB PS Full Duplex, Mask = 255.255.255.0, GW = 255.255.255.255, Host = 192.168.0.21, Domain =, NIS-DOMAIN = (None), BootServer = 255.255.255.255, rootserver = 192.168.0.20, rootpath =

Net4: UNIX Domain Sockets 1.0 / Smp for Linux Net4.0. NetWinder Floating Point Emulator V0.97 (Double Precision) Looking Up Port of RPC 100003/2 on 192.168.0.20 Looking Up Port of RPC 100005/1 ON 192.168.0.20 VFS : MOUNTED ROOT (NFS FileSystem). Freeing Init Memory: 232K # 车 激 激 控制 控制 please press Enter to Activate this Console. Busybox V1.00-Pre10 (2004.04.27-01: 28 0000) Built-in Shell (ASH) ENTER 'HELP' for a list of build-in command, the shell prompt appears, indicating the boot success / # 5.7 boot process: Flash root file system # Using MKFS.JFFS2 tools, make root file system images # -d fakeroot: The content of the root file system is placed in the Fakeroot directory # -e 0x20000: flash's EraseBlock size is 0x20000 byte # -p: Align EraseBlock # -o fakeroot.jffs2.img with the space of the 0xFF populated file. Output image file name [root @ lips arm] # mkfs.jffs2 -d fakeroot -e 0x20000 -p -o fakeroot.jffs2. IMG # copies the image file to the root of the TFTP server (here is / root / arm / boot / [Root @ lips arm] # cp fakeroot.jffs2.img boot / [root @ lips arm] # # 当 当 f 布 布 布 地址,> 地址>>>>>>>>>> 0xF0000000 0x00040000 0x00000000 Redboot Co nfig 0xF07C0000 0xF07C0000 0x00001000 0x00000000 FIS directory 0xF07E0000 0xF07E0000 0x00020000 0x00000000 kernel 0xF0040000 0x00100000 0x000E0000 0x00100000 RedBoot> fis free 0xF0120000 .. 0xF07C0000 # TFTP server via a network from a host fakeroot.jffs2.img downloaded file, and loaded into memory where several addresses 0x10 0000 # The meaning of the parameters can refer to the previous section # -b 0x100000: Determine the principle of this value is the same as the downloading kernel file, and you can use a different address Redboot> Load -R -B 0x100000 -H 192.168.0.20 FakerOot.jffs2. Img Raw File Loaded 0x00100000-0X0023FFF, Assumed Entry AT 0x00100000 # Erase command with the FIS tool Erase the specified Flash area # After the area is filled with 0xFF, this is to ensure that the space without the valid data is "clean ", Thereby avoiding errors caused by spam in the end of the file. This step is not required.

Redboot> FIS ERASE -F 0xF0120000 -L 0x140000 # Write the contents of the content in the memory with the WRITE command with the FIS tool to write the content # -b 0x100000: Data address in memory # -f 0xf0120000: Data Write an address (how to determine This address? From the above FIS FRE E command, you can know the starting address of the currently available space, which is certainly available. Of course, you can rely on some, such as 0xF0200000, but pay attention to this, there will be an idle space, and It will affect the number of root equipment, namely / dev / mtdblock ?.) # -l 0x140000: Data block length (how to determine this length? Back information from the load command knows the size of the image file, then take a slightly big and aligned ERASE . block size value of 0x20000) RedBoot> fis write -b 0x100000 -f 0xf0120000 -l 0x140000 * CAUTION * about to program FLASH at 0xf0120000..0xf025ffff from 0x00100000 -? continue (y / n) y ... Erase from 0xf0120000- 0xF0260000: .................................... # with the create command of the FIS tool named the content for FakeRoot # N: This parameter specifies only the directory node Redboot> FIS CREATE -F 0xF0120000 -L 0x140000 -N FakeRoot ... unlock from 0xf07e0000-0xf0800000:. ... ERASE from 0xf07e0000-0xf0800000:. ... Program from 0x01fdf000- 0x01FFF000 AT 0xF07E0000:. ... Lock from 0xf07e0000-0xf0800000:. # View 0000 0xF0000000 0x00040000 0x00000000 RedBoot config 0xF07C0000 0xF07C0000 0x00001000 0x00000000 FIS directory 0xF07E0000 0xF07E0000 0x00020000 0x00000000 kernel 0xF0040000 0x00100000 0x000E0000 0x00100000 fakeroot 0xF0120000 0xF0120000 0x00140000 0x00100000 RedBoot> fis free 0xF0260000 .. 0xF07C0000 # RedBoot load the kernel from FLASH> fis load kernel # exec command execution cores, -c Specify boot parameters # console = TTYS0, 115200: Set the serial port console # root = / dev / mtdblock2: Set the root file system to / dev / mtdblock2 # This "/ dev / mtdblock2" is determined? We have created device nodes MTDBLOCK0 ~ M TDBLOCK7 where you want to determine which device corresponds to the JFFS2 file system written to the flash.

The method is that from the start address of Flas H, the written JFFS2 is located in the first few partitions; counts from 0; the first partition on IQ80321 board is Redboot; "UNALLOCATED SPACE" is also considered. Accurate information can be seen during the guided process, such as "Creating 6 MTD Partitions ON IOP3XX Flash:"; or can be seen in the / proc / mtd file after the boot is successful.

Redboot> exec -c "console = ttys0, 115200 root = / dev / mtdblock2" Using base address 0x00100000 and length 0x000e0000 uncompressing Linux ....................... .............................. .... done, booting the kernel. Linux version 2.4.21-RMK1-DS0- dj9 (root @ lips) (gcc version 2.95.3 200103 15 (release)) # 1 Mon Jul 5 14:34:15 CST 2004 CPU: XScale-IOP80321 revision 2 Machine: Intel IQ80321 alloc_bootmem_low memtable_init On node 0 totalpages: 16384 zone (0): 16384 Pages. Zone (2): 0 pages.......................................... .. 64MB total Memory: 62904KB available (1398K code, 261K data, 232K init) XScale Cache / TLB Locking Copyright (c) 2001 MontaVista Software, Inc. Dentry cache hash table entries: 8192 (order: 4, 65536 bytes) Inode cache hash table Entries: 4096 (Order: 3, 32768 BYtes) Mount Cache Hash Table Entries: 512 (Order: 0, 4096 BYtes) Buffer-Cache Hash Table Entries: 4096 (Order: 2, 16 384 bytes) Page-cache hash table entries: 16384 (order: 4, 65536 bytes) POSIX conformance testing by UNIFIX PCI: bus0: Fast back to back transfers disabled Linux NET4.0 for Linux 2.4 Based upon Swansea University Computer Society NET3.039 . Initializing RT netlink socket Intel IOP3xx AAU RAID Copyright (c) 2003 Intel Corporation Starting kswapd JFFS2 version 2.1 (C) 2001 Red Hat, Inc., designed by Axis Communicatio ns AB pty:. 256 Unix98 ptys configured Serial driver version 5.05c ( 2001-07-08) with many_ports share_irq seria l_pci enabled TTYS00 AT 0xFE800000X (IRQ =

28) is a 16550A Real Time Clock Driver v1.10e RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize Intel (R) PRO / 1000 Network Driver - version 5.0.43-k1 Copyright (c) 1999-2003 Intel Corporation. eth0: Intel (R) PRO / 1000 Network Connection Uniform Multi-Platform E-IDE driver Revision: 7.00beta4-2.4 ide: Assuming 33MHz system bus speed for PIO modes; override with idebus = xx cfi_cmdset_0001: Erase suspend on write enabled Using buffer write method Using RedBoot partition definition Creating 6 MTD partitions on "IOP3xx Flash": 0x00000000-0x00040000: "RedBoot" 0x00040000-0x00120000: "kernel" 0x00120000-0x00260000: "fakeroot" 0x00260000-0x007c0000: "unallocated space" 0x007c0000-0x007c1000: " RedBoot config "mtd: partition" RedBoot config "does not end on an erase block - force r ead-only 0x007e0000-0x00800000:" FIS directory "md: raid5 personality registered as nr 4 raid5: measuring checksumming speed iop3xx_aau: 223.200 MB / sec raid5: using function: IOP3XX_AAU (223.20 0 MB / sec) MD: MD Driver 0.90.0 max_md_devs = 256, md_sb_disks =

27 MD: Autodetecting Raid Arrays. MD: Autorun ... Md: ... Autorun Done. Net4: Linux TCP / IP 1.0 for Net4.0 IP Protocols: ICMP, UDP, TCP IP: Routing Cache Hash Table of 512 BUCKETS, 4Kbytes TCP: Hash tables configured (established 4096 bind 4096) NET4: Unix domain sockets 1.0 / SMP for Linux NET4.0 NetWinder Floating Point Emulator v0.97 (double precision) VFS:. Mounted root (jffs2 filesystem) Freeing init memory.: 232K Setting hostname iq80321: Mounting proc filesystem: mount: Mounting none on / proc failed: Device or resource busy Please press Enter to activate this console BusyBox v1.00-pre10. (2004.04.27-01: 28 0000) Built-in Shell (ASH) ENTER 'HELP' for a list of build-in commands. # gets the shell prompt, the boot is successful! / ## We use the ERASE / WRITE / CREATE for three consecutive commands to complete the write of the JFFS2 image file system, mainly to ensure that 0xFF fills the non-valid data space, if this is guaranteed, use the create command to write directly It is also possible to enter Flash. How to ensure 0xFF fill? Experience is that the FIS INIT -F command is completely initialized for Flash, and the idle space is filld by 0xFF; or use the Fis Erase command to erase Flash; or use the mfill command to populate a memory area to 0xFF again to the zone; necessary If you can use the dump command to check the contents of Flash. In short, understanding "What" can be flexible to use these commands without having to stick to the demonstration in the document.

# Here is the test: RedBoot> fis free 0xF0260000 .. 0xF07C0000 RedBoot> load -r -b 0x200000 -h 192.168.0.20 fakeroot.jffs2.img Raw file loaded 0x00200000-0x0033ffff, assumed entry at 0x00200000 RedBoot> fis create -b 0x200000 -f 0xf0260000 -L 0x140000 fakeroot2 ... Erase from 0xF0260000-0xf03a0000: ....................................................... Unlock from 0xf07e0000-0xf0800000:. ... Erase from 0xf07e0000-0xf0800000:. ... Program from 0x01fdf000-0x01fff000 at 0xf07e0000:. ... Lock from 0xf07e0000-0xf0800000:. RedBoot> fis list Name FLASH addr Mem addr Length Entry point RedBoot 0xF0000000 0xF0000000 0x00040000 0x00000000 RedBoot config 0xF07C0000 0xF07C0000 0x00001000 0x00000000 FIS directory 0xF07E0000 0xF07E0000 0x00020000 0x00000000 kernel 0xF0040000 0x00100000 0x000E0000 0x00100000 fakeroot 0xF0120000 0xF0120000 0x00140000 0x00100000 fakeroot2 0xF0260000 0xF0260000 0x00140000 0x00200000 RedBoot> fis free 0xF03A0000 .. 0xF07C0000 RedBoot> dump -b 0xf025ff 00 f025ff00: FF FF FF FF FF FF FF FF FF FF FF FF FF FF | ........... ..... | F025FF10: FF FF FF FF FF FF FF FF FF FF FF ff ff ff | ........... ..... | Redboot> Fis Load Kernel Redboot> EXEC-C "Console = TTYS0, 115200 ROOT = / dev / mtdblock3" Using Base Address 0x00100000 And length 0x000e0000 uncompressing linux ............................................. ........ .... / # cat / proc / mtd dev: size eraSesize name mtd0: 00040000 00020000 "Redboot" mtd1: 000E0000 000200 "kernel" MTD2: 00140000 00020000 "Fakeroot" MTD3: 00140000 00020000 " Fakeroot2 "MTD4: 00420000 00020000" UNALLOCATED SPACE "MTD5: 00001000 00020000" Redboot Config "

mtd6: 00020000 00020000 "FIS directory" / # mount / dev / mtdblock3 on / type jffs2 (rw) / proc on / proc type proc (rw) / # 5.8 FLASH memory space distribution RAM: 0x00000000-0x08000000, 0x0001b488-0x01fd1000 available FLASH :. 0xf0000000 - 0xf0800000, 64 blocks of 0x00020000 bytes each Name FLASH addr Length 0 RedBoot 0xF0000000 0x00040000 1 kernel 0xF0040000 0x000E0000 core 2 fakeroot 3 0xF0260000 Free (unallocated space) 0xF0120000 0x00140000 root file system 4 RedBoot config 0xF07C0000 0x00001000 5 FIS directory 0xF07E0000 0x00020000 0xF0800000 END 6 Tip 6.1 I have resolved issues 6.1.1 Problem Description The entire development process is still relatively smooth, because there is a reduction of Linux systems (LiPs), the boot process of remote N fs root file system is successful. Said to use the JFFS2 file system boot in Flash, I have encountered some tricky problems, and fortunately spent two days. It will now explain the problems and solutions to it. At that time, Kernel had written in Flas H with a mkfs.jffs2 command on the host, but did not use the --raSeBlock = 0x20000 and -p parameters. Then when writing the image file from the memory with the FIS CREATE command, the length of the -L parameter specified is 0x200000 (2M). In fact, the image file is only 1.2m left and right, and it wants to leave the file system.

When you are ready to root = / dev / mtdblock / 2 as a parameter the launch kernel, following results were obtained: RedBoot> fis list Name FLASH addr Mem addr Length Entry point RedBoot 0xF0000000 0xF0000000 0x00040000 0x00000000 RedBoot config 0xF07C0000 0xF07C0000 0x00001000 0x00000000 FIS directory 0xF07E0000 0xF07E0000 0x00020000 0x00000000 kernel 0xF0040000 0x01008000 0x000C0000 0x01008000 fakeroot 0xF0100000 0xF0100000 0x00200000 0x00100000 RedBoot> fis free 0xF0300000 .. 0xF07C0000 RedBoot> fis load kernel RedBoot> exec -c "console = ttyS0,115200 root = / dev / mtdblock / 2" Using base address 0x01008000 and Length 0x000c0000 uncompressing linux ............................................ ...... DONE Linux Version 2.4.21-RMK1-DS0-DJ9 (root @ lips) (GCC Version 2.95.3 20 010315 (Rel CPU: xscale-Iop80321 Revision 2 Machine: Intel iQ80321 Using Redboot Partition Definition Creating 6 MTD Partitions on "IOP3XX Flash": 0x00000000-0x00040000: "Redboot" 0x00040000-0x00100000: "kernel" 0x00100000-0X00300000: "Fakeroot" 0x00300000-0x007c0000: "unallocated space" 0x007c0000-0x007c1000: "RedBoot config" mtd: partition "RedBoot config" does not end on an erase block - for ce read-onl 0x007e0000-0x00800000: "FIS directory"

jffs2_scan_eraseblock (): Magic bitmask 0x1985 not found at 0x0000000 0: 0xf018 i jffs2_scan_eraseblock (): Magic bitmask 0x1985 not found at 0x0000000 4: 0xf018 i jffs2_scan_eraseblock (): Magic bitmask 0x1985 not found at 0x0000000 8: 0xf018 i jffs2_scan_eraseblock (): Magic bitmask 0x1985 not found at 0x0000000 c: 0xf018 id ............ Further such events for this erase block will not be printed JFFS2:. Erase block at 0x00000000 is not formatted It will be erased jffs2_scan_eraseblock (): Magic bitmask 0x1985 not found at 0x0002000 0: 0x0008 id jffs2_scan_eraseblock (): Magic bitmask 0x1985 not found at 0x0002000 4: 0xaff0 id jffs2_scan_eraseblock (): Magic bitmask 0x1985 not found at 0x0002000 8: 0x1009 id ............ Further such events for this erase block will not be printed JFFS2 : ERASE BLOCK AT 0x00020000 is not formatted. It will be ERASED COWARDLY TO ERASE BLOCKS ON FILESYSTEM WITH NO VALID JFFS2 NODES KERNEL PANIC: VFS: UNABLE TO MOUNT ROOT FS ON 1F: 00 There are mainly two problems here, respectively, respectively. 6.1.2 Creating a JFS2 file system notes dozens of lines occur during boot process "Jffs2_scan_eraseblock (): magic bitmask 0x198 5 Not found ..." Information Description Jffs2 file system has problems. Also, if I first boot with the remote NFS root file system, then directly mount -t jffs2 / dev / mtdblock / 2 / mnt in the target machine system will also get the same warning message, but it can be seen in / mnt. File system content. In order to solve this problem, I first read the master page of mkfs.jffs2, and found that therasebl ock parameter seems to be more important, and I don't use it, so I found the parameter value 0x20000, and use this parameter to rebuild the image file. Test indicates that the problem still exists. Find data discovery, some people emphasize using the -p option when mkfs.jffs2, and its role is from the end of the file to the last Erase Block populate 0xFF. At this time I realized that the unallocated space of Flash must be filled with 0xFF. And my previous practice can't guarantee this. The first -P option is not specified; secondly, since the -l parameter specifies the length of the memory area is far greater than the length of the actual image file, a large amount of spam in the memory area is written in FL ASH. Therefore, re-belt -P -P production JFFS2 file system image, and remember -L 0x200000 to 0x140000 Write Flash, so the mount is OK, no warning information will appear again.

But kernel Panic still exists, this is another problem. 6.1.3 / dev / mtdblock / 2 or / dev / mtdblock2 (first explain, '2' is just an example ./Dev/mtdblock/n, N, 0, 1, 2, 3, and...) It looks like these two devices The node should be completely equivalent. At least I think so. In the information you have seen, some use / dev / mtdblock / 2, some use / dev / mtdblock2. The difference that can be seen is that if multiple MTD block device nodes are required, put these nodes in a separate / dev / mtdblock directory instead of being put on / dev under / dev, you can make the / dev look refreshed. Therefore, when I am making root file system, I chose the former, that is, at the / dev / mtdblock directory created 0-7 total 8 device nodes. However, "Kernel PANIC: VFS: Unable to Mount Root FS ON 1F: 00" error Description The kernel does not correctly locate the root file system from the boot parameter "root = / dev / mtdblock / 2" (even if the previous problem has been solved. Guaranteed that the JFFS2 file system has no problem). After considering how many possibilities have been excluded, I decided to try "root = / dev / mtdblock 2". The miracle happened, the guidance is successful! Special attention, I didn't modify the / dev device node, but only modified the way the boot parameters were modified. That is, regardless of the MTD device node you created is / dev / mtdblock / 2 or / dev / mtdblock2, kernel boot parameters should be "root = / dev / mtdblock2"! In order not to cause more confusion, I still change the device node to / dev / mtdblock2 form. So can you use / dev / mtdblock / 2 in the end of the kernel boot parameters? Later I guess the kernel if the DEVFS supported should be possible. The purpose of DEVFS is not to change / dev to a clear hierarchy from a mess-up flat structure? But I haven't verified yet. In addition, the location of the "main device number, the secondary device number" is used in the form of "main device number, secondary device number" in the kernel boot parameters, is also possible. As shown below, "root = 1f02" also specifies / dev / mtdblock2.

0x1 f = 31 is the main device number of the MTD block device, 0x02 = 2 is the secondary device number, ie MTDBLOCK2. Redboot> Fis Load Kernel Redboot> EXEC-C "Console = TTYS0, 115200 ROOT = 1F02" Using Base Address 0x00100000 and length 0x00000 Uncompressing Linux ..................... ............................................ vfs: mounted root (jffs2 filesis " Freeing Init Memory: 232k please press Enter to Activate this console. Busybox v1.00-pre10 (2004.04.27-01: 28 0000) Built-in shell (ASH) ENTER 'HELP' for a list of Built-in Commands . / # 5 / version jffs2 (rw) / proc on / proc Type Proc (RW) / # 6.2 has not been resolved issued issued issues 6.2.1 RTC (Hardware Clock and System Time) Busybox's HWCLock does not access RTC ( / dev / rtc), will generate segmentation fault, re-accessed the RTC device again. At present, because of hardware clock and system time, the system time is reset to 1970 after restarting. Test found that HWClock in util-linux-2.11z (http://kernel.org/pub/linux/utils/util-li nux / util-linux-2.11z.tar.gz) has the same problem. It is estimated that it is related to IQ80321 board? 6.2.2 Compliance with RedHat Compatible System Profile and Start Scripting Network Configuration Related / etc / sysconfig / network-script /etc/rc.d/init.d/network system log related / var / log / message 6.2.3 How to create An empty JFFS2 file system? 6.2.4 Starting the Telnetd server Some people say that as long as the DEVPTS is mounted to / dev / pts.

/ etc / fstab file is added as follows: none / dev / pts devpts mode = 620 0 0 on Fri, Jul 16, 2004 At 09:08:28 am 0800, xiaoming dong wrote:> i tried telnetd in busybox 1.00-pre10 And Faard IQ80321, Using Linux-2.4.21-RMK1-DS0.> I Beleive Telnetd Require Some Kernel Configurations As Follo Wing,> Character Devices --->>> [*] Virtual Terminal> [ *] Support for console on virtual terminal> But I can not compile the kernel sucessful if I added these options,> it failed on some files about 'keyboard' (my board have no keyboar d, you know).> If someone do this successed , please let me know, not virtual terminal suppst. and you need to mount the devpts filesystem: mount -t devpts devts / dev / pts. Erik - ---- Erik mouw ---- www. Bitwizard.nl ---- 31 15 2600 998 ---- Run Telnetd (busybox 1.00-pre10) on the 80321 platform, then connect from other hosts, the login process is as follows: [root @ lips root] # Telnet 192.168.0.21 Trying 192.168.0.21 ... connezted to 192.168.0 .21. Escape character is '^]'. IQ80321 ARM Linux kernel 2.4.21-rmk1-ds0-dj9 on an armv5l iQ80321 login: root password: login incorrect, telnetd is indeed running, but the user authentication has problems.

Should I try TinyLogin? (Refer to http://www.busybox.net/lists/busybox/2003-may/008370.html) [busybox] How I got telnetd to run lbrigman at fcpa.fujitsu.com lbrigman at fcpa.fujitsu.com Tue May 20 12:11:15 MDT 2003 Here is what I did to get my diskless nodes to run telnetd. Part of the problem with this is that telnetd is considered a security risk and has been removed from most default distribution installations and replaced with ssh along with all the supporting documentation. Also I was not ever successful using the predeclared devices or usi ng inetd. This is probably my own fault because of a lack of understanding. 1. Compile busybox with telnetd on and set "use devpts" in "General Configuration "To on. You don't need need to compile or turn the number of files That Are Needed. 2. Build a kernel with filesystems -> / dev / pts = y. character Devic ES UNIX98 PTY = Y. Chose a Number of Pty to Support. Configure your networking as required for your setup. 3. in your root file system make ad irectory / dev / pts and mknod / de v / ptmx c 5 2 4. If you are using shared libraries make sure you have llibnsl.so.1 libnss_files.so.2 libnss_compat.so.2 with the appropriate symbolic links. You will have to have oth ers for busybox to even run. (My problem with some of the networking code is that mklibs.sh misses these libraries) 5. Have an entry in the / etc / fstab file like none / dev / pts devpts defaults 0 0 You Will Have To Mount It Either Manually (Mount -t Devpts / Dev / Pts) Or when your startup scripts run "mount -a"

转载请注明原文地址:https://www.9cbs.com/read-43524.html

New Post(0)