Skip to content

Commit

Permalink
Merge pull request agherzan#1 from Minipada/cm3-64-synced
Browse files Browse the repository at this point in the history
Cm3 64 synced
  • Loading branch information
thiagodefreitas committed Oct 17, 2017
2 parents 1e1b50c + f3cd2eb commit ce322be
Show file tree
Hide file tree
Showing 48 changed files with 538 additions and 359 deletions.
29 changes: 0 additions & 29 deletions classes/linux-raspberrypi-base.bbclass

This file was deleted.

48 changes: 26 additions & 22 deletions classes/sdcard_image-rpi.bbclass
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
inherit image_types
inherit linux-raspberrypi-base

#
# Create an image that can by written onto a SD card using dd.
Expand Down Expand Up @@ -36,6 +35,7 @@ KERNEL_INITRAMFS ?= ""
SDIMG_KERNELIMAGE_raspberrypi ?= "kernel.img"
SDIMG_KERNELIMAGE_raspberrypi2 ?= "kernel7.img"
SDIMG_KERNELIMAGE_raspberrypi3-64 ?= "kernel8.img"
SDIMG_KERNELIMAGE_raspberrypi-cm3-64 ?= "kernel8.img"

# Boot partition volume id
BOOTDD_VOLUME_ID ?= "${MACHINE}"
Expand All @@ -48,15 +48,15 @@ IMAGE_ROOTFS_ALIGNMENT = "4096"

# Use an uncompressed ext3 by default as rootfs
SDIMG_ROOTFS_TYPE ?= "ext3"
SDIMG_ROOTFS = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.${SDIMG_ROOTFS_TYPE}"
SDIMG_ROOTFS = "${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${SDIMG_ROOTFS_TYPE}"

do_image_rpi_sdimg[depends] = " \
parted-native:do_populate_sysroot \
mtools-native:do_populate_sysroot \
dosfstools-native:do_populate_sysroot \
virtual/kernel:do_deploy \
${IMAGE_BOOTLOADER}:do_deploy \
${@bb.utils.contains('KERNEL_IMAGETYPE', 'uImage', 'u-boot:do_deploy', '',d)} \
${@bb.utils.contains('RPI_USE_U_BOOT', '1', 'u-boot:do_deploy', '',d)} \
"

# SD card image name
Expand All @@ -73,9 +73,20 @@ SDIMG = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.rpi-sdimg"
FATPAYLOAD ?= ""

# SD card vfat partition image name
SDIMG_VFAT = "${IMGDEPLOYDIR}/${IMAGE_NAME}.vfat"
SDIMG_VFAT = "${IMAGE_NAME}.vfat"
SDIMG_LINK_VFAT = "${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.vfat"

def split_overlays(d, out, ver=None):
dts = d.getVar("KERNEL_DEVICETREE")
if out:
overlays = oe.utils.str_filter_out('\S+\-overlay\.dtb$', dts, d)
overlays = oe.utils.str_filter_out('\S+\.dtbo$', overlays, d)
else:
overlays = oe.utils.str_filter('\S+\-overlay\.dtb$', dts, d) + \
" " + oe.utils.str_filter('\S+\.dtbo$', dts, d)

return overlays

IMAGE_CMD_rpi-sdimg () {

# Align partitions
Expand All @@ -86,7 +97,7 @@ IMAGE_CMD_rpi-sdimg () {
echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $ROOTFS_SIZE KiB"

# Check if we are building with device tree support
DTS="${@get_dts(d)}"
DTS="${KERNEL_DEVICETREE}"

# Initialize sdcard image file
dd if=/dev/zero of=${SDIMG} bs=1024 count=0 seek=${SDIMG_SIZE}
Expand Down Expand Up @@ -126,16 +137,13 @@ IMAGE_CMD_rpi-sdimg () {
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.${DTB_EXT} ::overlays/${DTB_BASE_NAME}.${DTB_EXT}
done
fi
case "${KERNEL_IMAGETYPE}" in
"uImage")
if [ "${RPI_USE_U_BOOT}" = "1" ]; then
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/u-boot.bin ::${SDIMG_KERNELIMAGE}
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::uImage
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::${KERNEL_IMAGETYPE}
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/boot.scr ::boot.scr
;;
*)
else
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::${SDIMG_KERNELIMAGE}
;;
esac
fi

if [ -n ${FATPAYLOAD} ] ; then
echo "Copying payload into VFAT"
Expand All @@ -150,23 +158,19 @@ IMAGE_CMD_rpi-sdimg () {
mcopy -i ${WORKDIR}/boot.img -v ${WORKDIR}/image-version-info ::

# Deploy vfat partition (for u-boot case only)
case "${KERNEL_IMAGETYPE}" in
"uImage")
cp ${WORKDIR}/boot.img ${SDIMG_VFAT}
if [ "${RPI_USE_U_BOOT}" = "1" ]; then
cp ${WORKDIR}/boot.img ${IMGDEPLOYDIR}/${SDIMG_VFAT}
ln -sf ${SDIMG_VFAT} ${SDIMG_LINK_VFAT}
;;
*)
;;
esac
fi

