AT91SAM9260 builds LINUX operating system

Publisher:闪耀星空Latest update time:2022-07-07 Source: csdnKeywords:AT91SAM9260 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Purpose of writing

        This document is used to record the process of AT91SAM9260 LINUX learning. A previously developed 9260 core board is used for development. This core board is designed based on the official AT91SAM9260-EK development board of ATMEL, so it uses the same BOOTLOADER and KERNEL as the official development board.


        You can download the software support package of AT91SAM9260-EK development board from www.linux4sam.org or ftp://www.at91.com/pub/ for development. ATMEL no longer maintains this development board separately. The relevant software source code is integrated into the latest AT91 source code. Use make to select the corresponding development board.


        www.linux4sam.org has the corresponding software (bootstrap, uboot, kernel) source code and related usage methods. Some of the compilation and installation methods in this document may come from the instructions on this website.


Development environment description: CentOS 6.5 (2.6.32), arm-linux-gcc 4.3.2


2. System Construction

1. Download relevant software packages

        Ø sam-ba_2.12.zip (image burning tool)


                This tool can be downloaded from the Internet, and registration is required to download from www.linux4sam.org.


                ( http://pan.baidu.com/s/1o6mHJfW )


        Ø at91bootstrap-at91bootstrap-3.x.zip


                https://github.com/linux4sam/at91bootstrap/tree/at91bootstrap-3.x


                (http://pan.baidu.com/s/1hq1NgeK)


        Ø u-boot-at91-u-boot-2013.07-at91.zip


                https://github.com/linux4sam/u-boot-at91/tree/u-boot-2013.07-at91


                (http://pan.baidu.com/s/1mgC4qwS)


        Ølinux-at91-linux-2.6.39-at91.zip


                https://github.com/linux4sam/linux-at91/tree/linux-2.6.39-at91


                (http://pan.baidu.com/s/1mgC4qwS)


 


2. Bootstrap compilation

        Compile the nand flash image according to the instructions in README.txt in the bootstrap source code directory


        1) # make mrproper


        2) # make at91sam9260eknf_uboot_defconfig

        If a "Permission denied" error message is displayed, this error is usually caused by the executable file not having execution permission. You can grant execution permission to the relevant executable file, or grant execution permission to all files in the folder.


                # chmod +x * -R


        3) Add 64MB NAND support, gedit ./driver/nandflash.c

        4) # make menuconfig

        It prompts that ncurses cannot be installed. Use yum to install related tools.


                # yum install ncurses-devel


        Modify the following configurations:


                a) Memory selection ---> NAND flash configuration --->

 

                b) U-Boot Image Storage Setup --->

        5) #make CROSS_COMPILE=arm-linux-

        In http://www.at91.com/linux4sam/bin/view/Linux4SAM/AT91Bootstrap there are the following instructions:

        # make CROSS_COMPILE=arm-none-linux-gnueabi-


        Compilation is successful! The generated files are in the binaries directory.

 

        Although it can be compiled successfully, it cannot run after being downloaded to the target board, and there is no serial port output information. I have been trying for a long time without success. Maybe the high version of Bootstrap does not support 9260 well. In order not to affect the overall progress, I will skip this step and use Bootstrap V1.9 for transplantation. For details, please refer to "Bootstrap_V1.9 transplantation.doc".


3. U-BOOT compilation

a) Generate the configuration file using the command make at91sam9260ek_nandflash_config according to the ./doc/README.at91 document in the UBOOT directory.

b) Modify the configuration file gedit ./include/configs/at91sam9260ek.h


        i. Modify U-BOOT parameter address

        ii. Remove unnecessary instructions and keep only NAND instructions

        iii. Modify the startup command


                "nand read.jffs2 0x22000000 0xA0000 0x200000; bootm"

 

        After completion, use make to start compiling. Burn the generated u-boot.bin to the 0x00020000 position of NAND, and burn the previously generated bootstrap. For the LINUX image, temporarily use the one made before and burn it to the 0xa0000 position. After the image is burned, restart the development board. You can see that the LINUX boot is successful in the DEBUG window.

4. Linux compilation

a) Unzip the kernel to the current directory


        unzip -d ./ /media/sf_ShareDIR/source/linux-at91-linux-2.6.39-at91.zip


b) Enter the kernel source root directory: make mrproper


c) Generate the default configuration for AT91SAM9260EK. The configuration file is in ./arch/arm/configs/


        make ARCH=arm at91sam9260ek_defconfig


d) Enter the menuconfig configuration menu


        make ARCH=arm menuconfig


