b6da489f6121ab922be8a5967de18549287057fa
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / board / altera / sockit / readme.txt
1 SoCkit
2
3 Intro
4 =====
5
6 This is the buildroot board support for the Arrow SoCkit Evaluation Board.
7
8 A good source of information is :
9 http://www.rocketboards.org/foswiki/Documentation/ArrowSoCKitEvaluationBoard
10
11 How it works
12 ============
13
14 Boot process :
15 --------------
16
17 In summary, the bootloader has multiple stages, an hardcoded boot routine is
18 loaded from an on-chip ROM.
19
20   - That first stage is scanning the SD card's partition table to find
21     partition having the 0xA2 type.
22   - This partition is expected to contain a boot image on its first 60 Kb,
23     because u-boot is bigger, we must fill it with a preloader (u-boot-spl)
24     which will load the u-boot image.
25   - Then the u-boot image will load the Linux kernel.
26
27 A good source of information for the boot process is :
28 http://xillybus.com/tutorials/u-boot-image-altera-soc
29
30 Note for the SPL :
31 The SPL generated by the u-boot from Rocketboards doesn't seems to work,
32 therefore we provide a patch for {uboot-PKG}/board/altera/socfpga_cyclone5/*
33 based on the files generated with the Altera example design.
34
35 For more information about this files please look at :
36 http://www.rocketboards.org/foswiki/Documentation/PreloaderUbootCustomization#Common_Source_Code
37
38 How to build it
39 ===============
40
41 Configure Buildroot
42 -------------------
43
44 The altera_sockit_defconfig configuration is a minimal configuration with
45 all that is required to bring the SoCkit :
46
47   $ make altera_sockit_defconfig
48
49 Build everything
50 ----------------
51
52 Note: you will need to have access to the network, since Buildroot will
53 download the packages' sources.
54
55   $ make
56
57 Result of the build
58 -------------------
59
60 After building, you should obtain this tree:
61
62     output/images/
63     ├── rootfs.ext2
64     ├── rootfs.ext3 -> rootfs.ext2
65     ├── rootfs.tar
66     ├── socfpga_cyclone5_sockit.dtb
67     ├── socfpga.dtb
68     ├── u-boot.img
69     ├── u-boot-spl.bin
70     └── uImage
71
72
73 Signing the Preloader
74 ---------------------
75
76 *** BEWARE ****
77 The u-boot-spl.bin must be signed using the Altera's tool "mkpimage".
78 This tool comes as a part of the Altera development environnment (SoC EDS).
79 A fork of this tool have been done by Maxime Hadjinlian and can be found here :
80 https://github.com/maximeh/mkpimage
81
82 Remember that without signing the u-boot-spl.bin, the board will not boot !!!
83
84   $ mkpimage u-boot-spl.bin -o u-boot-spl-signed.bin
85
86 Prepare your SDcard
87 ===================
88
89 A good source of information for the partitioning process is :
90 http://www.rocketboards.org/foswiki/view/Projects/SoCKitLinaroLinuxDesktop#Partition_the_SD_Card
91
92 Create the SDcard partition table
93 ----------------------------------
94
95 Determine the device associated to the SD card :
96
97   $ cat /proc/partitions
98
99 let's assume it is /dev/mmcblk0 :
100
101   $ sudo fdisk /dev/mmcblk0
102
103 Delete all previous partitions with 'd' then create the new partition table,
104 using these options, pressing enter after each one:
105
106   * n p 1 9000000 +20480K t 1 b
107   * n p 2 4096 +4496384K t 83
108   * n p 3 2048 +1024K t 3 a2
109
110 Using the 'p' option, the SD card's partition must look like this :
111
112 Device         Boot     Start       End  Blocks  Id System
113 /dev/mmcblk0p1        9000000   9041919   20960   b W95 FAT32
114 /dev/mmcblk0p2           4096   8996863 4496384  83 Linux
115 /dev/mmcblk0p3           2048      4095    1024  a2 Unknown
116
117 Then write the partition table using 'w' and exit.
118
119 Make partition one a DOS partition :
120
121   $ sudo mkdosfs /dev/mmcblk0p1
122
123 Install the binaries to the SDcard
124 ----------------------------------
125
126 Remember your binaries are located in output/images/, go inside that directory :
127
128   $ cd output/images
129
130 The partition with type a2 is the partition scan by the first bootloader stage
131 in the SoCkit ROM to find the next bootloader stage so we must write the signed
132 preloader and the u-boot binaries in that partition :
133
134   $ sudo dd if=u-boot-spl-signed.bin of=/dev/mmcblk0p3 bs=64k seek=0
135   $ sudo dd if=u-boot.img of=/dev/mmcblk0p3 bs=64k seek=4
136
137 Copy the Linux kernel and its Device tree :
138
139   $ sudo mkdir /mnt/sdcard
140   $ sudo mount /dev/mmcblk0p1 /mnt/sdcard
141   $ sudo cp socfpga.dtb uImage /mnt/sdcard
142   $ sudo umount /mnt/sdcard
143
144 Copy the rootfs :
145
146   $ sudo dd if=rootfs.ext2 of=/dev/mmcblk0p2 bs=64k
147   $ sudo sync
148
149 It's Done!
150
151 Finish
152 ======
153
154 Eject your SDcard, insert it in your SoCkit, and power it up.
155
156 if you want a serial console, you can plug a micro B USB cable on the USB-UART
157 port, the serial port config to used is 57600/8-N-1.