# Burn Partitions
dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024)
# If SDIMG_ROOTFS_TYPE is a .xz file use xzcat
if echo "${SDIMG_ROOTFS_TYPE}" | egrep -q "*\.xz"
then
xzcat ${SDIMG_ROOTFS} | dd of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
xzcat ${SDIMG_ROOTFS} | dd of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024)
else
dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024)
fi

# Optionally apply compression
Expand Down
9 changes: 9 additions & 0 deletions conf/layer.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ BBFILE_PRIORITY_raspberrypi = "9"
# Additional license directories.
LICENSE_PATH += "${LAYERDIR}/files/custom-licenses"

# The dynamic-layers directory hosts the extensions and layer specific
# modifications.
#
# The .bbappend and .bb files are included if the respective layer
# collection is available.
BBFILES += "${@' '.join('${LAYERDIR}/dynamic-layers/%s/recipes*/*/*.bbappend' % layer \
for layer in BBFILE_COLLECTIONS.split())}"
BBFILES += "${@' '.join('${LAYERDIR}/dynamic-layers/%s/recipes*/*/*.bb' % layer \
for layer in BBFILE_COLLECTIONS.split())}"
22 changes: 18 additions & 4 deletions conf/machine/include/rpi-base.inc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,17 @@ KERNEL_DEVICETREE ?= " \
overlays/pi3-miniuart-bt.dtbo \
overlays/vc4-kms-v3d.dtbo \
"
KERNEL_IMAGETYPE ?= "Image"

# By default:
#
# * When u-boot is disabled use the "Image" format which can be directly loaded
# by the rpi firmware.
#
# * When u-boot is enabled use the "uImage" format and the "bootm" command
# within u-boot to load the kernel.
KERNEL_BOOTCMD ??= "bootm"
KERNEL_IMAGETYPE_UBOOT ??= "uImage"
KERNEL_IMAGETYPE ?= "${@bb.utils.contains('RPI_USE_U_BOOT', '1', '${KERNEL_IMAGETYPE_UBOOT}', 'Image', d)}"

MACHINE_FEATURES += "apm usbhost keyboard vfat ext2 screen touchscreen alsa bluetooth wifi sdio"

Expand Down Expand Up @@ -83,10 +93,14 @@ def make_dtb_boot_files(d):

IMAGE_BOOT_FILES ?= "bcm2835-bootfiles/* \
${@make_dtb_boot_files(d)} \
${@bb.utils.contains('KERNEL_IMAGETYPE', 'uImage', '${KERNEL_IMAGETYPE}', '${KERNEL_IMAGETYPE};${SDIMG_KERNELIMAGE}', d)} \
${@bb.utils.contains('KERNEL_IMAGETYPE', 'uImage', 'u-boot.bin;${SDIMG_KERNELIMAGE}', '', d)} \
${@bb.utils.contains('KERNEL_IMAGETYPE', 'uImage', 'boot.scr;boot.scr', '', d)} \
${@bb.utils.contains('RPI_USE_U_BOOT', '1', \
'${KERNEL_IMAGETYPE} u-boot.bin;${SDIMG_KERNELIMAGE} boot.scr', \
'${KERNEL_IMAGETYPE};${SDIMG_KERNELIMAGE}', d)} \
"
do_image_wic[depends] += " \
bcm2835-bootfiles:do_deploy \
${@bb.utils.contains('RPI_USE_U_BOOT', '1', 'u-boot:do_deploy', '',d)} \
"

