├── MAINTAINERS ├── README ├── recipes-kernel └── linux-yocto │ ├── linux-yocto │ ├── 6lowpan.cfg │ ├── debug-fs.cfg │ ├── uspi.cfg │ ├── can-spi.cfg │ ├── nspawn-fs.cfg │ ├── security-tpm.cfg │ ├── 6lowpan-btle.cfg │ ├── wireless.cfg │ ├── nspawn-devpts.cfg │ ├── bootchart.cfg │ ├── nfc-spi.cfg │ ├── ecryptfs.cfg │ ├── nspawn-netdev.cfg │ ├── security-x64.cfg │ ├── security-x86.cfg │ ├── debug-kernel.cfg │ ├── no-gfx.cfg │ ├── 6lowpan-802154.cfg │ ├── usb-gadget.cfg │ ├── nfc-i2c.cfg │ ├── can-x86.cfg │ ├── iio.cfg │ ├── nfc.cfg │ ├── gfx.cfg │ ├── broxton.cfg │ ├── usb-ethernet.cfg │ ├── nspawn-firewall.cfg │ ├── can.cfg │ ├── usb-serial.cfg │ ├── security.cfg │ ├── lockdep.cfg │ ├── galileo2.cfg │ ├── bluetooth.cfg │ ├── 0001-v3.15.0-ARM-dts-am335x-boneblack-configure-i2c1-and-2.patch │ ├── 0001-USB-usbip-fix-potential-out-of-bounds-write.patch │ ├── sensors.cfg │ ├── KEYS_Fix_keyring_ref_leak_in-join_session_keyring.patch │ ├── 0002-capabilities-add-a-securebit-to-disable-PR_CAP_AMBIE.patch │ ├── 0002-edison-capabilities-add-a-securebit-to-disable-PR_CAP_AMBIE.patch │ ├── edison-iptables.cfg │ ├── 0001-ovl-setxattr-don-t-deadlock-when-called-from-ima_fix.patch │ ├── 0001-sched-cgroup-Fix-cleanup-cgroup-teardown-init.patch │ └── 0027-gpio-pca953x-add-drive-property.patch │ ├── linux-yocto-edison.bbappend │ ├── linux-ostro │ ├── cleanup-defconfig.sh │ └── quark │ │ ├── v4-1-2-firmware_loader-introduce-new-API---request_firmware_direct_full_path.patch │ │ └── v4-2-2-efi-an-sysfs-interface-for-user-to-update-efi-firmware.patch │ ├── linux-ostro_4.1.bb │ ├── linux-yocto-dev.bbappend │ ├── linux-yocto_4.1.bbappend │ └── linux-yocto_4.4.bbappend ├── recipes-core └── systemd │ ├── files │ └── runtime-watchdog.conf │ └── systemd-watchdog.bb ├── meta-edison-bsp ├── recipes-core │ ├── systemd │ │ ├── files │ │ │ └── wlan0.network │ │ └── systemd_%.bbappend │ ├── base-files │ │ ├── base-files_%.bbappend │ │ └── base-files │ │ │ └── fstab │ ├── initrdscripts │ │ ├── initramfs-boot_1.0.bbappend │ │ └── files │ │ │ └── init-boot.sh │ └── images │ │ ├── core-image-sdk-edison.bb │ │ └── core-image-initramfs-edison.bb ├── recipes-kernel │ ├── mcu-fw │ │ ├── files │ │ │ ├── intel_mcu.bin │ │ │ ├── mcu_fw_loader.service │ │ │ ├── mcu_fw_loader.sh │ │ │ └── LICENSE │ │ ├── mcu-fw-bin.bb │ │ └── mcu-fw-load.bb │ ├── sst-fw │ │ ├── files │ │ │ └── fw_sst_119a.bin │ │ └── sst-fw.bb │ ├── bcm43340 │ │ ├── bcm43340-mod.bb │ │ └── bcm43340-fw.bb │ ├── linux │ │ ├── linux-yocto-edison.bb │ │ └── files │ │ │ └── 0002-Always-inline-inline-functions.patch │ └── bcm43340-bt │ │ └── bcm43340-bt_1.0.bb ├── recipes-bsp │ ├── ifwi │ │ ├── ifwi │ │ │ └── ifwi-2015.01.30.tar.bz2 │ │ └── ifwi_2015.01.30.bb │ ├── flashall │ │ ├── flashall-2.0 │ │ │ ├── helper │ │ │ │ ├── images │ │ │ │ │ ├── Edison-arduino.png │ │ │ │ │ ├── Edison-breakout-board.png │ │ │ │ │ └── Edison-arduino-blink-led.png │ │ │ │ └── helper.html │ │ │ ├── pft-config-edison.xml │ │ │ ├── filter-dfu-out.js │ │ │ ├── LICENSE │ │ │ ├── FlashEdison.json │ │ │ ├── flashall.sh │ │ │ └── flashall.bat │ │ └── flashall_2.0.bb │ └── u-boot │ │ ├── files │ │ ├── target_env │ │ │ ├── prod.env │ │ │ ├── ifwi.env │ │ │ ├── blankcdc.env │ │ │ └── blankrndis.env │ │ ├── fw_env.config │ │ ├── 0001-Fix-missing-stdint.h-include.patch │ │ ├── 0002-Fix-weak-external-function-references-for-gcc5.patch │ │ └── edison.env │ │ ├── u-boot-edison_2014.04.bb │ │ ├── u-boot-internal.inc │ │ ├── u-boot-tools-edison_2014.04.bb │ │ ├── u-boot-fw-utils-edison_2014.04.bb │ │ ├── u-boot-target-env.inc │ │ └── u-boot-osip.inc ├── recipes-connectivity │ ├── bluetooth-rfkill-event │ │ ├── files │ │ │ ├── bluetooth-rfkill-event.service │ │ │ └── bcm43341.conf │ │ ├── COPYING │ │ └── bluetooth-rfkill-event_1.0.bb │ └── wpa_supplicant │ │ └── wpa-supplicant_%.bbappend ├── conf │ ├── layer.conf │ └── machine │ │ └── edison.conf └── classes │ └── image_types_edison.bbclass ├── recipes-extended ├── ethtool │ ├── ethtool_%.bbappend │ └── files │ │ └── quark.patch ├── spi-quark-board │ ├── files │ │ ├── modules-load.d │ │ │ └── at86rf230.conf.sample │ │ ├── Makefile │ │ ├── spi-quark-board.h │ │ ├── spi-quark-board.c │ │ └── spi-quark-at86rf230.c │ └── spi-quark-board.bb ├── i2c-edison-board │ ├── files │ │ ├── Makefile │ │ └── i2c-edison-mpu6050.c │ └── i2c-edison-board.bb ├── i2c-quark-board │ ├── files │ │ ├── Makefile │ │ ├── i2c-quark-apds9960.c │ │ └── i2c-quark-mpu6050.c │ └── i2c-quark-board.bb ├── i2c-minnowmax-board │ ├── files │ │ ├── Makefile │ │ ├── i2c-minnow-apds9960.c │ │ └── i2c-minnow-mpu6050.c │ └── i2c-minnowmax-board.bb └── spi-minnowmax-board │ ├── files │ ├── spi-minnow-board.h │ ├── Makefile │ ├── modules-load.d │ │ ├── at86rf230.conf.sample │ │ └── cc2520.conf.sample │ ├── modprobe.d │ │ ├── spi-minnow-at86rf230.conf.sample │ │ └── spi-minnow-cc2520.conf.sample │ ├── spi-minnow-board.c │ ├── spi-minnow-cc2520.c │ └── spi-minnow-at86rf230.c │ └── spi-minnowmax-board.bb ├── recipes-support └── libgcrypt │ └── libgcrypt_%.bbappend ├── recipes-bsp └── u-boot │ ├── u-boot_2016.03.bbappend │ └── u-boot │ └── 0001-Search-for-bootable-partitions-on-both-SD-and-eMMC.patch ├── conf ├── machine │ ├── quark.conf │ ├── atom.conf │ └── atomup.conf └── layer.conf └── COPYING.MIT /MAINTAINERS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This layer is collection of Ostro OS specific BSPs. 2 | 3 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/6lowpan.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_6LOWPAN=m 2 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/debug-fs.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_DEBUG_FS=y 2 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/uspi.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_SPI_SPIDEV=m 2 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto-edison.bbappend: -------------------------------------------------------------------------------- 1 | linux-yocto_4.4.bbappend -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/can-spi.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_CAN_MCP251X=m 2 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/nspawn-fs.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_OVERLAY_FS=y 2 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/security-tpm.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_TCG_CRB=y 2 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/6lowpan-btle.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_BT_6LOWPAN=m 2 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/wireless.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_RTL8723BE=m 2 | 3 | -------------------------------------------------------------------------------- /recipes-core/systemd/files/runtime-watchdog.conf: -------------------------------------------------------------------------------- 1 | [Manager] 2 | RuntimeWatchdogSec=90 3 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/nspawn-devpts.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_DEVPTS_MULTIPLE_INSTANCES=y 2 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/bootchart.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_DEBUG_KERNEL=y 2 | CONFIG_SCHEDSTATS=y 3 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/nfc-spi.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_NFC_NCI_SPI=y 2 | CONFIG_NFC_TRF7970A=m 3 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/ecryptfs.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_ECRYPT_FS=m 2 | CONFIG_ECRYPT_FS_MESSAGING=y 3 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-core/systemd/files/wlan0.network: -------------------------------------------------------------------------------- 1 | [Match] 2 | Name=wlan0 3 | [Network] 4 | DHCP=yes 5 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/nspawn-netdev.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_MACVLAN=y 2 | CONFIG_IPVLAN=y 3 | CONFIG_VETH=y 4 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-core/base-files/base-files_%.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend_edison := "${THISDIR}/base-files:" 2 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-core/initrdscripts/initramfs-boot_1.0.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend_edison := "${THISDIR}/files:" 2 | 3 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/security-x64.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_RANDOMIZE_BASE_MAX_OFFSET=0x40000000 2 | # CONFIG_X86_MSR is not set 3 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/security-x86.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_RANDOMIZE_BASE_MAX_OFFSET=0x20000000 2 | # CONFIG_X86_MSR is not set 3 | -------------------------------------------------------------------------------- /recipes-extended/ethtool/ethtool_%.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/files:" 2 | SRC_URI_append_quark = " file://quark.patch" 3 | -------------------------------------------------------------------------------- /recipes-support/libgcrypt/libgcrypt_%.bbappend: -------------------------------------------------------------------------------- 1 | EXTRA_OECONF_append_quark = " --disable-aesni-support \ 2 | --disable-padlock-support" 3 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-kernel/mcu-fw/files/intel_mcu.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embed/meta-ostro-bsp/master/meta-edison-bsp/recipes-kernel/mcu-fw/files/intel_mcu.bin -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-ostro/cleanup-defconfig.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | sed -e "/^#.*/d" -e "/^\s*$/d" defconfig >defconfig.new 4 | mv defconfig.new defconfig 5 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-kernel/sst-fw/files/fw_sst_119a.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embed/meta-ostro-bsp/master/meta-edison-bsp/recipes-kernel/sst-fw/files/fw_sst_119a.bin -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/ifwi/ifwi/ifwi-2015.01.30.tar.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embed/meta-ostro-bsp/master/meta-edison-bsp/recipes-bsp/ifwi/ifwi/ifwi-2015.01.30.tar.bz2 -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/debug-kernel.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_CONSOLE_POLL=y 2 | CONFIG_DEBUG_INFO=y 3 | CONFIG_GDB_SCRIPTS=y 4 | CONFIG_KGDB=y 5 | CONFIG_KGDB_SERIAL_CONSOLE=y 6 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/no-gfx.cfg: -------------------------------------------------------------------------------- 1 | # CONFIG_AGP is not set 2 | # CONFIG_DRM is not set 3 | CONFIG_VGACON_SOFT_SCROLLBACK=y 4 | CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=64 5 | -------------------------------------------------------------------------------- /recipes-bsp/u-boot/u-boot_2016.03.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/u-boot:" 2 | 3 | SRC_URI_append = " file://0001-Search-for-bootable-partitions-on-both-SD-and-eMMC.patch" 4 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/6lowpan-802154.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_IEEE802154=m 2 | CONFIG_IEEE802154_6LOWPAN=m 3 | CONFIG_MAC802154=m 4 | CONFIG_IEEE802154_AT86RF230=m 5 | CONFIG_IEEE802154_CC2520=m 6 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/flashall/flashall-2.0/helper/images/Edison-arduino.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embed/meta-ostro-bsp/master/meta-edison-bsp/recipes-bsp/flashall/flashall-2.0/helper/images/Edison-arduino.png -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/flashall/flashall-2.0/helper/images/Edison-breakout-board.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embed/meta-ostro-bsp/master/meta-edison-bsp/recipes-bsp/flashall/flashall-2.0/helper/images/Edison-breakout-board.png -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/usb-gadget.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_USB_LIBCOMPOSITE=m 2 | CONFIG_USB_F_ACM=m 3 | CONFIG_USB_U_SERIAL=m 4 | CONFIG_USB_F_SERIAL=m 5 | CONFIG_USB_F_OBEX=m 6 | CONFIG_USB_G_SERIAL=m 7 | CONFIG_USB_G_ACM_MS=m 8 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/flashall/flashall-2.0/helper/images/Edison-arduino-blink-led.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embed/meta-ostro-bsp/master/meta-edison-bsp/recipes-bsp/flashall/flashall-2.0/helper/images/Edison-arduino-blink-led.png -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/u-boot/files/target_env/prod.env: -------------------------------------------------------------------------------- 1 | # U-Boot production environment 2 | # used in factory for flashing and calibrating 3 | target_name=prod 4 | bootdelay=3 5 | do_flash_os_done=0 6 | boot_target_cmd=run do_flash_ifwi;run do_force_flash_os 7 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/nfc-i2c.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_NFC_MICROREAD=m 2 | CONFIG_NFC_MICROREAD_I2C=m 3 | CONFIG_NFC_PN544=m 4 | CONFIG_NFC_PN544_I2C=m 5 | CONFIG_NFC_ST21NFCA=m 6 | CONFIG_NFC_ST21NFCA_I2C=m 7 | CONFIG_NFC_ST21NFCB=m 8 | CONFIG_NFC_ST21NFCB_I2C=m 9 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-kernel/mcu-fw/files/mcu_fw_loader.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Daemon to load edison mcu app binary 3 | After=syslog.target 4 | 5 | [Service] 6 | ExecStart=/etc/intel_mcu/mcu_fw_loader.sh 7 | 8 | [Install] 9 | WantedBy=multi-user.target 10 | 11 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/u-boot/files/target_env/ifwi.env: -------------------------------------------------------------------------------- 1 | # U-Boot IFWI environment 2 | # IFWI testing mode 3 | # this env is stitched with xfstk binary , do only dfu 4 | target_name=ifwi 5 | bootdelay=1 6 | do_flash_os_done=0 7 | boot_target_cmd=run do_partition;run do_force_flash_os 8 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/can-x86.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_PCH_CAN=m 2 | # drivers for ISA/PCI cards 3 | CONFIG_CAN_C_CAN_PCI=m 4 | # Philips SJA1000 based 5 | CONFIG_CAN_EMS_PCI=m 6 | CONFIG_CAN_PEAK_PCI=m 7 | CONFIG_CAN_PEAK_PCIEC=m 8 | CONFIG_CAN_KVASER_PCI=m 9 | CONFIG_CAN_PLX_PCI=m 10 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-connectivity/bluetooth-rfkill-event/files/bluetooth-rfkill-event.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Bluetooth rf kill event daemon 3 | 4 | [Service] 5 | Type=simple 6 | ExecStart=/usr/sbin/bluetooth_rfkill_event 7 | Restart=on-failure 8 | 9 | [Install] 10 | WantedBy=multi-user.target 11 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/u-boot/u-boot-edison_2014.04.bb: -------------------------------------------------------------------------------- 1 | require recipes-bsp/u-boot/u-boot.inc 2 | require u-boot-internal.inc 3 | require u-boot-target-env.inc 4 | require u-boot-osip.inc 5 | 6 | LICENSE = "GPLv2+" 7 | LIC_FILES_CHKSUM = "file://Licenses/README;md5=025bf9f768cbcb1a165dbe1a110babfb" 8 | 9 | PR = "r6" 10 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/iio.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_IIO=m 2 | CONFIG_IIO_BUFFER=y 3 | CONFIG_IIO_BUFFER_CB=y 4 | CONFIG_IIO_KFIFO_BUF=m 5 | CONFIG_IIO_TRIGGERED_BUFFER=m 6 | CONFIG_IIO_TRIGGER=y 7 | CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 8 | CONFIG_IIO_INTERRUPT_TRIGGER=m 9 | CONFIG_IIO_SYSFS_TRIGGER=m 10 | CONFIG_STAGING=y 11 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/nfc.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_NFC=m 2 | CONFIG_NFC_DIGITAL=m 3 | CONFIG_NFC_NCI=m 4 | CONFIG_NFC_HCI=m 5 | CONFIG_NFC_SHDLC=y 6 | # USB drivers 7 | CONFIG_NFC_PN533=m 8 | CONFIG_NFC_PORT100=m 9 | CONFIG_NFC_MRVL=m 10 | CONFIG_NFC_MRVL_USB=m 11 | # support items 12 | CONFIG_CRC_ITU_T=m 13 | CONFIG_CRC_CCITT=m 14 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-kernel/mcu-fw/files/mcu_fw_loader.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #author: JiuJin Hong (jiujinx.hong@intel.com) 3 | if [ ! -d "/sys/devices/platform/intel_mcu" ];then 4 | exit 5 | fi 6 | 7 | if [ ! -f "/lib/firmware/intel_mcu.bin" ];then 8 | exit 9 | fi 10 | 11 | echo "load mcu app" > /sys/devices/platform/intel_mcu/control 12 | 13 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/gfx.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_DRM_I915=m 2 | CONFIG_DRM_I915_PRELIMINARY_HW_SUPPORT=y 3 | CONFIG_DRM_I915_FBDEV=m 4 | CONFIG_DRM_I915_KMS=m 5 | CONFIG_DRM_LOAD_EDID_FIRMWARE=y 6 | CONFIG_INTEL_POWERCLAMP=y 7 | 8 | CONFIG_SND_HDA_I915=m 9 | 10 | # Setting to resolve graphics hang issue 11 | # CONFIG_INTEL_IOMMU_DEFAULT_ON is not set 12 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-core/images/core-image-sdk-edison.bb: -------------------------------------------------------------------------------- 1 | inherit core-image 2 | 3 | DESCRIPTION = "Basic image without X support suitable native development. It includes \ 4 | the full meta-toolchain, plus development headers and libraries to form a standalone SDK." 5 | 6 | IMAGE_FEATURES += "tools-sdk dev-pkgs tools-debug tools-profile" 7 | 8 | IMAGE_INSTALL += "kernel-dev" 9 | -------------------------------------------------------------------------------- /recipes-extended/spi-quark-board/files/modules-load.d/at86rf230.conf.sample: -------------------------------------------------------------------------------- 1 | # These modules are required to enable AT86RF230 802.15.4 radio in the 2 | # Galileo Gen 2 3 | # 4 | # To enable loading, link as below: 5 | # 6 | # install: ln -s /usr/lib/modules-load.d/at86rf230.conf.sample /etc/modules-load.d/at86rf230.conf 7 | # 8 | spi-quark-at86rf230 9 | spi-quark-board 10 | -------------------------------------------------------------------------------- /meta-edison-bsp/conf/layer.conf: -------------------------------------------------------------------------------- 1 | # We have a conf and classes directory, add to BBPATH 2 | BBPATH := "${BBPATH}:${LAYERDIR}" 3 | 4 | # We have a recipes-* directories, add to BBFILES 5 | BBFILES := "${BBFILES} ${LAYERDIR}/recipes-*/*/*.bb \ 6 | ${LAYERDIR}/recipes-*/*/*.bbappend" 7 | 8 | BBFILE_COLLECTIONS += "edison" 9 | BBFILE_PATTERN_edison = "^${LAYERDIR}/" 10 | BBFILE_PRIORITY_edison = "6" 11 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-core/systemd/systemd_%.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend_edison := "${THISDIR}/files:" 2 | 3 | SRC_URI_append_edison = " file://wlan0.network" 4 | 5 | FILES_${PN} += "${sysconfdir}/systemd/network" 6 | 7 | do_install_append_edison () { 8 | install -m 755 -d ${D}${sysconfdir}/systemd/network 9 | install -m 644 ${WORKDIR}/wlan0.network ${D}${sysconfdir}/systemd/network/ 10 | } 11 | -------------------------------------------------------------------------------- /recipes-extended/i2c-edison-board/files/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := i2c-edison-mpu6050.o 2 | SRC := $(shell pwd) 3 | 4 | all: 5 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules 6 | 7 | modules_install: 8 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install 9 | 10 | clean: 11 | rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c 12 | rm -f Module.markers Module.symvers modules.order 13 | rm -rf .tmp_versions Modules.symvers 14 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-connectivity/wpa_supplicant/wpa-supplicant_%.bbappend: -------------------------------------------------------------------------------- 1 | do_install_append_edison () { 2 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then 3 | install -d ${D}${sysconfdir}/systemd/system/multi-user.target.wants 4 | ln -s ${base_libdir}/systemd/system/wpa_supplicant@.service ${D}${sysconfdir}/systemd/system/multi-user.target.wants/wpa_supplicant@wlan0.service 5 | fi 6 | } 7 | -------------------------------------------------------------------------------- /recipes-extended/i2c-quark-board/files/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := i2c-quark-mpu6050.o i2c-quark-apds9960.o 2 | SRC := $(shell pwd) 3 | 4 | all: 5 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules 6 | 7 | modules_install: 8 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install 9 | 10 | clean: 11 | rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c 12 | rm -f Module.markers Module.symvers modules.order 13 | rm -rf .tmp_versions Modules.symvers 14 | -------------------------------------------------------------------------------- /recipes-extended/i2c-minnowmax-board/files/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := i2c-minnow-mpu6050.o i2c-minnow-apds9960.o 2 | SRC := $(shell pwd) 3 | 4 | all: 5 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules 6 | 7 | modules_install: 8 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install 9 | 10 | clean: 11 | rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c 12 | rm -f Module.markers Module.symvers modules.order 13 | rm -rf .tmp_versions Modules.symvers 14 | -------------------------------------------------------------------------------- /recipes-extended/spi-quark-board/files/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := spi-quark-at86rf230.o spi-quark-board.o 2 | 3 | SRC := $(shell pwd) 4 | 5 | all: 6 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules 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 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/broxton.cfg: -------------------------------------------------------------------------------- 1 | # config items required by BXT but missing from the current generic config 2 | CONFIG_PINCTRL_BROXTON=y 3 | CONFIG_GPIO_GENERIC=y 4 | CONFIG_MFD_INTEL_LPSS=y 5 | CONFIG_MFD_INTEL_LPSS_ACPI=y 6 | CONFIG_MFD_INTEL_LPSS_PCI=y 7 | CONFIG_MMC_SDHCI_PLTFM=y 8 | CONFIG_DMA_VIRTUAL_CHANNELS=y 9 | CONFIG_INTEL_IDMA64=y 10 | CONFIG_USB_DWC2=m 11 | CONFIG_USB_DWC2_PLATFORM=m 12 | CONFIG_USB_DWC2_PCI=m 13 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/usb-ethernet.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_USB_NET_DRIVERS=m 2 | CONFIG_USB_PEGASUS=m 3 | CONFIG_USB_RTL8150=m 4 | CONFIG_USB_RTL8152=m 5 | CONFIG_USB_LAN78XX=m 6 | CONFIG_USB_USBNET=m 7 | CONFIG_USB_NET_AX8817X=m 8 | CONFIG_USB_NET_AX88179_178A=m 9 | CONFIG_USB_NET_DM9601=m 10 | CONFIG_USB_NET_SR9800=m 11 | CONFIG_USB_NET_SMSC75XX=m 12 | CONFIG_USB_NET_SMSC95XX=m 13 | CONFIG_USB_NET_MCS7830=m 14 | CONFIG_USB_NET_CH9200=m 15 | -------------------------------------------------------------------------------- /recipes-extended/i2c-edison-board/i2c-edison-board.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "I2C sensor kernel modules on Minnow-Max" 2 | 3 | LICENSE = "GPLv2" 4 | LIC_FILES_CHKSUM = "file://${THISDIR}/files/COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e" 5 | PR = "r0" 6 | 7 | inherit module 8 | 9 | FILESEXTRAPATHS_prepend := "${THISDIR}/files/:" 10 | 11 | SRC_URI = "file://i2c-edison-mpu6050.c \ 12 | file://Makefile \ 13 | " 14 | 15 | S = "${WORKDIR}" 16 | -------------------------------------------------------------------------------- /recipes-extended/spi-minnowmax-board/files/spi-minnow-board.h: -------------------------------------------------------------------------------- 1 | #ifndef __SPI_MINNOW_BOARD_H__ 2 | #define __SPI_MINNOW_BOARD_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | void set_spi_minnow_board_value(struct spi_board_info *spi_minnow_board_info, 10 | unsigned int *spi_board_irq, u16 *spi_board_master); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/nspawn-firewall.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_IP_NF_NAT=m 2 | CONFIG_NF_TABLES=m 3 | CONFIG_NF_TABLES_INET=m 4 | CONFIG_NF_TABLES_NETDEV=m 5 | CONFIG_NFT_LOG=m 6 | CONFIG_NFT_MASQ=m 7 | CONFIG_NFT_REDIR=m 8 | CONFIG_NFT_NAT=m 9 | CONFIG_NFT_COMPAT=m 10 | CONFIG_NETFILTER_XTABLES=m 11 | CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m 12 | CONFIG_NETFILTER_XT_MATCH_IPRANGE=m 13 | CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m 14 | CONFIG_NETFILTER_XT_TARGET_LOG=m -------------------------------------------------------------------------------- /recipes-extended/spi-minnowmax-board/files/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := spi-minnow-at86rf230.o spi-minnow-board.o spi-minnow-cc2520.o 2 | 3 | SRC := $(shell pwd) 4 | 5 | all: 6 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules 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 | -------------------------------------------------------------------------------- /recipes-extended/i2c-quark-board/i2c-quark-board.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "I2C sensor kernel modules on Minnow-Max" 2 | 3 | LICENSE = "GPLv2" 4 | LIC_FILES_CHKSUM = "file://${THISDIR}/files/COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e" 5 | PR = "r0" 6 | 7 | inherit module 8 | 9 | FILESEXTRAPATHS_prepend := "${THISDIR}/files/:" 10 | 11 | SRC_URI = "file://i2c-quark-mpu6050.c \ 12 | file://i2c-quark-apds9960.c \ 13 | file://Makefile \ 14 | " 15 | 16 | S = "${WORKDIR}" 17 | -------------------------------------------------------------------------------- /recipes-extended/i2c-minnowmax-board/i2c-minnowmax-board.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "I2C sensor kernel modules on Minnow-Max" 2 | 3 | LICENSE = "GPLv2" 4 | LIC_FILES_CHKSUM = "file://${THISDIR}/files/COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e" 5 | PR = "r0" 6 | 7 | inherit module 8 | 9 | FILESEXTRAPATHS_prepend := "${THISDIR}/files/:" 10 | 11 | SRC_URI = "file://i2c-minnow-mpu6050.c \ 12 | file://i2c-minnow-apds9960.c \ 13 | file://Makefile \ 14 | " 15 | 16 | S = "${WORKDIR}" 17 | -------------------------------------------------------------------------------- /recipes-extended/spi-quark-board/files/spi-quark-board.h: -------------------------------------------------------------------------------- 1 | #ifndef __SPI_QUARK_BOARD_H__ 2 | #define __SPI_QUARK_BOARD_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | void set_spi_quark_board_value(struct spi_board_info *spi_quark_board_info, 13 | unsigned int *spi_board_irq, u16 *spi_board_master); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/u-boot/files/target_env/blankcdc.env: -------------------------------------------------------------------------------- 1 | # U-Boot blank environment with CDC ECM ethernet config for gadget multi 2 | # used to erase all partitions and first boot setup 3 | target_name=blank 4 | bootdelay=1 5 | do_flash_os_done=1 6 | bootargs_target=multi-user 7 | bootargs_ethconfig=cdc 8 | dfu_to_sec=3 9 | do_probe_dfu=run do_dfu_alt_info_mmc ; dfu 0 mmc 0 $dfu_to_sec 10 | boot_target_cmd=run do_flash_os;run do_probe_dfu;run do_compute_target;run load_kernel;run mmc-bootargs;zboot ${loadaddr} 11 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/u-boot/files/target_env/blankrndis.env: -------------------------------------------------------------------------------- 1 | # U-Boot blank environment with RNDIS ethernet config for gadget multi 2 | # used to erase all partitions and first boot setup 3 | target_name=blank 4 | bootdelay=1 5 | do_flash_os_done=1 6 | bootargs_target=multi-user 7 | bootargs_ethconfig=rndis 8 | dfu_to_sec=3 9 | do_probe_dfu=run do_dfu_alt_info_mmc ; dfu 0 mmc 0 $dfu_to_sec 10 | boot_target_cmd=run do_flash_os;run do_probe_dfu;run do_compute_target;run load_kernel;run mmc-bootargs;zboot ${loadaddr} 11 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-kernel/sst-fw/sst-fw.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Edison sst fw binary." 2 | HOMEPAGE = "http://www.intel.com" 3 | LICENSE = "CLOSED" 4 | 5 | FILESEXTRAPATHS_prepend := "${THISDIR}/files/:" 6 | 7 | SRC_URI = "file://fw_sst_119a.bin" 8 | 9 | S = "${WORKDIR}" 10 | 11 | do_install () { 12 | install -v -d ${D}/${base_libdir}/firmware/ 13 | install -m 644 fw_sst_119a.bin ${D}/${base_libdir}/firmware/ 14 | } 15 | 16 | INSANE_SKIP_${PN} = "arch" 17 | 18 | FILES_${PN} = "${base_libdir}/firmware/" 19 | 20 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-kernel/bcm43340/bcm43340-mod.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Broadcom wifi driver for the 43340" 2 | LICENSE = "GPLv2" 3 | 4 | SRC_URI = "git://github.com/01org/edison-bcm43340.git;branch=master;protocol=git;rev=9d609e1ffadbf8895a701e6283392bb54bd962f9" 5 | 6 | LIC_FILES_CHKSUM = "file://COPYING;md5=f9986853fb3b3403700e7535a392d014" 7 | 8 | # The module is compatible with Edison kernel only 9 | COMPATIBLE_MACHINE="edison" 10 | 11 | inherit module 12 | 13 | PV = "1.141" 14 | PR = "r49" 15 | 16 | S = "${WORKDIR}/git/" 17 | 18 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/can.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_CAN=m 2 | CONFIG_CAN_VCAN=m 3 | CONFIG_CAN_PEAK_USB=m 4 | CONFIG_CAN_CALC_BITTIMING=y 5 | CONFIG_CAN_SJA1000=m 6 | CONFIG_CAN_SJA1000_PLATFORM=m 7 | CONFIG_CAN_C_CAN=m 8 | CONFIG_CAN_C_CAN_PLATFORM=m 9 | CONFIG_CAN_CC770=m 10 | CONFIG_CAN_CC770_PLATFORM=m 11 | CONFIG_CAN_EMS_USB=m 12 | CONFIG_CAN_ESD_USB2=m 13 | CONFIG_CAN_GS_USB=m 14 | CONFIG_CAN_KVASER_USB=m 15 | CONFIG_CAN_PEAK_USB=m 16 | CONFIG_CAN_8DEV_USB=m 17 | CONFIG_CAN_SOFTING=m 18 | CONFIG_CAN_SLCAN=m 19 | CONFIG_NET_EMATCH_CANID=m 20 | -------------------------------------------------------------------------------- /recipes-extended/spi-minnowmax-board/files/modules-load.d/at86rf230.conf.sample: -------------------------------------------------------------------------------- 1 | # These modules are required to enable AT86RF230 802.15.4 radio in the 2 | # MinnowBoard MAX 3 | # 4 | # To enable loading, link as below: 5 | # 6 | # requirement: ln -s /lib/modprobe.d/spi-minnow-at86rf230.conf.sample /etc/modprobe.d/spi-minnow-at86rf230.conf 7 | # install: ln -s /usr/lib/modules-load.d/at86rf230.conf.sample /etc/modules-load.d/at86rf230.conf 8 | # 9 | # NOTE: MinnowBoard MAX BIOS must have LPSS SPI enabled. 10 | spi_pxa2xx_platform 11 | spi-minnow-at86rf230 12 | spi-minnow-board 13 | -------------------------------------------------------------------------------- /recipes-extended/spi-minnowmax-board/files/modules-load.d/cc2520.conf.sample: -------------------------------------------------------------------------------- 1 | # These modules are required to enable CC2520 802.15.4 radio in the 2 | # MinnowBoard MAX 3 | # 4 | # To enable loading, link as below: 5 | # 6 | # requirement: ln -s /lib/modprobe.d/spi-minnow-cc2520.conf.sample /etc/modprobe.d/spi-minnow-cc2520.conf 7 | # install: ln -s /usr/lib/modules-load.d/cc2520.conf.sample /etc/modules-load.d/cc2520.conf 8 | # 9 | # NOTE: MinnowBoard MAX BIOS must have PWM #1/#2 disabled and LPSS SPI enabled. 10 | spi_pxa2xx_platform 11 | spi-minnow-cc2520 12 | spi-minnow-board 13 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/usb-serial.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_USB_SERIAL=y 2 | CONFIG_USB_SERIAL_GENERIC=y 3 | CONFIG_USB_SERIAL_ARK3116=m 4 | CONFIG_USB_SERIAL_BELKIN=m 5 | CONFIG_USB_SERIAL_CH341=m 6 | CONFIG_USB_SERIAL_CP210X=m 7 | CONFIG_USB_SERIAL_FTDI_SIO=m 8 | CONFIG_USB_SERIAL_F81232=m 9 | CONFIG_USB_SERIAL_IPW=m 10 | CONFIG_USB_SERIAL_PL2303=m 11 | CONFIG_USB_SERIAL_OTI6858=m 12 | CONFIG_USB_SERIAL_QUALCOMM=m 13 | CONFIG_USB_SERIAL_SPCP8X5=m 14 | CONFIG_USB_SERIAL_SIERRAWIRELESS=m 15 | CONFIG_USB_SERIAL_TI=m 16 | CONFIG_USB_SERIAL_WWAN=m 17 | CONFIG_USB_SERIAL_OPTION=m 18 | -------------------------------------------------------------------------------- /conf/machine/quark.conf: -------------------------------------------------------------------------------- 1 | #@TYPE: Machine 2 | #@NAME: quark 3 | 4 | #@DESCRIPTION: Machine configuration for Quark systems 5 | 6 | PREFERRED_PROVIDER_virtual/kernel ?= "linux-ostro" 7 | PREFERRED_VERSION_linux-yocto ?= "4.1%" 8 | 9 | require conf/machine/include/x86-base.inc 10 | include conf/machine/include/tune-i586.inc 11 | 12 | MACHINE_FEATURES += "efi usb pci" 13 | #EFI_PROVIDER = "gummiboot" 14 | 15 | APPEND += "console=ttyS1,115200n8 earlycon=uart8250,mmio32,0x8010f000,115200n8 reboot=efi,warm apic=debug rw" 16 | 17 | SERIAL_CONSOLE = "115200 ttyS1" 18 | #SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS1" 19 | 20 | 21 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-kernel/mcu-fw/mcu-fw-bin.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "This is edison mcu fw binary." 2 | HOMEPAGE = "http://www.intel.com" 3 | 4 | LICENSE = "Intel-OBL-Binary-Firmware-License" 5 | LIC_FILES_CHKSUM = "file://LICENSE;md5=41b172554812bbdd8ef5b0711639b69b" 6 | 7 | FILESEXTRAPATHS_prepend := "${THISDIR}/files/:" 8 | 9 | SRC_URI = "file://intel_mcu.bin \ 10 | file://LICENSE" 11 | 12 | S = "${WORKDIR}" 13 | 14 | do_install () { 15 | install -v -d ${D}/${base_libdir}/firmware/ 16 | install -m 644 intel_mcu.bin ${D}/${base_libdir}/firmware/ 17 | } 18 | 19 | FILES_${PN} = "${base_libdir}/firmware/" 20 | 21 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/u-boot/u-boot-internal.inc: -------------------------------------------------------------------------------- 1 | PV = "2014.04-1" 2 | S = "${WORKDIR}/git" 3 | 4 | PACKAGE_ARCH = "${MACHINE_ARCH}" 5 | 6 | SRC_URI = "git://github.com/01org/edison-u-boot.git;branch=edison-v2014.04;protocol=git" 7 | SRC_URI += "${@'file://${MACHINE}.env' if '${MACHINE}' in ('edison',) else ''}" 8 | SRC_URI += "file://target_env/" 9 | SRC_URI += "file://0001-Backport-compiler-gcc.h-from-4.2-kernel.patch" 10 | SRC_URI += "file://0002-Fix-weak-external-function-references-for-gcc5.patch" 11 | SRC_URI += "file://0001-Fix-missing-stdint.h-include.patch" 12 | SRCREV = "e4177b9f38f41f55eac05c7c1c9275d10653aa1b" 13 | -------------------------------------------------------------------------------- /conf/machine/atom.conf: -------------------------------------------------------------------------------- 1 | #@TYPE: Machine 2 | #@NAME: atom 3 | 4 | #@DESCRIPTION: Machine configuration for Atom systems 5 | 6 | PREFERRED_PROVIDER_virtual/kernel ?= "linux-ostro" 7 | PREFERRED_VERSION_linux-yocto ?= "4.1%" 8 | 9 | #DEFAULTTUNE = "core2-32" 10 | 11 | require conf/machine/include/x86-base.inc 12 | include conf/machine/include/tune-atom.inc 13 | 14 | MACHINE_FEATURES += "usb pci" 15 | #MACHINE_FEATURES += "efi" 16 | #EFI_PROVIDER = "gummiboot" 17 | 18 | #APPEND += "console=ttyS0,115200n8 rw" 19 | 20 | SYSLINUX_OPTS = "serial 0 115200" 21 | SERIAL_CONSOLE = "115200 ttyS0" 22 | #SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS1" 23 | -------------------------------------------------------------------------------- /conf/machine/atomup.conf: -------------------------------------------------------------------------------- 1 | #@TYPE: Machine 2 | #@NAME: atom 3 | 4 | #@DESCRIPTION: Machine configuration for Atom systems 5 | 6 | PREFERRED_PROVIDER_virtual/kernel ?= "linux-ostro" 7 | PREFERRED_VERSION_linux-yocto ?= "4.1%" 8 | 9 | #DEFAULTTUNE = "core2-32" 10 | 11 | require conf/machine/include/x86-base.inc 12 | include conf/machine/include/tune-atom.inc 13 | 14 | MACHINE_FEATURES += "usb pci" 15 | #MACHINE_FEATURES += "efi" 16 | #EFI_PROVIDER = "gummiboot" 17 | 18 | #APPEND += "console=ttyS0,115200n8 rw" 19 | 20 | SYSLINUX_OPTS = "serial 0 115200" 21 | SERIAL_CONSOLE = "115200 ttyS0" 22 | #SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS1" 23 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-core/base-files/base-files/fstab: -------------------------------------------------------------------------------- 1 | /dev/root / auto nodev,noatime,discard,barrier=1,data=ordered,noauto_da_alloc 1 1 2 | proc /proc proc defaults 0 0 3 | devpts /dev/pts devpts mode=0620,gid=5 0 0 4 | usbdevfs /proc/bus/usb usbdevfs noauto 0 0 5 | tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0 6 | tmpfs /var/volatile tmpfs defaults 0 0 7 | /dev/mmcblk0p5 /factory auto ro,noatime 0 0 8 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/flashall/flashall-2.0/helper/helper.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Please plug Edison board

