Chapter 5 build a testing environment for the Development Board

Source: Internet
Author: User
Tags gmp

Development Environment Configuration
1. Build the cross-compilation tool chain required by the compiling environment: S3C6410XToolChain4.2.2-EABIV0.0-cross-4.2.2-eabi.tar 1. decompress the tool chain to obtain the folder 4.2.2-Eabi/2. create the directory ARM/Under/usr/local/(note that it is best to put it in this directory, otherwise some errors may occur in the future compilation process) 3. move directory 4.2.2-Eabi/to/usr/local/ARM/4. set the environment variable: edit the/etc/profile file and add: Path = "$ path: /usr/local/ARM/4.2.2-Eabi/usr/bin "exportpath to make the environment variable take effect: Enter the command: Source/etc/profile on the terminal to test whether the environment variable is set successfully: input echo $ path on the terminal. If the output path contains/usr/local/ARM/4.2.2-Eabi/usr/bin, the environment variable is successfully set.. Test the cross-compiled toolchain in the terminal input: Arm-Linux-gcc-V displays the following: Usingbuilt-inspecs.Target: Arm-unknown-Linux-gnueabiconfiguredwith: /home/scsuh/workplace/coffee/buildroot-20071011/toolchain_build_arm/gcc-4.2.2/configure -- prefix =/usr -- Build = i386-pc-linux-gnu -- Host = i386-pc-linux-gnu -- target = arm-unknown-Linux-gnueabi -- enable-languages ages = C, c ++ -- With-sysroot =/usr/local/ARM/4.2.2-Eabi/-- With-Build-time-tools =/usr/local/ARM/4.2.2-Eabi/ /Usr/ARM-unknown-Linux-gnueabi/bin -- disable-_ cxa_atexit -- enable-target-optspace -- With-GNU-LD -- enable-shared -- With-GMP =/ usr/local/ARM/4.2.2-Eabi // GMP -- With-mpfr =/usr/local/ARM/4.2.2-Eabi // mpfr -- disable-NLS -- enable-threads -- disable -multilib -- disable-largefile -- With-arch = armv4t -- With-float = soft -- enable-cxx-flags =-msoft-floatthreadmodel: posixgccversion4.2.2 indicates that the cross-compilation toolchain has been installed successfully.
2. Build a file system image production environment 1. create the root file system directory rootfs and its subdirectories bin, sbin, Boot, root, sys, SRV, Proc, and USR. compile busybox1.7.0 :( the required source package: busybox-1.7.0.tar.bz2) 2.1 extract the source package, enter the source directory; 2.2 configure busybox: In the source directory to execute makemenuconfig, if you use the default configuration, directly exit, save, if you need to configure your own, change the corresponding options and save and exit. Choose the following options to support the full-featured tab complementing busyboxsettings ---> busyboxlibrarytuning ---> [] tabcompetion has supported the mountnfs function 2.3 modify the makefile of the source code Directory: Change the 175 rows: arch? = $ (Subarch) changed to: arch? = Arm
Set row 176: cross_compile? = Changed to cross_compile? = Arm-linux-2.4 official compilation busybox: Execute make compilation 2.5 install busybox in the source Directory: Execute the command makeconfig_prefix =/***/rootfs (root file system directory) install3. copy the glibc library-related files to the root file system. The glibc library files are already available in the Cross-compilation toolchain, you can directly copy it and use $ sudocp/usr/local/ARM/4.2.2-Eabi/lib /*. so */***/rootfs/lib/-d $ sudocp/usr/local/ARM/4.2.2-Eabi/usr/ARM-unknown-Linux-gnueabi/lib /*. so */***/rootfs/lib/-D4. create the configuration file: 4.1 create/etc/inittab. The content is as follows: #/etc/inittab: sysinit: /etc/init. d/RCS: askfirst:-/bin/sh: ctrlal Tdel:/sbin/reboot: shutdown:/bin/umount-a-r4.2 create/etc/init. d/RCs, the content is as follows: (After creation, change its attributes so that it can execute sudochmod + x/etc/init. d/RCs )#! /Bin/sh (this script is mainly used to automatically generate device files) # ifconfigeth0192.168.1.17mount-amkdir/dev/ptsmount-tdevptsdevpts/dev/ptsecho/sbin/mdev>/proc/sys/kernel/hotplugmdev-s4.3 create the/etc/fstab file with the following content: # devicemount-mounted/procprocdefaults00tmpfs/mounted to create a device file. Execute $ sudomknodconsolec51 $ sudomknodnullc13 in the/dev directory of the root file system. This is our most basic root file system.. 6. test whether the mkcramfs package has been installed on the root file system in the PC, so that the root file system can be created in the cramfs format: $ mkcramfs/***/rootfs. cramfs is used to burn uboot, kernel, and rootfs to the Development Board and restart the Development Board (for details about how to burn these contents, see section 3: kernel and file system image burning). The system starts normally and enters the shell, the test is successful. 7. test the basic C program and write the simplest hello on the PC when running the root file system. C program: # include <stdio. h> intmain () {printf ("Hello! \ N ");
Return0;} compile the program: $ the arm-linux-gcc-ohellohello.c copies the compiled hello to any directory such as/bin or/sbin or/usr/bin or/usr/sbin of the root file system to recreate the root file system image rootfs. cramfs re-burn and write the root file system image to the Development Board to restart the Development Board, enter shell, run the hello program, and display hello! The test is successful.
For details about how to use the three-character internal kernel and file system image, see 6410linuxuserguide.pdf.
4, build the kernel development environment file: linux-2.6.24-for-apdk6410.tar.gz unzip the kernel source code, enter the source directory (note: the source code must be placed in the directory does not contain Chinese, otherwise makeapdk6410_defconfig is not correctly executed) run the $ makeapdk6410_defconfig command in the source code directory (this command copies apdk6410_defconfig under ARCH/ARM/configs to the source code directory and name it. in this way, the corresponding configuration of apdk6410 is correctly used during compilation.) view the source code directory. the cross_compile file contains the following content:/usr/local/ARM/4.2.2-Eabi/usr/bin/ARM-Linux-we just installed the compiler in the corresponding location, if the file is not installed in the corresponding location, you need to change the file content to ensure that the path is consistent. Compile the kernel: Execute make in the source code directory to obtain the result: a zimage file is generated under ARCH/ARM/boot, which is the required kernel. Test: Install the kernel on the development board, restart the Development Board, and enter the system normally. Note: NFS support has been added to the configuration file by default. The configuration information is as follows: config_network_filesystems = networking = yconfig_nfsd = networking = yconfig_root_nfs = yconfig_lockd = yconfig_lockd_v4 = yconfig_exportfs = networking = yconfig_nfs_common =
V. program debugging method 1. install, configure, and start the NFS service $ sudoapt-getinstallnfs-kernel-serverportmap on the PC to modify its configuration file/etc/exports. Add the following content to it: /work/nfs_root * (RW, sync, no_root_squash) Then you can access the above directories through the Network File System. After modification, save and exit, and restart the NFS service: $ sudo/etc/init. d/nfs-kernel-server restart 2. after the system is started on the Development Board (the network has been set through the configuration file, you can change different IP addresses on your own), execute the command on the Development Board System: Mount-O nolock 192.168.0. *:/work/nfs_root/mnt. In this way, the IP address is 192.168.0. * mount the/work/nfs_root directory on the PC to the/mnt directory of the development board system. 3. after completing the above operations, you can debug the program that you have compiled at any time.

Chapter 5 build a testing environment for the Development Board

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.