# The kernel image is installed into the FAT32 boot partition and does not need
# to also be installed into the rootfs.
Expand Down
41 changes: 41 additions & 0 deletions conf/machine/raspberrypi-cm3-64.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#@TYPE: Machine
#@NAME: RaspberryPi 3 Development Board
#@DESCRIPTION: Machine configuration for the RaspberryPi 3 in 64 bits mode

MACHINEOVERRIDES = "raspberrypi2:${MACHINE}"

MACHINE_EXTRA_RRECOMMENDS += "linux-firmware-bcm43430"

require conf/machine/include/arm/arch-armv8.inc
include conf/machine/include/rpi-base.inc

KERNEL_DEVICETREE = " \
broadcom/bcm2837-rpi-cm3.dtb \
\
overlays/hifiberry-amp.dtbo \
overlays/hifiberry-dac.dtbo \
overlays/hifiberry-dacplus.dtbo \
overlays/hifiberry-digi.dtbo \
overlays/i2c-rtc.dtbo \
overlays/iqaudio-dac.dtbo \
overlays/iqaudio-dacplus.dtbo \
overlays/lirc-rpi.dtbo \
overlays/pitft22.dtbo \
overlays/pitft28-resistive.dtbo \
overlays/pitft35-resistive.dtbo \
overlays/pps-gpio.dtbo \
overlays/rpi-ft5406.dtbo \
overlays/w1-gpio.dtbo \
overlays/w1-gpio-pullup.dtbo \
overlays/pi3-disable-bt.dtbo \
overlays/pi3-miniuart-bt.dtbo \
overlays/vc4-kms-v3d.dtbo \
overlays/vc4-fkms-v3d.dtbo \
"

SERIAL_CONSOLE ?= "115200 ttyS0"
#VC4_CMA_SIZE ?= "cma-256"

UBOOT_MACHINE = "rpi_3_config"
#MACHINE_FEATURES_append = " vc4graphics"
KERNEL_DEFCONFIG ?= "bcmrpi3_defconfig"
6 changes: 6 additions & 0 deletions conf/machine/raspberrypi3-64.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ KERNEL_DEVICETREE = " \
overlays/pi3-disable-bt.dtbo \
overlays/pi3-miniuart-bt.dtbo \
overlays/vc4-kms-v3d.dtbo \
overlays/vc4-fkms-v3d.dtbo \
"

SERIAL_CONSOLE ?= "115200 ttyS0"
VC4_CMA_SIZE ?= "cma-256"

UBOOT_MACHINE = "rpi_3_config"
MACHINE_FEATURES_append = " vc4graphics"

# When u-boot is enabled we need to use the "Image" format and the "booti"
# command to load the kernel
KERNEL_IMAGETYPE_UBOOT ?= "Image"
KERNEL_BOOTCMD ?= "booti"
14 changes: 11 additions & 3 deletions docs/extra-build-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,22 @@ this variable in local.conf:

ENABLE_KGDB = "1"

## Disable rpi boot logo

To disable rpi boot logo, set this variable in local.conf:

DISABLE_RPI_BOOT_LOGO = "1"

## Boot to U-Boot

To have u-boot load kernel image, set in your local.conf:

KERNEL_IMAGETYPE = "uImage"
RPI_USE_U_BOOT = "1"

This will make kernel.img be u-boot image which will load uImage. By default,
kernel.img is the actual kernel image (ex. Image).
This will select the appropriate image format for use with u-boot automatically.
For further customisation the KERNEL_IMAGETYPE and KERNEL_BOOTCMD variables can
be overridden to select the exact kernel image type (eg. zImage) and u-boot
command (eg. bootz) to be used.

## Image with Initramfs

Expand Down
2 changes: 1 addition & 1 deletion recipes-bsp/bootfiles/bcm2835-bootfiles.bb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include recipes-bsp/common/firmware.inc

RDEPENDS_${PN} = "rpi-config"

COMPATIBLE_MACHINE = "raspberrypi"
COMPATIBLE_MACHINE = "^rpi$"

S = "${RPIFW_S}/boot"

