Skip to content

Commit

Permalink
Adapted platform for trezor 1.7.1 (webusb)
Browse files Browse the repository at this point in the history
  • Loading branch information
heneault committed Nov 18, 2018
1 parent 711e253 commit 0f10a16
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 26 deletions.
5 changes: 3 additions & 2 deletions build/conf/local.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ SYSVINIT_ENABLED_GETTYS = ""
KERNEL_DEVICETREE_append = " overlays/dwc2.dtbo "
GPU_MEM = "64"
CMDLINE = "dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait consoleblank=0 ro quiet "
KERNEL_MODULE_AUTOLOAD += " usb_f_hid dwc2 "
KERNEL_MODULE_AUTOLOAD += " gadgetfs dwc2 "
EXTRA_IMAGECMD_ext3 = "-i 4096 -L fs"
FATPAYLOAD += " ${datadir}/pitrezor/pitrezor.config"
TOOLCHAIN_TARGET_TASK += "bcm2835-staticdev"
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 "

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

# Include modules in rootfs
IMAGE_INSTALL += " \
kernel-module-usb-f-hid \
kernel-module-gadgetfs \
kernel-module-dwc2 \
"
IMAGE_INSTALL += " pitrezor "
Expand All @@ -28,6 +28,9 @@ customize_image() {
echo "tz:5:respawn:/usr/bin/start_pitrezor" >> ${IMAGE_ROOTFS}/etc/inittab

echo "LABEL=boot /boot vfat defaults 0 0" >> ${IMAGE_ROOTFS}/etc/fstab

echo "mkdir /dev/gadget && mount -t gadgetfs none /dev/gadget" >> ${IMAGE_ROOTFS}/etc/rcS.d/S10mountgadget
chmod a+x ${IMAGE_ROOTFS}/etc/rcS.d/S10mountgadget
}

ROOTFS_POSTPROCESS_COMMAND_append = " customize_image; "
4 changes: 2 additions & 2 deletions meta-pitrezor/recipes-core/pitrezor/files/start_pitrezor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

source /boot/pitrezor.config

cd /boot
dos2unix -n pitrezor.config /var/volatile/pitrezor.config
source /var/volatile/pitrezor.config
TREZOR_OLED_FULLSCREEN=1 /usr/bin/pitrezor
6 changes: 3 additions & 3 deletions meta-pitrezor/recipes-core/pitrezor/pitrezor_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ SUMMARY = "Pitrezor application"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=e6a600fd5e1d9cbde2d983680233ad02"

DEPENDS = "libsdl2 libusbgx bcm2835 protobuf-native python3-protobuf-native python3-six-native dos2unix-native"
RDEPENDS_${PN} = "rng-tools"
DEPENDS = "libsdl2 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"

inherit pkgconfig python3native

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

SRCREV = "fca6824df2faf004f168c7db5b1b7c2ed95a244f"
SRCREV = "58035f00a81b4b1388c2c9f69acdccedd362d413"

S = "${WORKDIR}/git"

Expand Down
13 changes: 13 additions & 0 deletions meta-pitrezor/recipes-devtools/python/python3-munch_2.3.2.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
SUMMARY = "A dot-accessible dictionary (a la JavaScript objects)."

HOMEPAGE = "https://github.com/Infinidat/munch"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=f0291cd32b2d6a91d9b19970c94d0a46"

SRC_URI[md5sum] = "539311fdfc6419381b6f38d0695f01ee"
SRC_URI[sha256sum] = "6ae3d26b837feacf732fb8aa5b842130da1daf221f5af9f9d4b2a0a6414b0d51"

BBCLASSEXTEND = "native nativesdk"

inherit pypi setuptools3

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BBCLASSEXTEND = "native nativesdk"
18 changes: 18 additions & 0 deletions meta-pitrezor/recipes-devtools/python/python3-trezor_git.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
SUMMARY = "Client side implementation for TREZOR-compatible Bitcoin hardware wallets."

HOMEPAGE = "https://github.com/trezor/python-trezor"
LICENSE = "LGPLv3"
LIC_FILES_CHKSUM = "file://COPYING;md5=e6a600fd5e1d9cbde2d983680233ad02"

SRC_URI = "gitsm://github.com/trezor/python-trezor.git"
SRCREV = "252f946f409fc87d6b9f462682ef36219b96ece3"
S="${WORKDIR}/git"

SRC_URI[md5sum] = ""
SRC_URI[sha256sum] = ""

BBCLASSEXTEND = "native nativesdk"

inherit setuptools3

DEPENDS += " protobuf-native python3-protobuf-native python3-six-native "
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--- git/drivers/usb/gadget/legacy/inode.c 2018-11-10 17:41:56.027719759 -0500
+++ git.new/drivers/usb/gadget/legacy/inode.c 2018-11-10 18:00:17.401165612 -0500
@@ -1284,7 +1284,7 @@

qual.bLength = sizeof qual;
qual.bDescriptorType = USB_DT_DEVICE_QUALIFIER;
- qual.bcdUSB = cpu_to_le16 (0x0200);
+ qual.bcdUSB = desc->bcdUSB;

desc = dev->dev;
qual.bDeviceClass = desc->bDeviceClass;
@@ -1393,11 +1393,8 @@
if (value >= 0)
value = min (w_length, (u16) value);
break;
- case USB_DT_STRING:
+ default:
goto unrecognized;
-
- default: // all others are errors
- break;
}
break;

@@ -1856,7 +1853,6 @@
|| dev->dev->bNumConfigurations != 1)
goto fail;
dev->dev->bNumConfigurations = 1;
- dev->dev->bcdUSB = cpu_to_le16 (0x0200);

/* triggers gadgetfs_bind(); then we can enumerate. */
spin_unlock_irq (&dev->lock);
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://usb_inode.patch"
18 changes: 0 additions & 18 deletions meta-pitrezor/recipes-support/libusbgx/libusbgx_git.bb

This file was deleted.

0 comments on commit 0f10a16

Please sign in to comment.