summaryrefslogtreecommitdiffstats
path: root/board/altera/readme.txt
blob: 8d5b89114b0be770a0451a0159e669477900a02d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
SoCkit

Intro
=====

This is the buildroot board support for the Arrow SoCkit Evaluation Board
and the Altera Cyclone 5 Development Board.

A good source of information is :
http://www.rocketboards.org/foswiki/Documentation/ArrowSoCKitEvaluationBoard

How it works
============

Boot process :
--------------

In summary, the bootloader has multiple stages, an hardcoded boot routine is
loaded from an on-chip ROM.

  - That first stage is scanning the SD card's partition table to find
    partition having the 0xA2 type.
  - This partition is expected to contain a boot image on its first 60 Kb,
    because u-boot is bigger, we must fill it with a preloader (u-boot-spl)
    which will load the u-boot image.
  - Then the u-boot image will load the Linux kernel.

A good source of information for the boot process is :
http://xillybus.com/tutorials/u-boot-image-altera-soc

Note for the SPL :
The SPL generated by the u-boot from Rocketboards doesn't seems to work,
therefore we provide a patch for {uboot-PKG}/board/altera/socfpga_cyclone5/*
based on the files generated with the Altera example design.

For more information about this files please look at :
http://www.rocketboards.org/foswiki/Documentation/PreloaderUbootCustomization#Common_Source_Code

How to build it
===============

Configure Buildroot
-------------------

The altera_sockit_defconfig configuration is a minimal configuration with
all that is required to bring the SoCkit :

  $ make altera_sockit_defconfig

and for the SoC Development Board :

  $ make altera_sockdk_defconfig

Build everything
----------------

Note: you will need to have access to the network, since Buildroot will
download the packages' sources.

  $ make

Result of the build
-------------------

After building, you should obtain this tree:

    output/images/
    ├── rootfs.ext2
    ├── rootfs.ext3 -> rootfs.ext2
    ├── rootfs.tar
    ├── socfpga_cyclone5_sockit.dtb or socfpga_cyclone5_socdk.dtb
    ├── socfpga.dtb
    ├── u-boot.img
    ├── u-boot-spl.bin
    └── uImage


Signing the Preloader
---------------------

*** BEWARE ****
The u-boot-spl.bin must be signed using the Altera's tool "mkpimage".
This tool comes as a part of the Altera development environnment (SoC EDS).
A fork of this tool have been done by Maxime Hadjinlian and can be found here :
https://github.com/maximeh/mkpimage

Remember that without signing the u-boot-spl.bin, the board will not boot !!!

  $ mkpimage u-boot-spl.bin -o u-boot-spl-signed.bin

Prepare your SDcard
===================

A good source of information for the partitioning process is :
http://www.rocketboards.org/foswiki/view/Projects/SoCKitLinaroLinuxDesktop#Partition_the_SD_Card

Create the SDcard partition table
----------------------------------

Determine the device associated to the SD card :

  $ cat /proc/partitions

let's assume it is /dev/mmcblk0 :

  $ sudo fdisk /dev/mmcblk0

Delete all previous partitions with 'd' then create the new partition table,
using these options, pressing enter after each one:

  * n p 1 9000000 +20480K t 1 b
  * n p 2 4096 +4496384K t 83
  * n p 3 2048 +1024K t 3 a2

Using the 'p' option, the SD card's partition must look like this :

Device         Boot     Start       End  Blocks  Id System
/dev/mmcblk0p1        9000000   9041919   20960   b W95 FAT32
/dev/mmcblk0p2           4096   8996863 4496384  83 Linux
/dev/mmcblk0p3           2048      4095    1024  a2 Unknown

Then write the partition table using 'w' and exit.

Make partition one a DOS partition :

  $ sudo mkdosfs /dev/mmcblk0p1

Install the binaries to the SDcard
----------------------------------

Remember your binaries are located in output/images/, go inside that directory :

  $ cd output/images

The partition with type a2 is the partition scan by the first bootloader stage
in the SoCkit ROM to find the next bootloader stage so we must write the signed
preloader and the u-boot binaries in that partition :

  $ sudo dd if=u-boot-spl-signed.bin of=/dev/mmcblk0p3 bs=64k seek=0
  $ sudo dd if=u-boot.img of=/dev/mmcblk0p3 bs=64k seek=4

Copy the Linux kernel and its Device tree :

  $ sudo mkdir /mnt/sdcard
  $ sudo mount /dev/mmcblk0p1 /mnt/sdcard
  $ sudo cp socfpga.dtb uImage /mnt/sdcard
  $ sudo umount /mnt/sdcard

Copy the rootfs :

  $ sudo dd if=rootfs.ext2 of=/dev/mmcblk0p2 bs=64k
  $ sudo sync

It's Done!

Finish
======

Eject your SDcard, insert it in your SoCkit, and power it up.

if you want a serial console, you can plug a micro B USB cable on the USB-UART
port, the serial port config to used is 57600/8-N-1.
OpenPOWER on IntegriCloud