e) Board level configuration


        gedit ./arch/arm/mach-at91/board-sam9260ek.c


        i. MTD partition configuration


/*


 * NAND flash


 */


static struct mtd_partition __initdata ek_nand_partition[] = {


{


.name = "bootstrap",


.offset = 0,


.size = 128*1024,


},


{


.name = "uboot",


.offset = 128*1024,


.size = 256*1024,


},


{


.name = "env1",


.offset = 128*1024+256*1024,


.size = 128*1024,


},


{


.name = "env2",


.offset = 512*1024,


.size = 128*1024,


},


{


.name = "linux",


.offset = 640*1024,


.size = 2*1024*1024,


},


{


.name = "root",


.offset = 640*1024+2*1024*1024,


.size = 5*1024*1024,


},


{


.name = "user",


.offset = 640*1024+7*1024*1024,


.size = MTDPART_SIZ_FULL,


},


};


f) Configure the kernel (make menuconfig)


        i. Configure support for NFS


                File systems --->Network File Systems --->


                        <*> NFS client support


                        [*] NFS client support for NFS version 3


                        [*] NFS client support for the NFSv3 ACL protocol extension


                        [*] NFS client support for NFS version 4


                        [*] NFS client support for NFSv4.1 (EXPERIMENTAL)


                        [*] Root file system on NFS



g) Generate U-BOOT boot image


        make ARCH=arm CROSS_COMPILE=arm-linux- uImage


        It prompts that the mkimage tool is not installed. This tool can be obtained from the U-BOOT directory and copied to the /usr/bin directory.


         cp ../../2.u-boot/u-boot-at91-u-boot-2013.07-at91/tools/mkimage /usr/bin/



5. Download the system image from the TFTP server through the TFTP command of U-BOOT

        Refer to the document "Setting up a TFTP server under CentOS.doc" to set up the server. Modify the UBOOT source code to support related commands and set the server IP (this setting is relatively simple and is omitted here).


        U-BOOT commands are:


                setenv bootcmd 'tftp 0x22000000 /AT91SAM9260EK/uImage;bootm;'


Copy the kernel image to the TFTP directory:


        # /bin/cp arch/arm/boot/uImage /opt/TFTP_DIR/AT91SAM9260EK/


6. File system creation

        The file system uses the one previously made for the AM1808 core board. The compressed package is fs_lsh_20130320.tar.bz2 (http://pan.baidu.com/s/1pJylrBX). For detailed production methods, please refer to the document "Creating the minimum file system for the AM1808 core board.doc".


7. Mount NFS as root file system

a) Unzip the file system to the /opt/AT91SAM9260EK/4.FS/opt/AT91SAM9260EK/4.FS directory and rename it to NFS


        # tar -xvf /media/sf_ShareDIR/source/fs_lsh_20130320.tar.bz2 -C /opt/AT91SAM9260EK/4.FS/


        # mv /opt/AT91SAM9260EK/4.FS/fs_lsh/ /opt/AT91SAM9260EK/4.FS/NFS


b) Modify the NFS configuration file


        # gedit /etc/exports


        Configuration: /opt/AT91SAM9260EK/4.FS/NFS *(rw,no_root_squash,no_all_squash,sync)


c) Restart the NFS server


        # service nfs restart


d) Test whether the NFS server is started successfully


        # mount -t nfs localhost:/opt/AT91SAM9260EK/4.FS/NFS /mnt/


        # umount /mnt


e) Modify U-BOOT parameters (can be fixed in the code, or can be set by entering the setenv command in the U-BOOT command line)


 setenv bootargs 'mem=64M console=ttyS0,115200 mac=00:60:6E:42:BA:80 root=/dev/nfs nfsroot=192.168.1.222:/opt/AT91SAM9260EK/4.FS/NFS ip=192.168.1.123:192.168.1.222:192.168.1.1:255.255.255.0:::eth0:off '


f) Set the network parameters of U-BOOT and enable the PING command (to test whether the network is normal)


        #define CONFIG_ETHADDR 10:23:45:67:89:AB


        #define CONFIG_NETMASK 255.255.255.0


        #define CONFIG_IPADDR 192.168.1.123


        #define CONFIG_SERVERIP 192.168.1.222


