Skip to content

Commit

Permalink
modification to support pi 4
Browse files Browse the repository at this point in the history
  • Loading branch information
heneault committed Mar 28, 2021
1 parent 4c9a409 commit 464ac0e
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ build/downloads/
build/sstate-cache/
build/tmp/
build/bitbake-cookerdaemon.log
images/
imgs
15 changes: 8 additions & 7 deletions build-pitrezor.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
#!/bin/bash
set -e

IMAGE=pitrezor-build
TAG=${1:-master}
IMGFILE=images/pitrezor-$TAG.img
MACHINE=${2:-raspberrypi0-wifi} # raspberrypi0-wifi (default) or raspberrypi4
IMAGE=pitrezor-build
IMGFILE=imgs/pitrezor-$MACHINE-$TAG.img
DOCKER_UID=30000

mkdir -p images
chown $DOCKER_UID:$DOCKER_UID images
mkdir -p imgs
chown $DOCKER_UID:$DOCKER_UID imgs

docker build -t $IMAGE .

docker run -t --rm -v $(pwd)/images:/images:z $IMAGE /bin/bash -c "\
docker run -t --rm -v $(pwd)/imgs:/imgs:z $IMAGE /bin/bash -c "\
git clone https://github.com/heneault/yocto-pitrezor.git && \
cd yocto-pitrezor && \
git checkout $TAG && \
git submodule update --init --recursive && \
sed -i -e "s/^MACHINE.*/MACHINE ??= \"${MACHINE}\"/" conf/local.conf
. poky/oe-init-build-env build && \
bitbake pitrezor-image && \
cp tmp/deploy/images/raspberrypi0-wifi/pitrezor-image-raspberrypi0-wifi.rpi-sdimg /$IMGFILE"
cp tmp/deploy/images/$MACHINE/pitrezor-image-$MACHINE.rpi-sdimg /$IMGFILE"

zip -m -j -9 ${IMGFILE%.img}.zip $IMGFILE

7 changes: 4 additions & 3 deletions build/conf/local.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PACKAGE_CLASSES ?= "package_rpm"
EXTRA_IMAGE_FEATURES += "read-only-rootfs"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
DISTRO_FEATURES_remove = " acl alsa argp bluetooth irda largefile opengl pcmcia usbgadget usbhost xattr nfs zeroconf pci 3g nfc x11 wayland pulseaudio "
DISTRO_FEATURES_remove = " acl alsa argp bluetooth irda largefile pcmcia usbgadget usbhost xattr nfs zeroconf pci 3g nfc x11 wayland pulseaudio "
IMAGE_FSTYPES = "rpi-sdimg"
VIRTUAL-RUNTIME_init_manager = "sysvinit"
VIRTUAL-RUNTIME_dev_manager = ""
Expand All @@ -15,13 +15,14 @@ SERIAL_CONSOLES_CHECK_forcevariable = ""
SYSVINIT_ENABLED_GETTYS = ""
ENABLE_DWC2_PERIPHERAL = "1"
GPU_MEM = "64"
DISABLE_VC4GRAPHICS = "1"
VC4DTBO = "vc4-fkms-v3d"
CMDLINE = "dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait consoleblank=0 ro quiet "
KERNEL_MODULE_AUTOLOAD += " gadgetfs dwc2 "
KERNEL_MODULE_AUTOLOAD += " gadgetfs dwc2 vc4 v3d "
EXTRA_IMAGECMD_ext3 = "-i 4096 -L fs"
FATPAYLOAD += " ${datadir}/pitrezor/pitrezor.config"
TOOLCHAIN_TARGET_TASK += " bcm2835-staticdev "
TOOLCHAIN_HOST_TASK_append += " nativesdk-protobuf-compiler nativesdk-python3-protobuf nativesdk-python3-setuptools nativesdk-python3 nativesdk-python3-click nativesdk-python3-trezor nativesdk-python3-mako nativesdk-python3-munch "
RPI_EXTRA_CONFIG = "hdmi_safe=1"

BB_DISKMON_DIRS = "\
STOPTASKS,${TMPDIR},1G,100K \
Expand Down
4 changes: 4 additions & 0 deletions meta-pitrezor/recipes-core/images/pitrezor-image.bb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ include recipes-core/images/core-image-minimal.bb
IMAGE_INSTALL += " \
kernel-module-gadgetfs \
kernel-module-dwc2 \
kernel-module-vc4 \
"

