summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README22
-rw-r--r--classes/sdcard_image-rpi.bbclass192
-rwxr-xr-xconf/machine/raspberrypi.conf11
-rwxr-xr-xrecipes-bcm/bootfiles/bcm2835-bootfiles.bb9
-rw-r--r--recipes-bcm/common/firmware.inc8
-rw-r--r--recipes-bcm/kernel-image/bcm2835-kernel-image.bb4
-rw-r--r--recipes-bcm/vc-graphics/files/egl.pc10
-rw-r--r--recipes-bcm/vc-graphics/vc-graphics-hardfp.bb8
-rwxr-xr-xrecipes-bcm/vc-graphics/vc-graphics.bb8
-rw-r--r--recipes-bcm/vc-graphics/vc-graphics.inc38
-rwxr-xr-xrecipes-kernel/linux/linux-raspberrypi_3.1.9.bb4
11 files changed, 189 insertions, 125 deletions
diff --git a/README b/README
index ddce089..0007c0f 100644
--- a/README
+++ b/README
@@ -9,11 +9,27 @@ More information can be found at:
9 http://www.raspberrypi.org/ (Official Site) 9 http://www.raspberrypi.org/ (Official Site)
10 http://www.distant-earth.com/ (My Site) 10 http://www.distant-earth.com/ (My Site)
11 11
12Build scripts to support making a firmware image for the RaspberryPi can be found at: 12Build scripts patched to support making a firmware image for the RaspberryPi with Angstrom can be found at:
13 13
14 TODO: Fork Angstrom setup-scripts with layer added. 14 http://github.com/Angstrom-distribution/setup-scripts
15 15
16This layer depends on: 16When not depending on meta-openembedded and not using systemd, you may need to
17mask few recipes requiring systemd or other recipes not included in your distribution of choice.
18
19You can achieve this by adding something like the following to local.conf:
20
21BBMASK = "meta-raspberrypi/recipes-multimedia/libav|meta-raspberrypi/recipes-core/systemd"
22
23You can adjust the BBMASK for any .bbappends that your distribution does not contain recipes for.
24
25The core BSP part of meta-raspberrypi should work with different OpenEmbedded/Yocto
26distributions and layer stacks, such as:
27
28* Distro-less (only with OE-Core).
29* Angstrom (main focus of testing).
30* Yocto/Poky.
31
32This layer in its entirety depends on:
17 33
18URI: git://git.openembedded.org/openembedded-core 34URI: git://git.openembedded.org/openembedded-core
19branch: master 35branch: master
diff --git a/classes/sdcard_image-rpi.bbclass b/classes/sdcard_image-rpi.bbclass
index 1ac3e84..af18aab 100644
--- a/classes/sdcard_image-rpi.bbclass
+++ b/classes/sdcard_image-rpi.bbclass
@@ -1,131 +1,97 @@
1inherit image 1#
2 2# Create an image that can by written onto a SD card using dd.
3# Add the fstypes we need 3#
4IMAGE_FSTYPES_append = " tar.bz2 rpi-sdimg" 4# The disk layout used is:
5 5#
6# Ensure required utilities are present 6# 0 - 1M - reserved for other data
7IMAGE_DEPENDS_rpi-sdimg = "genext2fs-native e2fsprogs-native bcm2835-bootfiles bcm2835-kernel-image" 7# 1M - BOOT_SPACE - bootloader and kernel
8 8# BOOT_SPACE - SDIMG_SIZE - rootfs
9# Register this as an avalable type of image. 9#
10IMAGE_TYPES_append = " rpi-sdimg" 10
11 11# Set kernel and boot loader
12# Change this to match your host distro 12IMAGE_BOOTLOADER ?= "bcm2835-bootfiles"
13LOSETUP ?= "/sbin/losetup" 13
14 14# Default to 1.4GiB images
15# Since these need to go in /etc/fstab we can hardcode them 15SDIMG_SIZE ?= "4000"
16# Since the vars are weakly assigned, you can override them from your local.conf 16
17LOOPDEV ?= "/dev/loop1" 17# Boot partition volume id
18LOOPDEV_BOOT ?= "/dev/loop2" 18BOOTDD_VOLUME_ID ?= "${MACHINE}"
19LOOPDEV_FS ?= "/dev/loop3" 19
20 20# Addional space for boot partition
21# Default to 4GiB images 21BOOT_SPACE ?= "20MiB"
22SDIMG_SIZE ?= "444" 22
23 23# Use an ext3 by default as rootfs
24# FS type for rootfs 24SDIMG_ROOTFS_TYPE ?= "ext3"
25ROOTFSTYPE ?= "ext4" 25SDIMG_ROOTFS = "${IMAGE_NAME}.rootfs.${SDIMG_ROOTFS_TYPE}"
26 26
27BOOTPARTNAME ?= "${MACHINE}" 27# Set GPU firmware image to be used
28 28# arm128 : 128M ARM, 128M GPU split
29IMAGEDATESTAMP = "${@time.strftime('%Y.%m.%d',time.gmtime())}" 29# arm192 : 192M ARM, 64M GPU split
30# arm224 : 224M ARM, 32M GPU split
31RPI_GPU_FIRMWARE ?= "arm192"
32
33IMAGE_DEPENDS_rpi-sdimg = " \
34 parted-native \
35 mtools-native \
36 dosfstools-native \
37 virtual/kernel \
38 ${IMAGE_BOOTLOADER} \
39 "
40
41# SD card image name
42SDIMG = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.rpi-sdimg"
30 43
31# Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS. 44# Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS.
32FATPAYLOAD ?= "" 45FATPAYLOAD ?= ""
33 46
34IMAGE_CMD_rpi-sdimg () { 47IMAGEDATESTAMP = "${@time.strftime('%Y.%m.%d',time.gmtime())}"
35 SDIMG=${WORKDIR}/sd.img
36
37 # sanity check fstab entry for boot partition mounting
38 if [ "x$(cat /etc/fstab | grep ${LOOPDEV_BOOT} | grep ${WORKDIR}/tmp-mnt-boot | grep user || true)" = "x" ]; then
39 echo "/etc/fstab entries need to be created with the user flag for the loop devices like:"
40 echo "${LOOPDEV_BOOT} ${WORKDIR}/tmp-mnt-boot vfat user 0 0"
41 false
42 fi
43
44 # cleanup loops
45 for loop in ${LOOPDEV} ${LOOPDEV_BOOT} ${LOOPDEV_FS} ; do
46 ${LOSETUP} -d $loop || true
47 done
48
49 # If an SD image is already present, reuse and reformat it
50 if [ ! -e ${SDIMG} ] ; then
51 dd if=/dev/zero of=${SDIMG} bs=$(echo '255 * 63 * 512' | bc) count=${SDIMG_SIZE}
52 fi
53 48
54 ${LOSETUP} ${LOOPDEV} ${SDIMG} 49IMAGE_CMD_rpi-sdimg () {
50 # Initialize sdcard image file
51 dd if=/dev/zero of=${SDIMG} bs=1 count=0 seek=$(expr 1000 \* 1000 \* ${SDIMG_SIZE})
55 52
56 # Create partition table 53 # Create partition table
57 dd if=/dev/zero of=${LOOPDEV} bs=1024 count=1024 54 parted -s ${SDIMG} mklabel msdos
58 SIZE=$(/sbin/fdisk -l ${LOOPDEV} | grep Disk | grep bytes | awk '{print $5}') 55 # Create boot partition and mark it as bootable
59 CYLINDERS=$(echo $SIZE/255/63/512 | bc) 56 parted -s ${SDIMG} mkpart primary fat32 1MiB ${BOOT_SPACE}
60 { 57 parted -s ${SDIMG} set 1 boot on
61 echo ,9,0x0C,* 58 # Create rootfs partition
62 echo ,,,- 59 parted -s ${SDIMG} mkpart primary ext2 ${BOOT_SPACE} 100%
63 } | /sbin/sfdisk -D -H 255 -S 63 -C ${CYLINDERS} ${LOOPDEV} 60 parted ${SDIMG} print
64 61
65 # Prepare loop devices for boot and filesystem partitions 62 # Create a vfat image with boot files
66 BOOT_OFFSET=32256 63 BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG} unit b print | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }')
67 FS_OFFSET_SECT=$(/sbin/fdisk -l -u ${LOOPDEV} 2>&1 | grep Linux | perl -p -i -e "s/\s+/ /"|cut -d " " -f 2) 64 mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS
68 FS_OFFSET=$(echo "$FS_OFFSET_SECT * 512" | bc) 65 case "${RPI_GPU_FIRMWARE}" in
69 FS_SIZE_BLOCKS=$(/sbin/fdisk -l -u ${LOOPDEV} 2>&1 | grep Linux | perl -p -i -e "s/\s+/ /g" \ 66 "arm128" | "arm192" | "arm224")
70 |cut -d " " -f 4 | cut -d "+" -f 1) 67 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/${RPI_GPU_FIRMWARE}_start.elf ::start.elf
71 68 ;;
72 LOOPDEV_BLOCKS=$(/sbin/fdisk -l -u ${LOOPDEV} 2>&1 | grep FAT | perl -p -i -e "s/\s+/ /g"|cut -d " " -f 5) 69 *)
73 LOOPDEV_BYTES=$(echo "$LOOPDEV_BLOCKS * 1024" | bc) 70 bberror "RPI_GPU_FIRMWARE is undefined or value not recongnised. Possible values: arm128, arm192 or arm224."
74 71 exit 1
75 ${LOSETUP} -d ${LOOPDEV} 72 ;;
76 73 esac
77 ${LOSETUP} ${LOOPDEV_BOOT} ${SDIMG} -o ${BOOT_OFFSET}
78
79 /sbin/mkfs.vfat ${LOOPDEV_BOOT} -n ${BOOTPARTNAME} $LOOPDEV_BLOCKS
80
81 # Prepare boot partion. First mount the boot partition, and copy the bootloader and supporting files.
82
83 mkdir -p ${WORKDIR}/tmp-mnt-boot
84 mount $LOOPDEV_BOOT ${WORKDIR}/tmp-mnt-boot
85 74
86 echo "Copying bootloader and prepended kernel.img into the boot partition" 75 # To do
87 cp -v ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/* ${WORKDIR}/tmp-mnt-boot || true 76 # Copy here a cmdline.txt file generated taking into consideration the partition type
77 # of the rootfs
78 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/bootcode.bin ::
79 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/loader.bin ::
80 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/kernel.img ::
88 81
89 if [ -n ${FATPAYLOAD} ] ; then 82 if [ -n ${FATPAYLOAD} ] ; then
90 echo "Copying payload into VFAT" 83 echo "Copying payload into VFAT"
91 for entry in ${FATPAYLOAD} ; do 84 for entry in ${FATPAYLOAD} ; do
92 # add the || true to stop aborting on vfat issues like not supporting .~lock files 85 # add the || true to stop aborting on vfat issues like not supporting .~lock files
93 cp -av ${IMAGE_ROOTFS}$entry ${WORKDIR}/tmp-mnt-boot || true 86 mcopy -i ${WORKDIR}/boot.img -s -v ${IMAGE_ROOTFS}$entry :: || true
94 done 87 done
95 fi 88 fi
96 89
97 echo "${IMAGE_NAME}-${IMAGEDATESTAMP}" > ${IMAGE_ROOTFS}/etc/image-version-info 90 # Add stamp file
98 91 echo "${IMAGE_NAME}-${IMAGEDATESTAMP}" > ${WORKDIR}/image-version-info
99 cp -v ${IMAGE_ROOTFS}/etc/image-version-info ${WORKDIR}/tmp-mnt-boot || true 92 mcopy -i ${WORKDIR}/boot.img -v ${WORKDIR}//image-version-info ::
100
101 # Cleanup VFAT mount
102 echo "Cleaning up VFAT mount"
103 umount ${WORKDIR}/tmp-mnt-boot
104 ${LOSETUP} -d ${LOOPDEV_BOOT} || true
105
106 # Prepare rootfs parition
107 echo "Creating rootfs loopback"
108 ${LOSETUP} ${LOOPDEV_FS} ${SDIMG} -o ${FS_OFFSET}
109
110 FS_NUM_INODES=$(echo $FS_SIZE_BLOCKS / 4 | bc)
111
112 case "${ROOTFSTYPE}" in
113 ext3)
114 genext2fs -z -N $FS_NUM_INODES -b $FS_SIZE_BLOCKS -d ${IMAGE_ROOTFS} ${LOOPDEV_FS}
115 tune2fs -L ${IMAGE_NAME} -j ${LOOPDEV_FS}
116 ;;
117 ext4)
118 genext2fs -z -N $FS_NUM_INODES -b $FS_SIZE_BLOCKS -d ${IMAGE_ROOTFS} ${LOOPDEV_FS}
119 tune2fs -L ${IMAGE_NAME} -j -O extents,uninit_bg,dir_index ${LOOPDEV_FS}
120 ;;
121 *)
122 echo "Please set ROOTFSTYPE to something supported"
123 exit 1
124 ;;
125 esac
126
127 ${LOSETUP} -d ${LOOPDEV_FS} || true
128 93
129 gzip -c ${WORKDIR}/sd.img > ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}-${IMAGEDATESTAMP}.img.gz 94 # Burn Partitions
130 rm -f ${WORKDIR}/sd.img 95 dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1 bs=1M && sync && sync
96 dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=${BOOT_SPACE} && sync && sync
131} 97}
diff --git a/conf/machine/raspberrypi.conf b/conf/machine/raspberrypi.conf
index f3b33bb..a64104b 100755
--- a/conf/machine/raspberrypi.conf
+++ b/conf/machine/raspberrypi.conf
@@ -9,9 +9,10 @@ require conf/machine/include/tune-arm1176jzf-s.inc
9 9
10GUI_MACHINE_CLASS = "bigscreen" 10GUI_MACHINE_CLASS = "bigscreen"
11 11
12IMAGE_FSTYPES += "tar.bz2 rpi-sdimg" 12INHERIT += "sdcard_image-rpi"
13IMAGE_FSTYPES += "tar.bz2 ext3 rpi-sdimg"
13 14
14SERIAL_CONSOLE = "115200 ttyS0" 15SERIAL_CONSOLE = "115200 ttyAMA0"
15 16
16PREFERRED_PROVIDER_virtual/kernel = "linux-${MACHINE}" 17PREFERRED_PROVIDER_virtual/kernel = "linux-${MACHINE}"
17MACHINE_KERNEL_PR = "r4" 18MACHINE_KERNEL_PR = "r4"
@@ -34,3 +35,9 @@ MACHINE_EXTRA_RRECOMMENDS += " \
34 kernel-modules \ 35 kernel-modules \
35 bcm2835-kernel-image \ 36 bcm2835-kernel-image \
36" 37"
38
39# Set GPU firmware image to be used
40# arm128 : 128M ARM, 128M GPU split
41# arm192 : 192M ARM, 64M GPU split
42# arm224 : 224M ARM, 32M GPU split
43RPI_GPU_FIRMWARE ?= "arm192"
diff --git a/recipes-bcm/bootfiles/bcm2835-bootfiles.bb b/recipes-bcm/bootfiles/bcm2835-bootfiles.bb
index c0e204d..e059142 100755
--- a/recipes-bcm/bootfiles/bcm2835-bootfiles.bb
+++ b/recipes-bcm/bootfiles/bcm2835-bootfiles.bb
@@ -1,13 +1,12 @@
1DESCRIPTION = "Closed source binary files to help boot the ARM on the BCM2835." 1DESCRIPTION = "Closed source binary files to help boot the ARM on the BCM2835."
2LICENSE = "proprietary-binary" 2LICENSE = "Proprietary"
3 3
4LIC_FILES_CHKSUM = "file://LICENCE.broadcom;md5=e86e693d19572ee64cc8b17fb062faa9" 4LIC_FILES_CHKSUM = "file://LICENCE.broadcom;md5=e86e693d19572ee64cc8b17fb062faa9"
5 5
6# This is on the master branch 6include ../common/firmware.inc
7SRCREV = "56cd7ffb3f7244017c8eb3b492ea37592c678506"
8 7
9SRC_URI = " \ 8SRC_URI = " \
10 git://github.com/raspberrypi/firmware.git;protocol=git;branch=master \ 9 git://github.com/raspberrypi/firmware.git;protocol=git;branch=master \
11" 10"
12 11
13S = "${WORKDIR}/git/boot" 12S = "${WORKDIR}/git/boot"
@@ -23,7 +22,7 @@ do_deploy() {
23 done 22 done
24 for i in *.bin ; do 23 for i in *.bin ; do
25 cp $i ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles 24 cp $i ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles
26 done 25 done
27} 26}
28 27
29PACKAGE_ARCH = "${MACHINE_ARCH}" 28PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/recipes-bcm/common/firmware.inc b/recipes-bcm/common/firmware.inc
new file mode 100644
index 0000000..89192a2
--- /dev/null
+++ b/recipes-bcm/common/firmware.inc
@@ -0,0 +1,8 @@
1
2# 21/06/2012 firmware; this can be overridden from distro config
3RPIFW_SRCREV ?= "fc0232ac463f0618914bab9314e8e2ae27466d8c"
4RPIFW_DATE ?= "20120621"
5
6
7SRCREV = "${RPIFW_SRCREV}"
8PV = "${RPIFW_DATE}" \ No newline at end of file
diff --git a/recipes-bcm/kernel-image/bcm2835-kernel-image.bb b/recipes-bcm/kernel-image/bcm2835-kernel-image.bb
index ced20b0..085cd01 100644
--- a/recipes-bcm/kernel-image/bcm2835-kernel-image.bb
+++ b/recipes-bcm/kernel-image/bcm2835-kernel-image.bb
@@ -3,9 +3,9 @@ LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58" 3LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"
4 4
5COMPATIBLE_MACHINE = "raspberrypi" 5COMPATIBLE_MACHINE = "raspberrypi"
6PR = "${MACHINE_KERNEL_PR}.1" 6PR = "${MACHINE_KERNEL_PR}.2"
7 7
8DEPENDS = "bcm2835-bootfiles bcm2835-mkimage-native" 8DEPENDS = "bcm2835-bootfiles bcm2835-mkimage-native virtual/kernel"
9 9
10S = "${WORKDIR}" 10S = "${WORKDIR}"
11 11
diff --git a/recipes-bcm/vc-graphics/files/egl.pc b/recipes-bcm/vc-graphics/files/egl.pc
new file mode 100644
index 0000000..c314202
--- /dev/null
+++ b/recipes-bcm/vc-graphics/files/egl.pc
@@ -0,0 +1,10 @@
1prefix=/usr
2exec_prefix=${prefix}
3libdir=${exec_prefix}/lib
4includedir=${prefix}/include
5
6Name: egl
7Description: egl for RaspberryPI
8Version: 0.0
9Libs: -L${libdir} -lEGL -lGLESv2
10Cflags: -I${includedir}/vc -I${includedir}/interface -I${includedir}/interface/vcos -I${includedir}/interface/vcos/pthreads
diff --git a/recipes-bcm/vc-graphics/vc-graphics-hardfp.bb b/recipes-bcm/vc-graphics/vc-graphics-hardfp.bb
new file mode 100644
index 0000000..e96c291
--- /dev/null
+++ b/recipes-bcm/vc-graphics/vc-graphics-hardfp.bb
@@ -0,0 +1,8 @@
1
2CONFLICTS = "vc-graphics"
3
4VCDIR = "hardfp/opt/vc"
5require vc-graphics.inc
6
7PR = "${INCPR}.0"
8
diff --git a/recipes-bcm/vc-graphics/vc-graphics.bb b/recipes-bcm/vc-graphics/vc-graphics.bb
new file mode 100755
index 0000000..e78a80b
--- /dev/null
+++ b/recipes-bcm/vc-graphics/vc-graphics.bb
@@ -0,0 +1,8 @@
1
2CONFLICTS = "vc-graphics-hardfp"
3
4VCDIR = "opt/vc"
5require vc-graphics.inc
6
7PR = "${INCPR}.0"
8
diff --git a/recipes-bcm/vc-graphics/vc-graphics.inc b/recipes-bcm/vc-graphics/vc-graphics.inc
new file mode 100644
index 0000000..19ce4ba
--- /dev/null
+++ b/recipes-bcm/vc-graphics/vc-graphics.inc
@@ -0,0 +1,38 @@
1DESCRIPTION = "Graphics libraries for BCM2835."
2LICENSE = "proprietary-binary"
3
4LIC_FILES_CHKSUM = "file://LICENCE;md5=86e53f5f5909ee66900418028de11780"
5
6PROVIDES += "virtual/egl"
7
8include ../common/firmware.inc
9
10SRC_URI = "git://github.com/raspberrypi/firmware.git;protocol=git;branch=master\
11 file://egl.pc"
12
13S = "${WORKDIR}/git/${VCDIR}"
14
15INCPR = "r0"
16
17inherit pkgconfig
18
19do_install () {
20 install -d ${D}${bindir}
21 cp -R bin/* ${D}${bindir}
22
23 install -d ${D}${sbindir}
24 cp -R sbin/* ${D}${sbindir}
25
26 install -d ${D}${libdir}
27 cp -R lib/* ${D}${libdir}
28
29 install -d ${D}${includedir}
30 cp -R include/* ${D}${includedir}
31
32 install -d ${D}${libdir}/pkgconfig
33 install -m 0644 ${WORKDIR}/egl.pc ${D}${libdir}/pkgconfig/
34}
35
36
37FILES_${PN} = "${bindir}/* ${sbindir}/* ${libdir}/lib*.so*"
38FILES_${PN}-dev += "${libdir}/pkgconfig"
diff --git a/recipes-kernel/linux/linux-raspberrypi_3.1.9.bb b/recipes-kernel/linux/linux-raspberrypi_3.1.9.bb
index 1ab698b..ab5c6a0 100755
--- a/recipes-kernel/linux/linux-raspberrypi_3.1.9.bb
+++ b/recipes-kernel/linux/linux-raspberrypi_3.1.9.bb
@@ -27,3 +27,7 @@ PARALLEL_MAKEINST = ""
27do_configure_prepend() { 27do_configure_prepend() {
28 install -m 0644 ${S}/arch/${ARCH}/configs/${KERNEL_DEFCONFIG} ${WORKDIR}/defconfig || die "No default configuration for ${MACHINE} / ${KERNEL_DEFCONFIG} available." 28 install -m 0644 ${S}/arch/${ARCH}/configs/${KERNEL_DEFCONFIG} ${WORKDIR}/defconfig || die "No default configuration for ${MACHINE} / ${KERNEL_DEFCONFIG} available."
29} 29}
30
31do_install_prepend() {
32 install -d ${D}/lib/firmware
33}