g) Download, run and modify the kernel


        i. The error shown in the figure below is displayed. After analysis, the reason is that it is unable to communicate with the NFS server. The NFS function in the kernel has been turned on. It is found that there is no related execution of connecting to the network in the output information. It is estimated that it should be a problem with the network driver. Modify the network driver configuration (this step has been configured in the previous kernel transplantation).


        Menuconfig:


                Device Drivers --->Network device support ---> Ethernet (10 or 100Mbit) ---> <*> Atmel MACB support


                VFS: Unable to mount root fs via NFS, trying floppy.


                VFS: Cannot open root device "nfs" or unknown-block(2,0)

ii. After modifying the network configuration, it can be seen from the printed information that the NFS file system can be mounted. The system is currently stuck in Kernel panic. This may be caused by the compiler version used when compiling busybox. Open the following kernel configuration to solve it.


        Menuconfig:


                Kernel Features --->


                        [*] Use the ARM EABI to compile the kernel


                        [*] Allow old ABI binaries to run with this kernel (EXPERIMENTAL) (NEW


        Kernel panic - not syncing: Attempted to kill init!

iii. Now the NFS file system can be successfully mounted, and the operation reaches the position shown in the figure below. It prompts that the IP address setting failed. Since I did not set the IP address intentionally, it still prompts this, so I suspect that it is reset in the startup file. Open the /etc/init.d/rcS file, remove the relevant code, and only keep the following content.

[1] [2]
Keywords:AT91SAM9260 Reference address:AT91SAM9260 builds LINUX operating system

Previous article:AT91SAM9260 uses SAM-BA to debug the BOOT program
Next article:Linux (AT91SAM9260) adds support for UBIFS file system

Recommended ReadingLatest update time:2024-11-23 03:04

Embedded Linux ARM Assembly (IV) - ARM Assembly Programming
There are four structural forms of assembler programs: sequence, loop, branch, and subroutine. 1. Sequential Structure Program example: AREA Buf,DATA,READWRITE; define the data segment Buf   Array DCB 0x11, 0x22, 0x33, 0x44; define a 12-byte array Array   DCB 0x55,0x66,0x77,0x88 DCB 0x00,0x00,0x00,0x00 AREA hello,C
[Microcontroller]
arm-linux-gdb+gdbserver environment construction and remote debugging
0) Download gdb source code: http://ftp.gnu.org/gnu/gdb/ 1) Compile arm-linux-gdb     Specify the location of the cross-compilation toolchain     export PATH=$PATH:/usr/local/arm/3.4.1/bin     to start configuration and compilation     $cd gdb-6.6     $./configure --target=arm-linux --prefix=/usr/local/arm/gdb -v    
[Microcontroller]
Linux+QT+SocketCAN: Using signal slot mechanism to realize data transmission and reception
Recently, I have been considering using an object-oriented approach to rebuild the robot's main control program framework. Although the previous framework also had this idea in it, I always feel that there is still a shadow of procedural programming, and the processing in many places is not ideal. Moreover, although I
[Microcontroller]
Design of Media Playback Based on ARM9 in Embedded Linux
Most embedded devices now require the realization of audio and video playback functions. ARM9+Linux is widely used in embedded systems. Therefore, a multimedia playback system based on ARM9 under embedded Linux is proposed here. 1 Player system platform The hierarchical structure of the player's em
[Microcontroller]
Design of Media Playback Based on ARM9 in Embedded Linux
Analysis of the bootloader execution flow after the system is powered on and the startup process of ARM Linux
    1 Introduction     Linux was originally developed by Linus Torvalds, a student at the University of Helsinki in Sweden, in 1991. Later, with the support of GNU, Linux has achieved tremendous development. Although Linux is not as popular as Microsoft's  Windows  operating system on desktop PCs, its rapid developmen
[Microcontroller]
New Linux platform DVR video card for security monitoring system
Video surveillance system has always been a hot topic in the field of surveillance. It is intuitive, convenient and has rich information content and is widely used in various industries, such as transportation, electricity, communications, petroleum, docks, warehouses, finance, service windows of government agencies
[Security Electronics]
Loongson Arch Linux system released: 10,000 x86 software easily transplanted
As a 100% domestically produced chip instruction set, Loongson's Dragon architecture is not only its own hardware system, but also accelerating ecological development in OS systems. Recently, the Dragon architecture Arch Linux distribution has ended its beta, officially supports the Dragon architecture, and has transp
[Embedded]
Loongson Arch Linux system released: 10,000 x86 software easily transplanted
Research on GPS Data Acquisition Based on Embedded Linux Platform
With the rapid development of GPS (Global Positioning System) and portable mobile devices, various portable positioning systems based on GPS have emerged one after another. Embedded Linux has become the main development platform for various portable devices with its openness, security, robustness and stability. Ther
[Test Measurement]
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号