1*4882a593SmuzhiyunThis document explains how to set up a basic Buildroot system on 2*4882a593Smuzhiyunvarious Atmel/Microchip boards. Additional details can also be found 3*4882a593Smuzhiyunon the Linux4SAM website: http://www.linux4sam.org 4*4882a593Smuzhiyun 5*4882a593SmuzhiyunThis guide covers the following configurations: 6*4882a593Smuzhiyun - at91sam9g45m10ek_defconfig 7*4882a593Smuzhiyun - at91sam9rlek_defconfig 8*4882a593Smuzhiyun - at91sam9x5ek_defconfig (at91sam9g15, at91sam9g25, at91sam9x25, 9*4882a593Smuzhiyun at91sam9g35 and at91sam9x35) 10*4882a593Smuzhiyun - atmel_sama5d3xek_defconfig (sama5d31, sama5d33, sama5d34, sama5d35, 11*4882a593Smuzhiyun sama5d36) 12*4882a593Smuzhiyun - atmel_sama5d3_xplained_defconfig 13*4882a593Smuzhiyun - atmel_sama5d3_xplained_dev_defconfig 14*4882a593Smuzhiyun - atmel_sama5d3_xplained_mmc_defconfig 15*4882a593Smuzhiyun - atmel_sama5d3_xplained_mmc_dev_defconfig 16*4882a593Smuzhiyun - atmel_sama5d4_xplained_defconfig 17*4882a593Smuzhiyun - atmel_sama5d4_xplained_dev_defconfig 18*4882a593Smuzhiyun - atmel_sama5d4_xplained_mmc_defconfig 19*4882a593Smuzhiyun - atmel_sama5d4_xplained_mmc_dev_defconfig 20*4882a593Smuzhiyun - atmel_sama5d2_xplained_mmc_defconfig 21*4882a593Smuzhiyun - atmel_sama5d2_xplained_mmc_dev_defconfig 22*4882a593Smuzhiyun - microchip_sama5d27_wlsom1_ek_mmc_defconfig 23*4882a593Smuzhiyun - microchip_sama5d27_wlsom1_ek_mmc_dev_defconfig 24*4882a593Smuzhiyun - microchip_sam9x60ek_mmc_defconfig 25*4882a593Smuzhiyun - microchip_sam9x60ek_mmc_dev_defconfig 26*4882a593Smuzhiyun - microchip_sama5d2_icp_mmc_defconfig 27*4882a593Smuzhiyun - microchip_sama5d2_icp_mmc_dev_defconfig 28*4882a593Smuzhiyun 29*4882a593SmuzhiyunThese configurations will use AT91Bootstrap, u-boot and a linux kernel from 30*4882a593Smuzhiyunthe git trees maintained by Atmel. 31*4882a593Smuzhiyun 32*4882a593SmuzhiyunThe configurations labeled as 'dev' provide a development rootfs with tools to 33*4882a593Smuzhiyuntests the features of the SoC: 34*4882a593Smuzhiyun- ALSA tools to test audio 35*4882a593Smuzhiyun- FFMPEG to record video from the ISI/ISC 36*4882a593Smuzhiyun- I2C, SPI, CAN, etc. tools 37*4882a593Smuzhiyun- modetest for LCD screens, HDMI 38*4882a593Smuzhiyun- Wilc1000/Wilc3000 firmware for the Atmel Wireless sdio module 39*4882a593Smuzhiyun- SSH for convenience 40*4882a593Smuzhiyun- GDB/GDB server for debug 41*4882a593Smuzhiyun 42*4882a593SmuzhiyunConfiguring and building Buildroot 43*4882a593Smuzhiyun================================== 44*4882a593Smuzhiyun 45*4882a593SmuzhiyunFor the Xplained/Evaluation Kit boards, the Buildroot configuration is 46*4882a593Smuzhiyunprovided to boot from an SD card. Those configurations are labeled as 47*4882a593Smuzhiyun'mmc'. In this case, after building Buildroot, follow the instructions 48*4882a593Smuzhiyunin the "Preparing the SD card" section. 49*4882a593Smuzhiyun 50*4882a593SmuzhiyunFor the other configurations listed above, the Buildroot configuration 51*4882a593Smuzhiyunassumes the system will be flashed on NAND. In this case, after 52*4882a593Smuzhiyunbuilding Buildroot, follow the instructions in the "Flashing the NAND 53*4882a593Smuzhiyunusing SAM-BA" section below. 54*4882a593Smuzhiyun 55*4882a593SmuzhiyunTo configure and build Buildroot, run: 56*4882a593Smuzhiyun 57*4882a593Smuzhiyun make <board>_defconfig 58*4882a593Smuzhiyun make 59*4882a593Smuzhiyun 60*4882a593SmuzhiyunFlashing the NAND using SAM-BA 61*4882a593Smuzhiyun============================== 62*4882a593Smuzhiyun 63*4882a593SmuzhiyunFlashing the board 64*4882a593Smuzhiyun------------------ 65*4882a593Smuzhiyun 66*4882a593SmuzhiyunConnect the board: 67*4882a593Smuzhiyun o at91sam9g45m10ek: DBGU: J10, USB sam-ba: J14 68*4882a593Smuzhiyun o at91sam9rlek: DBGU: J19, USB sam-ba: J21 69*4882a593Smuzhiyun o at91sam9x5ek: DBGU: J11, USB sam-ba: J20 70*4882a593Smuzhiyun o sama5d3xek: DBGU: J14, USB sam-ba: J20 71*4882a593Smuzhiyun o sama5d3 Xplained: DBGU: J23, USB sam-ba: J6 72*4882a593Smuzhiyun o sama5d4ek: DBGU: J22 or J24, USB sam-ba: J1 73*4882a593Smuzhiyun o sama5d4 Xplained: DBGU: J1, USB sam-ba: J11 74*4882a593Smuzhiyun 75*4882a593SmuzhiyunStart the board in RomBOOT: 76*4882a593Smuzhiyun o at91sam9g45m10ek: 77*4882a593Smuzhiyun 1. open JP8, JP10 and JP12 78*4882a593Smuzhiyun 2. start the board 79*4882a593Smuzhiyun 3. close JP8, JP10 and JP12 80*4882a593Smuzhiyun 81*4882a593Smuzhiyun o at91sam9rlek: 82*4882a593Smuzhiyun 1. J11 on 1-2 (BMS=1), open J12 and J13 83*4882a593Smuzhiyun 2. start the board 84*4882a593Smuzhiyun 3. close J12 and J13 85*4882a593Smuzhiyun 86*4882a593Smuzhiyun o at91sam9x5ek: 87*4882a593Smuzhiyun 1. open JP9 and: 88*4882a593Smuzhiyun - Cogent: open *NCS jumper 89*4882a593Smuzhiyun - Embest: open SW1 90*4882a593Smuzhiyun - Ronetix: open J1 and J2 91*4882a593Smuzhiyun 2. start the board 92*4882a593Smuzhiyun 3. close JP9 and: 93*4882a593Smuzhiyun - Cogent: close *NCS jumper 94*4882a593Smuzhiyun - Embest: close SW1 (ON position) 95*4882a593Smuzhiyun - Ronetix: close J1 and J2 96*4882a593Smuzhiyun 97*4882a593Smuzhiyun o sama5d3xek: 98*4882a593Smuzhiyun 1. start the board 99*4882a593Smuzhiyun 2. push BP4 and BP1 100*4882a593Smuzhiyun 3. release BP1 101*4882a593Smuzhiyun 4. release BP4 102*4882a593Smuzhiyun 103*4882a593Smuzhiyun o sama5d3 Xplained: 104*4882a593Smuzhiyun 1. open JP5 (NANDCS) and JP6 (SPICS) 105*4882a593Smuzhiyun 2. start the board 106*4882a593Smuzhiyun 3. close JP5 ans JP6 107*4882a593Smuzhiyun 108*4882a593Smuzhiyun o sama5d4ek: 109*4882a593Smuzhiyun 1. start the board 110*4882a593Smuzhiyun 2. push BP3 and BP4 111*4882a593Smuzhiyun 3. release BP4 112*4882a593Smuzhiyun 4. release BP3 113*4882a593Smuzhiyun 114*4882a593Smuzhiyun o sama5d4 Xplained: 115*4882a593Smuzhiyun 1. close JP7 (BOOT_DIS) 116*4882a593Smuzhiyun 2. start the board 117*4882a593Smuzhiyun 3. open JP7 118*4882a593Smuzhiyun 119*4882a593Smuzhiyun"RomBOOT" should appear on your console (this should be ttyUSBx or ttyACMx) 120*4882a593Smuzhiyun 121*4882a593SmuzhiyunNow locate the USB sam-ba interface it should be ttyACMx, usually ttyACM0 122*4882a593Smuzhiyundmesg on your machine should give: 123*4882a593Smuzhiyunusb 1-2.1.4: New USB device found, idVendor=03eb, idProduct=6124 124*4882a593Smuzhiyunusb 1-2.1.4: New USB device strings: Mfr=0, Product=0, SerialNumber=0 125*4882a593Smuzhiyuncdc_acm 1-2.1.4:1.0: ttyACM0: USB ACM device 126*4882a593Smuzhiyun 127*4882a593SmuzhiyunLook for idVendor=03eb, idProduct=6124, this is the interface you want to use. 128*4882a593Smuzhiyun 129*4882a593SmuzhiyunYou can then flash the board using the provided flasher.sh script in board/atmel: 130*4882a593Smuzhiyun 131*4882a593Smuzhiyunboard/atmel/flasher.sh <builddir_path> <interface> <board> 132*4882a593Smuzhiyun 133*4882a593SmuzhiyunFor example, for an out of tree build made in 134*4882a593Smuzhiyun/tmp/atmel_sama5d3_xplained/ for the sama5d3 Xplained, you would use: 135*4882a593Smuzhiyunboard/atmel/flasher.sh /tmp/atmel_sama5d3_xplained/ /dev/ttyACM0 sama5d3_xplained 136*4882a593Smuzhiyun 137*4882a593SmuzhiyunReboot, the system should boot up to the buildroot login invite. 138*4882a593Smuzhiyun 139*4882a593SmuzhiyunPreparing the SD card 140*4882a593Smuzhiyun===================== 141*4882a593Smuzhiyun 142*4882a593SmuzhiyunAn image named sdcard.img is automatically generated. With this image, 143*4882a593Smuzhiyunyou no longer have to care about the creation of the partition and 144*4882a593Smuzhiyuncopying files to the SD card. 145*4882a593Smuzhiyun 146*4882a593SmuzhiyunYou need at least a 1GB SD card. All the data on the SD card will be 147*4882a593Smuzhiyunlost. To copy the image on the SD card: 148*4882a593Smuzhiyun 149*4882a593Smuzhiyun/!\ Caution be sure to do it on the right mmcblk device /!\ 150*4882a593Smuzhiyun 151*4882a593Smuzhiyundd if=output/images/sdcard.img of=/dev/mmcblk0 152*4882a593Smuzhiyun 153*4882a593SmuzhiyunInsert your SD card in your Xplained/Evaluation Kit board, and 154*4882a593Smuzhiyunenjoy. The default U-Boot environment will load properly the kernel 155*4882a593Smuzhiyunand Device Tree blob from the first partition of the SD card, so 156*4882a593Smuzhiyuneverything works automatically. 157*4882a593Smuzhiyun 158*4882a593SmuzhiyunBy default a 16MB FAT partition is created. It contains at91bootstrap, 159*4882a593Smuzhiyunu-boot, the kernel image and all dtb variants for your board. The dtb 160*4882a593Smuzhiyunused is the basic one: 161*4882a593Smuzhiyun 162*4882a593SmuzhiyunU-Boot> print 163*4882a593Smuzhiyun[...] 164*4882a593Smuzhiyunbootcmd=fatload mmc 1:1 0x21000000 at91-sama5d2_xplained.dtb; fatload mmc 1:1 0x22000000 zImage; bootz 0x22000000 - 0x21000000 165*4882a593Smuzhiyun[...] 166*4882a593Smuzhiyun 167*4882a593SmuzhiyunIf you want to use a variant such as the _pda7 one, you will have to 168*4882a593Smuzhiyunupdate your u-boot environment: 169*4882a593Smuzhiyun 170*4882a593SmuzhiyunU-Boot> setenv bootcmd 'fatload mmc 1:1 0x21000000 at91-sama5d2_xplained_pda7.dtb; fatload mmc 1:1 0x22000000 zImage; bootz 0x22000000 - 0x21000000' 171*4882a593SmuzhiyunU-Boot> save 172*4882a593SmuzhiyunSaving Environment to FAT... 173*4882a593Smuzhiyunwriting uboot.env 174*4882a593Smuzhiyundone 175*4882a593Smuzhiyun 176*4882a593SmuzhiyunA 512MB ext4 partition is also created to store the rootfs generated. 177*4882a593Smuzhiyun 178*4882a593SmuzhiyunIf you want to customize the size of the partitions and their content, 179*4882a593Smuzhiyuntake a look at the the genimage.cfg file in the board directory. 180