├── .gitlab-ci.yml ├── LICENSE ├── README.md ├── kas-bsp-rt.yml ├── kas-bsp.yml ├── kas-example-rt.yml ├── kas-example-swupdate.yml ├── kas-example.yml ├── kas-sdk-linux-x64.yml ├── kas-sdk-windows-i586.yml ├── meta-iot2000-bsp ├── COPYING.GPLv2 ├── COPYING.MIT ├── conf │ ├── layer.conf │ └── machine │ │ ├── include │ │ └── intel-quark-common.inc │ │ └── iot2000.conf ├── recipes-bsp │ ├── acpi-upgrades │ │ ├── acpi-upgrades.bb │ │ └── tables │ │ │ └── iot2000 │ │ │ └── ssdt-fixes.asl │ └── formfactor │ │ ├── formfactor │ │ └── iot2000 │ │ │ └── machconfig │ │ └── formfactor_0.0.bbappend ├── recipes-core │ ├── ell │ │ └── ell_0.22.bb │ └── images │ │ ├── core-image-iot2000.inc │ │ ├── core-image-minimal.bbappend │ │ ├── core-image-rt.bb │ │ └── wic-image.inc ├── recipes-devtools │ ├── go │ │ ├── common │ │ │ └── go-wrapper │ │ ├── go-cross-iot2000.inc │ │ ├── go-cross_1.6%.bbappend │ │ ├── go-cross_1.6-dummy.bb │ │ ├── go-cross_1.8%.bbappend │ │ ├── go-cross_1.8-dummy.bb │ │ ├── patches-1.6 │ │ │ ├── 0001-runtime-Implement-i386-atomic-quadword-ops-alternati.patch │ │ │ ├── 0002-Revert-runtime-check-and-fail-early-with-a-message-i.patch │ │ │ └── 0003-cmd-internal-obj-x86-cmd-compile-internal-x86-Add-In.patch │ │ └── patches-1.8 │ │ │ ├── 0001-runtime-Implement-i386-atomic-quadword-ops-alternati.patch │ │ │ ├── 0002-Revert-runtime-check-and-fail-early-with-a-message-i.patch │ │ │ └── 0003-cmd-internal-obj-x86-cmd-compile-internal-x86-Add-In.patch │ └── nodejs │ │ ├── nodejs │ │ ├── 0001-Restore-x87-port.patch │ │ ├── 0002-Switch-to-x87-mode-when-targeting-ia32.patch │ │ ├── 0003-Relax-check-in-ComputeInputFrameSize.patch │ │ ├── 0004-py2to3-automatic-conversion-via-2to3-tool.patch │ │ ├── 0005-py2to3-fix-configure.patch │ │ ├── 0006-py2to3-fix-tools-gyp-pylib-gyp-input.py.patch │ │ ├── 0007-py2to3-fix-tools-configure.d-nodedownload.py.patch │ │ ├── 0008-py2to3-deps-v8-gypfiles-toolchain.gypi.patch │ │ ├── 0009-py2to3-fix-tools-gyp-pylib-gyp-generator-make.py.patch │ │ ├── 0010-py2to3-fix-tools-compress_json.py.patch │ │ ├── 0011-py2to3-fix-tools-js2c.py-deps-v8-tools-js2c.py.patch │ │ ├── 0012-py2to3-fix-deps-v8-tools-gen-postmortem-metadata.py.patch │ │ ├── 0013-py2to3-fix-async-keyword-error.patch │ │ ├── 0014-py2to3-fix-deps-v8-third_party-jinja2-runtime.py.patch │ │ ├── 0015-py2to3-fix-gyp-samples-samples.patch │ │ ├── 0016-py2to3-use-python3-for-node-gyp.patch │ │ ├── 0017-CVE-2019-15606.patch │ │ ├── 0018-CVE-2019-15604.patch │ │ ├── 0019-CVE-2019-15605.patch │ │ ├── 0020-CVE-2020-8174.patch │ │ ├── 0021-nghttp2_1.41.0.patch │ │ ├── 0022-CVE-2020-11080.patch │ │ ├── 0023-CVE-2020-8265.patch │ │ ├── 0024-CVE-2020-8287.patch │ │ ├── 0025-CVE-2021-22884.patch │ │ ├── 0026-CVE-2021-22883.patch │ │ ├── 0027-CVE-2021-22930.patch │ │ ├── 0028-CVE-2021-22939.patch │ │ ├── 0029-CVE-2021-44907.patch │ │ ├── 0030-CVE-2022-0235.patch │ │ ├── 0031-OpenSSL-1.1.1-support.patch │ │ └── 0032-Fix-build-with-openssl-1.1.1d.patch │ │ ├── nodejs_8%.bbappend │ │ └── nodejs_8-dummy.bb ├── recipes-extended │ └── stress │ │ ├── stress_%.bbappend │ │ └── stress_0-dummy.bb ├── recipes-kernel │ └── linux │ │ ├── configs │ │ ├── defconfig │ │ ├── iot2000-cip-rt.cfg │ │ ├── iot2000-cip-rt.scc │ │ ├── iot2000-mainline.cfg │ │ └── iot2000-mainline.scc │ │ ├── linux-cip-rt_4.4.bb │ │ ├── linux-cip_4.4.bb │ │ ├── linux-cip_4.4.inc │ │ ├── linux-mainline-latest.bb │ │ └── patches │ │ ├── 0001-stmmac-pci-Make-stmmac_pci_info-structure-constant.patch │ │ ├── 0002-stmmac-pci-Use-stmmac_pci_info-for-all-devices.patch │ │ ├── 0003-stmmac-pci-Make-stmmac_pci_find_phy_addr-truly-gener.patch │ │ ├── 0004-stmmac-pci-Select-quark_pci_dmi_data-from-quark_defa.patch │ │ ├── 0005-stmmac-pci-Use-dmi_system_id-table-for-retrieving-PH.patch │ │ ├── 0006-stmmac-pci-Adjust-IOT2000-matching.patch │ │ ├── 0007-serial-8250_exar-Adjust-IOT2000-matching.patch │ │ ├── 0008-mfd-intel_quark_i2c_gpio-Adjust-IOT2000-matching.patch │ │ ├── 0009-gpio-sch-use-gpiochip-data-pointer.patch │ │ ├── 0010-gpio-sch-Use-devm_gpiochip_add_data-for-gpio-registr.patch │ │ ├── 0011-gpio-sch-Fix-Oops-on-module-load-on-Asus-Eee-PC-1201.patch │ │ ├── 0012-gpio-sch-Implement-.get_direction.patch │ │ ├── 0013-gpio-sch-Add-interrupt-support.patch │ │ ├── 0014-iot2000-hack-Work-around-DSDT-mistake.patch │ │ ├── 0015-iot2000-hack-Adjust-pca9685-gpio-base-for-legacy-com.patch │ │ ├── 0016-iot2000-hack-gpio-pca953x-provide-GPIO-base-based-on.patch │ │ ├── 0017-iot2000-hack-gpio-pca953x-add-drive-property.patch │ │ ├── 0018-iot2000-hack-pwm-pca-9685-Provide-chip-level-pwm_per.patch │ │ ├── 0019-random-replace-non-blocking-pool-with-a-Chacha20-bas.patch │ │ ├── 0020-random-make-dev-urandom-scalable-for-silly-userspace.patch │ │ ├── 0021-random-add-backtracking-protection-to-the-CRNG.patch │ │ ├── 0022-random-remove-stale-maybe_reseed_primary_crng.patch │ │ ├── 0023-random-use-chacha20-for-get_random_int-long.patch │ │ ├── 0024-random-convert-get_random_int-long-into-get_random_u.patch │ │ ├── 0025-random-invalidate-batched-entropy-after-crng-init.patch │ │ ├── 0026-random-silence-compiler-warnings-and-fix-race.patch │ │ ├── 0027-random-add-wait_for_random_bytes-API.patch │ │ ├── 0028-random-fix-crng_ready-test.patch │ │ ├── 0029-random-use-a-different-mixing-algorithm-for-add_devi.patch │ │ ├── 0030-random-only-read-from-dev-random-after-its-pool-has-.patch │ │ ├── 0031-random-fix-soft-lockup-when-trying-to-read-from-an-u.patch │ │ ├── 0032-random-try-to-actively-add-entropy-rather-than-passi.patch │ │ ├── rt-0001-spi-pca2xx-pci-Allow-MSI.patch │ │ └── rt-0002-gpio-dwapb-Work-around-RT-full-s-enforced-IRQ-thread.patch ├── recipes-multimedia │ └── ffmpeg │ │ └── ffmpeg_%.bbappend ├── recipes-tools │ └── switchmode │ │ ├── files │ │ └── switchmode.c │ │ └── switchmode_0.1.bb └── scripts │ └── lib │ └── wic │ └── canned-wks │ ├── common.iot2000.wks.footer.inc │ ├── common.iot2000.wks.header.inc │ └── wic-image.iot2000.wks └── meta-iot2000-example ├── COPYING.GPLv2 ├── COPYING.MIT ├── README.SWUPDATE.md ├── classes └── npm-ng.bbclass ├── conf ├── distro │ └── poky-iot2000.conf └── layer.conf ├── recipes-connectivity ├── connman │ ├── connman_%.bbappend │ └── files │ │ ├── main.conf │ │ └── settings └── openssl │ ├── files │ └── 0001-make-bnrand_range-reliable-with-deterministic-run-ti.patch │ └── openssl_1.1.%.bbappend ├── recipes-core └── images │ ├── example-image-swu.inc │ ├── files │ └── sw-description │ ├── iot2000-example-image-rt.bb │ ├── iot2000-example-image-swu.bb │ ├── iot2000-example-image.bb │ ├── iot2000-example-image.inc │ ├── iot2000-update-image.bb │ └── persiststore.bb ├── recipes-devtools └── nodejs │ ├── nodejs │ └── 0001-Disable-running-gyp-files-for-bundled-deps.patch │ └── nodejs_8.17.0.bb ├── recipes-example ├── busybox │ ├── busybox_1.31.%.bbappend │ └── files │ │ ├── arp.cfg │ │ ├── lsusb.cfg │ │ ├── nc.cfg │ │ ├── no-ext-dhcp.cfg │ │ ├── ntp.conf │ │ ├── ntpclient.cfg │ │ └── ntpd.busybox ├── init-ifupdown │ ├── files │ │ └── interfaces │ └── init-ifupdown_%.bbappend ├── iot2000setup │ ├── files │ │ ├── expandfs.sh │ │ └── iot2000setup.py │ ├── iot2000setup_1.0.bb │ └── mosquitto_%.bbappend └── modules │ ├── files │ ├── i2c-dev.conf │ └── ofono-module.conf │ └── modules-load-entries_1.0.bb ├── recipes-extended └── mraa │ └── mraa_%.bbappend ├── recipes-galileo ├── galileo-target │ ├── files │ │ ├── galileo-sketch-reset.service │ │ ├── galileo-target.service │ │ ├── galileo-target │ │ │ ├── LICENSE │ │ │ ├── Makefile │ │ │ ├── Readme.txt │ │ │ ├── canit.c │ │ │ ├── clloader.c │ │ │ ├── clloader.h │ │ │ ├── config.h │ │ │ ├── crctab.c │ │ │ ├── galileo-reset │ │ │ │ ├── galileo-reset.c │ │ │ │ └── galileo-reset.h │ │ │ ├── long-options.c │ │ │ ├── long-options.h │ │ │ ├── lsyslog.c │ │ │ ├── protname.c │ │ │ ├── rbsb.c │ │ │ ├── scripts │ │ │ │ └── opt │ │ │ │ │ └── cln │ │ │ │ │ └── galileo │ │ │ │ │ ├── galileo_sketch_reset_script.sh │ │ │ │ │ └── sketch-setup.sh │ │ │ ├── tcp.c │ │ │ ├── timing.c │ │ │ ├── timing.h │ │ │ ├── xstrtol.c │ │ │ ├── xstrtol.h │ │ │ ├── xstrtoul.c │ │ │ ├── xstrtoul.h │ │ │ ├── zglobal.h │ │ │ ├── zm.c │ │ │ ├── zmodem.h │ │ │ ├── zperr.c │ │ │ └── zreadline.c │ │ ├── galileod.init │ │ ├── launcher.sh │ │ └── r1_2_sketch_reset.patch │ └── galileo-target_0.1.bb └── uclibc │ ├── site_config │ ├── funcs │ ├── headers │ └── types │ ├── uclibc-config.inc │ ├── uclibc-git.inc │ ├── uclibc-git │ ├── 0001-Disable-lrount_tes-function.patch │ ├── locale.cfg │ ├── obstack.cfg │ ├── uClibc.distro │ └── uClibc.machine │ ├── uclibc-package.inc │ ├── uclibc.inc │ ├── uclibc │ ├── 0001-dl-elf.c-never-look-in-shared-library-loader-for-lib.patch │ ├── 0002-Very-hacky-solution-for-arduino-eeprom-compatibility.patch │ ├── config.cfg │ ├── libgcc_s.so.1 │ └── libstdc++.so.6.0.21 │ ├── uclibc_git.bb │ └── uclibc_git.bbappend ├── recipes-kernel ├── acm-gadget │ ├── acm-gadget.bb │ └── files │ │ └── acm-gadget ├── galileo-spi1-spidev │ ├── files │ │ ├── COPYING │ │ ├── Makefile │ │ └── galileo-spi1-spidev.c │ └── galileo-spi1-spidev_0.1.bb ├── galileo-uio-gpio │ ├── files │ │ ├── COPYING │ │ ├── Makefile │ │ └── galileo-uio-gpio.c │ └── galileo-uio-gpio_0.1.bb ├── galileogen2-fake │ ├── files │ │ ├── COPYING │ │ ├── Makefile │ │ └── galileogen2-fake.c │ └── galileogen2-fake_0.1.bb └── linux │ ├── configs │ ├── iot2000-example.cfg │ └── iot2000-example.scc │ ├── linux-cip-rt_4.4.bbappend │ └── linux-cip_4.4.bbappend ├── recipes-node ├── mindconnect-node-red-contrib-mindconnect │ ├── files │ │ └── npm-shrinkwrap.json │ └── mindconnect-node-red-contrib-mindconnect_3.9.1.bb ├── node-red-contrib-boolean-logic │ ├── files │ │ └── npm-shrinkwrap.json │ └── node-red-contrib-boolean-logic_0.0.3.bb ├── node-red-contrib-modbus │ ├── files │ │ └── npm-shrinkwrap.json │ └── node-red-contrib-modbus_5.13.3.bb ├── node-red-contrib-opcua │ ├── files │ │ └── npm-shrinkwrap.json │ └── node-red-contrib-opcua_0.2.88.bb ├── node-red-dashboard │ ├── files │ │ └── npm-shrinkwrap.json │ └── node-red-dashboard_2.23.4.bb ├── node-red-node-intel-gpio │ ├── files │ │ ├── 0001-intel-gpio-HTML-cleanups.patch │ │ ├── 0002-intel-gpio-Consistently-use-this-where-available.patch │ │ ├── 0003-intel-gpio-Add-support-for-initial-message-from-digi.patch │ │ ├── 0004-intel-gpio-Use-isrExit-in-favor-of-isr-m.EDGE_BOTH-n.patch │ │ ├── 0005-intel-gpio-Add-polling-of-input-pins-in-absence-of-i.patch │ │ ├── 0006-intel-gpio-Respect-user-defined-name-for-output-pin-.patch │ │ ├── 0007-intel-gpio-Mark-output-pin-13-as-LED-on-Galileo-v2.patch │ │ ├── 0008-intel-gpio-Add-support-for-user-button-on-Galileo-v2.patch │ │ ├── 0009-intel-gpio-Add-IOT2020-and-IOT2040-board-detection.patch │ │ ├── 0010-intel-gpio-Add-support-for-red-LED-of-IOT2040.patch │ │ └── 0011-intel-gpio-Privatize-version.patch │ └── node-red-node-intel-gpio_1.0.0-iot2000.bb ├── node-red-node-serialport │ ├── files │ │ └── npm-shrinkwrap.json │ └── node-red-node-serialport_0.11.0.bb ├── node-red-nodes │ └── node-red-nodes.bb └── node-red │ ├── files │ ├── node-red.init │ └── npm-shrinkwrap.json │ └── node-red_1.2.1.bb ├── recipes-support └── swupdate │ ├── swupdate │ ├── defconfig │ ├── progress_firmware.c │ ├── swupdate.cfg │ ├── swupdate_handlers.lua │ └── tools_makefile.patch │ └── swupdate_%.bbappend ├── recipes-tools └── setledcolor │ ├── files │ └── setledcolor.py │ └── setledcolor_0.1.bb └── scripts ├── extract_license └── lib └── wic └── canned-wks ├── example-image.iot2000.swupdate.wks └── example-image.iot2000.wks /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | image: kasproject/kas:2.0 2 | 3 | variables: 4 | GIT_STRATEGY: clone 5 | 6 | .build: &build 7 | stage: build 8 | script: 9 | # define these proxy variables in your CI/CD settings as needed 10 | - export http_proxy=$HTTP_PROXY 11 | - export https_proxy=$HTTPS_PROXY 12 | - export ftp_proxy=$FTP_PROXY 13 | - export no_proxy=$NO_PROXY 14 | - cd .. 15 | - kas build meta-iot2000/$KAS_CONFIG 16 | 17 | .build-and-deploy-image: &build-and-deploy-image 18 | <<: *build 19 | after_script: 20 | - for IMAGE in $DEPLOY_IMAGES; do 21 | xz -c -T0 -9 ../build/tmp/deploy/images/iot2000/$IMAGE > $IMAGE.xz; 22 | done 23 | artifacts: 24 | name: "${CI_JOB_NAME}-${CI_COMMIT_SHA::12}" 25 | paths: 26 | - ./*.xz 27 | expire_in: 1 week 28 | 29 | .build-and-deploy-sdk: &build-and-deploy-sdk 30 | <<: *build 31 | after_script: 32 | - mv ../build/tmp/deploy/sdk/$DEPLOY_SDK . 33 | artifacts: 34 | name: "${CI_JOB_NAME}-${CI_COMMIT_SHA::12}" 35 | paths: 36 | - $DEPLOY_SDK 37 | expire_in: 1 week 38 | 39 | bsp-rt: 40 | <<: *build-and-deploy-image 41 | variables: 42 | KAS_CONFIG: kas-bsp-rt.yml 43 | DEPLOY_IMAGES: core-image-rt-iot2000.wic 44 | 45 | example-image: 46 | <<: *build-and-deploy-image 47 | variables: 48 | KAS_CONFIG: kas-example.yml 49 | DEPLOY_IMAGES: iot2000-example-image-iot2000.wic 50 | 51 | update-image: 52 | # <<: *build-and-deploy-image 53 | <<: *build 54 | variables: 55 | KAS_CONFIG: kas-example-swupdate.yml 56 | DEPLOY_IMAGES: iot2000-example-image-swu-iot2000.wic iot2000-update-image-iot2000.swu 57 | 58 | windows-sdk: 59 | # <<: *build-and-deploy-sdk 60 | <<: *build 61 | variables: 62 | KAS_CONFIG: kas-sdk-windows-i586.yml 63 | DEPLOY_SDK: poky-iot2000-glibc-i686-iot2000-example-image-i586-nlp-32-toolchain-2.2.2.tar.xz 64 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The meta-iot2000 layers are generally made available under the MIT license 2 | except for explicitly marked components, which are GPLv2. Please see 3 | 4 | meta-iot2000-*/COPYING.MIT 5 | meta-iot2000-*/COPYING.GPLv2 6 | 7 | as well as separate COPYING files of components. 8 | -------------------------------------------------------------------------------- /kas-bsp-rt.yml: -------------------------------------------------------------------------------- 1 | header: 2 | version: 2 3 | includes: 4 | - kas-bsp.yml 5 | 6 | target: core-image-rt 7 | 8 | local_conf_header: 9 | rt_kernel: | 10 | PREFERRED_PROVIDER_virtual/kernel = "linux-cip-rt" 11 | -------------------------------------------------------------------------------- /kas-bsp.yml: -------------------------------------------------------------------------------- 1 | header: 2 | version: 2 3 | 4 | machine: iot2000 5 | 6 | repos: 7 | meta-iot2000: 8 | layers: 9 | meta-iot2000-bsp: 10 | 11 | poky: 12 | url: https://git.yoctoproject.org/git/poky 13 | refspec: 1e298a42223dd2628288b372caf66c52506a8081 14 | layers: 15 | meta: 16 | meta-poky: 17 | meta-yocto-bsp: 18 | 19 | meta-efibootguard: 20 | url: https://github.com/siemens/meta-efibootguard 21 | refspec: e13f038bb362a6c086be50359f1bf31cf770e151 22 | 23 | meta-openembedded: 24 | url: https://git.openembedded.org/meta-openembedded 25 | refspec: deee226017877d51188e0a46f9e6b93c10ffbb34 26 | layers: 27 | meta-oe: 28 | 29 | bblayers_conf_header: 30 | standard: | 31 | POKY_BBLAYERS_CONF_VERSION = "2" 32 | BBPATH = "${TOPDIR}" 33 | BBFILES ?= "" 34 | 35 | local_conf_header: 36 | standard: | 37 | CONF_VERSION = "1" 38 | 39 | debug-tweaks: | 40 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 41 | 42 | diskmon: | 43 | BB_DISKMON_DIRS = "\ 44 | STOPTASKS,${TMPDIR},1G,100K \ 45 | STOPTASKS,${DL_DIR},1G,100K \ 46 | STOPTASKS,${SSTATE_DIR},1G,100K \ 47 | STOPTASKS,/tmp,100M,100K \ 48 | ABORT,${TMPDIR},100M,1K \ 49 | ABORT,${DL_DIR},100M,1K \ 50 | ABORT,${SSTATE_DIR},100M,1K \ 51 | ABORT,/tmp,10M,1K" 52 | -------------------------------------------------------------------------------- /kas-example-rt.yml: -------------------------------------------------------------------------------- 1 | header: 2 | version: 2 3 | includes: 4 | - kas-example.yml 5 | 6 | target: iot2000-example-image-rt 7 | 8 | local_conf_header: 9 | rt_kernel: | 10 | PREFERRED_PROVIDER_virtual/kernel = "linux-cip-rt" 11 | -------------------------------------------------------------------------------- /kas-example-swupdate.yml: -------------------------------------------------------------------------------- 1 | header: 2 | version: 2 3 | includes: 4 | - kas-example.yml 5 | 6 | target: iot2000-update-image 7 | -------------------------------------------------------------------------------- /kas-example.yml: -------------------------------------------------------------------------------- 1 | header: 2 | version: 2 3 | includes: 4 | - kas-bsp.yml 5 | 6 | distro: poky-iot2000 7 | target: iot2000-example-image 8 | 9 | repos: 10 | meta-iot2000: 11 | layers: 12 | meta-iot2000-example: 13 | 14 | meta-openembedded: 15 | layers: 16 | meta-networking: 17 | meta-python: 18 | 19 | meta-swupdate: 20 | url: https://github.com/sbabic/meta-swupdate 21 | refspec: 1886350dacb63d931b3d1a3809b27795b0a5c306 22 | 23 | local_conf_header: 24 | package_ipk: | 25 | PACKAGE_CLASSES = "package_ipk" 26 | -------------------------------------------------------------------------------- /kas-sdk-linux-x64.yml: -------------------------------------------------------------------------------- 1 | header: 2 | version: 3 3 | includes: 4 | - kas-example.yml 5 | 6 | task: populate_sdk 7 | 8 | local_conf_header: 9 | sdk_machine: | 10 | SDKMACHINE ?= "x86_64" 11 | -------------------------------------------------------------------------------- /kas-sdk-windows-i586.yml: -------------------------------------------------------------------------------- 1 | header: 2 | version: 3 3 | includes: 4 | - kas-example.yml 5 | 6 | task: populate_sdk 7 | 8 | repos: 9 | meta-mingw: 10 | url: https://git.yoctoproject.org/git/meta-mingw 11 | refspec: 524de686205b5d6736661d4532f5f98fee8589b7 12 | 13 | local_conf_header: 14 | sdk_machine: | 15 | SDKMACHINE ?= "i686-mingw32" 16 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/COPYING.MIT: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a copy 2 | of this software and associated documentation files (the "Software"), to deal 3 | in the Software without restriction, including without limitation the rights 4 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5 | copies of the Software, and to permit persons to whom the Software is 6 | furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in 9 | all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17 | THE SOFTWARE. 18 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/conf/layer.conf: -------------------------------------------------------------------------------- 1 | # We have a conf and classes directory, add to BBPATH 2 | BBPATH .= ":${LAYERDIR}" 3 | 4 | # We have a recipes-* directories, add to BBFILES 5 | BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ 6 | ${LAYERDIR}/recipes-*/*/*.bbappend" 7 | 8 | BBFILE_COLLECTIONS += "iot2000-bsp" 9 | BBFILE_PATTERN_iot2000-bsp = "^${LAYERDIR}/" 10 | BBFILE_PRIORITY_iot2000-bsp = "6" 11 | 12 | LAYERSERIES_COMPAT_iot2000-bsp = "dunfell" 13 | 14 | IOT2000_MIT_LICENSE = "${LAYERDIR}/COPYING.MIT" 15 | IOT2000_GPLv2_LICENSE = "${LAYERDIR}/COPYING.GPLv2" 16 | 17 | PACKAGE_CLASSES = "package_ipk" 18 | 19 | PREFERRED_VERSION_stress = "1.%" 20 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/conf/machine/include/intel-quark-common.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Common configuration for all MACHINES of the intel-quark type 3 | # 4 | 5 | DEFAULTTUNE ?= "i586-nlp-32" 6 | require conf/machine/include/tune-i586-nlp.inc 7 | require conf/machine/include/x86-base.inc 8 | 9 | # gnutls padlock code uses CMOV instruction in assembly which 10 | # is not valid for Quark. 11 | EXTRA_OECONF_append_pn-gnutls_intel-quark = " --disable-padlock" 12 | EXTRA_OECONF_append_pn-openssl_intel-quark = " no-asm" 13 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/conf/machine/iot2000.conf: -------------------------------------------------------------------------------- 1 | #@TYPE: Machine 2 | #@NAME: iot2000 3 | 4 | #@DESCRIPTION: Machine configuration for iot2000 systems 5 | 6 | MACHINEOVERRIDES =. "intel-quark:" 7 | 8 | PREFERRED_PROVIDER_virtual/kernel ?= "linux-cip" 9 | 10 | require conf/machine/include/intel-quark-common.inc 11 | 12 | MACHINE_FEATURES = "efi usb" 13 | 14 | MACHINE_EXTRA_RRECOMMENDS += "kernel-modules linux-firmware" 15 | 16 | SERIAL_CONSOLES = "115200;ttyS1" 17 | APPEND += "rootwait console=ttyS1,115200 console=tty0" 18 | 19 | EFI_PROVIDER = "efibootguard" 20 | 21 | # Ensure that the Lock prefix is omitted for the kernel 22 | KERNEL_EXTRA_ARGS = "EXTRA_CFLAGS=-Wa,-momit-lock-prefix=yes" 23 | 24 | # Machine specific Image packages: 25 | IMAGE_INSTALL_append = " kernel-modules" 26 | 27 | # Package compatiblity: 28 | PACKAGE_EXTRA_ARCHS_append = " intel-quark quark i586 x86" 29 | 30 | # Enable connman celluar 31 | PACKAGECONFIG_append_pn-connman = " 3g" 32 | 33 | INITRD_LIVE_prepend = "${DEPLOY_DIR_IMAGE}/acpi-upgrades-${MACHINE}.cpio " 34 | 35 | # runqemu configuration 36 | IMAGE_CLASSES += "qemuboot" 37 | IMAGE_FSTYPES += "ext4" 38 | QB_SYSTEM_NAME = "qemu-system-i386" 39 | QB_MEM = "-m 1024" 40 | QB_CPU = "-cpu pentium" 41 | QB_CPU_KVM = "-cpu pentium" 42 | QB_KERNEL_CMDLINE_APPEND = "console=ttyS1" 43 | QB_OPT_APPEND = "-serial pty -serial mon:stdio -device virtio-rng-pci" 44 | QB_NETWORK_DEVICE = "-device virtio-net-pci -device virtio-net-pci,netdev=net0,mac=@MAC@" 45 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-bsp/acpi-upgrades/acpi-upgrades.bb: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/tables:" 2 | 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${IOT2000_MIT_LICENSE};md5=838c366f69b72c5df05c96dff79b35f2" 5 | 6 | inherit deploy 7 | 8 | DEPENDS = "acpica-native" 9 | 10 | SRC_URI_iot2000 = "file://iot2000" 11 | 12 | do_compile() { 13 | rm -fr ${WORKDIR}/acpi-upgrades 14 | 15 | install -d ${WORKDIR}/acpi-upgrades/kernel/firmware/acpi 16 | 17 | for table in ${WORKDIR}/*/*.asl; do 18 | dest_table=$(basename $table) 19 | ${STAGING_DIR_NATIVE}${bindir_native}/iasl \ 20 | -p ${WORKDIR}/acpi-upgrades/kernel/firmware/acpi/$dest_table $table 21 | done 22 | 23 | cd ${WORKDIR}/acpi-upgrades 24 | find kernel | cpio -H newc -o > ${WORKDIR}/acpi-upgrades-${MACHINE}.cpio 25 | } 26 | 27 | do_deploy() { 28 | cp ${WORKDIR}/acpi-upgrades-${MACHINE}.cpio ${DEPLOYDIR} 29 | } 30 | 31 | addtask deploy before do_build after do_compile 32 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-bsp/acpi-upgrades/tables/iot2000/ssdt-fixes.asl: -------------------------------------------------------------------------------- 1 | DefinitionBlock ("ssdt-fixes.aml", "SSDT", 5, "SsgPmm", "CpuPm", 17) 2 | { 3 | /* What we hijacked */ 4 | 5 | External (_PR_.CPU0, DeviceObj) 6 | 7 | Scope (\) 8 | { 9 | Name (PDC0, 0x80000000) 10 | } 11 | 12 | Scope (\_PR.CPU0) 13 | { 14 | Method (_PDC, 1, NotSerialized) // _PDC: Processor Driver Capabilities 15 | { 16 | CreateDWordField (Arg0, 0x08, CAP0) 17 | Store (CAP0, PDC0) 18 | } 19 | } 20 | 21 | /* Fixes */ 22 | 23 | External (\_SB.PCI0.SPI0, DeviceObj) 24 | External (\_SB.PCI0.GIP0.GPO, DeviceObj) 25 | External (\_SB.PCI0.PEX1, DeviceObj) 26 | 27 | Scope (\_SB.PCI0.SPI0) 28 | { 29 | Name (_CRS, ResourceTemplate () { 30 | GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly, 31 | "\\_SB.PCI0.GIP0.GPO", 0) {0} 32 | }) 33 | 34 | Name (_DSD, Package () { 35 | ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 36 | Package () { 37 | Package () { 38 | "cs-gpios", Package () {^SPI0, 0, 0, 0}, 39 | }, 40 | } 41 | }) 42 | } 43 | 44 | Scope (\_SB.PCI0.PEX1) 45 | { 46 | Device (EXR0) 47 | { 48 | Name (_ADR, 0x00000000) 49 | Name (_STA, 0x0F) 50 | } 51 | } 52 | 53 | Scope (\_SB) 54 | { 55 | Device (LEDR) 56 | { 57 | Name (_HID, "PRP0001") 58 | 59 | Name (_CRS, ResourceTemplate () { 60 | GpioIo (Exclusive, PullNone, 0, 0, IoRestrictionOutputOnly, 61 | "\\_SB.PCI0.PEX1.EXR0", 0) {0} 62 | }) 63 | 64 | Name (_DSD, Package () { 65 | ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 66 | Package () { 67 | Package () {"compatible", "gpio-leds"}, 68 | }, 69 | ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), 70 | Package () { 71 | Package () {"led-0", "LED0"}, 72 | } 73 | }) 74 | 75 | Name (LED0, Package () { 76 | ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 77 | Package () { 78 | Package () {"label", "mpio_uart_led:red:user"}, 79 | Package () {"gpios", Package () {^LEDR, 0, 0, 0}}, 80 | Package () {"linux,default-state", "off"}, 81 | Package () {"linux,default-trigger", "none"}, 82 | Package () {"linux,retain-state-suspended", 1}, 83 | } 84 | }) 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-bsp/formfactor/formfactor/iot2000/machconfig: -------------------------------------------------------------------------------- 1 | # Assume a USB mouse and keyboard are connected 2 | HAVE_TOUCHSCREEN=n 3 | HAVE_KEYBOARD=n 4 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-bsp/formfactor/formfactor_0.0.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 2 | 3 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-core/ell/ell_0.22.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "Embedded Linux Library" 2 | DESCRIPTION = "The Embedded Linux Library (ELL) provides core, \ 3 | low-level functionality for system daemons. It typically has no \ 4 | dependencies other than the Linux kernel, C standard library, and \ 5 | libdl (for dynamic linking). While ELL is designed to be efficient \ 6 | and compact enough for use on embedded Linux platforms, it is not \ 7 | limited to resource-constrained systems." 8 | SECTION = "libs" 9 | LICENSE = "LGPLv2.1" 10 | LIC_FILES_CHKSUM = "file://COPYING;md5=fb504b67c50331fc78734fed90fb0e09" 11 | 12 | DEPENDS = "dbus" 13 | 14 | inherit autotools pkgconfig 15 | 16 | SRC_URI = "https://mirrors.edge.kernel.org/pub/linux/libs/${BPN}/${BPN}-${PV}.tar.xz" 17 | SRC_URI[md5sum] = "a4e7d74404f11e71775b89f53a8f1c33" 18 | SRC_URI[sha256sum] = "3c1d6d997e17dfcbe4ebcd1331d9a7be5c64f2f0a0813bc223790e570d8da2e3" 19 | 20 | do_configure_prepend () { 21 | mkdir -p ${S}/build-aux 22 | } 23 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-core/images/core-image-iot2000.inc: -------------------------------------------------------------------------------- 1 | require wic-image.inc 2 | 3 | DEPENDS += "acpi-upgrades" 4 | do_bootimg[depends] += "acpi-upgrades:do_deploy" 5 | 6 | IMAGE_INSTALL_append = " switchmode" 7 | 8 | DEPENDS += "gptfdisk-native efibootguard-native" 9 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-core/images/core-image-minimal.bbappend: -------------------------------------------------------------------------------- 1 | require core-image-iot2000.inc 2 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-core/images/core-image-rt.bb: -------------------------------------------------------------------------------- 1 | require recipes-core/images/core-image-minimal.bb 2 | require core-image-iot2000.inc 3 | 4 | # Skip processing of this recipe if linux-cip-rt is not explicitly specified as the 5 | # PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying 6 | # to build multiple virtual/kernel providers. 7 | python () { 8 | if d.getVar("PREFERRED_PROVIDER_virtual/kernel", True) != "linux-cip-rt": 9 | raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-cip-rt to enable it") 10 | } 11 | 12 | DESCRIPTION = "A small image just capable of allowing a device to boot plus a \ 13 | real-time test suite and tools appropriate for real-time use." 14 | DEPENDS += "linux-cip-rt" 15 | 16 | IMAGE_INSTALL += "rt-tests hwlatdetect" 17 | 18 | LICENSE = "MIT" 19 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-core/images/wic-image.inc: -------------------------------------------------------------------------------- 1 | IMAGE_FSTYPES_append = " wic" 2 | 3 | WKS_FILE = "wic-image.${MACHINE}.wks" 4 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/go/common/go-wrapper: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ "$1" = build ]; then 3 | shift 4 | export GOARCH="386" 5 | export GO386="quark" 6 | go.bin build -a "$@" 7 | else 8 | go.bin "$@" 9 | fi 10 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/go/go-cross-iot2000.inc: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/common:" 2 | 3 | SRC_URI += " \ 4 | file://0001-runtime-Implement-i386-atomic-quadword-ops-alternati.patch \ 5 | file://0002-Revert-runtime-check-and-fail-early-with-a-message-i.patch \ 6 | file://0003-cmd-internal-obj-x86-cmd-compile-internal-x86-Add-In.patch \ 7 | file://go-wrapper \ 8 | " 9 | 10 | do_install_append() { 11 | mv ${D}${bindir}/go ${D}${bindir}/go.bin 12 | install -m755 ${WORKDIR}/go-wrapper ${D}${bindir}/go 13 | } 14 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/go/go-cross_1.6%.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/patches-1.6:" 2 | 3 | require go-cross-iot2000.inc 4 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/go/go-cross_1.6-dummy.bb: -------------------------------------------------------------------------------- 1 | # Dummy recipe in case meta-golang is not used 2 | LICENSE="" 3 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/go/go-cross_1.8%.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/patches-1.8:" 2 | 3 | require go-cross-iot2000.inc 4 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/go/go-cross_1.8-dummy.bb: -------------------------------------------------------------------------------- 1 | go-cross_1.6-dummy.bb -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/go/patches-1.6/0002-Revert-runtime-check-and-fail-early-with-a-message-i.patch: -------------------------------------------------------------------------------- 1 | From 19d0c77d72a0687140155f33aad7d2348e0b86b9 Mon Sep 17 00:00:00 2001 2 | From: Petros Angelatos 3 | Date: Tue, 18 Oct 2016 08:23:35 -0700 4 | Subject: [PATCH 2/3] Revert "runtime: check and fail early with a message if 5 | MMX is not available on 386" 6 | 7 | This reverts commit 35e84546d7c3cc599dd5bf31ad86bf8d3d841d04. 8 | 9 | Upstream Status: Pending 10 | 11 | [Jan: rebased over 1.6.2] 12 | Signed-off-by: Jan Kiszka 13 | --- 14 | src/runtime/asm_386.s | 41 ----------------------------------------- 15 | 1 file changed, 41 deletions(-) 16 | 17 | diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s 18 | index 4181859724..b32ed46eef 100644 19 | --- a/src/runtime/asm_386.s 20 | +++ b/src/runtime/asm_386.s 21 | @@ -26,32 +26,6 @@ TEXT runtime·rt0_go(SB),NOSPLIT,$0 22 | MOVL SP, (g_stack+stack_hi)(BP) 23 | 24 | // find out information about the processor we're on 25 | -#ifdef GOOS_nacl // NaCl doesn't like PUSHFL/POPFL 26 | - JMP has_cpuid 27 | -#else 28 | - // first see if CPUID instruction is supported. 29 | - PUSHFL 30 | - PUSHFL 31 | - XORL $(1<<21), 0(SP) // flip ID bit 32 | - POPFL 33 | - PUSHFL 34 | - POPL AX 35 | - XORL 0(SP), AX 36 | - POPFL // restore EFLAGS 37 | - TESTL $(1<<21), AX 38 | - JNE has_cpuid 39 | -#endif 40 | - 41 | -bad_proc: // show that the program requires MMX. 42 | - MOVL $2, 0(SP) 43 | - MOVL $bad_proc_msg<>(SB), 4(SP) 44 | - MOVL $0x3d, 8(SP) 45 | - CALL runtime·write(SB) 46 | - MOVL $1, 0(SP) 47 | - CALL runtime·exit(SB) 48 | - INT $3 49 | - 50 | -has_cpuid: 51 | MOVL $0, AX 52 | CPUID 53 | CMPL AX, $0 54 | @@ -75,10 +49,6 @@ notintel: 55 | MOVL AX, runtime·cpuid_ecx(SB) 56 | MOVL DX, runtime·cpuid_edx(SB) 57 | 58 | - // Check for MMX support 59 | - TESTL $(1<<23), DX // MMX 60 | - JZ bad_proc 61 | - 62 | nocpuinfo: 63 | 64 | // if there is an _cgo_init, call it to let it 65 | @@ -160,17 +130,6 @@ ok: 66 | INT $3 67 | RET 68 | 69 | -DATA bad_proc_msg<>+0x00(SB)/8, $"This pro" 70 | -DATA bad_proc_msg<>+0x08(SB)/8, $"gram can" 71 | -DATA bad_proc_msg<>+0x10(SB)/8, $" only be" 72 | -DATA bad_proc_msg<>+0x18(SB)/8, $" run on " 73 | -DATA bad_proc_msg<>+0x20(SB)/8, $"processe" 74 | -DATA bad_proc_msg<>+0x28(SB)/8, $"rs with " 75 | -DATA bad_proc_msg<>+0x30(SB)/8, $"MMX supp" 76 | -DATA bad_proc_msg<>+0x38(SB)/4, $"ort." 77 | -DATA bad_proc_msg<>+0x3c(SB)/1, $0xa 78 | -GLOBL bad_proc_msg<>(SB), RODATA, $0x3d 79 | - 80 | DATA runtime·mainPC+0(SB)/4,$runtime·main(SB) 81 | GLOBL runtime·mainPC(SB),RODATA,$4 82 | 83 | -- 84 | 2.12.3 85 | 86 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/go/patches-1.6/0003-cmd-internal-obj-x86-cmd-compile-internal-x86-Add-In.patch: -------------------------------------------------------------------------------- 1 | From 235f5fb7d83dc9f4f896e7d469665162bae91b55 Mon Sep 17 00:00:00 2001 2 | From: Jan Kiszka 3 | Date: Sun, 30 Jul 2017 09:45:41 +0200 4 | Subject: [PATCH 3/3] cmd/internal/obj/x86, cmd/compile/internal/x86: Add Intel 5 | Quark workaround 6 | 7 | The Quark erratum #24 requires us to leave out any LOCK prefix from 8 | instructions that may cause segfaults. The GNU assembler has a special 9 | switch for that. We can add another GO386 mode: quark. It's identical to 10 | 387, except that it tells the assembler to not generate any LOCK prefix. 11 | 12 | Signed-off-by: Jan Kiszka 13 | --- 14 | src/cmd/compile/internal/x86/galign.go | 2 +- 15 | src/cmd/internal/obj/x86/asm6.go | 7 +++++++ 16 | 2 files changed, 8 insertions(+), 1 deletion(-) 17 | 18 | diff --git a/src/cmd/compile/internal/x86/galign.go b/src/cmd/compile/internal/x86/galign.go 19 | index 2535e3e165..d4353cb639 100644 20 | --- a/src/cmd/compile/internal/x86/galign.go 21 | +++ b/src/cmd/compile/internal/x86/galign.go 22 | @@ -52,7 +52,7 @@ func Main() { 23 | gc.Thearch.REGMIN = x86.REG_AX 24 | gc.Thearch.REGMAX = x86.REG_DI 25 | switch v := obj.Getgo386(); v { 26 | - case "387": 27 | + case "387", "quark": 28 | gc.Thearch.FREGMIN = x86.REG_F0 29 | gc.Thearch.FREGMAX = x86.REG_F7 30 | gc.Thearch.Use387 = true 31 | diff --git a/src/cmd/internal/obj/x86/asm6.go b/src/cmd/internal/obj/x86/asm6.go 32 | index 4ed1d8790b..8168fc83ba 100644 33 | --- a/src/cmd/internal/obj/x86/asm6.go 34 | +++ b/src/cmd/internal/obj/x86/asm6.go 35 | @@ -2015,11 +2015,18 @@ func span6(ctxt *obj.Link, s *obj.LSym) { 36 | } 37 | } 38 | 39 | +var isQuark = (obj.Getgo386() == "quark") 40 | + 41 | func instinit() { 42 | var c int 43 | 44 | for i := 1; optab[i].as != 0; i++ { 45 | c = int(optab[i].as) 46 | + 47 | + if isQuark && c == ALOCK { 48 | + optab[i].op = [23]uint8{} 49 | + } 50 | + 51 | if opindex[c&obj.AMask] != nil { 52 | log.Fatalf("phase error in optab: %d (%v)", i, obj.Aconv(c)) 53 | } 54 | -- 55 | 2.12.3 56 | 57 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/go/patches-1.8/0002-Revert-runtime-check-and-fail-early-with-a-message-i.patch: -------------------------------------------------------------------------------- 1 | From 344d01186a11f5963988faea50c94cb29e8824f5 Mon Sep 17 00:00:00 2001 2 | From: Petros Angelatos 3 | Date: Tue, 18 Oct 2016 08:23:35 -0700 4 | Subject: [PATCH 2/3] Revert "runtime: check and fail early with a message if 5 | MMX is not available on 386" 6 | 7 | This reverts commit 35e84546d7c3cc599dd5bf31ad86bf8d3d841d04. 8 | 9 | Upstream Status: Pending 10 | 11 | [Jan: rebased over 1.8.3] 12 | Signed-off-by: Jan Kiszka 13 | --- 14 | src/runtime/asm_386.s | 41 ----------------------------------------- 15 | 1 file changed, 41 deletions(-) 16 | 17 | diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s 18 | index 3d0b74ce92..5e1b3da66b 100644 19 | --- a/src/runtime/asm_386.s 20 | +++ b/src/runtime/asm_386.s 21 | @@ -26,32 +26,6 @@ TEXT runtime·rt0_go(SB),NOSPLIT,$0 22 | MOVL SP, (g_stack+stack_hi)(BP) 23 | 24 | // find out information about the processor we're on 25 | -#ifdef GOOS_nacl // NaCl doesn't like PUSHFL/POPFL 26 | - JMP has_cpuid 27 | -#else 28 | - // first see if CPUID instruction is supported. 29 | - PUSHFL 30 | - PUSHFL 31 | - XORL $(1<<21), 0(SP) // flip ID bit 32 | - POPFL 33 | - PUSHFL 34 | - POPL AX 35 | - XORL 0(SP), AX 36 | - POPFL // restore EFLAGS 37 | - TESTL $(1<<21), AX 38 | - JNE has_cpuid 39 | -#endif 40 | - 41 | -bad_proc: // show that the program requires MMX. 42 | - MOVL $2, 0(SP) 43 | - MOVL $bad_proc_msg<>(SB), 4(SP) 44 | - MOVL $0x3d, 8(SP) 45 | - CALL runtime·write(SB) 46 | - MOVL $1, 0(SP) 47 | - CALL runtime·exit(SB) 48 | - INT $3 49 | - 50 | -has_cpuid: 51 | MOVL $0, AX 52 | CPUID 53 | MOVL AX, SI 54 | @@ -77,10 +51,6 @@ notintel: 55 | MOVL AX, runtime·cpuid_ecx(SB) 56 | MOVL DX, runtime·cpuid_edx(SB) 57 | 58 | - // Check for MMX support 59 | - TESTL $(1<<23), DX // MMX 60 | - JZ bad_proc 61 | - 62 | // Load EAX=7/ECX=0 cpuid flags 63 | CMPL SI, $7 64 | JLT nocpuinfo 65 | @@ -170,17 +140,6 @@ ok: 66 | INT $3 67 | RET 68 | 69 | -DATA bad_proc_msg<>+0x00(SB)/8, $"This pro" 70 | -DATA bad_proc_msg<>+0x08(SB)/8, $"gram can" 71 | -DATA bad_proc_msg<>+0x10(SB)/8, $" only be" 72 | -DATA bad_proc_msg<>+0x18(SB)/8, $" run on " 73 | -DATA bad_proc_msg<>+0x20(SB)/8, $"processo" 74 | -DATA bad_proc_msg<>+0x28(SB)/8, $"rs with " 75 | -DATA bad_proc_msg<>+0x30(SB)/8, $"MMX supp" 76 | -DATA bad_proc_msg<>+0x38(SB)/4, $"ort." 77 | -DATA bad_proc_msg<>+0x3c(SB)/1, $0xa 78 | -GLOBL bad_proc_msg<>(SB), RODATA, $0x3d 79 | - 80 | DATA runtime·mainPC+0(SB)/4,$runtime·main(SB) 81 | GLOBL runtime·mainPC(SB),RODATA,$4 82 | 83 | -- 84 | 2.12.3 85 | 86 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/go/patches-1.8/0003-cmd-internal-obj-x86-cmd-compile-internal-x86-Add-In.patch: -------------------------------------------------------------------------------- 1 | From 0e740c3e58d7e3c0a76f54960889a51f96079a5a Mon Sep 17 00:00:00 2001 2 | From: Jan Kiszka 3 | Date: Sun, 30 Jul 2017 09:45:41 +0200 4 | Subject: [PATCH 3/3] cmd/internal/obj/x86, cmd/compile/internal/x86: Add Intel 5 | Quark workaround 6 | 7 | The Quark erratum #24 requires us to leave out any LOCK prefix from 8 | instructions that may cause segfaults. The GNU assembler has a special 9 | switch for that. We can add another GO386 mode: quark. It's identical to 10 | 387, except that it tells the assembler to not generate any LOCK prefix. 11 | 12 | Signed-off-by: Jan Kiszka 13 | --- 14 | src/cmd/compile/internal/x86/galign.go | 2 +- 15 | src/cmd/internal/obj/x86/asm6.go | 7 +++++++ 16 | 2 files changed, 8 insertions(+), 1 deletion(-) 17 | 18 | diff --git a/src/cmd/compile/internal/x86/galign.go b/src/cmd/compile/internal/x86/galign.go 19 | index bb29d2a02f..36dc9b6498 100644 20 | --- a/src/cmd/compile/internal/x86/galign.go 21 | +++ b/src/cmd/compile/internal/x86/galign.go 22 | @@ -16,7 +16,7 @@ func Init() { 23 | gc.Thearch.LinkArch = &x86.Link386 24 | gc.Thearch.REGSP = x86.REGSP 25 | switch v := obj.GO386; v { 26 | - case "387": 27 | + case "387", "quark": 28 | gc.Thearch.Use387 = true 29 | case "sse2": 30 | default: 31 | diff --git a/src/cmd/internal/obj/x86/asm6.go b/src/cmd/internal/obj/x86/asm6.go 32 | index bf67822822..6a72acf8c9 100644 33 | --- a/src/cmd/internal/obj/x86/asm6.go 34 | +++ b/src/cmd/internal/obj/x86/asm6.go 35 | @@ -1969,9 +1969,16 @@ func span6(ctxt *obj.Link, s *obj.LSym) { 36 | } 37 | } 38 | 39 | +var isQuark = (obj.GO386 == "quark") 40 | + 41 | func instinit() { 42 | for i := 1; optab[i].as != 0; i++ { 43 | c := optab[i].as 44 | + 45 | + if isQuark && c == ALOCK { 46 | + optab[i].op = [23]uint8{} 47 | + } 48 | + 49 | if opindex[c&obj.AMask] != nil { 50 | log.Fatalf("phase error in optab: %d (%v)", i, c) 51 | } 52 | -- 53 | 2.12.3 54 | 55 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/nodejs/nodejs/0002-Switch-to-x87-mode-when-targeting-ia32.patch: -------------------------------------------------------------------------------- 1 | From b4a1ab6a0a199c2f8d474575115526b33632347e Mon Sep 17 00:00:00 2001 2 | From: Jan Kiszka 3 | Date: Thu, 7 Feb 2019 21:58:05 +0100 4 | Subject: [PATCH 02/32] Switch to x87 mode when targeting ia32 5 | 6 | Required for Quark. 7 | 8 | Signed-off-by: Jan Kiszka 9 | --- 10 | configure | 3 +++ 11 | 1 file changed, 3 insertions(+) 12 | 13 | diff --git a/configure b/configure 14 | index ceb04f7998..3da21cf2bf 100755 15 | --- a/configure 16 | +++ b/configure 17 | @@ -1033,6 +1033,9 @@ def configure_v8(o): 18 | o['variables']['v8_random_seed'] = 0 # Use a random seed for hash tables. 19 | o['variables']['v8_promise_internal_field_count'] = 1 # Add internal field to promises for async hooks. 20 | o['variables']['v8_use_snapshot'] = 'false' if options.without_snapshot else 'true' 21 | + target_arch = options.dest_cpu or host_arch 22 | + if target_arch == 'ia32': 23 | + o['variables']['v8_target_arch'] = 'x87' 24 | o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0 25 | o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform) 26 | o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8) 27 | -- 28 | 2.34.1 29 | 30 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/nodejs/nodejs/0003-Relax-check-in-ComputeInputFrameSize.patch: -------------------------------------------------------------------------------- 1 | From 2efeca0edceb4483ea53c878c900cb47c66e81e2 Mon Sep 17 00:00:00 2001 2 | From: Jan Kiszka 3 | Date: Sat, 16 Mar 2019 15:21:53 +0100 4 | Subject: [PATCH 03/32] Relax check in ComputeInputFrameSize 5 | 6 | It's not yet clear why the x87 port sometimes triggers this, e.g. while 7 | running npm, but it seems harmless to ignore, at least the case where 8 | result is larger than than expected. 9 | 10 | Signed-off-by: Jan Kiszka 11 | --- 12 | deps/v8/src/deoptimizer.cc | 8 +++++++- 13 | 1 file changed, 7 insertions(+), 1 deletion(-) 14 | 15 | diff --git a/deps/v8/src/deoptimizer.cc b/deps/v8/src/deoptimizer.cc 16 | index 21b36ba49c..25e8abab58 100644 17 | --- a/deps/v8/src/deoptimizer.cc 18 | +++ b/deps/v8/src/deoptimizer.cc 19 | @@ -1973,7 +1973,13 @@ unsigned Deoptimizer::ComputeInputFrameSize() const { 20 | unsigned stack_slots = compiled_code_->stack_slots(); 21 | unsigned outgoing_size = 0; 22 | // ComputeOutgoingArgumentSize(compiled_code_, bailout_id_); 23 | - CHECK_EQ(fixed_size_above_fp + (stack_slots * kPointerSize) - 24 | + 25 | + if (V8_UNLIKELY(fixed_size_above_fp + (stack_slots * kPointerSize) - 26 | + CommonFrameConstants::kFixedFrameSizeAboveFp + 27 | + outgoing_size < result)) 28 | + printf("node: WARN: Check failed in %s:%d - ignoring\n", 29 | + __FILE__, __LINE__); 30 | + CHECK_LE(fixed_size_above_fp + (stack_slots * kPointerSize) - 31 | CommonFrameConstants::kFixedFrameSizeAboveFp + outgoing_size, 32 | result); 33 | } 34 | -- 35 | 2.34.1 36 | 37 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/nodejs/nodejs/0007-py2to3-fix-tools-configure.d-nodedownload.py.patch: -------------------------------------------------------------------------------- 1 | From 8f7295b674a11eeea0f0d5f223941159451740d5 Mon Sep 17 00:00:00 2001 2 | From: Su Baocheng 3 | Date: Fri, 9 Oct 2020 18:19:02 +0800 4 | Subject: [PATCH 07/32] py2to3: fix tools/configure.d/nodedownload.py 5 | 6 | Signed-off-by: Su Baocheng 7 | --- 8 | tools/configure.d/nodedownload.py | 3 +-- 9 | 1 file changed, 1 insertion(+), 2 deletions(-) 10 | 11 | diff --git a/tools/configure.d/nodedownload.py b/tools/configure.d/nodedownload.py 12 | index 64a85bb505..92a30d6ee5 100644 13 | --- a/tools/configure.d/nodedownload.py 14 | +++ b/tools/configure.d/nodedownload.py 15 | @@ -6,12 +6,11 @@ import hashlib 16 | import sys 17 | import zipfile 18 | import tarfile 19 | -import fpformat 20 | import contextlib 21 | 22 | def formatSize(amt): 23 | """Format a size as a string in MB""" 24 | - return fpformat.fix(amt / 1024000., 1) 25 | + return "%.1f" % (amt / 1024000.) 26 | 27 | def spin(c): 28 | """print out an ASCII 'spinner' based on the value of counter 'c'""" 29 | -- 30 | 2.34.1 31 | 32 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/nodejs/nodejs/0008-py2to3-deps-v8-gypfiles-toolchain.gypi.patch: -------------------------------------------------------------------------------- 1 | From 628ba8503a5fcd581f55620ab438c1dc5cb8e936 Mon Sep 17 00:00:00 2001 2 | From: Su Baocheng 3 | Date: Fri, 9 Oct 2020 18:52:28 +0800 4 | Subject: [PATCH 08/32] py2to3: deps/v8/gypfiles/toolchain.gypi 5 | 6 | Signed-off-by: Su Baocheng 7 | --- 8 | deps/v8/gypfiles/toolchain.gypi | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/deps/v8/gypfiles/toolchain.gypi b/deps/v8/gypfiles/toolchain.gypi 12 | index 2b150b44b4..423f24b998 100644 13 | --- a/deps/v8/gypfiles/toolchain.gypi 14 | +++ b/deps/v8/gypfiles/toolchain.gypi 15 | @@ -41,7 +41,7 @@ 16 | 'has_valgrind%': 0, 17 | 'coverage%': 0, 18 | 'v8_target_arch%': '<(target_arch)', 19 | - 'v8_host_byteorder%': ' 3 | Date: Tue, 20 Oct 2020 15:57:35 +0800 4 | Subject: [PATCH 09/32] py2to3: fix tools/gyp/pylib/gyp/generator/make.py 5 | 6 | Signed-off-by: Su Baocheng 7 | --- 8 | tools/gyp/pylib/gyp/generator/make.py | 4 ++-- 9 | 1 file changed, 2 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/tools/gyp/pylib/gyp/generator/make.py b/tools/gyp/pylib/gyp/generator/make.py 12 | index bde7e01429..210e18762a 100644 13 | --- a/tools/gyp/pylib/gyp/generator/make.py 14 | +++ b/tools/gyp/pylib/gyp/generator/make.py 15 | @@ -1753,8 +1753,8 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD 16 | # - The multi-output rule will have an do-nothing recipe. 17 | 18 | # Hash the target name to avoid generating overlong filenames. 19 | - cmddigest = hashlib.sha1(command if command else self.target).hexdigest() 20 | - intermediate = "%s.intermediate" % (cmddigest) 21 | + cmddigest = hashlib.sha1((command or self.target).encode("utf-8")).hexdigest() 22 | + intermediate = "%s.intermediate" % cmddigest 23 | self.WriteLn('%s: %s' % (' '.join(outputs), intermediate)) 24 | self.WriteLn('\t%s' % '@:'); 25 | self.WriteLn('%s: %s' % ('.INTERMEDIATE', intermediate)) 26 | -- 27 | 2.34.1 28 | 29 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/nodejs/nodejs/0010-py2to3-fix-tools-compress_json.py.patch: -------------------------------------------------------------------------------- 1 | From fa0ee90074505d8a8dc387bdb3a93c3e0c5a0ccf Mon Sep 17 00:00:00 2001 2 | From: Su Baocheng 3 | Date: Fri, 9 Oct 2020 19:08:09 +0800 4 | Subject: [PATCH 10/32] py2to3: fix tools/compress_json.py 5 | 6 | Signed-off-by: Su Baocheng 7 | --- 8 | tools/compress_json.py | 13 +++++++------ 9 | 1 file changed, 7 insertions(+), 6 deletions(-) 10 | 11 | diff --git a/tools/compress_json.py b/tools/compress_json.py 12 | index f136cd49be..13808b9769 100644 13 | --- a/tools/compress_json.py 14 | +++ b/tools/compress_json.py 15 | @@ -6,9 +6,9 @@ import sys 16 | import zlib 17 | 18 | if __name__ == '__main__': 19 | - fp = open(sys.argv[1]) 20 | - obj = json.load(fp) 21 | - text = json.dumps(obj, separators=(',', ':')) 22 | + with open(sys.argv[1]) as fp: 23 | + obj = json.load(fp) 24 | + text = json.dumps(obj, separators=(',', ':')).encode('utf-8') 25 | data = zlib.compress(text, zlib.Z_BEST_COMPRESSION) 26 | 27 | # To make decompression a little easier, we prepend the compressed data 28 | @@ -18,8 +18,9 @@ if __name__ == '__main__': 29 | 30 | step = 20 31 | slices = (data[i:i+step] for i in range(0, len(data), step)) 32 | - slices = [','.join(str(ord(c)) for c in s) for s in slices] 33 | + slices = [','.join(str(c) for c in s) for s in slices] 34 | + 35 | text = ',\n'.join(slices) 36 | 37 | - fp = open(sys.argv[2], 'w') 38 | - fp.write(text) 39 | + with open(sys.argv[2], 'w') as fp: 40 | + fp.write(text) 41 | -- 42 | 2.34.1 43 | 44 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/nodejs/nodejs/0011-py2to3-fix-tools-js2c.py-deps-v8-tools-js2c.py.patch: -------------------------------------------------------------------------------- 1 | From 004f9dcf214fc0e07635c952af106a134bbf962f Mon Sep 17 00:00:00 2001 2 | From: Su Baocheng 3 | Date: Fri, 9 Oct 2020 19:31:00 +0800 4 | Subject: [PATCH 11/32] py2to3: fix tools/js2c.py & deps/v8/tools/js2c.py 5 | 6 | Signed-off-by: Su Baocheng 7 | --- 8 | deps/v8/tools/js2c.py | 8 ++++---- 9 | tools/js2c.py | 10 ++++------ 10 | 2 files changed, 8 insertions(+), 10 deletions(-) 11 | 12 | diff --git a/deps/v8/tools/js2c.py b/deps/v8/tools/js2c.py 13 | index 511b75094a..01cf9fd8ce 100755 14 | --- a/deps/v8/tools/js2c.py 15 | +++ b/deps/v8/tools/js2c.py 16 | @@ -35,7 +35,7 @@ import os, re 17 | import optparse 18 | import jsmin 19 | import textwrap 20 | -from functools import reduce 21 | +from functools import reduce, cmp_to_key 22 | 23 | 24 | class Error(Exception): 25 | @@ -407,8 +407,8 @@ def PrepareSources(source_files, native_type, emit_js): 26 | filters = BuildFilterChain(macro_file, message_template_file) 27 | 28 | # Sort 'debugger' sources first. 29 | - source_files = sorted(source_files, 30 | - lambda l,r: IsDebuggerFile(r) - IsDebuggerFile(l)) 31 | + source_files = sorted(source_files, 32 | + key=cmp_to_key(lambda l,r: IsDebuggerFile(r) - IsDebuggerFile(l))) 33 | 34 | source_files_and_contents = [(f, ReadFile(f)) for f in source_files] 35 | 36 | @@ -511,7 +511,7 @@ def PutInt(blob_file, value): 37 | 38 | def PutStr(blob_file, value): 39 | PutInt(blob_file, len(value)); 40 | - blob_file.write(value); 41 | + blob_file.write(value.encode('utf-8')) 42 | 43 | 44 | def WriteStartupBlob(sources, startup_blob): 45 | diff --git a/tools/js2c.py b/tools/js2c.py 46 | index 0fe695a64c..c06d38428b 100755 47 | --- a/tools/js2c.py 48 | +++ b/tools/js2c.py 49 | @@ -34,8 +34,6 @@ 50 | import os 51 | import re 52 | import sys 53 | -import string 54 | - 55 | 56 | def ToCArray(elements, step=10): 57 | slices = (elements[i:i+step] for i in range(0, len(elements), step)) 58 | @@ -148,14 +146,14 @@ def ReadMacros(lines): 59 | macro_match = MACRO_PATTERN.match(line) 60 | if macro_match: 61 | name = macro_match.group(1) 62 | - args = list(map(string.strip, macro_match.group(2).split(','))) 63 | + args = [x.strip() for x in macro_match.group(2).split(',')] 64 | body = macro_match.group(3).strip() 65 | macros[name] = TextMacro(args, body) 66 | else: 67 | python_match = PYTHON_MACRO_PATTERN.match(line) 68 | if python_match: 69 | name = python_match.group(1) 70 | - args = list(map(string.strip, python_match.group(2).split(','))) 71 | + args = [x.strip() for x in python_match.group(2).split(',')] 72 | body = python_match.group(3).strip() 73 | fun = eval("lambda " + ",".join(args) + ': ' + body) 74 | macros[name] = PythonMacro(args, fun) 75 | @@ -223,8 +221,8 @@ def Render(var, data): 76 | # Treat non-ASCII as UTF-8 and convert it to UTF-16. 77 | if any(ord(c) > 127 for c in data): 78 | template = TWO_BYTE_STRING 79 | - data = list(map(ord, data.decode('utf-8').encode('utf-16be'))) 80 | - data = [data[i] * 256 + data[i+1] for i in range(0, len(data), 2)] 81 | + data = bytearray(data, 'utf-16le') 82 | + data = [data[i] + data[i+1]*256 for i in range(0, len(data), 2)] 83 | data = ToCArray(data) 84 | else: 85 | template = ONE_BYTE_STRING 86 | -- 87 | 2.34.1 88 | 89 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/nodejs/nodejs/0012-py2to3-fix-deps-v8-tools-gen-postmortem-metadata.py.patch: -------------------------------------------------------------------------------- 1 | From afc6ebba47051804872d40e8d08db31e0f733b32 Mon Sep 17 00:00:00 2001 2 | From: Su Baocheng 3 | Date: Tue, 20 Oct 2020 17:15:12 +0800 4 | Subject: [PATCH 12/32] py2to3: fix deps/v8/tools/gen-postmortem-metadata.py 5 | 6 | Signed-off-by: Su Baocheng 7 | --- 8 | deps/v8/tools/gen-postmortem-metadata.py | 3 +-- 9 | 1 file changed, 1 insertion(+), 2 deletions(-) 10 | 11 | diff --git a/deps/v8/tools/gen-postmortem-metadata.py b/deps/v8/tools/gen-postmortem-metadata.py 12 | index 827d00dc9e..0696bd0ff2 100644 13 | --- a/deps/v8/tools/gen-postmortem-metadata.py 14 | +++ b/deps/v8/tools/gen-postmortem-metadata.py 15 | @@ -627,8 +627,7 @@ def emit_set(out, consts): 16 | # Emit the whole output file. 17 | # 18 | def emit_config(): 19 | - out = file(sys.argv[1], 'w'); 20 | - 21 | + with open(sys.argv[1], 'w') as out: 22 | out.write(header); 23 | 24 | out.write('/* miscellaneous constants */\n'); 25 | -- 26 | 2.34.1 27 | 28 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/nodejs/nodejs/0013-py2to3-fix-async-keyword-error.patch: -------------------------------------------------------------------------------- 1 | From ba310b8f0b6b18758d12447c454a7dd4db37e826 Mon Sep 17 00:00:00 2001 2 | From: Su Baocheng 3 | Date: Sat, 10 Oct 2020 09:47:32 +0800 4 | Subject: [PATCH 13/32] py2to3: fix async keyword error 5 | 6 | fix async keyword error in: 7 | deps/v8/third_party/inspector_protocol/CodeGenerator.py 8 | 9 | Signed-off-by: Su Baocheng 10 | --- 11 | deps/v8/third_party/inspector_protocol/CodeGenerator.py | 5 ++++- 12 | 1 file changed, 4 insertions(+), 1 deletion(-) 13 | 14 | diff --git a/deps/v8/third_party/inspector_protocol/CodeGenerator.py b/deps/v8/third_party/inspector_protocol/CodeGenerator.py 15 | index 20d05bc9f4..eda58710f5 100644 16 | --- a/deps/v8/third_party/inspector_protocol/CodeGenerator.py 17 | +++ b/deps/v8/third_party/inspector_protocol/CodeGenerator.py 18 | @@ -31,6 +31,9 @@ def read_config(): 19 | items = [(k, os.path.join(config_base, v) if k == "path" else v) for (k, v) in list(object_dict.items())] 20 | items = [(k, os.path.join(output_base, v) if k == "output" else v) for (k, v) in items] 21 | keys, values = list(zip(*items)) 22 | + # 'async' is a keyword since Python 3.7. 23 | + # Avoid namedtuple(rename=True) for compatibility with Python 2.X. 24 | + keys = tuple('async_' if k == 'async' else k for k in keys) 25 | return collections.namedtuple('X', keys)(*values) 26 | return json.loads(data, object_hook=json_object_hook) 27 | 28 | @@ -443,7 +446,7 @@ class Protocol(object): 29 | def is_async_command(self, domain, command): 30 | if not self.config.protocol.options: 31 | return False 32 | - return self.check_options(self.config.protocol.options, domain, command, "async", None, False) 33 | + return self.check_options(self.config.protocol.options, domain, command, "async_", None, False) 34 | 35 | 36 | def is_exported(self, domain, name): 37 | -- 38 | 2.34.1 39 | 40 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/nodejs/nodejs/0014-py2to3-fix-deps-v8-third_party-jinja2-runtime.py.patch: -------------------------------------------------------------------------------- 1 | From af90afdfd9959ad24e50278055abaa2f5c1ae8fc Mon Sep 17 00:00:00 2001 2 | From: Su Baocheng 3 | Date: Sat, 10 Oct 2020 09:53:45 +0800 4 | Subject: [PATCH 14/32] py2to3: fix deps/v8/third_party/jinja2/runtime.py 5 | 6 | Signed-off-by: Su Baocheng 7 | --- 8 | deps/v8/third_party/jinja2/runtime.py | 1 - 9 | 1 file changed, 1 deletion(-) 10 | 11 | diff --git a/deps/v8/third_party/jinja2/runtime.py b/deps/v8/third_party/jinja2/runtime.py 12 | index f90f5542e5..5b29743a58 100644 13 | --- a/deps/v8/third_party/jinja2/runtime.py 14 | +++ b/deps/v8/third_party/jinja2/runtime.py 15 | @@ -522,7 +522,6 @@ class Undefined(object): 16 | 17 | def __bool__(self): 18 | return False 19 | - __bool__ = __nonzero__ 20 | 21 | def __repr__(self): 22 | return 'Undefined' 23 | -- 24 | 2.34.1 25 | 26 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/nodejs/nodejs/0015-py2to3-fix-gyp-samples-samples.patch: -------------------------------------------------------------------------------- 1 | From c1655a56f68fdf7ade8e1bfd48d9299e49e9e185 Mon Sep 17 00:00:00 2001 2 | From: Su Baocheng 3 | Date: Sat, 10 Oct 2020 12:59:22 +0800 4 | Subject: [PATCH 15/32] py2to3: fix gyp/samples/samples 5 | 6 | Signed-off-by: Su Baocheng 7 | --- 8 | deps/npm/node_modules/node-gyp/gyp/samples/samples | 8 ++++---- 9 | tools/gyp/samples/samples | 8 ++++---- 10 | 2 files changed, 8 insertions(+), 8 deletions(-) 11 | 12 | diff --git a/deps/npm/node_modules/node-gyp/gyp/samples/samples b/deps/npm/node_modules/node-gyp/gyp/samples/samples 13 | index 804b618998..94c0a9febd 100755 14 | --- a/deps/npm/node_modules/node-gyp/gyp/samples/samples 15 | +++ b/deps/npm/node_modules/node-gyp/gyp/samples/samples 16 | @@ -1,4 +1,4 @@ 17 | -#!/usr/bin/python 18 | +#!/usr/bin/python3 19 | 20 | # Copyright (c) 2009 Google Inc. All rights reserved. 21 | # Use of this source code is governed by a BSD-style license that can be 22 | @@ -57,7 +57,7 @@ gyps = [ 23 | 24 | def Main(argv): 25 | if len(argv) != 3 or argv[1] not in ['push', 'pull']: 26 | - print 'Usage: %s push/pull PATH_TO_CHROME' % argv[0] 27 | + print('Usage: %s push/pull PATH_TO_CHROME' % argv[0]) 28 | return 1 29 | 30 | path_to_chrome = argv[2] 31 | @@ -66,10 +66,10 @@ def Main(argv): 32 | chrome_file = os.path.join(path_to_chrome, g) 33 | local_file = os.path.join(os.path.dirname(argv[0]), os.path.split(g)[1]) 34 | if argv[1] == 'push': 35 | - print 'Copying %s to %s' % (local_file, chrome_file) 36 | + print('Copying %s to %s' % (local_file, chrome_file)) 37 | shutil.copyfile(local_file, chrome_file) 38 | elif argv[1] == 'pull': 39 | - print 'Copying %s to %s' % (chrome_file, local_file) 40 | + print('Copying %s to %s' % (chrome_file, local_file)) 41 | shutil.copyfile(chrome_file, local_file) 42 | else: 43 | assert False 44 | diff --git a/tools/gyp/samples/samples b/tools/gyp/samples/samples 45 | index 804b618998..94c0a9febd 100755 46 | --- a/tools/gyp/samples/samples 47 | +++ b/tools/gyp/samples/samples 48 | @@ -1,4 +1,4 @@ 49 | -#!/usr/bin/python 50 | +#!/usr/bin/python3 51 | 52 | # Copyright (c) 2009 Google Inc. All rights reserved. 53 | # Use of this source code is governed by a BSD-style license that can be 54 | @@ -57,7 +57,7 @@ gyps = [ 55 | 56 | def Main(argv): 57 | if len(argv) != 3 or argv[1] not in ['push', 'pull']: 58 | - print 'Usage: %s push/pull PATH_TO_CHROME' % argv[0] 59 | + print('Usage: %s push/pull PATH_TO_CHROME' % argv[0]) 60 | return 1 61 | 62 | path_to_chrome = argv[2] 63 | @@ -66,10 +66,10 @@ def Main(argv): 64 | chrome_file = os.path.join(path_to_chrome, g) 65 | local_file = os.path.join(os.path.dirname(argv[0]), os.path.split(g)[1]) 66 | if argv[1] == 'push': 67 | - print 'Copying %s to %s' % (local_file, chrome_file) 68 | + print('Copying %s to %s' % (local_file, chrome_file)) 69 | shutil.copyfile(local_file, chrome_file) 70 | elif argv[1] == 'pull': 71 | - print 'Copying %s to %s' % (chrome_file, local_file) 72 | + print('Copying %s to %s' % (chrome_file, local_file)) 73 | shutil.copyfile(chrome_file, local_file) 74 | else: 75 | assert False 76 | -- 77 | 2.34.1 78 | 79 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/nodejs/nodejs/0016-py2to3-use-python3-for-node-gyp.patch: -------------------------------------------------------------------------------- 1 | From aa533dc22fce9cb37ef8053eea9fd7799c72001c Mon Sep 17 00:00:00 2001 2 | From: Su Baocheng 3 | Date: Fri, 16 Oct 2020 15:16:06 +0800 4 | Subject: [PATCH 16/32] py2to3: use python3 for node-gyp 5 | 6 | Signed-off-by: Su Baocheng 7 | --- 8 | deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py | 6 ++++++ 9 | 1 file changed, 6 insertions(+) 10 | 11 | diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py 12 | index 2094017c34..649b7ff6da 100644 13 | --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py 14 | +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py 15 | @@ -708,6 +708,9 @@ PHASE_LATELATE = 2 16 | 17 | def ExpandVariables(input, phase, variables, build_file): 18 | # Look for the pattern that gets expanded into variables 19 | + def to_utf8(s): 20 | + return s if isinstance(s, str) else s.decode('utf-8') 21 | + 22 | if phase == PHASE_EARLY: 23 | variable_re = early_variable_re 24 | expansion_symbol = '<' 25 | @@ -910,6 +913,9 @@ def ExpandVariables(input, phase, variables, build_file): 26 | 27 | p_stdout, p_stderr = p.communicate('') 28 | 29 | + p_stdout = to_utf8(p_stdout) 30 | + p_stderr = to_utf8(p_stderr) 31 | + 32 | if p.wait() != 0 or p_stderr: 33 | sys.stderr.write(p_stderr) 34 | # Simulate check_call behavior, since check_call only exists 35 | -- 36 | 2.34.1 37 | 38 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/nodejs/nodejs/0025-CVE-2021-22884.patch: -------------------------------------------------------------------------------- 1 | From f833e662ae3a78ccf7a6dd2679363e091da59239 Mon Sep 17 00:00:00 2001 2 | From: chao zeng 3 | Date: Fri, 15 Jul 2022 10:32:50 +0800 4 | Subject: [PATCH 25/32] CVE-2021-22884 5 | MIME-Version: 1.0 6 | Content-Type: text/plain; charset=UTF-8 7 | Content-Transfer-Encoding: 8bit 8 | 9 | Ported from 10 | OpenSuse:nodejs8-8.17.0-150200.10.22.1:CVE-2021-22884 11 | 12 | Original commit message: 13 | 14 | From 1564752d553f582c8048ee45614f870ee2a446c9 Mon Sep 17 00:00:00 2001 15 | From: Matteo Collina 16 | Date: Thu, 14 Jan 2021 16:04:44 +0100 17 | Subject: [PATCH] src: drop localhost6 as allowed host for inspector 18 | MIME-Version: 1.0 19 | Content-Type: text/plain; charset=UTF-8 20 | Content-Transfer-Encoding: 8bit 21 | 22 | CVE-ID: CVE-2021-22884 23 | Refs: https://hackerone.com/bugs?report_id=1069487 24 | PR-URL: https://github.com/nodejs-private/node-private/pull/244 25 | Reviewed-By: Beth Griggs 26 | Reviewed-By: Daniel Bevenius 27 | Reviewed-By: Mary Marchini 28 | Reviewed-By: Michael Dawson 29 | Reviewed-By: Michaël Zasso 30 | Reviewed-By: Rich Trott 31 | 32 | Signed-off-by: chao zeng 33 | --- 34 | src/inspector_socket.cc | 3 +-- 35 | 1 file changed, 1 insertion(+), 2 deletions(-) 36 | 37 | diff --git a/src/inspector_socket.cc b/src/inspector_socket.cc 38 | index ed0efd0a20..2ecdb66d7d 100644 39 | --- a/src/inspector_socket.cc 40 | +++ b/src/inspector_socket.cc 41 | @@ -511,8 +511,7 @@ static std::string HeaderValue(const struct http_parsing_state_s* state, 42 | static bool IsAllowedHost(const std::string& host_with_port) { 43 | std::string host = TrimPort(host_with_port); 44 | return host.empty() || IsIPAddress(host) 45 | - || node::StringEqualNoCase(host.data(), "localhost") 46 | - || node::StringEqualNoCase(host.data(), "localhost6"); 47 | + || node::StringEqualNoCase(host.data(), "localhost"); 48 | } 49 | 50 | static int message_complete_cb(http_parser* parser) { 51 | -- 52 | 2.34.1 53 | 54 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/nodejs/nodejs/0028-CVE-2021-22939.patch: -------------------------------------------------------------------------------- 1 | From 6fbfa68123d3a6af92a6b9db9f231a3d20a7eca5 Mon Sep 17 00:00:00 2001 2 | From: chao zeng 3 | Date: Fri, 15 Jul 2022 10:38:34 +0800 4 | Subject: [PATCH 28/32] CVE-2021-22939 5 | 6 | Ported from 7 | OpenSuse:nodejs8-8.17.0-150200.10.22.1:CVE-2021-22939 8 | 9 | Original commit message: 10 | 11 | From 1780bbc3291357f7c3370892eb311fc7a62afe8d Mon Sep 17 00:00:00 2001 12 | From: Matteo Collina 13 | Date: Wed, 4 Aug 2021 18:40:00 +0200 14 | Subject: [PATCH] tls: validate "rejectUnauthorized: undefined" 15 | 16 | Incomplete validation of rejectUnauthorized parameter (Low) 17 | 18 | If the Node.js https API was used incorrectly and "undefined" was passed 19 | in for the "rejectUnauthorized" parameter, no error was returned and 20 | connections to servers with an expired certificate would have been 21 | accepted. 22 | 23 | CVE-ID: CVE-2021-22939 24 | Refs: https://nvd.nist.gov/vuln/detail/CVE-2021-22939 25 | Refs: https://hackerone.com/reports/1278254 26 | PR-URL: https://github.com/nodejs-private/node-private/pull/276 27 | Reviewed-By: Rich Trott 28 | Reviewed-By: Akshay K 29 | Reviewed-By: Robert Nagy 30 | Reviewed-By: Richard Lau 31 | 32 | Signed-off-by: chao zeng 33 | --- 34 | test/parallel/test-tls-client-reject.js | 13 +++++++++++++ 35 | 1 file changed, 13 insertions(+) 36 | 37 | diff --git a/test/parallel/test-tls-client-reject.js b/test/parallel/test-tls-client-reject.js 38 | index 955d97da6f..8fdde38073 100644 39 | --- a/test/parallel/test-tls-client-reject.js 40 | +++ b/test/parallel/test-tls-client-reject.js 41 | @@ -67,6 +67,19 @@ function rejectUnauthorized() { 42 | socket.write('ng'); 43 | } 44 | 45 | +function rejectUnauthorizedUndefined() { 46 | + console.log('reject unauthorized undefined'); 47 | + const socket = tls.connect(server.address().port, { 48 | + servername: 'localhost', 49 | + rejectUnauthorized: undefined 50 | + }, common.mustNotCall()); 51 | + socket.on('data', common.mustNotCall()); 52 | + socket.on('error', common.mustCall(function(err) { 53 | + authorized(); 54 | + })); 55 | + socket.end('ng'); 56 | +} 57 | + 58 | function authorized() { 59 | const socket = tls.connect(server.address().port, { 60 | ca: [fixtures.readSync('test_cert.pem')], 61 | -- 62 | 2.34.1 63 | 64 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/nodejs/nodejs/0030-CVE-2022-0235.patch: -------------------------------------------------------------------------------- 1 | From b2e2def5b5e264e98453a1914d7da731a7261801 Mon Sep 17 00:00:00 2001 2 | From: chao zeng 3 | Date: Fri, 15 Jul 2022 13:25:30 +0800 4 | Subject: [PATCH 30/32] CVE-2022-0235 5 | 6 | Ported from 7 | OpenSuse:nodejs8-8.17.0-150200.10.22.1:CVE-2022-0235 8 | 9 | Signed-off-by: chao zeng 10 | --- 11 | deps/npm/node_modules/node-fetch-npm/src/index.js | 3 +++ 12 | 1 file changed, 3 insertions(+) 13 | 14 | diff --git a/deps/npm/node_modules/node-fetch-npm/src/index.js b/deps/npm/node_modules/node-fetch-npm/src/index.js 15 | index b2cf80f9ec..f83de8bac0 100644 16 | --- a/deps/npm/node_modules/node-fetch-npm/src/index.js 17 | +++ b/deps/npm/node_modules/node-fetch-npm/src/index.js 18 | @@ -99,6 +99,9 @@ function fetch (uri, opts) { 19 | } 20 | if (url.parse(request.url).hostname !== redirectURL.hostname) { 21 | request.headers.delete('authorization') 22 | + request.headers.delete('www-authenticate') 23 | + request.headers.delete('cookie') 24 | + request.headers.delete('cookie2') 25 | } 26 | 27 | // per fetch spec, for POST request with 301/302 response, or any request with 303 response, use GET when following redirect 28 | -- 29 | 2.34.1 30 | 31 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/nodejs/nodejs_8%.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/nodejs:" 2 | 3 | SRC_URI += " \ 4 | file://0001-Restore-x87-port.patch \ 5 | file://0002-Switch-to-x87-mode-when-targeting-ia32.patch \ 6 | file://0003-Relax-check-in-ComputeInputFrameSize.patch \ 7 | file://0004-py2to3-automatic-conversion-via-2to3-tool.patch \ 8 | file://0005-py2to3-fix-configure.patch \ 9 | file://0006-py2to3-fix-tools-gyp-pylib-gyp-input.py.patch \ 10 | file://0007-py2to3-fix-tools-configure.d-nodedownload.py.patch \ 11 | file://0008-py2to3-deps-v8-gypfiles-toolchain.gypi.patch \ 12 | file://0009-py2to3-fix-tools-gyp-pylib-gyp-generator-make.py.patch \ 13 | file://0010-py2to3-fix-tools-compress_json.py.patch \ 14 | file://0011-py2to3-fix-tools-js2c.py-deps-v8-tools-js2c.py.patch \ 15 | file://0012-py2to3-fix-deps-v8-tools-gen-postmortem-metadata.py.patch \ 16 | file://0013-py2to3-fix-async-keyword-error.patch \ 17 | file://0014-py2to3-fix-deps-v8-third_party-jinja2-runtime.py.patch \ 18 | file://0015-py2to3-fix-gyp-samples-samples.patch \ 19 | file://0016-py2to3-use-python3-for-node-gyp.patch \ 20 | file://0017-CVE-2019-15606.patch \ 21 | file://0018-CVE-2019-15604.patch \ 22 | file://0019-CVE-2019-15605.patch \ 23 | file://0020-CVE-2020-8174.patch \ 24 | file://0021-nghttp2_1.41.0.patch \ 25 | file://0022-CVE-2020-11080.patch \ 26 | file://0023-CVE-2020-8265.patch \ 27 | file://0024-CVE-2020-8287.patch \ 28 | file://0025-CVE-2021-22884.patch \ 29 | file://0026-CVE-2021-22883.patch \ 30 | file://0027-CVE-2021-22930.patch \ 31 | file://0028-CVE-2021-22939.patch \ 32 | file://0029-CVE-2021-44907.patch \ 33 | file://0030-CVE-2022-0235.patch \ 34 | file://0031-OpenSSL-1.1.1-support.patch \ 35 | file://0032-Fix-build-with-openssl-1.1.1d.patch \ 36 | " 37 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-devtools/nodejs/nodejs_8-dummy.bb: -------------------------------------------------------------------------------- 1 | # Dummy recipe in case nodejs 8 is not available 2 | LICENSE="" 3 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-extended/stress/stress_%.bbappend: -------------------------------------------------------------------------------- 1 | SRC_URI_remove = "http://people.seas.harvard.edu/~apw/${BPN}/${BP}.tar.gz" 2 | SRC_URI += "http://deb.debian.org/debian/pool/main/s/stress/${BPN}_${PV}.orig.tar.gz" 3 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-extended/stress/stress_0-dummy.bb: -------------------------------------------------------------------------------- 1 | # Dummy recipe in case stress is not available 2 | LICENSE="" 3 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/configs/iot2000-cip-rt.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_RWSEM_GENERIC_SPINLOCK=y 2 | # CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 3 | CONFIG_HZ_PERIODIC=y 4 | # CONFIG_NO_HZ_IDLE is not set 5 | # CONFIG_NO_HZ is not set 6 | CONFIG_PREEMPT_RCU=y 7 | CONFIG_RCU_EXPERT=y 8 | CONFIG_RCU_STALL_COMMON=y 9 | CONFIG_RCU_FANOUT=32 10 | CONFIG_RCU_FANOUT_LEAF=16 11 | CONFIG_RCU_BOOST=y 12 | CONFIG_RCU_KTHREAD_PRIO=1 13 | CONFIG_RCU_BOOST_DELAY=500 14 | # CONFIG_RCU_NOCB_CPU is not set 15 | CONFIG_PREEMPT=y 16 | CONFIG_PREEMPT_RT_BASE=y 17 | CONFIG_PREEMPT_LAZY=y 18 | # CONFIG_PREEMPT_NONE is not set 19 | CONFIG_PREEMPT_RT_FULL=y 20 | CONFIG_PREEMPT_COUNT=y 21 | # CONFIG_SUSPEND is not set 22 | # CONFIG_PM is not set 23 | # CONFIG_ACPI_PROCESSOR is not set 24 | # CONFIG_CPU_FREQ is not set 25 | # CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set 26 | # CONFIG_CPU_IDLE is not set 27 | # CONFIG_NTP_PPS is not set 28 | CONFIG_RCU_CPU_STALL_TIMEOUT=21 29 | # CONFIG_PREEMPT_TRACER is not set 30 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/configs/iot2000-cip-rt.scc: -------------------------------------------------------------------------------- 1 | define KFEATURE_DESCRIPTION "IOT2000 CIP real-time config adjustments" 2 | kconf hardware iot2000-cip-rt.cfg 3 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/configs/iot2000-mainline.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_SERIAL_8250_LPSS=y 2 | 3 | # Make driver modular to avoid ttyS numbering issue 4 | CONFIG_SERIAL_8250_EXAR=m 5 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/configs/iot2000-mainline.scc: -------------------------------------------------------------------------------- 1 | define KFEATURE_DESCRIPTION "IOT2000 mainline config adjustments" 2 | kconf hardware iot2000-mainline.cfg 3 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/linux-cip-rt_4.4.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Linux real-time Kernel for IOT2000 based on CIP SLTS version" 2 | SECTION = "kernel" 3 | 4 | require recipes-kernel/linux/linux-yocto.inc 5 | require linux-cip_4.4.inc 6 | 7 | LINUX_VERSION = "4.4.302-cip69-rt39" 8 | SRC_URI += " \ 9 | file://rt-0001-spi-pca2xx-pci-Allow-MSI.patch \ 10 | file://rt-0002-gpio-dwapb-Work-around-RT-full-s-enforced-IRQ-thread.patch \ 11 | file://iot2000-cip-rt.scc" 12 | SRC_URI[sha256sum] = "5cbddbd7780739f7af91545691ffaa07a436dab4a0e8380a5e2b9b31e883071f" 13 | 14 | PV = "${LINUX_VERSION}" 15 | 16 | LINUX_VERSION_EXTENSION = "" 17 | 18 | COMPATIBLE_MACHINE_iot2000 = "iot2000" 19 | KMACHINE_iot2000 = "intel-quark" 20 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/linux-cip_4.4.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Linux Kernel for IOT2000 based on CIP SLTS version" 2 | SECTION = "kernel" 3 | 4 | require recipes-kernel/linux/linux-yocto.inc 5 | require linux-cip_4.4.inc 6 | 7 | PV = "${LINUX_VERSION}" 8 | 9 | LINUX_VERSION_EXTENSION = "" 10 | 11 | COMPATIBLE_MACHINE_iot2000 = "iot2000" 12 | KMACHINE_iot2000 = "intel-quark" 13 | 14 | # Accelerated entropy collection. 15 | # These are not yet ready for the -rt kernel. 16 | KERNEL_PATCHES += " \ 17 | file://0019-random-replace-non-blocking-pool-with-a-Chacha20-bas.patch \ 18 | file://0020-random-make-dev-urandom-scalable-for-silly-userspace.patch \ 19 | file://0021-random-add-backtracking-protection-to-the-CRNG.patch \ 20 | file://0022-random-remove-stale-maybe_reseed_primary_crng.patch \ 21 | file://0023-random-use-chacha20-for-get_random_int-long.patch \ 22 | file://0024-random-convert-get_random_int-long-into-get_random_u.patch \ 23 | file://0025-random-invalidate-batched-entropy-after-crng-init.patch \ 24 | file://0026-random-silence-compiler-warnings-and-fix-race.patch \ 25 | file://0027-random-add-wait_for_random_bytes-API.patch \ 26 | file://0028-random-fix-crng_ready-test.patch \ 27 | file://0029-random-use-a-different-mixing-algorithm-for-add_devi.patch \ 28 | file://0030-random-only-read-from-dev-random-after-its-pool-has-.patch \ 29 | file://0031-random-fix-soft-lockup-when-trying-to-read-from-an-u.patch \ 30 | file://0032-random-try-to-actively-add-entropy-rather-than-passi.patch" 31 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/linux-cip_4.4.inc: -------------------------------------------------------------------------------- 1 | LICENSE = "GPLv2" 2 | LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7" 3 | 4 | FILESEXTRAPATHS_prepend := "${THISDIR}/configs:${THISDIR}/patches:" 5 | 6 | LINUX_VERSION = "4.4.302-cip69" 7 | SRC_URI = " \ 8 | https://git.kernel.org/pub/scm/linux/kernel/git/cip/linux-cip.git/snapshot/linux-cip-${LINUX_VERSION}.tar.gz \ 9 | file://defconfig \ 10 | ${KERNEL_PATCHES}" 11 | SRC_URI[sha256sum] = "3acecb8f9ee4d9fba58d4a4cf4a2114018f030865f55b65cbc8e385ad04e691e" 12 | 13 | KERNEL_PATCHES = " \ 14 | file://0001-stmmac-pci-Make-stmmac_pci_info-structure-constant.patch \ 15 | file://0002-stmmac-pci-Use-stmmac_pci_info-for-all-devices.patch \ 16 | file://0003-stmmac-pci-Make-stmmac_pci_find_phy_addr-truly-gener.patch \ 17 | file://0004-stmmac-pci-Select-quark_pci_dmi_data-from-quark_defa.patch \ 18 | file://0005-stmmac-pci-Use-dmi_system_id-table-for-retrieving-PH.patch \ 19 | file://0006-stmmac-pci-Adjust-IOT2000-matching.patch \ 20 | file://0007-serial-8250_exar-Adjust-IOT2000-matching.patch \ 21 | file://0008-mfd-intel_quark_i2c_gpio-Adjust-IOT2000-matching.patch \ 22 | file://0009-gpio-sch-use-gpiochip-data-pointer.patch \ 23 | file://0010-gpio-sch-Use-devm_gpiochip_add_data-for-gpio-registr.patch \ 24 | file://0011-gpio-sch-Fix-Oops-on-module-load-on-Asus-Eee-PC-1201.patch \ 25 | file://0012-gpio-sch-Implement-.get_direction.patch \ 26 | file://0013-gpio-sch-Add-interrupt-support.patch \ 27 | file://0014-iot2000-hack-Work-around-DSDT-mistake.patch \ 28 | file://0015-iot2000-hack-Adjust-pca9685-gpio-base-for-legacy-com.patch \ 29 | file://0016-iot2000-hack-gpio-pca953x-provide-GPIO-base-based-on.patch \ 30 | file://0017-iot2000-hack-gpio-pca953x-add-drive-property.patch \ 31 | file://0018-iot2000-hack-pwm-pca-9685-Provide-chip-level-pwm_per.patch" 32 | 33 | S = "${WORKDIR}/linux-cip-${LINUX_VERSION}" 34 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/linux-mainline-latest.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Linux Kernel for IOT2000 using latest mainline kernel" 2 | SECTION = "kernel" 3 | 4 | include recipes-kernel/linux/linux-yocto.inc 5 | 6 | LICENSE = "GPLv2" 7 | LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814" 8 | 9 | FILESEXTRAPATHS_prepend := "${THISDIR}/configs:${THISDIR}/patches:" 10 | 11 | SRC_URI = " \ 12 | git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git;protocol=https \ 13 | file://0001-iot2000-hack-Work-around-DSDT-mistake.patch \ 14 | file://defconfig \ 15 | file://iot2000-mainline.scc" 16 | 17 | SRCREV = "${AUTOREV}" 18 | 19 | S = "${WORKDIR}/git" 20 | 21 | COMPATIBLE_MACHINE = "iot2000" 22 | KMACHINE = "intel-quark" 23 | 24 | # This recipe is tracking always the latest version 25 | do_kernel_version_sanity_check() { 26 | } 27 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/patches/0001-stmmac-pci-Make-stmmac_pci_info-structure-constant.patch: -------------------------------------------------------------------------------- 1 | From 3e6e84840e6434c005fe52094f972677447dd951 Mon Sep 17 00:00:00 2001 2 | From: Jan Kiszka 3 | Date: Thu, 22 Jun 2017 08:17:57 +0200 4 | Subject: [PATCH 01/32] stmmac: pci: Make stmmac_pci_info structure constant 5 | 6 | Commit c5d5287ef0f763e836bf94659b3a6080358373f1 upstream. 7 | 8 | By removing the PCI device reference from the structure and passing it 9 | as parameters to the interested functions, we can make quark_pci_info 10 | const. 11 | 12 | Signed-off-by: Jan Kiszka 13 | Reviewed-by: Andy Shevchenko 14 | Signed-off-by: David S. Miller 15 | --- 16 | .../net/ethernet/stmicro/stmmac/stmmac_pci.c | 23 +++++++++---------- 17 | 1 file changed, 11 insertions(+), 12 deletions(-) 18 | 19 | diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c 20 | index 3491e98bffc5..828d276748e3 100644 21 | --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c 22 | +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c 23 | @@ -42,17 +42,17 @@ struct stmmac_pci_dmi_data { 24 | }; 25 | 26 | struct stmmac_pci_info { 27 | - struct pci_dev *pdev; 28 | - int (*setup)(struct plat_stmmacenet_data *plat, 29 | - struct stmmac_pci_info *info); 30 | + int (*setup)(struct pci_dev *pdev, struct plat_stmmacenet_data *plat, 31 | + const struct stmmac_pci_info *info); 32 | struct stmmac_pci_dmi_data *dmi; 33 | }; 34 | 35 | -static int stmmac_pci_find_phy_addr(struct stmmac_pci_info *info) 36 | +static int stmmac_pci_find_phy_addr(struct pci_dev *pdev, 37 | + const struct stmmac_pci_info *info) 38 | { 39 | const char *name = dmi_get_system_info(DMI_BOARD_NAME); 40 | const char *asset_tag = dmi_get_system_info(DMI_BOARD_ASSET_TAG); 41 | - unsigned int func = PCI_FUNC(info->pdev->devfn); 42 | + unsigned int func = PCI_FUNC(pdev->devfn); 43 | struct stmmac_pci_dmi_data *dmi; 44 | 45 | /* 46 | @@ -96,17 +96,17 @@ static void stmmac_default_data(struct plat_stmmacenet_data *plat) 47 | plat->unicast_filter_entries = 1; 48 | } 49 | 50 | -static int quark_default_data(struct plat_stmmacenet_data *plat, 51 | - struct stmmac_pci_info *info) 52 | +static int quark_default_data(struct pci_dev *pdev, 53 | + struct plat_stmmacenet_data *plat, 54 | + const struct stmmac_pci_info *info) 55 | { 56 | - struct pci_dev *pdev = info->pdev; 57 | int ret; 58 | 59 | /* 60 | * Refuse to load the driver and register net device if MAC controller 61 | * does not connect to any PHY interface. 62 | */ 63 | - ret = stmmac_pci_find_phy_addr(info); 64 | + ret = stmmac_pci_find_phy_addr(pdev, info); 65 | if (ret < 0) 66 | return ret; 67 | 68 | @@ -165,7 +165,7 @@ static struct stmmac_pci_dmi_data quark_pci_dmi_data[] = { 69 | {} 70 | }; 71 | 72 | -static struct stmmac_pci_info quark_pci_info = { 73 | +static const struct stmmac_pci_info quark_pci_info = { 74 | .setup = quark_default_data, 75 | .dmi = quark_pci_dmi_data, 76 | }; 77 | @@ -227,9 +227,8 @@ static int stmmac_pci_probe(struct pci_dev *pdev, 78 | pci_set_master(pdev); 79 | 80 | if (info) { 81 | - info->pdev = pdev; 82 | if (info->setup) { 83 | - ret = info->setup(plat, info); 84 | + ret = info->setup(pdev, plat, info); 85 | if (ret) 86 | return ret; 87 | } 88 | -- 89 | 2.34.1 90 | 91 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/patches/0003-stmmac-pci-Make-stmmac_pci_find_phy_addr-truly-gener.patch: -------------------------------------------------------------------------------- 1 | From 5f7d7ce17cba1a1684f0d7262bdf2905ec52141b Mon Sep 17 00:00:00 2001 2 | From: Jan Kiszka 3 | Date: Thu, 22 Jun 2017 08:17:59 +0200 4 | Subject: [PATCH 03/32] stmmac: pci: Make stmmac_pci_find_phy_addr truly 5 | generic 6 | 7 | Commit c5f657e49c878756f21349f9e4b0f1c9631d5352 upstream. 8 | 9 | Move the special case for the early Galileo firmware into 10 | quark_default_setup. This allows to use stmmac_pci_find_phy_addr for 11 | non-quark cases. 12 | 13 | Signed-off-by: Jan Kiszka 14 | Reviewed-by: Andy Shevchenko 15 | Signed-off-by: David S. Miller 16 | --- 17 | .../net/ethernet/stmicro/stmmac/stmmac_pci.c | 20 ++++++++++++------- 18 | 1 file changed, 13 insertions(+), 7 deletions(-) 19 | 20 | diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c 21 | index a60059032dc6..19cf9607618a 100644 22 | --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c 23 | +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c 24 | @@ -55,12 +55,8 @@ static int stmmac_pci_find_phy_addr(struct pci_dev *pdev, 25 | unsigned int func = PCI_FUNC(pdev->devfn); 26 | struct stmmac_pci_dmi_data *dmi; 27 | 28 | - /* 29 | - * Galileo boards with old firmware don't support DMI. We always return 30 | - * 1 here, so at least first found MAC controller would be probed. 31 | - */ 32 | if (!name) 33 | - return 1; 34 | + return -ENODEV; 35 | 36 | for (dmi = info->dmi; dmi->name && *dmi->name; dmi++) { 37 | if (!strcmp(dmi->name, name) && dmi->func == func) { 38 | @@ -115,8 +111,18 @@ static int quark_default_data(struct pci_dev *pdev, 39 | * does not connect to any PHY interface. 40 | */ 41 | ret = stmmac_pci_find_phy_addr(pdev, info); 42 | - if (ret < 0) 43 | - return ret; 44 | + if (ret < 0) { 45 | + /* Return error to the caller on DMI enabled boards. */ 46 | + if (dmi_get_system_info(DMI_BOARD_NAME)) 47 | + return ret; 48 | + 49 | + /* 50 | + * Galileo boards with old firmware don't support DMI. We always 51 | + * use 1 here as PHY address, so at least the first found MAC 52 | + * controller would be probed. 53 | + */ 54 | + ret = 1; 55 | + } 56 | 57 | plat->bus_id = PCI_DEVID(pdev->bus->number, pdev->devfn); 58 | plat->phy_addr = ret; 59 | -- 60 | 2.34.1 61 | 62 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/patches/0006-stmmac-pci-Adjust-IOT2000-matching.patch: -------------------------------------------------------------------------------- 1 | From ba307656efb121266558ea9b4a13e4a01a8c151b Mon Sep 17 00:00:00 2001 2 | From: Su Bao Cheng 3 | Date: Fri, 12 Oct 2018 15:08:11 +0200 4 | Subject: [PATCH 06/32] stmmac: pci: Adjust IOT2000 matching 5 | 6 | Since there are more IOT2040 variants with identical hardware but 7 | different asset tags, the asset tag matching should be adjusted to 8 | support them. 9 | 10 | For the board name "SIMATIC IOT2000", currently there are 2 types of 11 | hardware, IOT2020 and IOT2040. The IOT2020 is identified by its unique 12 | asset tag. Match on it first. If we then match on the board name only, 13 | we will catch all IOT2040 variants. In the future there will be no other 14 | devices with the "SIMATIC IOT2000" DMI board name but different 15 | hardware. 16 | 17 | Signed-off-by: Su Bao Cheng 18 | Reviewed-by: Jan Kiszka 19 | --- 20 | drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 8 ++++++-- 21 | 1 file changed, 6 insertions(+), 2 deletions(-) 22 | 23 | diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c 24 | index 279a1355d75f..ac733d4d3ed4 100644 25 | --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c 26 | +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c 27 | @@ -149,11 +149,15 @@ static const struct dmi_system_id quark_pci_dmi[] = { 28 | }, 29 | .driver_data = (void *)&galileo_stmmac_dmi_data, 30 | }, 31 | + /* 32 | + * There are 2 types of SIMATIC IOT2000: IOT2020 and IOT2040. 33 | + * The asset tag "6ES7647-0AA00-0YA2" is only for IOT2020 which 34 | + * has only one pci network device while other asset tags are 35 | + * for IOT2040 which has two. 36 | + */ 37 | { 38 | .matches = { 39 | DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"), 40 | - DMI_EXACT_MATCH(DMI_BOARD_ASSET_TAG, 41 | - "6ES7647-0AA00-1YA2"), 42 | }, 43 | .driver_data = (void *)&iot2040_stmmac_dmi_data, 44 | }, 45 | -- 46 | 2.34.1 47 | 48 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/patches/0007-serial-8250_exar-Adjust-IOT2000-matching.patch: -------------------------------------------------------------------------------- 1 | From cf9622280c0454e1383584bfc8277f32fad9fa8a Mon Sep 17 00:00:00 2001 2 | From: Su Bao Cheng 3 | Date: Fri, 12 Oct 2018 15:12:37 +0200 4 | Subject: [PATCH 07/32] serial: 8250_exar: Adjust IOT2000 matching 5 | 6 | Since there are more IOT2040 variants with identical hardware but 7 | different asset tags, the asset tag matching should be adjusted to 8 | support them. 9 | 10 | As only the IOT2040 variants have the Exar chip on board, matching on 11 | their board name is enough. In the future there will be no other devices 12 | with the "SIMATIC IOT2000" DMI board name but different hardware. 13 | 14 | Signed-off-by: Su Bao Cheng 15 | Reviewed-by: Jan Kiszka 16 | --- 17 | drivers/tty/serial/8250/8250_exar.c | 7 +++++-- 18 | 1 file changed, 5 insertions(+), 2 deletions(-) 19 | 20 | diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c 21 | index be82707d6cb8..3eb3a7674a0f 100644 22 | --- a/drivers/tty/serial/8250/8250_exar.c 23 | +++ b/drivers/tty/serial/8250/8250_exar.c 24 | @@ -338,12 +338,15 @@ static const struct exar8250_platform iot2040_platform = { 25 | .register_gpio = iot2040_register_gpio, 26 | }; 27 | 28 | +/* 29 | + * For SIMATIC IOT2000, only IOT2040 and its variants have the Exar device, 30 | + * IOT2020 doesn't have. Therefore it is sufficient to match on the common 31 | + * board name after the device was found. 32 | + */ 33 | static const struct dmi_system_id exar_platforms[] = { 34 | { 35 | .matches = { 36 | DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"), 37 | - DMI_EXACT_MATCH(DMI_BOARD_ASSET_TAG, 38 | - "6ES7647-0AA00-1YA2"), 39 | }, 40 | .driver_data = (void *)&iot2040_platform, 41 | }, 42 | -- 43 | 2.34.1 44 | 45 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/patches/0008-mfd-intel_quark_i2c_gpio-Adjust-IOT2000-matching.patch: -------------------------------------------------------------------------------- 1 | From 206982b7aaf696b874b31d1c4557b36882a5e636 Mon Sep 17 00:00:00 2001 2 | From: Su Bao Cheng 3 | Date: Fri, 12 Oct 2018 15:05:07 +0200 4 | Subject: [PATCH 08/32] mfd: intel_quark_i2c_gpio: Adjust IOT2000 matching 5 | 6 | Since there are more IOT2040 variants with identical hardware but 7 | different asset tags, the asset tag matching should be adjusted to 8 | support them. 9 | 10 | For the board name "SIMATIC IOT2000", currently there are 2 types of 11 | hardware, IOT2020 and IOT2040. Both are identical regarding the 12 | intel_quark_i2c_gpio. In the future there will be no other devices with 13 | the "SIMATIC IOT2000" DMI board name but different hardware. So remove 14 | the asset tag matching from this driver. 15 | 16 | Signed-off-by: Su Bao Cheng 17 | Reviewed-by: Jan Kiszka 18 | --- 19 | drivers/mfd/intel_quark_i2c_gpio.c | 10 ---------- 20 | 1 file changed, 10 deletions(-) 21 | 22 | diff --git a/drivers/mfd/intel_quark_i2c_gpio.c b/drivers/mfd/intel_quark_i2c_gpio.c 23 | index 1c09604978d3..ad70a058bea8 100644 24 | --- a/drivers/mfd/intel_quark_i2c_gpio.c 25 | +++ b/drivers/mfd/intel_quark_i2c_gpio.c 26 | @@ -76,16 +76,6 @@ static const struct dmi_system_id dmi_platform_info[] = { 27 | { 28 | .matches = { 29 | DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"), 30 | - DMI_EXACT_MATCH(DMI_BOARD_ASSET_TAG, 31 | - "6ES7647-0AA00-0YA2"), 32 | - }, 33 | - .driver_data = (void *)400000, 34 | - }, 35 | - { 36 | - .matches = { 37 | - DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"), 38 | - DMI_EXACT_MATCH(DMI_BOARD_ASSET_TAG, 39 | - "6ES7647-0AA00-1YA2"), 40 | }, 41 | .driver_data = (void *)400000, 42 | }, 43 | -- 44 | 2.34.1 45 | 46 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/patches/0009-gpio-sch-use-gpiochip-data-pointer.patch: -------------------------------------------------------------------------------- 1 | From 3d2fa867cc51f2f6130b122f556a92c19ddbabab Mon Sep 17 00:00:00 2001 2 | From: Linus Walleij 3 | Date: Mon, 7 Dec 2015 14:21:49 +0100 4 | Subject: [PATCH 09/32] gpio: sch: use gpiochip data pointer 5 | 6 | This makes the driver use the data pointer added to the gpio_chip 7 | to store a pointer to the state container instead of relying on 8 | container_of(). 9 | 10 | Cc: Chang Rebecca Swee Fun 11 | Acked-by: Mika Westerberg 12 | Signed-off-by: Linus Walleij 13 | --- 14 | drivers/gpio/gpio-sch.c | 14 ++++++-------- 15 | 1 file changed, 6 insertions(+), 8 deletions(-) 16 | 17 | diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c 18 | index b72906f5b999..23907fc080a3 100644 19 | --- a/drivers/gpio/gpio-sch.c 20 | +++ b/drivers/gpio/gpio-sch.c 21 | @@ -41,8 +41,6 @@ struct sch_gpio { 22 | unsigned short resume_base; 23 | }; 24 | 25 | -#define to_sch_gpio(gc) container_of(gc, struct sch_gpio, chip) 26 | - 27 | static unsigned sch_gpio_offset(struct sch_gpio *sch, unsigned gpio, 28 | unsigned reg) 29 | { 30 | @@ -65,7 +63,7 @@ static unsigned sch_gpio_bit(struct sch_gpio *sch, unsigned gpio) 31 | 32 | static int sch_gpio_reg_get(struct gpio_chip *gc, unsigned gpio, unsigned reg) 33 | { 34 | - struct sch_gpio *sch = to_sch_gpio(gc); 35 | + struct sch_gpio *sch = gpiochip_get_data(gc); 36 | unsigned short offset, bit; 37 | u8 reg_val; 38 | 39 | @@ -80,7 +78,7 @@ static int sch_gpio_reg_get(struct gpio_chip *gc, unsigned gpio, unsigned reg) 40 | static void sch_gpio_reg_set(struct gpio_chip *gc, unsigned gpio, unsigned reg, 41 | int val) 42 | { 43 | - struct sch_gpio *sch = to_sch_gpio(gc); 44 | + struct sch_gpio *sch = gpiochip_get_data(gc); 45 | unsigned short offset, bit; 46 | u8 reg_val; 47 | 48 | @@ -97,7 +95,7 @@ static void sch_gpio_reg_set(struct gpio_chip *gc, unsigned gpio, unsigned reg, 49 | 50 | static int sch_gpio_direction_in(struct gpio_chip *gc, unsigned gpio_num) 51 | { 52 | - struct sch_gpio *sch = to_sch_gpio(gc); 53 | + struct sch_gpio *sch = gpiochip_get_data(gc); 54 | 55 | spin_lock(&sch->lock); 56 | sch_gpio_reg_set(gc, gpio_num, GIO, 1); 57 | @@ -112,7 +110,7 @@ static int sch_gpio_get(struct gpio_chip *gc, unsigned gpio_num) 58 | 59 | static void sch_gpio_set(struct gpio_chip *gc, unsigned gpio_num, int val) 60 | { 61 | - struct sch_gpio *sch = to_sch_gpio(gc); 62 | + struct sch_gpio *sch = gpiochip_get_data(gc); 63 | 64 | spin_lock(&sch->lock); 65 | sch_gpio_reg_set(gc, gpio_num, GLV, val); 66 | @@ -122,7 +120,7 @@ static void sch_gpio_set(struct gpio_chip *gc, unsigned gpio_num, int val) 67 | static int sch_gpio_direction_out(struct gpio_chip *gc, unsigned gpio_num, 68 | int val) 69 | { 70 | - struct sch_gpio *sch = to_sch_gpio(gc); 71 | + struct sch_gpio *sch = gpiochip_get_data(gc); 72 | 73 | spin_lock(&sch->lock); 74 | sch_gpio_reg_set(gc, gpio_num, GIO, 0); 75 | @@ -217,7 +215,7 @@ static int sch_gpio_probe(struct platform_device *pdev) 76 | 77 | platform_set_drvdata(pdev, sch); 78 | 79 | - return gpiochip_add(&sch->chip); 80 | + return gpiochip_add_data(&sch->chip, sch); 81 | } 82 | 83 | static int sch_gpio_remove(struct platform_device *pdev) 84 | -- 85 | 2.34.1 86 | 87 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/patches/0010-gpio-sch-Use-devm_gpiochip_add_data-for-gpio-registr.patch: -------------------------------------------------------------------------------- 1 | From 51f41c2758d17b514033f5462d0495a17a299de7 Mon Sep 17 00:00:00 2001 2 | From: Laxman Dewangan 3 | Date: Mon, 22 Feb 2016 17:43:28 +0530 4 | Subject: [PATCH 10/32] gpio: sch: Use devm_gpiochip_add_data() for gpio 5 | registration 6 | 7 | Use devm_gpiochip_add_data() for GPIO registration and remove the 8 | need of driver callback .remove. 9 | 10 | Signed-off-by: Laxman Dewangan 11 | --- 12 | drivers/gpio/gpio-sch.c | 11 +---------- 13 | 1 file changed, 1 insertion(+), 10 deletions(-) 14 | 15 | diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c 16 | index 23907fc080a3..bbf9b2a34da8 100644 17 | --- a/drivers/gpio/gpio-sch.c 18 | +++ b/drivers/gpio/gpio-sch.c 19 | @@ -215,15 +215,7 @@ static int sch_gpio_probe(struct platform_device *pdev) 20 | 21 | platform_set_drvdata(pdev, sch); 22 | 23 | - return gpiochip_add_data(&sch->chip, sch); 24 | -} 25 | - 26 | -static int sch_gpio_remove(struct platform_device *pdev) 27 | -{ 28 | - struct sch_gpio *sch = platform_get_drvdata(pdev); 29 | - 30 | - gpiochip_remove(&sch->chip); 31 | - return 0; 32 | + return devm_gpiochip_add_data(&pdev->dev, &sch->chip, sch); 33 | } 34 | 35 | static struct platform_driver sch_gpio_driver = { 36 | @@ -231,7 +223,6 @@ static struct platform_driver sch_gpio_driver = { 37 | .name = "sch_gpio", 38 | }, 39 | .probe = sch_gpio_probe, 40 | - .remove = sch_gpio_remove, 41 | }; 42 | 43 | module_platform_driver(sch_gpio_driver); 44 | -- 45 | 2.34.1 46 | 47 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/patches/0012-gpio-sch-Implement-.get_direction.patch: -------------------------------------------------------------------------------- 1 | From 162c9be631a532dc54e902655ca4f00158c6915f Mon Sep 17 00:00:00 2001 2 | From: Linus Walleij 3 | Date: Wed, 27 Jun 2018 10:39:31 +0200 4 | Subject: [PATCH 12/32] gpio: sch: Implement .get_direction() 5 | 6 | It's pretty simple to implement the .get_direction() for this 7 | chip, so let's just do it. 8 | 9 | Cc: Denis Turischev 10 | Cc: Daniel Krueger 11 | Acked-by: Mika Westerberg 12 | Signed-off-by: Linus Walleij 13 | --- 14 | drivers/gpio/gpio-sch.c | 8 ++++++++ 15 | 1 file changed, 8 insertions(+) 16 | 17 | diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c 18 | index 5f72b177fc80..6715828c3940 100644 19 | --- a/drivers/gpio/gpio-sch.c 20 | +++ b/drivers/gpio/gpio-sch.c 21 | @@ -138,6 +138,13 @@ static int sch_gpio_direction_out(struct gpio_chip *gc, unsigned gpio_num, 22 | return 0; 23 | } 24 | 25 | +static int sch_gpio_get_direction(struct gpio_chip *gc, unsigned gpio_num) 26 | +{ 27 | + struct sch_gpio *sch = gpiochip_get_data(gc); 28 | + 29 | + return sch_gpio_reg_get(sch, gpio_num, GIO); 30 | +} 31 | + 32 | static struct gpio_chip sch_gpio_chip = { 33 | .label = "sch_gpio", 34 | .owner = THIS_MODULE, 35 | @@ -145,6 +152,7 @@ static struct gpio_chip sch_gpio_chip = { 36 | .get = sch_gpio_get, 37 | .direction_output = sch_gpio_direction_out, 38 | .set = sch_gpio_set, 39 | + .get_direction = sch_gpio_get_direction, 40 | }; 41 | 42 | static int sch_gpio_probe(struct platform_device *pdev) 43 | -- 44 | 2.34.1 45 | 46 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/patches/0014-iot2000-hack-Work-around-DSDT-mistake.patch: -------------------------------------------------------------------------------- 1 | From cf52d45aaa12edd92350deb7d82226b3c7834400 Mon Sep 17 00:00:00 2001 2 | From: Jan Kiszka 3 | Date: Thu, 25 May 2017 11:09:42 +0200 4 | Subject: [PATCH 14/32] iot2000-hack: Work around DSDT mistake 5 | 6 | Until we have a new firmware revision, fix up the incorrect GPIO 7 | interrupt pin in software. 8 | 9 | Nothing for upstream. 10 | 11 | Signed-off-by: Jan Kiszka 12 | --- 13 | drivers/gpio/gpiolib-acpi.c | 8 ++++++++ 14 | 1 file changed, 8 insertions(+) 15 | 16 | diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c 17 | index 16a7b6816744..304855b3ecb8 100644 18 | --- a/drivers/gpio/gpiolib-acpi.c 19 | +++ b/drivers/gpio/gpiolib-acpi.c 20 | @@ -10,6 +10,7 @@ 21 | * published by the Free Software Foundation. 22 | */ 23 | 24 | +#include 25 | #include 26 | #include 27 | #include 28 | @@ -408,6 +409,13 @@ static int acpi_find_gpio(struct acpi_resource *ares, void *data) 29 | if (pin_index >= agpio->pin_table_length) 30 | return 1; 31 | 32 | + if (!strcmp(dmi_get_system_info(DMI_BOARD_NAME), 33 | + "SIMATIC IOT2000") && 34 | + !strcmp(agpio->resource_source.string_ptr, 35 | + "\\_SB.PCI0.GIP0.GPO") && 36 | + agpio->pin_table[pin_index] == 9) 37 | + agpio->pin_table[pin_index] = 1; 38 | + 39 | lookup->desc = acpi_get_gpiod(agpio->resource_source.string_ptr, 40 | agpio->pin_table[pin_index]); 41 | lookup->info.gpioint = 42 | -- 43 | 2.34.1 44 | 45 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/patches/0015-iot2000-hack-Adjust-pca9685-gpio-base-for-legacy-com.patch: -------------------------------------------------------------------------------- 1 | From b11e03e512bb2ea41752c432db51cd5cd6874281 Mon Sep 17 00:00:00 2001 2 | From: Jan Kiszka 3 | Date: Thu, 25 May 2017 13:05:12 +0200 4 | Subject: [PATCH 15/32] iot2000-hack: Adjust pca9685-gpio base for legacy 5 | compatibility 6 | 7 | mraa and the Arduino runtime expect this. 8 | 9 | Not for upstream. 10 | 11 | Signed-off-by: Jan Kiszka 12 | --- 13 | drivers/pwm/pwm-pca9685.c | 6 +++++- 14 | 1 file changed, 5 insertions(+), 1 deletion(-) 15 | 16 | diff --git a/drivers/pwm/pwm-pca9685.c b/drivers/pwm/pwm-pca9685.c 17 | index d2b92e940e38..611b9263a896 100644 18 | --- a/drivers/pwm/pwm-pca9685.c 19 | +++ b/drivers/pwm/pwm-pca9685.c 20 | @@ -19,6 +19,7 @@ 21 | * this program. If not, see . 22 | */ 23 | 24 | +#include 25 | #include 26 | #include 27 | #include 28 | @@ -222,7 +223,10 @@ static int pca9685_pwm_gpio_probe(struct pca9685 *pca) 29 | pca->gpio.direction_output = pca9685_pwm_gpio_direction_output; 30 | pca->gpio.get = pca9685_pwm_gpio_get; 31 | pca->gpio.set = pca9685_pwm_gpio_set; 32 | - pca->gpio.base = -1; 33 | + if (!strcmp(dmi_get_system_info(DMI_BOARD_NAME), "SIMATIC IOT2000")) 34 | + pca->gpio.base = 64; 35 | + else 36 | + pca->gpio.base = -1; 37 | pca->gpio.ngpio = PCA9685_MAXCHAN; 38 | pca->gpio.can_sleep = true; 39 | 40 | -- 41 | 2.34.1 42 | 43 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/patches/0018-iot2000-hack-pwm-pca-9685-Provide-chip-level-pwm_per.patch: -------------------------------------------------------------------------------- 1 | From 0fc6db3ce88b642be1c4e320e2f66ee539befdb6 Mon Sep 17 00:00:00 2001 2 | From: Jan Kiszka 3 | Date: Fri, 17 Nov 2017 20:25:54 +0100 4 | Subject: [PATCH 18/32] iot2000-hack: pwm: pca-9685: Provide chip-level 5 | pwm_period attribute 6 | 7 | Arduino runtime relies on this path to program the PWM period, rather 8 | than doing this via the upstream kernel API which is per channel. 9 | 10 | Another one not for upstream. 11 | 12 | Signed-off-by: Jan Kiszka 13 | --- 14 | drivers/pwm/pwm-pca9685.c | 59 +++++++++++++++++++++++++++++++++++++++ 15 | 1 file changed, 59 insertions(+) 16 | 17 | diff --git a/drivers/pwm/pwm-pca9685.c b/drivers/pwm/pwm-pca9685.c 18 | index 611b9263a896..ce765f903714 100644 19 | --- a/drivers/pwm/pwm-pca9685.c 20 | +++ b/drivers/pwm/pwm-pca9685.c 21 | @@ -444,6 +444,54 @@ static const struct pwm_ops pca9685_pwm_ops = { 22 | .owner = THIS_MODULE, 23 | }; 24 | 25 | +static ssize_t pwm_period_show(struct device *parent, 26 | + struct device_attribute *attr, 27 | + char *buf) 28 | +{ 29 | + struct pwm_chip *chip = dev_get_drvdata(parent); 30 | + 31 | + return sprintf(buf, "%u\n", to_pca(chip)->period_ns); 32 | +} 33 | + 34 | +static ssize_t pwm_period_store(struct device *parent, 35 | + struct device_attribute *attr, 36 | + const char *buf, size_t size) 37 | +{ 38 | + struct pwm_chip *chip = dev_get_drvdata(parent); 39 | + struct pca9685 *pca = to_pca(chip); 40 | + int old_period_ns = pca->period_ns; 41 | + unsigned long long duty_scale, new_duty_ns; 42 | + unsigned int val, channel; 43 | + struct pwm_device *pwm; 44 | + int ret; 45 | + 46 | + ret = kstrtouint(buf, 0, &val); 47 | + if (ret) 48 | + return ret; 49 | + 50 | + for (channel = 0; channel < PCA9685_MAXCHAN; channel++) { 51 | + pwm = &chip->pwms[channel]; 52 | + 53 | + if (pca9685_pwm_is_gpio(pca, pwm)) 54 | + continue; 55 | + 56 | + /* Scale the rise time to maintain duty cycle */ 57 | + duty_scale = val; 58 | + duty_scale *= 1000000; 59 | + do_div(duty_scale, old_period_ns); 60 | + new_duty_ns = duty_scale * pwm_get_duty_cycle(pwm); 61 | + do_div(new_duty_ns, 1000000); 62 | + /* Update the duty_cycle */ 63 | + ret = pwm_config(pwm, (int)new_duty_ns, val); 64 | + if (ret) 65 | + return ret; 66 | + } 67 | + 68 | + return size; 69 | +} 70 | + 71 | +static DEVICE_ATTR_RW(pwm_period); 72 | + 73 | static const struct regmap_config pca9685_regmap_i2c_config = { 74 | .reg_bits = 8, 75 | .val_bits = 8, 76 | @@ -504,8 +552,17 @@ static int pca9685_pwm_probe(struct i2c_client *client, 77 | if (ret < 0) 78 | return ret; 79 | 80 | + ret = sysfs_create_file(&pca->chip.dev->kobj, 81 | + &dev_attr_pwm_period.attr); 82 | + if (ret < 0) { 83 | + pwmchip_remove(&pca->chip); 84 | + return ret; 85 | + } 86 | + 87 | ret = pca9685_pwm_gpio_probe(pca); 88 | if (ret < 0) { 89 | + sysfs_remove_file(&pca->chip.dev->kobj, 90 | + &dev_attr_pwm_period.attr); 91 | pwmchip_remove(&pca->chip); 92 | return ret; 93 | } 94 | @@ -526,6 +583,8 @@ static int pca9685_pwm_remove(struct i2c_client *client) 95 | struct pca9685 *pca = i2c_get_clientdata(client); 96 | int ret; 97 | 98 | + sysfs_remove_file(&pca->chip.dev->kobj, &dev_attr_pwm_period.attr); 99 | + 100 | ret = pwmchip_remove(&pca->chip); 101 | if (ret) 102 | return ret; 103 | -- 104 | 2.34.1 105 | 106 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/patches/0022-random-remove-stale-maybe_reseed_primary_crng.patch: -------------------------------------------------------------------------------- 1 | From 306ca3fda343b97a0097dbbd063e4a376626cd1b Mon Sep 17 00:00:00 2001 2 | From: Stephan Mueller 3 | Date: Thu, 15 Dec 2016 12:42:33 +0100 4 | Subject: [PATCH 22/32] random: remove stale maybe_reseed_primary_crng 5 | 6 | The function maybe_reseed_primary_crng is not used anywhere and thus can 7 | be removed. 8 | 9 | Signed-off-by: Stephan Mueller 10 | Signed-off-by: Theodore Ts'o 11 | --- 12 | drivers/char/random.c | 7 ------- 13 | 1 file changed, 7 deletions(-) 14 | 15 | diff --git a/drivers/char/random.c b/drivers/char/random.c 16 | index 80be6054e0a4..54f554161b51 100644 17 | --- a/drivers/char/random.c 18 | +++ b/drivers/char/random.c 19 | @@ -853,13 +853,6 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r) 20 | spin_unlock_irqrestore(&primary_crng.lock, flags); 21 | } 22 | 23 | -static inline void maybe_reseed_primary_crng(void) 24 | -{ 25 | - if (crng_init > 2 && 26 | - time_after(jiffies, primary_crng.init_time + CRNG_RESEED_INTERVAL)) 27 | - crng_reseed(&primary_crng, &input_pool); 28 | -} 29 | - 30 | static inline void crng_wait_ready(void) 31 | { 32 | wait_event_interruptible(crng_init_wait, crng_ready()); 33 | -- 34 | 2.34.1 35 | 36 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/patches/0028-random-fix-crng_ready-test.patch: -------------------------------------------------------------------------------- 1 | From eaea9f187b05f364b281ffa7ced5ddc3d85a6347 Mon Sep 17 00:00:00 2001 2 | From: Theodore Ts'o 3 | Date: Wed, 11 Apr 2018 13:27:52 -0400 4 | Subject: [PATCH 28/32] random: fix crng_ready() test 5 | 6 | The crng_init variable has three states: 7 | 8 | 0: The CRNG is not initialized at all 9 | 1: The CRNG has a small amount of entropy, hopefully good enough for 10 | early-boot, non-cryptographical use cases 11 | 2: The CRNG is fully initialized and we are sure it is safe for 12 | cryptographic use cases. 13 | 14 | The crng_ready() function should only return true once we are in the 15 | last state. This addresses CVE-2018-1108. 16 | 17 | Reported-by: Jann Horn 18 | Fixes: e192be9d9a30 ("random: replace non-blocking pool...") 19 | Cc: stable@kernel.org # 4.8+ 20 | Signed-off-by: Theodore Ts'o 21 | Reviewed-by: Jann Horn 22 | --- 23 | drivers/char/random.c | 10 +++++----- 24 | 1 file changed, 5 insertions(+), 5 deletions(-) 25 | 26 | diff --git a/drivers/char/random.c b/drivers/char/random.c 27 | index 2d6f57c7ee81..d50f71b3b4ea 100644 28 | --- a/drivers/char/random.c 29 | +++ b/drivers/char/random.c 30 | @@ -435,7 +435,7 @@ struct crng_state primary_crng = { 31 | * its value (from 0->1->2). 32 | */ 33 | static int crng_init = 0; 34 | -#define crng_ready() (likely(crng_init > 0)) 35 | +#define crng_ready() (likely(crng_init > 1)) 36 | static int crng_init_cnt = 0; 37 | #define CRNG_INIT_CNT_THRESH (2*CHACHA20_KEY_SIZE) 38 | static void _extract_crng(struct crng_state *crng, 39 | @@ -803,7 +803,7 @@ static int crng_fast_load(const char *cp, size_t len) 40 | 41 | if (!spin_trylock_irqsave(&primary_crng.lock, flags)) 42 | return 0; 43 | - if (crng_ready()) { 44 | + if (crng_init != 0) { 45 | spin_unlock_irqrestore(&primary_crng.lock, flags); 46 | return 0; 47 | } 48 | @@ -865,7 +865,7 @@ static void _extract_crng(struct crng_state *crng, 49 | { 50 | unsigned long v, flags; 51 | 52 | - if (crng_init > 1 && 53 | + if (crng_ready() && 54 | time_after(jiffies, crng->init_time + CRNG_RESEED_INTERVAL)) 55 | crng_reseed(crng, crng == &primary_crng ? &input_pool : NULL); 56 | spin_lock_irqsave(&crng->lock, flags); 57 | @@ -1146,7 +1146,7 @@ void add_interrupt_randomness(int irq, int irq_flags) 58 | fast_mix(fast_pool); 59 | add_interrupt_bench(cycles); 60 | 61 | - if (!crng_ready()) { 62 | + if (unlikely(crng_init == 0)) { 63 | if ((fast_pool->count >= 64) && 64 | crng_fast_load((char *) fast_pool->pool, 65 | sizeof(fast_pool->pool))) { 66 | @@ -2201,7 +2201,7 @@ void add_hwgenerator_randomness(const char *buffer, size_t count, 67 | { 68 | struct entropy_store *poolp = &input_pool; 69 | 70 | - if (!crng_ready()) { 71 | + if (unlikely(crng_init == 0)) { 72 | crng_fast_load(buffer, count); 73 | return; 74 | } 75 | -- 76 | 2.34.1 77 | 78 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/patches/0031-random-fix-soft-lockup-when-trying-to-read-from-an-u.patch: -------------------------------------------------------------------------------- 1 | From c74cb5fd0d89a37c3e6bd42bc3fcff9dd779ed7d Mon Sep 17 00:00:00 2001 2 | From: Theodore Ts'o 3 | Date: Wed, 22 May 2019 12:02:16 -0400 4 | Subject: [PATCH 31/32] random: fix soft lockup when trying to read from an 5 | uninitialized blocking pool 6 | 7 | Fixes: eb9d1bf079bb: "random: only read from /dev/random after its pool has received 128 bits" 8 | Reported-by: kernel test robot 9 | Signed-off-by: Theodore Ts'o 10 | --- 11 | drivers/char/random.c | 16 +++++++++++++--- 12 | 1 file changed, 13 insertions(+), 3 deletions(-) 13 | 14 | diff --git a/drivers/char/random.c b/drivers/char/random.c 15 | index 0c72ec3eaf3b..6529a2043fde 100644 16 | --- a/drivers/char/random.c 17 | +++ b/drivers/char/random.c 18 | @@ -702,8 +702,11 @@ retry: 19 | if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig) 20 | goto retry; 21 | 22 | - if (has_initialized) 23 | + if (has_initialized) { 24 | r->initialized = 1; 25 | + wake_up_interruptible(&random_read_wait); 26 | + kill_fasync(&fasync, SIGIO, POLL_IN); 27 | + } 28 | 29 | trace_credit_entropy_bits(r->name, nbits, 30 | entropy_count >> ENTROPY_SHIFT, _RET_IP_); 31 | @@ -719,6 +722,13 @@ retry: 32 | entropy_bits = r->entropy_count >> ENTROPY_SHIFT; 33 | } 34 | 35 | + /* initialize the blocking pool if necessary */ 36 | + if (entropy_bits >= random_read_wakeup_bits && 37 | + !other->initialized) { 38 | + schedule_work(&other->push_work); 39 | + return; 40 | + } 41 | + 42 | /* should we wake readers? */ 43 | if (entropy_bits >= random_read_wakeup_bits) { 44 | wake_up_interruptible(&random_read_wait); 45 | @@ -1795,8 +1805,8 @@ _random_read(int nonblock, char __user *buf, size_t nbytes) 46 | return -EAGAIN; 47 | 48 | wait_event_interruptible(random_read_wait, 49 | - ENTROPY_BITS(&input_pool) >= 50 | - random_read_wakeup_bits); 51 | + blocking_pool.initialized && 52 | + (ENTROPY_BITS(&input_pool) >= random_read_wakeup_bits)); 53 | if (signal_pending(current)) 54 | return -ERESTARTSYS; 55 | } 56 | -- 57 | 2.34.1 58 | 59 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/patches/rt-0001-spi-pca2xx-pci-Allow-MSI.patch: -------------------------------------------------------------------------------- 1 | From 3e04b76fef134ae25191d8c38759e0aa3da67ebd Mon Sep 17 00:00:00 2001 2 | From: Jan Kiszka 3 | Date: Mon, 26 Sep 2016 08:52:49 +0200 4 | Subject: [PATCH 1/2] spi: pca2xx-pci: Allow MSI 5 | 6 | Backport of 64e02cb0bdfc7cef0a01e2ad4d567fdc0a74450e upstream. 7 | 8 | Now that the core is ready for edge-triggered interrupts, we can safely 9 | allow the PCI versions that provide this to enable the feature and, 10 | thus, have less shared interrupts. 11 | 12 | Signed-off-by: Jan Kiszka 13 | --- 14 | drivers/spi/spi-pxa2xx-pci.c | 6 +++++- 15 | 1 file changed, 5 insertions(+), 1 deletion(-) 16 | 17 | diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c 18 | index ac0658ead1b9..0a9be3b6538a 100644 19 | --- a/drivers/spi/spi-pxa2xx-pci.c 20 | +++ b/drivers/spi/spi-pxa2xx-pci.c 21 | @@ -156,10 +156,14 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, 22 | dev_err(&dev->dev, "failed to ioremap() registers\n"); 23 | return -EIO; 24 | } 25 | - ssp->irq = dev->irq; 26 | ssp->port_id = (c->port_id >= 0) ? c->port_id : dev->devfn; 27 | ssp->type = c->type; 28 | 29 | + pci_set_master(dev); 30 | + 31 | + pci_enable_msi(dev); 32 | + ssp->irq = dev->irq; 33 | + 34 | snprintf(buf, sizeof(buf), "pxa2xx-spi.%d", ssp->port_id); 35 | ssp->clk = clk_register_fixed_rate(&dev->dev, buf , NULL, 36 | CLK_IS_ROOT, c->max_clk_rate); 37 | -- 38 | 2.25.1 39 | 40 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-kernel/linux/patches/rt-0002-gpio-dwapb-Work-around-RT-full-s-enforced-IRQ-thread.patch: -------------------------------------------------------------------------------- 1 | From 752f1ba7c76e3ee4ba26b4775b2705531bc1c9b6 Mon Sep 17 00:00:00 2001 2 | From: Jan Kiszka 3 | Date: Wed, 3 Jan 2018 15:32:56 +0100 4 | Subject: [PATCH 2/2] gpio: dwapb: Work around RT-full's enforced IRQ threading 5 | side effects 6 | 7 | Under RT-full, dwapb_irq_handler will run in a threaded IRQ. However, 8 | generic_handle_irq expect us to call it with IRQs disabled. 9 | Documentation/gpio/driver.txt suggest to use fake raw spinlock around 10 | generic_handle_irq in order to call the latter with interrupts off. 11 | 12 | Signed-off-by: Jan Kiszka 13 | --- 14 | drivers/gpio/gpio-dwapb.c | 6 ++++++ 15 | 1 file changed, 6 insertions(+) 16 | 17 | diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c 18 | index fcd5b0acfc72..dad75d594f76 100644 19 | --- a/drivers/gpio/gpio-dwapb.c 20 | +++ b/drivers/gpio/gpio-dwapb.c 21 | @@ -81,6 +81,7 @@ struct dwapb_gpio { 22 | struct dwapb_gpio_port *ports; 23 | unsigned int nr_ports; 24 | struct irq_domain *domain; 25 | + raw_spinlock_t wa_rt_lock; 26 | }; 27 | 28 | static inline struct dwapb_gpio_port * 29 | @@ -135,8 +136,11 @@ static u32 dwapb_do_irq(struct dwapb_gpio *gpio) 30 | while (irq_status) { 31 | int hwirq = fls(irq_status) - 1; 32 | int gpio_irq = irq_find_mapping(gpio->domain, hwirq); 33 | + unsigned long wa_flags; 34 | 35 | + raw_spin_lock_irqsave(&gpio->wa_rt_lock, wa_flags); 36 | generic_handle_irq(gpio_irq); 37 | + raw_spin_unlock_irqrestore(&gpio->wa_rt_lock, wa_flags); 38 | irq_status &= ~BIT(hwirq); 39 | 40 | if ((irq_get_trigger_type(gpio_irq) & IRQ_TYPE_SENSE_MASK) 41 | @@ -541,6 +545,8 @@ static int dwapb_gpio_probe(struct platform_device *pdev) 42 | if (!gpio) 43 | return -ENOMEM; 44 | 45 | + raw_spin_lock_init(&gpio->wa_rt_lock); 46 | + 47 | gpio->dev = &pdev->dev; 48 | gpio->nr_ports = pdata->nports; 49 | 50 | -- 51 | 2.25.1 52 | 53 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-multimedia/ffmpeg/ffmpeg_%.bbappend: -------------------------------------------------------------------------------- 1 | def cpu(d): 2 | return "i586" 3 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/recipes-tools/switchmode/switchmode_0.1.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Tool to switch between the com port modes" 2 | LICENSE = "MIT" 3 | LIC_FILES_CHKSUM = "file://${IOT2000_MIT_LICENSE};md5=838c366f69b72c5df05c96dff79b35f2" 4 | 5 | SRC_URI = "file://switchmode.c" 6 | 7 | S = "${WORKDIR}" 8 | INSTDIR = "/usr/bin/" 9 | 10 | FILES_${PN} = "${INSTDIR}*" 11 | 12 | do_compile() { 13 | ${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/switchmode.c -o switchserialmode 14 | } 15 | 16 | do_install() { 17 | install -d ${D}${INSTDIR} 18 | install -m 755 ${WORKDIR}/switchserialmode ${D}${INSTDIR} 19 | } 20 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/scripts/lib/wic/canned-wks/common.iot2000.wks.footer.inc: -------------------------------------------------------------------------------- 1 | bootloader --ptable gpt --append="rootwait console=ttyS1,115200n8 earlyprintk initrd=acpi-upgrades-iot2000.cpio" 2 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/scripts/lib/wic/canned-wks/common.iot2000.wks.header.inc: -------------------------------------------------------------------------------- 1 | # short-description: Create an IOT2000 disk image 2 | # long-description: Creates a partitioned EFI disk image for the SIMATIC IOT2000 3 | # that the user can directly dd to boot media. 4 | 5 | part --source efibootguard-efi --size 32 --extra-space 0 --overhead-factor 1 --ondisk mmcblk0 --label efi --part-type=EF00 --align 1024 6 | part --source efibootguard-boot --size 32 --extra-space 0 --overhead-factor 1 --ondisk mmcblk0 --label boot0 --align 1024 --part-type=0700 --sourceparams "watchdog=60,revision=2,initrd=acpi-upgrades-iot2000.cpio" 7 | -------------------------------------------------------------------------------- /meta-iot2000-bsp/scripts/lib/wic/canned-wks/wic-image.iot2000.wks: -------------------------------------------------------------------------------- 1 | # short-description: Create an iot2000 example disk image 2 | # long-description: Creates a partitioned EFI disk image for the iot2000, 3 | # using efibootguard, that the user can directly dd to boot media. 4 | 5 | include common.iot2000.wks.header.inc 6 | 7 | part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label platform --align 1024 8 | 9 | include common.iot2000.wks.footer.inc 10 | -------------------------------------------------------------------------------- /meta-iot2000-example/COPYING.MIT: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a copy 2 | of this software and associated documentation files (the "Software"), to deal 3 | in the Software without restriction, including without limitation the rights 4 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5 | copies of the Software, and to permit persons to whom the Software is 6 | furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in 9 | all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17 | THE SOFTWARE. 18 | -------------------------------------------------------------------------------- /meta-iot2000-example/README.SWUPDATE.md: -------------------------------------------------------------------------------- 1 | # Example for efibootguard + SWUpdate support with meta-iot2000 2 | 3 | [SWUpdate](https://github.com/sbabic/swupdate) is a software that supports 4 | firmware and/or software updates targeting embedded devices. 5 | 6 | It can be run as a stand-alone server in foreground or as a daemon listening 7 | for connections via ethernet or IPC. Different backends can be configured to 8 | support other 3rd party software to provide the update artifacts. These are 9 | then pulled by SWUpdate to update the system. 10 | The new boot loader EFI Boot Guard will take care that unsuccessful firmware 11 | updates will be rolled back so that the system is not bricked. 12 | 13 | To build the image, the kas tool is utilized. 14 | 15 | The [kas](https://pypi.python.org/pypi/kas) recipes in 16 | 17 | ``` 18 | meta-iot2000/meta-iot2000-example/kas-update.yml 19 | ``` 20 | 21 | build the base image as well as an update artifact without and with a 22 | real-time kernel respectively, ready to be fed to `SWUpdate`. The recipes 23 | contain all needed layer references. 24 | 25 | For SWUpdate integration, the official 26 | [meta-swupdate](https://github.com/sbabic/meta-swupdate) layer is used. Per 27 | default it installs an init script to start up a webserver for update purposes, 28 | which is not needed for manual updates. For this purpose, it is replaced by an 29 | empty init script. 30 | 31 | This example of `SWUpdate` and `efibootguard` integration provides manual 32 | update capability only. 33 | 34 | 35 | The manual update process means, that the `swu` file must be copied onto the 36 | finished SD-card before booting or via, e.g., SSH to the booted device. 37 | 38 | To use it with swupdate, the following command is used: 39 | 40 | ``` 41 | swupdate -i .swu 42 | ``` 43 | 44 | Then a reboot of the system into the newly installed image is required. After 45 | this version came up successfully, the installation has to be confirmed: 46 | 47 | ``` 48 | bg_setenv -c 49 | ``` 50 | 51 | Without this, the next reboot will fall back to the previous image version. 52 | 53 | *NOTE*: The setup can be adapted to work with backends like, e.g., hawkBit. 54 | 55 | ## Created artifacts 56 | 57 | The aforementioned kas yml files produce the following artifacts in 58 | `/tmp/deploy/images/`: 59 | 60 | * A flashable image: `iot2000-example-image-swu-iot2000.wic` 61 | * An update artifact: `iot2000-example-image-iot2000.swu` 62 | 63 | *Note*: 64 | Per default, the root filesystem included in the update artifact is identical to 65 | the one contained in the wic file. The simplest way to change this is to make it 66 | depend on a different image and set `SWUPDATE_IMAGES, SWUPDATE_IMAGES_FSTYPES, 67 | and IMAGE_DEPENDS` accordingly. See 68 | `meta-iot2000-example/recipes-core/images/iot2000-update-image.bb` for example. 69 | 70 | The provided example configuration of swupdate registers a 'progress_firmware' 71 | program as a hook to reboot the system automatically after swupdate installed 72 | the artifact. This is done in `/etc/swupdate.cfg`. 73 | -------------------------------------------------------------------------------- /meta-iot2000-example/conf/distro/poky-iot2000.conf: -------------------------------------------------------------------------------- 1 | require conf/distro/poky.conf 2 | 3 | DISTRO = "poky-iot2000" 4 | DISTRO_NAME = "IOT2000 Example Image" 5 | DISTRO_VERSION = "V3.1.17" 6 | 7 | BINDINGS_pn-mraa = "python nodejs" 8 | 9 | PREFERRED_VERSION_nodejs = "8.%" 10 | PREFERRED_VERSION_nodejs-native = "8.%" 11 | -------------------------------------------------------------------------------- /meta-iot2000-example/conf/layer.conf: -------------------------------------------------------------------------------- 1 | # We have a conf and classes directory, add to BBPATH 2 | BBPATH .= ":${LAYERDIR}" 3 | 4 | # We have a recipes-* directories, add to BBFILES 5 | BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ 6 | ${LAYERDIR}/recipes-*/*/*.bbappend" 7 | 8 | BBFILE_COLLECTIONS += "iot2000-example" 9 | BBFILE_PATTERN_iot2000-example = "^${LAYERDIR}/" 10 | BBFILE_PRIORITY_iot2000-example = "6" 11 | 12 | LAYERDEPENDS_iot2000-example += " \ 13 | iot2000-bsp \ 14 | " 15 | 16 | LAYERSERIES_COMPAT_iot2000-example = "dunfell" 17 | 18 | IOT2000_MIT_LICENSE = "${LAYERDIR}/COPYING.MIT" 19 | IOT2000_GPLv2_LICENSE = "${LAYERDIR}/COPYING.GPLv2" 20 | 21 | BB_SIGNATURE_HANDLER = "OEBasicHash" 22 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-connectivity/connman/connman_%.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/files:" 2 | 3 | SRC_URI += " \ 4 | file://main.conf \ 5 | file://settings" 6 | 7 | do_install_append() { 8 | sed -e 's/\(DESC="Connection Manager"\)/\0\n\nexport GNUTLS_NO_EXPLICIT_INIT=1/' \ 9 | -e 's/\(EXTRA_PARAM=\)""$/\1"--nodnsproxy"/' \ 10 | -i ${D}/etc/init.d/connman 11 | 12 | install -d ${D}/etc/connman 13 | install -m 0644 ${WORKDIR}/main.conf ${D}/etc/connman/main.conf 14 | 15 | install -d ${D}/var/lib/connman 16 | install -m 0600 ${WORKDIR}/settings ${D}/var/lib/connman/settings 17 | } 18 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-connectivity/connman/files/main.conf: -------------------------------------------------------------------------------- 1 | [General] 2 | AlowHostnameUpdates=false 3 | NetworkInterfaceBlacklist=eth,wlan 4 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-connectivity/connman/files/settings: -------------------------------------------------------------------------------- 1 | [global] 2 | OfflineMode=false 3 | 4 | [WiFi] 5 | Enable=true 6 | Tethering=false 7 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-connectivity/openssl/openssl_1.1.%.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/files:" 2 | 3 | SRC_URI += "file://0001-make-bnrand_range-reliable-with-deterministic-run-ti.patch" 4 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-core/images/example-image-swu.inc: -------------------------------------------------------------------------------- 1 | WKS_FILE = "example-image.iot2000.swupdate.wks" 2 | 3 | # needs to be in sync with wks setting 4 | IMAGE_ROOTFS_SIZE = "2097152" 5 | IMAGE_OVERHEAD_FACTOR = "1" 6 | IMAGE_ROOTFS_EXTRA_SPACE = "0" 7 | 8 | IMAGE_FSTYPES += "ext4.gz" 9 | 10 | IMAGE_INSTALL += "swupdate" 11 | IMAGE_INSTALL += "efibootguard-tools" 12 | IMAGE_INSTALL += "persiststore" 13 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-core/images/files/sw-description: -------------------------------------------------------------------------------- 1 | software = 2 | { 3 | version = "0.1.0"; 4 | images: ({ 5 | filename = "iot2000-example-image-swu-iot2000.ext4.gz"; 6 | device = "mmcblk0p4,mmcblk0p5"; 7 | type = "roundrobin"; 8 | compressed = true; 9 | }); 10 | files: ({ 11 | filename = "bzImage"; 12 | path = "bzImage"; 13 | type = "kernel"; 14 | device = "mmcblk0p2,mmcblk0p3"; 15 | filesystem = "vfat"; 16 | }); 17 | } 18 | 19 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-core/images/iot2000-example-image-rt.bb: -------------------------------------------------------------------------------- 1 | require recipes-core/images/core-image-rt.bb 2 | require iot2000-example-image.inc 3 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-core/images/iot2000-example-image-swu.bb: -------------------------------------------------------------------------------- 1 | require iot2000-example-image.bb 2 | require example-image-swu.inc 3 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-core/images/iot2000-example-image.bb: -------------------------------------------------------------------------------- 1 | require recipes-core/images/core-image-minimal.bb 2 | require recipes-core/images/core-image-iot2000.inc 3 | require iot2000-example-image.inc 4 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-core/images/iot2000-example-image.inc: -------------------------------------------------------------------------------- 1 | WKS_FILE = "example-image.${MACHINE}.wks" 2 | 3 | IMAGE_FSTYPES_append = " wic.bmap" 4 | 5 | DESCRIPTION = "Example image for the IOT2000 platform" 6 | 7 | #example features 8 | IMAGE_FEATURES += "package-management" 9 | IMAGE_FEATURES += "dev-pkgs" 10 | IMAGE_FEATURES += "eclipse-debug" 11 | IMAGE_FEATURES += "tools-sdk" 12 | 13 | IMAGE_INSTALL += "opkg" 14 | IMAGE_INSTALL += "os-release" 15 | IMAGE_INSTALL += "modules-load-entries" 16 | IMAGE_INSTALL += "dmidecode" 17 | IMAGE_INSTALL += "openssh" 18 | IMAGE_INSTALL += "screen minicom" 19 | IMAGE_INSTALL += "mraa-utils upm" 20 | IMAGE_INSTALL += "parted e2fsprogs dosfstools e2fsprogs-resize2fs" 21 | IMAGE_INSTALL += "nodejs nodejs-npm" 22 | IMAGE_INSTALL += "node-red node-mraa node-red-nodes" 23 | IMAGE_INSTALL += "curl" 24 | IMAGE_INSTALL += "pciutils" 25 | IMAGE_INSTALL += "iptables" 26 | IMAGE_INSTALL += "cmake" 27 | IMAGE_INSTALL += "nano tree" 28 | IMAGE_INSTALL += "iw wpa-supplicant crda" 29 | IMAGE_INSTALL += "galileo-target" 30 | IMAGE_INSTALL += "iot2000setup" 31 | IMAGE_INSTALL += "sqlite3" 32 | IMAGE_INSTALL += "i2c-tools" 33 | IMAGE_INSTALL += "linux-firmware" 34 | IMAGE_INSTALL += "mosquitto mosquitto-clients" 35 | IMAGE_INSTALL += "python3-pip python3-modules python3-setuptools python3-lxml" 36 | IMAGE_INSTALL += "setledcolor" 37 | IMAGE_INSTALL += "tzcode tzdata tzdata-misc tzdata-posix tzdata-right" 38 | IMAGE_INSTALL += "tzdata-africa tzdata-americas tzdata-antarctica" 39 | IMAGE_INSTALL += "tzdata-arctic tzdata-asia tzdata-atlantic" 40 | IMAGE_INSTALL += "tzdata-australia tzdata-europe tzdata-pacific" 41 | IMAGE_INSTALL += "cronie" 42 | IMAGE_INSTALL += "usb-modeswitch usb-modeswitch-data" 43 | IMAGE_INSTALL += "ppp ppp-oe" 44 | IMAGE_INSTALL += "ofono ofono-tests" 45 | IMAGE_INSTALL += "connman connman-tools connman-tests connman-client" 46 | IMAGE_INSTALL += "haveged" 47 | 48 | # causing excessive boot delays with Yocto 3.0 49 | PACKAGE_EXCLUDE += "rng-tools" 50 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-core/images/iot2000-update-image.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "iot2000 example update image" 2 | 3 | DEPENDS += "iot2000-example-image-swu" 4 | 5 | SRC_URI = "file://sw-description" 6 | 7 | IMAGE_DEPENDS = "iot2000-example-image-swu" 8 | 9 | LICENSE = "MIT" 10 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" 11 | 12 | SWUPDATE_IMAGES = "iot2000-example-image-swu bzImage" 13 | 14 | SWUPDATE_IMAGES_FSTYPES[iot2000-example-image-swu] = ".ext4.gz" 15 | SWUPDATE_IMAGES_NOAPPEND_MACHINE[bzImage] = "1" 16 | 17 | inherit swupdate 18 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-core/images/persiststore.bb: -------------------------------------------------------------------------------- 1 | LICENSE = "MIT" 2 | 3 | FILES_${PN} += "/data" 4 | 5 | do_install_append () { 6 | install -d "${D}/data" 7 | } 8 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-devtools/nodejs/nodejs/0001-Disable-running-gyp-files-for-bundled-deps.patch: -------------------------------------------------------------------------------- 1 | From a849b30b6d34eeb5d5afa6405674ae13ade7fd7d Mon Sep 17 00:00:00 2001 2 | From: Zuzana Svetlikova 3 | Date: Thu, 27 Apr 2017 14:25:42 +0200 4 | Subject: [PATCH] Disable running gyp on shared deps 5 | 6 | --- 7 | Makefile | 7 +++---- 8 | 1 file changed, 3 insertions(+), 4 deletions(-) 9 | 10 | diff --git a/Makefile b/Makefile 11 | index e014f09bbe..3d08cdc71e 100644 12 | --- a/Makefile 13 | +++ b/Makefile 14 | @@ -92,10 +92,9 @@ $(NODE_G_EXE): config.gypi out/Makefile 15 | $(MAKE) -C out BUILDTYPE=Debug V=$(V) 16 | if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/Debug/$(NODE_EXE) $@; fi 17 | 18 | -out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp \ 19 | - deps/zlib/zlib.gyp deps/v8/gypfiles/toolchain.gypi \ 20 | - deps/v8/gypfiles/features.gypi deps/v8/src/v8.gyp node.gyp \ 21 | - config.gypi 22 | +out/Makefile: common.gypi deps/http_parser/http_parser.gyp \ 23 | + deps/v8/gypfiles/toolchain.gypi deps/v8/gypfiles/features.gypi \ 24 | + deps/v8/src/v8.gyp node.gyp config.gypi 25 | $(PYTHON) tools/gyp_node.py -f make 26 | 27 | config.gypi: configure 28 | -- 29 | 2.25.1 30 | 31 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-example/busybox/busybox_1.31.%.bbappend: -------------------------------------------------------------------------------- 1 | #This recipe modifies the default settings of busybox 2 | #arp.cfg adds the "arp" command 3 | 4 | FILESEXTRAPATHS_prepend := "${THISDIR}/files:" 5 | 6 | SRC_URI += "file://arp.cfg" 7 | SRC_URI += "file://lsusb.cfg" 8 | SRC_URI += "file://nc.cfg" 9 | SRC_URI += "file://ntpclient.cfg" 10 | SRC_URI += "file://ntp.conf" 11 | SRC_URI += "file://ntpd.busybox" 12 | SRC_URI += "file://no-ext-dhcp.cfg" 13 | 14 | PACKAGES =+ "${PN}-ntpd" 15 | 16 | INITSCRIPT_PACKAGES += "${PN}-ntpd" 17 | INITSCRIPT_NAME_${PN}-ntpd = "ntpd.busybox" 18 | 19 | FILES_${PN}-ntpd = "${sysconfdir}/init.d/ntpd.busybox ${sysconfdir}/ntp.conf" 20 | 21 | CONFFILES_${PN}-ntpd = "${sysconfdir}/ntp.conf" 22 | 23 | RRECOMMENDS_${PN} += "${PN}-ntpd" 24 | 25 | do_install_append() { 26 | install -d ${D}${sysconfdir} 27 | install -m 0644 ${WORKDIR}/ntp.conf ${D}${sysconfdir}/ 28 | 29 | install -d ${D}${sysconfdir}/init.d 30 | install -m 0755 ${WORKDIR}/ntpd.busybox ${D}${sysconfdir}/init.d/ 31 | } 32 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-example/busybox/files/arp.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_ARP=y -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-example/busybox/files/lsusb.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_LSUSB=y -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-example/busybox/files/nc.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_NC_SERVER=y 2 | CONFIG_NC_EXTRA=y 3 | CONFIG_NC_110_COMPAT=y 4 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-example/busybox/files/no-ext-dhcp.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP=n 2 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-example/busybox/files/ntp.conf: -------------------------------------------------------------------------------- 1 | server 0.pool.ntp.org 2 | server 1.pool.ntp.org 3 | server 2.pool.ntp.org 4 | server 3.pool.ntp.org 5 | 6 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-example/busybox/files/ntpclient.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_NTPD=y 2 | CONFIG_FEATURE_NTPD_CONF=y 3 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-example/busybox/files/ntpd.busybox: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # Copyright (c) Siemens AG, 2017 4 | # 5 | # Authors: 6 | # Jan Kiszka 7 | # 8 | # derived from: Sysvinit is Copyright (C) 1991-2004 Miquel van Smoorenburg 9 | # 10 | # This work is licensed under the terms of the GNU GPL, version 2. See 11 | # the COPYING.GPLv2 file in the top-level directory. 12 | # 13 | 14 | ### BEGIN INIT INFO 15 | # Provides: ntpd 16 | # Required-Start: $network 17 | # Should-Start: 18 | # Required-Stop: $network 19 | # Should-Stop: 20 | # Default-Start: 2 3 4 5 21 | # Default-Stop: 0 1 6 22 | # Short-Description: Start NTP client 23 | # Description: 24 | ### END INIT INFO 25 | 26 | PATH=/sbin:/usr/sbin:/bin:/usr/bin 27 | 28 | DESC="NTP client" 29 | NAME="ntpd.busybox" 30 | 31 | PIDFILE=/var/run/ntpd.pid 32 | DAEMON=/usr/sbin/ntpd 33 | 34 | daemon= 35 | 36 | . /etc/init.d/functions || exit 1 37 | 38 | # 39 | # Function that starts the device 40 | # 41 | do_start() { 42 | start-stop-daemon -q -S -m -p $PIDFILE -b -x $DAEMON 43 | } 44 | 45 | # 46 | # Function that stops the daemon/service 47 | # 48 | do_stop() { 49 | start-stop-daemon -q -K -p $PIDFILE -s USR1 50 | rm $PIDFILE -f 51 | } 52 | 53 | case "$1" in 54 | start) 55 | do_start 56 | ;; 57 | stop) 58 | do_stop 59 | ;; 60 | restart) 61 | do_stop 62 | do_start 63 | ;; 64 | *) 65 | echo "Usage: $0 {start|stop|restart}" >&2 66 | exit 3 67 | ;; 68 | esac 69 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-example/init-ifupdown/files/interfaces: -------------------------------------------------------------------------------- 1 | # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) 2 | 3 | # The loopback interface 4 | auto lo 5 | iface lo inet loopback 6 | 7 | # Wired interfaces 8 | auto eth0 9 | iface eth0 inet static 10 | address 192.168.200.1 11 | netmask 255.255.255.0 12 | 13 | auto eth1 14 | iface eth1 inet dhcp 15 | 16 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-example/init-ifupdown/init-ifupdown_%.bbappend: -------------------------------------------------------------------------------- 1 | #This recipe will provide a default confi for networking. 2 | #The default configuration provided with this recipe is both ports using dhcp. 3 | #If you wish to change this behavior, simply modify the file "interfaces" 4 | #according to your requirements. This file will be placed at 5 | #/etc/network/interfaces. 6 | 7 | FILESEXTRAPATHS_prepend := "${THISDIR}/files:" 8 | 9 | SRC_URI_append = " file://interfaces" 10 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-example/iot2000setup/files/expandfs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | LOG_CMD="logger -t expandfs.sh" 4 | 5 | disable_hint() { 6 | echo 7 | echo "Please note: This script is not disabled." 8 | echo "To disable it, use:" 9 | echo 10 | echo "update-rc.d -f expandfs.sh remove" 11 | } 12 | 13 | ROOT_DEVICE=$( { findmnt / -o source -n || echo "ERR"; } | sed 's/p\?[0-9]*$//' 2>/dev/null ) 14 | RES=$( echo "${ROOT_DEVICE}" | tail -1 ) 15 | if [ "${RES}" = "ERR" ]; then 16 | echo "ERROR: could not find root device." | ${LOG_CMD} 17 | disable_hint 18 | exit 1 19 | fi 20 | 21 | CURRENT_TABLE="$( sfdisk -d ${ROOT_DEVICE} || echo ERR )" 22 | RES=$( echo "${CURRENT_TABLE}" | tail -1 ) 23 | if [ "${RES}" = "ERR" ]; then 24 | echo "ERROR: could not read partition table." | ${LOG_CMD} 25 | disable_hint 26 | exit 1 27 | fi 28 | 29 | LAST_PART=$( echo "${CURRENT_TABLE}" | awk 'END{print $1}' ) 30 | echo "Resizing "${LAST_PART} | ${LOG_CMD} 31 | 32 | RES=$( { echo "${CURRENT_TABLE}" | grep -v last-lba | \ 33 | sed "\#\(${LAST_PART}\)#s#\(size=\)\s*[0-9]*,##" | \ 34 | sfdisk --force "${ROOT_DEVICE}"; } 2>&1 || echo "ERR" ) 35 | echo "${RES}" | ${LOG_CMD} 36 | 37 | RES=$( echo "${RES}" | tail -1 ) 38 | if [ "${RES}" = "ERR" ]; then 39 | echo "ERROR: could not update partition table." | ${LOG_CMD} 40 | disable_hint 41 | exit 1 42 | fi 43 | 44 | echo "Informing kernel about new partitioning" | ${LOG_CMD} 45 | partprobe > /dev/null 46 | 47 | echo "Online-Resizing file system" | ${LOG_CMD} 48 | RES=$( resize2fs ${LAST_PART} 2>&1 || echo "ERR" ) 49 | echo ${RES} | ${LOG_CMD} 50 | 51 | RES=$( echo "${RES}" | tail -1 ) 52 | if [ "${RES}" = "ERR" ]; then 53 | echo "ERROR: could not resize file system" | ${LOG_CMD} 54 | disable_hint 55 | exit 1 56 | fi 57 | 58 | echo "Deactivating this automatic resizer" | ${LOG_CMD} 59 | update-rc.d -f expandfs.sh remove 60 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-example/iot2000setup/iot2000setup_1.0.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "Copy iot2000setup files to file system" 2 | LICENSE = "MIT" 3 | LIC_FILES_CHKSUM = "file://${IOT2000_MIT_LICENSE};md5=838c366f69b72c5df05c96dff79b35f2" 4 | 5 | inherit update-rc.d 6 | 7 | SRC_URI = "file://expandfs.sh file://iot2000setup.py" 8 | 9 | FILES_${PN} += " \ 10 | ${sysconfdir}/init.d/expandfs.sh \ 11 | ${bindir}/iot2000setup \ 12 | " 13 | 14 | RDEPENDS_${PN} += "libnewt-python python3-mraa util-linux-sfdisk" 15 | INITSCRIPT_NAME = "expandfs.sh" 16 | INITSCRIPT_PARAMS = "defaults 10" 17 | 18 | do_install() { 19 | install -d ${D}${sysconfdir}/init.d 20 | install -d ${D}${bindir} 21 | install -m 0755 ${WORKDIR}/iot2000setup.py ${D}${bindir}/iot2000setup 22 | install -m 0755 ${WORKDIR}/expandfs.sh ${D}${sysconfdir}/init.d/expandfs.sh 23 | } 24 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-example/iot2000setup/mosquitto_%.bbappend: -------------------------------------------------------------------------------- 1 | # suppress automatic service activation 2 | updatercd_postinst() { 3 | } 4 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-example/modules/files/i2c-dev.conf: -------------------------------------------------------------------------------- 1 | i2c-dev 2 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-example/modules/files/ofono-module.conf: -------------------------------------------------------------------------------- 1 | tun 2 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-example/modules/modules-load-entries_1.0.bb: -------------------------------------------------------------------------------- 1 | LICENSE = "MIT" 2 | LIC_FILES_CHKSUM = "file://${IOT2000_MIT_LICENSE};md5=838c366f69b72c5df05c96dff79b35f2" 3 | 4 | SRC_URI = " \ 5 | file://i2c-dev.conf \ 6 | file://ofono-module.conf" 7 | 8 | do_install() { 9 | install -d ${D}/etc/modules-load.d/ 10 | install -m 0444 ${WORKDIR}/i2c-dev.conf ${D}/etc/modules-load.d/ 11 | install -d ${D}/etc/modules-load.d/ 12 | install -m 0444 ${WORKDIR}/ofono-module.conf ${D}/etc/modules-load.d/ 13 | } 14 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-extended/mraa/mraa_%.bbappend: -------------------------------------------------------------------------------- 1 | # Move mraa under /usr/lib/node, to be in the search path 2 | 3 | do_install_append() { 4 | mv ${D}${libdir}/node_modules ${D}${libdir}/node 5 | } 6 | 7 | FILES_node-${PN} = "${prefix}/lib/node/" 8 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-sketch-reset.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Galileo Arduino Sketch Reset 3 | 4 | [Service] 5 | Type=simple 6 | ExecStart=/opt/cln/galileo/galileo_sketch_reset 7 | 8 | [Install] 9 | WantedBy=multi-user.target 10 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Galileo Arduino Layer 3 | 4 | [Service] 5 | Type=simple 6 | ExecStart=/bin/sh /opt/cln/galileo/launcher.sh 7 | 8 | [Install] 9 | WantedBy=multi-user.target 10 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ifdef CROSS_COMPILE 3 | CC := $(CROSS_COMPILE)gcc 4 | endif 5 | 6 | ifndef BOARD_NAME 7 | BOARD_NAME=galileo 8 | endif 9 | 10 | GALILEO_TGT_LOADER= clloader 11 | GALILEO_TGT_RESET_HANDLER= galileo_sketch_reset 12 | 13 | SRC = crctab.c clloader.c lsyslog.c protname.c rbsb.c timing.c zm.c zperr.c tcp.c zreadline.c xstrtoul.c canit.c long-options.c 14 | 15 | RST_SRC = ./galileo-reset/galileo-reset.c 16 | 17 | IDIR =. 18 | 19 | ifdef CROSS_COMPILE 20 | CFLAGS=-I$(IDIR) -I$(IDIR)/../ -I../lib -D_XOPEN_SOURCE -DLOCALEDIR=\"/usr/local/share/locale\" -DNFGVMIN -DHAVE_CONFIG_H -DCLANTON_LOADER -g -Wall -std=c99 -m32 -Os -march=pentium -ffunction-sections 21 | else 22 | CFLAGS=-I$(IDIR) -I$(IDIR)/../ -I../lib -D_XOPEN_SOURCE -DNFGVMIN -DHAVE_CONFIG_H -DCLANTON_LOADER -g -Wall -std=c99 -Os -ffunction-sections 23 | endif 24 | 25 | all: clloader galileo_sketch_reset 26 | 27 | ODIR=. 28 | LIBS= 29 | 30 | DEPEND = $(SRC:.c=.d) 31 | 32 | _OBJ = $(SRC:.c=.o) 33 | OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ)) 34 | 35 | $(ODIR)/%.o: %.c $(DEPEND) 36 | $(CC) -c -o $@ $< $(CFLAGS) $(CFLAGS_EXTRA) 37 | 38 | clloader: $(OBJ) 39 | $(CC) -o $@ $^ $(LDFLAGS) $(LIBS) 40 | 41 | 42 | 43 | 44 | RST_ODIR=. 45 | RST_DEPEND = $(RST_SRC:.c=.d) 46 | _RST_OBJ = $(RST_SRC:.c=.o) 47 | RST_OBJ = $(patsubst %,$(RST_ODIR)/%,$(_RST_OBJ)) 48 | 49 | $(RST_ODIR)/%.o: %.c $(RST_DEPEND) 50 | $(CC) -c -o $@ $< $(CFLAGS) $(CFLAGS_EXTRA) 51 | 52 | galileo_sketch_reset: $(RST_OBJ) 53 | $(CC) -o $@ $^ $(LDFLAGS) $(LIBS) 54 | 55 | .PHONY: clean 56 | 57 | clean: 58 | rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~ *.d 59 | rm -f $(RST_ODIR)/*.o *~ core $(INCDIR)/*~ *.d 60 | ${RM} $(GALILEO_TGT_LOADER) -f 61 | ${RM} $(GALILEO_TGT_RESET_HANDLER) -f 62 | ${RM} -r $(DESTDIR) 63 | 64 | %.d: %.c 65 | @echo DEPEND $<; \ 66 | rm -f $@; \ 67 | $(CC) -MM $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \ 68 | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ 69 | rm -f $@.$$$$ 70 | 71 | ifneq ($(MAKECMDGOALS), clean) 72 | -include $(DEPEND) 73 | endif 74 | 75 | CLN_GALILEO := opt/cln/galileo 76 | 77 | install: $(GALILEO_TGT_LOADER) $(GALILEO_TGT_RESET_HANDLER) install-scripts 78 | install -d $(DESTDIR)/${CLN_GALILEO} 79 | install -m 0755 $(GALILEO_TGT_LOADER) $(DESTDIR)/${CLN_GALILEO} 80 | install -m 0755 $(GALILEO_TGT_RESET_HANDLER) $(DESTDIR)/${CLN_GALILEO} 81 | 82 | DESTDIR ?= build 83 | 84 | install-scripts: 85 | install -d $(DESTDIR)/$(CLN_GALILEO) 86 | install -m 0755 scripts/${CLN_GALILEO}/* $(DESTDIR)/$(CLN_GALILEO) 87 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target/Readme.txt: -------------------------------------------------------------------------------- 1 | This is the izmir download daemon. 2 | 3 | It needs to be built with the yocto Linux cross compiler, not the cross compiler for sketches. 4 | Compiler was setup using: 5 | source /nfs/iir/disks/clanton_disk005/users/software/linux_xcompiler/1.4.1/environment-setup-i586-poky-linux-uclibc 6 | 7 | 8 | Run the command on the target: 9 | ./clloader --escape --binary < /dev/ttyGS0 > /dev/ttyGS0 10 | 11 | clloader --help for other options. 12 | 13 | Clloader will look for /sketch/sketch.elf and run it if found. 14 | Output from the sketch will be redirected back to /dev/ttyGS0 15 | 16 | If clloader is HUPed while running a sketch it will terminate the sketch and wait for a command. 17 | If the sketch terminates the loader will revert back to waiting for a remote command. 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target/canit.c: -------------------------------------------------------------------------------- 1 | /* 2 | canit - cancel zmodem connection 3 | Copyright (C) until 1988 Chuck Forsberg (Omen Technology INC) 4 | Copyright (C) 1994 Matt Porter, Michael D. Black 5 | Copyright (C) 1996, 1997 Uwe Ohse 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2, or (at your option) 10 | any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program; if not, write to the Free Software 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | 02111-1307, USA. 21 | */ 22 | #include "zglobal.h" 23 | 24 | #define SS_NORMAL 0 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | /* send cancel string to get the other end to shut up */ 34 | void 35 | canit (int fd) 36 | { 37 | static char canistr[] = 38 | { 39 | 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0 40 | }; 41 | purgeline(fd); 42 | write(fd,canistr,strlen(canistr)); 43 | if (fd==0) 44 | write(1,canistr,strlen(canistr)); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target/clloader.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright(c) 2013 Intel Corporation. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms and conditions of the GNU General Public License, 7 | * version 2, as published by the Free Software Foundation. 8 | * 9 | * This program is distributed in the hope it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | /*#include "variant.h" */ /* Name of /dev/tty */ 28 | 29 | 30 | #define _XOPEN_SOURCE /* See feature_test_macros(7) */ 31 | #define MAX_ARGS 0x20 32 | 33 | #define CL_LOADER_CMD_HOST_START_DOWNLOAD_CMD "~sketch download" 34 | 35 | #define CL_LOADER_CMD_STARTCHAR '#' 36 | #define CL_LOADER_CMD_START_SKETCH_APP "#Start Sketch:" /* filename args and exec i/o wrapper */ 37 | 38 | extern int clLoaderFSM(int argc, char **argp); 39 | 40 | typedef enum { 41 | FSM_STATE_PASSTHROUGH_INIT = 0, 42 | FSM_STATE_PASSTHROUGH_RUNNING, 43 | FSM_STATE_ZMODEM, 44 | }fsm_t; 45 | 46 | struct daemon_state { 47 | fsm_t fsm_state; /* State of daemon */ 48 | int tty_to_host; /* handle to host port e.g. /dev/ttyGS0 */ 49 | int tty_from_host; /* handle from host port e.g. /dev/ttyGS0 */ 50 | int tty_slave; /* handle to slave port e.g. /dev/ptmx */ 51 | char * slavename; /* name of slave */ 52 | pid_t slave_pid; /* fork */ 53 | char *sketch_args; 54 | }; 55 | 56 | #define CLANTON_SKETCHPROGRAM "/sketch/sketch.elf" 57 | 58 | #define CLANTON_LDSO "/opt/uclibc/lib/ld-uClibc.so.0" 59 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target/galileo-reset/galileo-reset.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright(c) 2013 Intel Corporation. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms and conditions of the GNU General Public License, 7 | * version 2, as published by the Free Software Foundation. 8 | * 9 | * This program is distributed in the hope it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | */ 14 | 15 | #ifndef gpio_reset_Header_h 16 | #define gpio_reset_Header_h 17 | 18 | #define GPIO_SYS_BASE_STRING "/sys/class/gpio" 19 | #define GPIO_SYS_EXPORT_STRING "/sys/class/gpio/export" 20 | 21 | //todo: make reset script an arg to the program 22 | #define SKETCH_RESET_RELEASE_SCRIPT "/opt/cln/galileo/galileo_sketch_reset_script.sh" 23 | 24 | #define GPIO_STRING_LEN 132 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target/long-options.c: -------------------------------------------------------------------------------- 1 | /* Utility to accept --help and --version options as unobtrusively as possible. 2 | Copyright (C) 1993, 1994 Free Software Foundation, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2, or (at your option) 7 | any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 17 | 18 | /* Jim Meyering (meyering@comco.com) */ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | #include 22 | #endif 23 | 24 | #include 25 | #include 26 | #include "long-options.h" 27 | 28 | static struct option const long_options[] = 29 | { 30 | {"help", no_argument, 0, 'h'}, 31 | {"version", no_argument, 0, 'v'}, 32 | {0, 0, 0, 0} 33 | }; 34 | 35 | /* Process long options --help and --version, but only if argc == 2. 36 | Be careful not to gobble up `--'. */ 37 | void 38 | parse_long_options (argc, argv,version, usage) 39 | int argc; 40 | char **argv; 41 | void (*version)(); 42 | void (*usage)(); 43 | { 44 | int c; 45 | int saved_opterr; 46 | int saved_optind; 47 | 48 | saved_opterr = opterr; 49 | saved_optind = optind; 50 | 51 | /* Don't print an error message for unrecognized options. */ 52 | opterr = 0; 53 | 54 | if (argc == 2 55 | && (c = getopt_long (argc, argv, "+", long_options, (int *) 0)) != EOF) 56 | { 57 | switch (c) 58 | { 59 | case 'h': 60 | (*usage) (0); 61 | 62 | case 'v': 63 | (*version) (0); 64 | /* printf ("%s (%s) %s\n", command_name, package, version_string); */ 65 | exit (0); 66 | 67 | default: 68 | /* Don't process any other long-named options. */ 69 | break; 70 | } 71 | } 72 | 73 | /* Restore previous value. */ 74 | opterr = saved_opterr; 75 | 76 | /* Restore optind in case it has advanced past a leading `--'. */ 77 | optind = saved_optind; 78 | } 79 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target/long-options.h: -------------------------------------------------------------------------------- 1 | #undef __P 2 | #if defined (__STDC__) && __STDC__ 3 | #define __P(args) args 4 | #else 5 | #define __P(args) () 6 | #endif 7 | 8 | void parse_long_options __P ((int _argc, char **_argv, 9 | void (*_version) (void), 10 | void (*_usage) (int))); 11 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target/lsyslog.c: -------------------------------------------------------------------------------- 1 | /* 2 | lsyslog.c - wrapper for the syslog function 3 | Copyright (C) 1997 Uwe Ohse 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2, or (at your option) 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | 02111-1307, USA. 19 | 20 | */ 21 | #include "config.h" 22 | #ifdef ENABLE_SYSLOG 23 | #include "zglobal.h" 24 | #include 25 | #include 26 | #include 27 | #endif 28 | 29 | #if __STDC__ 30 | # include 31 | # define VA_START(args, lastarg) va_start(args, lastarg) 32 | # define WAYTOGO 33 | #else 34 | # include 35 | # define VA_START(args, lastarg) va_start(args) 36 | #endif 37 | 38 | void 39 | #ifdef WAYTOGO 40 | lsyslog(int prio, const char *format, ...) 41 | #else 42 | lsyslog(prio,format,va_alist) 43 | int prio; 44 | const char *format; 45 | va_dcl 46 | #endif 47 | { 48 | #ifdef ENABLE_SYSLOG 49 | static char *username=NULL; 50 | static char uid_string[20]=""; /* i'd really hate this function to fail! */ 51 | char *s=NULL; 52 | static int init_done=0; 53 | va_list ap; 54 | if (!enable_syslog) 55 | return; 56 | if (!init_done) { 57 | uid_t uid; 58 | struct passwd *pwd; 59 | init_done=1; 60 | uid=getuid(); 61 | pwd=getpwuid(uid); 62 | if (pwd && pwd->pw_name && *pwd->pw_name) { 63 | username=strdup(pwd->pw_name); 64 | } 65 | if (!username) { 66 | username=uid_string; 67 | sprintf(uid_string,"#%lu",(unsigned long) uid); 68 | } 69 | } 70 | 71 | VA_START(ap, format); 72 | vasprintf(&s,format, ap); 73 | va_end(ap); 74 | syslog(prio,"[%s] %s",username,s); 75 | free(s); 76 | #else 77 | (void) prio; /* get rid of warning */ 78 | (void) format; /* get rid of warning */ 79 | #endif 80 | } 81 | 82 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target/protname.c: -------------------------------------------------------------------------------- 1 | /* 2 | protname.c - return the name of the protocol used 3 | Copyright (C) 1996, 1997 Uwe Ohse 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2, or (at your option) 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | 02111-1307, USA. 19 | 20 | */ 21 | #include "zglobal.h" 22 | 23 | /* this code was duplicate in lrz.c and lsz.c */ 24 | 25 | const char * 26 | protname(void) 27 | { 28 | const char *prot_name; 29 | switch(protocol) { 30 | case ZM_XMODEM: 31 | prot_name="XMODEM"; 32 | break; 33 | case ZM_YMODEM: 34 | prot_name="YMODEM"; 35 | break; 36 | default: 37 | prot_name="ZMODEM"; 38 | break; 39 | } 40 | return prot_name; 41 | } 42 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target/scripts/opt/cln/galileo/galileo_sketch_reset_script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | systemctl restart galileo-target.service 4 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target/scripts/opt/cln/galileo/sketch-setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #Krzysztof.M.Sywula@intel.com 3 | 4 | SKETCH=/sketch 5 | SKETCH_SIZE=256 #KB 6 | ERASE_SIZE=32 #KB 7 | IMAGE=/opt/cln/galileo/jffs2.bin 8 | DEVICE=/dev/mtdblock0 9 | 10 | start() 11 | { 12 | dd if=$IMAGE of=$DEVICE 13 | mount -t jffs2 $DEVICE $SKETCH 14 | } 15 | 16 | stop() 17 | { 18 | umount $SKETCH 19 | dd if=$DEVICE of=$IMAGE 20 | } 21 | 22 | setup() 23 | { 24 | ulimit -c unlimited 25 | modprobe mtdram total_size=$SKETCH_SIZE erase_size=$ERASE_SIZE 26 | modprobe mtdchar 27 | modprobe mtdblock 28 | mkdir -p $SKETCH 29 | 30 | # IF IMAGE DOES NOT EXIST - CREATE ONE 31 | test -f $IMAGE || mkfs.jffs2 --pad=$(($SKETCH_SIZE * 1024)) -r /tmp --eraseblock=$ERASE_SIZE -o $IMAGE 32 | } 33 | 34 | usage() 35 | { 36 | echo "Use: $1 [start/stop]" 37 | exit 1 38 | } 39 | 40 | main() 41 | { 42 | echo $1 43 | if [ "x$1" = "xstart" ]; then 44 | # setup 45 | # start 46 | mkdir -p /sketch 47 | elif [ "x$1" = "xstop" ]; then 48 | # stop 49 | else 50 | usage $0 51 | fi 52 | } 53 | 54 | main "$@" 55 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target/timing.h: -------------------------------------------------------------------------------- 1 | double timing __P ((int reset,time_t *now)); 2 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target/xstrtol.h: -------------------------------------------------------------------------------- 1 | #ifndef _xstrtol_h_ 2 | #define _xstrtol_h_ 1 3 | 4 | #if STRING_TO_UNSIGNED 5 | # define __xstrtol xstrtoul 6 | # define __strtol strtoul 7 | # define __unsigned unsigned 8 | # define __ZLONG_MAX ULONG_MAX 9 | #else 10 | # define __xstrtol xstrtol 11 | # define __strtol strtol 12 | # define __unsigned /* empty */ 13 | # define __ZLONG_MAX LONG_MAX 14 | #endif 15 | 16 | #undef __P 17 | #if defined (__STDC__) && __STDC__ 18 | #define __P(x) x 19 | #else 20 | #define __P(x) () 21 | #endif 22 | 23 | enum strtol_error 24 | { 25 | LONGINT_OK, LONGINT_INVALID, LONGINT_INVALID_SUFFIX_CHAR, LONGINT_OVERFLOW 26 | }; 27 | typedef enum strtol_error strtol_error; 28 | 29 | strtol_error 30 | __xstrtol __P ((const char *s, char **ptr, int base, 31 | __unsigned long int *val, const char *valid_suffixes)); 32 | 33 | #define _STRTOL_ERROR(exit_code, str, argument_type_string, err) \ 34 | do \ 35 | { \ 36 | switch ((err)) \ 37 | { \ 38 | case LONGINT_OK: \ 39 | abort (); \ 40 | \ 41 | case LONGINT_INVALID: \ 42 | error ((exit_code), 0, "invalid %s `%s'", \ 43 | (argument_type_string), (str)); \ 44 | break; \ 45 | \ 46 | case LONGINT_INVALID_SUFFIX_CHAR: \ 47 | error ((exit_code), 0, "invalid character following %s `%s'", \ 48 | (argument_type_string), (str)); \ 49 | break; \ 50 | \ 51 | case LONGINT_OVERFLOW: \ 52 | /* FIXME: make this message dependent on STRING_TO_UNSIGNED */\ 53 | error ((exit_code), 0, "%s `%s' larger than maximum long int",\ 54 | (argument_type_string), (str)); \ 55 | break; \ 56 | } \ 57 | } \ 58 | while (0) 59 | 60 | #define STRTOL_FATAL_ERROR(str, argument_type_string, err) \ 61 | _STRTOL_ERROR (2, str, argument_type_string, err) 62 | 63 | #define STRTOL_FAIL_WARN(str, argument_type_string, err) \ 64 | _STRTOL_ERROR (0, str, argument_type_string, err) 65 | 66 | #endif /* _xstrtol_h_ */ 67 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target/xstrtoul.c: -------------------------------------------------------------------------------- 1 | #define STRING_TO_UNSIGNED 1 2 | #include "xstrtol.c" 3 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target/xstrtoul.h: -------------------------------------------------------------------------------- 1 | #ifndef _xstrtoul_h_ 2 | #define _xstrtoul_h_ 1 3 | 4 | #define STRING_TO_UNSIGNED 1 5 | #include "xstrtol.h" 6 | 7 | #endif /* _xstrtoul_h_ */ 8 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target/zglobal.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siemens/meta-iot2000/f9508ebdc3f6f2a7bf9952773245d64510d467b8/meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target/zglobal.h -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileo-target/zperr.c: -------------------------------------------------------------------------------- 1 | /* 2 | zperr.c - "stderr" output stuff 3 | Copyright (C) 1996, 1997 Uwe Ohse 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2, or (at your option) 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | 02111-1307, USA. 19 | 20 | originally written by Uwe Ohse 21 | */ 22 | #include "zglobal.h" 23 | #include 24 | #include 25 | #include 26 | 27 | #ifdef __STDC__ 28 | # define WAYTOGO 29 | # include 30 | # define VA_START(args, lastarg) va_start(args, lastarg) 31 | #else 32 | # include 33 | # define VA_START(args, lastarg) va_start(args) 34 | #endif 35 | 36 | void 37 | #ifdef WAYTOGO 38 | zperr(const char *fmt, ...) 39 | #else 40 | zperr(fmt, va_alist) 41 | const char *fmt; 42 | va_dcl 43 | #endif 44 | { 45 | va_list ap; 46 | 47 | if (Verbose<=0) 48 | return; 49 | fprintf(stderr,_("Retry %d: "),errors); 50 | VA_START(ap, fmt); 51 | vfprintf(stderr,fmt, ap); 52 | va_end(ap); 53 | putc('\n',stderr); 54 | } 55 | 56 | void 57 | #ifdef WAYTOGO 58 | zpfatal(const char *fmt, ...) 59 | #else 60 | zpfatal(fmt, va_alist) 61 | const char *fmt; 62 | va_dcl 63 | #endif 64 | { 65 | va_list ap; 66 | int err=errno; 67 | 68 | if (Verbose<=0) 69 | return; 70 | fprintf(stderr,"%s: ",program_name); 71 | VA_START(ap, fmt); 72 | vfprintf(stderr,fmt, ap); 73 | va_end(ap); 74 | fprintf(stderr,": %s\n",strerror(err)); 75 | } 76 | 77 | void 78 | #ifdef WAYTOGO 79 | vfile(const char *format, ...) 80 | #else 81 | vfile(format, va_alist) 82 | const char *format; 83 | va_dcl 84 | #endif 85 | { 86 | va_list ap; 87 | 88 | if (Verbose < 3) 89 | return; 90 | VA_START(ap, format); 91 | vfprintf(stderr,format, ap); 92 | va_end(ap); 93 | putc('\n',stderr); 94 | } 95 | 96 | #ifndef vstringf 97 | /* if using gcc this function is not needed */ 98 | void 99 | #ifdef WAYTOGO 100 | vstringf(const char *format, ...) 101 | #else 102 | vstringf(format, va_alist) 103 | const char *format; 104 | va_dcl 105 | #endif 106 | { 107 | va_list ap; 108 | 109 | VA_START(ap, format); 110 | vfprintf(stderr,format, ap); 111 | va_end(ap); 112 | } 113 | #endif 114 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/galileod.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ### BEGIN INIT INFO 4 | # Provides: galileod 5 | # Required-Start: $network $syslog 6 | # Should-Start: 7 | # Required-Stop: $network $syslog 8 | # Should-Stop: 9 | # Default-Start: 2 3 4 5 10 | # Default-Stop: 0 1 6 11 | # Short-Description: Galileo Arduino Runtime 12 | ### END INIT INFO 13 | 14 | pidfile=/var/run/launcher.pid 15 | launcher=/opt/cln/galileo/launcher.sh 16 | 17 | start_galileod() 18 | { 19 | echo "Starting galileod" 20 | start-stop-daemon -q -S -m -p $pidfile -b -x $launcher 21 | } 22 | 23 | stop_handler() 24 | { 25 | echo "Stopping galileod" 26 | start-stop-daemon -q -K -p $pidfile -s USR1 27 | rm $pidfile -f 28 | } 29 | 30 | die() 31 | { 32 | exit 1 33 | } 34 | 35 | case "$1" in 36 | start) 37 | start_galileod 38 | ;; 39 | stop) 40 | stop_handler 41 | ;; 42 | restart) 43 | $0 stop 44 | $0 start 45 | ;; 46 | status) 47 | if [ -f $pidfile ]; then 48 | echo "galileod (pid $(cat $pidfile)) is running..." 49 | exit 0 50 | else 51 | echo "galileod is stopped" 52 | fi 53 | exit 3 54 | ;; 55 | *) 56 | echo "Usage: syslog { start | stop | restart | status }" >&2 57 | exit 1 58 | ;; 59 | esac 60 | 61 | exit 0 62 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/launcher.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | GALILEO_PATH="/opt/cln/galileo" 3 | CLLOADER="$GALILEO_PATH/clloader" 4 | CLLOADER_OPTS="--escape --binary --zmodem --disable-timeouts" 5 | SKETCH_RESET="$GALILEO_PATH/galileo_sketch_reset" 6 | 7 | mytrap() 8 | { 9 | kill -KILL $clPID 10 | keepgoing=false 11 | } 12 | 13 | trap 'mytrap' USR1 14 | 15 | arduino_services() 16 | { 17 | $SKETCH_RESET $sketch_reset_params & 18 | 19 | keepgoing=true 20 | while $keepgoing 21 | do 22 | $CLLOADER $CLLOADER_OPTS < /dev/ttyGS0 > /dev/ttyGS0 & clPID=$! 23 | wait $clPID 24 | usleep 200000 25 | done 26 | } 27 | 28 | sketch_reset_params="-i 63 -o 47" 29 | arduino_services 30 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/files/r1_2_sketch_reset.patch: -------------------------------------------------------------------------------- 1 | --- galileo-target-0.1/scripts/opt/cln/galileo/galileo_sketch_reset_script.sh 2015-06-29 02:10:35.770165975 +0800 2 | +++ galileo-target-0.1/scripts/opt/cln/galileo/galileo_sketch_reset_script.sh 2015-06-29 02:12:50.950162414 +0800 3 | @@ -1,3 +1,3 @@ 4 | #!/bin/sh 5 | 6 | -systemctl restart galileo-target.service 7 | +killall -TERM clloader 8 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/galileo-target/galileo-target_0.1.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Clanton Software Sketch Framework" 2 | LICENSE = "GPLv2" 3 | LIC_FILES_CHKSUM = "file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263" 4 | 5 | SRC_URI = "file://galileo-target \ 6 | file://launcher.sh \ 7 | file://galileod.init \ 8 | file://galileo-target.service \ 9 | file://galileo-sketch-reset.service \ 10 | file://r1_2_sketch_reset.patch" 11 | 12 | INSTALLDIR = "/opt/cln/galileo" 13 | FILES_${PN} += "${INSTALLDIR} \ 14 | ${systemd_unitdir}/system/ \ 15 | /sketch" 16 | FILES_${PN}-dbg += "${INSTALLDIR}/.debug" 17 | 18 | S = "${WORKDIR}/galileo-target" 19 | 20 | RDEPENDS_${PN} += "uclibc uclibc-libpthread uclibc-libm uclibc-binlibs" 21 | RDEPENDS_${PN} += "galileogen2-fake galileo-uio-gpio galileo-spi1-spidev" 22 | RDEPENDS_${PN} += "acm-gadget" 23 | 24 | do_compile() { 25 | make 26 | } 27 | 28 | do_install() { 29 | oe_runmake install DESTDIR=${D}/ 30 | 31 | install -d ${D}${INSTALLDIR} 32 | install -m 0755 ${WORKDIR}/launcher.sh ${D}${INSTALLDIR}/ 33 | 34 | install -d ${D}${sysconfdir}/init.d 35 | install -m 0755 ${WORKDIR}/galileod.init ${D}${sysconfdir}/init.d/galileod 36 | 37 | install -d ${D}${systemd_unitdir}/system 38 | install -m 0644 ${WORKDIR}/galileo-target.service ${D}${systemd_unitdir}/system/ 39 | install -m 0644 ${WORKDIR}/galileo-sketch-reset.service ${D}${systemd_unitdir}/system/ 40 | 41 | install -d ${D}${base_libdir}/udev/rules.d 42 | echo 'SUBSYSTEM=="spidev", SYMLINK+="spidev1.0"' > ${D}${base_libdir}/udev/rules.d/99-galileo-arduino-spi-compat.rules 43 | 44 | install -d ${D}/sketch 45 | } 46 | 47 | inherit update-rc.d 48 | INITSCRIPT_PACKAGES = "${PN}" 49 | INITSCRIPT_NAME = "galileod" 50 | 51 | inherit systemd 52 | SYSTEMD_SERVICE_${PN} = "galileo-target.service galileo-sketch-reset.service" 53 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/uclibc/site_config/headers: -------------------------------------------------------------------------------- 1 | aio.h 2 | alloca.h 3 | argz.h 4 | arpa/inet.h 5 | arpa/nameser.h 6 | asm/byteorder.h 7 | asm/ioctls.h 8 | asm/page.h 9 | asm/types.h 10 | assert.h 11 | byteswap.h 12 | crypt.h 13 | ctype.h 14 | dirent.h 15 | dlfcn.h 16 | elf.h 17 | endian.h 18 | err.h 19 | errno.h 20 | execinfo.h 21 | fcntl.h 22 | features.h 23 | float.h 24 | fstab.h 25 | ftw.h 26 | getopt.h 27 | glob.h 28 | grp.h 29 | iconv.h 30 | ifaddrs.h 31 | inttypes.h 32 | langinfo.h 33 | lastlog.h 34 | libgen.h 35 | libintl.h 36 | limits.h 37 | linux/capability.h 38 | linux/fd.h 39 | linux/fs.h 40 | linux/hayesesp.h 41 | linux/hdreg.h 42 | linux/icmp.h 43 | linux/in6.h 44 | linux/joystick.h 45 | linux/ptrace.h 46 | linux/serial.h 47 | linux/sonypi.h 48 | linux/unistd.h 49 | linux/utsname.h 50 | linux/version.h 51 | locale.h 52 | malloc.h 53 | math.h 54 | mcheck.h 55 | memory.h 56 | mntent.h 57 | mqueue.h 58 | netdb.h 59 | net/if.h 60 | netinet/ether.h 61 | netinet/in.h 62 | netinet/ip6.h 63 | netinet/ip.h 64 | netinet/tcp.h 65 | netinet/udp.h 66 | netipx/ipx.h 67 | net/route.h 68 | paths.h 69 | poll.h 70 | pthread.h 71 | pty.h 72 | pwd.h 73 | regex.h 74 | resolv.h 75 | rpc/rpc.h 76 | rpc/types.h 77 | sched.h 78 | scsi/scsi.h 79 | search.h 80 | semaphore.h 81 | setjmp.h 82 | sgtty.h 83 | shadow.h 84 | signal.h 85 | stdarg.h 86 | stdbool.h 87 | stdc 88 | stddef.h 89 | stdint.h 90 | stdio.h 91 | stdlib.h 92 | string.h 93 | strings.h 94 | stropts.h 95 | sys/bitypes.h 96 | sys/cdefs.h 97 | sys/dir.h 98 | sys/epoll.h 99 | sysexits.h 100 | sys/fcntl.h 101 | sys/file.h 102 | sys/fsuid.h 103 | sys/ioctl.h 104 | sys/ipc.h 105 | syslog.h 106 | sys/mman.h 107 | sys/mount.h 108 | sys/mtio.h 109 | sys/param.h 110 | sys/poll.h 111 | sys/prctl.h 112 | sys/ptrace.h 113 | sys/queue.h 114 | sys/reg.h 115 | sys/resource.h 116 | sys/select.h 117 | sys/sem.h 118 | sys/shm.h 119 | sys/signal.h 120 | sys/socket.h 121 | sys/socketvar.h 122 | sys/soundcard.h 123 | sys/statfs.h 124 | sys/stat.h 125 | sys/statvfs.h 126 | sys/stropts.h 127 | sys/swap.h 128 | sys/sysctl.h 129 | sys/sysinfo.h 130 | sys/sysmacros.h 131 | sys/termios.h 132 | sys/timeb.h 133 | sys/time.h 134 | sys/times.h 135 | sys/timex.h 136 | sys/types.h 137 | sys/uio.h 138 | sys/un.h 139 | sys/unistd.h 140 | sys/user.h 141 | sys/utsname.h 142 | sys/vfs.h 143 | sys/wait.h 144 | termio.h 145 | termios.h 146 | time.h 147 | ttyent.h 148 | ulimit.h 149 | unistd.h 150 | ustat.h 151 | utime.h 152 | utmp.h 153 | utmpx.h 154 | values.h 155 | wchar.h 156 | wctype.h 157 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/uclibc/site_config/types: -------------------------------------------------------------------------------- 1 | char 2 | char * 3 | double 4 | float 5 | int 6 | long 7 | long double 8 | long int 9 | long long 10 | long long int 11 | short 12 | short int 13 | signed char 14 | unsigned char 15 | unsigned int 16 | unsigned long 17 | unsigned long int 18 | unsigned long long int 19 | unsigned short 20 | unsigned short int 21 | void * 22 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/uclibc/uclibc-git.inc: -------------------------------------------------------------------------------- 1 | SRCREV = "003b266cbeb370a8eae91dc256197f00798c6f93" 2 | 3 | PV = "1.0.12+git${SRCPV}" 4 | 5 | FILESEXTRAPATHS =. "${FILE_DIRNAME}/uclibc-git:" 6 | 7 | SRC_URI = "git://uclibc-ng.org/git/uclibc-ng \ 8 | file://0001-Disable-lrount_tes-function.patch \ 9 | file://uClibc.machine \ 10 | file://uClibc.distro \ 11 | file://obstack.cfg \ 12 | file://locale.cfg \ 13 | " 14 | S = "${WORKDIR}/git" 15 | 16 | UPSTREAM_CHECK_GITTAGREGEX = "(?P\d+\.\d+(\.\d+)*)" 17 | 18 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/uclibc/uclibc-git/0001-Disable-lrount_tes-function.patch: -------------------------------------------------------------------------------- 1 | From 14b865b3438d0df29b4969148678d8fa8943e1ef Mon Sep 17 00:00:00 2001 2 | From: Khem Raj 3 | Date: Sun, 16 Aug 2015 20:49:33 -0700 4 | Subject: [PATCH 1/7] Disable lrount_tes() function 5 | 6 | Its not used anyway, avoids some strict compiler warnings 7 | 8 | Signed-off-by: Khem Raj 9 | --- 10 | Upstream-Status: Pending 11 | 12 | test/math/libm-test.inc | 2 -- 13 | 1 file changed, 2 deletions(-) 14 | 15 | diff --git a/test/math/libm-test.inc b/test/math/libm-test.inc 16 | index f50b48b..6d70a95 100644 17 | --- a/test/math/libm-test.inc 18 | +++ b/test/math/libm-test.inc 19 | @@ -3470,7 +3470,6 @@ logb_test (void) 20 | } 21 | 22 | 23 | -#if 0 24 | static void 25 | lround_test (void) 26 | { 27 | @@ -3605,7 +3604,6 @@ llround_test (void) 28 | 29 | END (llround); 30 | } 31 | -#endif 32 | 33 | static void 34 | modf_test (void) 35 | -- 36 | 2.1.4 37 | 38 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/uclibc/uclibc-git/locale.cfg: -------------------------------------------------------------------------------- 1 | UCLIBC_HAS_LOCALE=y 2 | UCLIBC_HAS_XLOCALE=y 3 | UCLIBC_BUILD_MINIMAL_LOCALE=y 4 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/uclibc/uclibc-git/obstack.cfg: -------------------------------------------------------------------------------- 1 | UCLIBC_HAS_OBSTACK=y 2 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/uclibc/uclibc-git/uClibc.machine: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated make config: don't edit 3 | # Version: 0.9.32-git 4 | # Mon Jul 19 01:34:29 2010 5 | # 6 | # 7 | # Using ELF file format 8 | # 9 | FORCE_OPTIONS_FOR_ARCH=y 10 | ARCH_HAS_MMU=y 11 | ARCH_USE_MMU=y 12 | KERNEL_HEADERS="/usr/include" 13 | HAVE_DOT_CONFIG=y 14 | 15 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/uclibc/uclibc-package.inc: -------------------------------------------------------------------------------- 1 | # Ensure the uclibc-dev package is processed before uclibc-staticdev to allow 2 | # *_nonshared.a libraries to be packaged in the uclibc-dev package. 3 | PACKAGES = "ldd uclibc-utils uclibc-gconv uclibc-thread-db uclibc-argp uclibc-backtrace uclibc-libcrypt uclibc-libintl uclibc-libnsl uclibc-libresolv uclibc-libm uclibc-libdl uclibc-libutil uclibc-libpthread uclibc-librt ${PN}-dbg ${PN}-dev ${PN}-staticdev ${PN}-doc ${PN}" 4 | 5 | FILES_uclibc-libcrypt = "${base_libdir}/libcrypt*.so.* ${base_libdir}/libcrypt-*.so" 6 | FILES_uclibc-libintl = "${base_libdir}/libintl*.so.* ${base_libdir}/libintl-*.so" 7 | FILES_uclibc-libnsl = "${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so" 8 | FILES_uclibc-libresolv = "${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so" 9 | FILES_uclibc-libm = "${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so" 10 | FILES_uclibc-libdl = "${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so" 11 | FILES_uclibc-libutil = "${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so" 12 | FILES_uclibc-libpthread = "${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so" 13 | FILES_uclibc-librt = "${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so" 14 | 15 | FILES_ldd = "${bindir}/ldd" 16 | FILES_uclibc-utils = "${bindir} ${sbindir}" 17 | FILES_uclibc-gconv = "${libdir}/gconv" 18 | FILES_uclibc-thread-db = "${base_libdir}/libthread_db*" 19 | FILES_uclibc-argp = "${base_libdir}/libuargp-*.so ${base_libdir}/libuargp*.so.*" 20 | FILES_uclibc-backtrace = "${base_libdir}/libubacktrace-*.so ${base_libdir}/libubacktrace*.so.*" 21 | 22 | # The last line (gdb and lib1) is for uclinux-uclibc builds 23 | uclibc_baselibs = "${base_libdir}/ld*.so.* ${base_libdir}/ld*.so \ 24 | ${base_libdir}/libc*.so.* ${base_libdir}/libuClibc-*.so \ 25 | ${libdir}/libc.gdb ${libdir}/libc ${base_libdir}/lib1.so \ 26 | " 27 | FILES_SOLIBSDEV = "${libdir}/lib*${SOLIBSDEV}" 28 | FILES_${PN}-dev += "\ 29 | ${libdir}/lib*.so \ 30 | ${libdir}/*_nonshared.a \ 31 | ${libdir}/[S]*crt[1in].o \ 32 | ${libdir}/crtreloc*.o \ 33 | ${includedir}/*.h ${includedir}/*/*.h \ 34 | " 35 | FILES_${PN} = "${sysconfdir} ${uclibc_baselibs} /sbin/ldconfig \ 36 | ${libexecdir} ${datadir}/zoneinfo ${libdir}/locale" 37 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/uclibc/uclibc/0001-dl-elf.c-never-look-in-shared-library-loader-for-lib.patch: -------------------------------------------------------------------------------- 1 | From 83143cd1012514d3131bb7e3fc660c774480d6c4 Mon Sep 17 00:00:00 2001 2 | From: Brendan Le Foll 3 | Date: Fri, 23 May 2014 15:56:36 +0100 4 | Subject: [PATCH 2/2] dl-elf.c: never look in shared library loader for 5 | libraries 6 | 7 | This essentially does the same as undef __LDSO_SEARCH_INTERP_PATH__ in the 8 | config but makes the hack even clearer. 9 | 10 | Signed-off-by: Brendan Le Foll 11 | --- 12 | ldso/ldso/dl-elf.c | 2 +- 13 | 1 file changed, 1 insertion(+), 1 deletion(-) 14 | 15 | diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c 16 | index 62174d3..db139e7 100644 17 | --- a/ldso/ldso/dl-elf.c 18 | +++ b/ldso/ldso/dl-elf.c 19 | @@ -287,7 +287,7 @@ struct elf_resolve *_dl_load_shared_library(unsigned rflags, struct dyn_elf **rp 20 | } 21 | } 22 | #endif 23 | -#if defined SHARED && defined __LDSO_SEARCH_INTERP_PATH__ 24 | +#if 0 25 | /* Look for libraries wherever the shared library loader 26 | * was installed */ 27 | _dl_if_debug_dprint("\tsearching ldso dir='%s'\n", _dl_ldsopath); 28 | -- 29 | 1.7.10.4 30 | 31 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/uclibc/uclibc/0002-Very-hacky-solution-for-arduino-eeprom-compatibility.patch: -------------------------------------------------------------------------------- 1 | From 34fbba9d0a204d541027fec5b4f0c294a9b1b59e Mon Sep 17 00:00:00 2001 2 | From: Claudius Heine 3 | Date: Thu, 29 Sep 2016 15:13:34 +0200 4 | Subject: [PATCH] Very hacky solution for arduino eeprom compatibility 5 | 6 | This patches the `open()` to change the sysfs filepath to the eeprom. 7 | 8 | Signed-off-by: Claudius Heine 9 | --- 10 | libc/sysdeps/linux/common/open.c | 4 ++++ 11 | 1 file changed, 4 insertions(+) 12 | 13 | diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c 14 | index fd37ea0..28172fe 100644 15 | --- a/libc/sysdeps/linux/common/open.c 16 | +++ b/libc/sysdeps/linux/common/open.c 17 | @@ -29,6 +29,10 @@ int open(const char *file, int oflag, ...) 18 | { 19 | mode_t mode = 0; 20 | 21 | + if (0 == strcmp(file, "/sys/bus/i2c/devices/0-0050/eeprom") || 22 | + 0 == strcmp(file, "/sys/bus/i2c/devices/0-0054/eeprom")) 23 | + file = "/sys/bus/i2c/devices/i2c-INT3499:00/eeprom"; 24 | + 25 | if (oflag & O_CREAT) { 26 | va_list arg; 27 | va_start(arg, oflag); 28 | -- 29 | 2.9.3 30 | 31 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/uclibc/uclibc/config.cfg: -------------------------------------------------------------------------------- 1 | LDSO_STANDALONE_SUPPORT=y 2 | LDSO_PRELINK_SUPPORT=y 3 | UCLIBC_BUILD_MINIMAL_LOCALES="en_US.UTF-8" 4 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/uclibc/uclibc/libgcc_s.so.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siemens/meta-iot2000/f9508ebdc3f6f2a7bf9952773245d64510d467b8/meta-iot2000-example/recipes-galileo/uclibc/uclibc/libgcc_s.so.1 -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/uclibc/uclibc/libstdc++.so.6.0.21: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siemens/meta-iot2000/f9508ebdc3f6f2a7bf9952773245d64510d467b8/meta-iot2000-example/recipes-galileo/uclibc/uclibc/libstdc++.so.6.0.21 -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/uclibc/uclibc_git.bb: -------------------------------------------------------------------------------- 1 | require uclibc.inc 2 | require uclibc-package.inc 3 | require uclibc-git.inc 4 | 5 | STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}" 6 | STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${TARGET_ARCH}" 7 | 8 | DEPENDS = "virtual/${TARGET_PREFIX}binutils \ 9 | virtual/${TARGET_PREFIX}gcc \ 10 | virtual/${TARGET_PREFIX}compilerlibs \ 11 | linux-libc-headers ncurses-native \ 12 | kern-tools-native" 13 | 14 | RDEPENDS_${PN}-dev = "linux-libc-headers-dev" 15 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-galileo/uclibc/uclibc_git.bbappend: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) Siemens AG, 2016 3 | # 4 | # Authors: 5 | # Claudius Heine 6 | # 7 | # This file is subject to the terms and conditions of the MIT License. See 8 | # COPYING.MIT file in the top-level directory. 9 | 10 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 11 | 12 | # I got the libstdc++.so.* and libgcc_s.so.* by compiling them 13 | # with TCLIB="uclibc" and extracted the libstdc++6*.ipk and libgcc1*.ipk with 14 | # "ar x *.ipk" and then data.tar.gz with "tar xf ..." 15 | SRC_URI_append = " \ 16 | file://0001-dl-elf.c-never-look-in-shared-library-loader-for-lib.patch \ 17 | file://0002-Very-hacky-solution-for-arduino-eeprom-compatibility.patch \ 18 | file://config.cfg \ 19 | file://libstdc++.so.6.0.21 \ 20 | file://libgcc_s.so.1 \ 21 | " 22 | 23 | COMPATIBLE_HOST = ".*" 24 | 25 | PROVIDES = "" 26 | 27 | INSTDIR = "/opt/uclibc" 28 | 29 | base_prefix="${INSTDIR}" 30 | 31 | python (){ 32 | configmangle = d.getVar('configmangle', True) 33 | configmangle = configmangle.replace('RUNTIME_PREFIX=\"/\"', 34 | 'RUNTIME_PREFIX=\"${INSTDIR}\"') 35 | configmangle = configmangle.replace('DEVEL_PREFIX=\"/%s\"' % d.getVar('prefix', True), 36 | 'DEVEL_PREFIX=\"${INSTDIR}/${prefix}\"') 37 | configmangle = configmangle.replace('SHARED_LIB_LOADER_PREFIX=\"/lib\"', 38 | 'SHARED_LIB_LOADER_PREFIX=\"${INSTDIR}/lib\"') 39 | d.setVar('configmangle', configmangle) 40 | 41 | d.renameVar('FILES_ldd', 'FILES_%s-ldd' % d.getVar('PN', True)) 42 | packages = d.getVar('PACKAGES', True) 43 | packages = packages.replace('ldd', '%s-ldd' % d.getVar('PN', True)) 44 | d.setVar('PACKAGES', packages) 45 | 46 | instdir = d.getVar('INSTDIR', True) 47 | # Change FILES_${PN}-* Variables: 48 | for sub in ['gconv', 'dev', 'bin', 49 | 'doc', 'locale', 'utils', 50 | 'staticdev', 'ldd', None]: 51 | varname = 'FILES_%s' % d.getVar('PN', True) 52 | if sub: 53 | varname += '-%s' % sub 54 | var = d.getVar(varname, True) 55 | #print(d.keys()) 56 | #print(varname, var) 57 | var = ' '.join(["${INSTDIR}" + s if not s.startswith(instdir) else s for s in var.split()]) 58 | d.setVar(varname, var) 59 | } 60 | 61 | do_install_append() { 62 | ln -s libm.so.1 "${D}${INSTDIR}/lib/libm.so.0" 63 | ln -s libc.so.1 "${D}${INSTDIR}/lib/libc.so.0" 64 | ln -s libpthread.so.1 "${D}${INSTDIR}/lib/libpthread.so.0" 65 | install -m 644 "${WORKDIR}/libstdc++.so.6.0.21" "${D}${INSTDIR}/usr/lib" 66 | install -m 644 "${WORKDIR}/libgcc_s.so.1" "${D}${INSTDIR}/lib" 67 | ln -s libstdc++.so.6.0.21 "${D}${INSTDIR}/usr/lib/libstdc++.so.6" 68 | } 69 | 70 | PRIVATE_LIBS_${PN}-libcrypt = "libcrypt.so.1" 71 | PRIVATE_LIBS_${PN}-libnsl = "libnsl.so.1" 72 | PRIVATE_LIBS_${PN}-librt = "librt.so.1" 73 | PRIVATE_LIBS_${PN}-libutil = "libutil.so.1" 74 | 75 | FILES_${PN}-binlibs = "${INSTDIR}/lib/libgcc_s.so* ${INSTDIR}/usr/lib/libstdc++.so*" 76 | PRIVATE_LIBS_${PN}-binlibs = "libstdc++.so.6.0.21 libstdc++.so.6 libgcc_s.so.1" 77 | 78 | PACKAGES_append = " ${PN}-binlibs" 79 | 80 | INSANE_SKIP_${PN} += "already-stripped" 81 | INSANE_SKIP_${PN}-binlibs += "build-deps" 82 | 83 | export V="1" 84 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-kernel/acm-gadget/acm-gadget.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "Sets up ACM gadget device via configfs" 2 | SECTION = "base" 3 | LICENSE = "GPLv2" 4 | LIC_FILES_CHKSUM = "file://${IOT2000_GPLv2_LICENSE};md5=751419260aa954499f7abaabaa882bbe" 5 | 6 | inherit update-rc.d 7 | 8 | INITSCRIPT_PACKAGES = "${PN}" 9 | INITSCRIPT_NAME = "${PN}" 10 | 11 | SRC_URI = " \ 12 | file://acm-gadget \ 13 | " 14 | 15 | do_install () { 16 | install -d ${D}${sysconfdir}/init.d 17 | cat ${WORKDIR}/acm-gadget | \ 18 | sed -e 's,/etc,${sysconfdir},g' \ 19 | -e 's,/usr/sbin,${sbindir},g' \ 20 | -e 's,/var,${localstatedir},g' \ 21 | -e 's,/usr/bin,${bindir},g' \ 22 | -e 's,/usr,${prefix},g' > ${D}${sysconfdir}/init.d/acm-gadget 23 | chmod a+x ${D}${sysconfdir}/init.d/acm-gadget 24 | } 25 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-kernel/acm-gadget/files/acm-gadget: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # Copyright (c) Siemens AG, 2016 4 | # 5 | # Authors: 6 | # Jan Kiszka 7 | # 8 | # derived from: Sysvinit is Copyright (C) 1991-2004 Miquel van Smoorenburg 9 | # 10 | # This work is licensed under the terms of the GNU GPL, version 2. See 11 | # the COPYING.GPLv2 file in the top-level directory. 12 | # 13 | 14 | ### BEGIN INIT INFO 15 | # Provides: USB gadget device 16 | # Required-Start: $local_fs 17 | # Should-Start: 18 | # Required-Stop: $local_fs 19 | # Should-Stop: 20 | # Default-Start: 2 3 4 5 21 | # Default-Stop: 0 1 6 22 | # Short-Description: Example initscript 23 | # Description: This file should be used to construct scripts to be 24 | # placed in /etc/init.d 25 | ### END INIT INFO 26 | 27 | PATH=/sbin:/usr/sbin:/bin:/usr/bin 28 | 29 | DESC="ACM gadget device" 30 | NAME="acm-gadget" 31 | 32 | CONFIGFS="/sys/kernel/config" 33 | DEVICE=$CONFIGFS/usb_gadget/$NAME 34 | 35 | . /etc/init.d/functions || exit 1 36 | 37 | # 38 | # Function that starts the device 39 | # 40 | do_start() { 41 | if ! mountpoint -q $CONFIGFS; then 42 | mkdir -p $CONFIGFS 43 | mount -t configfs none $CONFIGFS 44 | fi 45 | 46 | mkdir $DEVICE 47 | echo 0x8086 > $DEVICE/idVendor 48 | echo 0xbabe > $DEVICE/idProduct 49 | 50 | mkdir -p $DEVICE/strings/0x409 51 | echo "Siemens AG" > $DEVICE/strings/0x409/manufacturer 52 | echo "IOT2000" > $DEVICE/strings/0x409/product 53 | 54 | mkdir -p $DEVICE/configs/serial.1 55 | mkdir -p $DEVICE/configs/serial.1/strings/0x409 56 | echo "CDC ACM config" > $DEVICE/configs/serial.1/strings/0x409/configuration 57 | 58 | mkdir -p $DEVICE/functions/acm.acm0 59 | ln -s $DEVICE/functions/acm.acm0 $DEVICE/configs/serial.1/ 60 | 61 | echo 0000:00:14.2 > $DEVICE/UDC 62 | } 63 | 64 | # 65 | # Function that stops the daemon/service 66 | # 67 | do_stop() { 68 | echo "Not supported." >&2 69 | exit 1 70 | 71 | rm $DEVICE/configs/serial.1/acm.acm0 72 | rmdir $DEVICE/functions/acm.acm0 # BUG?! This line hangs... 73 | rmdir $DEVICE/configs/serial.1/strings/0x409 74 | rmdir $DEVICE/configs/serial.1 75 | rmdir $DEVICE/strings/0x409 76 | rmdir $DEVICE 77 | 78 | return 0 79 | } 80 | 81 | # 82 | # Function that shows if the gadget device is active 83 | # 84 | status_of_device () { 85 | if [ -d $DEVICE/configs/serial.1 ]; then 86 | echo "$DESC is configured." 87 | exit 0 88 | else 89 | echo "$DESC is not configured." >&2 90 | exit 1 91 | fi 92 | } 93 | 94 | case "$1" in 95 | start) 96 | do_start 97 | ;; 98 | stop) 99 | do_stop || exit $? 100 | ;; 101 | status) 102 | status_of_device 103 | ;; 104 | restart) 105 | do_stop 106 | do_start 107 | ;; 108 | try-restart|force-reload) 109 | do_stop && do_start 110 | ;; 111 | *) 112 | echo "Usage: $0 {start|stop|status|restart|try-restart|force-reload}" >&2 113 | exit 3 114 | ;; 115 | esac 116 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-kernel/galileo-spi1-spidev/files/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := galileo-spi1-spidev.o 2 | 3 | SRC := $(shell pwd) 4 | 5 | all: 6 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) 7 | 8 | modules_install: 9 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install 10 | 11 | clean: 12 | rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c 13 | rm -f Module.markers Module.symvers modules.order 14 | rm -rf .tmp_versions Modules.symvers 15 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-kernel/galileo-spi1-spidev/files/galileo-spi1-spidev.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Register spidev userspace driver with SPI channel 1 3 | * 4 | * Copyright (c) Siemens AG, 2016 5 | * 6 | * Authors: 7 | * Jan Kiszka 8 | * 9 | * This work is licensed under the terms of the GNU GPL, version 2. See 10 | * the COPYING file in the top-level directory. 11 | */ 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | static struct spi_device *spi_device; 18 | 19 | /* Option to allow GPIO 10 to be used for SPI1 chip-select */ 20 | static int gpio_cs; 21 | 22 | module_param(gpio_cs, int, S_IRUGO | S_IWUSR); 23 | MODULE_PARM_DESC(gpio_cs, "Enable GPIO chip-select for SPI channel 1"); 24 | 25 | static struct pxa2xx_spi_chip qrk_ffrd_spi_1_cs_0 = { 26 | .gpio_cs = 10, 27 | }; 28 | 29 | static struct spi_board_info spi1_dev_gpiocs = { 30 | .modalias = "spidev", 31 | .chip_select = 0, 32 | .controller_data = &qrk_ffrd_spi_1_cs_0, 33 | .max_speed_hz = 50000000, 34 | .bus_num = 169, 35 | }; 36 | 37 | static struct spi_board_info spi1_dev = { 38 | .modalias = "spidev", 39 | .chip_select = 0, 40 | .controller_data = NULL, 41 | .max_speed_hz = 50000000, 42 | .bus_num = 169, 43 | }; 44 | 45 | int init_module(void) 46 | { 47 | struct spi_board_info *info; 48 | struct spi_master *master; 49 | 50 | if (gpio_cs) 51 | info = &spi1_dev_gpiocs; 52 | else 53 | info = &spi1_dev; 54 | 55 | master = spi_busnum_to_master(info->bus_num); 56 | if (!master) 57 | return -EINVAL; 58 | 59 | spi_device = spi_new_device(master, info); 60 | put_device(&master->dev); 61 | if (!spi_device) 62 | return -EPERM; 63 | 64 | return 0; 65 | } 66 | 67 | void cleanup_module(void) 68 | { 69 | spi_unregister_device(spi_device); 70 | } 71 | 72 | MODULE_LICENSE("GPL"); 73 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-kernel/galileo-spi1-spidev/galileo-spi1-spidev_0.1.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "Register spidev userspace driver with SPI channel 1" 2 | LICENSE = "GPLv2" 3 | LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e" 4 | 5 | inherit module 6 | 7 | SRC_URI = "file://Makefile \ 8 | file://galileo-spi1-spidev.c \ 9 | file://COPYING \ 10 | " 11 | 12 | S = "${WORKDIR}" 13 | 14 | do_install_append() { 15 | install -d ${D}${sysconfdir}/modules-load.d 16 | echo "galileo-spi1-spidev" > ${D}${sysconfdir}/modules-load.d/galileo-spi1-spidev.conf 17 | } 18 | 19 | # The inherit of module.bbclass will automatically name module packages with 20 | # "kernel-module-" prefix as required by the oe-core build environment. 21 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-kernel/galileo-uio-gpio/files/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := galileo-uio-gpio.o 2 | 3 | SRC := $(shell pwd) 4 | 5 | all: 6 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) 7 | 8 | modules_install: 9 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install 10 | 11 | clean: 12 | rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c 13 | rm -f Module.markers Module.symvers modules.order 14 | rm -rf .tmp_versions Modules.symvers 15 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-kernel/galileo-uio-gpio/files/galileo-uio-gpio.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Don't try this at home... 3 | * 4 | * Copyright (c) Siemens AG, 2016 5 | * 6 | * Authors: 7 | * Jan Kiszka 8 | * 9 | * This work is licensed under the terms of the GNU GPL, version 2. See 10 | * the COPYING file in the top-level directory. 11 | * 12 | * Derived from drivers/mfd/intel_qrk_gip_gpio.c of meta-intel-galileo 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #define GIP_GPIO_BAR 1 20 | 21 | #define SCH_GPIOBASE 0x44 22 | #define SCH_GPIO_IO_SIZE 64 23 | 24 | static struct pci_dev *gip_dev; 25 | static struct pci_dev *sch_dev; 26 | static struct uio_info uio_gip; 27 | static struct uio_info uio_sch; 28 | static void __iomem *gip_reg_base; 29 | 30 | int init_module(void) 31 | { 32 | resource_size_t start, len; 33 | unsigned int base_addr_cfg; 34 | int err; 35 | 36 | gip_dev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x0934, NULL); 37 | if (!gip_dev) 38 | return -ENODEV; 39 | 40 | start = pci_resource_start(gip_dev, GIP_GPIO_BAR); 41 | len = pci_resource_len(gip_dev, GIP_GPIO_BAR); 42 | 43 | gip_reg_base = ioremap_nocache(start, len); 44 | if (!gip_reg_base) { 45 | err = -EFAULT; 46 | goto err_gip_devput; 47 | } 48 | 49 | uio_gip.mem[0].addr = start; 50 | uio_gip.mem[0].internal_addr = gip_reg_base; 51 | uio_gip.mem[0].size = len; 52 | uio_gip.mem[0].memtype = UIO_MEM_PHYS; 53 | uio_gip.mem[0].name = "gpio_regs"; 54 | uio_gip.name = "gpio uio"; 55 | uio_gip.version = "0.0.1"; 56 | 57 | err = uio_register_device(&gip_dev->dev, &uio_gip); 58 | if (err) 59 | goto err_gip_unmap; 60 | 61 | sch_dev = pci_get_device(PCI_VENDOR_ID_INTEL, 62 | PCI_DEVICE_ID_INTEL_QUARK_X1000_ILB, NULL); 63 | if (!sch_dev) { 64 | err = -ENODEV; 65 | goto err_gip_unregister; 66 | } 67 | 68 | pci_read_config_dword(sch_dev, SCH_GPIOBASE, &base_addr_cfg); 69 | if (!(base_addr_cfg & (1 << 31))) { 70 | err = -EIO; 71 | goto err_sch_devput; 72 | } 73 | 74 | uio_sch.port[0].start = (unsigned short)base_addr_cfg; 75 | uio_sch.port[0].size = SCH_GPIO_IO_SIZE; 76 | uio_sch.port[0].porttype = UIO_PORT_X86; 77 | uio_sch.port[0].name = "gpio_regs"; 78 | uio_sch.name = "sch_gpio"; 79 | uio_sch.version = "0.0.1"; 80 | 81 | err = uio_register_device(&sch_dev->dev, &uio_sch); 82 | if (err) 83 | goto err_sch_devput; 84 | 85 | return 0; 86 | 87 | err_sch_devput: 88 | pci_dev_put(gip_dev); 89 | err_gip_unregister: 90 | uio_unregister_device(&uio_gip); 91 | err_gip_unmap: 92 | iounmap(gip_reg_base); 93 | err_gip_devput: 94 | pci_dev_put(gip_dev); 95 | return err; 96 | } 97 | 98 | void cleanup_module(void) 99 | { 100 | uio_unregister_device(&uio_sch); 101 | pci_dev_put(sch_dev); 102 | 103 | uio_unregister_device(&uio_gip); 104 | iounmap(gip_reg_base); 105 | pci_dev_put(gip_dev); 106 | } 107 | 108 | MODULE_LICENSE("GPL"); 109 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-kernel/galileo-uio-gpio/galileo-uio-gpio_0.1.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "Crude UIO driver for the Galileo to map GPIO registers into userspace" 2 | LICENSE = "GPLv2" 3 | LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e" 4 | 5 | inherit module 6 | 7 | SRC_URI = "file://Makefile \ 8 | file://galileo-uio-gpio.c \ 9 | file://COPYING \ 10 | " 11 | 12 | S = "${WORKDIR}" 13 | 14 | do_install_append() { 15 | install -d ${D}${sysconfdir}/modules-load.d 16 | echo "galileo-uio-gpio" > ${D}${sysconfdir}/modules-load.d/galileo-uio-gpio.conf 17 | } 18 | 19 | # The inherit of module.bbclass will automatically name module packages with 20 | # "kernel-module-" prefix as required by the oe-core build environment. 21 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-kernel/galileogen2-fake/files/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := galileogen2-fake.o 2 | 3 | SRC := $(shell pwd) 4 | 5 | all: 6 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) 7 | 8 | modules_install: 9 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install 10 | 11 | clean: 12 | rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c 13 | rm -f Module.markers Module.symvers modules.order 14 | rm -rf .tmp_versions Modules.symvers 15 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-kernel/galileogen2-fake/files/galileogen2-fake.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Don't ask... 3 | * 4 | * Copyright (c) Siemens AG, 2016 5 | * 6 | * Authors: 7 | * Jan Kiszka 8 | * 9 | * This work is licensed under the terms of the GNU GPL, version 2. See 10 | * the COPYING file in the top-level directory. 11 | */ 12 | 13 | #include 14 | #include 15 | 16 | #define PLATFORM_NAME "GalileoGen2" 17 | 18 | static struct platform_device *pd; 19 | 20 | static struct platform_driver galileo_platform_driver = { 21 | .driver = { 22 | .name = PLATFORM_NAME, 23 | }, 24 | }; 25 | 26 | int init_module(void) 27 | { 28 | int err; 29 | 30 | err = platform_driver_register(&galileo_platform_driver); 31 | 32 | pd = platform_device_register_simple(PLATFORM_NAME, -1, NULL, 0); 33 | if (IS_ERR(pd)) { 34 | platform_driver_unregister(&galileo_platform_driver); 35 | return PTR_ERR(pd); 36 | } 37 | 38 | return 0; 39 | } 40 | 41 | void cleanup_module(void) 42 | { 43 | platform_device_unregister(pd); 44 | platform_driver_unregister(&galileo_platform_driver); 45 | } 46 | 47 | MODULE_LICENSE("GPL"); 48 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-kernel/galileogen2-fake/galileogen2-fake_0.1.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "Fake a platform driver module GalileoGen2 for Arduino sketches" 2 | LICENSE = "GPLv2" 3 | LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e" 4 | 5 | inherit module 6 | 7 | SRC_URI = "file://Makefile \ 8 | file://galileogen2-fake.c \ 9 | file://COPYING \ 10 | " 11 | 12 | S = "${WORKDIR}" 13 | 14 | do_install_append() { 15 | install -d ${D}${sysconfdir}/modules-load.d 16 | echo "galileogen2-fake" > ${D}${sysconfdir}/modules-load.d/galileogen2-fake.conf 17 | } 18 | 19 | # The inherit of module.bbclass will automatically name module packages with 20 | # "kernel-module-" prefix as required by the oe-core build environment. 21 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-kernel/linux/configs/iot2000-example.scc: -------------------------------------------------------------------------------- 1 | define KFEATURE_DESCRIPTION "IOT2000 example image kernel options" 2 | kconf hardware iot2000-example.cfg 3 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-kernel/linux/linux-cip-rt_4.4.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/configs:" 2 | 3 | SRC_URI += "file://iot2000-example.scc" 4 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-kernel/linux/linux-cip_4.4.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/configs:" 2 | 3 | SRC_URI += " \ 4 | file://iot2000-example.scc \ 5 | file://iot2000-example.cfg" 6 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-node/mindconnect-node-red-contrib-mindconnect/mindconnect-node-red-contrib-mindconnect_3.9.1.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "node red mindconnect node using mindconnect-nodejs library." 2 | 3 | # WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is 4 | # your responsibility to verify that the values are complete and correct. 5 | LICENSE = "MIT & BSD-3-Clause & BSD-2-Clause & ISC & Apache-2.0" 6 | LIC_FILES_CHKSUM = "file://LICENSE.md;md5=f2855717eed783b240d92baadef2c81f" 7 | 8 | inherit npm-ng 9 | 10 | NPMPN = "@mindconnect/node-red-contrib-mindconnect" 11 | NPM_LOCAL_INSTALL_DIR = "/home/root/.node-red" 12 | 13 | RDEPENDS_${PN} += "bash" 14 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-node/node-red-contrib-boolean-logic/files/npm-shrinkwrap.json: -------------------------------------------------------------------------------- 1 | { 2 | "requires": true, 3 | "lockfileVersion": 1, 4 | "dependencies": { 5 | "node-red-contrib-boolean-logic": { 6 | "version": "0.0.3", 7 | "resolved": "https://registry.npmjs.org/node-red-contrib-boolean-logic/-/node-red-contrib-boolean-logic-0.0.3.tgz", 8 | "integrity": "sha1-ObgL6YZ7PO+5z+ZgwWVX0HMBvMQ=" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-node/node-red-contrib-boolean-logic/node-red-contrib-boolean-logic_0.0.3.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "A set of Node-RED nodes for boolean logic" 2 | LICENSE = "MIT" 3 | LIC_FILES_CHKSUM = "file://LICENSE;md5=d5a1ff81f6ad90b88ba24f2a1fd4db83" 4 | 5 | inherit npm-ng 6 | 7 | NPM_LOCAL_INSTALL_DIR = "/home/root/.node-red" 8 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-node/node-red-contrib-modbus/node-red-contrib-modbus_5.13.3.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "The all in one Modbus TCP and Serial contribution package for Node-RED" 2 | 3 | # WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is 4 | # your responsibility to verify that the values are complete and correct. 5 | LICENSE = "BSD-2-Clause & BSD-3-Clause & Apache-2.0 & ISC & MIT" 6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=4ce3d0350364f3efff545d6ba54f61eb" 7 | 8 | inherit npm-ng 9 | 10 | export PYTHON = "python3" 11 | 12 | NPM_LOCAL_INSTALL_DIR = "/home/root/.node-red" 13 | 14 | INSANE_SKIP_${PN} += "textrel" 15 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-node/node-red-contrib-opcua/node-red-contrib-opcua_0.2.88.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "A Node-RED nodes to communicate or serve via OPC UA." 2 | 3 | # WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is 4 | # your responsibility to verify that the values are complete and correct. 5 | LICENSE = "BSD-2-Clause & BSD-3-Clause & Apache-2.0 & ISC & MIT | GPL-2.0" 6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=ba714a6d98076972d6313481e4887def" 7 | 8 | inherit npm-ng 9 | 10 | NPM_LOCAL_INSTALL_DIR = "/home/root/.node-red" 11 | 12 | INSANE_SKIP_${PN} += "textrel" 13 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-node/node-red-dashboard/node-red-dashboard_2.23.4.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "A set of dashboard nodes for Node-RED" 2 | 3 | # WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is 4 | # your responsibility to verify that the values are complete and correct. 5 | LICENSE = "BSD-2-Clause & BSD-3-Clause & Apache-2.0 & ISC & MIT" 6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=088ce976a5d78ef059391f1ca042eb3d" 7 | 8 | inherit npm-ng 9 | 10 | NPM_LOCAL_INSTALL_DIR = "/home/root/.node-red" 11 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-node/node-red-node-intel-gpio/files/0002-intel-gpio-Consistently-use-this-where-available.patch: -------------------------------------------------------------------------------- 1 | From a4dd2b0e9e54d77454c00dd31397cadae0ca9879 Mon Sep 17 00:00:00 2001 2 | From: Jan Kiszka 3 | Date: Mon, 29 Apr 2019 12:31:08 +0200 4 | Subject: [PATCH 02/11] intel-gpio: Consistently use "this" where available 5 | 6 | The "node" alias variable is for use in callbacks. 7 | 8 | Signed-off-by: Jan Kiszka 9 | --- 10 | hardware/intel/mraa-gpio-din.js | 8 ++++---- 11 | hardware/intel/mraa-gpio-dout.js | 16 ++++++++-------- 12 | 2 files changed, 12 insertions(+), 12 deletions(-) 13 | 14 | diff --git a/hardware/intel/mraa-gpio-din.js b/hardware/intel/mraa-gpio-din.js 15 | index 5966e44..a11c5e0 100644 16 | --- a/hardware/intel/mraa-gpio-din.js 17 | +++ b/hardware/intel/mraa-gpio-din.js 18 | @@ -35,17 +35,17 @@ module.exports = function(RED) { 19 | } 20 | } 21 | }); 22 | - switch (node.x.read()) { 23 | + switch (this.x.read()) { 24 | case 0: { 25 | - node.status({fill:"green",shape:"ring",text:"low"}); 26 | + this.status({fill:"green",shape:"ring",text:"low"}); 27 | break; 28 | } 29 | case 1: { 30 | - node.status({fill:"green",shape:"dot",text:"high"}); 31 | + this.status({fill:"green",shape:"dot",text:"high"}); 32 | break; 33 | } 34 | default: { 35 | - node.status({}); 36 | + this.status({}); 37 | } 38 | } 39 | this.on('close', function() { 40 | diff --git a/hardware/intel/mraa-gpio-dout.js b/hardware/intel/mraa-gpio-dout.js 41 | index 020db55..1c97e0a 100644 42 | --- a/hardware/intel/mraa-gpio-dout.js 43 | +++ b/hardware/intel/mraa-gpio-dout.js 44 | @@ -8,18 +8,18 @@ module.exports = function(RED) { 45 | this.set = n.set; 46 | this.level = Number(n.level); 47 | var node = this; 48 | - if (node.pin === 14) { 49 | - node.p = new m.Gpio(3,false,true); // special for onboard LED v1 50 | + if (this.pin === 14) { 51 | + this.p = new m.Gpio(3,false,true); // special for onboard LED v1 52 | } 53 | else { 54 | - node.p = new m.Gpio(node.pin); 55 | + this.p = new m.Gpio(node.pin); 56 | } 57 | - node.p.mode(m.PIN_GPIO); 58 | - node.p.dir(m.DIR_OUT); 59 | - if (node.set) { 60 | - node.p.write(node.level); 61 | + this.p.mode(m.PIN_GPIO); 62 | + this.p.dir(m.DIR_OUT); 63 | + if (this.set) { 64 | + this.p.write(this.level); 65 | } 66 | - node.on("input", function(msg) { 67 | + this.on("input", function(msg) { 68 | if (msg.payload == "1") { 69 | node.p.write(1); 70 | } 71 | -- 72 | 2.16.4 73 | 74 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-node/node-red-node-intel-gpio/files/0003-intel-gpio-Add-support-for-initial-message-from-digi.patch: -------------------------------------------------------------------------------- 1 | From 357d7e2adc9cfa82854af1983ade56e015aedac7 Mon Sep 17 00:00:00 2001 2 | From: Jan Kiszka 3 | Date: Mon, 29 Apr 2019 12:19:03 +0200 4 | Subject: [PATCH 03/11] intel-gpio: Add support for initial message from 5 | digital input 6 | 7 | This allows to send out an initial message with the current digital pin 8 | state on startup, simplifying initializations of certain flows. 9 | 10 | Signed-off-by: Jan Kiszka 11 | --- 12 | hardware/intel/mraa-gpio-din.html | 8 +++++++- 13 | hardware/intel/mraa-gpio-din.js | 8 +++++++- 14 | 2 files changed, 14 insertions(+), 2 deletions(-) 15 | 16 | diff --git a/hardware/intel/mraa-gpio-din.html b/hardware/intel/mraa-gpio-din.html 17 | index 0abc49c..13916fd 100644 18 | --- a/hardware/intel/mraa-gpio-din.html 19 | +++ b/hardware/intel/mraa-gpio-din.html 20 | @@ -7,7 +7,8 @@ 21 | defaults: { 22 | name: {value:""}, 23 | pin: {value:"", required: true}, 24 | - interrupt: {value:"", required: true} 25 | + interrupt: {value:"", required: true}, 26 | + initial: {value: false} 27 | }, 28 | inputs:0, 29 | outputs:1, 30 | @@ -70,6 +71,11 @@ 31 | 32 | 33 | 34 | +
35 | + 36 | + 37 | + 38 | +
39 |
40 | 41 | 42 | diff --git a/hardware/intel/mraa-gpio-din.js b/hardware/intel/mraa-gpio-din.js 43 | index a11c5e0..2ce87b1 100644 44 | --- a/hardware/intel/mraa-gpio-din.js 45 | +++ b/hardware/intel/mraa-gpio-din.js 46 | @@ -8,6 +8,7 @@ module.exports = function(RED) { 47 | this.pin = n.pin; 48 | this.interrupt = n.interrupt; 49 | this.x = new m.Gpio(parseInt(this.pin)); 50 | + this.initialMsg = n.initial; 51 | this.board = m.getPlatformName(); 52 | var node = this; 53 | node.x.mode(m.PIN_GPIO); 54 | @@ -35,7 +36,9 @@ module.exports = function(RED) { 55 | } 56 | } 57 | }); 58 | - switch (this.x.read()) { 59 | + 60 | + var initialState = this.x.read(); 61 | + switch (initialState) { 62 | case 0: { 63 | this.status({fill:"green",shape:"ring",text:"low"}); 64 | break; 65 | @@ -48,6 +51,9 @@ module.exports = function(RED) { 66 | this.status({}); 67 | } 68 | } 69 | + if (this.initialMsg) 70 | + eventHandler(initialState); 71 | + 72 | this.on('close', function() { 73 | node.x.isr(m.EDGE_BOTH, null); 74 | }); 75 | -- 76 | 2.16.4 77 | 78 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-node/node-red-node-intel-gpio/files/0004-intel-gpio-Use-isrExit-in-favor-of-isr-m.EDGE_BOTH-n.patch: -------------------------------------------------------------------------------- 1 | From 3bf5436a51ea40b5d78c095f1cf3e785e9061c30 Mon Sep 17 00:00:00 2001 2 | From: Jan Kiszka 3 | Date: Mon, 29 Apr 2019 12:46:28 +0200 4 | Subject: [PATCH 04/11] intel-gpio: Use isrExit in favor of isr(m.EDGE_BOTH, 5 | null) 6 | 7 | Provides a cleaner shutdown. 8 | 9 | Signed-off-by: Jan Kiszka 10 | --- 11 | hardware/intel/mraa-gpio-din.js | 2 +- 12 | 1 file changed, 1 insertion(+), 1 deletion(-) 13 | 14 | diff --git a/hardware/intel/mraa-gpio-din.js b/hardware/intel/mraa-gpio-din.js 15 | index 2ce87b1..031341a 100644 16 | --- a/hardware/intel/mraa-gpio-din.js 17 | +++ b/hardware/intel/mraa-gpio-din.js 18 | @@ -55,7 +55,7 @@ module.exports = function(RED) { 19 | eventHandler(initialState); 20 | 21 | this.on('close', function() { 22 | - node.x.isr(m.EDGE_BOTH, null); 23 | + node.x.isrExit(); 24 | }); 25 | } 26 | RED.nodes.registerType("mraa-gpio-din", gpioDin); 27 | -- 28 | 2.16.4 29 | 30 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-node/node-red-node-intel-gpio/files/0006-intel-gpio-Respect-user-defined-name-for-output-pin-.patch: -------------------------------------------------------------------------------- 1 | From 80658c52d10c7eb785d3f4f006b1f5e7609bd97a Mon Sep 17 00:00:00 2001 2 | From: Jan Kiszka 3 | Date: Mon, 6 May 2019 00:07:38 +0200 4 | Subject: [PATCH 06/11] intel-gpio: Respect user-defined name for output pin 14 5 | 6 | No reason to hard-code "LED" here. 7 | 8 | Signed-off-by: Jan Kiszka 9 | --- 10 | hardware/intel/mraa-gpio-dout.html | 5 +++-- 11 | 1 file changed, 3 insertions(+), 2 deletions(-) 12 | 13 | diff --git a/hardware/intel/mraa-gpio-dout.html b/hardware/intel/mraa-gpio-dout.html 14 | index 6c37a41..bcbfbd0 100644 15 | --- a/hardware/intel/mraa-gpio-dout.html 16 | +++ b/hardware/intel/mraa-gpio-dout.html 17 | @@ -16,8 +16,9 @@ 18 | align: "right", 19 | label: function() { 20 | if (this.pin === "14") { 21 | - return "LED"; 22 | - } else { 23 | + return this.name || "LED"; 24 | + } 25 | + else { 26 | return this.name||"D"+this.pin; 27 | } 28 | }, 29 | -- 30 | 2.16.4 31 | 32 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-node/node-red-node-intel-gpio/files/0007-intel-gpio-Mark-output-pin-13-as-LED-on-Galileo-v2.patch: -------------------------------------------------------------------------------- 1 | From a34eb83826ea31417b037aeb6579d6d3df8955ae Mon Sep 17 00:00:00 2001 2 | From: Jan Kiszka 3 | Date: Mon, 6 May 2019 00:13:00 +0200 4 | Subject: [PATCH 07/11] intel-gpio: Mark output pin 13 as "LED" on Galileo v2 5 | 6 | At least for that board we know that D13 is connected to an LED. 7 | Visualize that. 8 | 9 | Signed-off-by: Jan Kiszka 10 | --- 11 | hardware/intel/mraa-gpio-dout.html | 8 +++++++- 12 | 1 file changed, 7 insertions(+), 1 deletion(-) 13 | 14 | diff --git a/hardware/intel/mraa-gpio-dout.html b/hardware/intel/mraa-gpio-dout.html 15 | index bcbfbd0..0900039 100644 16 | --- a/hardware/intel/mraa-gpio-dout.html 17 | +++ b/hardware/intel/mraa-gpio-dout.html 18 | @@ -6,6 +6,7 @@ 19 | paletteLabel: 'digital', 20 | defaults: { 21 | name: {value:""}, 22 | + d13suffix: {value:""}, 23 | pin: {value:"", required: true}, 24 | set: { value:"" }, 25 | level: { value:"0" } 26 | @@ -19,7 +20,7 @@ 27 | return this.name || "LED"; 28 | } 29 | else { 30 | - return this.name||"D"+this.pin; 31 | + return this.name || "D" + this.pin + (this.pin === "13" ? this.d13suffix : ""); 32 | } 33 | }, 34 | labelStyle: function() { 35 | @@ -27,6 +28,7 @@ 36 | }, 37 | oneditprepare: function() { 38 | var pinnow = this.pin; 39 | + var node = this; 40 | $.getJSON('mraa-gpio/'+this.id,function(data) { 41 | var t = "unknown"; 42 | if (data === 0) { t = "Galileo v1"; } 43 | @@ -41,6 +43,10 @@ 44 | if (data === 0) { 45 | $('#node-input-pin').append($("").attr("value",14).text("LED - Galileo v1")); 46 | } 47 | + if (data === 1) { 48 | + node.d13suffix = " (Green LED)"; 49 | + $('#node-input-pin [value=13]').text("D13 (Green LED)"); 50 | + } 51 | $('#node-input-pin').val(pinnow); 52 | }); 53 | $.getJSON('mraa-version/'+this.id,function(data) { 54 | -- 55 | 2.16.4 56 | 57 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-node/node-red-node-intel-gpio/files/0011-intel-gpio-Privatize-version.patch: -------------------------------------------------------------------------------- 1 | From 497b0fbbc7b0a197eb38a64076dab9bb7dcba859 Mon Sep 17 00:00:00 2001 2 | From: Jan Kiszka 3 | Date: Tue, 7 May 2019 17:24:08 +0200 4 | Subject: [PATCH 11/11] intel-gpio: Privatize version 5 | 6 | This allows to build our own package that is newer than the official 7 | one. 8 | 9 | Signed-off-by: Jan Kiszka 10 | --- 11 | hardware/intel/package.json | 2 +- 12 | 1 file changed, 1 insertion(+), 1 deletion(-) 13 | 14 | diff --git a/hardware/intel/package.json b/hardware/intel/package.json 15 | index 6f66fe4..53d1319 100644 16 | --- a/hardware/intel/package.json 17 | +++ b/hardware/intel/package.json 18 | @@ -1,6 +1,6 @@ 19 | { 20 | "name" : "node-red-node-intel-gpio", 21 | - "version" : "0.0.6", 22 | + "version" : "1.0.0-iot2000", 23 | "description" : "A Node-RED node to talk to an Intel Galileo or Edison using mraa", 24 | "dependencies" : { 25 | }, 26 | -- 27 | 2.16.4 28 | 29 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-node/node-red-node-intel-gpio/node-red-node-intel-gpio_1.0.0-iot2000.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "A Node-RED node to talk to an Intel Galileo or Edison using mraa" 2 | 3 | LICENSE = "Apache-2.0" 4 | LIC_FILES_CHKSUM = "file://hardware/intel/LICENSE;md5=2c0cb74248cfa16e787ab1cf4c16e94e" 5 | 6 | SRC_URI = "git://github.com/node-red/node-red-nodes;protocol=https \ 7 | file://0001-intel-gpio-HTML-cleanups.patch \ 8 | file://0002-intel-gpio-Consistently-use-this-where-available.patch \ 9 | file://0003-intel-gpio-Add-support-for-initial-message-from-digi.patch \ 10 | file://0004-intel-gpio-Use-isrExit-in-favor-of-isr-m.EDGE_BOTH-n.patch \ 11 | file://0005-intel-gpio-Add-polling-of-input-pins-in-absence-of-i.patch \ 12 | file://0006-intel-gpio-Respect-user-defined-name-for-output-pin-.patch \ 13 | file://0007-intel-gpio-Mark-output-pin-13-as-LED-on-Galileo-v2.patch \ 14 | file://0008-intel-gpio-Add-support-for-user-button-on-Galileo-v2.patch \ 15 | file://0009-intel-gpio-Add-IOT2020-and-IOT2040-board-detection.patch \ 16 | file://0010-intel-gpio-Add-support-for-red-LED-of-IOT2040.patch \ 17 | file://0011-intel-gpio-Privatize-version.patch" 18 | SRCREV = "8d45e85acfa10b53fb94b1d6bfc16b9f8cc39eea" 19 | 20 | RDEPENDS_${PN} += "node-red" 21 | 22 | S = "${WORKDIR}/git" 23 | 24 | NODE_MODULES_DIR = "/usr/lib/node/node-red/node_modules" 25 | 26 | do_install() { 27 | install -d ${D}${NODE_MODULES_DIR}/${PN} 28 | install -m 0644 ${S}/hardware/intel/* ${D}${NODE_MODULES_DIR}/${PN} 29 | } 30 | 31 | FILES_${PN} = "${NODE_MODULES_DIR}/${PN}" 32 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-node/node-red-node-serialport/node-red-node-serialport_0.11.0.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "Node-RED nodes to talk to serial ports" 2 | 3 | # WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is 4 | # your responsibility to verify that the values are complete and correct. 5 | LICENSE = "BSD-2-Clause & BSD-3-Clause & MIT & ISC & Apache-2.0" 6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=6621dba0ae00c5595cc3b482008b021a" 7 | 8 | inherit npm-ng 9 | 10 | export PYTHON = "python3" 11 | 12 | NPM_LOCAL_INSTALL_DIR = "/home/root/.node-red" 13 | 14 | INSANE_SKIP_${PN} += "textrel" 15 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-node/node-red-nodes/node-red-nodes.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "Preinstalled Node-RED nodes for the IOT2000" 2 | 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${IOT2000_MIT_LICENSE};md5=838c366f69b72c5df05c96dff79b35f2" 5 | 6 | NODE_RED_PACKAGES = " \ 7 | node-red-dashboard \ 8 | node-red-node-serialport \ 9 | node-red-contrib-boolean-logic \ 10 | node-red-contrib-iiot-opcua \ 11 | node-red-contrib-modbus \ 12 | @mindconnect/node-red-contrib-mindconnect" 13 | 14 | RDEPENDS_${PN} += " \ 15 | node-red-dashboard \ 16 | node-red-node-serialport \ 17 | node-red-node-intel-gpio \ 18 | node-red-contrib-boolean-logic \ 19 | node-red-contrib-opcua \ 20 | node-red-contrib-modbus \ 21 | mindconnect-node-red-contrib-mindconnect" 22 | 23 | python do_compile() { 24 | import json 25 | 26 | with open("package.json", 'w') as outfile: 27 | packages = d.getVar('NODE_RED_PACKAGES').split() 28 | json_objs = { 29 | 'name': 'node-red-project', 30 | 'description': 'A Node-RED Project', 31 | 'version': '0.0.1', 32 | 'private': True, 33 | 'dependencies': { package: '*' for package in packages} 34 | } 35 | json.dump(json_objs, outfile, indent=2) 36 | } 37 | 38 | do_install() { 39 | install -d ${D}/home/root/.node-red/ 40 | install -m 0644 ${S}/package.json ${D}/home/root/.node-red/ 41 | } 42 | 43 | FILES_${PN} = "/home/root/.node-red/package.json" 44 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-node/node-red/files/node-red.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ### BEGIN INIT INFO 4 | # Provides: node-red 5 | # Required-Start: $network $syslog 6 | # Should-Start: 7 | # Required-Stop: $network $syslog 8 | # Should-Stop: 9 | # Default-Start: 2 3 4 5 10 | # Default-Stop: 0 1 6 11 | # Short-Description: Node-RED 12 | ### END INIT INFO 13 | 14 | pidfile=/var/run/node-red.pid 15 | 16 | case "$1" in 17 | start) 18 | echo -n "Starting node-red: " 19 | HOME=/home/root 20 | start-stop-daemon -q -S -m -p $pidfile -b --startas /bin/bash -- \ 21 | -c "exec node /usr/lib/node/node-red/red >> /var/log/node-red.log 2>&1" 22 | RETVAL=$? 23 | if [ $RETVAL -eq 0 ] ; then 24 | echo "OK" 25 | else 26 | echo "FAIL" 27 | fi 28 | ;; 29 | stop) 30 | echo -n "Stopping node-red: " 31 | start-stop-daemon -q -K -p $pidfile 32 | rm -f $pidfile 33 | echo "OK" 34 | ;; 35 | status) 36 | if [ -f $pidfile ]; then 37 | echo "node-red (pid $(cat $pidfile)) is running..." 38 | exit 0 39 | else 40 | echo "node-red is stopped" 41 | fi 42 | exit 3 43 | ;; 44 | restart) 45 | $0 stop 46 | $0 start 47 | ;; 48 | *) 49 | echo "Usage: $0 {start|stop|restart|status}" 50 | exit 1 51 | ;; 52 | esac 53 | 54 | exit 0 55 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-node/node-red/node-red_1.2.1.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "A visual tool for wiring the Internet of Things" 2 | HOMEPAGE = "http://nodered.org" 3 | 4 | # WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is 5 | # your responsibility to verify that the values are complete and correct. 6 | LICENSE = "Apache-2.0 & ISC & BSD-2-Clause & BSD & EUPL-1.1 & BSD-3-Clause & MIT" 7 | LIC_FILES_CHKSUM = "file://LICENSE;md5=d6f37569f5013072e9490d2194d10ae6" 8 | 9 | inherit npm-ng 10 | 11 | SRC_URI += "file://node-red.init" 12 | 13 | do_install_append() { 14 | install -d ${D}${sysconfdir}/init.d 15 | install -m 0755 ${WORKDIR}/node-red.init ${D}${sysconfdir}/init.d/node-red 16 | } 17 | 18 | FILES_${PN} += "${sysconfdir}/init.d/node-red.sh ${bindir}/node-red" 19 | 20 | RDEPENDS_${PN} += "python3 bash" 21 | 22 | INSANE_SKIP_${PN} += "textrel" 23 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-support/swupdate/swupdate/defconfig: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated file; DO NOT EDIT. 3 | # Swupdate Configuration 4 | # 5 | CONFIG_HAVE_DOT_CONFIG=y 6 | 7 | # 8 | # Swupdate Settings 9 | # 10 | 11 | # 12 | # General Configuration 13 | # 14 | CONFIG_CURL=y 15 | # CONFIG_SYSTEMD is not set 16 | CONFIG_SCRIPTS=y 17 | # CONFIG_HW_COMPATIBILITY is not set 18 | CONFIG_SW_VERSIONS_FILE="/etc/sw-versions" 19 | 20 | # 21 | # Socket Paths 22 | # 23 | CONFIG_SOCKET_CTRL_PATH="/tmp/sockinstctrl" 24 | CONFIG_SOCKET_PROGRESS_PATH="/tmp/swupdateprog" 25 | CONFIG_SOCKET_REMOTE_HANDLER_DIRECTORY="/tmp/" 26 | # CONFIG_MTD is not set 27 | CONFIG_LUA=y 28 | # CONFIG_LUAPKG is not set 29 | # CONFIG_FEATURE_SYSLOG is not set 30 | 31 | # 32 | # Build Options 33 | # 34 | CONFIG_CROSS_COMPILE="" 35 | CONFIG_SYSROOT="" 36 | CONFIG_EXTRA_CFLAGS="" 37 | CONFIG_EXTRA_LDFLAGS="" 38 | CONFIG_EXTRA_LDLIBS="" 39 | 40 | # 41 | # Debugging Options 42 | # 43 | # CONFIG_DEBUG is not set 44 | # CONFIG_WERROR is not set 45 | # CONFIG_NOCLEANUP is not set 46 | CONFIG_BOOTLOADER_EBG=y 47 | # CONFIG_UBOOT is not set 48 | # CONFIG_BOOTLOADER_NONE is not set 49 | # CONFIG_BOOTLOADER_GRUB is not set 50 | CONFIG_DOWNLOAD=y 51 | CONFIG_CHANNEL_CURL=y 52 | CONFIG_HASH_VERIFY=y 53 | # CONFIG_SIGNED_IMAGES is not set 54 | # CONFIG_ENCRYPTED_IMAGES is not set 55 | # CONFIG_SURICATTA is not set 56 | 57 | # 58 | # Features 59 | # 60 | # CONFIG_SURICATTA_SSL is not set 61 | # CONFIG_SURICATTA_STATE_CHOICE_NONE is not set 62 | # CONFIG_SURICATTA_STATE_CHOICE_BOOTLOADER is not set 63 | # CONFIG_SURICATTA_STATE_BOOTLOADER is not set 64 | 65 | # 66 | # Server 67 | # 68 | # CONFIG_SURICATTA_HAWKBIT is not set 69 | # CONFIG_WEBSERVER is not set 70 | CONFIG_GUNZIP=y 71 | 72 | # 73 | # Parser Features 74 | # 75 | CONFIG_LIBCONFIG=y 76 | CONFIG_PARSERROOT="" 77 | # CONFIG_JSON is not set 78 | CONFIG_LUAEXTERNAL=y 79 | # CONFIG_SETEXTPARSERNAME is not set 80 | # CONFIG_SETSWDESCRIPTION is not set 81 | 82 | # 83 | # Image Handlers 84 | # 85 | CONFIG_RAW=y 86 | CONFIG_LUASCRIPTHANDLER=y 87 | # CONFIG_SHELLSCRIPTHANDLER is not set 88 | CONFIG_HANDLER_IN_LUA=y 89 | CONFIG_EMBEDDED_LUA_HANDLER=y 90 | CONFIG_EMBEDDED_LUA_HANDLER_SOURCE="swupdate_handlers.lua" 91 | CONFIG_ARCHIVE=y 92 | CONFIG_REMOTE_HANDLER=y 93 | # CONFIG_SWUFORWARDER_HANDLER is not set 94 | CONFIG_BOOTLOADERHANDLER=y 95 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-support/swupdate/swupdate/progress_firmware.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Christian Storm 3 | * Copyright (C) 2018, Siemens AG 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of 8 | * the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | static int connect2swupdate(bool retry) 30 | { 31 | struct sockaddr_un servaddr; 32 | int connfd = socket(AF_LOCAL, SOCK_STREAM, 0); 33 | bzero(&servaddr, sizeof(servaddr)); 34 | servaddr.sun_family = AF_LOCAL; 35 | strcpy(servaddr.sun_path, SOCKET_PROGRESS_PATH); 36 | do { 37 | if (connect(connfd, (struct sockaddr *)&servaddr, sizeof(servaddr)) == 0) { 38 | break; 39 | } 40 | if (retry == false) { 41 | fprintf(stderr, "progress_firmware :: no connection to SWUpdate, exiting.\n"); 42 | exit(1); 43 | } 44 | usleep(10000); 45 | } while (true); 46 | fprintf(stdout, "progress_firmware :: connected to SWUpdate IPC.\n"); 47 | return connfd; 48 | } 49 | 50 | int main(void) 51 | { 52 | struct progress_msg msg; 53 | int connfd = -1; 54 | while (true) { 55 | if (connfd < 0) { 56 | connfd = connect2swupdate(true); 57 | } 58 | 59 | if (read(connfd, &msg, sizeof(msg)) != sizeof(msg)) { 60 | fprintf(stdout, "progress_firmware :: short read, connection closing..\n"); 61 | close(connfd); 62 | connfd = -1; 63 | continue; 64 | } 65 | 66 | if (msg.status == DONE) { 67 | fprintf(stdout, "progress_firmware :: firmware installed, rebooting.\n"); 68 | if (system("reboot") < 0) { 69 | fprintf(stderr, 70 | "progress_firmware :: reboot failed, please reset the board manually.\n"); 71 | } 72 | } 73 | } 74 | } 75 | 76 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-support/swupdate/swupdate/swupdate.cfg: -------------------------------------------------------------------------------- 1 | globals : 2 | { 3 | verbose = true; 4 | loglevel = 10; 5 | syslog = false; 6 | }; 7 | 8 | processes : 9 | ( 10 | { 11 | name = "progress_firmware"; 12 | exec = "/usr/bin/progress_firmware"; 13 | } 14 | ); 15 | 16 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-support/swupdate/swupdate/tools_makefile.patch: -------------------------------------------------------------------------------- 1 | diff --git a/tools/Makefile b/tools/Makefile 2 | index a4c4c29..21f2286 100644 3 | --- a/tools/Makefile 4 | +++ b/tools/Makefile 5 | @@ -17,7 +17,7 @@ lib-y += \ 6 | # # Uncomment the next lines to integrate the compiling/linking of 7 | # # any .c files placed alongside the above "official" tools in the 8 | # # tools/ directory into SWUpdate's build system. 9 | -# TOOLS_DIR := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) 10 | -# TOOLS_SRC := $(wildcard $(TOOLS_DIR)/*.c) 11 | -# TOOLS_BIN := $(patsubst $(TOOLS_DIR)/%.c, %.o, $(TOOLS_SRC)) 12 | -# lib-y += $(filter-out $(lib-y),$(TOOLS_BIN)) 13 | +TOOLS_DIR := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) 14 | +TOOLS_SRC := $(wildcard $(TOOLS_DIR)/*.c) 15 | +TOOLS_BIN := $(patsubst $(TOOLS_DIR)/%.c, %.o, $(TOOLS_SRC)) 16 | +lib-y += $(filter-out $(lib-y),$(TOOLS_BIN)) 17 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-support/swupdate/swupdate_%.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/swupdate:" 2 | 3 | SRC_URI += " \ 4 | file://swupdate_handlers.lua \ 5 | file://tools_makefile.patch \ 6 | file://progress_firmware.c \ 7 | file://swupdate.cfg" 8 | 9 | FILES_${PN} += "/etc/swupdate.cfg /usr/bin/progress_firmware" 10 | 11 | DEPENDS += "efibootguard" 12 | 13 | INHIBIT_UPDATERCD_BBCLASS = "1" 14 | 15 | do_configure_prepend () { 16 | cp ${WORKDIR}/swupdate_handlers.lua ${S} 17 | cp ${WORKDIR}/progress_firmware.c ${S}/tools/progress_firmware.c 18 | } 19 | 20 | # bitbake complains because progress_firmware is already stripped which would prevent 21 | # debugging. To prevent this QA error: 22 | INSANE_SKIP_${PN}_append = " already-stripped" 23 | 24 | do_install_append() { 25 | install -d ${D}${sysconfdir} 26 | install -m 644 ${WORKDIR}/swupdate.cfg ${D}${sysconfdir}/swupdate.cfg 27 | install -m 755 ${S}/tools/progress_firmware ${D}/usr/bin/progress_firmware 28 | } 29 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-tools/setledcolor/files/setledcolor.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import mraa 4 | import sys 5 | import os 6 | 7 | 8 | def redled(state): 9 | redLedFile = "/sys/class/leds/mpio_uart_led:red:user/brightness" 10 | if not os.path.isfile(redLedFile): 11 | print("Red LED not available") 12 | return 13 | file = open(redLedFile, 'w') 14 | if state == 1: 15 | file.write("1") 16 | else: 17 | file.write("0") 18 | file.close() 19 | 20 | 21 | def greenled(state): 22 | ledpin = mraa.Gpio(13) 23 | ledpin.dir(mraa.DIR_OUT) 24 | if state == 1: 25 | ledpin.write(1) 26 | else: 27 | ledpin.write(0) 28 | 29 | 30 | def usage(): 31 | print("Usage: " + sys.argv[0] + " color") 32 | print("color:") 33 | print("\t0 | off") 34 | print("\t1 | green") 35 | print("\t2 | red") 36 | print("\t3 | orange") 37 | sys.exit() 38 | 39 | 40 | if len(sys.argv) < 2: 41 | usage() 42 | 43 | try: 44 | x = {'off': 0, 'green': 1, 'red': 2, 'orange': 3}[sys.argv[1]] 45 | except KeyError: 46 | try: 47 | x = int(sys.argv[1]) 48 | except ValueError: 49 | usage() 50 | 51 | if x % 2 == 0: 52 | greenled(0) 53 | else: 54 | greenled(1) 55 | 56 | if x // 2 == 0: 57 | redled(0) 58 | else: 59 | redled(1) 60 | -------------------------------------------------------------------------------- /meta-iot2000-example/recipes-tools/setledcolor/setledcolor_0.1.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "This installs a small python script to handle the led color for the SIMATIC IOT2040" 2 | LICENSE = "MIT" 3 | LIC_FILES_CHKSUM = "file://${IOT2000_MIT_LICENSE};md5=838c366f69b72c5df05c96dff79b35f2" 4 | 5 | SRC_URI = "file://setledcolor.py" 6 | 7 | S = "${WORKDIR}" 8 | 9 | FILES_${PN} += "${bindir}/setledcolor.py" 10 | 11 | RDEPENDS_${PN} = "python3-mraa" 12 | 13 | do_install() { 14 | install -d ${D}${bindir} 15 | install -m 755 ${WORKDIR}/setledcolor.py ${D}${bindir}/ 16 | } 17 | -------------------------------------------------------------------------------- /meta-iot2000-example/scripts/extract_license: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) Siemens AG, 2017 4 | # 5 | # Authors: 6 | # Le Jin 7 | # 8 | # This file is subject to the terms and conditions of the MIT License. See 9 | # COPYING.MIT file in the top-level directory. 10 | # 11 | # Extract and combine license files 12 | # Eg: 13 | # extract_license build/tmp/deploy/licenses license.dat 14 | # 15 | 16 | function get_dir_list() 17 | { 18 | dir=$(find $1/* -type d -printf "%f\n") 19 | echo $dir 20 | } 21 | 22 | function get_file_list() 23 | { 24 | file=$(find $1/* -maxdepth 1 -type f -printf "%f\n") 25 | echo $file 26 | } 27 | 28 | dir_path="${1:?Please provide license directory path}" 29 | output_path="${2:?Please provide output file path}" 30 | dir_list=$(get_dir_list $dir_path) 31 | truncate $output_path --size 0 32 | for dir in $dir_list; do 33 | echo "Component: "$dir >> $output_path 34 | file_list=$(get_file_list $dir_path"/"$dir"/") 35 | for file in $file_list; do 36 | file_path=$dir/$file 37 | echo "File: "$file_path >> $output_path 38 | cat $dir_path/$file_path >> $output_path 39 | echo "__________" >> $output_path 40 | done 41 | echo "**********" >> $output_path 42 | done 43 | -------------------------------------------------------------------------------- /meta-iot2000-example/scripts/lib/wic/canned-wks/example-image.iot2000.swupdate.wks: -------------------------------------------------------------------------------- 1 | # short-description: Create an iot2000 example disk image for swupdate 2 | # long-description: Creates a partitioned EFI disk image for the iot2000, 3 | # using efibootguard, that the user can directly dd to boot media. 4 | 5 | include common.iot2000.wks.header.inc 6 | 7 | part --source efibootguard-boot --size 32 --extra-space 0 --overhead-factor 1 --ondisk mmcblk0 --label boot1 --align 1024 --part-type=0700 --sourceparams "watchdog=60,revision=1,initrd=acpi-upgrades-iot2000.cpio" 8 | part / --source rootfs --size 2048 --extra-space 0 --overhead-factor 1 --ondisk mmcblk0 --fstype=ext4 --label platform0 --align 1024 9 | part --size 2048 --extra-space 0 --overhead-factor 1 --ondisk mmcblk0 --fstype=ext4 --label plaftorm1 --align 1024 10 | part swap --ondisk mmcblk0 --size 512 --fstype=swap --label swap --align 1024 11 | part /data --size 1024 --extra-space 0 --overhead-factor 1 --ondisk mmcblk0 --label persistent --align 1024 --fstype=ext4 12 | 13 | include common.iot2000.wks.footer.inc 14 | -------------------------------------------------------------------------------- /meta-iot2000-example/scripts/lib/wic/canned-wks/example-image.iot2000.wks: -------------------------------------------------------------------------------- 1 | include common.iot2000.wks.header.inc 2 | 3 | part swap --ondisk mmcblk0 --size 512 --fstype=swap --label swap --align 1024 4 | part / --source rootfs --fstype=ext4 --label platform --align 1024 --use-uuid 5 | 6 | include common.iot2000.wks.footer.inc 7 | --------------------------------------------------------------------------------