at91sam9x5编译过程

1、创建目录

1
2
3
4
5
cd /home
mkdir at91sam9
cd at92sam9
mkdir at91sam9x5-ek
cd at91sam9x5-ek

2、Bootstrap编译

1
2
3
wget ftp://ftp.linux4sam.org/pub/at91bootstrap/AT91Bootstrap3.1/AT91Bootstrap-5series_1.2.tgz
tar xvzf AT91Bootstrap-5series_1.2.tgz
cd AT91Bootstrap-5series_1.2

选择存储在nandflash中

1
2
3
make at91sam9x5nf_defconfig
make menuconfig
make CROSS_COMPILE=arm-none-linux-gnueabi-

3、U-BOOT编译

下载代码

1
2
3
wget ftp://ftp.denx.de/pub/u-boot/u-boot-2010.06.tar.bz2
tar xvjf u-boot-2010.06.tar.bz2
cd u-boot-2010.06

打补丁

1
2
3
wget ftp://ftp.linux4sam.org/pub/uboot/u-boot-v2010.06/u-boot-5series_1.0.patch
patch -p1 < u-boot-5series_1.0.patch
make distclean

u-boot选择存储在nandflash中

1
2
make at91sam9x5ek_nandflash_config
make CROSS_COMPILE=arm-none-linux-gnueabi-

u-boot选择存储在Dataflash或SPI flash中

1
2
make at91sam9x5ek_dataflash_config
make CROSS_COMPILE=arm-none-linux-gnueabi-

u-boot已编译,并且可以用。如要使用,请通过SAMBA下载“AT91SAM9X5-EK下载文件”文件夹中的“u-boot.bin”文件。

Select Enable OS PMECC parametersin the Scriptsrolling menu and press Execute.
The default ECC configuration should be ok。
u-boot Address is 0x40000.

说明:如果要技术jffs2,需更改u-boot默认环境变量。
更改 u-boot-2010.06/include/configs/at91sam9x5ek.h

204行

1
2
3
4
5
#define CONFIG_BOOTARGS		"mem=128M console=ttyS0,115200 " \
"mtdparts=atmel_nand:" \
"8M(bootstrap/uboot/kernel)ro,-(rootfs) " \
"root=/dev/mtdblock1 rw " \
"rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs"

1
2
3
4
5
#define CONFIG_BOOTARGS		"mem=128M console=ttyS0,115200 " \
"mtdparts=atmel_nand:" \
"8M(bootstrap/uboot/kernel)ro,-(rootfs) " \
"root=/dev/mtdblock1 rw " \
"rootfstype=jffs2"
1
setenv bootargs mem=128M console=ttyS0,115200 mtdparts=atmel_nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rootfstype=jffs2 rw

4、内核编译

下载代码

1
2
3
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.tar.bz2
tar xvjf linux-2.6.39.tar.bz2
cd linux-2.6.39

打补丁

1
2
3
wget ftp://ftp.linux4sam.org/pub/linux/2.6.39-at91/2.6.39-at91-exp.tar.gz
tar xvzf 2.6.39-at91-exp.tar.gz
for p in 2.6.39-at91-exp/* ; do patch -p1 < $p ; done

编译

1
2
3
make ARCH=arm at91sam9x5ek_defconfig
make ARCH=arm menuconfig
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-

制作u-boot能使用的内核映像

1
mkimage -A arm -O linux -C none -T kernel -a 20008000 -e 20008000 -n linux-2.6 -d arch/arm/boot/zImage uImage-2.6.39-at91sam9x5ek.bin

Using u-boot下载内核

  • a.设置 MAC地址:
    1
    2
    3
    4
    5
    U-Boot>setenv ethaddr 3e:36:65:ba:6f:be  
    b.设置ipaddr地址:
    U-Boot>setenv ipaddr 192.168.1.159
    c.设置serverip地址:
    U-Boot>setenv serverip 192.168.1.158
    d. 保存配置
    1
    2
    3
    4
    5
    6
    U-Boot>saveenv
    - e.烧录kernel
    U-Boot>tftp 0x22000000 uImage-2.6.39-at91sam9x5ek.bin
    U-Boot>nand erase 0x200000 0x600000
    U-Boot>nand write 0x22000000 0x200000 0x250000
    U-Boot>boot
    若用Samba,下载uImage到nandflash的0x200000地址处

5、rootfs编译[编译时间很长]

下载代码

1
2
3
wget http://buildroot.uclibc.org/downloads/buildroot-2011.05.tar.bz2
tar xvjf buildroot-2011.05.tar.bz2
cd buildroot

打补丁

1
2
3
4
wget ftp://ftp.linux4sam.org/pub/buildroot/2011.05-at91_5series_1.0.patch
patch -p1 < 2011.05-at91_5series_1.0.patch
chmod +x board/atmel/at91sam9x5ek/post-build.sh
chmod +x board/atmel/at91sam9x5ek/alsa/post-build_alsa.sh

编译

1
2
make at91sam9x5ek_defconfig
make

生成文件

1
2
ls output/images/
rootfs.jffs2 rootfs.tar.bz2 rootfs.ubi rootfs.ubifs uImage
  • a.Choose the NandFlash media tab in the SAM-BA GUI.
  • b.Initialize the media choosing the Enable NandFlashaction in the Scriptsrolling menu and press Execute.
  • c.Select Enable OS PMECC parametersin the Scriptsrolling menu and press Execute.
    Trimffs选项打勾

烧写地址0x800000选择烧写文件为rootfs.ubi

文章目录
  1. 1. 1、创建目录
  2. 2. 2、Bootstrap编译
  3. 3. 3、U-BOOT编译
  4. 4. 4、内核编译
  5. 5. 5、rootfs编译[编译时间很长]