Yocto on Quark X1000

Build Guide

Table of Contents

  • 1 注意事项

  • 2 Prepare

  • 3 EDKII firmware

    • 3.1 build

    • 3.2 output

  • 4 GRUB OS loader

    • 4.1 Build

    • 4.2 output

  • 5 ROOTFS & bzImage

    • 5.1 build

    • 5.2 output

  • 6 cross compile toolchain

    • 6.1 build

    • 6.2 install

    • 6.3 usage

  • 7 flash image

    • 7.1 build

    • 7.2 output

  • 8 Define platform data

    • 8.1 build

  • 9 Programming Flash

1 注意事项

  • 默认工作目录: ~/workspace/galileo/

    $ tree -L 1
    .
    |-- gnu-efi-3.0
    |-- grub-legacy -> grub-legacy_5775f32a+v1.0.1
    |-- grub-legacy_5775f32a+v1.0.1
    |-- meta-clanton -> meta-clanton_v1.0.1
    |-- meta-clanton_v1.0.1
    |-- package
    |-- Quark_EDKII -> Quark_EDKII_v1.0.1
    |-- Quark_EDKII_v1.0.1
    |-- Quark_EDKII_v1.0.1-svn_externals.repo
    |-- spi-flash-tools -> spi-flash-tools_v1.0.1
    |-- spi-flash-tools_v1.0.1
    |-- sysimage -> sysimage_v1.0.1
    `-- sysimage_v1.0.1
  • 为避免编译环境的配置差异,编译每个包时最好 重新开启新的终端会话

2 Prepare

  • 下载BSP包到默认工作目录

    • Board_Support_Package_Sources_for_Intel_Quark_v1.0.1.7z 传送门

    • 解压

$ 7z x Board_Support_Package_Sources_for_Intel_Quark_v1.0.1.7z
  • 依赖包

$ sudo apt-get install build-essential gcc-multilib vim-common \
               p7zip-full git diffstat texinfo gawk chrpath file \
               make gcc g++ uuid-dev iasl patch \
               sed wget subversion git-core coreutils \
               unzip texi2html texinfo libsdl1.2-dev docbook-utils fop gawk \
               python-pysqlite2 diffstat make gcc build-essential xsltproc \
               g++ desktop-file-utils chrpath libgl1-mesa-dev libglu1-mesa-dev \
               autoconf automake groff libtool xterm libxml-parser-perl

3 EDKII firmware

3.1 build

$ tar -xvf package/Quark_EDKII_v1.0.1.tar.gz -C .

$ cd Quark_EDKII_v1.0.1/

$ ./svn_setup.py

$ svn update

$ cd CryptoPkg/Library/OpensslLib

$ wget http://www.openssl.org/source/openssl-0.9.8w.tar.gz

$ tar -xvf openssl-0.9.8w.tar.gz

$ cd openssl-0.9.8w

$ patch -p0 -i ../EDKII_openssl-0.9.8w.patch

$ cd ..

$ chmod +x Install.sh

$ ./Install.sh

$ cd ../../../

$ gcc -v 

$ ./buildallconfigs.sh GCC46 QuarkPlatform

3.2 output

The build output can be found in the following directories:

  • build/QuarkPlatform/<Config>/<Target>_<Tools>/FV/FlashModules/

    • Contains EDKII binary modules

  • Build/QuarkPlatform/<Config>/<Target>_<Tools>/FV/Applications/

    • Contains UEFI shell applications, including CapsuleApp.efi

  • where:

    • <Config> = PLAIN | SECURE

    • <Target> = DEBUG | RELEASE

    • <Tools> = GCC43 | GCC44 | GCC45 | GCC46 | GCC47

4 GRUB OS loader

4.1 Build

$ wget http://sourceforge.net/projects/gnu-efi/files/gnu-efi_3.0v.orig.tar.gz

$ tar -xvf gnu-efi*

$ cd gnu-efi*/gnuefi

$ make ARCH="ia32"

$ cd -

$ tar -xvf grub-legacy_*.tar.gz 

$ cd grub-legacy_* 

$ ./gitsetup.py 

$ cd work 

$ autoreconf --install 

$ export CC4GRUB='gcc -m32 -march=i586 -fno-stack-protector' 

$ export GNUEFI_LIBDIR=~/workspace/galileo/gnu-efi-3.0/gnuefi/

$ CC="${CC4GRUB}" ./configure-quark.sh 

$ make

4.2 output

  • work/efi/grub.efi

5 ROOTFS & bzImage

5.1 build

$ tar -xvf meta-clanton*.tar.gz 

$ cd meta-clanton* 

$ ./setup.sh 

$ source poky/oe-init-build-env yocto_build

$ bitbake image-spi-galileo

5.2 output

The output of the build process is found in ./tmp/deploy/images/ and includes the following files:

  • image-spi-clanton.cpio.gz

  • image-spi-clanton.cpio.lzma

  • bzImage

  • grub.efi

6 cross compile toolchain

6.1 build

$ source poky/oe-init-build-env yocto_build

$ bitbake image-spi-galileo -c populate_sdk

6.2 install

$ ./tmp/deploy/sdk/clanton-tiny-uclibc-x86_64-i586-toolchain-1.4.2.sh

6.3 usage

$ source /opt/clanton-tiny/1.4.2/environment-setup-i586-poky-linux-uclibc

$ ${CC} myfile.c -o myfile

7 flash image

7.1 build

$ tar -xvf sysimage_*.tar.gz

$ tar -xvf spi-flash-tools*.tar.gz

$ ./sysimage/create-symlinks.sh

$ cd sysimage/sysimage.CP-8M-debug

# modify the layout.conf file in the [Ramdisk] section 
# from image-spi-clanton.cpio.lzma to image-spi-galileo-clanton.cpio.lzma

$ ../../spi-flash-tools*/Makefile

7.2 output

  • Flash-missingPDAT.cap - standard capsule file.

  • Flash-missingPDAT.bin - flash file with no platform data.

  • FVMAIN.fv – board-specific recovery file

8 Define platform data

8.1 build

  • 修改platform-data配置文件

$ vim spi-flash-tools/platform-data/sample-platform-data.ini

参考下面的例子修改配置文件:

  [Platform Type]
  id=1
  desc=PlatformID
  data.type=hex.uint16
  # ClantonPeak 2, KipsBay 3, CrossHill 4, ClantonHill 5, KipsBay-fabD 6 
  data.value=6
  # WARNING: the MRC parameters MUST match the platformID used above
  
  [Mrc Params]
  id=6
  ver=1
  desc=MrcParams
  data.type=file
  #data.value=MRC/clantonpeak.v1.bin
  #data.value=MRC/kipsbay.v1.bin
  
  #data.value=MRC/crosshill.v1.bin
  #data.value=MRC/clantonhill.v1.bin
  data.value=MRC/kipsbay-fabD.v1.bin
  
  [MAC address 0]
  id=3
  desc=1st MAC
  data.type=hex.string
  data.value=001320FDF4F2 #unique MAC address of your device
  
  [MAC address 1]
  id=4
  desc=2nd MAC
data.type=hex.string
data.value=02FFFFFFFF01
  • 生成 spi-flash 镜像

$ cd spi-flash-tools/platform-data/

$ ./platform-data-patch.py -p sample-platform-data.ini \
    -i ../../sysimage_4M*/sysimage.CP-8M-release/Flash-missingPDAT.bin

9 Programming Flash

  • 将 CapsuleApp.efi 和 Flash-missingPDAT.cap 复制到U盘然后插入开发板USB接口

  • 上电,当出现下面的提示时按 F7 进入启动菜单

Press [Enter] to directly boot.
Press [F7]    to show boot menu options.
  • 选择 "UEFI Internal Shell"

▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒          Please select boot device:           ▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒UEFI Payload                                   ▒
▒Boot Device List                               ▒
▒UEFI Internal Shell                            ▒
▒UEFI Generic USB2.0-CRW 20090815198100000      ▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒            and  to move selection             ▒
▒          ENTER to select boot device          ▒
▒                  ESC to exit                  ▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  • 随后输入 "fs0:"

EFI Shell version 2.31 [1.0]
Current running mode 1.1.2
Device mapping table
  fs0     :Removable HardDisk - Alias hd11a0b blk0
           PciRoot(0x0)/Pci(0x14,0x4)/USB(0x0,0x0)/HD(1,MBR,0x00000000,0x2000,0xE6C000)
  blk0    :Removable HardDisk - Alias hd11a0b fs0
           PciRoot(0x0)/Pci(0x14,0x4)/USB(0x0,0x0)/HD(1,MBR,0x00000000,0x2000,0xE6C000)
  blk1    :Removable BlockDevice - Alias (null)
           PciRoot(0x0)/Pci(0x14,0x4)/USB(0x0,0x0)

Press ESC in 1 seconds to skip startup.nsh, any other key to continue.


Shell> fs0:
  • 输入命令 "CapsuleApp.efi Flash-missingPDAT.cap"

fs0:\> CapsuleApp.efi Flash-missingPDAT.cap



你可能感兴趣的:(Build,yocto,Quark)