summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYves Vandervennet <yvanderv@opensource.altera.com>2014-09-04 13:43:44 -0500
committerKhem Raj <khem_raj@cable.comcast.com>2014-09-20 18:50:14 -0700
commit4e663cef8f0fb950a8751a4e3ae236cc85db244e (patch)
tree373d01078b5d3345fc50589fbdda70e05dbd02d9
downloadmeta-altera-4e663cef8f0fb950a8751a4e3ae236cc85db244e.tar.gz
Yocto layer for Altera's SoCFPGA
Signed-off-by: Yves Vandervennet <yvanderv@opensource.altera.com>
-rw-r--r--COPYING.MIT17
-rw-r--r--README10
-rw-r--r--conf/layer.conf14
-rw-r--r--conf/machine/include/socfpga.inc27
-rw-r--r--conf/machine/socfpga_arria5.conf8
-rw-r--r--conf/machine/socfpga_cyclone5.conf8
-rwxr-xr-xrecipes-bsp/uboot/u-boot-socfpga.inc89
-rwxr-xr-xrecipes-bsp/uboot/u-boot-socfpga_2013.01.01.bb1
-rw-r--r--recipes-kernel/linux/linux-altera-latest.inc5
-rwxr-xr-xrecipes-kernel/linux/linux-altera-ltsi-rt_3.10.bb6
-rw-r--r--recipes-kernel/linux/linux-altera-ltsi.inc5
-rwxr-xr-xrecipes-kernel/linux/linux-altera-ltsi_3.10.bb4
-rwxr-xr-xrecipes-kernel/linux/linux-altera.inc112
-rwxr-xr-xrecipes-kernel/linux/linux-altera_3.15.bb6
14 files changed, 312 insertions, 0 deletions
diff --git a/COPYING.MIT b/COPYING.MIT
new file mode 100644
index 0000000..fb950dc
--- /dev/null
+++ b/COPYING.MIT
@@ -0,0 +1,17 @@
1Permission is hereby granted, free of charge, to any person obtaining a copy
2of this software and associated documentation files (the "Software"), to deal
3in the Software without restriction, including without limitation the rights
4to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5copies of the Software, and to permit persons to whom the Software is
6furnished to do so, subject to the following conditions:
7
8The above copyright notice and this permission notice shall be included in
9all copies or substantial portions of the Software.
10
11THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17THE SOFTWARE.
diff --git a/README b/README
new file mode 100644
index 0000000..a9126cc
--- /dev/null
+++ b/README
@@ -0,0 +1,10 @@
1The official OpenEmbedded/Yocto BSP layer for Altera SoCFPGA platforms
2
3This layer works with poky and Angstrom
4
5Please follow the recommended setup procedures of your OE distribution.
6
7
8Send pull requests, patches, comments or questions to yvanderv@opensource.altera.com
9
10Maintainer: yvanderv@opensource.altera.com
diff --git a/conf/layer.conf b/conf/layer.conf
new file mode 100644
index 0000000..f611a31
--- /dev/null
+++ b/conf/layer.conf
@@ -0,0 +1,14 @@
1# We have a conf and classes directory, append to BBPATH
2BBPATH .= ":${LAYERDIR}"
3
4# We have a recipes directory, add to BBFILES
5BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend"
6
7BBFILE_COLLECTIONS += "meta-altera"
8BBFILE_PATTERN_meta-altera := "^${LAYERDIR}/"
9# increase the number
10BBFILE_PRIORITY_meta-altera = "6"
11
12# yves
13BBDEBUG = "yes"
14
diff --git a/conf/machine/include/socfpga.inc b/conf/machine/include/socfpga.inc
new file mode 100644
index 0000000..60ba002
--- /dev/null
+++ b/conf/machine/include/socfpga.inc
@@ -0,0 +1,27 @@
1SOC_FAMILY = "socfpga"
2
3require conf/machine/include/tune-cortexa9.inc
4
5# this variable specifies the kernel to be built: linux-altera or linux-altera-ltsi
6# this affects the PREFERRED_PROVIDER of virtual/kernel
7# it can be overriden from the environment, using BB_ENV_EXTRAWHITE
8KERNEL_PROVIDER?="linux-altera-ltsi"
9PREFERRED_PROVIDER_virtual/kernel = "${KERNEL_PROVIDER}"
10
11PREFERRED_PROVIDER_virtual/bootloader = "u-boot-socfpga"
12
13# Increase this everytime you change something in the kernel
14MACHINE_KERNEL_PR = "r1"
15
16UBOOT_ENTRYPOINT = "0x80008000"
17UBOOT_LOADADDRESS = "0x80008000"
18
19SERIAL_CONSOLE = "115200 ttyS0"
20
21KERNEL_IMAGETYPE = "zImage"
22MACHINE_EXTRA_RRECOMMENDS = " kernel-modules"
23MACHINE_FEATURES = "kernel26"
24
25# file system images required
26IMAGE_FSTYPES ?= "cpio ext3 tar.gz"
27
diff --git a/conf/machine/socfpga_arria5.conf b/conf/machine/socfpga_arria5.conf
new file mode 100644
index 0000000..022c6a8
--- /dev/null
+++ b/conf/machine/socfpga_arria5.conf
@@ -0,0 +1,8 @@
1#@TYPE: Machine
2#@NAME: SOCFPGA
3#@DESCRIPTION: Machine configuration for the Cyclone V SoC"
4
5require conf/machine/include/socfpga.inc
6
7UBOOT_MACHINE = "socfpga_arria5"
8
diff --git a/conf/machine/socfpga_cyclone5.conf b/conf/machine/socfpga_cyclone5.conf
new file mode 100644
index 0000000..e4d3b5b
--- /dev/null
+++ b/conf/machine/socfpga_cyclone5.conf
@@ -0,0 +1,8 @@
1#@TYPE: Machine
2#@NAME: SOCFPGA
3#@DESCRIPTION: Machine configuration for the Cyclone V SoC"
4
5require conf/machine/include/socfpga.inc
6
7UBOOT_MACHINE = "socfpga_cyclone5"
8
diff --git a/recipes-bsp/uboot/u-boot-socfpga.inc b/recipes-bsp/uboot/u-boot-socfpga.inc
new file mode 100755
index 0000000..5655c12
--- /dev/null
+++ b/recipes-bsp/uboot/u-boot-socfpga.inc
@@ -0,0 +1,89 @@
1DESCRIPTION = "U-boot bootloader for Altera socfpga"
2HOMEPAGE = "http://www.altera.com/"
3SECTION = "bootloaders"
4PROVIDES += " virtual/bootloader u-boot"
5
6inherit deploy
7
8PARALLEL_MAKE=""
9PACKAGES=""
10
11# the following variables can be passed from the env
12# using BB_ENV_WHITELIST to override the defaults
13UBOOT_REPO?="git://git.rocketboards.org/u-boot-socfpga.git"
14UBOOT_BRANCH?="socfpga_v${PV}"
15UBOOT_PROT?="http"
16UBOOT_TAG?="${AUTOREV}"
17
18SRC_URI = "${UBOOT_REPO};protocol=${UBOOT_PROT};branch=${UBOOT_BRANCH}"
19LIC_FILES_CHKSUM = "file://${S}/COPYING;startline=26;md5=1707d6db1d42237583f50183a5651ecb"
20SRCREV_pn-${PN} = "${UBOOT_TAG}"
21
22S = "${WORKDIR}/git"
23
24# GCC 4.5.1 builds unusable binaries using -Os, remove it from OPTFLAGS
25EXTRA_OEMAKE = "CROSS_COMPILE=${TARGET_PREFIX}"
26
27python () {
28 if not d.getVar("UBOOT_MACHINE", True):
29 PN = d.getVar("PN", True)
30 FILE = os.path.basename(d.getVar("FILE", True))
31 bb.debug(1, "To build %s, see %s for instructions on \
32 setting up your machine config" % (PN, FILE))
33 raise bb.parse.SkipPackage("because UBOOT_MACHINE is not set")
34}
35
36UBOOT_ELF ?= "u-boot-${MACHINE}-${PV}-${PR}"
37UBOOT_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.bin"
38UBOOT_IMAGE_UIMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.img"
39UBOOT_IMAGE_SPL ?= "u-boot-spl-${MACHINE}-${PV}-${PR}.bin"
40UBOOT_ELF_SPL ?= "u-boot-spl-${MACHINE}-${PV}-${PR}"
41UBOOT_BINARY ?= "u-boot.bin"
42UBOOT_SYMLINK_ELF ?= "u-boot-${MACHINE}"
43UBOOT_SYMLINK ?= "u-boot-${MACHINE}.bin"
44UBOOT_SYMLINK_UIMAGE ?= "u-boot-${MACHINE}.img"
45UBOOT_SYMLINK_SPL ?= "u-boot-spl-${MACHINE}.bin"
46UBOOT_SYMLINK_ELF_SPL ?= "u-boot-spl-${MACHINE}"
47UBOOT_MAKE_TARGET ?= "all"
48INC_PR = "r0"
49
50LICENSE = "GPLv2+"
51
52do_compile () {
53 unset LDFLAGS
54 unset CFLAGS
55 unset CPPFLAGS
56 oe_runmake ${UBOOT_MACHINE}
57 oe_runmake ${UBOOT_MAKE_TARGET}
58}
59
60do_install () {
61 install -d ${D}/boot
62 install ${S}/${UBOOT_BINARY} ${D}/boot/${UBOOT_IMAGE}
63 install ${S}/spl/u-boot-spl ${D}/boot/${UBOOT_ELF_SPL}
64 install ${S}/u-boot ${D}/boot/${UBOOT_ELF}
65 ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY}
66}
67
68FILES_${PN} = "/boot"
69
70do_deploy () {
71 install ${S}/u-boot.bin ${DEPLOYDIR}/${UBOOT_IMAGE}
72 install ${S}/u-boot.img ${DEPLOYDIR}/${UBOOT_IMAGE_UIMAGE}
73 install ${S}/spl/u-boot-spl.bin ${DEPLOYDIR}/${UBOOT_IMAGE_SPL}
74 install ${S}/spl/u-boot-spl ${DEPLOYDIR}/${UBOOT_ELF_SPL}
75 install ${S}/u-boot ${DEPLOYDIR}/${UBOOT_ELF}
76
77 cd ${DEPLOYDIR}
78 rm -f ${UBOOT_SYMLINK}
79 ln -sf ${UBOOT_IMAGE} ${UBOOT_SYMLINK}
80 rm -f ${UBOOT_SYMLINK_UIMAGE}
81 ln -sf ${UBOOT_IMAGE_UIMAGE} ${UBOOT_SYMLINK_UIMAGE}
82 rm -f ${UBOOT_SYMLINK_SPL}
83 ln -sf ${UBOOT_IMAGE_SPL} ${UBOOT_SYMLINK_SPL}
84 rm -f ${UBOOT_SYMLINK_ELF_SPL}
85 ln -sf ${UBOOT_ELF_SPL} ${UBOOT_SYMLINK_ELF_SPL}
86 rm -f ${UBOOT_SYMLINK_ELF}
87 ln -sf ${UBOOT_ELF} ${UBOOT_SYMLINK_ELF}
88}
89addtask deploy before do_build after do_compile
diff --git a/recipes-bsp/uboot/u-boot-socfpga_2013.01.01.bb b/recipes-bsp/uboot/u-boot-socfpga_2013.01.01.bb
new file mode 100755
index 0000000..1beca44
--- /dev/null
+++ b/recipes-bsp/uboot/u-boot-socfpga_2013.01.01.bb
@@ -0,0 +1 @@
require u-boot-socfpga.inc
diff --git a/recipes-kernel/linux/linux-altera-latest.inc b/recipes-kernel/linux/linux-altera-latest.inc
new file mode 100644
index 0000000..edf09b2
--- /dev/null
+++ b/recipes-kernel/linux/linux-altera-latest.inc
@@ -0,0 +1,5 @@
1KERNEL_BRANCH?="socfpga-${PV}"
2
3require recipes-kernel/linux/linux-altera.inc
4
5
diff --git a/recipes-kernel/linux/linux-altera-ltsi-rt_3.10.bb b/recipes-kernel/linux/linux-altera-ltsi-rt_3.10.bb
new file mode 100755
index 0000000..9946554
--- /dev/null
+++ b/recipes-kernel/linux/linux-altera-ltsi-rt_3.10.bb
@@ -0,0 +1,6 @@
1DTB_SUBDIR="dts/"
2
3KERNEL_BRANCH?="socfpga-${PV}-ltsi-rt"
4
5require recipes-kernel/linux/linux-altera.inc
6
diff --git a/recipes-kernel/linux/linux-altera-ltsi.inc b/recipes-kernel/linux/linux-altera-ltsi.inc
new file mode 100644
index 0000000..8b058e5
--- /dev/null
+++ b/recipes-kernel/linux/linux-altera-ltsi.inc
@@ -0,0 +1,5 @@
1KERNEL_BRANCH?="socfpga-${PV}-ltsi"
2
3require recipes-kernel/linux/linux-altera.inc
4
5
diff --git a/recipes-kernel/linux/linux-altera-ltsi_3.10.bb b/recipes-kernel/linux/linux-altera-ltsi_3.10.bb
new file mode 100755
index 0000000..1ba1a60
--- /dev/null
+++ b/recipes-kernel/linux/linux-altera-ltsi_3.10.bb
@@ -0,0 +1,4 @@
1DTB_SUBDIR="dts/"
2
3require recipes-kernel/linux/linux-altera-ltsi.inc
4
diff --git a/recipes-kernel/linux/linux-altera.inc b/recipes-kernel/linux/linux-altera.inc
new file mode 100755
index 0000000..3a8ac1d
--- /dev/null
+++ b/recipes-kernel/linux/linux-altera.inc
@@ -0,0 +1,112 @@
1PR = "r1"
2
3KERNEL_REPO?="git://git.rocketboards.org/linux-socfpga.git"
4KERNEL_PROT?="http"
5KERNEL_DEFCONFIG?="socfpga_defconfig"
6KERNEL_TAG?="${AUTOREV}"
7
8SRC_URI = "${KERNEL_REPO};protocol=${KERNEL_PROT};branch=${KERNEL_BRANCH}"
9
10SRCREV_pn-${PN} = "${KERNEL_TAG}"
11
12inherit kernel
13SECTION = "kernel"
14DESCRIPTION = "Altera Linux kernel"
15LICENSE = "GPLv2"
16
17COMPATIBLE_MACHINE = "socfpga"
18
19LIC_FILES_CHKSUM = "file://${S}/COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
20
21S = "${WORKDIR}/git"
22
23MACHINE_DEFCONFIG = "${KERNEL_DEFCONFIG}"
24
25do_configure() {
26 export INITRAMFS_IMAGE_FILE="${INITRAMFS_IMAGE}-${MACHINE}.cpio"
27
28 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
29 export CROSS_COMPILE="${TARGET_PREFIX}"
30 export ARCH=${ARCH}
31
32 oe_runmake ${MACHINE_DEFCONFIG} CONFIG_BLK_DEV_INITRD=y
33
34 cp .config .config.ori
35
36 grep CONFIG_BLK_DEV_INITRD .config || echo "CONFIG_BLK_DEV_INITRD=y" >> .config
37 grep CONFIG_INITRAMFS_SOURCE .config || echo "CONFIG_INITRAMFS_SOURCE=\"\"" >> .config
38 grep CONFIG_INITRAMFS_ROOT_UID .config || echo "CONFIG_INITRAMFS_ROOT_UID=0" >> .config
39 grep CONFIG_INITRAMFS_ROOT_GID .config || echo "CONFIG_INITRAMFS_ROOT_GID=0" >> .config
40 grep CONFIG_INITRAMFS_COMPRESSION_NONE .config || echo "CONFIG_INITRAMFS_COMPRESSION_NONE=y" >> .config
41
42 if [ ! -z ${INITRAMFS_IMAGE} ] && [ -e ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_FILE} ]; then
43 cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_FILE} .
44 echo "Found valid initramfs ${INITRAMFS_IMAGE_FILE}"
45 sed -i "s|^.*CONFIG_BLK_DEV_INITRD[ =].*$|CONFIG_BLK_DEV_INITRD=y|g" .config
46 sed -i "s|^.*CONFIG_INITRAMFS_SOURCE[ =].*$|CONFIG_INITRAMFS_SOURCE=\"${INITRAMFS_IMAGE_FILE}\"|g" .config
47 sed -i "s|^.*CONFIG_INITRAMFS_ROOT_UID[ =].*$|CONFIG_INITRAMFS_ROOT_UID=0|g" .config
48 sed -i "s|^.*CONFIG_INITRAMFS_ROOT_GID[ =].*$|CONFIG_INITRAMFS_ROOT_GID=0|g" .config
49 sed -i "s|^.*CONFIG_INITRAMFS_COMPRESSION_NONE[ =].*$|CONFIG_INITRAMFS_COMPRESSION_NONE=y|g" .config
50 oe_runmake oldconfig
51 else
52 rm -f *.cpio
53 echo "Initramfs disabled or can't find valid initramfs ${INITRAMFS_IMAGE_FILE}"
54 sed -i "s|^CONFIG_BLK_DEV_INITRD=.*$|# CONFIG_BLK_DEV_INITRD is not set|g" .config
55 sed -i "s|^CONFIG_INITRAMFS_SOURCE=\".*\"$|# CONFIG_INITRAMFS_SOURCE is not set|g" .config
56 sed -i "s|^CONFIG_INITRAMFS_ROOT_UID=.*$|# CONFIG_INITRAMFS_ROOT_UID is not set|g" .config
57 sed -i "s|^CONFIG_INITRAMFS_ROOT_GID=.*$|# CONFIG_INITRAMFS_ROOT_GID is not set|g" .config
58 sed -i "s|^CONFIG_INITRAMFS_COMPRESSION_NONE=.*$|# CONFIG_INITRAMFS_COMPRESSION_NONE is not set|g" .config
59 oe_runmake oldconfig
60 fi
61}
62
63kernel_do_compile() {
64 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
65 oe_runmake __headers CC="${KERNEL_CC}" LD="${KERNEL_LD}"
66 oe_runmake ${KERNEL_IMAGETYPE_FOR_MAKE} ${KERNEL_ALT_IMAGETYPE} CC="${KERNEL_CC}" LD="${KERNEL_LD}" LOADADDR=0x8000
67 if test "${KERNEL_IMAGETYPE_FOR_MAKE}.gz" = "${KERNEL_IMAGETYPE}"; then
68 gzip -9c < "${KERNEL_IMAGETYPE_FOR_MAKE}" > "${KERNEL_OUTPUT}"
69 fi
70}
71
72do_compile_dtb() {
73 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
74 sync
75 oe_runmake ARCH=${ARCH} CROSS_COMPILE="${TARGET_PREFIX}" dtbs ||
76 oe_runmake ARCH=${ARCH} CROSS_COMPILE="${TARGET_PREFIX}" dtbs
77}
78
79addtask compile_dtb after do_compile before do_build
80
81KERNEL_DEVICETREE ?= "socfpga_vt socfpga_cyclone5 socfpga_arria5"
82
83do_deploy_dtb() {
84 install -d ${DEPLOY_DIR_IMAGE}
85 cd ${DEPLOY_DIR_IMAGE}
86 if test -n "${KERNEL_DEVICETREE}"; then
87 for DTB_FILE in ${KERNEL_DEVICETREE}; do
88 DTB_SYMLINK_NAME="${DTB_FILE}.dtb"
89 DEVICE_TREE_OUTPUT="${S}/arch/${ARCH}/boot/${DTB_SUBDIR}${DTB_FILE}.dtb"
90 DTB_NAME="${DTB_FILE}-${DATETIME}.dtb"
91 if [ ! -f ${DEVICE_TREE_OUTPUT} ]; then
92 echo "Warning: ${DEVICE_TREE_OUTPUT} is not available!"
93 continue
94 fi
95 install -m 0644 ${DEVICE_TREE_OUTPUT} ${DTB_NAME}
96 rm -f ${DTB_SYMLINK_NAME}
97 ln -sf ${DTB_NAME} ${DTB_SYMLINK_NAME}
98 done
99 fi
100}
101
102addtask deploy_dtb after do_compile_dtb before do_build
103
104VMLINUX_NAME ?= "vmlinux-${PV}-${PR}-${MACHINE}-${DATETIME}"
105
106kernel_do_deploy_append() {
107 install -m 0644 ${S}/vmlinux ${DEPLOYDIR}/${VMLINUX_NAME}
108 cd ${DEPLOYDIR} &&
109 rm -f vmlinux &&
110 ln -sf ${VMLINUX_NAME} vmlinux
111}
112
diff --git a/recipes-kernel/linux/linux-altera_3.15.bb b/recipes-kernel/linux/linux-altera_3.15.bb
new file mode 100755
index 0000000..535b526
--- /dev/null
+++ b/recipes-kernel/linux/linux-altera_3.15.bb
@@ -0,0 +1,6 @@
1DTB_SUBDIR="dts/"
2
3KERNEL_DEVICETREE = "socfpga_cyclone5_socdk socfpga_arria5_socdk socfpga_vt"
4
5require recipes-kernel/linux/linux-altera-latest.inc
6