IMAGE_INSTALL_append_raspberrypi4 = " kernel-module-v3d libudev "

IMAGE_INSTALL += " pitrezor "

customize_image() {
Expand Down
4 changes: 2 additions & 2 deletions meta-pitrezor/recipes-core/pitrezor/pitrezor_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://legacy/COPYING;md5=e6a600fd5e1d9cbde2d983680233ad02"

DEPENDS = "libsdl2 libsdl2-image bcm2835 protobuf-native python3-protobuf-native python3-six-native python3-click-native python3-trezor-native dos2unix-native python3-mako-native python3-munch-native libconfig"
RDEPENDS_${PN} = "rng-tools dos2unix"
RDEPENDS_${PN} = "rng-tools dos2unix libegl-mesa libgles2-mesa mesa-megadriver libgbm libdrm"

inherit pkgconfig python3native

Expand All @@ -13,7 +13,7 @@ SRC_URI = "git://github.com/heneault/trezor-firmware.git;branch=pitrezor \
file://pitrezor.config \
"

SRCREV = "4671d69e275ae35a62482c0711dc153a5b4ad442"
SRCREV = "18fc2a04fe616c8fd1c648de9f7d023110832e00"

S = "${WORKDIR}/git"

Expand Down
2 changes: 0 additions & 2 deletions meta-pitrezor/recipes-devtools/bcm2835/bcm2835_%.bbappend

This file was deleted.

24 changes: 24 additions & 0 deletions meta-pitrezor/recipes-devtools/bcm2835/bcm2835_1.68.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
DESCRIPTION = "Package that provides access to GPIO and other IO\
functions on the Broadcom BCM 2835 chip, allowing access to the\
GPIO pins on the 26 pin IDE plug on the RPi board"
SECTION = "base"
HOMEPAGE = "http://www.open.com.au/mikem/bcm2835"
AUTHOR = "Mike McCauley ([email protected])"

LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=e49f4652534af377a713df3d9dec60cb"

COMPATIBLE_MACHINE = "^rpi$"

SRC_URI = "http://www.airspayce.com/mikem/bcm2835/bcm2835-${PV}.tar.gz \
file://fix_i2c_core_clock.patch \
"

SRC_URI[md5sum] = "96ee0c2b078a77bfe4aa749fd056157a"
SRC_URI[sha256sum] = "b7eda59fd7bc3cb97fdac14e8455e86ddad75006d69270358ac8d00108e369a9"

inherit autotools

RDEPENDS_${PN}-dev = ""

FILES_${PN} = ""
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
diff -Nur bcm2835-1.52.orig/src/bcm2835.h bcm2835-1.52/src/bcm2835.h
--- bcm2835-1.52.orig/src/bcm2835.h 2017-03-01 20:17:16.000000000 -0500
+++ bcm2835-1.52/src/bcm2835.h 2018-01-24 14:15:00.055739461 -0500
@@ -503,7 +503,7 @@
#define LOW 0x0
diff --git a/src/bcm2835.h b/src/bcm2835.h
index 7d3e3b9..4a7c218 100644
--- a/src/bcm2835.h
+++ b/src/bcm2835.h
@@ -637,7 +637,7 @@
#endif

/*! Speed of the core clock core_clk */
-#define BCM2835_CORE_CLK_HZ 250000000 /*!< 250 MHz */
+#define BCM2835_CORE_CLK_HZ 150000000 /*!< 150 MHz */

/*! On RPi2 with BCM2836, and all recent OSs, the base of the peripherals is read from a /proc file */
/*! On all recent OSs, the base of the peripherals is read from a /proc file */
#define BMC2835_RPI2_DT_FILENAME "/proc/device-tree/soc/ranges"
1 change: 1 addition & 0 deletions meta-pitrezor/recipes-devtools/qemu/qemu_%.bbappend
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PACKAGECONFIG_remove = "sdl"
6 changes: 4 additions & 2 deletions meta-pitrezor/recipes-graphics/libsdl2/libsdl2_%.bbappend
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
DEPENDS = "virtual/egl"
PACKAGECONFIG = "gles2"
PACKAGECONFIG = "kmsdrm gles2"
EXTRA_OECONF_append = " --disable-video-rpi "
DEPENDS += "udev"
BBCLASSEXTEND=""

0 comments on commit 464ac0e

Please sign in to comment.