From: Charles Manning Date: Sun, 12 Jul 2015 22:00:31 +0000 (+0200) Subject: configs: add altera_socdk_defconfig for Altera Cyclone 5 Development Board X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e4f787ec999834116089d79f6bd65c70403cd689;p=buildroot.git configs: add altera_socdk_defconfig for Altera Cyclone 5 Development Board This is largely the same as altera_sockit_defconfig. It uses a fresher Linux and u-boot than SocKit. It also speeds the serial port up to 115200. The post-image script is generalized by adding BR2_ROOTFS_POST_SCRIPT_ARGS and moving it up the altera directory. Similarly, the readme is moved up and made more generic. Signed-off-by: Charles Manning Signed-off-by: Arnout Vandecappelle (Essensium/Mind) Signed-off-by: Thomas Petazzoni --- diff --git a/board/altera/post-image.sh b/board/altera/post-image.sh new file mode 100755 index 0000000000..03e7819aa6 --- /dev/null +++ b/board/altera/post-image.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# post-image.sh for SoCkit/SoCDK +# 2014, "Roman Diouskine" +# 2014, "Sebastien Bourdelin" + +# create a DTB file copy with the name expected by the u-boot config +# Name of the DTB is passed as the second argument to the script. +cp -af $BINARIES_DIR/${2}.dtb $BINARIES_DIR/socfpga.dtb diff --git a/board/altera/readme.txt b/board/altera/readme.txt new file mode 100644 index 0000000000..8d5b89114b --- /dev/null +++ b/board/altera/readme.txt @@ -0,0 +1,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. diff --git a/board/altera/sockit/post-image.sh b/board/altera/sockit/post-image.sh deleted file mode 100755 index 9040808ecf..0000000000 --- a/board/altera/sockit/post-image.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# post-image.sh for SoCkit -# 2014, "Roman Diouskine" -# 2014, "Sebastien Bourdelin" - -# create a DTB file copy with the name expected by the u-boot config -cp -af $BINARIES_DIR/socfpga_cyclone5_sockit.dtb $BINARIES_DIR/socfpga.dtb diff --git a/board/altera/sockit/readme.txt b/board/altera/sockit/readme.txt deleted file mode 100644 index b6da489f61..0000000000 --- a/board/altera/sockit/readme.txt +++ /dev/null @@ -1,157 +0,0 @@ -SoCkit - -Intro -===== - -This is the buildroot board support for the Arrow SoCkit Evaluation 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 - -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 - ├── 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. diff --git a/configs/altera_socdk_defconfig b/configs/altera_socdk_defconfig new file mode 100644 index 0000000000..5a27a74d64 --- /dev/null +++ b/configs/altera_socdk_defconfig @@ -0,0 +1,36 @@ +BR2_arm=y +BR2_cortex_a9=y + +BR2_ARM_EABIHF=y +BR2_ARM_ENABLE_NEON=y +BR2_ARM_FPU_NEON=y +BR2_ARM_INSTRUCTIONS_THUMB2=y + +# Lock to 3.13 headers +BR2_KERNEL_HEADERS_VERSION=y +BR2_DEFAULT_KERNEL_VERSION="3.13.5" +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_3_13=y + +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/altera/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_LINUX_KERNEL_INTREE_DTS_NAME)" + +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_GIT=y +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="git://git.rocketboards.org/linux-socfpga.git" +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="rel_socfpga-3.13_14.02.02" +BR2_LINUX_KERNEL_DEFCONFIG="socfpga" +BR2_LINUX_KERNEL_ZIMAGE=y +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="socfpga_cyclone5_socdk" + +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_3=y + +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BOARDNAME="socfpga_cyclone5" +BR2_TARGET_UBOOT_CUSTOM_GIT=y +BR2_TARGET_UBOOT_CUSTOM_REPO_URL="git://git.rocketboards.org/u-boot-socfpga.git" +BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="rel_socfpga_v2013.01.01_14.02.02" +BR2_TARGET_UBOOT_FORMAT_IMG=y +BR2_TARGET_UBOOT_SPL=y +BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin" diff --git a/configs/altera_sockit_defconfig b/configs/altera_sockit_defconfig index 888fccf0c1..dfb895e44c 100644 --- a/configs/altera_sockit_defconfig +++ b/configs/altera_sockit_defconfig @@ -12,7 +12,8 @@ BR2_DEFAULT_KERNEL_VERSION="3.13.5" BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_3_13=y BR2_TARGET_GENERIC_GETTY_BAUDRATE_57600=y -BR2_ROOTFS_POST_IMAGE_SCRIPT="board/altera/sockit/post-image.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/altera/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_LINUX_KERNEL_INTREE_DTS_NAME)" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_GIT=y