4 |

5 | If already plugged, please unplug and re plug it. 6 |
7 | 8 | 9 | 14 | 19 | 20 |
10 | Edison breakout board 11 |
12 | 13 |
15 | Edison arduino board 16 |
17 | 18 |
21 |

22 | Also make sure you selected the good USB driver (CDC or RNDIS). 23 | 24 | 25 | -------------------------------------------------------------------------------- /recipes-core/systemd/systemd-watchdog.bb: -------------------------------------------------------------------------------- 1 | # Creates a package containing a systemd configuration entry 2 | # for the watchdog feature. Activate the watchdog by including 3 | # the package in the image. 4 | 5 | LICENSE = "MIT" 6 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 7 | SRC_URI += "file://runtime-watchdog.conf" 8 | 9 | inherit allarch 10 | 11 | do_install () { 12 | install -m 0755 -d ${D}/${sysconfdir}/systemd/system.conf.d 13 | install -m 0644 ${WORKDIR}/runtime-watchdog.conf ${D}/${sysconfdir}/systemd/system.conf.d/00-runtime-watchdog.conf 14 | } 15 | 16 | CONFFILES_${PN} = "${sysconfdir}/systemd/system.conf.d/00-runtime-watchdog.conf" 17 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/u-boot/files/fw_env.config: -------------------------------------------------------------------------------- 1 | # Configuration file for fw_(printenv/setenv) utility. 2 | # Up to two entries are valid, in this case the redundant 3 | # environment sector is assumed present. 4 | # Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash. 5 | # Futhermore, if the Flash sector size is ommitted, this value is assumed to 6 | # be the same as the Environment size, which is valid for NOR and SPI-dataflash 7 | 8 | # MTD device name Device offset Env. size Flash sector size Number of sectors 9 | # On Edison, the u-boot environments are located on partitions 2 and 4 and both have a size of 64kB 10 | /dev/mmcblk0p2 0x0000 0x10000 11 | /dev/mmcblk0p4 0x0000 0x10000 12 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/security.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_CC_STACKPROTECTOR=y 2 | CONFIG_CC_STACKPROTECTOR_STRONG=y 3 | CONFIG_DEBUG_STACKOVERFLOW=y 4 | CONFIG_DEFAULT_MMAP_MIN_ADDR=65536 5 | CONFIG_RANDOMIZE_BASE=y 6 | CONFIG_SECURITY_DMESG_RESTRICT=y 7 | CONFIG_STRICT_DEVMEM=y 8 | CONFIG_LSM_MMAP_MIN_ADDR=65536 9 | CONFIG_SECURITY_NETWORK=y 10 | CONFIG_SECURITY_YAMA=y 11 | CONFIG_SECURITY_YAMA_STACKED=y 12 | CONFIG_IMA_APPRAISE_SIGNED_INIT=y 13 | CONFIG_IMA_LSM_RULES=y 14 | CONFIG_INTEGRITY_AUDIT=y 15 | # CONFIG_DEVKMEM is not set 16 | # CONFIG_IKCONFIG_PROC is not set 17 | # CONFIG_PROC_KCORE is not set 18 | CONFIG_NF_DEFRAG_IPV6=m 19 | CONFIG_NF_CONNTRACK_IPV6=m 20 | # CONFIG_NF_NAT_IPV6 is not set 21 | # CONFIG_IP6_NF_NAT is not set 22 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-kernel/linux/linux-yocto-edison.bb: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/files:" 2 | 3 | LINUX_VERSION = "3.10.98" 4 | #LINUX_VERSION = "3.19.5" 5 | 6 | SRC_URI = "git://github.com/01org/edison-linux.git;protocol=git;branch=edison-${LINUX_VERSION};nocheckout=1;name=machine" 7 | SRC_URI += "file://defconfig" 8 | SRC_URI += "file://4.2-3.10-hack.patch" 9 | SRC_URI += "file://0002-Always-inline-inline-functions.patch" 10 | 11 | SRCREV_machine = "ff2ff63071c8cf7408c2bed7350c155586c869dc" 12 | #SRCREV_machine = "e152349de59b43b2a75f2c332b44171df461d5a0" 13 | 14 | inherit kernel 15 | require recipes-kernel/linux/linux-yocto.inc 16 | 17 | PV = "${LINUX_VERSION}+git${SRCPV}" 18 | 19 | COMPATIBLE_MACHINE = "edison" 20 | 21 | -------------------------------------------------------------------------------- /recipes-extended/spi-minnowmax-board/files/modprobe.d/spi-minnow-at86rf230.conf.sample: -------------------------------------------------------------------------------- 1 | # These modules are required to enable AT86RF230 802.15.4 radio in the 2 | # MinnowBoard MAX 3 | # 4 | # To enable loading, link as below: 5 | # 6 | # install: ln -s /lib/modprobe.d/spi-minnow-at86rf230.conf.sample /etc/modprobe.d/spi-minnow-at86rf230.conf 7 | # to-autoload: ln -s /usr/lib/modules-load.d/at86rf230.conf.sample /etc/modules-load.d/at86rf230.conf 8 | # 9 | # NOTE: MinnowBoard MAX BIOS must have LPSS SPI enabled. 10 | 11 | blacklist spi-minnow-cc2520 12 | install spi-minnow-cc2520 /bin/true 13 | 14 | blacklist low_speed-spidev # avoid being auto-loaded as dependency 15 | install low_speed-spidev /bin/true # disable manual install 16 | 17 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/lockdep.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_EXPERT=y 2 | CONFIG_KALLSYMS_ALL=y 3 | CONFIG_DEBUG_KERNEL=y 4 | CONFIG_LOCKUP_DETECTOR=y 5 | CONFIG_HARDLOCKUP_DETECTOR=y 6 | CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE=0 7 | CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 8 | CONFIG_DETECT_HUNG_TASK=y 9 | CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 10 | CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 11 | CONFIG_SCHED_DEBUG=y 12 | CONFIG_DEBUG_PREEMPT=y 13 | CONFIG_DEBUG_RT_MUTEXES=y 14 | CONFIG_DEBUG_SPINLOCK=y 15 | CONFIG_DEBUG_MUTEXES=y 16 | CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y 17 | CONFIG_DEBUG_LOCK_ALLOC=y 18 | CONFIG_PROVE_LOCKING=y 19 | CONFIG_LOCKDEP=y 20 | CONFIG_LOCK_STAT=y 21 | CONFIG_DEBUG_RODATA=y 22 | CONFIG_DEBUG_RODATA_TEST=y 23 | CONFIG_X86_DEBUG_FPU=y 24 | -------------------------------------------------------------------------------- /recipes-extended/spi-minnowmax-board/files/modprobe.d/spi-minnow-cc2520.conf.sample: -------------------------------------------------------------------------------- 1 | # These modules are required to enable CC2520 802.15.4 radio in the 2 | # MinnowBoard MAX 3 | # 4 | # To enable loading, link as below: 5 | # 6 | # install: ln -s /lib/modprobe.d/spi-minnow-cc2520.conf.sample /etc/modprobe.d/spi-minnow-cc2520.conf 7 | # to-autoload: ln -s /usr/lib/modules-load.d/cc2520.conf.sample /etc/modules-load.d/cc2520.conf 8 | # 9 | # NOTE: MinnowBoard MAX BIOS must have PWM #1/#2 disabled and LPSS SPI enabled. 10 | 11 | blacklist spi-minnow-at86rf230 12 | install spi-minnow-at86rf230 /bin/true 13 | 14 | blacklist low_speed-spidev # avoid being auto-loaded as dependency 15 | install low_speed-spidev /bin/true # disable manual install 16 | 17 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-connectivity/bluetooth-rfkill-event/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, Intel Corporation. 2 | 3 | This program is free software; you can redistribute it and/or modify it 4 | under the terms of version 2 of the GNU General Public License as 5 | published by the Free Software Foundation. 6 | 7 | This program is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 9 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU General Public License along with 13 | this program; if not, write to the Free Software Foundation, Inc., 59 14 | Temple Place - Suite 330, Boston, MA 02111-1307, USA. 15 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-core/images/core-image-initramfs-edison.bb: -------------------------------------------------------------------------------- 1 | # Simple initramfs image. 2 | DESCRIPTION = "Small initramfs image capable of supporting fota." 3 | 4 | PACKAGE_INSTALL = "initramfs-boot ${VIRTUAL-RUNTIME_base-utils} udev base-passwd u-boot-fw-utils-edison dosfstools e2fsprogs-mke2fs e2fsprogs-tune2fs ${ROOTFS_BOOTSTRAP_INSTALL} watchdog" 5 | 6 | # Do not pollute the initrd image with rootfs features 7 | IMAGE_FEATURES = "" 8 | 9 | export IMAGE_BASENAME = "core-image-initramfs-edison" 10 | IMAGE_LINGUAS = "" 11 | 12 | LICENSE = "MIT" 13 | 14 | #EXTRA_IMAGECMD = "-O ^sparse_super2" 15 | IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}" 16 | inherit core-image 17 | 18 | IMAGE_ROOTFS_SIZE = "8192" 19 | 20 | BAD_RECOMMENDATIONS += "busybox-syslog systemd" 21 | 22 | USE_DEVFS = "0" 23 | 24 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/galileo2.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_GPIO_GENERIC=y 2 | CONFIG_GPIO_DWAPB=y 3 | CONFIG_GPIO_SCH=y 4 | CONFIG_MFD_CORE=y 5 | CONFIG_LPC_SCH=y 6 | CONFIG_I2C_DESIGNWARE_CORE=y 7 | CONFIG_I2C_DESIGNWARE_PLATFORM=y 8 | CONFIG_I2C_DESIGNWARE_PCI=y 9 | CONFIG_I2C_SLAVE=y 10 | CONFIG_I2C_SLAVE_EEPROM=m 11 | CONFIG_GPIOLIB_IRQCHIP=y 12 | CONFIG_GPIO_PCA953X=y 13 | CONFIG_GPIO_PCA953X_IRQ=y 14 | CONFIG_GPIO_SYSFS=y 15 | CONFIG_MFD_INTEL_QUARK_I2C_GPIO=y 16 | CONFIG_PWM=y 17 | CONFIG_PWM_SYSFS=y 18 | CONFIG_EEPROM_AT24=m 19 | CONFIG_MFD_PCA9685=m 20 | # CONFIG_STANDALONE is not set 21 | CONFIG_ACPI_CUSTOM_DSDT_FILE="DSDT.hex" 22 | CONFIG_ACPI_CUSTOM_DSDT=y 23 | CONFIG_STAGING=y 24 | CONFIG_ADC1x8S102=y 25 | CONFIG_SPI_PXA2XX_DMA=y 26 | CONFIG_SPI_PXA2XX=y 27 | CONFIG_SPI_PXA2XX_PCI=y 28 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/bluetooth.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_BT=m 2 | CONFIG_BT_RFCOMM=m 3 | CONFIG_BT_RFCOMM_TTY=m 4 | CONFIG_BT_BNEP=m 5 | CONFIG_BT_BNEP_MC_FILTER=y 6 | CONFIG_BT_BNEP_PROTO_FILTER=y 7 | CONFIG_BT_HIDP=m 8 | # CONFIG_BT_SELFTEST is not set 9 | # CONFIG_BT_DEBUGFS is not set 10 | 11 | # 12 | # Bluetooth device drivers 13 | # 14 | CONFIG_BT_INTEL=m 15 | CONFIG_BT_BCM=m 16 | CONFIG_BT_HCIBTUSB=m 17 | CONFIG_BT_HCIBTUSB_BCM=y 18 | # CONFIG_BT_HCIBTSDIO is not set 19 | # CONFIG_BT_HCIUART is not set 20 | # CONFIG_BT_HCIBCM203X is not set 21 | # CONFIG_BT_HCIBPA10X is not set 22 | # CONFIG_BT_HCIBFUSB is not set 23 | # CONFIG_BT_HCIVHCI is not set 24 | # CONFIG_BT_MRVL is not set 25 | CONFIG_BT_ATH3K=m 26 | 27 | CONFIG_USB_OHCI_HCD=m 28 | CONFIG_USB_OHCI_HCD_PCI=m 29 | 30 | CONFIG_USB_UHCI_HCD=m 31 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/u-boot/files/0001-Fix-missing-stdint.h-include.patch: -------------------------------------------------------------------------------- 1 | From 12f254de22bd9695b2052f112ec2695470c23be2 Mon Sep 17 00:00:00 2001 2 | From: Jussi Laako 3 | Date: Mon, 25 Jan 2016 17:18:29 +0200 4 | Subject: [PATCH] Fix missing stdint.h include 5 | 6 | Signed-off-by: Jussi Laako 7 | --- 8 | tools/env/fw_env.c | 1 + 9 | 1 file changed, 1 insertion(+) 10 | 11 | diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c 12 | index d228cc3..3613d3b 100644 13 | --- a/tools/env/fw_env.c 14 | +++ b/tools/env/fw_env.c 15 | @@ -15,6 +15,7 @@ 16 | #include 17 | #include 18 | #include 19 | +#include 20 | #include 21 | #include 22 | #include 23 | -- 24 | 2.7.0.rc3 25 | 26 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/u-boot/u-boot-tools-edison_2014.04.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "U-boot bootloader mkimage tool" 2 | LICENSE = "GPLv2+" 3 | LIC_FILES_CHKSUM = "file://Licenses/README;md5=025bf9f768cbcb1a165dbe1a110babfb" 4 | SECTION = "bootloader" 5 | 6 | require u-boot-internal.inc 7 | 8 | EXTRA_OEMAKE = 'HOSTCC="${CC}" HOSTLD="${LD}" HOSTLDFLAGS="${LDFLAGS}" HOSTSTRIP=true' 9 | 10 | do_compile () { 11 | oe_runmake tools 12 | } 13 | 14 | do_install () { 15 | install -d ${D}${bindir} 16 | install -m 0755 tools/mkimage ${D}${bindir}/uboot-mkimage 17 | install -m 0755 tools/mkenvimage ${D}${bindir}/uboot-mkenvimage 18 | ln -sf uboot-mkimage ${D}${bindir}/mkimage 19 | ln -sf uboot-mkenvimage ${D}${bindir}/mkenvimage 20 | } 21 | 22 | BBCLASSEXTEND = "native nativesdk" 23 | 24 | COMPATIBLE_MACHINE = "edison" 25 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-kernel/mcu-fw/mcu-fw-load.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "This is intel mcu app download daemon." 2 | HOMEPAGE = "http://www.intel.com" 3 | 4 | LICENSE = "Intel-OBL-Binary-Firmware-License" 5 | LIC_FILES_CHKSUM = "file://LICENSE;md5=41b172554812bbdd8ef5b0711639b69b" 6 | 7 | FILESEXTRAPATHS_prepend := "${THISDIR}/files/:" 8 | 9 | SRC_URI = "file://mcu_fw_loader.service \ 10 | file://mcu_fw_loader.sh \ 11 | file://LICENSE" 12 | 13 | SYSTEMD_SERVICE_${PN} = "mcu_fw_loader.service" 14 | 15 | S = "${WORKDIR}" 16 | 17 | inherit systemd 18 | 19 | do_install () { 20 | install -d ${D}${sysconfdir}/intel_mcu/ 21 | install -m 0755 mcu_fw_loader.sh ${D}${sysconfdir}/intel_mcu/ 22 | 23 | install -d ${D}${systemd_unitdir}/system/ 24 | install -m 0644 mcu_fw_loader.service ${D}${systemd_unitdir}/system/ 25 | } 26 | 27 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-kernel/bcm43340-bt/bcm43340-bt_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Broadcom Bluetooth fw files and patch utility" 2 | SECTION = "connectivity" 3 | 4 | SRC_URI = "git://github.com/01org/edison-firmware.git;branch=master;protocol=git;rev=8585a10b3527666b2d35b3dcacffede3ec00cb53" 5 | 6 | LICENSE = "Proprietary" 7 | LIC_FILES_CHKSUM = "file://LICENCE.broadcom_bcm43xx;md5=3160c14df7228891b868060e1951dfbc" 8 | 9 | PR = "r1" 10 | 11 | S = "${WORKDIR}/git/broadcom_cws/bluetooth/firmware/" 12 | 13 | do_compile() { 14 | ${CC} -O2 -Wall ${LDFLAGS} -o brcm_patchram_plus brcm_patchram_plus.c 15 | } 16 | 17 | do_install() { 18 | install -v -d ${D}/etc/firmware/ 19 | install -m 0755 BCM43341B0_002.001.014.0122.0166.hcd ${D}/etc/firmware/bcm43341.hcd 20 | install -v -d ${D}/usr/sbin/ 21 | install -m 0755 brcm_patchram_plus ${D}/usr/sbin/ 22 | } 23 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/flashall/flashall-2.0/pft-config-edison.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | system 4 | edison 5 | 6 | 0x80000007 7 | 8 | 9 | 10 | edison_ifwi-dbg-00.bin 11 | 00ED.1D01 12 | 13 | 14 | edison_dnx_fwr.bin 15 | 00ED.1D01 16 | 17 | 18 | edison_dnx_osr.bin 19 | 00ED.1D01 20 | 21 | 22 | 23 | 24 | u-boot-edison.img 25 | edison 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/ifwi/ifwi_2015.01.30.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "ifwi binary blobs" 2 | 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=ea398a763463b76b18da15f013c0c531" 5 | 6 | inherit deploy 7 | 8 | PR = "r1" 9 | 10 | SRC_URI = "file://${PN}-${PV}.tar.bz2" 11 | 12 | S="${WORKDIR}/ifwi" 13 | 14 | PACKAGE_ARCH = "${MACHINE_ARCH}" 15 | 16 | do_deploy () { 17 | 18 | # remove any prior deployments 19 | rm -rf ${DEPLOYDIR}/ifwi 20 | 21 | install -d ${DEPLOYDIR}/ifwi 22 | install ${S}/*.bin ${DEPLOYDIR}/ifwi 23 | 24 | # build ifwi file for using in DFU mode 25 | # Remove FUP footer (144 bytes) as it's not needed when we directly write to boot partitions 26 | for ifwi in ${DEPLOYDIR}/ifwi/*ifwi*.bin ; 27 | do 28 | dfu_ifwi_name="`basename $ifwi .bin`-dfu.bin" 29 | dd if=$ifwi of=${DEPLOYDIR}/ifwi/$dfu_ifwi_name bs=4194304 count=1 30 | done 31 | } 32 | 33 | addtask deploy before do_rootfs 34 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-kernel/bcm43340/bcm43340-fw.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Firmware files for use with Linux kernel" 2 | SECTION = "kernel" 3 | 4 | SRC_URI = "git://github.com/01org/edison-firmware.git;branch=master;protocol=git;rev=8585a10b3527666b2d35b3dcacffede3ec00cb53" 5 | 6 | S = "${WORKDIR}/git/broadcom_cws/wlan/firmware/" 7 | 8 | LICENSE = "Proprietary" 9 | LIC_FILES_CHKSUM = "file://LICENCE.broadcom_bcm43xx;md5=3160c14df7228891b868060e1951dfbc" 10 | 11 | PV = "6.20.190" 12 | PR = "r4" 13 | 14 | inherit allarch update-alternatives 15 | 16 | do_install() { 17 | install -v -d ${D}/etc/firmware/ 18 | install -m 0755 bcmdhd_aob.cal_4334x_b0 ${D}/etc/firmware/bcmdhd_aob.cal 19 | install -m 0755 bcmdhd.cal_4334x_b0 ${D}/etc/firmware/bcmdhd.cal 20 | install -m 0755 fw_bcmdhd_p2p.bin_4334x_b0 ${D}/etc/firmware/fw_bcmdhd.bin 21 | install -m 0755 LICENCE.broadcom_bcm43xx ${D}/etc/firmware/ 22 | } 23 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-connectivity/bluetooth-rfkill-event/files/bcm43341.conf: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # 3 | # Configuration file for Broadcom hciattach utility (brcm_patchram_plus) 4 | # 5 | # option are loaded by rfkill event daemon and passed to brcm_patchram_plus 6 | # 7 | ########################################################################### 8 | [General] 9 | 10 | # fork 11 | fork = true 12 | 13 | # Low Power Mode 14 | lpm = true 15 | 16 | # register HCI device 17 | reg_hci = true 18 | 19 | # set baudrate; possible values: 20 | # 115200, 230400, 460800, 500000, 576000, 921600 21 | # 1000000, 1152000, 1500000, 2000000, 2500000, 3000000, 3500000, 4000000 22 | baud_rate = 3000000 23 | 24 | # FW patch file 25 | fw_patch = /etc/firmware/bcm43341.hcd 26 | 27 | # UART device 28 | uart_dev = /dev/ttyMFD0 29 | 30 | # SCO settings 31 | # configure sco routing to Transport (HCI); 32 | scopcm = 1,0,0,0,0,0,0,0,0,0 33 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/flashall/flashall-2.0/filter-dfu-out.js: -------------------------------------------------------------------------------- 1 | /* filter output of dfu-util and handle tee feature */ 2 | var stdin = WScript.StdIn; 3 | var stdout = WScript.StdOut; 4 | var fs = WScript.CreateObject("Scripting.FileSystemObject"); 5 | if ( WScript.arguments.length < 2 ) { 6 | WScript.Quit(3) ; 7 | } 8 | 9 | var f = fs.OpenTextFile(WScript.arguments(0), 8,true, 0); 10 | var filterout = false 11 | if ( WScript.arguments(1) == "on") { 12 | filterout = true; 13 | } 14 | 15 | while (!stdin.AtEndOfStream) { 16 | line = ""; 17 | while (!stdin.AtEndOfLine) { 18 | carac = stdin.Read(1); 19 | line += carac; 20 | if ((carac == '\r')) { 21 | stdout.Write(line); 22 | line = "" 23 | } 24 | 25 | } 26 | stdin.Read(1); 27 | if (filterout) { 28 | if (line.indexOf("Download") >= 0 ) { 29 | stdout.write(line + '\n'); 30 | } 31 | } 32 | else { 33 | stdout.write(line + '\n') 34 | } 35 | f.write(line + '\n'); 36 | } 37 | 38 | f.Close(); 39 | -------------------------------------------------------------------------------- /recipes-extended/spi-quark-board/spi-quark-board.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "6lowpan over 802.15.4 for 802.15.4 chip on Galileo" 2 | 3 | LICENSE = "GPLv2" 4 | LIC_FILES_CHKSUM = "file://${THISDIR}/files/COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e" 5 | PR = "r0" 6 | 7 | # The module is compatible with intel-quark/Galileo Gen2 only 8 | COMPATIBLE_MACHINE="intel-quark" 9 | 10 | inherit module 11 | 12 | FILESEXTRAPATHS_prepend := "${THISDIR}/files/:" 13 | 14 | RRECOMMENDS_${PN} = "ostro-6lowpan" 15 | 16 | SRC_URI = "file://spi-quark-at86rf230.c \ 17 | file://spi-quark-board.c \ 18 | file://spi-quark-board.h \ 19 | file://Makefile \ 20 | file://modules-load.d/at86rf230.conf.sample \ 21 | " 22 | 23 | FILES_${PN} += " /usr/lib/modules-load.d/at86rf230.conf.sample \ 24 | " 25 | # Sample configuring file 26 | do_install_append () { 27 | install -d -m 755 ${D}${libdir}/modules-load.d 28 | install -m 0644 modules-load.d/at86rf230.conf.sample ${D}${libdir}/modules-load.d/ 29 | } 30 | 31 | S = "${WORKDIR}" 32 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/u-boot/u-boot-fw-utils-edison_2014.04.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "U-boot bootloader fw_printenv/setenv utils" 2 | LICENSE = "GPLv2+" 3 | LIC_FILES_CHKSUM = "file://Licenses/README;md5=025bf9f768cbcb1a165dbe1a110babfb" 4 | SECTION = "bootloader" 5 | 6 | require u-boot-internal.inc 7 | 8 | FILESEXTRAPATHS_prepend := "${THISDIR}/files:" 9 | SRC_URI += "file://fw_env.config" 10 | 11 | EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}"' 12 | 13 | INSANE_SKIP_${PN} += "ldflags" 14 | 15 | do_compile () { 16 | oe_runmake ${UBOOT_MACHINE} 17 | oe_runmake env 18 | } 19 | 20 | do_install () { 21 | install -d ${D}${sbindir} 22 | install -m 755 ${S}/tools/env/fw_printenv_unstripped ${D}${sbindir}/fw_printenv 23 | # This is not a typo, this tool checks the args[0] to change its behavior a-la-busybox 24 | install -m 755 ${S}/tools/env/fw_printenv_unstripped ${D}${sbindir}/fw_setenv 25 | } 26 | 27 | FILES_${PN} = "${sbindir}/*" 28 | FILES_${PN} += "${sysconfdir}/fw_env.config" 29 | 30 | DEPENDS = "u-boot-edison" 31 | 32 | COMPATIBLE_MACHINE = "edison" 33 | -------------------------------------------------------------------------------- /COPYING.MIT: -------------------------------------------------------------------------------- 1 | Copyright(c) 2013 Intel Corporation. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/flashall/flashall-2.0/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright © 2014 Intel Corporation 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /recipes-extended/i2c-quark-board/files/i2c-quark-apds9960.c: -------------------------------------------------------------------------------- 1 | /* 2 | * APDS9960 I2C sensor kernel module 3 | * build command: KDIR=/kernel-source/ make 4 | * The kernel config should include CONFIG_APDS9960=m 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #define APDS9960_I2C_ADDR 0x39 12 | 13 | /* The IRQ pin is connected to GPIO14=IO3 14 | */ 15 | #define APDS9960_I2C_IRQ 14 16 | 17 | static struct i2c_board_info i2c_device = { 18 | I2C_BOARD_INFO("apds9960", APDS9960_I2C_ADDR), 19 | .irq = -1, 20 | }; 21 | 22 | static struct i2c_client *i2c_client; 23 | static int __init apds9960_init(void) 24 | { 25 | struct i2c_adapter *adap = NULL; 26 | 27 | adap = i2c_get_adapter(0); 28 | if (!adap) 29 | return -1; 30 | 31 | gpio_request_one(16, GPIOF_OUT_INIT_HIGH, "at86rf230-gpio16"); 32 | i2c_device.irq = gpio_to_irq(APDS9960_I2C_IRQ); 33 | printk("Create new I2C device on %s \n", adap->name); 34 | i2c_client = i2c_new_device(adap, &i2c_device); 35 | return 0; 36 | } 37 | 38 | static void __exit apds9960_exit(void) 39 | { 40 | i2c_unregister_device(i2c_client); 41 | } 42 | MODULE_LICENSE("GPL"); 43 | module_init(apds9960_init); 44 | module_exit(apds9960_exit); 45 | -------------------------------------------------------------------------------- /conf/layer.conf: -------------------------------------------------------------------------------- 1 | # We have a conf and classes directory, add to BBPATH 2 | BBPATH := "${BBPATH}:${LAYERDIR}" 3 | 4 | # We have a recipes directory, add to BBFILES 5 | BBFILES := "${BBFILES} ${LAYERDIR}/recipes-*/*/*.bb \ 6 | ${LAYERDIR}/recipes-*/*/*.bbappend" 7 | 8 | BBFILE_COLLECTIONS += "quark-bsp" 9 | BBFILE_PATTERN_quark-bsp := "^${LAYERDIR}/" 10 | BBFILE_PRIORITY_quark-bsp = "6" 11 | 12 | # Normally one would use MACHINE_ESSENTIAL_EXTRA_RDEPENDS in a machine 13 | # config, but we use existing machine configurations and thus cannot 14 | # do that. Extending via layer config with machine override is close 15 | # enough. 16 | 17 | MACHINE_ESSENTIAL_EXTRA_RDEPENDS_append_intel-corei7-64 = " \ 18 | spi-minnowmax-board \ 19 | i2c-minnowmax-board \ 20 | " 21 | 22 | MACHINE_ESSENTIAL_EXTRA_RDEPENDS_append_intel-quark = " \ 23 | spi-quark-board \ 24 | i2c-quark-board \ 25 | " 26 | 27 | MACHINE_ESSENTIAL_EXTRA_RDEPENDS_append_edison = " \ 28 | i2c-edison-board \ 29 | " 30 | 31 | # Could be also in edison.conf, kept here for sake of consistency. 32 | MACHINE_ESSENTIAL_EXTRA_RDEPENDS_append_edison = " systemd-watchdog" 33 | MACHINE_ESSENTIAL_EXTRA_RDEPENDS_append_beaglebone = " systemd-watchdog" 34 | # Actually only relevant on MinnowMax, but causes little harm 35 | # elsewhere (unnecessary sleep wakeup every 45 seconds). 36 | MACHINE_ESSENTIAL_EXTRA_RDEPENDS_append_intel-corei7-64 = " systemd-watchdog" 37 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/flashall/flashall_2.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "flashall scripts and supporting files" 2 | 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=ea398a763463b76b18da15f013c0c531" 5 | 6 | inherit deploy 7 | 8 | PR = "r5" 9 | 10 | SRC_URI = " \ 11 | file://LICENSE \ 12 | file://filter-dfu-out.js \ 13 | file://flashall.bat \ 14 | file://flashall.sh \ 15 | file://pft-config-edison.xml \ 16 | file://FlashEdison.json \ 17 | file://helper/helper.html \ 18 | file://helper/images/Edison-arduino.png \ 19 | file://helper/images/Edison-arduino-blink-led.png \ 20 | file://helper/images/Edison-breakout-board.png \ 21 | " 22 | 23 | S="${WORKDIR}" 24 | 25 | PACKAGE_ARCH = "${MACHINE_ARCH}" 26 | 27 | do_deploy () { 28 | 29 | # remove any prior deployments 30 | rm -rf ${DEPLOYDIR}/flashall 31 | 32 | install -d ${DEPLOYDIR}/flashall 33 | install ${S}/filter-dfu-out.js ${DEPLOYDIR}/flashall 34 | install ${S}/flashall.* ${DEPLOYDIR}/flashall 35 | install ${S}/pft-config-edison.xml ${DEPLOYDIR}/flashall 36 | install ${S}/FlashEdison.json ${DEPLOYDIR}/flashall 37 | 38 | install -d ${DEPLOYDIR}/flashall/helper 39 | install ${S}/helper/helper.html ${DEPLOYDIR}/flashall/helper 40 | 41 | install -d ${DEPLOYDIR}/flashall/helper/images 42 | install ${S}/helper/images/*.png ${DEPLOYDIR}/flashall/helper/images 43 | } 44 | 45 | addtask deploy before do_rootfs 46 | -------------------------------------------------------------------------------- /recipes-extended/ethtool/files/quark.patch: -------------------------------------------------------------------------------- 1 | From 1b1a122b192687355cb18cd16b5e8f053a57f9b4 Mon Sep 17 00:00:00 2001 2 | From: Bryan O'Donoghue 3 | Date: Thu, 4 Oct 2012 09:55:22 +0100 4 | Subject: [PATCH] stmmac.c updated to align with kernel registers being 5 | reported in Clanton's version of this driver 6 | 7 | --- 8 | stmmac.c | 11 ++++++++++- 9 | 1 file changed, 10 insertions(+), 1 deletion(-) 10 | 11 | diff --git a/stmmac.c b/stmmac.c 12 | index fb69bfe..3d79054 100644 13 | --- a/stmmac.c 14 | +++ b/stmmac.c 15 | @@ -52,11 +52,20 @@ int st_gmac_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs) 16 | int i; 17 | unsigned int *stmmac_reg = (unsigned int *)regs->data; 18 | 19 | - fprintf(stdout, "ST GMAC Registers\n"); 20 | + fprintf(stdout, "ST GMAC Registers - Quark SOC extended\n"); 21 | fprintf(stdout, "GMAC Registers\n"); 22 | for (i = 0; i < 55; i++) 23 | fprintf(stdout, "Reg%d 0x%08X\n", i, *stmmac_reg++); 24 | 25 | + /* VLAN extended registers 355 & 354 */ 26 | + for(i = 353; i < 355; i++) 27 | + fprintf(stdout, "Reg%d 0x%08x\n", i, *stmmac_reg++); 28 | + 29 | + /* 1588 extended registers 448 - 461 */ 30 | + for(i = 448; i < 462; i++) 31 | + fprintf(stdout, "Reg%d 0x%08x\n", i, *stmmac_reg++); 32 | + 33 | + /* DMA Regs */ 34 | fprintf(stdout, "\n"); 35 | fprintf(stdout, "DMA Registers\n"); 36 | for (i = 0; i < 22; i++) 37 | -- 38 | 1.8.2 39 | 40 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-ostro_4.1.bb: -------------------------------------------------------------------------------- 1 | KBRANCH ?= "linux-4.1.y" 2 | 3 | require recipes-kernel/linux/linux-yocto.inc 4 | 5 | S = "${WORKDIR}/linux-stable" 6 | FILESEXTRAPATHS_prepend := "${THISDIR}/linux-yocto:" 7 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 8 | 9 | # Override COMPATIBLE_MACHINE to include your machine in a bbappend 10 | # file. Leaving it empty here ensures an early explicit build failure. 11 | COMPATIBLE_MACHINE = "quark|atom|atomup" 12 | 13 | SRCREV = "c8bde72f9af412de57f0ceae218d648640118b0b" 14 | 15 | SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git;branch=${KBRANCH}" 16 | 17 | SRC_URI_append_quark = " \ 18 | file://quark/PATCHv6-1-1-thermal-intel-Quark-SoC-X1000-DTS-thermal-driver.patch \ 19 | file://quark/v4-1-2-firmware_loader-introduce-new-API---request_firmware_direct_full_path.patch \ 20 | file://quark/v4-2-2-efi-an-sysfs-interface-for-user-to-update-efi-firmware.patch \ 21 | file://quark/defconfig \ 22 | " 23 | SRC_URI_append_atom = " \ 24 | file://atom/defconfig" 25 | SRC_URI_append_atomup = " \ 26 | file://atomup/defconfig" 27 | 28 | # pick selected semi-generic fragments 29 | SRC_URI_append = " \ 30 | file://can.cfg \ 31 | file://nfc.cfg \ 32 | file://usb-serial.cfg \ 33 | " 34 | SRC_URI_append_quark = " \ 35 | file://can-spi.cfg \ 36 | file://nfc-spi.cfg \ 37 | file://nfc-i2c.cfg \ 38 | file://sensors.cfg \ 39 | " 40 | 41 | LINUX_VERSION ?= "4.1.3" 42 | 43 | -------------------------------------------------------------------------------- /recipes-bsp/u-boot/u-boot/0001-Search-for-bootable-partitions-on-both-SD-and-eMMC.patch: -------------------------------------------------------------------------------- 1 | From 86cc560ff9a6578326532e277d987e24661e5f04 Mon Sep 17 00:00:00 2001 2 | From: Jussi Laako 3 | Date: Fri, 26 Feb 2016 14:58:32 +0200 4 | Subject: [PATCH] Search for bootable partitions on both SD and eMMC 5 | 6 | On BeagleBone Black, first attempt to boot from microSD and then from 7 | eMMC if not available. 8 | 9 | Signed-off-by: Jussi Laako 10 | --- 11 | include/configs/ti_armv7_common.h | 11 ++++++++++- 12 | 1 file changed, 10 insertions(+), 1 deletion(-) 13 | 14 | diff --git a/include/configs/ti_armv7_common.h b/include/configs/ti_armv7_common.h 15 | index 199612b..ece87ab 100644 16 | --- a/include/configs/ti_armv7_common.h 17 | +++ b/include/configs/ti_armv7_common.h 18 | @@ -60,7 +60,16 @@ 19 | #define DEFAULT_MMC_TI_ARGS \ 20 | "mmcdev=0\0" \ 21 | "mmcrootfstype=ext4 rootwait\0" \ 22 | - "finduuid=part uuid mmc 0:2 uuid\0" \ 23 | + "findsduuid=part uuid mmc 0:2 sduuid\0" \ 24 | + "findemmcuuid=part uuid mmc 1:2 emmcuuid\0" \ 25 | + "finduuid=if run findsduuid; then "\ 26 | + "echo \"Boot from microSD\"; "\ 27 | + "setenv uuid ${sduuid}; " \ 28 | + "else " \ 29 | + "run findemmcuuid; " \ 30 | + "echo \"Boot from eMMC\"; " \ 31 | + "setenv uuid ${emmcuuid}; " \ 32 | + "fi;\0" \ 33 | "args_mmc=run finduuid;setenv bootargs console=${console} " \ 34 | "${optargs} " \ 35 | "root=PARTUUID=${uuid} rw " \ 36 | -- 37 | 2.7.0 38 | 39 | -------------------------------------------------------------------------------- /recipes-extended/i2c-minnowmax-board/files/i2c-minnow-apds9960.c: -------------------------------------------------------------------------------- 1 | /* 2 | * MinnowBoard-Max APDS9960 I2C sensor test file 3 | * build command: KDIR=/kernel-source/ make 4 | * The kernel config should include CONFIG_APDS9960=m 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #define APDS9960_I2C_ADDR 0x39 12 | 13 | /* The APDS9960 IRQ pin is connected to pin25(GPIO_S5_2) of LSE connector, 14 | * On Linux >=3.18, it is GPIO 340 15 | * For more information, visit the below 16 | * http://www.elinux.org/Minnowboard:MinnowMax#Low_Speed_Expansion_.28Top.29 17 | */ 18 | #define APDS9960_I2C_IRQ 340 19 | 20 | static struct i2c_board_info apds9960_accel_device = { 21 | I2C_BOARD_INFO("apds9960", APDS9960_I2C_ADDR), 22 | .irq = -1, 23 | }; 24 | 25 | static struct i2c_client *i2c_client; 26 | static int __init apds9960_init(void) 27 | { 28 | int i = 0; 29 | struct i2c_adapter *adap = NULL; 30 | 31 | for (i = 0; i < 3; i++) { 32 | adap = i2c_get_adapter(i); 33 | if (!adap) 34 | return -1; 35 | 36 | if (!strcmp(adap->name, "Synopsys DesignWare I2C adapter")) 37 | break; 38 | } 39 | 40 | apds9960_accel_device.irq = gpio_to_irq(APDS9960_I2C_IRQ); 41 | 42 | i2c_client = i2c_new_device(adap, &apds9960_accel_device); 43 | return 0; 44 | } 45 | 46 | static void __exit apds9960_exit(void) 47 | { 48 | i2c_unregister_device(i2c_client); 49 | } 50 | MODULE_LICENSE("GPL"); 51 | module_init(apds9960_init); 52 | module_exit(apds9960_exit); 53 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-connectivity/bluetooth-rfkill-event/bluetooth-rfkill-event_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Bluetooth rfkill event daemon for Bluetooth chips" 2 | SECTION = "connectivity" 3 | 4 | LICENSE = "GPLv2" 5 | LIC_FILES_CHKSUM = "file://${THISDIR}/COPYING;md5=3fa94220fac4e7b1463e6fd8d63140c5" 6 | 7 | DEPENDS = "glib-2.0 bluez5" 8 | 9 | FILESEXTRAPATHS_prepend := "${THISDIR}/files/:" 10 | 11 | inherit systemd 12 | 13 | SYSTEMD_SERVICE_${PN} = "bluetooth-rfkill-event.service" 14 | 15 | SRC_URI = "file://bluetooth_rfkill_event.c \ 16 | file://bluetooth-rfkill-event.service \ 17 | file://bcm43341.conf" 18 | 19 | S = "${WORKDIR}" 20 | 21 | INC_DIRS = "-I${STAGING_INCDIR}/glib-2.0 -I${STAGING_LIBDIR}/glib-2.0/include/" 22 | 23 | LIBS = "-lglib-2.0" 24 | 25 | do_compile() { 26 | ${CC} $CFLAGS ${LDFLAGS} -o bluetooth_rfkill_event bluetooth_rfkill_event.c ${INC_DIRS} ${LIBS} 27 | } 28 | 29 | do_install() { 30 | install -v -d ${D}${sbindir} 31 | install -m 0755 bluetooth_rfkill_event ${D}${sbindir} 32 | 33 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then 34 | # Copy file service 35 | install -d ${D}/${systemd_unitdir}/system 36 | install -m 644 ${WORKDIR}/bluetooth-rfkill-event.service ${D}/${systemd_unitdir}/system 37 | fi 38 | 39 | install -v -d ${D}/etc/firmware/ 40 | install -m 0755 ${WORKDIR}/bcm43341.conf ${D}/etc/firmware/bcm43341.conf 41 | } 42 | -------------------------------------------------------------------------------- /recipes-extended/i2c-quark-board/files/i2c-quark-mpu6050.c: -------------------------------------------------------------------------------- 1 | /* 2 | * MinnowBoard-Max MPU-6050 I2C sensor test file 3 | * build command: KDIR=/kernel-source/ make 4 | * The kernel config should include CONFIG_INV_MPU6050_IIO=m 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define MPU6050_I2C_ADDR 0x68 13 | 14 | /* The MPU-6050 IRQ pin is connected to GPIO14=IO3 15 | */ 16 | #define MPU6050_I2C_IRQ 14 17 | 18 | static struct inv_mpu6050_platform_data mpu_data = { 19 | .orientation = {0, 1, 0, 1, 0, 0, 0, 0, -1}, 20 | }; 21 | 22 | static struct i2c_board_info mpu6050_accel_device = { 23 | I2C_BOARD_INFO("mpu6050", MPU6050_I2C_ADDR), 24 | .irq = -1, 25 | .platform_data = &mpu_data, 26 | }; 27 | 28 | static struct i2c_client *i2c_client; 29 | static int __init mpu6050_init(void) 30 | { 31 | int i = 0; 32 | struct i2c_adapter *adap = NULL; 33 | 34 | for (i = 0; i < 10; i++) { 35 | adap = i2c_get_adapter(i); 36 | if (!adap) 37 | return -1; 38 | 39 | if (!strcmp(adap->name, "Synopsys DesignWare I2C adapter")) 40 | break; 41 | } 42 | 43 | mpu6050_accel_device.irq = gpio_to_irq(MPU6050_I2C_IRQ); 44 | i2c_client = i2c_new_device(adap, &mpu6050_accel_device); 45 | return 0; 46 | } 47 | 48 | static void __exit mpu6050_exit(void) 49 | { 50 | i2c_unregister_device(i2c_client); 51 | } 52 | MODULE_LICENSE("GPL"); 53 | module_init(mpu6050_init); 54 | module_exit(mpu6050_exit); 55 | -------------------------------------------------------------------------------- /recipes-extended/i2c-minnowmax-board/files/i2c-minnow-mpu6050.c: -------------------------------------------------------------------------------- 1 | /* 2 | * MinnowBoard-Max MPU-6050 I2C sensor test file 3 | * build command: KDIR=/kernel-source/ make 4 | * The kernel config should include CONFIG_INV_MPU6050_IIO=m 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define MPU6050_I2C_ADDR 0x68 13 | 14 | /* The MPU-6050 IRQ pin is connected to pin25(GPIO_S5_2) of LSE connector, 15 | * On Linux >=3.18, it is GPIO 340 16 | * For more information, visit the below 17 | * http://www.elinux.org/Minnowboard:MinnowMax#Low_Speed_Expansion_.28Top.29 18 | */ 19 | #define MPU6050_I2C_IRQ 340 20 | 21 | static struct inv_mpu6050_platform_data mpu_data = { 22 | .orientation = {0, 1, 0, 1, 0, 0, 0, 0, -1}, 23 | }; 24 | 25 | static struct i2c_board_info mpu6050_accel_device = { 26 | I2C_BOARD_INFO("mpu6050", MPU6050_I2C_ADDR), 27 | .irq = -1, 28 | .platform_data = &mpu_data, 29 | }; 30 | 31 | static struct i2c_client *i2c_client; 32 | static int __init mpu6050_init(void) 33 | { 34 | int i = 0; 35 | struct i2c_adapter *adap = NULL; 36 | 37 | for (i = 0; i < 10; i++) { 38 | adap = i2c_get_adapter(i); 39 | if (!adap) 40 | return -1; 41 | 42 | if (!strcmp(adap->name, "Synopsys DesignWare I2C adapter")) 43 | break; 44 | } 45 | 46 | mpu6050_accel_device.irq = gpio_to_irq(MPU6050_I2C_IRQ); 47 | 48 | i2c_client = i2c_new_device(adap, &mpu6050_accel_device); 49 | return 0; 50 | } 51 | 52 | static void __exit mpu6050_exit(void) 53 | { 54 | i2c_unregister_device(i2c_client); 55 | } 56 | MODULE_LICENSE("GPL"); 57 | module_init(mpu6050_init); 58 | module_exit(mpu6050_exit); 59 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/0001-v3.15.0-ARM-dts-am335x-boneblack-configure-i2c1-and-2.patch: -------------------------------------------------------------------------------- 1 | From 79d1797bc5da50c4b6e0c53cd8492715a2d53c99 Mon Sep 17 00:00:00 2001 2 | From: Nishanth Menon 3 | Date: Thu, 12 Jun 2014 16:48:47 -0500 4 | Subject: [PATCH] ARM: dts: am335x-boneblack: configure i2c1 and 2 5 | 6 | Configure i2c1 and 2 at 400KHz. 7 | 8 | Signed-off-by: Nishanth Menon 9 | --- 10 | arch/arm/boot/dts/am335x-boneblack.dts | 30 ++++++++++++++++++++++++++++++ 11 | 1 file changed, 30 insertions(+) 12 | 13 | diff --git a/arch/arm/boot/dts/am335x-boneblack.dts b/arch/arm/boot/dts/am335x-boneblack.dts 14 | index 6b71ad9..f02c6a9 100644 15 | --- a/arch/arm/boot/dts/am335x-boneblack.dts 16 | +++ b/arch/arm/boot/dts/am335x-boneblack.dts 17 | @@ -60,12 +60,42 @@ 18 | 0x1b0 0x03 /* xdma_event_intr0, OMAP_MUX_MODE3 | AM33XX_PIN_OUTPUT */ 19 | >; 20 | }; 21 | + 22 | + i2c1_pins: pinmux_i2c1_pins { 23 | + pinctrl-single,pins = < 24 | + 0x158 (PIN_INPUT_PULLUP | MUX_MODE2) /* spi0_d1.i2c1_sda */ 25 | + 0x15c (PIN_INPUT_PULLUP | MUX_MODE2) /* spi0_cs0.i2c1_scl */ 26 | + >; 27 | + }; 28 | + 29 | + i2c2_pins: pinmux_i2c2_pins { 30 | + pinctrl-single,pins = < 31 | + 0x178 (PIN_INPUT_PULLUP | MUX_MODE3) /* uart1_ctsn.i2c2_sda */ 32 | + 0x17c (PIN_INPUT_PULLUP | MUX_MODE3) /* uart1_rtsn.i2c2_scl */ 33 | + >; 34 | + }; 35 | }; 36 | 37 | &lcdc { 38 | status = "okay"; 39 | }; 40 | 41 | +&i2c1 { 42 | + pinctrl-names = "default"; 43 | + pinctrl-0 = <&i2c1_pins>; 44 | + 45 | + status = "okay"; 46 | + clock-frequency = <400000>; 47 | +}; 48 | + 49 | +&i2c2 { 50 | + pinctrl-names = "default"; 51 | + pinctrl-0 = <&i2c2_pins>; 52 | + 53 | + status = "okay"; 54 | + clock-frequency = <400000>; 55 | +}; 56 | + 57 | / { 58 | hdmi { 59 | compatible = "ti,tilcdc,slave"; 60 | -- 61 | 1.7.9.5 62 | 63 | -------------------------------------------------------------------------------- /recipes-extended/spi-minnowmax-board/spi-minnowmax-board.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "6lowpan over 802.15.4 for 802.15.4 chip on Minnow-Max" 2 | 3 | LICENSE = "GPLv2" 4 | LIC_FILES_CHKSUM = "file://${THISDIR}/files/COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e" 5 | PR = "r0" 6 | 7 | # The module is compatible with intel-corei7-64/Minnowboard only 8 | COMPATIBLE_MACHINE="intel-corei7-64" 9 | 10 | inherit module 11 | 12 | FILESEXTRAPATHS_prepend := "${THISDIR}/files/:" 13 | 14 | RRECOMMENDS_${PN} = "ostro-6lowpan" 15 | 16 | SRC_URI = "file://spi-minnow-cc2520.c \ 17 | file://spi-minnow-at86rf230.c \ 18 | file://spi-minnow-board.c \ 19 | file://spi-minnow-board.h \ 20 | file://Makefile \ 21 | file://modules-load.d/cc2520.conf.sample \ 22 | file://modprobe.d/spi-minnow-cc2520.conf.sample \ 23 | file://modules-load.d/at86rf230.conf.sample \ 24 | file://modprobe.d/spi-minnow-at86rf230.conf.sample \ 25 | " 26 | 27 | FILES_${PN} += " /usr/lib/modules-load.d/cc2520.conf.sample \ 28 | /usr/lib/modules-load.d/at86rf230.conf.sample \ 29 | /lib/modprobe.d/spi-minnow-cc2520.conf.sample \ 30 | /lib/modprobe.d/spi-minnow-at86rf230.conf.sample \ 31 | " 32 | 33 | # Sample configuring file 34 | do_install_append () { 35 | install -d -m 755 ${D}${base_libdir}/modprobe.d 36 | install -d -m 755 ${D}${libdir}/modules-load.d 37 | install -m 0644 modules-load.d/cc2520.conf.sample ${D}${libdir}/modules-load.d/ 38 | install -m 0644 modprobe.d/spi-minnow-cc2520.conf.sample ${D}${base_libdir}/modprobe.d/ 39 | install -m 0644 modules-load.d/at86rf230.conf.sample ${D}${libdir}/modules-load.d/ 40 | install -m 0644 modprobe.d/spi-minnow-at86rf230.conf.sample ${D}${base_libdir}/modprobe.d/ 41 | } 42 | 43 | S = "${WORKDIR}" 44 | -------------------------------------------------------------------------------- /recipes-extended/i2c-edison-board/files/i2c-edison-mpu6050.c: -------------------------------------------------------------------------------- 1 | /* 2 | * MinnowBoard-Max MPU-6050 I2C sensor test file 3 | * build command: KDIR=/kernel-source/ make 4 | * The kernel config should include CONFIG_INV_MPU6050_IIO=m 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define MPU6050_I2C_ADDR 0x68 13 | 14 | /* The MPU-6050 IRQ pin is connected to GPIO12=IO3 15 | */ 16 | #define MPU6050_I2C_IRQ 12 17 | 18 | static struct inv_mpu6050_platform_data mpu_data = { 19 | .orientation = {0, 1, 0, 1, 0, 0, 0, 0, -1}, 20 | }; 21 | 22 | static struct i2c_board_info mpu6050_accel_device = { 23 | I2C_BOARD_INFO("mpu6050", MPU6050_I2C_ADDR), 24 | .irq = -1, 25 | .platform_data = &mpu_data, 26 | }; 27 | 28 | static struct i2c_client *i2c_client; 29 | static int __init mpu6050_init(void) 30 | { 31 | int ret; 32 | int i = 0; 33 | struct i2c_adapter *adap = NULL; 34 | 35 | for (i = 1; i < 8; i++) { 36 | adap = i2c_get_adapter(i); 37 | if (!adap) 38 | return -1; 39 | 40 | if (!strcmp(adap->name, "i2c-designware-6")) 41 | break; 42 | } 43 | 44 | if (!gpio_is_valid(MPU6050_I2C_IRQ)) { 45 | printk(KERN_WARNING "GPIO#%d is not valid\n", MPU6050_I2C_IRQ); 46 | return -EINVAL; 47 | } 48 | 49 | ret = gpio_request_one(MPU6050_I2C_IRQ, GPIOF_IN, "mpu6050-irq"); 50 | if (ret) { 51 | printk(KERN_WARNING "failed to request GPIO#%d\n", MPU6050_I2C_IRQ); 52 | return ret; 53 | } 54 | 55 | mpu6050_accel_device.irq = gpio_to_irq(MPU6050_I2C_IRQ); 56 | i2c_client = i2c_new_device(adap, &mpu6050_accel_device); 57 | return 0; 58 | } 59 | 60 | static void __exit mpu6050_exit(void) 61 | { 62 | i2c_unregister_device(i2c_client); 63 | gpio_free(MPU6050_I2C_IRQ); 64 | } 65 | MODULE_LICENSE("GPL"); 66 | module_init(mpu6050_init); 67 | module_exit(mpu6050_exit); 68 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-core/initrdscripts/files/init-boot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | PATH=/sbin:/bin:/usr/sbin:/usr/bin 4 | 5 | # create required directories 6 | mkdir -p /proc 7 | mkdir -p /sys 8 | mkdir -p /run 9 | mkdir -p /update 10 | mkdir -p /var/lock 11 | mkdir -p /var/log 12 | mkdir -p /var/run 13 | 14 | # set up /proc /sys and /dev 15 | mount -t proc proc /proc 16 | mount -t sysfs sysfs /sys 17 | mount -t devtmpfs none /dev 18 | 19 | # set up logging 20 | syslogd 21 | 22 | # launch udev 23 | udevd --daemon 24 | udevadm trigger --action=add 25 | 26 | # start watchdog daemon to avoid reboot while recovering 27 | watchdog 28 | 29 | # mount update partition and do recovery 30 | if losetup -o 1048576 /dev/loop0 /dev/mmcblk0p9; then 31 | mount -t vfat /dev/loop0 /update 32 | if [ -d /update/recovery ] && \ 33 | [ -e /update/recovery/u-boot.bin ] && \ 34 | [ -e /update/recovery/u-boot.env ] && \ 35 | [ -e /update/recovery/boot.hddimg ] && \ 36 | [ -e /update/recovery/rootfs.tar.bz2 ] && \ 37 | [ -e /update/recovery/image-name.txt ]; then 38 | echo -n " Recovering installation of " 39 | cat /update/recovery/image-name.txt 40 | echo "Writing u-boot binary ..." 41 | dd if=/update/recovery/u-boot.bin of=/dev/mmcblk0p1 42 | echo "Writing u-boot environment ..." 43 | dd if=/update/recovery/u-boot.env of=/dev/mmcblk0p2 44 | echo "Writing u-boot backup environment ..." 45 | dd if=/update/recovery/u-boot.env of=/dev/mmcblk0p4 46 | echo "Writing boot partition ..." 47 | dd if=/update/recovery/boot.hddimg of=/dev/mmcblk0p7 48 | echo "Preparing rootfs ..." 49 | mkfs.ext4 -i 4096 /dev/mmcblk0p8 50 | echo "Writing rootfs ..." 51 | mkdir /rootfs 52 | mount -t ext4 /dev/mmcblk0p8 /rootfs 53 | tar xf /update/recovery/rootfs.tar.bz2 -C /rootfs 54 | sync 55 | losetup -d /dev/loop0 56 | reboot -f 57 | fi 58 | fi 59 | echo "Missing recovery files, launching debug shell" 60 | exec sh 61 | -------------------------------------------------------------------------------- /recipes-extended/spi-minnowmax-board/files/spi-minnow-board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * MinnowBoard Max cc2520 spi board file 3 | * Copyright (c) 2015, Intel Corporation. 4 | * All rights reserved. 5 | * 6 | * This program is free software; you can redistribute it and/or modify it 7 | * under the terms and conditions of the GNU General Public License, 8 | * version 2, as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | */ 15 | 16 | #define pr_fmt(fmt) "MinnowBoard Max: " fmt 17 | 18 | #include "spi-minnow-board.h" 19 | 20 | static struct spi_device *dev; 21 | static struct spi_board_info spi_info; 22 | static unsigned int spi_irq; 23 | static u16 spi_master; 24 | 25 | EXPORT_SYMBOL(spi_info); 26 | 27 | static int __init minnow_module_init(void) 28 | { 29 | struct spi_master *master; 30 | int err; 31 | 32 | pr_info("module init\n"); 33 | 34 | set_spi_minnow_board_value(&spi_info, &spi_irq, &spi_master); 35 | 36 | err = -ENODEV; 37 | master = spi_busnum_to_master(spi_master); 38 | pr_info("master=%p\n", master); 39 | if (!master) 40 | goto out; 41 | 42 | dev = spi_new_device(master, &spi_info); 43 | pr_info("dev=%p\n", dev); 44 | if (!dev) 45 | goto out; 46 | 47 | if (spi_irq) 48 | dev->irq = gpio_to_irq(spi_irq); 49 | 50 | pr_info("802.15.4 chip registered\n"); 51 | err = 0; 52 | 53 | out: 54 | if (err) 55 | pr_err("Failed to register SPI device\n"); 56 | return err; 57 | } 58 | 59 | static void __exit minnow_module_exit(void) 60 | { 61 | pr_info("module exit"); 62 | if (dev) 63 | spi_unregister_device(dev); 64 | } 65 | 66 | module_init(minnow_module_init); 67 | module_exit(minnow_module_exit); 68 | 69 | MODULE_LICENSE("GPL"); 70 | -------------------------------------------------------------------------------- /recipes-extended/spi-quark-board/files/spi-quark-board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Galileo atmel212b spi board file 3 | * Copyright (c) 2015, Intel Corporation. 4 | * All rights reserved. 5 | * 6 | * This program is free software; you can redistribute it and/or modify it 7 | * under the terms and conditions of the GNU General Public License, 8 | * version 2, as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | */ 15 | 16 | #define pr_fmt(fmt) "Galileo: " fmt 17 | 18 | #include "spi-quark-board.h" 19 | 20 | static struct spi_device *dev; 21 | static struct spi_board_info spi_info; 22 | static unsigned int spi_irq; 23 | static u16 spi_master; 24 | 25 | static int __init galileo_module_init(void) 26 | { 27 | struct spi_master *master; 28 | int err; 29 | 30 | pr_info("module init\n"); 31 | 32 | set_spi_quark_board_value(&spi_info, &spi_irq, &spi_master); 33 | 34 | err = -ENODEV; 35 | master = spi_busnum_to_master(spi_master); 36 | pr_info("master=%p\n", master); 37 | if (!master) 38 | goto out; 39 | 40 | dev = spi_new_device(master, &spi_info); 41 | pr_info("dev=%p\n", dev); 42 | if (!dev) 43 | goto out; 44 | 45 | if (spi_irq) { 46 | dev->irq = gpio_to_irq(spi_irq); 47 | irq_set_irq_type(dev->irq, IRQF_TRIGGER_RISING); 48 | } 49 | 50 | pr_info("802.15.4 chip registered\n"); 51 | err = 0; 52 | 53 | out: 54 | if (err) 55 | pr_err("Failed to register SPI device\n"); 56 | return err; 57 | } 58 | 59 | static void __exit galileo_module_exit(void) 60 | { 61 | pr_info("module exit"); 62 | if (dev) 63 | spi_unregister_device(dev); 64 | } 65 | 66 | module_init(galileo_module_init); 67 | module_exit(galileo_module_exit); 68 | 69 | MODULE_LICENSE("GPL"); 70 | -------------------------------------------------------------------------------- /recipes-extended/spi-minnowmax-board/files/spi-minnow-cc2520.c: -------------------------------------------------------------------------------- 1 | /* 2 | * MinnowBoard Max cc2520 spi board file 3 | * Copyright (c) 2015, Intel Corporation. 4 | * All rights reserved. 5 | * 6 | * This program is free software; you can redistribute it and/or modify it 7 | * under the terms and conditions of the GNU General Public License, 8 | * version 2, as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | */ 15 | 16 | #define pr_fmt(fmt) "MinnowBoard Max: " fmt 17 | 18 | #include "spi-minnow-board.h" 19 | #include 20 | 21 | #define CC2520_SPI_MASTER 0 22 | 23 | #define CC2520_SPI_CS 0 24 | #define CC2520_MAX_CLK_HZ 8000000 25 | 26 | static struct cc2520_platform_data cc2520_data = { 27 | .fifo = 338, 28 | .fifop = 339, 29 | .cca = 340, 30 | .sfd = 504, 31 | .reset = 505, 32 | .vreg = 464, 33 | }; 34 | 35 | void set_spi_minnow_board_value(struct spi_board_info *spi_minnow_board_info, 36 | unsigned int *spi_board_irq, u16 *spi_board_master) 37 | { 38 | strcpy(spi_minnow_board_info->modalias, "cc2520"); 39 | spi_minnow_board_info->max_speed_hz = CC2520_MAX_CLK_HZ; 40 | spi_minnow_board_info->bus_num = CC2520_SPI_MASTER; 41 | spi_minnow_board_info->chip_select = CC2520_SPI_CS; 42 | spi_minnow_board_info->platform_data = &cc2520_data; 43 | 44 | *spi_board_irq = 0; 45 | *spi_board_master = CC2520_SPI_MASTER; 46 | } 47 | EXPORT_SYMBOL(set_spi_minnow_board_value); 48 | 49 | static int __init cc2520_module_init(void) 50 | { 51 | pr_info("module init\n"); 52 | return 0; 53 | } 54 | 55 | static void __exit cc2520_module_exit(void) 56 | { 57 | pr_info("module exit\n"); 58 | } 59 | 60 | module_init(cc2520_module_init); 61 | module_exit(cc2520_module_exit); 62 | 63 | MODULE_LICENSE("GPL"); 64 | -------------------------------------------------------------------------------- /recipes-extended/spi-minnowmax-board/files/spi-minnow-at86rf230.c: -------------------------------------------------------------------------------- 1 | /* 2 | * MinnowBoard Max cc2520 spi board file 3 | * Copyright (c) 2015, Intel Corporation. 4 | * All rights reserved. 5 | * 6 | * This program is free software; you can redistribute it and/or modify it 7 | * under the terms and conditions of the GNU General Public License, 8 | * version 2, as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | */ 15 | 16 | #define pr_fmt(fmt) "MinnowBoard Max: " fmt 17 | 18 | #include "spi-minnow-board.h" 19 | 20 | #include 21 | 22 | #define AT86RF_SPI_MASTER 0 23 | 24 | #define AT86RF_SPI_CS 0 25 | #define AT86RF_MAX_CLK_HZ 5000000 26 | #define AT86RF_IRQ 504 27 | 28 | static struct at86rf230_platform_data at86rf230_data = { 29 | .rstn = 338, 30 | .slp_tr = 339, 31 | .xtal_trim = 0x2, 32 | .dig2 = 0, 33 | }; 34 | 35 | void set_spi_minnow_board_value(struct spi_board_info *spi_minnow_board_info, 36 | unsigned int *spi_board_irq, u16 *spi_board_master) 37 | { 38 | strcpy(spi_minnow_board_info->modalias, "at86rf230"); 39 | spi_minnow_board_info->max_speed_hz = AT86RF_MAX_CLK_HZ; 40 | spi_minnow_board_info->bus_num = AT86RF_SPI_MASTER; 41 | spi_minnow_board_info->chip_select = AT86RF_SPI_CS; 42 | spi_minnow_board_info->platform_data = &at86rf230_data; 43 | *spi_board_irq = AT86RF_IRQ; 44 | *spi_board_master = AT86RF_SPI_MASTER; 45 | } 46 | EXPORT_SYMBOL(set_spi_minnow_board_value); 47 | 48 | static int __init at86rf230_module_init(void) 49 | { 50 | pr_info("module init\n"); 51 | return 0; 52 | } 53 | 54 | static void __exit at86rf230_module_exit(void) 55 | { 56 | pr_info("module exit\n"); 57 | } 58 | 59 | module_init(at86rf230_module_init); 60 | module_exit(at86rf230_module_exit); 61 | 62 | MODULE_LICENSE("GPL"); 63 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/0001-USB-usbip-fix-potential-out-of-bounds-write.patch: -------------------------------------------------------------------------------- 1 | From b348d7dddb6c4fbfc810b7a0626e8ec9e29f7cbb Mon Sep 17 00:00:00 2001 2 | From: Ignat Korchagin 3 | Date: Thu, 17 Mar 2016 18:00:29 +0000 4 | Subject: [PATCH] USB: usbip: fix potential out-of-bounds write 5 | 6 | Fix potential out-of-bounds write to urb->transfer_buffer 7 | usbip handles network communication directly in the kernel. When receiving a 8 | packet from its peer, usbip code parses headers according to protocol. As 9 | part of this parsing urb->actual_length is filled. Since the input for 10 | urb->actual_length comes from the network, it should be treated as untrusted. 11 | Any entity controlling the network may put any value in the input and the 12 | preallocated urb->transfer_buffer may not be large enough to hold the data. 13 | Thus, the malicious entity is able to write arbitrary data to kernel memory. 14 | 15 | Signed-off-by: Ignat Korchagin 16 | Signed-off-by: Greg Kroah-Hartman 17 | --- 18 | drivers/usb/usbip/usbip_common.c | 11 +++++++++++ 19 | 1 file changed, 11 insertions(+) 20 | 21 | diff --git a/drivers/usb/usbip/usbip_common.c b/drivers/usb/usbip/usbip_common.c 22 | index facaaf0..e40da77 100644 23 | --- a/drivers/usb/usbip/usbip_common.c 24 | +++ b/drivers/usb/usbip/usbip_common.c 25 | @@ -741,6 +741,17 @@ int usbip_recv_xbuff(struct usbip_device *ud, struct urb *urb) 26 | if (!(size > 0)) 27 | return 0; 28 | 29 | + if (size > urb->transfer_buffer_length) { 30 | + /* should not happen, probably malicious packet */ 31 | + if (ud->side == USBIP_STUB) { 32 | + usbip_event_add(ud, SDEV_EVENT_ERROR_TCP); 33 | + return 0; 34 | + } else { 35 | + usbip_event_add(ud, VDEV_EVENT_ERROR_TCP); 36 | + return -EPIPE; 37 | + } 38 | + } 39 | + 40 | ret = usbip_recv(ud->tcp_socket, urb->transfer_buffer, size); 41 | if (ret != size) { 42 | dev_err(&urb->dev->dev, "recv xbuf, %d\n", ret); 43 | -- 44 | 1.9.1 45 | 46 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/sensors.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_STAGING=y 2 | CONFIG_BMP085=y 3 | CONFIG_BMP085_I2C=m 4 | CONFIG_SENSORS_HMC5843=m 5 | CONFIG_SENSORS_HMC5843_I2C=m 6 | CONFIG_SENSORS_LM75=m 7 | CONFIG_INPUT_POLLDEV=m 8 | CONFIG_INPUT_MISC=y 9 | CONFIG_INPUT_BMA150=m 10 | CONFIG_INPUT_MPU3050=m 11 | CONFIG_INPUT_ADXL34X=m 12 | CONFIG_INPUT_ADXL34X_I2C=m 13 | CONFIG_INPUT_ADXL34X_SPI=m 14 | CONFIG_SENSORS_ISL29018=m 15 | CONFIG_SENSORS_ISL29028=m 16 | CONFIG_TSL2583=m 17 | CONFIG_TSL2x7x=m 18 | CONFIG_SENSORS_HMC5843_SPI=m 19 | CONFIG_BMC150_ACCEL=m 20 | CONFIG_MMA8452=m 21 | CONFIG_MMA9551_CORE=m 22 | CONFIG_MMA9551=m 23 | CONFIG_MMA9553=m 24 | CONFIG_BMG160=m 25 | CONFIG_SI7005=m 26 | CONFIG_SI7020=m 27 | CONFIG_ISL29125=m 28 | CONFIG_LTR501=m 29 | CONFIG_TCS3414=m 30 | CONFIG_BMP280=m 31 | CONFIG_MPL115=m 32 | CONFIG_MS5611=m 33 | CONFIG_MS5611_I2C=m 34 | CONFIG_MS5611_SPI=m 35 | CONFIG_T5403=m 36 | CONFIG_MLX90614=m 37 | # CONFIG_INPUT_BMA150 is not set 38 | CONFIG_LIS3L02DQ=m 39 | CONFIG_KXSD9=m 40 | CONFIG_IIO_ST_ACCEL_3AXIS=m 41 | CONFIG_IIO_ST_ACCEL_I2C_3AXIS=m 42 | CONFIG_IIO_ST_ACCEL_SPI_3AXIS=m 43 | CONFIG_AD_SIGMA_DELTA=m 44 | CONFIG_AD7266=m 45 | CONFIG_AD7298=m 46 | CONFIG_AD7923=m 47 | CONFIG_AD7791=m 48 | CONFIG_AD7793=m 49 | CONFIG_AD7476=m 50 | CONFIG_AD7887=m 51 | CONFIG_MAX1363=m 52 | CONFIG_TI_ADC081C=m 53 | CONFIG_IIO_ST_SENSORS_I2C=m 54 | CONFIG_IIO_ST_SENSORS_SPI=m 55 | CONFIG_IIO_ST_SENSORS_CORE=m 56 | CONFIG_MCP4725=m 57 | CONFIG_ADIS16136=m 58 | CONFIG_IIO_ST_GYRO_3AXIS=m 59 | CONFIG_IIO_ST_GYRO_I2C_3AXIS=m 60 | CONFIG_IIO_ST_GYRO_SPI_3AXIS=m 61 | CONFIG_ITG3200=m 62 | CONFIG_ADIS16400=m 63 | CONFIG_ADIS16480=m 64 | CONFIG_IIO_ADIS_LIB=m 65 | CONFIG_IIO_ADIS_LIB_BUFFER=y 66 | CONFIG_INV_MPU6050_IIO=m 67 | CONFIG_ADJD_S311=m 68 | CONFIG_SENSORS_TSL2563=m 69 | CONFIG_VCNL4000=m 70 | CONFIG_AK8975=m 71 | CONFIG_IIO_ST_MAGN_3AXIS=m 72 | CONFIG_IIO_ST_MAGN_I2C_3AXIS=m 73 | CONFIG_IIO_ST_MAGN_SPI_3AXIS=m 74 | CONFIG_BH1750=m 75 | CONFIG_MMA7455=m 76 | CONFIG_MMA7455_I2C=m 77 | CONFIG_APDS9960=m 78 | 79 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-kernel/mcu-fw/files/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Intel Corporation. 2 | All rights reserved. 3 | 4 | Redistribution. Redistribution and use in binary form, without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions must reproduce the above copyright notice and the 9 | following disclaimer in the documentation and/or other materials 10 | provided with the distribution. 11 | * Neither the name of Intel Corporation nor the names of its suppliers 12 | may be used to endorse or promote products derived from this software 13 | without specific prior written permission. 14 | * No reverse engineering, decompilation, or disassembly of this software 15 | is permitted. 16 | 17 | Limited patent license. Intel Corporation grants a world-wide, 18 | royalty-free, non-exclusive license under patents it now or hereafter 19 | owns or controls to make, have made, use, import, offer to sell and 20 | sell (“Utilize”) this software, but solely to the extent that any 21 | such patent is necessary to Utilize the software alone. The patent license 22 | shall not apply to any combinations which include this software. No hardware 23 | per se is licensed hereunder. 24 | 25 | DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 26 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 27 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 28 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 29 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 30 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 31 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 32 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 34 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 35 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 36 | DAMAGE. 37 | 38 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/KEYS_Fix_keyring_ref_leak_in-join_session_keyring.patch: -------------------------------------------------------------------------------- 1 | From: Yevgeny Pats 2 | 3 | This fixes CVE-2016-0728. 4 | 5 | If a thread is asked to join as a session keyring the keyring that's already 6 | set as its session, we leak a keyring reference. 7 | 8 | This can be tested with the following program: 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | int main(int argc, const char *argv[]) 16 | { 17 | int i = 0; 18 | key_serial_t serial; 19 | 20 | serial = keyctl(KEYCTL_JOIN_SESSION_KEYRING, 21 | "leaked-keyring"); 22 | if (serial < 0) { 23 | perror("keyctl"); 24 | return -1; 25 | } 26 | 27 | if (keyctl(KEYCTL_SETPERM, serial, 28 | KEY_POS_ALL | KEY_USR_ALL) < 0) { 29 | perror("keyctl"); 30 | return -1; 31 | } 32 | 33 | for (i = 0; i < 100; i++) { 34 | serial = keyctl(KEYCTL_JOIN_SESSION_KEYRING, 35 | "leaked-keyring"); 36 | if (serial < 0) { 37 | perror("keyctl"); 38 | return -1; 39 | } 40 | } 41 | 42 | return 0; 43 | } 44 | 45 | If, after the program has run, there something like the following line in 46 | /proc/keys: 47 | 48 | 3f3d898f I--Q--- 100 perm 3f3f0000 0 0 keyring leaked-keyring: empty 49 | 50 | with a usage count of 100 * the number of times the program has been run, 51 | then the kernel is malfunctioning. If leaked-keyring has zero usages or 52 | has been garbage collected, then the problem is fixed. 53 | 54 | Reported-by: Yevgeny Pats 55 | Signed-off-by: David Howells 56 | Acked-by: Don Zickus 57 | Acked-by: Prarit Bhargava 58 | Acked-by: Jarod Wilson 59 | --- 60 | 61 | security/keys/process_keys.c | 1 + 62 | 1 file changed, 1 insertion(+) 63 | 64 | diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c 65 | index a3f85d2a00bb..e6d50172872f 100644 66 | --- a/security/keys/process_keys.c 67 | +++ b/security/keys/process_keys.c 68 | @@ -794,6 +794,7 @@ long join_session_keyring(const char *name) 69 | ret = PTR_ERR(keyring); 70 | goto error2; 71 | } else if (keyring == new->session_keyring) { 72 | + key_put(keyring); 73 | ret = 0; 74 | goto error2; 75 | } 76 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-kernel/linux/files/0002-Always-inline-inline-functions.patch: -------------------------------------------------------------------------------- 1 | From a98c2b09dbebc08c330ba1280466adde4e239b8c Mon Sep 17 00:00:00 2001 2 | From: Jussi Laako 3 | Date: Mon, 14 Sep 2015 15:52:35 +0300 4 | Subject: [PATCH 2/2] Always inline inline functions 5 | 6 | Signed-off-by: Jussi Laako 7 | --- 8 | lib/mpi/mpi-inline.h | 4 +--- 9 | lib/mpi/mpi-internal.h | 22 ++++++++++++---------- 10 | 2 files changed, 13 insertions(+), 13 deletions(-) 11 | 12 | diff --git a/lib/mpi/mpi-inline.h b/lib/mpi/mpi-inline.h 13 | index e2b3985..043c3c6 100644 14 | --- a/lib/mpi/mpi-inline.h 15 | +++ b/lib/mpi/mpi-inline.h 16 | @@ -29,9 +29,7 @@ 17 | #ifndef G10_MPI_INLINE_H 18 | #define G10_MPI_INLINE_H 19 | 20 | -#ifndef G10_MPI_INLINE_DECL 21 | -#define G10_MPI_INLINE_DECL extern inline 22 | -#endif 23 | +#define G10_MPI_INLINE_DECL __attribute__((always_inline)) static inline 24 | 25 | G10_MPI_INLINE_DECL mpi_limb_t 26 | mpihelp_add_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, 27 | diff --git a/lib/mpi/mpi-internal.h b/lib/mpi/mpi-internal.h 28 | index 60cf765..bb9dec9 100644 29 | --- a/lib/mpi/mpi-internal.h 30 | +++ b/lib/mpi/mpi-internal.h 31 | @@ -168,20 +168,22 @@ void mpi_rshift_limbs(MPI a, unsigned int count); 32 | int mpi_lshift_limbs(MPI a, unsigned int count); 33 | 34 | /*-- mpihelp-add.c --*/ 35 | -mpi_limb_t mpihelp_add_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, 36 | - mpi_size_t s1_size, mpi_limb_t s2_limb); 37 | +static inline mpi_limb_t mpihelp_add_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, 38 | + mpi_size_t s1_size, mpi_limb_t s2_limb); 39 | mpi_limb_t mpihelp_add_n(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, 40 | - mpi_ptr_t s2_ptr, mpi_size_t size); 41 | -mpi_limb_t mpihelp_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, 42 | - mpi_ptr_t s2_ptr, mpi_size_t s2_size); 43 | + mpi_ptr_t s2_ptr, mpi_size_t size); 44 | +static inline mpi_limb_t mpihelp_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, 45 | + mpi_size_t s1_size, mpi_ptr_t s2_ptr, 46 | + mpi_size_t s2_size); 47 | 48 | /*-- mpihelp-sub.c --*/ 49 | -mpi_limb_t mpihelp_sub_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, 50 | - mpi_size_t s1_size, mpi_limb_t s2_limb); 51 | +static inline mpi_limb_t mpihelp_sub_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, 52 | + mpi_size_t s1_size, mpi_limb_t s2_limb); 53 | mpi_limb_t mpihelp_sub_n(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, 54 | - mpi_ptr_t s2_ptr, mpi_size_t size); 55 | -mpi_limb_t mpihelp_sub(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, 56 | - mpi_ptr_t s2_ptr, mpi_size_t s2_size); 57 | + mpi_ptr_t s2_ptr, mpi_size_t size); 58 | +static inline mpi_limb_t mpihelp_sub(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, 59 | + mpi_size_t s1_size, mpi_ptr_t s2_ptr, 60 | + mpi_size_t s2_size); 61 | 62 | /*-- mpihelp-cmp.c --*/ 63 | int mpihelp_cmp(mpi_ptr_t op1_ptr, mpi_ptr_t op2_ptr, mpi_size_t size); 64 | -- 65 | 2.5.1 66 | 67 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/u-boot/files/0002-Fix-weak-external-function-references-for-gcc5.patch: -------------------------------------------------------------------------------- 1 | From 5b940cd15970aed177ee943d449f6df839afd96e Mon Sep 17 00:00:00 2001 2 | From: Jussi Laako 3 | Date: Fri, 11 Sep 2015 16:42:50 +0300 4 | Subject: [PATCH 2/2] Fix weak external function references for gcc5 5 | 6 | Signed-off-by: Jussi Laako 7 | --- 8 | common/board_f.c | 28 +++++++++------------------- 9 | common/main.c | 3 +-- 10 | 2 files changed, 10 insertions(+), 21 deletions(-) 11 | 12 | diff --git a/common/board_f.c b/common/board_f.c 13 | index 52b715c..eb55cbe 100644 14 | --- a/common/board_f.c 15 | +++ b/common/board_f.c 16 | @@ -78,25 +78,15 @@ DECLARE_GLOBAL_DATA_PTR; 17 | ************************************************************************ 18 | * May be supplied by boards if desired 19 | */ 20 | -inline void __coloured_LED_init(void) {} 21 | -void coloured_LED_init(void) 22 | - __attribute__((weak, alias("__coloured_LED_init"))); 23 | -inline void __red_led_on(void) {} 24 | -void red_led_on(void) __attribute__((weak, alias("__red_led_on"))); 25 | -inline void __red_led_off(void) {} 26 | -void red_led_off(void) __attribute__((weak, alias("__red_led_off"))); 27 | -inline void __green_led_on(void) {} 28 | -void green_led_on(void) __attribute__((weak, alias("__green_led_on"))); 29 | -inline void __green_led_off(void) {} 30 | -void green_led_off(void) __attribute__((weak, alias("__green_led_off"))); 31 | -inline void __yellow_led_on(void) {} 32 | -void yellow_led_on(void) __attribute__((weak, alias("__yellow_led_on"))); 33 | -inline void __yellow_led_off(void) {} 34 | -void yellow_led_off(void) __attribute__((weak, alias("__yellow_led_off"))); 35 | -inline void __blue_led_on(void) {} 36 | -void blue_led_on(void) __attribute__((weak, alias("__blue_led_on"))); 37 | -inline void __blue_led_off(void) {} 38 | -void blue_led_off(void) __attribute__((weak, alias("__blue_led_off"))); 39 | +__weak void coloured_LED_init(void) {} 40 | +__weak void red_led_on(void) {} 41 | +__weak void red_led_off(void) {} 42 | +__weak void green_led_on(void) {} 43 | +__weak void green_led_off(void) {} 44 | +__weak void yellow_led_on(void) {} 45 | +__weak void yellow_led_off(void) {} 46 | +__weak void blue_led_on(void) {} 47 | +__weak void blue_led_off(void) {} 48 | 49 | /* 50 | * Why is gd allocated a register? Prior to reloc it might be better to 51 | diff --git a/common/main.c b/common/main.c 52 | index 8b6f274..24e9117 100644 53 | --- a/common/main.c 54 | +++ b/common/main.c 55 | @@ -27,8 +27,7 @@ DECLARE_GLOBAL_DATA_PTR; 56 | /* 57 | * Board-specific Platform code can reimplement show_boot_progress () if needed 58 | */ 59 | -void inline __show_boot_progress (int val) {} 60 | -void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress"))); 61 | +__weak void show_boot_progress (int val) {} 62 | 63 | #define MAX_DELAY_STOP_STR 32 64 | 65 | -- 66 | 2.5.1 67 | 68 | -------------------------------------------------------------------------------- /meta-edison-bsp/conf/machine/edison.conf: -------------------------------------------------------------------------------- 1 | #@TYPE: Machine 2 | #@NAME: edison 3 | #@DESCRIPTION: Machine configuration for edison systems 4 | 5 | DEFAULTTUNE ?= "edison" 6 | X86ARCH32 ?= "i686" 7 | 8 | require conf/machine/include/x86/arch-x86.inc 9 | 10 | TUNEVALID[edison] = "Enable Edison specific processor optimizations" 11 | TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'edison', ' -march=atom -msse3 -mfpmath=sse', '', d)}" 12 | 13 | AVAILTUNES += "edison" 14 | TUNE_FEATURES_tune-edison = "${TUNE_FEATURES_tune-x86} edison" 15 | BASE_LIB_tune-edison = "lib" 16 | TUNE_PKGARCH_tune-edison = "edison" 17 | # Edison is already in package archs 18 | #PACKAGE_EXTRA_ARCHS_tune-edison = "${PACKAGE_EXTRA_ARCHS_tune-x86} edison" 19 | 20 | 21 | MACHINE_FEATURES = "bluetooth alsa pci serial usbgadget usbhost wifi x86 ext3" 22 | 23 | IMAGE_CLASSES += "image_types_edison" 24 | IMAGE_FSTYPES = "tar.bz2 ext4 toflash" 25 | 26 | # we want rootfs size of 2097152 27 | # rootfs_rpm.bbclass adds 51200 28 | # so adjust to 2097152 - 51200 29 | IMAGE_ROOTFS_SIZE = "2045952" 30 | # Also, Ostro OS is not allowed to ask for additional space either. 31 | # TODO: this should be a variable from OE-core which gets 32 | # added by rootfs_rpm.bbclass, instead of doing the increase twice 33 | # and having to substract the 51200 value above. 34 | OSTRO_IMAGE_ROOTFS_EXTRA_SPACE = "" 35 | 36 | # Bootloader config 37 | 38 | PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot-edison" 39 | PREFERRED_VERSION_u-boot-edison ?= "2014.04-1" 40 | PREFERRED_VERSION_u-boot-fw-utils-edison ?= "2014.04-1" 41 | UBOOT_MACHINE = "edison_config" 42 | 43 | MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "u-boot-edison u-boot-fw-utils-edison kernel-modules sst-fw mcu-fw-bin mcu-fw-load" 44 | MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "bluetooth-rfkill-event" 45 | 46 | # Kernel config 47 | 48 | PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto-edison" 49 | PREFERRED_VERSION_linux-yocto-edison = "3.10%" 50 | KERNEL_IMAGETYPE = "bzImage" 51 | SERIAL_CONSOLES ?= "115200;ttyMFD2 115200;ttyGS0" 52 | 53 | MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "kernel-module-bcm-bt-lpm bcm43340-bt" 54 | KERNEL_MODULE_AUTOLOAD += "bcm_bt_lpm" 55 | 56 | MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "bcm43340-mod bcm43340-fw" 57 | KERNEL_MODULE_AUTOLOAD += "bcm4334x" 58 | KERNEL_MODULE_PROBECONF += "bcm4334x" 59 | module_conf_bcm4334x = "options bcm4334x firmware_path=/etc/firmware/fw_bcmdhd.bin nvram_path=/etc/firmware/bcmdhd.cal" 60 | 61 | MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "kernel-module-g-multi" 62 | KERNEL_MODULE_AUTOLOAD += "g_multi" 63 | KERNEL_MODULE_PROBECONF += "g_multi" 64 | # FIXME: file parameter should be based on partition UUID (from U-Boot) or fixed 65 | # with label (label seems to work, but driver is probed too early) 66 | module_conf_g_multi = "options g_multi file=/dev/mmcblk0p9 stall=0 idVendor=0x8087 idProduct=0x0A9E iProduct=Edison iManufacturer=Intel" 67 | 68 | XSERVER = "xserver-xorg \ 69 | xf86-input-keyboard \ 70 | xf86-input-evdev \ 71 | xf86-video-dummy" 72 | 73 | #INITRAMFS_IMAGE ?= "core-image-initramfs-edison" 74 | #INITRAMFS_IMAGE_BUNDLE ?= "1" 75 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/0002-capabilities-add-a-securebit-to-disable-PR_CAP_AMBIE.patch: -------------------------------------------------------------------------------- 1 | From ddde00e3d62b68773c62c36816d93e3e18c57300 Mon Sep 17 00:00:00 2001 2 | From: Andy Lutomirski 3 | Date: Fri, 4 Sep 2015 15:42:51 -0700 4 | Subject: [PATCH 2/2] capabilities: add a securebit to disable 5 | PR_CAP_AMBIENT_RAISE 6 | 7 | Per Andrew Morgan's request, add a securebit to allow admins to disable 8 | PR_CAP_AMBIENT_RAISE. This securebit will prevent processes from adding 9 | capabilities to their ambient set. 10 | 11 | For simplicity, this disables PR_CAP_AMBIENT_RAISE entirely rather than 12 | just disabling setting previously cleared bits. 13 | 14 | Upstream-status: Backport [4.3] 15 | 16 | Signed-off-by: Andy Lutomirski 17 | Acked-by: Andrew G. Morgan 18 | Acked-by: Serge Hallyn 19 | Cc: Kees Cook 20 | Cc: Christoph Lameter 21 | Cc: Serge Hallyn 22 | Cc: Jonathan Corbet 23 | Cc: Aaron Jones 24 | Cc: Ted Ts'o 25 | Cc: Andrew G. Morgan 26 | Cc: Mimi Zohar 27 | Cc: Austin S Hemmelgarn 28 | Cc: Markku Savela 29 | Cc: Jarkko Sakkinen 30 | Cc: Michael Kerrisk 31 | Cc: James Morris 32 | Signed-off-by: Andrew Morton 33 | Signed-off-by: Linus Torvalds 34 | --- 35 | include/uapi/linux/securebits.h | 11 ++++++++++- 36 | security/commoncap.c | 3 ++- 37 | 2 files changed, 12 insertions(+), 2 deletions(-) 38 | 39 | diff --git a/include/uapi/linux/securebits.h b/include/uapi/linux/securebits.h 40 | index 985aac9..35ac35c 100644 41 | --- a/include/uapi/linux/securebits.h 42 | +++ b/include/uapi/linux/securebits.h 43 | @@ -43,9 +43,18 @@ 44 | #define SECBIT_KEEP_CAPS (issecure_mask(SECURE_KEEP_CAPS)) 45 | #define SECBIT_KEEP_CAPS_LOCKED (issecure_mask(SECURE_KEEP_CAPS_LOCKED)) 46 | 47 | +/* When set, a process cannot add new capabilities to its ambient set. */ 48 | +#define SECURE_NO_CAP_AMBIENT_RAISE 6 49 | +#define SECURE_NO_CAP_AMBIENT_RAISE_LOCKED 7 /* make bit-6 immutable */ 50 | + 51 | +#define SECBIT_NO_CAP_AMBIENT_RAISE (issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE)) 52 | +#define SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED \ 53 | + (issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE_LOCKED)) 54 | + 55 | #define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \ 56 | issecure_mask(SECURE_NO_SETUID_FIXUP) | \ 57 | - issecure_mask(SECURE_KEEP_CAPS)) 58 | + issecure_mask(SECURE_KEEP_CAPS) | \ 59 | + issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE)) 60 | #define SECURE_ALL_LOCKS (SECURE_ALL_BITS << 1) 61 | 62 | #endif /* _UAPI_LINUX_SECUREBITS_H */ 63 | diff --git a/security/commoncap.c b/security/commoncap.c 64 | index 79b90f7..f2a3f1d 100644 65 | --- a/security/commoncap.c 66 | +++ b/security/commoncap.c 67 | @@ -998,7 +998,8 @@ int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, 68 | if (arg2 == PR_CAP_AMBIENT_RAISE && 69 | (!cap_raised(current_cred()->cap_permitted, arg3) || 70 | !cap_raised(current_cred()->cap_inheritable, 71 | - arg3))) 72 | + arg3) || 73 | + issecure(SECURE_NO_CAP_AMBIENT_RAISE))) 74 | return -EPERM; 75 | 76 | new = prepare_creds(); 77 | -- 78 | 2.5.0 79 | 80 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/0002-edison-capabilities-add-a-securebit-to-disable-PR_CAP_AMBIE.patch: -------------------------------------------------------------------------------- 1 | From bcf6aa796d38133331ef73317351bab8b2c62d34 Mon Sep 17 00:00:00 2001 2 | From: Andy Lutomirski 3 | Date: Fri, 4 Sep 2015 15:42:51 -0700 4 | Subject: [PATCH 2/2] capabilities: add a securebit to disable 5 | PR_CAP_AMBIENT_RAISE 6 | 7 | Per Andrew Morgan's request, add a securebit to allow admins to disable 8 | PR_CAP_AMBIENT_RAISE. This securebit will prevent processes from adding 9 | capabilities to their ambient set. 10 | 11 | For simplicity, this disables PR_CAP_AMBIENT_RAISE entirely rather than 12 | just disabling setting previously cleared bits. 13 | 14 | Upstream-status: Backport [4.3] 15 | 16 | Signed-off-by: Andy Lutomirski 17 | Acked-by: Andrew G. Morgan 18 | Acked-by: Serge Hallyn 19 | Cc: Kees Cook 20 | Cc: Christoph Lameter 21 | Cc: Serge Hallyn 22 | Cc: Jonathan Corbet 23 | Cc: Aaron Jones 24 | Cc: Ted Ts'o 25 | Cc: Andrew G. Morgan 26 | Cc: Mimi Zohar 27 | Cc: Austin S Hemmelgarn 28 | Cc: Markku Savela 29 | Cc: Jarkko Sakkinen 30 | Cc: Michael Kerrisk 31 | Cc: James Morris 32 | Signed-off-by: Andrew Morton 33 | Signed-off-by: Linus Torvalds 34 | --- 35 | include/uapi/linux/securebits.h | 11 ++++++++++- 36 | security/commoncap.c | 3 ++- 37 | 2 files changed, 12 insertions(+), 2 deletions(-) 38 | 39 | diff --git a/include/uapi/linux/securebits.h b/include/uapi/linux/securebits.h 40 | index 985aac9..35ac35c 100644 41 | --- a/include/uapi/linux/securebits.h 42 | +++ b/include/uapi/linux/securebits.h 43 | @@ -43,9 +43,18 @@ 44 | #define SECBIT_KEEP_CAPS (issecure_mask(SECURE_KEEP_CAPS)) 45 | #define SECBIT_KEEP_CAPS_LOCKED (issecure_mask(SECURE_KEEP_CAPS_LOCKED)) 46 | 47 | +/* When set, a process cannot add new capabilities to its ambient set. */ 48 | +#define SECURE_NO_CAP_AMBIENT_RAISE 6 49 | +#define SECURE_NO_CAP_AMBIENT_RAISE_LOCKED 7 /* make bit-6 immutable */ 50 | + 51 | +#define SECBIT_NO_CAP_AMBIENT_RAISE (issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE)) 52 | +#define SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED \ 53 | + (issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE_LOCKED)) 54 | + 55 | #define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \ 56 | issecure_mask(SECURE_NO_SETUID_FIXUP) | \ 57 | - issecure_mask(SECURE_KEEP_CAPS)) 58 | + issecure_mask(SECURE_KEEP_CAPS) | \ 59 | + issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE)) 60 | #define SECURE_ALL_LOCKS (SECURE_ALL_BITS << 1) 61 | 62 | #endif /* _UAPI_LINUX_SECUREBITS_H */ 63 | diff --git a/security/commoncap.c b/security/commoncap.c 64 | index dcfc43f..a7c54f3 100644 65 | --- a/security/commoncap.c 66 | +++ b/security/commoncap.c 67 | @@ -1001,7 +1001,8 @@ int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, 68 | if (arg2 == PR_CAP_AMBIENT_RAISE && 69 | (!cap_raised(current_cred()->cap_permitted, arg3) || 70 | !cap_raised(current_cred()->cap_inheritable, 71 | - arg3))) 72 | + arg3) || 73 | + issecure(SECURE_NO_CAP_AMBIENT_RAISE))) 74 | return -EPERM; 75 | 76 | new = prepare_creds(); 77 | -- 78 | 2.5.0 79 | 80 | -------------------------------------------------------------------------------- /recipes-extended/spi-quark-board/files/spi-quark-at86rf230.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Galileo atmel212b spi board file 3 | * Copyright (c) 2015, Intel Corporation. 4 | * All rights reserved. 5 | * 6 | * This program is free software; you can redistribute it and/or modify it 7 | * under the terms and conditions of the GNU General Public License, 8 | * version 2, as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | */ 15 | 16 | #define pr_fmt(fmt) "Galileo: " fmt 17 | 18 | #include "spi-quark-board.h" 19 | 20 | #include 21 | 22 | #define AT86RF_SPI_MASTER 169 23 | 24 | #define AT86RF_SPI_CS 0 25 | #define AT86RF_MAX_CLK_HZ 3000000 26 | #define AT86RF_IRQ 14 27 | 28 | static struct gpio quark_at86rf_gpios[] = { 29 | // config gpio12=IO1=nRST 30 | {28, GPIOF_OUT_INIT_LOW, "at86rf230-gpio28"}, 31 | {29, GPIOF_IN, "at86rf230-gpio29"}, 32 | {45, GPIOF_OUT_INIT_LOW, "at86rf230-gpio45"}, 33 | 34 | // config gpio13=IO2=SLP_TR 35 | {34, GPIOF_OUT_INIT_LOW, "at86rf230-gpio34"}, 36 | {35, GPIOF_IN, "at86rf230-gpio35"}, 37 | {77, GPIOF_OUT_INIT_LOW, "at86rf230-gpio77"}, 38 | 39 | // config gpio14=IO3=IRQ 40 | {16, GPIOF_OUT_INIT_HIGH, "at86rf230-gpio16"}, 41 | {AT86RF_IRQ, GPIOF_IN, "at86rf230-irq"}, 42 | {17, GPIOF_IN, "at86rf230-gpio17"}, 43 | {76, GPIOF_OUT_INIT_LOW, "at86rf230-gpio76"}, 44 | {64, GPIOF_OUT_INIT_LOW, "at86rf230-gpio64"}, 45 | 46 | // config IO10=nCS 47 | {26, GPIOF_OUT_INIT_LOW, "at86rf230-gpio26"}, 48 | {74, GPIOF_OUT_INIT_LOW, "at86rf230-gpio74"}, 49 | {27, GPIOF_IN, "at86rf230-gpio27"}, 50 | 51 | // config IO11=MOSI 52 | {24, GPIOF_OUT_INIT_LOW, "at86rf230-gpio24"}, 53 | {44, GPIOF_OUT_INIT_HIGH, "at86rf230-gpio44"}, 54 | {72, GPIOF_OUT_INIT_LOW, "at86rf230-gpio72"}, 55 | {25, GPIOF_IN, "at86rf230-gpio25"}, 56 | 57 | // config IO12=MISO 58 | {42, GPIOF_OUT_INIT_HIGH, "at86rf230-gpio42"}, 59 | {43, GPIOF_IN, "at86rf230-gpio43"}, 60 | 61 | // config IO13=CLK 62 | {30, GPIOF_OUT_INIT_LOW, "at86rf230-gpio30"}, 63 | {46, GPIOF_OUT_INIT_HIGH, "at86rf230-gpio46"}, 64 | {31, GPIOF_IN, "at86rf230-gpio31"}, 65 | }; 66 | 67 | static struct pxa2xx_spi_chip qrk_ffrd_spi_1_cs_0 = { 68 | .gpio_cs = 10, 69 | }; 70 | 71 | static struct at86rf230_platform_data at86rf230_data = { 72 | .rstn = 12, 73 | .slp_tr = 13, 74 | .xtal_trim = 0x2, 75 | .dig2 = 0, 76 | }; 77 | 78 | void set_spi_quark_board_value(struct spi_board_info *spi_quark_board_info, 79 | unsigned int *spi_board_irq, u16 *spi_board_master) 80 | { 81 | pr_info("Load at86rf230 clock %dHz\n", AT86RF_MAX_CLK_HZ); 82 | strcpy(spi_quark_board_info->modalias, "at86rf230"); 83 | spi_quark_board_info->max_speed_hz = AT86RF_MAX_CLK_HZ; 84 | spi_quark_board_info->bus_num = AT86RF_SPI_MASTER; 85 | spi_quark_board_info->chip_select = AT86RF_SPI_CS; 86 | spi_quark_board_info->platform_data = &at86rf230_data; 87 | spi_quark_board_info->controller_data = &qrk_ffrd_spi_1_cs_0; 88 | 89 | *spi_board_irq = AT86RF_IRQ; 90 | *spi_board_master = AT86RF_SPI_MASTER; 91 | } 92 | EXPORT_SYMBOL(set_spi_quark_board_value); 93 | 94 | static int __init at86rf230_quark_module_init(void) 95 | { 96 | int i; 97 | struct gpio *array = quark_at86rf_gpios; 98 | 99 | pr_info("module init config related GPIO pins\n"); 100 | 101 | for (i = 0; i < ARRAY_SIZE(quark_at86rf_gpios); i++, array++) { 102 | gpio_request_one(array->gpio, array->flags, array->label); 103 | } 104 | 105 | return 0; 106 | } 107 | 108 | static void __exit at86rf230_quark_module_exit(void) 109 | { 110 | pr_info("module exit\n"); 111 | gpio_free_array(quark_at86rf_gpios, ARRAY_SIZE(quark_at86rf_gpios)); 112 | } 113 | 114 | module_init(at86rf230_quark_module_init); 115 | module_exit(at86rf230_quark_module_exit); 116 | 117 | MODULE_LICENSE("GPL"); 118 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/u-boot/files/edison.env: -------------------------------------------------------------------------------- 1 | # Edison Environment File 2 | # Main part 3 | 4 | # Partition definition 5 | partitions=uuid_disk=${uuid_disk};name=u-boot0,start=1MiB,size=2MiB,uuid=${uuid_uboot0};name=u-boot-env0,size=1MiB,uuid=${uuid_uboot_env0};name=u-boot1,size=2MiB,uuid=${uuid_uboot1};name=u-boot-env1,size=1MiB,uuid=${uuid_uboot_env1};name=factory,size=1MiB,uuid=${uuid_factory};name=panic,size=24MiB,uuid=${uuid_panic};name=boot,size=32MiB,uuid=${uuid_boot};name=rootfs,size=2048MiB,uuid=${uuid_rootfs};name=update,size=768MiB,uuid=${uuid_update};name=home,size=-,uuid=${uuid_home}; 6 | 7 | # Dfu Alternate setting definition 8 | do_dfu_alt_info_mmc=setenv dfu_alt_info "ifwi${hardware_id} mmc 0 8192 mmcpart 1;ifwib${hardware_id} mmc 0 8192 mmcpart 2;u-boot0 part 0 1;u-boot-env0 part 0 2;u-boot1 part 0 3;u-boot-env1 part 0 4;boot part 0 7;rootfs part 0 8;update part 0 9;home part 0 10;vmlinuz fat 0 7;initrd fat 0 7" 9 | dfu_alt_info_ram=kernel ram ${loadaddr} 0x800000 10 | do_dfu_alt_info_ifwi=setenv dfu_alt_info "ifwi${hardware_id} mmc 0 8192 mmcpart 1;ifwib${hardware_id} mmc 0 8192 mmcpart 2" 11 | dfu_alt_info_reset=reset ram 0x0 0x0 12 | 13 | # Kernel load configuration 14 | bootargs_console=console=ttyMFD2 earlyprintk=ttyMFD2,keep 15 | bootargs_debug=loglevel=4 16 | do_bootargs_rootfs=setenv bootargs_rootfs rootwait root=${rootfs} rootfstype=ext4 17 | first_install_retry=0 18 | first_install_max_retries=3 19 | audio_codec_name=audio_codec="dummy" 20 | do_audio_support=setenv audio_support platform_mrfld_audio.${audio_codec_name} 21 | do_compute_target=if itest.b ${first_install_retry} -gt ${first_install_max_retries} ; then echo "Switch to Rescue target"; setenv bootargs_target rescue; saveenv; fi 22 | mmc-bootargs=run do_bootargs_rootfs; run do_audio_support; setenv bootargs ${bootargs_rootfs} ${bootargs_console} ${bootargs_debug} g_multi.ethernet_config=${bootargs_ethconfig} systemd.unit=${bootargs_target}.target hardware_id=${hardware_id} g_multi.iSerialNumber=${serial#} g_multi.dev_addr=${usb0addr} ${audio_support} fsck.mode=skip 23 | loadaddr=0x100000 24 | load_kernel=mmc rescan;if fatload mmc 1:1 ${loadaddr} vmlinuz;then echo "Booting from SD ...";setenv rootfs /dev/mmcblk1p2;else fatload mmc 0:7 ${loadaddr} vmlinuz;echo "Booting from emmc ...";setenv rootfs PARTUUID=${uuid_rootfs};fi; 25 | 26 | # Main functions 27 | do_partition_done=0 28 | do_partition=if itest.b ${do_partition_done} -eq 1; then echo "Partitioning already done..."; else run do_force_partition ; fi 29 | do_force_partition=echo "Partitioning using GPT"; gpt write mmc 0 ${partitions} ; mmc rescan; setenv do_partition_done 1 ; saveenv 30 | do_flash_ifwi=run do_dfu_alt_info_ifwi ; dfu 0 mmc 0 31 | do_flash_os=if itest.b ${do_flash_os_done} -eq 1 ; then echo "Flashing already done..." ; else run do_force_flash_os; fi 32 | do_force_flash_os=run do_dfu_alt_info_mmc ; sleep 1 ; setenv do_flash_os_done 1 ; saveenv ; dfu 0 mmc 0 33 | do_flashall=run do_partition;run do_flash_ifwi;run do_flash_os 34 | do_dnx=setenv dfu_alt_info ${dfu_alt_info_ram};dfu 0 ram 0 ram;run bootcmd 35 | init_dfu=run do_dfu_alt_info_mmc ; saveenv 36 | 37 | # Handle different boot mode 38 | bootcmd=echo "Target:${target_name}"; run do_partition; run do_handle_bootargs_mode; 39 | 40 | do_handle_bootargs_mode=run do_preprocess_bootargs_mode; if itest.s $bootargs_mode == "recovery" ; then run do_recovery; fi; if itest.s $bootargs_mode == "boot" ; then run do_boot; fi; if itest.s $bootargs_mode == "flash"; then run do_flash; fi; run do_fallback; exit; 41 | do_preprocess_bootargs_mode=if env exists bootargs_mode ; then ; else setenv bootargs_mode "boot" ;fi; 42 | 43 | do_fallback=echo "Unknown boot mode: $bootargs_mode"; env delete -f bootargs_mode; saveenv; echo "Resetting to default boot mode and reboot..."; reset; 44 | do_boot=run boot_target_cmd; 45 | do_flash=run do_force_flash_os; 46 | 47 | do_recovery_init=env delete -f bootargs_mode 48 | do_recovery_bootargs=setenv bootargs ${bootargs_console} ${bootargs_debug} hardware_id=${hardware_id} intel_scu_watchdog_evo.disable_kernel_watchdog=1 49 | do_recovery_load_kernel=fatload mmc 0:7 ${loadaddr} vmlinuzi 50 | do_recovery=run do_recovery_init; run do_recovery_bootargs; run do_recovery_load_kernel; zboot ${loadaddr} 51 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/u-boot/u-boot-target-env.inc: -------------------------------------------------------------------------------- 1 | # Handle severals environments generation for u-boot 2 | # and link the default one for Ifwi to u-boot-osip recipe 3 | 4 | #Env binary size 5 | ENV_SIZE = "0x10000" 6 | 7 | #Env base Name 8 | ENV_BASE_NAME = "${MACHINE}" 9 | # Env base file correspond to common part of all environment 10 | ENV_BASE_FILE = "${WORKDIR}/${ENV_BASE_NAME}.env" 11 | 12 | # Env directory is where target variant files are stored 13 | ENV_DIR = "${WORKDIR}/target_env" 14 | # Env composed is directory where target env are composed 15 | # by concatening of base environment file and variant files 16 | # pattern name is applied the resulting files: base-variant.env 17 | ENV_COMPOSED_DIR = "${WORKDIR}/target_composed" 18 | # Env bin is directory where target env are store in binary form 19 | # filename follows pattern name above : base-variant.bin 20 | ENV_BIN_DIR = "${WORKDIR}/target_env_bin" 21 | 22 | # Env deploy dir is the name of directory where binary envs will be deployed 23 | ENV_DEPLOY_DIR="u-boot-envs" 24 | 25 | # Env deploy src dir is the name of directory where txt envs will be deployed 26 | ENV_SRC_DEPLOY_DIR="u-boot-envs-src" 27 | 28 | # Env target to use for IFWI stitching process 29 | ENV_IFWI_TARGET_NAME="ifwi" 30 | # Env image is U-Boot primary environment (where internal U-Boot variables are stored) 31 | # The same vairiable is also defined in u-boot-osip recip in charge of doing stitching 32 | # process for IFWI 33 | ENV_IMAGE = "${B}/env.bin" 34 | 35 | do_build_mkimage_tool[dirs] = "${B}" 36 | do_environment_mkimage[dirs] = "${B}" 37 | 38 | do_build_mkimage_tool () { 39 | HOSTCC="${CC}" HOSTLD="${LD}" HOSTLDFLAGS="${LDFLAGS}" HOSTSTRIP=true oe_runmake tools 40 | } 41 | 42 | python do_environment_mkimage() { 43 | import subprocess 44 | import shutil 45 | # list env variant target files 46 | target_root_dir = d.getVar('ENV_DIR',True) 47 | env_files = os.listdir(target_root_dir ) 48 | # builds absolute paths 49 | env_files = [ os.path.join(target_root_dir,f) for f in env_files] 50 | 51 | env_bin_dir = d.getVar("ENV_BIN_DIR",True) 52 | # cleans if it exists env_bin directory 53 | shutil.rmtree(env_bin_dir, ignore_errors=True) 54 | # create env bin directory 55 | os.mkdir(env_bin_dir) 56 | # if a previous env image used for osip process exists delete it 57 | env_image = d.getVar('ENV_IMAGE',True) 58 | try: 59 | os.unlink(env_image) 60 | except OSError: pass 61 | bb.debug(1, 'Building binary environments in : %s' % env_bin_dir) 62 | # iterate targets list to build binary environment files 63 | for target_env in env_files : 64 | # get only filename without path and extension 65 | target_filename = os.path.splitext(os.path.basename(target_env))[0] 66 | # build output file path with ext 67 | target_bin = os.path.join(env_bin_dir, 68 | d.getVar('ENV_BASE_NAME',True) + '-' + target_filename + '.bin') 69 | # generated mkenvimage tool command line 70 | cmd_mkimg ='cat %s %s | grep -v -E "^$|^\#" |' \ 71 | ' ./tools/mkenvimage -s %s -r -o %s -' \ 72 | % ( d.getVar('ENV_BASE_FILE',True),target_env, 73 | d.getVar("ENV_SIZE",True), target_bin) 74 | bb.debug(1, 'Building binary for %s target:' % (target_filename)) 75 | bb.debug(1, '%s' % cmd_mkimg) 76 | # execute shell command 77 | ret = subprocess.call(cmd_mkimg, shell=True) 78 | if ret: return ret 79 | if d.getVar('ENV_IFWI_TARGET_NAME',True) in target_bin : 80 | # create a symbolic link on default binary file env file to 81 | # avoid modifying to much osip part 82 | bb.debug(1, 'Create for IFWI stitching symlink %s to %s' % (env_image, target_bin)) 83 | os.symlink(target_bin, env_image) 84 | return 0 85 | } 86 | 87 | do_deploy_append() { 88 | install -d ${DEPLOYDIR} 89 | # deploy binary U-boot environments 90 | echo "Deploying U-boot Environments binary files in ${DEPLOYDIR}/${ENV_DEPLOY_DIR}" 91 | install -d ${DEPLOYDIR}/${ENV_DEPLOY_DIR} 92 | cp ${ENV_BIN_DIR}/*.bin ${DEPLOYDIR}/${ENV_DEPLOY_DIR} 93 | } 94 | 95 | addtask build_mkimage_tool after do_compile before do_environment_mkimage 96 | addtask environment_mkimage after do_build_mkimage_tool before do_deploy 97 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/edison-iptables.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_BRIDGE_NETFILTER=y 2 | CONFIG_NF_NAT=m 3 | CONFIG_NF_NAT_NEEDED=y 4 | # CONFIG_NF_NAT_AMANDA is not set 5 | # CONFIG_NF_NAT_FTP is not set 6 | # CONFIG_NF_NAT_IRC is not set 7 | # CONFIG_NF_NAT_SIP is not set 8 | # CONFIG_NF_NAT_TFTP is not set 9 | # CONFIG_NETFILTER_TPROXY is not set 10 | # CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set 11 | # CONFIG_NETFILTER_XT_TARGET_CT is not set 12 | # CONFIG_NETFILTER_XT_TARGET_DSCP is not set 13 | CONFIG_NETFILTER_XT_TARGET_HL=m 14 | CONFIG_NETFILTER_XT_TARGET_NETMAP=m 15 | # CONFIG_NETFILTER_XT_TARGET_NOTRACK is not set 16 | CONFIG_NETFILTER_XT_TARGET_REDIRECT=m 17 | # CONFIG_NETFILTER_XT_TARGET_TRACE is not set 18 | # CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set 19 | CONFIG_NETFILTER_XT_MATCH_ECN=m 20 | # CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set 21 | CONFIG_IP_NF_IPTABLES=m 22 | CONFIG_IP_NF_MATCH_AH=m 23 | CONFIG_IP_NF_MATCH_ECN=m 24 | # CONFIG_IP_NF_MATCH_RPFILTER is not set 25 | CONFIG_IP_NF_MATCH_TTL=m 26 | CONFIG_IP_NF_FILTER=m 27 | CONFIG_IP_NF_TARGET_REJECT=m 28 | CONFIG_IP_NF_TARGET_ULOG=m 29 | CONFIG_NF_NAT_IPV4=m 30 | CONFIG_IP_NF_TARGET_MASQUERADE=m 31 | CONFIG_IP_NF_TARGET_NETMAP=m 32 | CONFIG_IP_NF_TARGET_REDIRECT=m 33 | # CONFIG_NF_NAT_PPTP is not set 34 | # CONFIG_NF_NAT_H323 is not set 35 | CONFIG_IP_NF_MANGLE=m 36 | CONFIG_IP_NF_TARGET_CLUSTERIP=m 37 | CONFIG_IP_NF_TARGET_ECN=m 38 | CONFIG_IP_NF_TARGET_TTL=m 39 | CONFIG_IP_NF_RAW=m 40 | CONFIG_IP_NF_SECURITY=m 41 | CONFIG_IP6_NF_IPTABLES=m 42 | CONFIG_IP6_NF_MATCH_AH=m 43 | CONFIG_IP6_NF_MATCH_EUI64=m 44 | CONFIG_IP6_NF_MATCH_FRAG=m 45 | CONFIG_IP6_NF_MATCH_OPTS=m 46 | CONFIG_IP6_NF_MATCH_HL=m 47 | CONFIG_IP6_NF_MATCH_IPV6HEADER=m 48 | CONFIG_IP6_NF_MATCH_MH=m 49 | CONFIG_IP6_NF_MATCH_RPFILTER=m 50 | CONFIG_IP6_NF_MATCH_RT=m 51 | CONFIG_IP6_NF_TARGET_HL=m 52 | CONFIG_IP6_NF_FILTER=m 53 | CONFIG_IP6_NF_TARGET_REJECT=m 54 | CONFIG_IP6_NF_MANGLE=m 55 | CONFIG_IP6_NF_RAW=m 56 | CONFIG_IP6_NF_SECURITY=m 57 | # CONFIG_NF_NAT_IPV6 is not set 58 | CONFIG_BRIDGE_NF_EBTABLES=m 59 | # CONFIG_BRIDGE_EBT_BROUTE is not set 60 | # CONFIG_BRIDGE_EBT_T_FILTER is not set 61 | # CONFIG_BRIDGE_EBT_T_NAT is not set 62 | # CONFIG_BRIDGE_EBT_802_3 is not set 63 | # CONFIG_BRIDGE_EBT_AMONG is not set 64 | # CONFIG_BRIDGE_EBT_ARP is not set 65 | # CONFIG_BRIDGE_EBT_IP is not set 66 | # CONFIG_BRIDGE_EBT_IP6 is not set 67 | # CONFIG_BRIDGE_EBT_LIMIT is not set 68 | # CONFIG_BRIDGE_EBT_MARK is not set 69 | # CONFIG_BRIDGE_EBT_PKTTYPE is not set 70 | # CONFIG_BRIDGE_EBT_STP is not set 71 | # CONFIG_BRIDGE_EBT_VLAN is not set 72 | # CONFIG_BRIDGE_EBT_ARPREPLY is not set 73 | # CONFIG_BRIDGE_EBT_DNAT is not set 74 | # CONFIG_BRIDGE_EBT_MARK_T is not set 75 | # CONFIG_BRIDGE_EBT_REDIRECT is not set 76 | # CONFIG_BRIDGE_EBT_SNAT is not set 77 | # CONFIG_BRIDGE_EBT_LOG is not set 78 | # CONFIG_BRIDGE_EBT_ULOG is not set 79 | # CONFIG_BRIDGE_EBT_NFLOG is not set 80 | CONFIG_IP_ROUTE_CLASSID=y 81 | # CONFIG_NF_CONNTRACK_EVENTS is not set 82 | CONFIG_NETFILTER_XT_TARGET_CONNMARK=m 83 | CONFIG_NETFILTER_XT_TARGET_MARK=m 84 | CONFIG_NETFILTER_XT_TARGET_NFLOG=m 85 | CONFIG_NETFILTER_XT_TARGET_TRACE=m 86 | CONFIG_NETFILTER_XT_TARGET_TCPMSS=m 87 | # CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set 88 | CONFIG_NETFILTER_XT_MATCH_COMMENT=m 89 | CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m 90 | CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m 91 | CONFIG_NETFILTER_XT_MATCH_CONNMARK=m 92 | CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m 93 | CONFIG_NETFILTER_XT_MATCH_DCCP=m 94 | CONFIG_NETFILTER_XT_MATCH_DSCP=m 95 | CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m 96 | CONFIG_NETFILTER_XT_MATCH_HELPER=m 97 | CONFIG_NETFILTER_XT_MATCH_IPRANGE=m 98 | CONFIG_NETFILTER_XT_MATCH_LENGTH=m 99 | CONFIG_NETFILTER_XT_MATCH_LIMIT=m 100 | CONFIG_NETFILTER_XT_MATCH_MAC=m 101 | CONFIG_NETFILTER_XT_MATCH_MARK=m 102 | CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m 103 | CONFIG_NETFILTER_XT_MATCH_POLICY=m 104 | CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m 105 | CONFIG_NETFILTER_XT_MATCH_QUOTA=m 106 | CONFIG_NETFILTER_XT_MATCH_REALM=m 107 | CONFIG_NETFILTER_XT_MATCH_SCTP=m 108 | CONFIG_NETFILTER_XT_MATCH_STATE=m 109 | CONFIG_NETFILTER_XT_MATCH_STATISTIC=m 110 | CONFIG_NETFILTER_XT_MATCH_STRING=m 111 | CONFIG_NETFILTER_XT_MATCH_TCPMSS=m 112 | CONFIG_NETFILTER_XT_MATCH_U32=m 113 | CONFIG_NF_DEFRAG_IPV4=m 114 | CONFIG_NF_CONNTRACK_IPV4=m 115 | # CONFIG_IP_NF_TARGET_ULOG is not set 116 | CONFIG_TEXTSEARCH=y 117 | CONFIG_TEXTSEARCH_KMP=m 118 | CONFIG_TEXTSEARCH_BM=m 119 | CONFIG_TEXTSEARCH_FSM=m 120 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto-dev.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/linux-yocto:" 2 | 3 | ### linux-stable/linux-4.4.y backports 4 | SRC_URI_append_intel-edison = " file://0001-USB-usbip-fix-potential-out-of-bounds-write.patch" 5 | 6 | ### Config "fix" fragments 7 | 8 | # security fixes 9 | SRC_URI_append = " file://security.cfg" 10 | SRC_URI_append_edison = " file://security-x86.cfg" 11 | SRC_URI_append_intel-quark = " file://security-x86.cfg" 12 | SRC_URI_append_intel-core2-32 = " file://security-x86.cfg" 13 | SRC_URI_append_intel-corei7-64 = " file://security-x64.cfg" 14 | SRC_URI_append_edison = " file://edison-iptables.cfg" 15 | 16 | ### Hardware support fragments 17 | 18 | # additional security hardware support 19 | SRC_URI_append_intel-core2-32 = " file://security-tpm.cfg" 20 | SRC_URI_append_intel-corei7-64 = " file://security-tpm.cfg" 21 | 22 | # generic support for Broxton platform 23 | SRC_URI_append_intel-corei7-64 = " file://broxton.cfg" 24 | 25 | # I2C sensors 26 | SRC_URI_append_edison = " file://sensors.cfg" 27 | SRC_URI_append_beaglebone = " file://sensors.cfg" 28 | 29 | # BeagleBone Black enable all I2Cs 30 | SRC_URI_append_beaglebone = " file://0001-v3.15.0-ARM-dts-am335x-boneblack-configure-i2c1-and-2.patch" 31 | 32 | # user space SPI support 33 | SRC_URI_append_intel-quark = " file://uspi.cfg" 34 | SRC_URI_append_edison = " file://uspi.cfg" 35 | SRC_URI_append_beaglebone = " file://uspi.cfg" 36 | 37 | # IIO support 38 | SRC_URI_append_beaglebone = " file://iio.cfg" 39 | 40 | # NFC support and drivers 41 | SRC_URI_append = " file://nfc.cfg" 42 | SRC_URI_append_intel-quark = " file://nfc-spi.cfg" 43 | SRC_URI_append_edison = " file://nfc-spi.cfg" 44 | SRC_URI_append_beaglebone = " file://nfc-spi.cfg" 45 | # Minnow Max has SPI 46 | SRC_URI_append_intel-corei7-64 = " file://nfc-spi.cfg" 47 | SRC_URI_append_intel-quark = " file://nfc-i2c.cfg" 48 | SRC_URI_append_edison = " file://nfc-i2c.cfg" 49 | SRC_URI_append_beaglebone = " file://nfc-i2c.cfg" 50 | # Minnow Max has I2C 51 | SRC_URI_append_intel-corei7-64 = " file://nfc-i2c.cfg" 52 | 53 | # USB-serial interface support and drivers 54 | SRC_URI_append = " file://usb-serial.cfg" 55 | 56 | # USB-ethernet support and drivers for Edison 57 | SRC_URI_append_edison = " file://edison-usb-ethernet.cfg" 58 | 59 | # CAN-bus support and drivers 60 | SRC_URI_append = " file://can.cfg" 61 | SRC_URI_append_intel-quark = " file://can-spi.cfg" 62 | SRC_URI_append_edison = " file://can-spi.cfg" 63 | SRC_URI_append_beaglebone = " file://can-spi.cfg" 64 | # MinnowMax has SPI 65 | SRC_URI_append_intel-corei7-64 = " file://can-spi.cfg" 66 | SRC_URI_append_intel-core2-32 = " file://can-x86.cfg" 67 | SRC_URI_append_intel-corei7-64 = " file://can-x86.cfg" 68 | 69 | # RealTek WiFi chip used on Gigabyte GB-BXBT-3825 70 | SRC_URI_append_intel-core2-32 = " file://wireless.cfg" 71 | SRC_URI_append_intel-corei7-64 = " file://wireless.cfg" 72 | 73 | # 6lowpan support 74 | SRC_URI_append = " file://6lowpan.cfg" 75 | 76 | # 6lowpan over 802154 support and drivers 77 | SRC_URI_append = " file://6lowpan-802154.cfg" 78 | 79 | # 6lowpan over Bluetooth LE support 80 | SRC_URI_append = " file://6lowpan-btle.cfg" 81 | SRC_URI_append_intel-quark = " file://debug-fs.cfg" 82 | 83 | # Bluetooth and Bluetooth LE support on Galileo Gen 2 84 | SRC_URI_append_intel-quark = " file://bluetooth.cfg" 85 | 86 | # Galileo 2 GPIO 87 | SRC_URI_append_intel-quark = " file://galileo2.cfg" 88 | SRC_URI_append_intel-quark = " file://iio.cfg" 89 | 90 | # Enable/disable GFX console and support as necessary 91 | SRC_URI_append_intel-core2-32 = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', ' file://gfx.cfg', ' file://no-gfx.cfg', d)}" 92 | SRC_URI_append_intel-corei7-64 = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', ' file://gfx.cfg', ' file://no-gfx.cfg', d)}" 93 | 94 | # enable usb gadget 95 | SRC_URI_append_intel-quark = " file://usb-gadget.cfg" 96 | 97 | KERNEL_MODULE_AUTOLOAD_append_intel-quark = " g_acm_ms" 98 | KERNEL_MODULE_PROBECONF_append_intel-quark = " g_acm_ms" 99 | 100 | module_conf_g_acm_ms_intel-quark = "options g_acm_ms file=/dev/mmcblk0p1 removable=1 idVendor=0x8086 idProduct=0xDEAD" 101 | 102 | ### Feature fragments 103 | 104 | # Enable eCryptFS 105 | SRC_URI_append = " file://ecryptfs.cfg" 106 | 107 | # Backport ambient capabilities support 108 | SRC_URI_append_edison = " file://0001-edison-capabilities-ambient-capabilities.patch" 109 | SRC_URI_append_edison = " file://0002-edison-capabilities-add-a-securebit-to-disable-PR_CAP_AMBIE.patch" 110 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto_4.1.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/linux-yocto:" 2 | 3 | ### linux-stable/linux-4.4.y backports 4 | SRC_URI_append_intel-quark = " file://0001-USB-usbip-fix-potential-out-of-bounds-write.patch" 5 | SRC_URI_append_intel-core2-32 = " file://0001-USB-usbip-fix-potential-out-of-bounds-write.patch" 6 | SRC_URI_append_intel-corei7-64 = " file://0001-USB-usbip-fix-potential-out-of-bounds-write.patch" 7 | 8 | ### Config "fix" fragments 9 | 10 | # security fixes 11 | SRC_URI_append = " file://security.cfg" 12 | SRC_URI_append_edison = " file://security-x86.cfg" 13 | SRC_URI_append_intel-quark = " file://security-x86.cfg" 14 | SRC_URI_append_intel-core2-32 = " file://security-x86.cfg" 15 | SRC_URI_append_intel-corei7-64 = " file://security-x64.cfg" 16 | SRC_URI_append_edison = " file://edison-iptables.cfg" 17 | 18 | ### Hardware support fragments 19 | 20 | # additional security hardware support 21 | SRC_URI_append_intel-core2-32 = " file://security-tpm.cfg" 22 | SRC_URI_append_intel-corei7-64 = " file://security-tpm.cfg" 23 | 24 | # I2C sensors 25 | SRC_URI_append_edison = " file://sensors.cfg" 26 | SRC_URI_append_beaglebone = " file://sensors.cfg" 27 | 28 | # BeagleBone Black enable all I2Cs 29 | SRC_URI_append_beaglebone = " file://0001-v3.15.0-ARM-dts-am335x-boneblack-configure-i2c1-and-2.patch" 30 | 31 | # user space SPI support 32 | SRC_URI_append_intel-quark = " file://uspi.cfg" 33 | SRC_URI_append_edison = " file://uspi.cfg" 34 | SRC_URI_append_beaglebone = " file://uspi.cfg" 35 | 36 | # IIO support 37 | SRC_URI_append_beaglebone = " file://iio.cfg" 38 | 39 | # NFC support and drivers 40 | SRC_URI_append = " file://nfc.cfg" 41 | SRC_URI_append_intel-quark = " file://nfc-spi.cfg" 42 | SRC_URI_append_edison = " file://nfc-spi.cfg" 43 | SRC_URI_append_beaglebone = " file://nfc-spi.cfg" 44 | # Minnow Max has SPI 45 | SRC_URI_append_intel-corei7-64 = " file://nfc-spi.cfg" 46 | SRC_URI_append_intel-quark = " file://nfc-i2c.cfg" 47 | SRC_URI_append_edison = " file://nfc-i2c.cfg" 48 | SRC_URI_append_beaglebone = " file://nfc-i2c.cfg" 49 | # Minnow Max has I2C 50 | SRC_URI_append_intel-corei7-64 = " file://nfc-i2c.cfg" 51 | 52 | # USB-serial interface support and drivers 53 | SRC_URI_append = " file://usb-serial.cfg" 54 | 55 | # USB-ethernet support and drivers for Edison 56 | SRC_URI_append_edison = " file://edison-usb-ethernet.cfg" 57 | 58 | # CAN-bus support and drivers 59 | SRC_URI_append = " file://can.cfg" 60 | SRC_URI_append_intel-quark = " file://can-spi.cfg" 61 | SRC_URI_append_edison = " file://can-spi.cfg" 62 | SRC_URI_append_beaglebone = " file://can-spi.cfg" 63 | # MinnowMax has SPI 64 | SRC_URI_append_intel-corei7-64 = " file://can-spi.cfg" 65 | SRC_URI_append_intel-core2-32 = " file://can-x86.cfg" 66 | SRC_URI_append_intel-corei7-64 = " file://can-x86.cfg" 67 | 68 | # RealTek WiFi chip used on Gigabyte GB-BXBT-3825 69 | SRC_URI_append_intel-core2-32 = " file://wireless.cfg" 70 | SRC_URI_append_intel-corei7-64 = " file://wireless.cfg" 71 | 72 | # 6lowpan support 73 | SRC_URI_append = " file://6lowpan.cfg" 74 | 75 | # 6lowpan over 802154 support and drivers 76 | SRC_URI_append = " file://6lowpan-802154.cfg" 77 | 78 | # 6lowpan over Bluetooth LE support 79 | SRC_URI_append = " file://6lowpan-btle.cfg" 80 | SRC_URI_append_intel-quark = " file://debug-fs.cfg" 81 | 82 | # Bluetooth and Bluetooth LE support on Galileo Gen 2 83 | SRC_URI_append_intel-quark = " file://bluetooth.cfg" 84 | 85 | # Galileo 2 GPIO 86 | SRC_URI_append_intel-quark = " file://galileo2.cfg" 87 | SRC_URI_append_intel-quark = " file://iio.cfg" 88 | 89 | # Disable GFX console and support 90 | SRC_URI_append_intel-core2-32 = " file://no-gfx.cfg" 91 | SRC_URI_append_intel-corei7-64 = " file://no-gfx.cfg" 92 | 93 | # enable usb gadget 94 | SRC_URI_append_intel-quark = " file://usb-gadget.cfg" 95 | 96 | KERNEL_MODULE_AUTOLOAD_append_intel-quark = " g_acm_ms" 97 | KERNEL_MODULE_PROBECONF_append_intel-quark = " g_acm_ms" 98 | 99 | module_conf_g_acm_ms_intel-quark = "options g_acm_ms file=/dev/mmcblk0p1 removable=1 idVendor=0x8086 idProduct=0xDEAD" 100 | 101 | ### Feature fragments 102 | 103 | # Enable eCryptFS 104 | SRC_URI_append = " file://ecryptfs.cfg" 105 | 106 | # Backport ambient capabilities support 107 | SRC_URI_append_intel-beaglebone = " file://0001-capabilities-ambient-capabilities.patch" 108 | SRC_URI_append_intel-beaglebone = " file://0002-capabilities-add-a-securebit-to-disable-PR_CAP_AMBIE.patch" 109 | 110 | SRC_URI_append_edison = " file://0001-edison-capabilities-ambient-capabilities.patch" 111 | SRC_URI_append_edison = " file://0002-edison-capabilities-add-a-securebit-to-disable-PR_CAP_AMBIE.patch" 112 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/0001-ovl-setxattr-don-t-deadlock-when-called-from-ima_fix.patch: -------------------------------------------------------------------------------- 1 | From e6cac82bbdfc889f279c68323d3bea3e439f923b Mon Sep 17 00:00:00 2001 2 | From: Krisztian Litkey 3 | Date: Sun, 15 May 2016 10:39:09 -0400 4 | Subject: [PATCH 1/1] ovl: setxattr: don't deadlock when called from 5 | ima_fix_xattr. 6 | 7 | IMA tracks the integrity of files by hashing the file content 8 | and storing the hash in an IMA-specific extended attribute 9 | (security.ima). When a file opened for writing is closed by 10 | the last writer, IMA recalculates the hash and updates the 11 | extended attribute. Updating the attribute happens by locking 12 | the inode mutex and calling __vfs_setxattr_noperm. 13 | 14 | For a file on an overlayfs mount, this causes ovl_setxattr 15 | being eventually called (from __vfs_setxattr_noperm via 16 | inode->i_op->setxattr) with the inode already locked. In this 17 | case we cannot do the xattr setting by calling vfs_setxattr 18 | since that will try to lock the inode mutex again. To avoid 19 | a deadlock, we check if the XATTR_IMA_UPDATE flag is set and 20 | call __vfs_setxattr_noperm or vfs_setxattr accordingly. 21 | 22 | Upstream-Status: inappropriate [other] 23 | 24 | With this patch in place, a deadlock is still possible in 25 | principle as on the offending code path (ima_fix_xattr -> 26 | __ovl_setxattr_noperm -> inode->i_op->setxattr -> 27 | ovl_setxattr) the sb_writer and i_mutex locks are taken in 28 | the wrong order (i_mutex first, then sb_writers). I *think*, 29 | the only way to try and trigger the deadlock would be to modify 30 | an IMA protected file on an overlayfs using a regular write 31 | while at the same time trying to sign the same file with 32 | evmctl ima_sign. It is entirely possible that there other 33 | safeguards present in the code protecting against this corner- 34 | case that I simply missed. 35 | 36 | The real fix would be to change IMA, overlayfs, potentially 37 | touching the related parts in VFS as well to eliminate the 38 | the reversed locking. I don't attempt rolling such a patch 39 | myself. I think this needs eyeballing by someone who is already 40 | familiar with VFS, and preferably also with overlayfs. 41 | 42 | This bug has been reported upstream to IMA, overlayfs and 43 | linux-fs. 44 | 45 | Signed-off-by: Krisztian Litkey 46 | --- 47 | fs/overlayfs/inode.c | 26 +++++++++++++++----------- 48 | include/linux/xattr.h | 2 ++ 49 | security/integrity/ima/ima_appraise.c | 2 +- 50 | 3 files changed, 18 insertions(+), 12 deletions(-) 51 | 52 | diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c 53 | index 05ac9a9..bdc1cf6 100644 54 | --- a/fs/overlayfs/inode.c 55 | +++ b/fs/overlayfs/inode.c 56 | @@ -225,25 +225,29 @@ int ovl_setxattr(struct dentry *dentry, const char *name, 57 | const void *value, size_t size, int flags) 58 | { 59 | int err; 60 | - struct dentry *upperdentry; 61 | + struct dentry *upper; 62 | + 63 | + if (ovl_is_private_xattr(name)) 64 | + return -EPERM; 65 | 66 | err = ovl_want_write(dentry); 67 | if (err) 68 | goto out; 69 | 70 | - err = -EPERM; 71 | - if (ovl_is_private_xattr(name)) 72 | - goto out_drop_write; 73 | - 74 | err = ovl_copy_up(dentry); 75 | - if (err) 76 | - goto out_drop_write; 77 | + if (!err) 78 | + upper = ovl_dentry_upper(dentry); 79 | 80 | - upperdentry = ovl_dentry_upper(dentry); 81 | - err = vfs_setxattr(upperdentry, name, value, size, flags); 82 | - 83 | -out_drop_write: 84 | ovl_drop_write(dentry); 85 | + 86 | + if (err) 87 | + goto out; 88 | + 89 | + if (flags & XATTR_IMA_UPDATE) 90 | + err = __vfs_setxattr_noperm(upper, name, value, size, 91 | + flags & ~XATTR_IMA_UPDATE); 92 | + else 93 | + err = vfs_setxattr(upper, name, value, size, flags); 94 | out: 95 | return err; 96 | } 97 | diff --git a/include/linux/xattr.h b/include/linux/xattr.h 98 | index 89474b9..cf180ed 100644 99 | --- a/include/linux/xattr.h 100 | +++ b/include/linux/xattr.h 101 | @@ -16,6 +16,8 @@ 102 | #include 103 | #include 104 | 105 | +#define XATTR_IMA_UPDATE (XATTR_REPLACE << 1) /* inode mutex locked by IMA */ 106 | + 107 | struct inode; 108 | struct dentry; 109 | 110 | diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c 111 | index 1873b55..8fad831 100644 112 | --- a/security/integrity/ima/ima_appraise.c 113 | +++ b/security/integrity/ima/ima_appraise.c 114 | @@ -62,7 +62,7 @@ static int ima_fix_xattr(struct dentry *dentry, 115 | rc = __vfs_setxattr_noperm(dentry, XATTR_NAME_IMA, 116 | &iint->ima_hash->xattr.data[offset], 117 | (sizeof(iint->ima_hash->xattr) - offset) + 118 | - iint->ima_hash->length, 0); 119 | + iint->ima_hash->length, XATTR_IMA_UPDATE); 120 | return rc; 121 | } 122 | 123 | -- 124 | 2.5.5 125 | 126 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/0001-sched-cgroup-Fix-cleanup-cgroup-teardown-init.patch: -------------------------------------------------------------------------------- 1 | From 2f5177f0fd7e531b26d54633be62d1d4cb94621c Mon Sep 17 00:00:00 2001 2 | From: Peter Zijlstra 3 | Date: Wed, 16 Mar 2016 16:22:45 +0100 4 | Subject: [PATCH] sched/cgroup: Fix/cleanup cgroup teardown/init 5 | 6 | The CPU controller hasn't kept up with the various changes in the whole 7 | cgroup initialization / destruction sequence, and commit: 8 | 9 | 2e91fa7f6d45 ("cgroup: keep zombies associated with their original cgroups") 10 | 11 | caused it to explode. 12 | 13 | The reason for this is that zombies do not inhibit css_offline() from 14 | being called, but do stall css_released(). Now we tear down the cfs_rq 15 | structures on css_offline() but zombies can run after that, leading to 16 | use-after-free issues. 17 | 18 | The solution is to move the tear-down to css_released(), which 19 | guarantees nobody (including no zombies) is still using our cgroup. 20 | 21 | Furthermore, a few simple cleanups are possible too. There doesn't 22 | appear to be any point to us using css_online() (anymore?) so fold that 23 | in css_alloc(). 24 | 25 | And since cgroup code guarantees an RCU grace period between 26 | css_released() and css_free() we can forgo using call_rcu() and free the 27 | stuff immediately. 28 | 29 | Suggested-by: Tejun Heo 30 | Reported-by: Kazuki Yamaguchi 31 | Reported-by: Niklas Cassel 32 | Tested-by: Niklas Cassel 33 | Signed-off-by: Peter Zijlstra (Intel) 34 | Acked-by: Tejun Heo 35 | Cc: Linus Torvalds 36 | Cc: Peter Zijlstra 37 | Cc: Thomas Gleixner 38 | Fixes: 2e91fa7f6d45 ("cgroup: keep zombies associated with their original cgroups") 39 | Link: http://lkml.kernel.org/r/20160316152245.GY6344@twins.programming.kicks-ass.net 40 | Signed-off-by: Ingo Molnar 41 | --- 42 | kernel/sched/core.c | 35 ++++++++++++++--------------------- 43 | 1 file changed, 14 insertions(+), 21 deletions(-) 44 | 45 | diff --git a/kernel/sched/core.c b/kernel/sched/core.c 46 | index eb70592..bcda4f8 100644 47 | --- a/kernel/sched/core.c 48 | +++ b/kernel/sched/core.c 49 | @@ -7692,7 +7692,7 @@ void set_curr_task(int cpu, struct task_struct *p) 50 | /* task_group_lock serializes the addition/removal of task groups */ 51 | static DEFINE_SPINLOCK(task_group_lock); 52 | 53 | -static void free_sched_group(struct task_group *tg) 54 | +static void sched_free_group(struct task_group *tg) 55 | { 56 | free_fair_sched_group(tg); 57 | free_rt_sched_group(tg); 58 | @@ -7718,7 +7718,7 @@ struct task_group *sched_create_group(struct task_group *parent) 59 | return tg; 60 | 61 | err: 62 | - free_sched_group(tg); 63 | + sched_free_group(tg); 64 | return ERR_PTR(-ENOMEM); 65 | } 66 | 67 | @@ -7738,17 +7738,16 @@ void sched_online_group(struct task_group *tg, struct task_group *parent) 68 | } 69 | 70 | /* rcu callback to free various structures associated with a task group */ 71 | -static void free_sched_group_rcu(struct rcu_head *rhp) 72 | +static void sched_free_group_rcu(struct rcu_head *rhp) 73 | { 74 | /* now it should be safe to free those cfs_rqs */ 75 | - free_sched_group(container_of(rhp, struct task_group, rcu)); 76 | + sched_free_group(container_of(rhp, struct task_group, rcu)); 77 | } 78 | 79 | -/* Destroy runqueue etc associated with a task group */ 80 | void sched_destroy_group(struct task_group *tg) 81 | { 82 | /* wait for possible concurrent references to cfs_rqs complete */ 83 | - call_rcu(&tg->rcu, free_sched_group_rcu); 84 | + call_rcu(&tg->rcu, sched_free_group_rcu); 85 | } 86 | 87 | void sched_offline_group(struct task_group *tg) 88 | @@ -8209,31 +8208,26 @@ cpu_cgroup_css_alloc(struct cgroup_subsys_state *parent_css) 89 | if (IS_ERR(tg)) 90 | return ERR_PTR(-ENOMEM); 91 | 92 | + sched_online_group(tg, parent); 93 | + 94 | return &tg->css; 95 | } 96 | 97 | -static int cpu_cgroup_css_online(struct cgroup_subsys_state *css) 98 | +static void cpu_cgroup_css_released(struct cgroup_subsys_state *css) 99 | { 100 | struct task_group *tg = css_tg(css); 101 | - struct task_group *parent = css_tg(css->parent); 102 | 103 | - if (parent) 104 | - sched_online_group(tg, parent); 105 | - return 0; 106 | + sched_offline_group(tg); 107 | } 108 | 109 | static void cpu_cgroup_css_free(struct cgroup_subsys_state *css) 110 | { 111 | struct task_group *tg = css_tg(css); 112 | 113 | - sched_destroy_group(tg); 114 | -} 115 | - 116 | -static void cpu_cgroup_css_offline(struct cgroup_subsys_state *css) 117 | -{ 118 | - struct task_group *tg = css_tg(css); 119 | - 120 | - sched_offline_group(tg); 121 | + /* 122 | + * Relies on the RCU grace period between css_released() and this. 123 | + */ 124 | + sched_free_group(tg); 125 | } 126 | 127 | static void cpu_cgroup_fork(struct task_struct *task, void *private) 128 | @@ -8593,9 +8587,8 @@ static struct cftype cpu_files[] = { 129 | 130 | struct cgroup_subsys cpu_cgrp_subsys = { 131 | .css_alloc = cpu_cgroup_css_alloc, 132 | + .css_released = cpu_cgroup_css_released, 133 | .css_free = cpu_cgroup_css_free, 134 | - .css_online = cpu_cgroup_css_online, 135 | - .css_offline = cpu_cgroup_css_offline, 136 | .fork = cpu_cgroup_fork, 137 | .can_attach = cpu_cgroup_can_attach, 138 | .attach = cpu_cgroup_attach, 139 | -- 140 | 1.7.10.4 141 | 142 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto_4.4.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/linux-yocto:" 2 | 3 | ### linux-stable/linux-4.4.y backports 4 | SRC_URI_append_intel-edison = " file://0001-USB-usbip-fix-potential-out-of-bounds-write.patch" 5 | 6 | ### Config "fix" fragments 7 | 8 | # security fixes 9 | SRC_URI_append = " file://security.cfg" 10 | SRC_URI_append_edison = " file://security-x86.cfg" 11 | SRC_URI_append_intel-quark = " file://security-x86.cfg" 12 | SRC_URI_append_intel-core2-32 = " file://security-x86.cfg" 13 | SRC_URI_append_intel-corei7-64 = " file://security-x64.cfg" 14 | SRC_URI_append_edison = " file://edison-iptables.cfg" 15 | 16 | ### Hardware support fragments 17 | 18 | # additional security hardware support 19 | SRC_URI_append_intel-core2-32 = " file://security-tpm.cfg" 20 | SRC_URI_append_intel-corei7-64 = " file://security-tpm.cfg" 21 | 22 | # generic support for Broxton platform 23 | SRC_URI_append_intel-corei7-64 = " file://broxton.cfg" 24 | 25 | # I2C sensors 26 | SRC_URI_append_edison = " file://sensors.cfg" 27 | SRC_URI_append_beaglebone = " file://sensors.cfg" 28 | 29 | # BeagleBone Black enable all I2Cs 30 | SRC_URI_append_beaglebone = " file://0001-v3.15.0-ARM-dts-am335x-boneblack-configure-i2c1-and-2.patch" 31 | 32 | # user space SPI support 33 | SRC_URI_append_intel-quark = " file://uspi.cfg" 34 | SRC_URI_append_edison = " file://uspi.cfg" 35 | SRC_URI_append_beaglebone = " file://uspi.cfg" 36 | 37 | # IIO support 38 | SRC_URI_append_beaglebone = " file://iio.cfg" 39 | 40 | # NFC support and drivers 41 | SRC_URI_append = " file://nfc.cfg" 42 | SRC_URI_append_intel-quark = " file://nfc-spi.cfg" 43 | SRC_URI_append_edison = " file://nfc-spi.cfg" 44 | SRC_URI_append_beaglebone = " file://nfc-spi.cfg" 45 | # Minnow Max has SPI 46 | SRC_URI_append_intel-corei7-64 = " file://nfc-spi.cfg" 47 | SRC_URI_append_intel-quark = " file://nfc-i2c.cfg" 48 | SRC_URI_append_edison = " file://nfc-i2c.cfg" 49 | SRC_URI_append_beaglebone = " file://nfc-i2c.cfg" 50 | # Minnow Max has I2C 51 | SRC_URI_append_intel-corei7-64 = " file://nfc-i2c.cfg" 52 | 53 | # USB-serial interface support and drivers 54 | SRC_URI_append = " file://usb-serial.cfg" 55 | 56 | # USB-ethernet support and drivers 57 | SRC_URI_append = " file://usb-ethernet.cfg" 58 | 59 | # CAN-bus support and drivers 60 | SRC_URI_append = " file://can.cfg" 61 | SRC_URI_append_intel-quark = " file://can-spi.cfg" 62 | SRC_URI_append_edison = " file://can-spi.cfg" 63 | SRC_URI_append_beaglebone = " file://can-spi.cfg" 64 | # MinnowMax has SPI 65 | SRC_URI_append_intel-corei7-64 = " file://can-spi.cfg" 66 | SRC_URI_append_intel-core2-32 = " file://can-x86.cfg" 67 | SRC_URI_append_intel-corei7-64 = " file://can-x86.cfg" 68 | 69 | # RealTek WiFi chip used on Gigabyte GB-BXBT-3825 70 | SRC_URI_append_intel-core2-32 = " file://wireless.cfg" 71 | SRC_URI_append_intel-corei7-64 = " file://wireless.cfg" 72 | 73 | # 6lowpan support 74 | SRC_URI_append = " file://6lowpan.cfg" 75 | 76 | # 6lowpan over 802154 support and drivers 77 | SRC_URI_append = " file://6lowpan-802154.cfg" 78 | 79 | # 6lowpan over Bluetooth LE support 80 | SRC_URI_append = " file://6lowpan-btle.cfg" 81 | SRC_URI_append_intel-quark = " file://debug-fs.cfg" 82 | 83 | # Bluetooth and Bluetooth LE support on Galileo Gen 2 84 | SRC_URI_append_intel-quark = " file://bluetooth.cfg" 85 | 86 | # Galileo 2 GPIO 87 | SRC_URI_append_intel-quark = " file://galileo2.cfg" 88 | SRC_URI_append_intel-quark = " file://iio.cfg" 89 | 90 | # Enable/disable GFX console and support as necessary 91 | SRC_URI_append_intel-core2-32 = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', ' file://gfx.cfg', ' file://no-gfx.cfg', d)}" 92 | SRC_URI_append_intel-corei7-64 = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', ' file://gfx.cfg', ' file://no-gfx.cfg', d)}" 93 | 94 | # enable usb gadget 95 | SRC_URI_append_intel-quark = " file://usb-gadget.cfg" 96 | 97 | KERNEL_MODULE_AUTOLOAD_append_intel-quark = " g_acm_ms" 98 | KERNEL_MODULE_PROBECONF_append_intel-quark = " g_acm_ms" 99 | 100 | module_conf_g_acm_ms_intel-quark = "options g_acm_ms file=/dev/mmcblk0p1 removable=1 idVendor=0x8086 idProduct=0xDEAD" 101 | 102 | ### Feature fragments 103 | 104 | # Enable eCryptFS 105 | SRC_URI_append = " file://ecryptfs.cfg" 106 | 107 | # Backport ambient capabilities support 108 | SRC_URI_append_edison = " file://0001-edison-capabilities-ambient-capabilities.patch" 109 | SRC_URI_append_edison = " file://0002-edison-capabilities-add-a-securebit-to-disable-PR_CAP_AMBIE.patch" 110 | 111 | # Enable the necessary options for systemd-nspawn'd containers. 112 | SRC_URI_append = " \ 113 | file://nspawn-fs.cfg \ 114 | file://nspawn-netdev.cfg \ 115 | file://nspawn-firewall.cfg \ 116 | file://nspawn-devpts.cfg \ 117 | " 118 | 119 | # Workaround for IMA/overlayfs deadlock. 120 | SRC_URI_append_intel-quark = " \ 121 | file://0001-ovl-setxattr-don-t-deadlock-when-called-from-ima_fix.patch \ 122 | " 123 | 124 | SRC_URI_append_intel-core2-32 = " \ 125 | file://0001-ovl-setxattr-don-t-deadlock-when-called-from-ima_fix.patch \ 126 | " 127 | 128 | SRC_URI_append_intel-corei7-64 = " \ 129 | file://0001-ovl-setxattr-don-t-deadlock-when-called-from-ima_fix.patch \ 130 | " 131 | 132 | SRC_URI_append_beaglebone = " \ 133 | file://0001-ovl-setxattr-don-t-deadlock-when-called-from-ima_fix.patch \ 134 | " 135 | 136 | # lockdep and kernel debugging 137 | # SRC_URI_append = " file://lockdep.cfg file://debug-kernel.cfg" 138 | 139 | # Temporarily use this yocto-kernel-cache commit to make intel-quark to compile 140 | # with the latest linux-yocto-4.% changes. 141 | SRCREV_meta_i586-nlp-32-intel-common = "698835841165b68089604398f68fd8bc3f79cb65" 142 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-ostro/quark/v4-1-2-firmware_loader-introduce-new-API---request_firmware_direct_full_path.patch: -------------------------------------------------------------------------------- 1 | From patchwork Tue Apr 14 09:44:55 2015 2 | Content-Type: text/plain; charset="utf-8" 3 | MIME-Version: 1.0 4 | Content-Transfer-Encoding: 7bit 5 | Subject: [v4, 1/2] firmware_loader: introduce new API - 6 | request_firmware_direct_full_path() 7 | From: Kweh Hock Leong 8 | X-Patchwork-Id: 6212461 9 | Message-Id: <1429004697-28320-2-git-send-email-hock.leong.kweh@intel.com> 10 | To: Ming Lei , Matt Fleming , 11 | Greg Kroah-Hartman 12 | Cc: Ong Boon Leong , 13 | "Kweh, Hock Leong" , 14 | LKML , linux-efi@vger.kernel.org, 15 | Sam Protsenko , 16 | Peter Jones , Andy Lutomirski , 17 | Roy Franz , Borislav Petkov 18 | Date: Tue, 14 Apr 2015 17:44:55 +0800 19 | 20 | From: "Kweh, Hock Leong" 21 | 22 | Introduce this new API for loading firmware from a specific location 23 | instead of /lib/firmware/ by providing a full path to the firmware 24 | file. 25 | 26 | Cc: Ming Lei 27 | Cc: Matt Fleming 28 | Signed-off-by: Kweh, Hock Leong 29 | 30 | --- 31 | drivers/base/firmware_class.c | 46 ++++++++++++++++++++++++++++++++++++----- 32 | include/linux/firmware.h | 9 ++++++++ 33 | 2 files changed, 50 insertions(+), 5 deletions(-) 34 | 35 | diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c 36 | index 171841a..3ab7bb9 100644 37 | --- a/drivers/base/firmware_class.c 38 | +++ b/drivers/base/firmware_class.c 39 | @@ -111,6 +111,7 @@ static inline long firmware_loading_timeout(void) 40 | #define FW_OPT_FALLBACK 0 41 | #endif 42 | #define FW_OPT_NO_WARN (1U << 3) 43 | +#define FW_OPT_FULL_PATH (1U << 4) 44 | 45 | struct firmware_cache { 46 | /* firmware_buf instance will be added into the below list */ 47 | @@ -318,20 +319,29 @@ fail: 48 | } 49 | 50 | static int fw_get_filesystem_firmware(struct device *device, 51 | - struct firmware_buf *buf) 52 | + struct firmware_buf *buf, 53 | + unsigned int opt_flags) 54 | { 55 | int i; 56 | int rc = -ENOENT; 57 | char *path = __getname(); 58 | + int path_array_size = 1; 59 | + static const char * const root_path[] = {"/"}; 60 | + char **temp_path = (char **)root_path; 61 | 62 | - for (i = 0; i < ARRAY_SIZE(fw_path); i++) { 63 | + if (!(opt_flags & FW_OPT_FULL_PATH)) { 64 | + temp_path = (char **)fw_path; 65 | + path_array_size = ARRAY_SIZE(fw_path); 66 | + } 67 | + 68 | + for (i = 0; i < path_array_size; i++) { 69 | struct file *file; 70 | 71 | /* skip the unset customized path */ 72 | - if (!fw_path[i][0]) 73 | + if (!temp_path[i][0]) 74 | continue; 75 | 76 | - snprintf(path, PATH_MAX, "%s/%s", fw_path[i], buf->fw_id); 77 | + snprintf(path, PATH_MAX, "%s/%s", temp_path[i], buf->fw_id); 78 | 79 | file = filp_open(path, O_RDONLY, 0); 80 | if (IS_ERR(file)) 81 | @@ -1122,7 +1132,7 @@ _request_firmware(const struct firmware **firmware_p, const char *name, 82 | } 83 | } 84 | 85 | - ret = fw_get_filesystem_firmware(device, fw->priv); 86 | + ret = fw_get_filesystem_firmware(device, fw->priv, opt_flags); 87 | if (ret) { 88 | if (!(opt_flags & FW_OPT_NO_WARN)) 89 | dev_warn(device, 90 | @@ -1210,6 +1220,32 @@ int request_firmware_direct(const struct firmware **firmware_p, 91 | EXPORT_SYMBOL_GPL(request_firmware_direct); 92 | 93 | /** 94 | + * request_firmware_direct_full_path: - load firmware directly from exact 95 | + * full path 96 | + * @firmware_p: pointer to firmware image 97 | + * @name: full path to the firmware file with file name 98 | + * @device: device for which firmware is being loaded 99 | + * 100 | + * This function works like request_firmware_direct(), but this doesn't 101 | + * search the /lib/firmware/ for the firmware file. It support exact full 102 | + * path to the firmware file for loading. 103 | + **/ 104 | +int request_firmware_direct_full_path(const struct firmware **firmware_p, 105 | + const char *name, struct device *device) 106 | +{ 107 | + int ret; 108 | + 109 | + __module_get(THIS_MODULE); 110 | + ret = _request_firmware(firmware_p, name, device, 111 | + FW_OPT_UEVENT | FW_OPT_NO_WARN | 112 | + FW_OPT_FULL_PATH); 113 | + module_put(THIS_MODULE); 114 | + 115 | + return ret; 116 | +} 117 | +EXPORT_SYMBOL_GPL(request_firmware_direct_full_path); 118 | + 119 | +/** 120 | * release_firmware: - release the resource associated with a firmware image 121 | * @fw: firmware resource to release 122 | **/ 123 | diff --git a/include/linux/firmware.h b/include/linux/firmware.h 124 | index 5c41c5e..b7c6435 100644 125 | --- a/include/linux/firmware.h 126 | +++ b/include/linux/firmware.h 127 | @@ -47,6 +47,8 @@ int request_firmware_nowait( 128 | void (*cont)(const struct firmware *fw, void *context)); 129 | int request_firmware_direct(const struct firmware **fw, const char *name, 130 | struct device *device); 131 | +int request_firmware_direct_full_path(const struct firmware **fw, 132 | + const char *name, struct device *device); 133 | 134 | void release_firmware(const struct firmware *fw); 135 | #else 136 | @@ -75,5 +77,12 @@ static inline int request_firmware_direct(const struct firmware **fw, 137 | return -EINVAL; 138 | } 139 | 140 | +static inline int request_firmware_direct_full_path(const struct firmware **fw, 141 | + const char *name, 142 | + struct device *device) 143 | +{ 144 | + return -EINVAL; 145 | +} 146 | + 147 | #endif 148 | #endif 149 | -------------------------------------------------------------------------------- /meta-edison-bsp/classes/image_types_edison.bbclass: -------------------------------------------------------------------------------- 1 | inherit image_types 2 | 3 | IMAGE_DEPENDS_boot = "virtual/kernel:do_deploy dosfstools-native mtools-native" 4 | IMAGE_TYPEDEP_boot = "ext4 tar" 5 | 6 | IMAGE_TYPES += "boot update toflash" 7 | 8 | IMAGE_CMD_boot () { 9 | 10 | BLOCKS=32768 11 | rm -f ${WORKDIR}/boot.img 12 | 13 | mkfs.vfat -n "boot" -S 512 -C ${WORKDIR}/boot.img $BLOCKS 14 | 15 | # Copy kernel 16 | mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/bzImage-edison.bin ::/vmlinuz 17 | 18 | # Copy fota kernel (includes initramfs) 19 | if [ -e ${DEPLOY_DIR_IMAGE}/bzImage-initramfs-edison.bin ]; then 20 | mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/bzImage-initramfs-edison.bin ::/vmlinuzi 21 | fi 22 | 23 | # Copy fota initramfs 24 | if [ -e ${DEPLOY_DIR_IMAGE}/core-image-initramfs-edison.cpio.gz ]; then 25 | mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/core-image-initramfs-edison.cpio.gz ::/initramfs 26 | fi 27 | 28 | install ${WORKDIR}/boot.img ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg 29 | ln -s -f ${IMAGE_NAME}.hddimg ${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}.hddimg 30 | } 31 | 32 | IMAGE_DEPENDS_update = "dosfstools-native mtools-native" 33 | IMAGE_TYPEDEP_update = "tar.bz2 boot" 34 | 35 | IMAGE_CMD_update () { 36 | 37 | UPDATE_BLOCKS=786432 38 | FAT_BLOCKS=785408 39 | 40 | # clean up from previous builds 41 | rm -f ${WORKDIR}/update.img 42 | rm -f ${WORKDIR}/fat.img 43 | rm -f ${WORKDIR}/update.tar 44 | rm -f ${WORKDIR}/update.tar.gz 45 | 46 | 47 | # create disk image with fat32 primary partition on all available space 48 | dd if=/dev/zero of=${WORKDIR}/update.img bs=1024 count=$UPDATE_BLOCKS 49 | printf "n\np\n1\n\n\nt\nb\np\nw\n" | fdisk ${WORKDIR}/update.img 50 | 51 | # Create fat file system image 52 | mkfs.vfat -n "Edison" -S 512 -C ${WORKDIR}/fat.img $FAT_BLOCKS 53 | 54 | # Create recovery directory and populate it 55 | mmd -i ${WORKDIR}/fat.img ::/recovery 56 | echo ${IMAGE_NAME} > /tmp/image-name.txt 57 | mcopy -i ${WORKDIR}/fat.img -s /tmp/image-name.txt ::/recovery/image-name.txt 58 | mcopy -i ${WORKDIR}/fat.img -s ${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}.tar.bz2 ::/recovery/rootfs.tar.bz2 59 | mcopy -i ${WORKDIR}/fat.img -s ${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}.hddimg ::/recovery/boot.hddimg 60 | mcopy -i ${WORKDIR}/fat.img -s ${DEPLOY_DIR_IMAGE}/u-boot-edison.bin ::/recovery/u-boot.bin 61 | mcopy -i ${WORKDIR}/fat.img -s ${DEPLOY_DIR_IMAGE}/u-boot-envs/edison-blankrndis.bin ::/recovery/u-boot.env 62 | 63 | # add fat image to disk image 64 | dd if=${WORKDIR}/fat.img of=${WORKDIR}/update.img bs=1024 seek=1024 65 | 66 | install ${WORKDIR}/update.img ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.update.hddimg 67 | ln -s -f ${IMAGE_NAME}.update.hddimg ${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}.update.hddimg 68 | 69 | # Create update archive 70 | tar -cf ${WORKDIR}/update.tar -C /tmp image-name.txt 71 | tar --transform='flags=r;s|${IMAGE_NAME}.rootfs.tar.bz2|rootfs.tar.bz2|' -rf ${WORKDIR}/update.tar -C ${DEPLOY_DIR_IMAGE} ${IMAGE_NAME}.rootfs.tar.bz2 72 | tar --transform='flags=r;s|${IMAGE_NAME}.hddimg|boot.hddimg|' -rf ${WORKDIR}/update.tar -C ${DEPLOY_DIR_IMAGE} ${IMAGE_NAME}.hddimg 73 | tar --transform='flags=r;s|u-boot-edison.bin|u-boot.bin|' -rhf ${WORKDIR}/update.tar -C ${DEPLOY_DIR_IMAGE} u-boot-edison.bin 74 | tar --transform='flags=r;s|edison-blankrndis.bin|u-boot.env|' -rf ${WORKDIR}/update.tar -C ${DEPLOY_DIR_IMAGE}/u-boot-envs edison-blankrndis.bin 75 | gzip ${WORKDIR}/update.tar 76 | 77 | install ${WORKDIR}/update.tar.gz ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.update.tar.gz 78 | ln -s -f ${IMAGE_NAME}.update.tar.gz ${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}.update.tar.gz 79 | } 80 | 81 | IMAGE_DEPENDS_toflash = "ifwi flashall u-boot-edison u-boot-mkimage-native" 82 | IMAGE_TYPEDEP_toflash = "ext4 boot update" 83 | 84 | IMAGE_CMD_toflash () { 85 | 86 | rm -rf ${WORKDIR}/toFlash 87 | install -d ${WORKDIR}/toFlash/u-boot-envs/ 88 | install -d ${WORKDIR}/toFlash/helper/images 89 | 90 | install ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext4 ${WORKDIR}/toFlash/${IMAGE_BASENAME}-${MACHINE}.ext4 91 | install ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg ${WORKDIR}/toFlash/${IMAGE_BASENAME}-${MACHINE}.hddimg 92 | install ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.update.hddimg ${WORKDIR}/toFlash/${IMAGE_BASENAME}-${MACHINE}.update.hddimg 93 | 94 | install ${DEPLOY_DIR_IMAGE}/u-boot-edison.bin ${WORKDIR}/toFlash/ 95 | install ${DEPLOY_DIR_IMAGE}/u-boot-edison.img ${WORKDIR}/toFlash/ 96 | install ${DEPLOY_DIR_IMAGE}/u-boot-envs/*.bin ${WORKDIR}/toFlash/u-boot-envs/ 97 | 98 | install ${DEPLOY_DIR_IMAGE}/ifwi/*.bin ${WORKDIR}/toFlash/ 99 | 100 | install ${DEPLOY_DIR_IMAGE}/flashall/filter-dfu-out.js ${WORKDIR}/toFlash/ 101 | install ${DEPLOY_DIR_IMAGE}/flashall/flashall.* ${WORKDIR}/toFlash/ 102 | install ${DEPLOY_DIR_IMAGE}/flashall/pft-config-edison.xml ${WORKDIR}/toFlash/ 103 | 104 | install ${DEPLOY_DIR_IMAGE}/flashall/FlashEdison.json ${WORKDIR}/toFlash/ 105 | install ${DEPLOY_DIR_IMAGE}/flashall/helper/helper.html ${WORKDIR}/toFlash/helper/ 106 | install ${DEPLOY_DIR_IMAGE}/flashall/helper/images/*.png ${WORKDIR}/toFlash/helper/images/ 107 | 108 | # update image names inside flashing tools 109 | sed -e "s/^IMAGE_NAME=.\+$/IMAGE_NAME=\"${IMAGE_BASENAME}\"/" -i ${WORKDIR}/toFlash/flashall.sh 110 | sed -e "s/^set IMAGE_NAME=.\+$/set IMAGE_NAME=${IMAGE_BASENAME}/" -i ${WORKDIR}/toFlash/flashall.bat 111 | sed -e "s/\"edison-image-edison\./\"${IMAGE_BASENAME}-edison./" -i ${WORKDIR}/toFlash/FlashEdison.json 112 | 113 | # generate a formatted list of all packages included in the image 114 | awk '{print $1 " " $3}' ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.manifest > ${WORKDIR}/toFlash/package-list.txt 115 | 116 | tar cvjf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.toflash.tar.bz2 -C ${WORKDIR} toFlash/ 117 | 118 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}.toflash.tar.bz2 119 | ln -s -f ${IMAGE_NAME}.toflash.tar.bz2 ${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}.toflash.tar.bz2 120 | } 121 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/flashall/flashall-2.0/FlashEdison.json: -------------------------------------------------------------------------------- 1 | { 2 | "flash" : { 3 | "commands" : [ 4 | { 5 | "duration" : 42000, 6 | "restrict" : null, 7 | "source" : "${helperFile}", 8 | "tool" : "notifier" 9 | }, 10 | { 11 | "description" : "Waiting for device", 12 | "restrict" : null, 13 | "state" : "dnx_fw", 14 | "timeout" : 42000, 15 | "tool" : "waitForDevice" 16 | }, 17 | { 18 | "duration" : 5000, 19 | "restrict" : null, 20 | "source" : "Edison board plugged", 21 | "tool" : "notifier" 22 | }, 23 | { 24 | "gpflag" : "${gpflag}", 25 | "ifwi" : "${ifwi_file}", 26 | "ifwi_dnx" : "${fw_dnx_file}", 27 | "os" : "${os_file}", 28 | "os_dnx" : "${os_dnx_file}", 29 | "restrict" : null, 30 | "tool" : "xfstkDownloader" 31 | }, 32 | { 33 | "description" : "Waiting for device", 34 | "restrict" : null, 35 | "state" : "pos", 36 | "timeout" : 120000, 37 | "tool" : "waitForDevice" 38 | }, 39 | { 40 | "args" : "\"--alt\" \"u-boot0\" \"-D\" \"${u-boot_file}\" \"-t\" \"4096\"", 41 | "description" : "Flashing u-boot0", 42 | "mandatory" : true, 43 | "restrict" : null, 44 | "retry" : 2, 45 | "timeout" : 60000, 46 | "tool" : "dfuDownloader" 47 | }, 48 | { 49 | "args" : "\"--alt\" \"u-boot-env0\" \"-D\" \"${u-boot-env_file_rndis}\" \"-t\" \"4096\"", 50 | "description" : "Flashing u-boot-env0", 51 | "mandatory" : true, 52 | "restrict" : [ 53 | "rndis_env" 54 | ], 55 | "retry" : 2, 56 | "timeout" : 60000, 57 | "tool" : "dfuDownloader" 58 | }, 59 | { 60 | "args" : "\"--alt\" \"u-boot-env0\" \"-D\" \"${u-boot-env_file_cdc}\" \"-t\" \"4096\"", 61 | "description" : "Flashing u-boot-env0", 62 | "mandatory" : true, 63 | "restrict" : [ 64 | "cdc_env" 65 | ], 66 | "retry" : 2, 67 | "timeout" : 60000, 68 | "tool" : "dfuDownloader" 69 | }, 70 | { 71 | "args" : "\"--alt\" \"u-boot-env1\" \"-D\" \"${u-boot-env_file_rndis}\" \"-t\" \"4096\" \"-R\"", 72 | "description" : "Flashing u-boot-env1", 73 | "mandatory" : true, 74 | "restrict" : [ 75 | "rndis_env" 76 | ], 77 | "retry" : 2, 78 | "timeout" : 60000, 79 | "tool" : "dfuDownloader" 80 | }, 81 | { 82 | "args" : "\"--alt\" \"u-boot-env1\" \"-D\" \"${u-boot-env_file_cdc}\" \"-t\" \"4096\" \"-R\"", 83 | "description" : "Flashing u-boot-env1", 84 | "mandatory" : true, 85 | "restrict" : [ 86 | "cdc_env" 87 | ], 88 | "retry" : 2, 89 | "timeout" : 60000, 90 | "tool" : "dfuDownloader" 91 | }, 92 | { 93 | "duration" : 6000, 94 | "restrict" : null, 95 | "tool" : "sleep" 96 | }, 97 | { 98 | "description" : "Waiting for device", 99 | "restrict" : null, 100 | "state" : "pos", 101 | "timeout" : 120000, 102 | "tool" : "waitForDevice" 103 | }, 104 | { 105 | "args" : "\"--alt\" \"boot\" \"-D\" \"${boot_file}\" \"-t\" \"4096\"", 106 | "description" : "Flashing boot", 107 | "mandatory" : true, 108 | "restrict" : null, 109 | "retry" : 2, 110 | "timeout" : 60000, 111 | "tool" : "dfuDownloader" 112 | }, 113 | { 114 | "args" : "\"--alt\" \"update\" \"-D\" \"${update_file}\" \"-t\" \"4096\"", 115 | "description" : "Flashing update partition", 116 | "mandatory" : true, 117 | "restrict" : null, 118 | "retry" : 2, 119 | "timeout" : 1200000, 120 | "tool" : "dfuDownloader" 121 | }, 122 | { 123 | "args" : "\"--alt\" \"rootfs\" \"-D\" \"${rootfs_file}\" \"-t\" \"4096\" \"-R", 124 | "description" : "Flashing rootfs", 125 | "mandatory" : true, 126 | "restrict" : null, 127 | "retry" : 2, 128 | "timeout" : 1200000, 129 | "tool" : "dfuDownloader" 130 | }, 131 | { 132 | "duration" : 60000, 133 | "restrict" : null, 134 | "source" : "Edison board needs to reboot
135 | Please do not unplug it for 2 minutes

