Introduction
This solution documents the steps required to prepare an Arrow SoCKit evaluation board to boot from QSPI. There are a few broad steps that are required.- Prepare the boot files
- Write the boot files to the QSPI serial flash.
- Configure the board to boot from QSPI.
This Solution assumes you have a suitable Linux host available to develop the boot files for the SoCKit target. It is also important to note that this solution requires that you have the 3.9 release of the linux kernel and the 2013.01.01 release of u-boot.Prepare the Boot files
1. The preloader (u-boot-spl)
Creating a preloader is shown in detail in the Arrow SoC Workshop Software Lab Instructions Guide. You can download these materials at
http://www.arrownac.com/solutions/sockit/ under the Getting Started Tab.Please refer to Module 3 for exact steps on how to create a preloader. The preloader can be modified to boot from QSPI.
To modify the preloader for QSPI do the following:- Open the bsp-editor and select the settings.bsp file of the existing preloader.
- Check the checkbox next to BOOT_FROM_QSPI. Uncheck the checkbox next to BOOT_FROM_SDMMC
- Press the Generate button. Press exit.
- Use make to build the executable as shown in the Workshop Software Lab Instructions Guide Module 3.
- Navigate to the /software/spl_bsp/uboot_socfpga/spl directory
- Create the bootable preloader. At the prompt type 'mkpimage -o preloader_with_header_qspi.img u-boot-spl.bin'
- Copy preloader_with_header_qspi.img to a folder where you will gather all the bootable files.
2. Clone the Yocto Project git Tree
The instructions for cloning the Yocto Project git trees and building Yocto Project are:- git clone http://git.rocketboards.org/poky-socfpga.git
- cd poky-socfpga/
- git checkout -b origin/danny-altera
- source ./altera-init build
- bitbake u-boot altera-image-minimal
- copy altera-image-minimal-socfpga_cyclone5-.rootfs.jffs2 from poky-socfpga/build/tmp/deploy/images to a folder where you will gather all the bootable files
- copy socfpga_cyclone5-.dtb from poky-socfpga/build/tmp/deploy/images to a folder where you will gather all the bootable files
- rename the files to remove the build date.
3. Modify u-boot to support Qspi
This section presents instructions on how to recompile u-boot. It assumes that you have manually downloaded the build toolchain.- open new shell. cd poky-socfpga/build/tmp/work/armv7ahf-vfp-neon-poky-linux-gnueabi/u-boot-altera-2013.01.01-r0/git
- export CROSS_COMPILE=~/gcc-linaro-arm-linux-gnueabihf-4.7-2012.11-20121123_linux/bin/arm-linux-gnueabihf-
- modify poky-socfpga/build/tmp/work/armv7ahf-vfp-neon-poky-linux-gnueabi/u-boot-altera-2013.01.01-r0/git/board/altera/socfpga/build.h. as shown in the two bullets below
- #define CONFIG_PRELOADER_BOOT_FROM_QSPI (1)
- #define CONFIG_PRELOADER_BOOT_FROM_SDMMC (0)
- modify poky-socfpga/build2/tmp/work/armv7ahf-vfp-neon-poky-linux-gnueabi/u-boot-altera-2013.01.01-r0/git/include/configs/socfpga_common.h as shown in the three bullets below
- change #define CONFIG_BOOTCOMMAND "run mmcload; run mmcboot" to #define CONFIG_BOOTCOMMAND "run qspiload; run qspiboot"
- change #define CONFIG_BAUDRATE 115200 to #define CONFIG_BAUDRATE 57600
- rebuild u-boot; make clean; make all
- copy u-boot.img from poky-socfpga/build/tmp/work/armv7ahf-vfp-neon-poky-linux-gnueabi/u-boot-altera-2013.01.01-r0/git to a folder where you will gather all the bootable files
4. Build the Linux kernelThis section presents instructions on how to clone the Linux kernel git tree and compile the Linux kernel. It assumes that you have manually downloaded the build toolchain.
Booting from Qspi is supported by the linux kernel 3.9 and later. Since the Yocto distribution of the kernel is 3.8 please do the following.- git clone http://git.rocketboards.org/linux-socfpga.git
- cd linux-socfpga
- git checkout -b socfpga-3.9
- export CROSS_COMPILE=~/gcc-linaro-arm-linux-gnueabihf-4.7-2012.11-20121123_linux/bin/arm-linux-gnueabihf-
- make ARCH=arm socfpga_defconfig
- make ARCH=arm zImage LOADADDR=0x8000
- copy zImage from linux-socfpga/arch/arm/boot to a folder where you will gather all the bootable files
Write the Boot files to the QSPI serial flashThe Qspi requires the following arrangement in order to boot.
There are two ways to achieve this. The first uses the u-boot sf utility. The second uses the linux mtd_debug utility
1. u-boot sf utility- obtain an SD card with a sockit_20130421.img (u-boot version 2012.10, linux version 3.7) bootable image
- copy the five files that you have gathered on your host to the fat32 partition of the SD card (partition 1)
- boot the SoCKit using the SD card. hit any key to stop autoboot of u-boot
- type 'fatls mmc 0:1' at the prompt to view all the files on the fat32 partition of the SD card
- sf probe to intialise the QSPI controller
- fatload mmc 0:1 0x2000000 preloader_with_header.img
- sf erase 0x0000 0x10000
- sf write 0x2000000 0x0000 0x10000
- fatload mmc 0:1 0x2000000 u-boot.img
- sf erase 0x60000 0x40000
- sf write 0x2000000 0x60000 0x40000
- fatload mmc 0:1 0x2000000 socfpga_cyclone5.dtb
- sf erase 0x50000 0x10000
- sf write 0x2000000 0x50000 0x10000
- fatload mmc 0:1 0x2000000 zImage
- sf erase 0xa0000 0x400000
- sf write 0x2000000 0xa0000 0x400000
- fatload mmc 0:1 0x2000000 altera-image-minimal-socfpga_cyclone5.rootfs.jffs2
- sf erase 0x800000 0xe00000
- sf write 0x2000000 0x800000 0xe00000
2. linux mtd_debug utility- obtain an SD card that has u-boot 2013.01.01 and linux 3.9
- boot the SoCKit to the linux prompt. login as root
- create a password. use the 'passwd' command. set the password to be root
- use ifconfig to determine the targets ip address
- open a shell, on your linux host.
- cd to the directory where you have gathered the bootable files
- use scp to copy the files to the target.
- scp * root@:/home/root
- on the target use the mtd utility to write the bootable files to QSPI
- cd to the /home/root directory
- ls -al to get the exact length of each of the bootable files
- flash_erase /dev/mtd0 0 0
- flash_erase /dev/mtd1 0 0
- mtd_debug write /dev/mtd0 0 0x10000 preloader_with_header.img
- mtd_debug write /dev/mtd0 0x50000 socfpga_cyclone5.dtb
- mtd_debug write /dev/mtd0 0x60000 u-boot.img
- mtd_debug write /dev/mtd0 0xa0000 zImage
- flashcp altera-image-minimal-socfpga_cyclone5.jffs2 /dev/mtd1
Configure the SoCKit board to boot from QSPI serial flash- power down the SoCKit when the last file has been written to QSPI
- change the BOOTSEL jumpers to '111'
- power the SoCKit on
- login as root; root
本帖最后由 chenzhufly 于 2014-12-19 10:19 编辑