diff --git a/.gitignore b/.gitignore index a89a4ff..d44aa20 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,4 @@ build/downloads/ build/sstate-cache/ build/tmp/ build/bitbake-cookerdaemon.log -images/ +imgs diff --git a/build-pitrezor.sh b/build-pitrezor.sh index 665a84a..64372a8 100755 --- a/build-pitrezor.sh +++ b/build-pitrezor.sh @@ -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 - diff --git a/build/conf/local.conf b/build/conf/local.conf index f81d6d2..231137a 100644 --- a/build/conf/local.conf +++ b/build/conf/local.conf @@ -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 = "" @@ -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 \ diff --git a/meta-pitrezor/recipes-core/images/pitrezor-image.bb b/meta-pitrezor/recipes-core/images/pitrezor-image.bb index b4d132a..8b54a8f 100644 --- a/meta-pitrezor/recipes-core/images/pitrezor-image.bb +++ b/meta-pitrezor/recipes-core/images/pitrezor-image.bb @@ -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() { diff --git a/meta-pitrezor/recipes-core/pitrezor/pitrezor_git.bb b/meta-pitrezor/recipes-core/pitrezor/pitrezor_git.bb index 15dd26b..a7b88fc 100644 --- a/meta-pitrezor/recipes-core/pitrezor/pitrezor_git.bb +++ b/meta-pitrezor/recipes-core/pitrezor/pitrezor_git.bb @@ -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 @@ -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" diff --git a/meta-pitrezor/recipes-devtools/bcm2835/bcm2835_%.bbappend b/meta-pitrezor/recipes-devtools/bcm2835/bcm2835_%.bbappend deleted file mode 100644 index 6f6bc4d..0000000 --- a/meta-pitrezor/recipes-devtools/bcm2835/bcm2835_%.bbappend +++ /dev/null @@ -1,2 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" -SRC_URI += "file://fix_i2c_core_clock.patch" diff --git a/meta-pitrezor/recipes-devtools/bcm2835/bcm2835_1.68.bb b/meta-pitrezor/recipes-devtools/bcm2835/bcm2835_1.68.bb new file mode 100644 index 0000000..4f69028 --- /dev/null +++ b/meta-pitrezor/recipes-devtools/bcm2835/bcm2835_1.68.bb @@ -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 (mikem@open.com.au)" + +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} = "" diff --git a/meta-pitrezor/recipes-devtools/bcm2835/files/fix_i2c_core_clock.patch b/meta-pitrezor/recipes-devtools/bcm2835/files/fix_i2c_core_clock.patch index 8cd2907..c3eac95 100644 --- a/meta-pitrezor/recipes-devtools/bcm2835/files/fix_i2c_core_clock.patch +++ b/meta-pitrezor/recipes-devtools/bcm2835/files/fix_i2c_core_clock.patch @@ -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" diff --git a/meta-pitrezor/recipes-devtools/qemu/qemu_%.bbappend b/meta-pitrezor/recipes-devtools/qemu/qemu_%.bbappend new file mode 100644 index 0000000..f58517e --- /dev/null +++ b/meta-pitrezor/recipes-devtools/qemu/qemu_%.bbappend @@ -0,0 +1 @@ +PACKAGECONFIG_remove = "sdl" diff --git a/meta-pitrezor/recipes-graphics/libsdl2/libsdl2_%.bbappend b/meta-pitrezor/recipes-graphics/libsdl2/libsdl2_%.bbappend index c4b17f3..2ef06ea 100644 --- a/meta-pitrezor/recipes-graphics/libsdl2/libsdl2_%.bbappend +++ b/meta-pitrezor/recipes-graphics/libsdl2/libsdl2_%.bbappend @@ -1,3 +1,5 @@ -DEPENDS = "virtual/egl" -PACKAGECONFIG = "gles2" +PACKAGECONFIG = "kmsdrm gles2" +EXTRA_OECONF_append = " --disable-video-rpi " +DEPENDS += "udev" +BBCLASSEXTEND=""