136 | On Arduino board, led will stop blinking at boot completed

137 | ", 138 | "tool" : "notifier" 139 | } 140 | ], 141 | "configurations" : { 142 | "cdc_env" : { 143 | "brief" : "CDC USB driver (Mac OS/Linux)", 144 | "default" : false, 145 | "description" : "U-Boot CDC environment", 146 | "documentation" : "", 147 | "groupsState" : { 148 | }, 149 | "name" : "CDC (Mac/Linux)", 150 | "parameters" : { 151 | }, 152 | "startState" : "dnx_fw" 153 | }, 154 | "rndis_env" : { 155 | "brief" : "RNDIS USB driver (Windows)", 156 | "default" : true, 157 | "description" : "U-Boot RNDIS environment", 158 | "documentation" : "", 159 | "groupsState" : { 160 | }, 161 | "name" : "RNDIS (Windows)", 162 | "parameters" : { 163 | }, 164 | "startState" : "dnx_fw" 165 | } 166 | }, 167 | "groups" : { 168 | }, 169 | "osplatform" : "android", 170 | "parameters" : { 171 | "boot_file" : { 172 | "description" : "Boot partition", 173 | "name" : "Boot partition", 174 | "type" : "file", 175 | "value" : "edison-image-edison.hddimg" 176 | }, 177 | "fw_dnx_file" : { 178 | "description" : "Firmware DnX", 179 | "name" : "Firmware DnX", 180 | "type" : "file", 181 | "value" : "edison_dnx_fwr.bin" 182 | }, 183 | "gpflag" : { 184 | "description" : "GP flag", 185 | "name" : "GP flag", 186 | "type" : "string", 187 | "value" : "0x80000007" 188 | }, 189 | "helperFile" : { 190 | "description" : "helperFile", 191 | "name" : "helperFile", 192 | "type" : "file", 193 | "value" : "helper/helper.html" 194 | }, 195 | "ifwi_file" : { 196 | "description" : "Firmware", 197 | "name" : "Firmware", 198 | "type" : "file", 199 | "value" : "edison_ifwi-dbg-00.bin" 200 | }, 201 | "os_dnx_file" : { 202 | "description" : "OS DnX", 203 | "name" : "OS DnX", 204 | "type" : "file", 205 | "value" : "edison_dnx_osr.bin" 206 | }, 207 | "os_file" : { 208 | "description" : "OS", 209 | "name" : "OS", 210 | "type" : "file", 211 | "value" : "u-boot-edison.img" 212 | }, 213 | "rootfs_file" : { 214 | "description" : "Rootfs", 215 | "name" : "Rootfs", 216 | "type" : "file", 217 | "value" : "edison-image-edison.ext4" 218 | }, 219 | "u-boot-env_file_cdc" : { 220 | "description" : "U-Boot CDC environment", 221 | "name" : "U-Boot CDC environment", 222 | "type" : "file", 223 | "value" : "u-boot-envs/edison-blankcdc.bin" 224 | }, 225 | "u-boot-env_file_rndis" : { 226 | "description" : "U-Boot RNDIS environment", 227 | "name" : "U-Boot RNDIS environment", 228 | "type" : "file", 229 | "value" : "u-boot-envs/edison-blankrndis.bin" 230 | }, 231 | "u-boot_file" : { 232 | "description" : "U-Boot", 233 | "name" : "U-Boot primary", 234 | "type" : "file", 235 | "value" : "u-boot-edison.bin" 236 | }, 237 | "update_file" : { 238 | "description" : "Update", 239 | "name" : "Update", 240 | "type" : "file", 241 | "value" : "edison-image-edison.update.hddimg" 242 | } 243 | }, 244 | "version" : "2.2" 245 | } 246 | } 247 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-ostro/quark/v4-2-2-efi-an-sysfs-interface-for-user-to-update-efi-firmware.patch: -------------------------------------------------------------------------------- 1 | From patchwork Tue Apr 14 09:44:56 2015 2 | Content-Type: text/plain; charset="utf-8" 3 | MIME-Version: 1.0 4 | Content-Transfer-Encoding: 7bit 5 | Subject: [v4,2/2] efi: an sysfs interface for user to update efi firmware 6 | From: Kweh Hock Leong 7 | X-Patchwork-Id: 6212471 8 | Message-Id: <1429004697-28320-3-git-send-email-hock.leong.kweh@intel.com> 9 | To: Ming Lei , Matt Fleming , 10 | Greg Kroah-Hartman 11 | Cc: Ong Boon Leong , 12 | "Kweh, Hock Leong" , 13 | LKML , linux-efi@vger.kernel.org, 14 | Sam Protsenko , 15 | Peter Jones , Andy Lutomirski , 16 | Roy Franz , Borislav Petkov 17 | Date: Tue, 14 Apr 2015 17:44:56 +0800 18 | 19 | From: "Kweh, Hock Leong" 20 | 21 | Introducing a kernel module to expose capsule loader interface 22 | for user to upload capsule binaries. This module leverage the 23 | request_firmware_direct_full_path() to obtain the binary at a 24 | specific path input by user. 25 | 26 | Example method to load the capsule binary: 27 | echo -n "/path/to/capsule/binary" > /sys/devices/platform/efi_capsule_loader/capsule_loader 28 | 29 | Cc: Matt Fleming 30 | Signed-off-by: Kweh, Hock Leong 31 | 32 | --- 33 | drivers/firmware/efi/Kconfig | 12 ++ 34 | drivers/firmware/efi/Makefile | 1 + 35 | drivers/firmware/efi/efi-capsule-loader.c | 169 +++++++++++++++++++++++++++++ 36 | 3 files changed, 182 insertions(+) 37 | create mode 100644 drivers/firmware/efi/efi-capsule-loader.c 38 | 39 | diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig 40 | index f712d47..3e84ec0 100644 41 | --- a/drivers/firmware/efi/Kconfig 42 | +++ b/drivers/firmware/efi/Kconfig 43 | @@ -60,6 +60,18 @@ config EFI_RUNTIME_WRAPPERS 44 | config EFI_ARMSTUB 45 | bool 46 | 47 | +config EFI_CAPSULE_LOADER 48 | + tristate "EFI capsule loader" 49 | + depends on EFI 50 | + select FW_LOADER 51 | + help 52 | + This option exposes a loader interface for user to load EFI 53 | + capsule binary and update the EFI firmware through system reboot. 54 | + This feature does not support auto locating capsule binaries at the 55 | + firmware lib search path. 56 | + 57 | + If unsure, say N. 58 | + 59 | endmenu 60 | 61 | config UEFI_CPER 62 | diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile 63 | index 698846e..5ab031a 100644 64 | --- a/drivers/firmware/efi/Makefile 65 | +++ b/drivers/firmware/efi/Makefile 66 | @@ -8,3 +8,4 @@ obj-$(CONFIG_UEFI_CPER) += cper.o 67 | obj-$(CONFIG_EFI_RUNTIME_MAP) += runtime-map.o 68 | obj-$(CONFIG_EFI_RUNTIME_WRAPPERS) += runtime-wrappers.o 69 | obj-$(CONFIG_EFI_STUB) += libstub/ 70 | +obj-$(CONFIG_EFI_CAPSULE_LOADER) += efi-capsule-loader.o 71 | diff --git a/drivers/firmware/efi/efi-capsule-loader.c b/drivers/firmware/efi/efi-capsule-loader.c 72 | new file mode 100644 73 | index 0000000..84b979b 74 | --- /dev/null 75 | +++ b/drivers/firmware/efi/efi-capsule-loader.c 76 | @@ -0,0 +1,169 @@ 77 | +/* 78 | + * EFI capsule loader driver. 79 | + * 80 | + * Copyright 2015 Intel Corporation 81 | + * 82 | + * This file is part of the Linux kernel, and is made available under 83 | + * the terms of the GNU General Public License version 2. 84 | + */ 85 | + 86 | +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 87 | + 88 | +#include 89 | +#include 90 | +#include 91 | +#include 92 | +#include 93 | +#include 94 | +#include 95 | +#include 96 | + 97 | +#define DEV_NAME "efi_capsule_loader" 98 | + 99 | +static DEFINE_MUTEX(capsule_loader_lock); 100 | +static struct platform_device *efi_capsule_pdev; 101 | + 102 | +/* 103 | + * This function will store the capsule binary and pass it to 104 | + * efi_capsule_update() API in capsule.c 105 | + */ 106 | +static int efi_capsule_store(const struct firmware *fw) 107 | +{ 108 | + int i; 109 | + int ret; 110 | + int count = fw->size; 111 | + int copy_size = (fw->size > PAGE_SIZE) ? PAGE_SIZE : fw->size; 112 | + int pages_needed = ALIGN(fw->size, PAGE_SIZE) >> PAGE_SHIFT; 113 | + struct page **pages; 114 | + void *page_data; 115 | + efi_capsule_header_t *capsule = NULL; 116 | + 117 | + if (!count) { 118 | + pr_err("%s: Received zero binary size\n", __func__); 119 | + return -ENOENT; 120 | + } 121 | + 122 | + pages = kmalloc_array(pages_needed, sizeof(void *), GFP_KERNEL); 123 | + if (!pages) { 124 | + pr_err("%s: kmalloc_array() failed\n", __func__); 125 | + return -ENOMEM; 126 | + } 127 | + 128 | + for (i = 0; i < pages_needed; i++) { 129 | + pages[i] = alloc_page(GFP_KERNEL); 130 | + if (!pages[i]) { 131 | + pr_err("%s: alloc_page() failed\n", __func__); 132 | + --i; 133 | + ret = -ENOMEM; 134 | + goto failed; 135 | + } 136 | + } 137 | + 138 | + for (i = 0; i < pages_needed; i++) { 139 | + page_data = kmap(pages[i]); 140 | + memcpy(page_data, fw->data + (i * PAGE_SIZE), copy_size); 141 | + 142 | + if (i == 0) 143 | + capsule = (efi_capsule_header_t *)page_data; 144 | + else 145 | + kunmap(pages[i]); 146 | + 147 | + count -= copy_size; 148 | + if (count < PAGE_SIZE) 149 | + copy_size = count; 150 | + } 151 | + 152 | + ret = efi_capsule_update(capsule, pages); 153 | + if (ret) { 154 | + pr_err("%s: efi_capsule_update() failed\n", __func__); 155 | + --i; 156 | + goto failed; 157 | + } 158 | + kunmap(pages[0]); 159 | + 160 | + /* 161 | + * we cannot free the pages here due to reboot need that data 162 | + * maintained. 163 | + */ 164 | + return 0; 165 | + 166 | +failed: 167 | + while (i >= 0) 168 | + __free_page(pages[i--]); 169 | + kfree(pages); 170 | + return ret; 171 | +} 172 | + 173 | +static ssize_t capsule_loader_store(struct device *dev, 174 | + struct device_attribute *attr, 175 | + const char *buf, size_t count) 176 | +{ 177 | + int ret = -EBUSY; 178 | + const struct firmware *fw; 179 | + 180 | + pr_debug("%s: Received path = %s\n", __func__, buf); 181 | + if (mutex_trylock(&capsule_loader_lock)) { 182 | + ret = request_firmware_direct_full_path(&fw, buf, 183 | + &efi_capsule_pdev->dev); 184 | + if (ret) { 185 | + pr_err("%s: request_firmware_direct_full_path() %s\n", 186 | + __func__, 187 | + "failed"); 188 | + mutex_unlock(&capsule_loader_lock); 189 | + return ret; 190 | + } 191 | + 192 | + ret = efi_capsule_store(fw); 193 | + if (ret) 194 | + pr_err("%s: %s, return error code = %d\n", 195 | + __func__, 196 | + "Failed to store capsule binary", 197 | + ret); 198 | + release_firmware(fw); 199 | + mutex_unlock(&capsule_loader_lock); 200 | + } 201 | + 202 | + return ret ? ret : count; 203 | +} 204 | +static DEVICE_ATTR_WO(capsule_loader); 205 | + 206 | +static int __init efi_capsule_loader_init(void) 207 | +{ 208 | + int ret = 0; 209 | + 210 | + efi_capsule_pdev = platform_device_register_simple(DEV_NAME, 211 | + PLATFORM_DEVID_NONE, 212 | + NULL, 0); 213 | + if (IS_ERR(efi_capsule_pdev)) { 214 | + pr_err("%s: platform_device_register_simple() failed\n", 215 | + __func__); 216 | + return PTR_ERR(efi_capsule_pdev); 217 | + } 218 | + 219 | + /* 220 | + * create this file node for user to pass in the full path of the 221 | + * capsule binary 222 | + */ 223 | + ret = device_create_file(&efi_capsule_pdev->dev, 224 | + &dev_attr_capsule_loader); 225 | + if (ret) { 226 | + pr_err("%s: device_create_file() failed\n", __func__); 227 | + platform_device_unregister(efi_capsule_pdev); 228 | + } 229 | + 230 | + return ret; 231 | +} 232 | +module_init(efi_capsule_loader_init); 233 | + 234 | +/* 235 | + * To remove this kernel module, just perform: 236 | + * rmmod efi_capsule_loader.ko 237 | + */ 238 | +static void __exit efi_capsule_loader_exit(void) 239 | +{ 240 | + platform_device_unregister(efi_capsule_pdev); 241 | +} 242 | +module_exit(efi_capsule_loader_exit); 243 | + 244 | +MODULE_DESCRIPTION("EFI capsule firmware binary loader"); 245 | +MODULE_LICENSE("GPL v2"); 246 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/flashall/flashall-2.0/flashall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | IMAGE_NAME="" 4 | BACKUP_IFS=$IFS 5 | IFS=$(echo -en "\n\b") 6 | 7 | GETOPTS="$(which getopt)" 8 | if [[ "$OSTYPE" == "darwin"* ]] ; then READLINK=greadlink; GETOPTS="$(brew list gnu-getopt | grep bin/getopt)"; else READLINK=readlink;fi; 9 | 10 | if [[ "$OSTYPE" == "cygwin" ]] ; 11 | then 12 | TEMP_DIR="$(dirname $($READLINK -f $0))" 13 | ESC_BASE_DIR="$(cygpath -m ${TEMP_DIR})" 14 | BASE_DIR="$(cygpath -m ${TEMP_DIR})" 15 | else 16 | BASE_DIR="$(dirname $($READLINK -f $0))" 17 | ESC_BASE_DIR=${BASE_DIR/' '/'\ '} 18 | fi; 19 | 20 | USB_VID=8087 21 | USB_PID=0a99 22 | TIMEOUT_SEC=60 23 | 24 | DO_RECOVERY=0 25 | # Phone Flash tools configuration files 26 | PFT_XML_FILE="${BASE_DIR}/pft-config-edison.xml" 27 | 28 | # Handle Ifwi file for DFU update 29 | IFWI_DFU_FILE=${ESC_BASE_DIR}/edison_ifwi-dbg 30 | 31 | VAR_DIR="${BASE_DIR}/u-boot-envs" 32 | if [[ "$OSTYPE" == "cygwin" ]] ; then 33 | VARIANT_NAME_DEFAULT="edison-defaultrndis" 34 | VARIANT_NAME_BLANK="edison-blankrndis" 35 | else 36 | VARIANT_NAME_DEFAULT="edison-defaultcdc" 37 | VARIANT_NAME_BLANK="edison-blankcdc" 38 | fi 39 | VARIANT_NAME=$VARIANT_NAME_BLANK 40 | 41 | LOG_FILENAME="flash.log" 42 | OUTPUT_LOG_CMD="2>&1 | tee -a ${LOG_FILENAME} | ( sed -n '19 q'; head -n 1; cat >/dev/null )" 43 | 44 | function print-usage { 45 | cat << EOF 46 | Usage: ${0##*/} [-i ][--image=] [-h][--help][--recovery] [--keep-data] 47 | Update all software and restore board to its initial state. 48 | -i flash specified image, image name is the name given to bitbake 49 | --image= 50 | -h,--help display this help and exit. 51 | -v verbose output 52 | --recovery recover the board to DFU mode using a dedicated tool, 53 | available only on linux and window hosts. 54 | --keep-data preserve user data when flashing. 55 | EOF 56 | exit -5 57 | } 58 | 59 | function flash-command-try { 60 | eval dfu-util -v -d ${USB_VID}:${USB_PID} $@ $OUTPUT_LOG_CMD 61 | } 62 | 63 | function flash-dfu-ifwi { 64 | ifwi_hwid_found=`dfu-util -l -d ${USB_VID}:${USB_PID} | grep -c $1` 65 | if [ $ifwi_hwid_found -ne 0 ]; 66 | then 67 | flash-command ${@:2} 68 | fi 69 | } 70 | 71 | function flash-command { 72 | flash-command-try $@ 73 | if [ $? -ne 0 ] ; 74 | then 75 | echo "Flash failed on $@" 76 | exit -1 77 | fi 78 | } 79 | 80 | function flash-debug { 81 | echo "DEBUG: lsusb" 82 | lsusb 83 | echo "DEBUG: dfu-util -l" 84 | dfu-util -l 85 | } 86 | 87 | function flash-ifwi { 88 | if [ -x "$(which phoneflashtool)" ]; then 89 | flash-ifwi-pft 90 | elif [ -x "$(which xfstk-dldr-solo)" ]; then 91 | flash-ifwi-xfstk 92 | else 93 | echo "!!! You should install xfstk tools, please visit http://xfstk.sourceforge.net/" 94 | exit -1 95 | fi 96 | } 97 | 98 | function flash-ifwi-pft { 99 | eval phoneflashtool --cli -f "$PFT_XML_FILE" 100 | if [ $? -ne 0 ]; 101 | then 102 | echo "Phoneflashtool error" 103 | flash-debug 104 | exit -1 105 | fi 106 | } 107 | 108 | function flash-ifwi-xfstk { 109 | XFSTK_PARAMS=" --gpflags 0x80000007 --osimage ${ESC_BASE_DIR}/u-boot-edison.img" 110 | XFSTK_PARAMS="${XFSTK_PARAMS} --fwdnx ${ESC_BASE_DIR}/edison_dnx_fwr.bin" 111 | XFSTK_PARAMS="${XFSTK_PARAMS} --fwimage ${ESC_BASE_DIR}/edison_ifwi-dbg-00.bin" 112 | XFSTK_PARAMS="${XFSTK_PARAMS} --osdnx ${ESC_BASE_DIR}/edison_dnx_osr.bin" 113 | 114 | eval xfstk-dldr-solo ${XFSTK_PARAMS} 115 | if [ $? -ne 0 ]; 116 | then 117 | echo "Xfstk tool error" 118 | flash-debug 119 | exit -1 120 | fi 121 | } 122 | 123 | function dfu-wait { 124 | echo "Now waiting for dfu device ${USB_VID}:${USB_PID}" 125 | if [ -z "$@" ]; then 126 | echo "Please plug and reboot the board" 127 | fi 128 | while [ `dfu-util -l -d ${USB_VID}:${USB_PID} | grep Found | grep -c ${USB_VID}` -eq 0 ] \ 129 | && [ $TIMEOUT_SEC -gt 0 ] && [ $(( TIMEOUT_SEC-- )) ]; 130 | do 131 | sleep 1 132 | done 133 | 134 | if [ $TIMEOUT_SEC -eq 0 ]; 135 | then 136 | echo "Timed out while waiting for dfu device ${USB_VID}:${USB_PID}" 137 | flash-debug 138 | if [ -z "$@" ]; then 139 | echo "Did you plug and reboot your board?" 140 | echo "If yes, please try a recovery by calling this script with the --recovery option" 141 | fi 142 | exit -2 143 | fi 144 | } 145 | 146 | # Execute old getopt to have long options support 147 | ARGS=$($GETOPTS -o ihv -l "image,keep-data,recovery,help" -n "${0##*/}" -- "$@"); 148 | #Bad arguments 149 | if [ $? -ne 0 ]; then print-usage ; fi; 150 | eval set -- "$ARGS"; 151 | 152 | while true; do 153 | case "$1" in 154 | -i|--image) shift; IMAGE_NAME="$2";; 155 | -h|--help) shift; print-usage;; 156 | -v) shift; OUTPUT_LOG_CMD=" 2>&1 | tee -a ${LOG_FILENAME}";; 157 | --recovery) shift; DO_RECOVERY=1;; 158 | --keep-data) shift; VARIANT_NAME=$VARIANT_NAME_DEFAULT;; 159 | --) shift; break;; 160 | esac 161 | done 162 | 163 | if test -z ${IMAGE_NAME} ; then 164 | echo "Image name not specified, please use -i / --image parameter!" ; 165 | echo "Note! Image name is the same name given to bitbake when baking the image." ; 166 | echo "" ; 167 | print-usage ; 168 | fi; 169 | echo -n "Image name: " 170 | echo ${IMAGE_NAME} 171 | 172 | echo "** Flashing Edison Board $(date) **" >> ${LOG_FILENAME} 173 | 174 | 175 | if [ ${DO_RECOVERY} -eq 1 ]; 176 | then 177 | if [[ "$OSTYPE" == "darwin"* ]] ; then 178 | echo "Recovery mode is only available on windows and linux"; 179 | exit -3 180 | fi 181 | 182 | echo "Starting Recovery mode" 183 | echo "Please plug and reboot the board" 184 | if [ ! -f "${PFT_XML_FILE}" ]; 185 | then 186 | echo "${PFT_XML_FILE} does not exist" 187 | exit -3 188 | fi 189 | echo "Flashing IFWI" 190 | flash-ifwi 191 | echo "Recovery Success..." 192 | echo "You can now try a regular flash" 193 | 194 | else 195 | echo "Using U-Boot target: ${VARIANT_NAME}" 196 | VARIANT_FILE="${VAR_DIR}/${VARIANT_NAME}.bin" 197 | if [ ! -f "${VARIANT_FILE}" ]; then 198 | echo "U-boot target ${VARIANT_NAME}: ${VARIANT_FILE} not found aborting" 199 | exit -5 200 | fi 201 | VARIANT_FILE=${VARIANT_FILE/' '/'\ '} 202 | 203 | dfu-wait 204 | 205 | echo "Flashing IFWI" 206 | 207 | flash-dfu-ifwi ifwi00 --alt ifwi00 -D "${IFWI_DFU_FILE}-00-dfu.bin" 208 | flash-dfu-ifwi ifwib00 --alt ifwib00 -D "${IFWI_DFU_FILE}-00-dfu.bin" 209 | 210 | flash-dfu-ifwi ifwi01 --alt ifwi01 -D "${IFWI_DFU_FILE}-01-dfu.bin" 211 | flash-dfu-ifwi ifwib01 --alt ifwib01 -D "${IFWI_DFU_FILE}-01-dfu.bin" 212 | 213 | flash-dfu-ifwi ifwi02 --alt ifwi02 -D "${IFWI_DFU_FILE}-02-dfu.bin" 214 | flash-dfu-ifwi ifwib02 --alt ifwib02 -D "${IFWI_DFU_FILE}-02-dfu.bin" 215 | 216 | flash-dfu-ifwi ifwi03 --alt ifwi03 -D "${IFWI_DFU_FILE}-03-dfu.bin" 217 | flash-dfu-ifwi ifwib03 --alt ifwib03 -D "${IFWI_DFU_FILE}-03-dfu.bin" 218 | 219 | flash-dfu-ifwi ifwi04 --alt ifwi04 -D "${IFWI_DFU_FILE}-04-dfu.bin" 220 | flash-dfu-ifwi ifwib04 --alt ifwib04 -D "${IFWI_DFU_FILE}-04-dfu.bin" 221 | 222 | flash-dfu-ifwi ifwi05 --alt ifwi05 -D "${IFWI_DFU_FILE}-05-dfu.bin" 223 | flash-dfu-ifwi ifwib05 --alt ifwib05 -D "${IFWI_DFU_FILE}-05-dfu.bin" 224 | 225 | flash-dfu-ifwi ifwi06 --alt ifwi06 -D "${IFWI_DFU_FILE}-06-dfu.bin" 226 | flash-dfu-ifwi ifwib06 --alt ifwib06 -D "${IFWI_DFU_FILE}-06-dfu.bin" 227 | 228 | echo "Flashing U-Boot" 229 | flash-command --alt u-boot0 -D "${ESC_BASE_DIR}/u-boot-edison.bin" 230 | 231 | echo "Flashing U-Boot Environment" 232 | flash-command --alt u-boot-env0 -D "${VARIANT_FILE}" 233 | 234 | echo "Flashing U-Boot Environment Backup" 235 | flash-command --alt u-boot-env1 -D "${VARIANT_FILE}" -R 236 | echo "Rebooting to apply partition changes" 237 | dfu-wait no-prompt 238 | 239 | echo "Flashing boot partition (kernel)" 240 | flash-command --alt boot -D "${ESC_BASE_DIR}/${IMAGE_NAME}-edison.hddimg" 241 | 242 | echo "Flashing update partition" 243 | flash-command --alt update -D "${ESC_BASE_DIR}/${IMAGE_NAME}-edison.update.hddimg" 244 | 245 | echo "Flashing rootfs, (it can take up to 5 minutes... Please be patient)" 246 | flash-command --alt rootfs -D "${ESC_BASE_DIR}/${IMAGE_NAME}-edison.ext4" -R 247 | 248 | echo "Rebooting" 249 | echo "U-boot & Kernel System Flash Success..." 250 | if [ $VARIANT_NAME == $VARIANT_NAME_BLANK ] ; then 251 | echo "Your board needs to reboot to complete the flashing procedure, please do not unplug it for 2 minutes." 252 | fi 253 | fi 254 | 255 | IFS=${BACKUP_IFS} 256 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/flashall/flashall-2.0/flashall.bat: -------------------------------------------------------------------------------- 1 | ::batch file for win platform 2 | @echo off 3 | set BASE_DIR=%~dp0 4 | set USB_VID=8087 5 | set USB_PID=0a99 6 | set /a TIMEOUT=60 7 | 8 | ::Phone flash tools configuration part 9 | set DO_RECOVERY=0 10 | set EDISON_XML_FILE="%BASE_DIR%pft-config-edison.xml" 11 | set PFT_XML_FILE="%BASE_DIR%pft-config-edison.xml" 12 | 13 | :: Handle Ifwi file for DFU update 14 | set IFWI_DFU_FILE=%BASE_DIR%edison_ifwi-dbg 15 | 16 | set VAR_DIR=%BASE_DIR%u-boot-envs\ 17 | set VARIANT_NAME_DEFAULT=edison-defaultrndis 18 | set VARIANT_NAME_BLANK=edison-blankrndis 19 | set VARIANT_NAME=%VARIANT_NAME_BLANK% 20 | 21 | set IMAGE_NAME= 22 | 23 | set LOG_FILENAME=flash.log 24 | set /a verbose_output=0 25 | :: ******************************************************************** 26 | :: parse arg 27 | set show_help=0 28 | set argcount=0 29 | set appname=%0 30 | :parse_arg_start 31 | if -%1-==-- goto parse_arg_end 32 | if -%1- == ---recovery- ( 33 | set /a DO_RECOVERY=1 34 | ) 35 | if -%1- == ---keep-data- ( 36 | set VARIANT_NAME=%VARIANT_NAME_DEFAULT% 37 | ) 38 | if -%1- == -/?- set /a show_help=1 39 | if -%1- == --h- set /a show_help=1 40 | if -%1- == ---help- set /a show_help=1 41 | if -%1- == --v- set /a verbose_output=1 42 | if -%1- == --i- set IMAGE_NAME=%2 43 | set /a argcount+= 1 44 | shift 45 | goto :parse_arg_start 46 | :parse_arg_end 47 | 48 | if -%IMAGE_NAME%-==-- set show_help=1 49 | 50 | :: handle help on cmd arg 51 | if %show_help% == 1 ( 52 | call:print-usage %appname% 53 | exit /b 54 | ) 55 | 56 | if %verbose_output% == 1 goto skip_init_log 57 | echo ** Flashing Edison Board %date% %time% ** >> %LOG_FILENAME% 58 | :skip_init_log 59 | 60 | :: ******************************************************************** 61 | :: Ifwi flashing part 62 | if %DO_RECOVERY% == 0 goto :skip_flash_ifwi 63 | echo Starting Recovery mode 64 | echo Please plug and reboot the board 65 | if not exist %PFT_XML_FILE% ( 66 | echo %PFT_XML_FILE% does not exist 67 | exit /b 3 68 | ) 69 | echo Flashing IFWI 70 | call:flash-ifwi 71 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 72 | echo Recovery Success... 73 | echo You can now try a regular flash 74 | goto :skip_flash_kernel 75 | :skip_flash_ifwi 76 | 77 | :: ******************************************************************** 78 | :: Kernel & rootfs flashing part 79 | echo Using U-boot target: %VARIANT_NAME% 80 | set VARIANT_FILE="%VAR_DIR%%VARIANT_NAME%.bin" 81 | if not exist %VARIANT_FILE% ( 82 | echo U-boot target %VARIANT_NAME%: %VARIANT_FILE% not found aborting 83 | exit /b 5 84 | ) 85 | 86 | echo Now waiting for dfu device %USB_VID%:%USB_PID% 87 | echo Please plug and reboot the board 88 | call:dfu-wait 89 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 90 | 91 | echo Flashing IFWI 92 | call:flash-dfu-ifwi ifwi00 "%IFWI_DFU_FILE%-00-dfu.bin" 93 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 94 | call:flash-dfu-ifwi ifwib00 "%IFWI_DFU_FILE%-00-dfu.bin" 95 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 96 | 97 | call:flash-dfu-ifwi ifwi01 "%IFWI_DFU_FILE%-01-dfu.bin" 98 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 99 | call:flash-dfu-ifwi ifwib01 "%IFWI_DFU_FILE%-01-dfu.bin" 100 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 101 | 102 | call:flash-dfu-ifwi ifwi02 "%IFWI_DFU_FILE%-02-dfu.bin" 103 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 104 | call:flash-dfu-ifwi ifwib02 "%IFWI_DFU_FILE%-02-dfu.bin" 105 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 106 | 107 | call:flash-dfu-ifwi ifwi03 "%IFWI_DFU_FILE%-03-dfu.bin" 108 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 109 | call:flash-dfu-ifwi ifwib03 "%IFWI_DFU_FILE%-03-dfu.bin" 110 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 111 | 112 | call:flash-dfu-ifwi ifwi04 "%IFWI_DFU_FILE%-04-dfu.bin" 113 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 114 | call:flash-dfu-ifwi ifwib04 "%IFWI_DFU_FILE%-04-dfu.bin" 115 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 116 | 117 | call:flash-dfu-ifwi ifwi05 "%IFWI_DFU_FILE%-05-dfu.bin" 118 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 119 | call:flash-dfu-ifwi ifwib05 "%IFWI_DFU_FILE%-05-dfu.bin" 120 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 121 | 122 | call:flash-dfu-ifwi ifwi06 "%IFWI_DFU_FILE%-06-dfu.bin" 123 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 124 | call:flash-dfu-ifwi ifwib06 "%IFWI_DFU_FILE%-06-dfu.bin" 125 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 126 | 127 | echo Flashing U-Boot 128 | call:flash-command --alt u-boot0 -D "%BASE_DIR%u-boot-edison.bin" 129 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 130 | 131 | echo Flashing U-Boot Environment 132 | call:flash-command --alt u-boot-env0 -D %VARIANT_FILE% 133 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 134 | 135 | echo Flashing U-Boot Environment Backup 136 | call:flash-command --alt u-boot-env1 -D %VARIANT_FILE% -R 137 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 138 | echo Rebooting to apply partiton changes 139 | call:dfu-wait 140 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 141 | 142 | 143 | echo Flashing boot partition ^(kernel^) 144 | call:flash-command --alt boot -D "%BASE_DIR%\%IMAGE_NAME%-edison.hddimg" 145 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 146 | 147 | echo Flashing update partition 148 | call:flash-command --alt update -D "%BASE_DIR%\%IMAGE_NAME%-edison.update.hddimg" 149 | if %errorlevel% neq 0 ( exit /b %errorlevel%) 150 | 151 | echo Flashing rootfs, ^(it can take up to 5 minutes... Please be patient^) 152 | call:flash-command --alt rootfs -D "%BASE_DIR%\%IMAGE_NAME%-edison.ext4" -R 153 | if %errorlevel% neq 0 ( exit /b %errorlevel% ) 154 | 155 | echo Rebooting 156 | echo U-boot ^& Kernel System Flash Success... 157 | if %VARIANT_NAME% == %VARIANT_NAME_BLANK% ( 158 | echo Your board needs to reboot to complete the flashing procedure, please do not unplug it for 2 minutes. 159 | ) 160 | :skip_flash_kernel 161 | 162 | :: ******************************************************************** 163 | :: The End 164 | exit /b 0 165 | 166 | 167 | :print-usage 168 | echo Usage: %1 [-h] [--help] [--recovery] [--keep-data] 169 | echo Update all software and restore board to its initial state. 170 | echo -h,--help display this help and exit. 171 | echo -v verbose output 172 | echo --recovery recover the board to DFU mode using a dedicated tool, 173 | echo available only on linux and window hosts. 174 | echo --keep-data preserve user data when flashing. 175 | echo -i imagename flash image with image name "imagename" 176 | exit /b 5 177 | 178 | :flash-dfu-ifwi 179 | dfu-util -d %USB_VID%:%USB_PID% -l | findstr "%1" > NUL 2>&1 180 | if %errorlevel% == 0 ( 181 | call:flash-command --alt %1 -D %2 182 | exit /b %errorlevel% 183 | ) 184 | exit /b 0 185 | 186 | :flash-command 187 | set filterout="on" 188 | if %verbose_output% == 1 ( set filterout="off") 189 | 190 | dfu-util -d %USB_VID%:%USB_PID% %* 2>&1 | cscript.exe /E:JScript //B filter-dfu-out.js %LOG_FILENAME% %filterout% 191 | 192 | set /a err_num=%errorlevel% 193 | if %err_num% neq 0 echo Flash failed on %* 194 | exit /b %err_num% 195 | 196 | :flash-debug 197 | echo DEBUG: dfu-util -l 198 | dfu-util -l 199 | exit /b 200 | 201 | :flash-ifwi 202 | for %%X in (xfstk-dldr-solo.exe) do (set xfstk_tool_found=%%~$PATH:X) 203 | for %%X in (cflasher.exe) do (set pft_tool_found=%%~$PATH:X) 204 | if defined pft_tool_found ( 205 | call:flash-ifwi-pft 206 | exit /b %errorlevel% 207 | ) 208 | if defined xfstk_tool_found ( 209 | call:flash-ifwi-xfstk 210 | exit /b %errorlevel% 211 | ) 212 | echo !!! You should install xfstk tools, please visit http://xfstk.sourceforge.net/ 213 | exit /b 3 214 | 215 | :flash-ifwi-xfstk 216 | xfstk-dldr-solo.exe --gpflags 0x80000007 --osimage "%BASE_DIR%u-boot-edison.img" --fwdnx "%BASE_DIR%edison_dnx_fwr.bin" --fwimage "%BASE_DIR%edison_ifwi-dbg-00.bin" --osdnx "%BASE_DIR%edison_dnx_osr.bin" 217 | set /a err_num=%errorlevel% 218 | if %err_num% neq 0 echo Ifwi Flash failed 219 | exit /b %err_num% 220 | 221 | :flash-ifwi-pft 222 | cflasher -f %PFT_XML_FILE% 223 | set /a err_num=%errorlevel% 224 | if %err_num% neq 0 echo Ifwi Flash failed 225 | exit /b %err_num% 226 | 227 | :dfu-wait 228 | setlocal 229 | set /a currtime=%TIMEOUT% 230 | :start_wait 231 | dfu-util -l -d %USB_VID%:%USB_PID% | findstr "Found" | findstr "%USB_VID%" > NUL 2>&1 232 | if %errorlevel% == 0 ( 233 | echo Dfu device found 234 | exit /b 0 235 | ) else ( 236 | set /a currtime-= 1 237 | timeout /t 1 /nobreak > nul 238 | if %currtime% gtr 0 goto:start_wait 239 | ) 240 | echo Dfu device not found Timeout 241 | echo Did you plug and reboot your board? 242 | echo If yes, please try a recovery by calling this script with the --recovery option 243 | exit /b 3 244 | 245 | -------------------------------------------------------------------------------- /meta-edison-bsp/recipes-bsp/u-boot/u-boot-osip.inc: -------------------------------------------------------------------------------- 1 | OSIP_STARTING_LBA = "2048" 2 | OSIP_DESTINATION_POINTER = "17825792" 3 | OSIP_HANDOFF_POINTER = "17829888" 4 | 5 | # env is U-Boot primary environment where internal U-Boot variables are stored 6 | # this default generated binary environment, is embedded in a raw OSIP image 7 | # use by XFSTK tools to do the initial boot 8 | ENV_IMAGE = "${B}/env.bin" 9 | BASE_IMAGE = "${B}/u-boot.bin" 10 | UBOOT_OSIP_SUFFIX = "img" 11 | UBOOT_TMP_IMG = "${B}/u-boot.${UBOOT_OSIP_SUFFIX}.no-osip" 12 | UBOOT_IMG = "${B}/u-boot.${UBOOT_OSIP_SUFFIX}" 13 | UBOOT_OSIP_IMAGE = "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_OSIP_SUFFIX}" 14 | UBOOT_OSIP_BINARY = "u-boot.${UBOOT_OSIP_SUFFIX}" 15 | UBOOT_OSIP_SYMLINK = "u-boot-${MACHINE}.${UBOOT_OSIP_SUFFIX}" 16 | 17 | do_uboot_padding[dirs] = "${B}" 18 | do_uboot_uboot_env_mkimage[dirs] = "${B}" 19 | 20 | do_uboot_padding() { 21 | # U-Boot.bin map 22 | # 0x000000 - 0x001000 | padding with 0 23 | # 0x001000 - 0x200000 | u-boot0 24 | dd if=/dev/zero of=u-boot.padding bs=4096 count=1 25 | cat u-boot.padding ${BASE_IMAGE} | dd of=u-boot.bin.padded 26 | 27 | # Align u-boot.bin to 4K for dfu 28 | filesize=$(stat -c %s u-boot.bin.padded) 29 | alignment=$(echo "4096 - (${filesize} % 4096)" | bc) 30 | if [ ${alignment} -ne 0 ]; 31 | then 32 | dd if=/dev/zero of=u-boot.bin.padded bs=1 count=${alignment} conv=notrunc seek=${filesize} 33 | fi 34 | 35 | cp u-boot.bin.padded ${BASE_IMAGE} 36 | } 37 | 38 | do_uboot_uboot_env_mkimage() { 39 | 40 | # U-Boot.img map 41 | # 0x000000 - 0x001000 | padding with 0 42 | # 0x001000 - 0x200000 | u-boot0 43 | # 0x200000 - 0x300000 | primary environment 44 | # 0x300000 - 0x500000 | reserved 45 | # 0x500000 - 0x600000 | secondary environment 46 | 47 | # U-Boot.img on eMMC in LBA (LBA size: 512 bytes) 48 | # | description | OSII | GPT label 49 | # 0x000000 - 0x000001 | MBR + OSIP | - | - 50 | # 0x000001 - 0x000022 | GPT | - | - 51 | # 0x000022 - 0x000800 | padding with 0 (alignment) | - | - 52 | # 0x000800 - 0x001800 | u-boot0 | 1 | u-boot0 53 | # 0x001800 - 0x002600 | primary environment | - | u-boot-env0 54 | # 0x002600 - 0x003600 | u-boot1 | 2 | u-boot1 55 | # 0x003600 - 0x004400 | secondary environment | - | u-boot-env1 56 | 57 | 58 | # Fill U-Boot.img with 0 59 | dd if=/dev/zero of=${UBOOT_TMP_IMG} bs=6M count=1 60 | # copy u-boot.bin in u-boot.img (u-boot0) 61 | dd if=${BASE_IMAGE} of=${UBOOT_TMP_IMG} bs=1M conv=notrunc 62 | # copy (offset 2M) u-boot_env0.bin in u-boot.img (u-boot0) 63 | dd if=${ENV_IMAGE} of=${UBOOT_TMP_IMG} bs=1M conv=notrunc seek=2 64 | # copy (offset 5M) u-boot_env1.bin in u-boot.img (u-boot0) 65 | dd if=${ENV_IMAGE} of=${UBOOT_TMP_IMG} bs=1M conv=notrunc seek=5 66 | } 67 | 68 | python do_osip_mkimage() { 69 | # 70 | # Stitch an image to create an OSIP image (OS Image Profile). 71 | # This script currently supports only one OSII (OS Image Identifier) 72 | # If more is necessary, it will need to be adjusted. 73 | # 74 | # This is the C struct for one OSII (size = 24 bytes) 75 | # struct OSII { //os image identifier 76 | # uint16_t os_rev_minor; 77 | # uint16_t os_rev_major; 78 | # uint32_t logical_start_block; //units defined by get_block_size() if 79 | # //reading/writing to/from nand, units of 80 | # //512 bytes if cracking a stitched image 81 | # uint32_t ddr_load_address; 82 | # uint32_t entry_point; 83 | # uint32_t size_of_os_image; //units defined by get_page_size() if 84 | # //reading/writing to/from nand, units of 85 | # //512 bytes if cracking a stitched image 86 | # uint8_t attribute; 87 | # uint8_t reserved[3]; 88 | # }; 89 | 90 | # This is what a full OSIP header contains 91 | # Its size is 512 bytes 92 | # Offset Size (bytes) Description 93 | # 0x000 4 OSIP Signature "$OS$" 94 | # 0x004 1 Reserved 95 | # 0x005 1 Header minor revision 96 | # 0x006 1 Header major revision 97 | # 0x007 1 Header checksum 98 | # 0x008 1 Number of pointers 99 | # 0x009 1 Number of images 100 | # 0x00a 2 Header size 101 | # 0x00c 20 Reserved 102 | # 0x020 24 1st bootable image descriptor (OSII) 103 | # 0x038 24 2nd bootable image descriptor (OSII) 104 | # ... ... ... 105 | # 0x170 24 15th bootable image descriptor (OSII) 106 | # 0x188 48 Not used 107 | # 0x1B8 4 Disk signature 108 | # 0x1BC 2 Null (0x0000) 109 | # 0x1BE 16 1st primary partition descriptor 110 | # 0x1CE 16 2nd primary partition descriptor 111 | # 0x1DE 16 3rd primary partition descriptor 112 | # 0x1EE 16 4th primary partition descriptor 113 | # 0x1FE 1 0x55 114 | # 0x1FF 1 0xaa 115 | 116 | import os 117 | import sys 118 | import argparse 119 | import struct 120 | import binascii 121 | 122 | # As only a small portion of the OSIP header needs to be changed 123 | # we simply store a full binary copy and we'll change just the 124 | # necessary values in it 125 | OSIP_HEADER_HEX_DATA = \ 126 | '244f532400000121010138000000000000000000000000000000000000' \ 127 | '00000000000000220000000000100100101001380100000f000000ffff' \ 128 | 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' \ 129 | 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' \ 130 | 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' \ 131 | 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' \ 132 | 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' \ 133 | 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' \ 134 | 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' \ 135 | 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' \ 136 | 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' \ 137 | 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' \ 138 | 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' \ 139 | 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' \ 140 | 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' \ 141 | 'ffffffffff00000000000000000000ee0000000100000000e0a3030000' \ 142 | '0000000000000000000000000000000000000000000000000000000000' \ 143 | '000000000000000000000000000000000055aa' 144 | 145 | def main(): 146 | input_file = d.getVar('UBOOT_TMP_IMG', True) 147 | output_file = d.getVar('UBOOT_IMG', True) 148 | handoff_pointer = int(d.getVar('OSIP_HANDOFF_POINTER', True)) 149 | destination_pointer = int(d.getVar('OSIP_DESTINATION_POINTER', True)) 150 | starting_lba = int(d.getVar('OSIP_STARTING_LBA', True)) 151 | 152 | in_file_data = open(input_file, 'rb').read() 153 | 154 | out_file = open(output_file, 'wb') 155 | 156 | # Write OSIP header data 157 | osip_header_data = bytearray(binascii.unhexlify(OSIP_HEADER_HEX_DATA)) 158 | 159 | # Override some values 160 | 161 | # Overrides starting LBA of imge in eMMC 162 | starting_lba_packed = struct.pack("I", starting_lba) 163 | osip_header_data[0x24:0x27+1]=starting_lba_packed 164 | 165 | # Overrides destination pointer to image in DDR 166 | destination_pointer_packed = struct.pack("I", destination_pointer) 167 | osip_header_data[0x28:0x2B+1]=destination_pointer_packed 168 | 169 | # Overrides pointer to handoff entry point in image 170 | handoff_pointer_packed = struct.pack("I", handoff_pointer) 171 | osip_header_data[0x2C:0x2F+1]=handoff_pointer_packed 172 | 173 | # The file needs to be padded to be multiple of 512 bytes 174 | 175 | # Overrides passed image size (in unit of 512 bytes blocks) 176 | # (6*1024*1024) / 512) = 6*1024*2 used here to avoid 177 | # ambiguities around division: in Python2 it is the intended 178 | # integer division, in Python3 the result is a float. 179 | padding_len_packed_block = struct.pack("I", 6*1024*2) 180 | osip_header_data[0x30:0x33+1]=padding_len_packed_block 181 | 182 | # Compute XOR checksum 183 | osip_header_size = 1*0x18+0x20 # 24 bytes per OSII + 32 bytes header 184 | osip_header_data[0x07]=0 185 | crc = osip_header_data[0] 186 | for i in range(1, osip_header_size): 187 | crc ^= osip_header_data[i] 188 | osip_header_data[0x07]=crc 189 | 190 | out_file.write(osip_header_data) 191 | 192 | # Write image content 193 | out_file.write(in_file_data) 194 | 195 | out_file.close() 196 | 197 | return 0 198 | 199 | main() 200 | } 201 | 202 | do_deploy_append() { 203 | install -d ${DEPLOYDIR} 204 | install ${UBOOT_IMG} ${DEPLOYDIR}/${UBOOT_OSIP_IMAGE} 205 | 206 | cd ${DEPLOYDIR} 207 | rm -f ${UBOOT_IMG} ${UBOOT_OSIP_SYMLINK} 208 | ln -sf ${UBOOT_OSIP_IMAGE} ${UBOOT_OSIP_SYMLINK} 209 | ln -sf ${UBOOT_OSIP_IMAGE} ${UBOOT_OSIP_BINARY} 210 | } 211 | 212 | addtask uboot_padding before do_environment_mkimage before do_deploy after do_compile 213 | addtask uboot_uboot_env_mkimage before do_osip_mkimage after do_environment_mkimage 214 | addtask osip_mkimage before do_deploy after do_uboot_uboot_env_mkimage 215 | -------------------------------------------------------------------------------- /recipes-kernel/linux-yocto/linux-yocto/0027-gpio-pca953x-add-drive-property.patch: -------------------------------------------------------------------------------- 1 | From 74c134644a773db90294cfa976c31232ba654ce0 Mon Sep 17 00:00:00 2001 2 | From: Ismo Puustinen 3 | Date: Wed, 21 Oct 2015 17:03:49 +0300 4 | Subject: [PATCH 27/27] gpio-pca953x: add "drive" property. 5 | 6 | Galileo gen 2 has support for setting GPIO modes. Expose these 7 | properties through the GPIO sysfs interface. This approach is bit hacky, 8 | since it changes the interface semantics. 9 | 10 | The original patch was by Josef Ahmad and 11 | made on top of kernel 3.8. 12 | 13 | Signed-off-by: Ismo Puustinen 14 | --- 15 | drivers/gpio/gpio-pca953x.c | 57 +++++++++++++++++++++++++++---- 16 | drivers/gpio/gpiolib-sysfs.c | 78 +++++++++++++++++++++++++++++++++++++++++++ 17 | drivers/gpio/gpiolib.c | 18 ++++++++++ 18 | drivers/gpio/gpiolib.h | 7 +++- 19 | include/asm-generic/gpio.h | 5 +++ 20 | include/linux/gpio.h | 10 ++++++ 21 | include/linux/gpio/consumer.h | 11 ++++++ 22 | include/linux/gpio/driver.h | 2 ++ 23 | 8 files changed, 180 insertions(+), 8 deletions(-) 24 | 25 | diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c 26 | index 0227cde..8f49bd6 100644 27 | --- a/drivers/gpio/gpio-pca953x.c 28 | +++ b/drivers/gpio/gpio-pca953x.c 29 | @@ -39,6 +39,9 @@ 30 | #define PCA957X_MSK 6 31 | #define PCA957X_INTS 7 32 | 33 | +#define PCA953X_PUPD_EN 35 34 | +#define PCA953X_PUPD_SEL 36 35 | + 36 | #define PCA_GPIO_MASK 0x00FF 37 | #define PCA_INT 0x0100 38 | #define PCA953X_TYPE 0x1000 39 | @@ -374,6 +377,43 @@ exit: 40 | mutex_unlock(&chip->i2c_lock); 41 | } 42 | 43 | +static int pca953x_gpio_set_drive(struct gpio_chip *gc, 44 | + unsigned off, unsigned mode) 45 | +{ 46 | + struct pca953x_chip *chip; 47 | + int ret = 0; 48 | + int val; 49 | + 50 | + chip = container_of(gc, struct pca953x_chip, gpio_chip); 51 | + 52 | + if (chip->chip_type != PCA953X_TYPE) 53 | + return -EINVAL; 54 | + 55 | + mutex_lock(&chip->i2c_lock); 56 | + 57 | + switch (mode) { 58 | + case GPIOF_DRIVE_PULLUP: 59 | + ret = pca953x_write_single(chip, PCA953X_PUPD_EN, 1, off) || 60 | + pca953x_write_single(chip, PCA953X_PUPD_SEL, 1, off); 61 | + break; 62 | + case GPIOF_DRIVE_PULLDOWN: 63 | + ret = pca953x_write_single(chip, PCA953X_PUPD_EN, 1, off) || 64 | + pca953x_write_single(chip, PCA953X_PUPD_SEL, 0, off); 65 | + break; 66 | + case GPIOF_DRIVE_STRONG: 67 | + case GPIOF_DRIVE_HIZ: 68 | + ret = pca953x_read_single(chip, PCA953X_PUPD_EN, &val, off) || 69 | + pca953x_write_single(chip, PCA953X_PUPD_EN, 0, off) || 70 | + pca953x_write_single(chip, PCA953X_PUPD_SEL, val, off); 71 | + break; 72 | + default: 73 | + ret = -EINVAL; 74 | + } 75 | + 76 | + mutex_unlock(&chip->i2c_lock); 77 | + return ret; 78 | +} 79 | + 80 | static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios) 81 | { 82 | struct gpio_chip *gc; 83 | @@ -392,6 +432,9 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios) 84 | gc->dev = &chip->client->dev; 85 | gc->owner = THIS_MODULE; 86 | gc->names = chip->names; 87 | + 88 | + if (chip->chip_type == PCA953X_TYPE) 89 | + gc->set_drive = pca953x_gpio_set_drive; 90 | } 91 | 92 | #ifdef CONFIG_GPIO_PCA953X_IRQ 93 | @@ -548,7 +591,7 @@ static irqreturn_t pca953x_irq_handler(int irq, void *devid) 94 | } 95 | 96 | static int pca953x_irq_setup(struct pca953x_chip *chip, 97 | - int irq_base) 98 | + int irq_base) 99 | { 100 | struct i2c_client *client = chip->client; 101 | int ret, i, offset = 0; 102 | @@ -591,10 +634,10 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, 103 | } 104 | 105 | ret = gpiochip_irqchip_add(&chip->gpio_chip, 106 | - &pca953x_irq_chip, 107 | - irq_base, 108 | - handle_simple_irq, 109 | - IRQ_TYPE_NONE); 110 | + &pca953x_irq_chip, 111 | + irq_base, 112 | + handle_simple_irq, 113 | + IRQ_TYPE_NONE); 114 | if (ret) { 115 | dev_err(&client->dev, 116 | "could not connect irqchip to gpiochip\n"); 117 | @@ -607,7 +650,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, 118 | 119 | #else /* CONFIG_GPIO_PCA953X_IRQ */ 120 | static int pca953x_irq_setup(struct pca953x_chip *chip, 121 | - int irq_base) 122 | + int irq_base) 123 | { 124 | struct i2c_client *client = chip->client; 125 | 126 | @@ -628,7 +671,7 @@ static int device_pca953x_init(struct pca953x_chip *chip, u32 invert) 127 | goto out; 128 | 129 | ret = pca953x_read_regs(chip, PCA953X_DIRECTION, 130 | - chip->reg_direction); 131 | + chip->reg_direction); 132 | if (ret) 133 | goto out; 134 | 135 | diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c 136 | index af3bc7a..4f90f69 100644 137 | --- a/drivers/gpio/gpiolib-sysfs.c 138 | +++ b/drivers/gpio/gpiolib-sysfs.c 139 | @@ -6,6 +6,7 @@ 140 | #include 141 | #include 142 | #include 143 | +#include 144 | 145 | #include "gpiolib.h" 146 | 147 | @@ -356,6 +357,82 @@ static ssize_t gpio_active_low_store(struct device *dev, 148 | static DEVICE_ATTR(active_low, 0644, 149 | gpio_active_low_show, gpio_active_low_store); 150 | 151 | + 152 | +static ssize_t gpio_drive_show(struct device *dev, 153 | + struct device_attribute *attr, char *buf) 154 | +{ 155 | + const struct gpio_desc *desc = dev_get_drvdata(dev); 156 | + ssize_t status; 157 | + 158 | + mutex_lock(&sysfs_lock); 159 | + 160 | + if (!test_bit(FLAG_EXPORT, &desc->flags)) { 161 | + status = -EIO; 162 | + } else { 163 | + if (test_bit(FLAG_PULLUP, &desc->flags)) 164 | + status = sprintf(buf, "pullup\n"); 165 | + else if (test_bit(FLAG_PULLDOWN, &desc->flags)) 166 | + status = sprintf(buf, "pulldown\n"); 167 | + else if (test_bit(FLAG_STRONG, &desc->flags)) 168 | + status = sprintf(buf, "strong\n"); 169 | + else if (test_bit(FLAG_HIZ, &desc->flags)) 170 | + status = sprintf(buf, "hiz\n"); 171 | + else 172 | + status = -EINVAL; 173 | + } 174 | + 175 | + mutex_unlock(&sysfs_lock); 176 | + return status; 177 | +} 178 | + 179 | +static ssize_t gpio_drive_store(struct device *dev, 180 | + struct device_attribute *attr, const char *buf, size_t size) 181 | +{ 182 | + struct gpio_desc *desc = dev_get_drvdata(dev); 183 | + ssize_t status; 184 | + 185 | + mutex_lock(&sysfs_lock); 186 | + 187 | + if (!test_bit(FLAG_EXPORT, &desc->flags)) 188 | + status = -EIO; 189 | + else { 190 | + if (sysfs_streq(buf, "pullup")) { 191 | + status = gpiod_set_drive(desc, GPIOF_DRIVE_PULLUP); 192 | + if (!status) { 193 | + desc->flags &= ~GPIO_DRIVE_MASK; 194 | + set_bit(FLAG_PULLUP, &desc->flags); 195 | + } 196 | + } else if (sysfs_streq(buf, "pulldown")) { 197 | + status = gpiod_set_drive(desc, GPIOF_DRIVE_PULLDOWN); 198 | + if (!status) { 199 | + desc->flags &= ~GPIO_DRIVE_MASK; 200 | + set_bit(FLAG_PULLDOWN, &desc->flags); 201 | + } 202 | + } else if (sysfs_streq(buf, "strong")) { 203 | + status = gpiod_set_drive(desc, GPIOF_DRIVE_STRONG); 204 | + if (!status) { 205 | + desc->flags &= ~GPIO_DRIVE_MASK; 206 | + set_bit(FLAG_STRONG, &desc->flags); 207 | + } 208 | + } else if (sysfs_streq(buf, "hiz")) { 209 | + status = gpiod_set_drive(desc, GPIOF_DRIVE_HIZ); 210 | + if (!status) { 211 | + desc->flags &= ~GPIO_DRIVE_MASK; 212 | + set_bit(FLAG_HIZ, &desc->flags); 213 | + } 214 | + } else { 215 | + status = -EINVAL; 216 | + } 217 | + } 218 | + 219 | + mutex_unlock(&sysfs_lock); 220 | + return status ? : size; 221 | +} 222 | + 223 | +static const DEVICE_ATTR(drive, 0644, 224 | + gpio_drive_show, gpio_drive_store); 225 | + 226 | + 227 | static umode_t gpio_is_visible(struct kobject *kobj, struct attribute *attr, 228 | int n) 229 | { 230 | @@ -382,6 +459,7 @@ static struct attribute *gpio_attrs[] = { 231 | &dev_attr_edge.attr, 232 | &dev_attr_value.attr, 233 | &dev_attr_active_low.attr, 234 | + &dev_attr_drive.attr, 235 | NULL, 236 | }; 237 | 238 | diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c 239 | index 6bc612b..038159b 100644 240 | --- a/drivers/gpio/gpiolib.c 241 | +++ b/drivers/gpio/gpiolib.c 242 | @@ -1127,6 +1127,24 @@ int gpiod_is_active_low(const struct gpio_desc *desc) 243 | } 244 | EXPORT_SYMBOL_GPL(gpiod_is_active_low); 245 | 246 | +int gpiod_set_drive(struct gpio_desc *desc, unsigned mode) 247 | +{ 248 | + unsigned long flags; 249 | + struct gpio_chip *chip; 250 | + 251 | + chip = desc->chip; 252 | + if (!chip || !chip->set || !chip->set_drive) 253 | + goto fail; 254 | + 255 | + might_sleep_if(chip->can_sleep); 256 | + 257 | + return chip->set_drive(chip, gpio_chip_hwgpio(desc), mode); 258 | + 259 | +fail: 260 | + return -EINVAL; 261 | +} 262 | +EXPORT_SYMBOL_GPL(gpiod_set_drive); 263 | + 264 | /* I/O calls are only valid after configuration completed; the relevant 265 | * "is this a valid GPIO" error checks should already have been done. 266 | * 267 | diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h 268 | index 594b179..2ffc2e6 100644 269 | --- a/drivers/gpio/gpiolib.h 270 | +++ b/drivers/gpio/gpiolib.h 271 | @@ -91,12 +91,17 @@ struct gpio_desc { 272 | #define FLAG_USED_AS_IRQ 9 /* GPIO is connected to an IRQ */ 273 | #define FLAG_SYSFS_DIR 10 /* show sysfs direction attribute */ 274 | #define FLAG_IS_HOGGED 11 /* GPIO is hogged */ 275 | +#define FLAG_PULLUP 12 /* Gpio drive is resistive pullup */ 276 | +#define FLAG_PULLDOWN 13 /* Gpio drive is resistive pulldown */ 277 | +#define FLAG_STRONG 14 /* Gpio drive is strong (fast output) */ 278 | +#define FLAG_HIZ 15 /* Gpio drive is Hi-Z (input) */ 279 | 280 | #define ID_SHIFT 16 /* add new flags before this one */ 281 | 282 | #define GPIO_FLAGS_MASK ((1 << ID_SHIFT) - 1) 283 | #define GPIO_TRIGGER_MASK (BIT(FLAG_TRIG_FALL) | BIT(FLAG_TRIG_RISE)) 284 | - 285 | +#define GPIO_DRIVE_MASK (BIT(FLAG_PULLUP) | BIT(FLAG_PULLDOWN) \ 286 | + | BIT(FLAG_STRONG) | BIT(FLAG_HIZ)) 287 | const char *label; 288 | }; 289 | 290 | diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h 291 | index 9bb0d11..21c9497 100644 292 | --- a/include/asm-generic/gpio.h 293 | +++ b/include/asm-generic/gpio.h 294 | @@ -76,6 +76,11 @@ static inline int gpio_set_debounce(unsigned gpio, unsigned debounce) 295 | return gpiod_set_debounce(gpio_to_desc(gpio), debounce); 296 | } 297 | 298 | +static inline int gpio_set_drive(unsigned gpio, unsigned mode) 299 | +{ 300 | + return gpiod_set_drive(gpio_to_desc(gpio), mode); 301 | +} 302 | + 303 | static inline int gpio_get_value_cansleep(unsigned gpio) 304 | { 305 | return gpiod_get_raw_value_cansleep(gpio_to_desc(gpio)); 306 | diff --git a/include/linux/gpio.h b/include/linux/gpio.h 307 | index ab81339..c22f1f6 100644 308 | --- a/include/linux/gpio.h 309 | +++ b/include/linux/gpio.h 310 | @@ -30,6 +30,11 @@ 311 | #define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT) 312 | #define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE) 313 | 314 | +#define GPIOF_DRIVE_PULLUP (1 << 7) 315 | +#define GPIOF_DRIVE_PULLDOWN (1 << 8) 316 | +#define GPIOF_DRIVE_STRONG (1 << 9) 317 | +#define GPIOF_DRIVE_HIZ (1 << 10) 318 | + 319 | /** 320 | * struct gpio - a structure describing a GPIO with configuration 321 | * @gpio: the GPIO number 322 | @@ -148,6 +153,11 @@ static inline int gpio_set_debounce(unsigned gpio, unsigned debounce) 323 | return -ENOSYS; 324 | } 325 | 326 | +static inline int gpio_set_drive(unsigned gpio, unsigned mode) 327 | +{ 328 | + return -ENOSYS; 329 | +} 330 | + 331 | static inline int gpio_get_value(unsigned gpio) 332 | { 333 | /* GPIO can never have been requested or set as {in,out}put */ 334 | diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h 335 | index 3a7c9ff..09c3fb2 100644 336 | --- a/include/linux/gpio/consumer.h 337 | +++ b/include/linux/gpio/consumer.h 338 | @@ -121,6 +121,8 @@ void gpiod_set_raw_array_cansleep(unsigned int array_size, 339 | 340 | int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce); 341 | 342 | +int gpiod_set_drive(struct gpio_desc *desc, unsigned mode); 343 | + 344 | int gpiod_is_active_low(const struct gpio_desc *desc); 345 | int gpiod_cansleep(const struct gpio_desc *desc); 346 | 347 | @@ -375,6 +377,15 @@ static inline int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce) 348 | return -ENOSYS; 349 | } 350 | 351 | + 352 | +static inline int gpiod_set_drive(unsigned gpio, unsigned mode) 353 | +{ 354 | + /* GPIO can never have been requested */ 355 | + WARN_ON(1); 356 | + return -ENOSYS; 357 | +} 358 | + 359 | + 360 | static inline int gpiod_is_active_low(const struct gpio_desc *desc) 361 | { 362 | /* GPIO can never have been requested */ 363 | diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h 364 | index f1b3659..2f19b34 100644 365 | --- a/include/linux/gpio/driver.h 366 | +++ b/include/linux/gpio/driver.h 367 | @@ -97,6 +97,8 @@ struct gpio_chip { 368 | int (*set_debounce)(struct gpio_chip *chip, 369 | unsigned offset, 370 | unsigned debounce); 371 | + int (*set_drive)(struct gpio_chip *chip, 372 | + unsigned offset, unsigned mode); 373 | 374 | int (*to_irq)(struct gpio_chip *chip, 375 | unsigned offset); 376 | -- 377 | 2.4.3 378 | 379 | --------------------------------------------------------------------------------