Expand Down
13 changes: 10 additions & 3 deletions recipes-bsp/bootfiles/rpi-config_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DESCRIPTION = "Commented config.txt file for the Raspberry Pi. \
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"

COMPATIBLE_MACHINE = "raspberrypi"
COMPATIBLE_MACHINE = "^rpi$"

SRCREV = "648ffc470824c43eb0d16c485f4c24816b32cd6f"
SRC_URI = "git://github.com/Evilpaul/RPi-config.git;protocol=git;branch=master \
Expand All @@ -21,7 +21,8 @@ PITFT28r="${@bb.utils.contains("MACHINE_FEATURES", "pitft28r", "1", "0", d)}"
PITFT35r="${@bb.utils.contains("MACHINE_FEATURES", "pitft35r", "1", "0", d)}"

VC4GRAPHICS="${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "1", "0", d)}"

VC4DTBO_raspberrypi3-64 = "vc4-fkms-v3d"
VC4DTBO ?= "vc4-kms-v3d"
inherit deploy

do_deploy() {
Expand Down Expand Up @@ -114,7 +115,7 @@ do_deploy() {
# VC4 Graphics support
if [ "${VC4GRAPHICS}" = "1" ]; then
echo "# Enable VC4 Graphics" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
echo "dtoverlay=vc4-kms-v3d,${VC4_CMA_SIZE}" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
echo "dtoverlay=${VC4DTBO},${VC4_CMA_SIZE}" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
fi

# Waveshare "C" 1024x600 7" Rev2.1 IPS capacitive touch (http://www.waveshare.com/7inch-HDMI-LCD-C.htm)
Expand All @@ -129,6 +130,12 @@ do_deploy() {
}

do_deploy_append_raspberrypi3-64() {
echo "# have a properly sized image" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
echo "disable_overscan=1" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt

echo "# Enable audio (loads snd_bcm2835)" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
echo "dtparam=audio=on" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt

# Device Tree support
echo "# Load correct Device Tree for Aarch64" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
echo "device_tree=bcm2710-rpi-3-b.dtb" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
Expand Down
6 changes: 3 additions & 3 deletions recipes-bsp/common/firmware.inc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
RPIFW_DATE ?= "20170405"
RPIFW_DATE ?= "20170811"
RPIFW_SRC_URI ?= "https://github.com/raspberrypi/firmware/archive/1.${RPIFW_DATE}.tar.gz"
RPIFW_S ?= "${WORKDIR}/firmware-1.${RPIFW_DATE}"

SRC_URI = "${RPIFW_SRC_URI}"
SRC_URI[md5sum] = "ea82d14a7cd8cfae9b78e00d4e56bc71"
SRC_URI[sha256sum] = "2f4e5bddbac1372590db203002c35cbba3fb9d6172a93c314ee27bf05ae13bff"
SRC_URI[md5sum] = "afd09f9a6df14e32b6d832fd9f51d087"
SRC_URI[sha256sum] = "a25f6281d64732892a2e838cc2346f1a88505b5c77a57a6540755362ea64043a"

PV = "${RPIFW_DATE}"

3 changes: 0 additions & 3 deletions recipes-bsp/rpi-u-boot-scr/files/boot.cmd

This file was deleted.

3 changes: 3 additions & 0 deletions recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs
fatload mmc 0:1 ${kernel_addr_r} @@KERNEL_IMAGETYPE@@
@@KERNEL_BOOTCMD@@ ${kernel_addr_r} - ${fdt_addr}
7 changes: 5 additions & 2 deletions recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bb
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
SUMMARY = "U-boot boot scripts for Raspberry Pi"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
COMPATIBLE_MACHINE = "rpi"
COMPATIBLE_MACHINE = "^rpi$"

DEPENDS = "u-boot-mkimage-native"

SRC_URI = "file://boot.cmd"
SRC_URI = "file://boot.cmd.in"

do_compile() {
sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \
-e 's/@@KERNEL_BOOTCMD@@/${KERNEL_BOOTCMD}/' \
"${WORKDIR}/boot.cmd.in" > "${WORKDIR}/boot.cmd"
mkimage -A arm -T script -C none -n "Boot script" -d "${WORKDIR}/boot.cmd" boot.scr
}

Expand Down
Loading

0 comments on commit ce322be

Please sign in to comment.