Merge branch 'dey-2.2/master' into dey-2.2/maint

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2017-11-29 19:03:46 +01:00
commit 7937aade49
254 changed files with 8964 additions and 13758 deletions

View File

@ -1,5 +1,5 @@
# Digi Embedded Yocto (DEY) 2.2
## Release 2.2-r2
## Release 2.2-r3
This document provides information about Digi Embedded Yocto,
Digi International's professional embedded Yocto development environment.
@ -9,6 +9,14 @@ Digi Embedded Yocto 2.2 is based on the Yocto Project(TM) 2.2 (Morty) release.
For a full list of supported features and interfaces please refer to the
online documentation.
# Tested OS versions
The current release has been verified and tested with the following
OS versions:
* Ubuntu 16.04
* Ubuntu 14.04
# Supported Platforms
The current release supports the following hardware platforms:
@ -71,6 +79,16 @@ Documentation is available online on the Digi documentation site:
# Release Changelog
## 2.2-r3
* Added Digi APIX C library to access and manage ConnectCore platforms interfaces:
* ADC
* GPIO
* I2C
* PWM
* SPI
* Updated AWS Greengrass Core software to v1.1.0
## 2.2-r2
* Fix for KRACK Attack vulnerability:
@ -146,6 +164,9 @@ boot a signed U-Boot only.
* Cloud Connector
* Remote file system management fails with long file names and paths
(over 255 characters).
* For P2P connections Digi recommends "Negotiated GO" modes. The QCA6564
devices (ConnectCore 6UL and ConnectCore 6 Plus) running a 4.9 kernel
version fail to join to autonomous groups.
## Digi ConnectCore 6UL

View File

@ -29,4 +29,4 @@ Support
-------
This layer is provided 'as is' with no guarantee. However, some support
may be available from support@digi.com
may be available from tech.support@digi.com

View File

@ -298,65 +298,5 @@ IMAGE_CMD_sdcard() {
dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc,fsync seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024 + ${BOOT_SPACE_ALIGNED} \* 1024)
}
#
# Create an image that can by written onto a SD card using dd (for ccardimx28 family)
#
# The disk layout used is:
#
# 1. Not partitioned : reserved for bootloader (u-boot at 1MiB offset)
# 2. BOOT PARTITION : kernel and device tree blobs
# 3. ROOTFS PARTITION : rootfs
#
# 4MiB BOOT_SPACE ROOTFS_SIZE
# <----------------> <--------------------> <------------------------------>
# +---+--------------+----------------------+--------------------------------+
# | | U-BOOT (RAW) | BOOT PARTITION (FAT) | ROOTFS PARTITION (EXT4) |
# +---+--------------+----------------------+--------------------------------+
# ^ ^ ^ ^ ^
# | | | | |
# 0 1MiB 4MiB 4MiB + BOOT_SPACE SDIMG_SIZE
#
IMAGE_CMD_sdcard_ccardimx28() {
# Align boot partition and calculate total sdcard image size
BOOT_SPACE_ALIGNED="$(expr \( \( ${BOARD_BOOTIMAGE_PARTITION_SIZE} + ${IMAGE_ROOTFS_ALIGNMENT} - 1 \) / ${IMAGE_ROOTFS_ALIGNMENT} \) \* ${IMAGE_ROOTFS_ALIGNMENT})"
SDIMG_SIZE="$(expr ${IMAGE_ROOTFS_ALIGNMENT} + ${BOOT_SPACE_ALIGNED} + $ROOTFS_SIZE)"
# Initialize sdcard image file
dd if=/dev/zero of=${SDIMG} bs=1024 count=0 seek=${SDIMG_SIZE}
#
# Bootstream header for u-boot at 1M offset
#
# The offset is coded in bytes 29-32 in little-endian. The
# value to set is the offset in 512 bytes blocks + 1.
#
# For 1M offset we can calculate the bytes:
#
# printf '%08x' 2049 | grep -o .. | tac | tr -d '\n'
#
BS_HDR="\x33\x22\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x08\x00\x00\x00\x00\x00\x00"
# Use 'printf' command and not shell builtins because hexadecimal
# format does not work well with 'dash' shell
PRINTF="$(which printf)"
# Create partition table, boot partition (with bootable flag) and rootfs partition (to the end of the disk)
parted -s ${SDIMG} mklabel msdos
parted -s ${SDIMG} unit KiB mkpart primary 1024 ${IMAGE_ROOTFS_ALIGNMENT}
parted -s ${SDIMG} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED})
parted -s ${SDIMG} set 2 boot on
parted -s ${SDIMG} -- unit KiB mkpart primary ext2 $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED}) -1s
parted -s ${SDIMG} unit KiB print
# Change partition type to 0x53 for mxs processor family and write bootstream header
echo -n S | dd of=${SDIMG} bs=1 count=1 seek=450 conv=notrunc
${PRINTF} "${BS_HDR}" | dd of=${SDIMG} bs=512 seek=$(expr 1024 \* 2) conv=notrunc,sync
# Burn bootloader, boot and rootfs partitions
dd if=${DEPLOY_DIR_IMAGE}/${UBOOT_SYMLINK} of=${SDIMG} conv=notrunc,fsync seek=$(expr 1024 \* 2 \+ 1) bs=512
dd if=${SDIMG_BOOTFS} of=${SDIMG} conv=notrunc,fsync seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024)
dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc,fsync seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024 + ${BOOT_SPACE_ALIGNED} \* 1024)
}
# The sdcard image requires the boot and rootfs images to be built before
IMAGE_TYPEDEP_sdcard = "${SDIMG_BOOTFS_TYPE} ${SDIMG_ROOTFS_TYPE}"

View File

@ -1,28 +0,0 @@
#@TYPE: Machine
#@NAME: ConnectCore for MX28 JumpStart Kit.
#@DESCRIPTION: Machine configuration for Digi's ConnectCore for MX28 JSK.
include conf/machine/include/ccardimx28.inc
# U-Boot configurations
UBOOT_CONFIG ??= "ccardimx28js"
UBOOT_CONFIG[ccardimx28js] = "ccardimx28js_config"
KERNEL_DEVICETREE = "imx28-${MACHINE}.dtb"
# Serial console
SERIAL_CONSOLES ?= "115200;ttyAMA0"
# Bluetooth tty
BT_TTY ?= "ttyAPP0"
# U-Boot script to be copied to the SD image
BOOT_SCRIPTS = "boot.scr:boot.scr"
# Flash image types
IMAGE_FSTYPES ?= "jffs2.sum sdcard tar.bz2 ubifs"
# FLASH parameters
MKUBIFS_ARGS ?= "-m 2048 -e 126976 -c 2047"
EXTRA_IMAGECMD_jffs2 ?= "-l -e 128 -n"
JFFS2_SUM_EXTRA_ARGS ?= "${EXTRA_IMAGECMD_jffs2}"

View File

@ -0,0 +1,42 @@
#@TYPE: Machine
#@NAME: ConnectCore 6 QuadPlus Single Board Computer.
#@DESCRIPTION: Machine configuration for Digi's ConnectCore 6 QuadPlus SBC.
# Include the machine configuration for Digi's ConnectCore 6 module.
include conf/machine/include/ccimx6.inc
# Wireless external module
WIRELESS_MODULE_append = " ${@base_conditional('HAVE_WIFI', '1', 'kernel-module-qualcomm', '', d)}"
# Wireless p2p interface
WLAN_P2P_INTERFACE ?= "p2p0"
MACHINE_EXTRA_RRECOMMENDS += "cryptoauthlib"
# Firmware
MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_BT', '1', 'firmware-qualcomm-qca6564-bt', '', d)}"
MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_WIFI', '1', 'firmware-qualcomm-qca6564-wifi', '', d)}"
PREFERRED_PROVIDER_virtual/libg2d_mx6 = "imx-gpu-g2d"
# U-Boot configurations
# Last one is the default (the one the symlinks point at)
UBOOT_CONFIG ??= "ccimx6qpsbc2GB"
UBOOT_CONFIG[ccimx6qpsbc2GB] = "ccimx6qpsbc2GB_defconfig"
KERNEL_DEVICETREE ?= " \
imx6qp-ccimx6qpsbc.dtb \
imx6qp-ccimx6qpsbc-id160.dtb \
imx6qp-ccimx6qpsbc-wb.dtb \
"
SERIAL_CONSOLES ?= "115200;ttymxc3"
# Bluetooth tty
BT_TTY ?= "ttymxc1"
# U-Boot script to be copied to the boot image
BOOT_SCRIPTS = "boot.scr:boot.scr"
# Flash image types
IMAGE_FSTYPES ?= "boot.vfat ext4 sdcard tar.bz2 recovery.vfat"

View File

@ -5,6 +5,17 @@
# Contains the ConnectCore 6 module.
include conf/machine/include/ccimx6.inc
# To be removed (rng-tools) once kernel 3.14 is deprecated
MACHINE_EXTRA_RRECOMMENDS += "rng-tools"
# Firmware
MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_BT', '1' , 'firmware-atheros-ar3k', '', d)}"
MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_WIFI', '1' , 'firmware-atheros-ath6kl', '', d)}"
PREFERRED_VERSION_imx-gpu-viv ?= "5.0.11.p8.6-hfp"
PREFERRED_VERSION_kernel-module-imx-gpu-viv ?= "5.0.11.p8.6+fslc%"
PREFERRED_VERSION_xf86-video-imxfb-vivante ?= "5.0.11.p8.6"
# U-Boot configurations
# Last one is the default (the one the symlinks point at)
UBOOT_CONFIG ??= "ccimx6dlsbc512MB ccimx6dlsbc ccimx6qsbc2GB ccimx6qsbc512MB ccimx6qsbc"
@ -14,6 +25,9 @@ UBOOT_CONFIG[ccimx6qsbc2GB] = "ccimx6qsbc2GB_defconfig"
UBOOT_CONFIG[ccimx6qsbc512MB] = "ccimx6qsbc512MB_defconfig"
UBOOT_CONFIG[ccimx6qsbc] = "ccimx6qsbc_defconfig"
# Use uImage for backwards compatibility
KERNEL_IMAGETYPE = "uImage"
KERNEL_DEVICETREE ?= " \
imx6dl-ccimx6sbc.dtb \
imx6dl-ccimx6sbc-w.dtb \

View File

@ -24,12 +24,11 @@ KERNEL_DEVICETREE ?= " \
imx6ul-ccimx6ulsbc.dtb \
imx6ul-ccimx6ulsbc-wb.dtb \
imx6ul-ccimx6ulsbc-id135.dtb \
imx6ul-ccimx6ulsbc-id136.dtb \
"
SERIAL_CONSOLES ?= "115200;ttymxc4"
MACHINE_FEATURES += "second-eth"
# Bluetooth tty
BT_TTY ?= "ttymxc0"

View File

@ -1,47 +0,0 @@
#@TYPE: Machine
#@NAME: ConnectCore for MX28 module.
#@DESCRIPTION: Machine configuration for Digi's ConnectCore for MX28 module.
DIGI_FAMILY = "ccardimx28"
MACHINEOVERRIDES =. "mxs:mx28:${DIGI_FAMILY}:"
include conf/machine/include/imx-digi-base.inc
include conf/machine/include/tune-arm926ejs.inc
# Platform u-boot settings
UBOOT_ENTRYPOINT = "0x40008000"
UBOOT_SUFFIX = "sb"
UBOOT_SYMLINK = "u-boot-${MACHINE}.${UBOOT_SUFFIX}"
# Wireless external module
WIRELESS_MODULE ?= ""
WIRELESS_MODULE_append = " ${@bb.utils.contains('MACHINE_FEATURES', 'wifi', 'kernel-module-atheros', '', d)}"
# Firmware
MACHINE_FIRMWARE ?= ""
MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_BT', '1' , 'firmware-atheros-ar3k', '', d)}"
MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_WIFI', '1' , 'firmware-atheros-ath6kl', '', d)}"
MACHINE_EXTRA_RDEPENDS += "mtd-utils-ubifs nvram ubootenv update-flash"
MACHINE_EXTRA_RRECOMMENDS += "${MACHINE_FIRMWARE} ${WIRELESS_MODULE}"
#
# Supported variants
#
# Maintain in sync with the same table in platform local.conf template.
#
# Name WiFi Eth2 BT 1wire
# -------------------------------------------
# - N N N N (empty MACHINE_VARIANT="")
# e N Y N N
# w Y N N N
# wb Y N Y N
# web Y Y Y N
# web1 Y Y Y Y
# Per-variant machine features
MACHINE_FEATURES_append_e = " second-eth"
MACHINE_FEATURES_append_w = " wifi"
MACHINE_FEATURES_append_wb = " wifi bluetooth"
MACHINE_FEATURES_append_web = " wifi second-eth bluetooth"
MACHINE_FEATURES_append_web1 = " wifi second-eth bluetooth 1-wire"

View File

@ -20,8 +20,6 @@ WIRELESS_MODULE ?= ""
MACHINE_FIRMWARE ?= ""
MACHINE_FIRMWARE_append_mx6q = " firmware-imx-vpu-imx6q"
MACHINE_FIRMWARE_append_mx6dl = " firmware-imx-vpu-imx6d"
MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_BT', '1' , 'firmware-atheros-ar3k', '', d)}"
MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_WIFI', '1' , 'firmware-atheros-ath6kl', '', d)}"
MACHINE_EXTRA_RDEPENDS += " \
e2fsprogs-mke2fs \
@ -30,6 +28,6 @@ MACHINE_EXTRA_RDEPENDS += " \
u-boot-fw-utils \
"
MACHINE_EXTRA_RRECOMMENDS += "${MACHINE_FIRMWARE} ${WIRELESS_MODULE}"
MACHINE_EXTRA_RRECOMMENDS += "imx-alsa-plugins cryptodev-module rng-tools"
MACHINE_EXTRA_RRECOMMENDS += "imx-alsa-plugins cryptodev-module"
MACHINE_FEATURES += "accel-graphics accel-video wifi bluetooth"

View File

@ -36,8 +36,6 @@ MACHINE_FEATURES += "wifi bluetooth"
MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_BT', '1', 'firmware-qualcomm-qca6564-bt', '', d)}"
MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_WIFI', '1', 'firmware-qualcomm-qca6564-wifi', '', d)}"
KERNEL_IMAGETYPE = "zImage"
# mkfs.ubifs parameters for boot partition (the one holding kernel and device tree files)
# Max LEB count (-c 255) calculated for a partition of up to 32 MiB considering 128 KiB erase-block size.
MKUBIFS_BOOT_ARGS ?= "-m 2048 -e 126976 -c 255"

View File

@ -10,18 +10,15 @@ PREFERRED_PROVIDER_virtual/xserver = "xserver-xorg"
#
# Platform Linux U-Boot
# -------------------------------------------------
# ccardimx28 3.10 2013.01
# ccimx6 4.1, 3.14 2015.04
# ccimx6ul 4.1 2015.04
# ccimx6qp 4.9 2015.04
# ccimx6ul 4.9, 4.1 2015.04
#
# Help variables used in recipes
HAVE_WIFI = "${@bb.utils.contains('MACHINE_FEATURES', 'wifi', '1', '', d)}"
HAVE_SECOND_ETH = "${@bb.utils.contains('MACHINE_FEATURES', 'second-eth', '1', '', d)}"
HAVE_BT = "${@bb.utils.contains('MACHINE_FEATURES', 'bluetooth', '1', '', d)}"
HAVE_1WIRE = "${@bb.utils.contains('MACHINE_FEATURES', '1-wire', '1', '', d)}"
HAVE_GUI = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '1', '', d)}"
HAVE_EXAMPLE = "${@bb.utils.contains('IMAGE_FEATURES', 'dey-examples', '1', '', d)}"
#
# Ethernet configuration used in recipes

View File

@ -88,7 +88,7 @@ PREFERRED_PROVIDER_virtual/libg2d_mx6ul = ""
EXTRA_IMAGEDEPENDS = "u-boot"
KERNEL_IMAGETYPE = "uImage"
KERNEL_IMAGETYPE = "zImage"
MACHINE_FEATURES = "usbgadget usbhost vfat alsa touchscreen"

View File

@ -10,20 +10,8 @@ SRC_URI_append_ccimx6 = " \
file://asound.play.state \
"
SRC_URI_append_ccardimx28 = " \
file://asound.inline_play.state \
file://asound.inline.state \
file://asound.micro_play.state \
file://asound.micro.state \
file://asound.play.state \
"
SRC_URI_append_ccimx6ul = " file://asound.state"
do_install_append_ccimx6() {
ln -sf asound.micro_play.state ${D}${localstatedir}/lib/alsa/asound.state
}
do_install_append_ccardimx28() {
ln -sf asound.micro_play.state ${D}${localstatedir}/lib/alsa/asound.state
}

View File

@ -1,114 +0,0 @@
state.mxssgtl5000 {
control.1 {
iface MIXER
name 'PCM Playback Volume'
value.0 154
value.1 154
comment {
access 'read write'
type INTEGER
count 2
range '0 - 192'
}
}
control.2 {
iface MIXER
name 'Capture Volume'
value.0 11
value.1 11
comment {
access 'read write'
type INTEGER
count 2
range '0 - 15'
}
}
control.3 {
iface MIXER
name 'Capture Attenuate Switch (-6dB)'
value 0
comment {
access 'read write'
type INTEGER
count 1
range '0 - 2'
dbmin -600
dbmax 600
dbvalue.0 -600
}
}
control.4 {
iface MIXER
name 'Capture ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.5 {
iface MIXER
name 'Headphone Playback Volume'
value.0 115
value.1 115
comment {
access 'read write'
type INTEGER
count 2
range '0 - 127'
dbmin -5150
dbmax 1200
dbvalue.0 600
dbvalue.1 600
}
}
control.6 {
iface MIXER
name 'Headphone Playback ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.7 {
iface MIXER
name 'Mic Volume'
value 2
comment {
access 'read write'
type INTEGER
count 1
range '0 - 3'
dbmin 0
dbmax 4000
dbvalue.0 3000
}
}
control.8 {
iface MIXER
name 'Headphone Mux'
value LINE_IN
comment {
access 'read write'
type ENUMERATED
count 1
item.0 DAC
item.1 LINE_IN
}
}
control.9 {
iface MIXER
name 'Capture Mux'
value LINE_IN
comment {
access 'read write'
type ENUMERATED
count 1
item.0 MIC_IN
item.1 LINE_IN
}
}
}

View File

@ -1,114 +0,0 @@
state.mxssgtl5000 {
control.1 {
iface MIXER
name 'PCM Playback Volume'
value.0 154
value.1 154
comment {
access 'read write'
type INTEGER
count 2
range '0 - 192'
}
}
control.2 {
iface MIXER
name 'Capture Volume'
value.0 11
value.1 11
comment {
access 'read write'
type INTEGER
count 2
range '0 - 15'
}
}
control.3 {
iface MIXER
name 'Capture Attenuate Switch (-6dB)'
value 0
comment {
access 'read write'
type INTEGER
count 1
range '0 - 2'
dbmin -600
dbmax 600
dbvalue.0 -600
}
}
control.4 {
iface MIXER
name 'Capture ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.5 {
iface MIXER
name 'Headphone Playback Volume'
value.0 115
value.1 115
comment {
access 'read write'
type INTEGER
count 2
range '0 - 127'
dbmin -5150
dbmax 1200
dbvalue.0 600
dbvalue.1 600
}
}
control.6 {
iface MIXER
name 'Headphone Playback ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.7 {
iface MIXER
name 'Mic Volume'
value 2
comment {
access 'read write'
type INTEGER
count 1
range '0 - 3'
dbmin 0
dbmax 4000
dbvalue.0 3000
}
}
control.8 {
iface MIXER
name 'Headphone Mux'
value DAC
comment {
access 'read write'
type ENUMERATED
count 1
item.0 DAC
item.1 LINE_IN
}
}
control.9 {
iface MIXER
name 'Capture Mux'
value LINE_IN
comment {
access 'read write'
type ENUMERATED
count 1
item.0 MIC_IN
item.1 LINE_IN
}
}
}

View File

@ -1,188 +0,0 @@
state.ccardxmx28 {
control.1 {
comment.access 'read write'
comment.type ENUMERATED
comment.count 1
comment.item.0 '0dB'
comment.item.1 '20dB'
comment.item.2 '30dB'
comment.item.3 '40dB'
iface MIXER
name 'MIC GAIN'
value '0dB'
}
control.2 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 15'
iface MIXER
name 'Capture Volume'
value.0 15
value.1 15
}
control.3 {
comment.access 'read write'
comment.type ENUMERATED
comment.count 1
comment.item.0 'No Change'
comment.item.1 'Reduced by 6dB'
iface MIXER
name 'Capture Vol Reduction'
value 'No Change'
}
control.4 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 192'
iface MIXER
name 'Playback Volume'
value.0 132
value.1 132
}
control.5 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 127'
iface MIXER
name 'Headphone Volume'
value.0 103
value.1 103
}
control.6 {
comment.access 'read write'
comment.type ENUMERATED
comment.count 1
comment.item.0 DAC
comment.item.1 LINE_IN
iface MIXER
name 'DAC Mux'
value DAC
}
control.7 {
comment.access 'read write'
comment.type ENUMERATED
comment.count 1
comment.item.0 MIC_IN
comment.item.1 LINE_IN
iface MIXER
name 'ADC Mux'
value MIC_IN
}
}
state.mxssgtl5000 {
control.1 {
iface MIXER
name 'PCM Playback Volume'
value.0 138
value.1 138
comment {
access 'read write'
type INTEGER
count 2
range '0 - 192'
}
}
control.2 {
iface MIXER
name 'Capture Volume'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 15'
}
}
control.3 {
iface MIXER
name 'Capture Attenuate Switch (-6dB)'
value 2
comment {
access 'read write'
type INTEGER
count 1
range '0 - 2'
dbmin -600
dbmax 600
dbvalue.0 600
}
}
control.4 {
iface MIXER
name 'Capture ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.5 {
iface MIXER
name 'Headphone Playback Volume'
value.0 103
value.1 103
comment {
access 'read write'
type INTEGER
count 2
range '0 - 127'
dbmin -5150
dbmax 1200
dbvalue.0 0
dbvalue.1 0
}
}
control.6 {
iface MIXER
name 'Headphone Playback ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.7 {
iface MIXER
name 'Mic Volume'
value 1
comment {
access 'read write'
type INTEGER
count 1
range '0 - 3'
dbmin 0
dbmax 4000
dbvalue.0 2000
}
}
control.8 {
iface MIXER
name 'Headphone Mux'
value LINE_IN
comment {
access 'read write'
type ENUMERATED
count 1
item.0 DAC
item.1 LINE_IN
}
}
control.9 {
iface MIXER
name 'Capture Mux'
value MIC_IN
comment {
access 'read write'
type ENUMERATED
count 1
item.0 MIC_IN
item.1 LINE_IN
}
}
}

View File

@ -1,114 +0,0 @@
state.mxssgtl5000 {
control.1 {
iface MIXER
name 'PCM Playback Volume'
value.0 138
value.1 138
comment {
access 'read write'
type INTEGER
count 2
range '0 - 192'
}
}
control.2 {
iface MIXER
name 'Capture Volume'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 15'
}
}
control.3 {
iface MIXER
name 'Capture Attenuate Switch (-6dB)'
value 2
comment {
access 'read write'
type INTEGER
count 1
range '0 - 2'
dbmin -600
dbmax 600
dbvalue.0 600
}
}
control.4 {
iface MIXER
name 'Capture ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.5 {
iface MIXER
name 'Headphone Playback Volume'
value.0 103
value.1 103
comment {
access 'read write'
type INTEGER
count 2
range '0 - 127'
dbmin -5150
dbmax 1200
dbvalue.0 0
dbvalue.1 0
}
}
control.6 {
iface MIXER
name 'Headphone Playback ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.7 {
iface MIXER
name 'Mic Volume'
value 1
comment {
access 'read write'
type INTEGER
count 1
range '0 - 3'
dbmin 0
dbmax 4000
dbvalue.0 2000
}
}
control.8 {
iface MIXER
name 'Headphone Mux'
value DAC
comment {
access 'read write'
type ENUMERATED
count 1
item.0 DAC
item.1 LINE_IN
}
}
control.9 {
iface MIXER
name 'Capture Mux'
value MIC_IN
comment {
access 'read write'
type ENUMERATED
count 1
item.0 MIC_IN
item.1 LINE_IN
}
}
}

View File

@ -1,114 +0,0 @@
state.mxssgtl5000 {
control.1 {
iface MIXER
name 'PCM Playback Volume'
value.0 142
value.1 142
comment {
access 'read write'
type INTEGER
count 2
range '0 - 192'
}
}
control.2 {
iface MIXER
name 'Capture Volume'
value.0 11
value.1 11
comment {
access 'read write'
type INTEGER
count 2
range '0 - 15'
}
}
control.3 {
iface MIXER
name 'Capture Attenuate Switch (-6dB)'
value 0
comment {
access 'read write'
type INTEGER
count 1
range '0 - 2'
dbmin -600
dbmax 600
dbvalue.0 -600
}
}
control.4 {
iface MIXER
name 'Capture ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.5 {
iface MIXER
name 'Headphone Playback Volume'
value.0 115
value.1 115
comment {
access 'read write'
type INTEGER
count 2
range '0 - 127'
dbmin -5150
dbmax 1200
dbvalue.0 600
dbvalue.1 600
}
}
control.6 {
iface MIXER
name 'Headphone Playback ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.7 {
iface MIXER
name 'Mic Volume'
value 2
comment {
access 'read write'
type INTEGER
count 1
range '0 - 3'
dbmin 0
dbmax 4000
dbvalue.0 3000
}
}
control.8 {
iface MIXER
name 'Headphone Mux'
value DAC
comment {
access 'read write'
type ENUMERATED
count 1
item.0 DAC
item.1 LINE_IN
}
}
control.9 {
iface MIXER
name 'Capture Mux'
value LINE_IN
comment {
access 'read write'
type ENUMERATED
count 1
item.0 MIC_IN
item.1 LINE_IN
}
}
}

View File

@ -1,4 +1,4 @@
# Copyright (C) 2013 Digi International.
# Copyright (C) 2013-2017 Digi International.
SUMMARY = "Firmware files for Digi's platforms, such as Atheros bluetooth."
SECTION = "base"
@ -8,6 +8,8 @@ LIC_FILES_CHKSUM = "file://${DIGI_EULA_FILE};md5=8c0ad592dd48ace3d25eed5bbb26ba7
FW_ATH6KL = " \
file://athtcmd_ram.bin \
file://athwlan.bin \
file://Digi_6203_2_ANT-US.bin \
file://Digi_6203_2_ANT-World.bin \
file://Digi_6203-6233-US.bin \
file://Digi_6203-6233-World.bin \
file://fw-4.bin \
@ -15,11 +17,6 @@ FW_ATH6KL = " \
file://utf.bin \
"
FW_ATH6KL_append_ccimx6 = " \
file://Digi_6203_2_ANT-US.bin \
file://Digi_6203_2_ANT-World.bin \
"
FW_AR3K = " \
file://PS_ASIC_class_1.pst \
file://PS_ASIC_class_2.pst \
@ -49,6 +46,8 @@ do_install() {
install -m 0644 \
athtcmd_ram.bin \
athwlan.bin \
Digi_6203_2_ANT-US.bin \
Digi_6203_2_ANT-World.bin \
Digi_6203-6233-US.bin \
Digi_6203-6233-World.bin \
fw-4.bin \
@ -63,13 +62,6 @@ do_install() {
ln -sf Digi_6203-6233-US.bin ${D}${base_libdir}/firmware/ath6k/AR6003/hw2.1.1/bdata.0x0.bin
ln -sf Digi_6203-6233-World.bin ${D}${base_libdir}/firmware/ath6k/AR6003/hw2.1.1/bdata.0x1.bin
ln -sf Digi_6203-6233-World.bin ${D}${base_libdir}/firmware/ath6k/AR6003/hw2.1.1/bdata.0x2.bin
}
do_install_append_ccimx6() {
install -m 0644 \
Digi_6203_2_ANT-US.bin \
Digi_6203_2_ANT-World.bin \
${D}${base_libdir}/firmware/ath6k/AR6003/hw2.1.1/
ln -sf Digi_6203_2_ANT-US.bin ${D}${base_libdir}/firmware/ath6k/AR6003/hw2.1.1/bdata.ANT-0x0.bin
ln -sf Digi_6203_2_ANT-World.bin ${D}${base_libdir}/firmware/ath6k/AR6003/hw2.1.1/bdata.ANT-0x1.bin
ln -sf Digi_6203_2_ANT-World.bin ${D}${base_libdir}/firmware/ath6k/AR6003/hw2.1.1/bdata.ANT-0x2.bin
@ -82,4 +74,4 @@ FILES_${PN}-ar3k = "/lib/firmware/ar3k"
FILES_${PN}-ath6kl = "/lib/firmware/ath6k"
PACKAGE_ARCH = "${MACHINE_ARCH}"
COMPATIBLE_MACHINE = "(ccardimx28|ccimx6$)"
COMPATIBLE_MACHINE = "(ccimx6sbc)"

View File

@ -1,126 +0,0 @@
// Radio table TAG
#
[H:S]012C
[H:S]00EE
[H:A]B1 B1 12 00 B8 08 FE FE 7D 00 17 00 00 20 02 00
0C 09 00 14 00 00 8C 08 00 00 00 40 80 08 78 00
00 01 84 08 AD AC 80 5F 88 08 20 3F 00 41 8C 08
00 00 00 40 94 08 54 25 64 92 98 08 C8 4E 2C 2E
9C 08 C0 20 DA 2C C0 08 B6 0D 01 00 C4 08 6C DB
B6 6D C8 08 DB 36 D3 6D CC 08 60 DB B6 6D 00 09
50 00 92 04 04 09 20 49 00 80 08 09 E0 6F 5B E5
0C 09 00 14 00 00 10 09 81 03 30 F0 14 09 80 80
43 00 18 09 00 00 00 80 1C 09 00 00 00 00 20 09
02 00 00 00 88 0A 00 60 77 58 61 00 00 60 02 00
04 07 C4 C1 8B 00 1C 00 00 05 90 01 0C 07 00 0D
00 00 30 00 D8 70 EF 4A 7C 00 B0 D2 5A B1 78 00
DE 7A 58 00 5C 00 01 00 14 01 44 00 00 00 10 E4
84 00 3F F0 E7 04 C0 00 90 01 2C 00 C4 00 80 D6
82 03 DC 00 D8 40 06 00 88 00 52 6C 3D 0E
// Radio table TAG
#
[H:S]012D
[H:S]00F0
[H:A]94 00 41 06 00 00 80 00 20 9C C8 00 90 00 DD DD
97 06 54 00 E0 A6 09 00 10 07 3D A0 00 3D 14 07
A0 80 01 00 18 07 17 55 D1 0C 1C 07 6D 23 00 00
C0 07 65 A8 0C 0B E4 07 27 CA 54 00 C4 07 FF FF
FF 3F C8 07 FF FF E3 3F CC 07 FF FF FF 3F D0 07
FF FF FF 3F D4 07 3F FE FF 3F D8 07 FF FF FF 3F
DC 07 FF FF FF 38 E0 07 FF FF FF 3F BC 07 D8 05
00 00 B8 07 42 00 0B 00 00 05 4A 1C 00 00 04 05
8A 1C 00 00 08 05 CA 1C 00 00 0C 05 0A 1D 00 00
10 05 4A 1D 00 00 14 05 1A 1C 00 00 18 05 5A 1C
00 00 1C 05 9A 1C 00 00 20 05 DA 1C 00 00 24 05
1A 1D 00 00 28 05 5A 1D 00 00 2C 05 2A 1C 00 00
30 05 6A 1C 00 00 34 05 AA 1C 00 00 38 05 EA 1C
00 00 3C 05 2A 1D 00 00 40 05 6A 1D 00 00 44 05
3A 1C 00 00 48 05 2B 1C 00 00 4C 05 6B 1C 00 00
// Radio table TAG
#
[H:S]012E
[H:S]00F0
[H:A]50 05 AB 1C 00 00 54 05 EB 1C 00 00 58 05 2B 1D
00 00 5C 05 5C 1D 00 00 60 05 2C 1C 00 00 64 05
6C 1C 00 00 68 05 AC 1C 00 00 6C 05 1D 1D 00 00
70 05 2D 1C 00 00 74 05 6D 1C 00 00 78 05 AD 1C
00 00 7C 05 ED 1C 00 00 80 05 2D 1D 00 00 84 05
6D 1D 00 00 88 05 3D 1C 00 00 8C 05 7D 1C 00 00
90 05 AE 1C 00 00 94 05 EE 1C 00 00 98 05 2E 1D
00 00 9C 05 6E 1D 00 00 A0 05 3E 1C 00 00 A4 05
7E 1C 00 00 A8 05 BE 1C 00 00 AC 05 2F 1C 00 00
B0 05 6F 1C 00 00 B4 05 AF 1C 00 00 B8 05 EF 1C
00 00 BC 05 2F 1D 00 00 C0 05 6F 1D 00 00 C4 05
AF 1D 00 00 C8 05 BF 00 00 00 CC 05 FF 1C 00 00
D0 05 3F 01 00 00 D4 05 7F 01 00 00 D8 05 BF 01
00 00 DC 05 FF 01 00 00 E0 05 3F 02 00 00 E4 05
7F 12 00 00 E8 05 BF 02 00 00 EC 05 FF 02 00 00
// Radio table TAG
#
[H:S]012F
[H:S]0044
[H:A]F0 05 3F 03 00 00 F4 05 7F 03 00 00 F8 05 BF 03
00 00 FC 05 FF 03 00 00 04 00 00 00 02 00 10 00
01 CE C0 10 14 00 07 04 00 00 A0 04 00 E9 FF 03
BC 04 FF 41 00 00 01 00 00 C0 02 00 B8 01 01 00
00 00 B2 B2
// System config TAG
#
[H:S]0013
[H:S]00F0
[H:A]C1 C1 20 02 BD 08 FE FE C9 00 00 CC B1 01 20 00
FF CC 02 CC 04 00 B6 FB A9 90 00 21 00 E0 FF CC
08 CC 1E 00 80 84 00 07 DB 05 93 11 FF CC 0E CC
0B 00 E4 FF 61 47 00 00 4D FD 61 47 00 00 58 FD
E8 FF 41 27 04 00 6F FD 41 27 04 00 6C FD EC FF
A0 A7 00 00 2F FD A0 A7 00 00 6D FD F0 FF 60 27
01 00 50 FD 60 27 01 00 6F FD F4 FF A0 C7 04 00
3A FD A0 C7 04 00 89 FD F8 FF 80 C7 08 00 12 FD
80 C7 08 00 58 FD FC FF 40 47 09 00 66 FD 40 47
09 00 0B FD 00 00 80 C7 0D 00 09 FD 80 C7 0D 00
09 FD 04 00 20 47 0E 40 58 FD 20 47 0E 40 58 FD
08 00 60 47 13 40 58 FD 60 47 13 40 58 FD 0C 00
00 E7 13 40 58 FD 00 E7 13 40 58 FD FF CC 0F CC
01 01 01 01 07 04 03 33 00 0A 00 04 00 00 60 6D
F0 00 66 01 00 00 00 00 00 00 FF CC 10 CC 22 81
// System config TAG
#
[H:S]0014
[H:S]00AE
[H:A]A0 0F A0 00 32 00 02 08 0A 64 20 20 0A FF 20 20
FF CC 11 CC 01 01 FF CC 12 CC 09 01 FF 03 00 FF
FF 03 FF CC 13 CC 02 19 B8 0B 17 0F E0 FD E0 FD
E0 FD E0 FD 58 FD 14 FD 58 FD 14 FD 54 25 11 A0
92 24 00 00 00 00 00 00 00 00 00 00 00 00 02 64
04 02 03 FF 04 03 FF CC 1A CC 0C 02 08 00 60 47
13 40 58 FD 0C 00 00 E7 13 40 58 FD FF CC 18 CC
01 00 05 05 14 0A FF CC 17 CC 20 01 FF CC 16 CC
07 00 C9 B0 B4 00 FF CC 14 CC 01 01 FF CC 15 CC
01 00 08 00 FF CC 1D CC 01 00 00 00 00 00 FB 00
16 F5 08 00 24 24 07 00 1C 1C FF CC C2 C2
// Coex Configuration
#
[H:S]0017
[H:S]0026
[H:A]D1 D1 20 00 02 01 02 09 0C 00 24 1F 12 00 00 01
00 01 00 00 01 01 01 01 01 00 00 00 01 00 01 01
01 01 01 00 D2 D2
//Audio - Audio main config
#
[H:S]0041
[H:S]0004
[H:A]01 00 00 00
//TLPM
//HOST TLPM 6W (GPIO14) Enable Active low No ack, Target TLPM 4W Enable Active low, No ack
#
[H:S]0023
[H:S]0018
[H:A]06 0E 06 0F 08 08 00 0E 05 00 05 00 2C 01 00 00
E8 03 00 00 C8 00 00 00

View File

@ -0,0 +1,13 @@
# Copyright (C) 2012-2016 Freescale Semiconductor
# Copyright 2017 NXP
require recipes-bsp/firmware-imx/firmware-imx.inc
LIC_FILES_CHKSUM = "file://COPYING;md5=6b552f505eedab4a11ab538cf3db743a"
SRC_URI[md5sum] = "088fb08b565748b537f6481b1ad6c9d7"
SRC_URI[sha256sum] = "9fa7c204a6ff8a30f2b5e8f9002d8c5736791e455dc137b952fa725dc0c3aeb8"
#BRCM firmware git
SRCREV = "951c1363abe95dd75ab3e9447f640d7807240236"
COMPATIBLE_MACHINE = "(ccimx6qpsbc)"

View File

@ -1,4 +1,4 @@
# Copyright (C) 2016 Digi International.
# Copyright (C) 2016,2017 Digi International.
SUMMARY = "Qualcomm firmware files for Digi's platforms."
SECTION = "base"
@ -55,4 +55,4 @@ FILES_${PN}-qca6564-bt = "/lib/firmware/qca"
FILES_${PN}-qca6564-wifi = "/lib/firmware"
PACKAGE_ARCH = "${MACHINE_ARCH}"
COMPATIBLE_MACHINE = "(ccimx6ul)"
COMPATIBLE_MACHINE = "(ccimx6qpsbc|ccimx6ul)"

View File

@ -0,0 +1,21 @@
# Copyright (C) 2013-2016 Freescale Semiconductor
# Copyright 2017 NXP
require recipes-bsp/imx-vpu/imx-vpu.inc
LIC_FILES_CHKSUM = "file://COPYING;md5=6b552f505eedab4a11ab538cf3db743a"
PE = "1"
SRC_URI[md5sum] = "2b8311cb6e5b5813253db706e807d962"
SRC_URI[sha256sum] = "ee265e88d17c7369bd9cb917e7cce035b8c7ee2ba4491645fdab9f382f54beb0"
# imx-vpu can only support imx6q platform, in order to build out the vpu case in unit test,
# using a workaround to transfer "IMX6Q" on imx6ul & imx7d platform.
PLATFORM_mx6ul = "IMX6Q"
PLATFORM_mx7 = "IMX6Q"
PLATFORM_mx6sll = "IMX6Q"
PROVIDES = "virtual/libvpu"
RPROVIDES_${PN} = "virtual/libvpu"
COMPATIBLE_MACHINE = "(ccimx6qpsbc)"

View File

@ -1,29 +0,0 @@
From: Javier Viguera <javier.viguera@digi.com>
Date: Fri, 11 Oct 2013 18:56:04 +0200
Subject: [PATCH] makefile.am
Yocto build system does not use the makefile.in directly. Instead it
uses autotools to regenerate it using the source makefile.am.
But the makefile.in distributed in the package has some rules changed
that are not generated from the makefile.am, so adapt the makefile.am to
generate an equivalent makefile.in.
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
---
include/Makefile.am | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/Makefile.am b/include/Makefile.am
index 17d4d2c..dc3a466 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,5 +1,8 @@
noinst_HEADERS=version.h
+all-local:
+ echo "const char *git_sha = \""`git rev-parse HEAD`"\";" > ../include/autoversion.h
+
version.h: stamp-vh
@:

View File

@ -1,84 +0,0 @@
From: "Paul B. Henson" <henson@acm.org>
Date: Fri, 11 Oct 2013 17:23:44 +0200
Subject: [PATCH] fix-mtd-defines
Newer kernel headers renamed mtd mode defines and no longer support
MEMSETOOBSEL. Allow code to work with both older and newer kernel
versions.
Signed-off-by: Paul B. Henson <henson@acm.org>
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
---
src/mtd.c | 9 +++++++++
src/mtd.h | 8 ++++++++
2 files changed, 17 insertions(+)
diff --git a/src/mtd.c b/src/mtd.c
index 2974814..f9e60a3 100644
--- a/src/mtd.c
+++ b/src/mtd.c
@@ -852,8 +852,11 @@ void mtd_close(struct mtd_data *md)
mp = &md->part[i];
if (mp->fd != -1) {
+/* Newer kernels dropped MEMSETOOBSEL */
+#ifdef MEMSETOOBSEL
(void)ioctl(mp->fd, MEMSETOOBSEL,
&mp->old_oobinfo);
+#endif
close(mp->fd);
}
@@ -896,6 +899,8 @@ int mtd_set_ecc_mode(struct mtd_data *md, int ecc)
continue;
}
+/* Newer kernels dropped MEMSETOOBSEL */
+#ifdef MEMSETOOBSEL
if (r == -ENOTTY) {
r = ioctl(mp->fd, MEMSETOOBSEL, &mp->old_oobinfo);
if (r != 0) {
@@ -904,6 +909,7 @@ int mtd_set_ecc_mode(struct mtd_data *md, int ecc)
}
mp->oobinfochanged = 0;
}
+#endif
} else {
r = ioctl(mp->fd, MTDFILEMODE, (void *)MTD_MODE_RAW);
if (r != 0 && r != -ENOTTY) {
@@ -911,6 +917,8 @@ int mtd_set_ecc_mode(struct mtd_data *md, int ecc)
continue;
}
+/* Newer kernels dropped MEMSETOOBSEL */
+#ifdef MEMSETOOBSEL
if (r == -ENOTTY) {
r = ioctl(mp->fd, MEMSETOOBSEL, &none_oobinfo);
if (r != 0) {
@@ -920,6 +928,7 @@ int mtd_set_ecc_mode(struct mtd_data *md, int ecc)
mp->oobinfochanged = 1;
} else
mp->oobinfochanged = 2;
+#endif
}
mp->ecc = ecc;
diff --git a/src/mtd.h b/src/mtd.h
index 99d7887..bf6e53d 100644
--- a/src/mtd.h
+++ b/src/mtd.h
@@ -31,6 +31,14 @@
#include "BootControlBlocks.h"
#include "rom_nand_hamming_code_ecc.h"
+// Newer kernel headers renamed define
+#ifndef MTD_MODE_NORMAL
+#define MTD_MODE_NORMAL MTD_FILE_MODE_NORMAL
+#endif
+#ifndef MTD_MODE_RAW
+#define MTD_MODE_RAW MTD_FILE_MODE_RAW
+#endif
+
//------------------------------------------------------------------------------
// Re-definitions of true and false, because the standard ones aren't good
// enough?

View File

@ -1,170 +0,0 @@
From: Hector Palacios <hector.palacios@digi.com>
Date: Fri, 18 Oct 2013 10:10:37 +0200
Subject: cleanup ROM version detection code and add cpx2 support
The original code flow was difficult to understand.
Now there is a main if-elseif to check for 'Hardware' or 'Revision'
strings from cpuinfo.
On the 'Hardware' section we first check if it is a CPX2, or else we
will parse the MX-- number to get the CPU model.
On the 'Revision' section we base on the revision number to get the
CPU model or, if unset (like when Linux is booted directly), we'll
rely on the previous hw_system_rev calculated before.
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
Reviewed-by: Robert Hodaszi <robert.hodaszi@digi.com>
---
src/plat_boot_config.c | 119 ++++++++++++++++++++++++++-----------------------
1 file changed, 63 insertions(+), 56 deletions(-)
diff --git a/src/plat_boot_config.c b/src/plat_boot_config.c
index 76e65c8..e3bf242 100644
--- a/src/plat_boot_config.c
+++ b/src/plat_boot_config.c
@@ -109,10 +109,11 @@ int discover_boot_rom_version(void)
{
FILE *cpuinfo;
char line_buffer[100];
- static char *banner = "Revision";
+ static char *banner_rev = "Revision";
static char *banner_hw = "Hardware";
+ static char *banner_digi_x2 = "Hardware\t: Digi ConnectPort X2";
char *rev;
- int system_rev, hw_system_rev = 0;
+ int system_rev = 0, hw_system_rev = 0;
cpuinfo = fopen("/proc/cpuinfo", "r");
if (!cpuinfo) {
@@ -125,15 +126,20 @@ int discover_boot_rom_version(void)
if (!fgets(line_buffer, sizeof(line_buffer), cpuinfo))
break;
- /* Check if it's revision line */
- if (strncmp(line_buffer, banner, strlen(banner))) {
- /*
- * Why use the `Hardware` to parse the system type ?
- * [1] If boot linux kernel directly from SD card not by uboot,
- * the `Revision` will be zero.
- * [2] The code does not change the old logic.
- */
- if (!strncmp(line_buffer, banner_hw, strlen(banner))) {
+ /* Check if it's hardware line... */
+ /*
+ * Why use the `Hardware` to parse the system type ?
+ * [1] If boot linux kernel directly from SD card not by uboot,
+ * the `Revision` will be zero.
+ * [2] The code does not change the old logic.
+ */
+ if (!strncmp(line_buffer, banner_hw, strlen(banner_hw))) {
+ if (!strncmp(line_buffer, banner_digi_x2,
+ strlen(banner_digi_x2))) {
+ /* The cpx2 is an i.MX28 */
+ hw_system_rev = MX28;
+ }
+ else {
rev = strstr(line_buffer, "MX");
if (rev) {
char tmp[3] = {};
@@ -143,56 +149,57 @@ int discover_boot_rom_version(void)
hw_system_rev = strtoul(tmp, NULL, 16);
}
}
- continue;
}
+ /* ... or Revision line */
+ else if (!strncmp(line_buffer, banner_rev, strlen(banner_rev))) {
+ rev = index(line_buffer, ':');
+ if (rev != NULL) {
+ rev++;
+ system_rev = strtoul(rev, NULL, 16);
+ system_rev = mxc_cpu(system_rev);
+ if (!system_rev)
+ system_rev = hw_system_rev;
+
+ switch (system_rev) {
+ case MX23:
+ plat_config_data = &mx23_boot_config;
+ break;
+
+ case MX28:
+ plat_config_data = &mx28_boot_config;
+ break;
+
+ case MX53:
+ if (mxc_cpu_is_rev(system_rev, CHIP_REV_2_0) < 0)
+ plat_config_data = &mx53to1_boot_config;
+ else
+ plat_config_data = &mx53to2_boot_config;
+ break;
+
+ case MX50:
+ plat_config_data = &mx50_boot_config;
+ break;
+
+ case MX6:
+ case MX6Q:
+ case MX6DL:
+ plat_config_data = &mx6q_boot_config;
+ break;
+
+ default:
+ fprintf(stderr, "Couldn't find Boot ROM version\n");
+ break;
+ }
- rev = index(line_buffer, ':');
- if (rev != NULL) {
- rev++;
- system_rev = strtoul(rev, NULL, 16);
- system_rev = mxc_cpu(system_rev);
- if (!system_rev)
- system_rev = hw_system_rev;
-
- switch (system_rev) {
- case MX23:
- plat_config_data = &mx23_boot_config;
- break;
-
- case MX28:
- plat_config_data = &mx28_boot_config;
- break;
-
- case MX53:
- if (mxc_cpu_is_rev(system_rev, CHIP_REV_2_0) < 0)
- plat_config_data = &mx53to1_boot_config;
- else
- plat_config_data = &mx53to2_boot_config;
- break;
-
- case MX50:
- plat_config_data = &mx50_boot_config;
- break;
-
- case MX6:
- case MX6Q:
- case MX6DL:
- plat_config_data = &mx6q_boot_config;
- break;
-
- default:
- fprintf(stderr, "Couldn't find Boot ROM version\n");
- break;
- }
-
- fclose(cpuinfo);
- if (plat_config_data) {
- plat_config_data->m_u32Arm_type = system_rev;
- return 0;
+ break; /* quit for loop */
}
- return -1;
}
}
+
fclose(cpuinfo);
+ if (plat_config_data) {
+ plat_config_data->m_u32Arm_type = system_rev;
+ return 0;
+ }
return -1;
}

View File

@ -1,128 +0,0 @@
From: Hector Palacios <hector.palacios@digi.com>
Date: Fri, 18 Oct 2013 10:11:29 +0200
Subject: discover boot ROM version from FDT if available
New kernels don't get CPU information from U-Boot ATAGS and
so the /proc/cpuinfo file does not have the Hardware/Revision
lines filled in.
This patch gets the CPU model from the device tree information
at /proc/device-tree/compatible.
For backwards compatibility, if the CPU model cannot be retrieved
from this file, we try to get it from /proc/cpuinfo.
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
Reviewed-by: Robert Hodaszi <robert.hodaszi@digi.com>
---
src/plat_boot_config.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 94 insertions(+), 1 deletion(-)
diff --git a/src/plat_boot_config.c b/src/plat_boot_config.c
index e3bf242..af7e03a 100644
--- a/src/plat_boot_config.c
+++ b/src/plat_boot_config.c
@@ -105,7 +105,91 @@ static platform_config mx6q_boot_config = {
.rom_mtd_commit_structures = v4_rom_mtd_commit_structures,
};
-int discover_boot_rom_version(void)
+#define MAX_STRLEN 256
+int get_rom_version_from_fdt(void)
+{
+ FILE *fd;
+ char line_buffer[MAX_STRLEN];
+ char *p;
+ static char *compatible = "fsl,imx";
+ char *rev;
+ int system_rev;
+
+ fd = fopen("/proc/device-tree/compatible", "r");
+ if (!fd)
+ return -1;
+
+ p = &line_buffer[0];
+ if (fgets(p, MAX_STRLEN, fd)) {
+ /*
+ * The compatible string can contain more than one string.
+ * Each string value is separated from the next one by a
+ * NULL char. We must check all values one by one until
+ * we find two consecutive NULL chars.
+ */
+ while (p[0] != 0) {
+ if (!strncmp(p, compatible, strlen(compatible))) {
+ rev = p + strlen(compatible);
+ /*
+ * check if it's an imx6 CPU series, or
+ * a parsable number.
+ */
+ if (!strncmp(rev, "6q", 2))
+ system_rev = MX6Q;
+ else if (!strncmp(rev, "6d", 2))
+ system_rev = MX6DL;
+ else if (!strncmp(rev, "6s", 2))
+ system_rev = MX6;
+ else
+ system_rev = strtoul(rev, NULL, 16);
+
+ switch (system_rev) {
+ case MX23:
+ plat_config_data = &mx23_boot_config;
+ break;
+
+ case MX28:
+ plat_config_data = &mx28_boot_config;
+ break;
+
+ case MX53:
+ /*
+ * TODO: check CPU revision
+ * Consider it is a TO2 for the
+ * moment
+ */
+ plat_config_data = &mx53to2_boot_config;
+ break;
+
+ case MX50:
+ plat_config_data = &mx50_boot_config;
+ break;
+
+ case MX6:
+ case MX6Q:
+ case MX6DL:
+ plat_config_data = &mx6q_boot_config;
+ break;
+
+ default:
+ break;
+ }
+
+ if (plat_config_data) {
+ plat_config_data->m_u32Arm_type = system_rev;
+ return 0;
+ }
+ }
+ /* Move string pointer to next possible value */
+ p += strlen(p) + 1;
+ }
+ }
+
+ fclose(fd);
+ return -1;
+}
+
+int get_rom_version_from_cpuinfo(void)
{
FILE *cpuinfo;
char line_buffer[100];
@@ -203,3 +287,12 @@ int discover_boot_rom_version(void)
}
return -1;
}
+
+int discover_boot_rom_version(void)
+{
+ /* First, try to get ROM version from FDT */
+ if (get_rom_version_from_fdt())
+ return (get_rom_version_from_cpuinfo());
+
+ return 0;
+}

View File

@ -1,195 +0,0 @@
From: Hector Palacios <hector.palacios@digi.com>
Date: Tue, 15 Oct 2013 18:58:11 +0200
Subject: dump v1 boot structures
The kobs-ng that we received from Freescale did not support reading the
boot structures on the mx28. It could write them, but the function that
reads them was never updated to handle the updated structures used by
the mx28. This change adds basic support for reading these structures,
enough so that the dump command works.
(forward ported from kobs-ng-10.12.01 to kobs-ng-3.0.35_4.1.0)
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
Reviewed-by: Robert Hodaszi <robert.hodaszi@digi.com>
---
src/main.c | 5 ++-
src/mtd.c | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
src/mtd.h | 1 +
3 files changed, 131 insertions(+), 4 deletions(-)
diff --git a/src/main.c b/src/main.c
index 82b6f9e..70517b0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -152,7 +152,10 @@ int dump_main(int argc, char **argv)
if (flags & F_VERBOSE)
mtd_dump(md);
- r = mtd_load_all_boot_structures(md);
+ if (ROM_Version_1 == plat_config_data->m_u32RomVer)
+ r = mtd_load_v1_boot_structures(md);
+ else
+ r = mtd_load_all_boot_structures(md);
if (r != 0) {
fprintf(stderr, "Unable to load boot structures\n");
exit(5);
diff --git a/src/mtd.c b/src/mtd.c
index f9e60a3..9ea92ad 100644
--- a/src/mtd.c
+++ b/src/mtd.c
@@ -975,6 +975,130 @@ void dump(const void *data, int size)
printf("\n");
}
+/*
+ * This function is a hack written by Digi because the original code from
+ * Freescale did not supporting reading the bootlet structures at all.
+ * This function reads the search areas for a given BCB. It will read the first
+ * search area and use it if the read succeeds. If the read fails, then it will
+ * try again with the second search area.
+ *
+ * md A pointer to the current struct mtd_data.
+ * bcb_name A pointer to a human-readable string that indicates what kind of
+ * BCB we're reading. This string will only be used in log messages.
+ * ofs1 If there is one chips, the index of the search area to read
+ * ofs2
+ * ofs_mchip If there are multiple chips, the index of the search area to read
+ * on both chips.
+ * end The number of consecutive search areas to be read.
+ * size The size of the BCB data to be read.
+ * ecc Indicates whether or not to use hardware ECC.
+ */
+int mtd_read_bcb(struct mtd_data *md, char *bcb_name,
+ loff_t ofs1, loff_t ofs2, loff_t ofs_mchip,
+ loff_t end, size_t size, int ecc)
+{
+ int chip;
+ loff_t end_index, search_area_indices[2], o;
+ int r;
+ int i;
+ int j;
+ unsigned stride_size_in_bytes;
+ unsigned search_area_size_in_strides;
+ unsigned search_area_size_in_bytes;
+
+ /* Compute some important facts about geometry */
+ if (plat_config_data->m_u32RomVer == ROM_Version_2) {
+ stride_size_in_bytes = mtd_erasesize(md);
+ search_area_size_in_strides = 4;
+ search_area_size_in_bytes = search_area_size_in_strides * stride_size_in_bytes;
+ } else {
+ stride_size_in_bytes = PAGES_PER_STRIDE * mtd_writesize(md);
+ search_area_size_in_strides = 1 << md->cfg.search_exponent;
+ search_area_size_in_bytes = search_area_size_in_strides * stride_size_in_bytes;
+ }
+
+ /*
+ * Check whether there are multiple chips and set up the two search area
+ * indices accordingly.
+ */
+ if (multichip(md))
+ search_area_indices[0] = search_area_indices[1] = ofs_mchip;
+ else {
+ search_area_indices[0] = ofs1;
+ search_area_indices[1] = ofs2;
+ }
+
+ /* Loop over search areas for this BCB. */
+ for (i = 0; i < 2; i++) {
+ /*
+ * Compute the search area index that marks the end of the
+ * writing on this chip.
+ */
+ end_index = search_area_indices[i] + end;
+
+ /* Figure out which chip we're writing */
+ chip = multichip(md) ? i : 0;
+
+ /* Loop over consecutive search areas to write. */
+ for (; search_area_indices[i] < end_index; search_area_indices[i]++) {
+ /*
+ * Compute the byte offset of the beginning of this
+ * search area
+ */
+ o = search_area_indices[i] * search_area_size_in_bytes;
+
+ /* Loop over strides in this search area. */
+ for (j = 0; j < search_area_size_in_strides; j++, o += stride_size_in_bytes) {
+ /*
+ * If we're crossing into a new block, erase it
+ * first.
+ */
+
+ /* Write the page */
+ vp(md, "mtd: Reading %s%d @%d:0x%llx(%x)\n",
+ bcb_name, j, chip, o, size);
+
+ r = mtd_read_page(md, chip, o, ecc);
+ if (r != size) {
+ fprintf(stderr, "\n%s r = 0x%8.8X, size = 0x%8.8X\n", __func__, r, size);
+ fprintf(stderr, "mtd: Failed to read %s @%d: 0x%llx (%d)\n",
+ bcb_name, chip, o, r);
+ } else
+ break;
+ }
+ }
+ }
+
+ return !(r == size);
+}
+
+/*
+ * This function is a hack by Digi, written because the original code from
+ * Freescale did not support reading the v1 boot structures at all. Do not
+ * use the results from this function for anything other than browsing the
+ * boot structures.
+ */
+int mtd_load_v1_boot_structures(struct mtd_data *md)
+{
+ int err = 0;
+
+ /* read the FCB search area */
+ err = mtd_read_bcb(md, "FCB", 0, 0, 0, 1,
+ mtd_writesize(md) + mtd_oobsize(md), false);
+ memcpy(&md->fcb, md->buf, sizeof(md->fcb));
+
+ /* read the DBBT search area */
+ err |= mtd_read_bcb(md, "DBBT", 1, 1, 1, 1, mtd_writesize(md), true);
+ memcpy(&md->dbbt28, md->buf, sizeof(md->dbbt28));
+
+ if ((err != 0) ||
+ (md->dbbt28.m_u32FingerPrint != DBBT_FINGERPRINT2)) {
+ err = -1;
+ }
+
+ return err;
+}
+
void *mtd_load_boot_structure(struct mtd_data *md, int chip, loff_t *ofsp, loff_t end,
uint32_t magic1, uint32_t magic2, uint32_t magic3, int use_ecc,
int magic_offset)
@@ -1083,9 +1207,8 @@ int mtd_load_all_boot_structures(struct mtd_data *md)
md->curr_ncb = NULL;
md->ncb_version = ncb_get_version(buf, &md->curr_ncb);
- if (md->flags & F_VERBOSE)
- printf("mtd: found NCB%d candidate version %d @%d:0x%llx\n",
- i, md->ncb_version, chip, ofs);
+ vp(md, "mtd: found NCB%d candidate version %d @%d:0x%llx\n",
+ i, md->ncb_version, chip, ofs);
if (md->ncb_version >= 0)
break;
diff --git a/src/mtd.h b/src/mtd.h
index bf6e53d..18e4d70 100644
--- a/src/mtd.h
+++ b/src/mtd.h
@@ -276,6 +276,7 @@ void *mtd_load_boot_structure(struct mtd_data *md, int chip, loff_t *ofsp, loff_
uint32_t magic1, uint32_t magic2, uint32_t magic3, int use_ecc,
int magic_offset);
int mtd_load_all_boot_structures(struct mtd_data *md);
+int mtd_load_v1_boot_structures(struct mtd_data *md);
int mtd_dump_structure(struct mtd_data *md);
int v0_rom_mtd_init(struct mtd_data *md, FILE *fp);

View File

@ -1,454 +0,0 @@
From: Hector Palacios <hector.palacios@digi.com>
Date: Wed, 16 Oct 2013 10:30:14 +0200
Subject: added option to verify data written to flash
This patch adds a -c (check) option to the update command.
This option will read back the data written to the flash and
compare to the original contents in RAM, to verify the write
operation was successful.
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
Reviewed-by: Robert Hodaszi <robert.hodaszi@digi.com>
---
src/main.c | 22 ++++++--
src/mtd.c | 138 +++++++++++++++++++++++++++++++++++++++----------
src/mtd.h | 10 ++--
src/plat_boot_config.h | 2 +-
4 files changed, 136 insertions(+), 36 deletions(-)
diff --git a/src/main.c b/src/main.c
index 70517b0..8774045 100644
--- a/src/main.c
+++ b/src/main.c
@@ -82,10 +82,12 @@ void usage(void)
" -x .................................... Add 1k-padding in the head\n"
" -n .................................... Dry run (don't commit to flash)\n"
" -w .................................... Commit to flash\n"
+ " -c .................................... Check committed data in flash\n"
"\n"
" update [-v] [KEY] [KOBS] [-0|1] <file> .. Update a single bootstream\n"
" -v .................................... Verbose mode\n"
" -0|1 .................................. Update specified bootstream #\n"
+ " -c .................................... Check committed data in flash\n"
"\n"
" extract [-v] [KEY] [KOBS] [-0|1] <file> . Extract a bootstream from flash\n"
" -v .................................... Verbose mode\n"
@@ -390,7 +392,8 @@ int extract_main(int argc, char **argv)
return 0;
}
-static int perform_bootstream_update(struct mtd_data *md, FILE *infp, int image_mask)
+static int perform_bootstream_update(struct mtd_data *md, FILE *infp,
+ int image_mask, int check)
{
int i, r;
unsigned int size, start, avail, end, update;
@@ -435,7 +438,8 @@ static int perform_bootstream_update(struct mtd_data *md, FILE *infp, int image_
update |= UPDATE_BS(i);
}
- r = plat_config_data->rom_mtd_commit_structures(md, infp, UPDATE_LDLB | update);
+ r = plat_config_data->rom_mtd_commit_structures(md, infp,
+ UPDATE_LDLB | update, check);
if (r < 0) {
fprintf(stderr, "FAILED to commit structures\n");
return -1;
@@ -457,6 +461,7 @@ int update_main(int argc, char **argv)
char ascii[20 * 2 + 1];
int device_key;
uint8_t *keyp;
+ int check;
memset(key, 0, sizeof(key));
device_key = 0;
@@ -473,6 +478,7 @@ int update_main(int argc, char **argv)
image_mask = 0; /* no image */
flags = 0;
j = 0;
+ check = 0;
for (i = 1; i < argc; i++) {
if (argv[i][0] != '-') {
@@ -500,6 +506,9 @@ int update_main(int argc, char **argv)
exit(5);
}
break;
+ case 'c':
+ check = 1;
+ break;
case 'v':
flags |= F_VERBOSE;
break;
@@ -545,7 +554,7 @@ int update_main(int argc, char **argv)
if (flags & F_VERBOSE)
mtd_dump(md);
- r = perform_bootstream_update(md, infp, image_mask);
+ r = perform_bootstream_update(md, infp, image_mask, check);
if (r != 0) {
fprintf(stderr, "Unable to perform bootstream update\n");
usage();
@@ -597,6 +606,7 @@ int init_main(int argc, char **argv)
FILE *infp;
loff_t ofs;
int dryrun;
+ int check;
int padding = 0;
struct mtd_config cfg;
uint8_t key[16];
@@ -619,6 +629,7 @@ int init_main(int argc, char **argv)
image = 0; /* first image */
flags = 0;
dryrun = 0;
+ check = 0;
j = 0;
for (i = 1; i < argc; i++) {
@@ -640,6 +651,9 @@ int init_main(int argc, char **argv)
case 'w':
dryrun = 0;
break;
+ case 'c':
+ check = 1;
+ break;
case 'n':
dryrun = 1;
break;
@@ -738,7 +752,7 @@ int init_main(int argc, char **argv)
mtd_dump_structure(md);
if (!dryrun) {
- r = plat_config_data->rom_mtd_commit_structures(md, infp, UPDATE_ALL);
+ r = plat_config_data->rom_mtd_commit_structures(md, infp, UPDATE_ALL, check);
if (r < 0) {
fprintf(stderr, "FAILED to commit structures\n");
exit(5);
diff --git a/src/mtd.c b/src/mtd.c
index 9ea92ad..77ba307 100644
--- a/src/mtd.c
+++ b/src/mtd.c
@@ -2344,7 +2344,7 @@ int v4_rom_mtd_init(struct mtd_data *md, FILE *fp)
int mtd_commit_bcb(struct mtd_data *md, char *bcb_name,
loff_t ofs1, loff_t ofs2, loff_t ofs_mchip,
- loff_t end, size_t size, int ecc)
+ loff_t end, size_t size, int ecc, int verify)
{
int chip;
loff_t end_index, search_area_indices[2], o;
@@ -2355,6 +2355,13 @@ int mtd_commit_bcb(struct mtd_data *md, char *bcb_name,
unsigned search_area_size_in_strides;
unsigned search_area_size_in_bytes;
unsigned count;
+ char *readbuf = NULL;
+
+ if (verify) {
+ readbuf = malloc(mtd_writesize(md));
+ if (NULL == readbuf)
+ return -1;
+ }
vp(md, "-------------- Start to write the [ %s ] -----\n", bcb_name);
//----------------------------------------------------------------------
@@ -2457,6 +2464,20 @@ int mtd_commit_bcb(struct mtd_data *md, char *bcb_name,
err ++;
}
+ if (verify) {
+ //------------------------------------------------------
+ // Verify the written data
+ //------------------------------------------------------
+ r = pread(md->part[chip].fd, readbuf, mtd_writesize(md), o);
+ if (r != mtd_writesize(md)) {
+ fprintf(stderr, "mtd: Failed to read @0x%llx (%d)\n", o, r);
+ goto err_free;
+ }
+ if (memcmp(md->buf, readbuf, mtd_writesize(md))) {
+ fprintf(stderr, "mtd: Verification error @0x%llx\n", o);
+ goto err_free;
+ }
+ }
}
}
@@ -2466,16 +2487,31 @@ int mtd_commit_bcb(struct mtd_data *md, char *bcb_name,
if (md->flags & F_VERBOSE)
printf("%s(%s): status %d\n\n", __func__, bcb_name, err);
- return err;
+err_free:
+ if (verify)
+ free(readbuf);
+ if (err) {
+ fprintf(stderr, "mtd: %d errors\n", err);
+ return -1;
+ }
+ else
+ return 0;
}
-int write_boot_stream(struct mtd_data *md, FILE *fp)
+int write_boot_stream(struct mtd_data *md, FILE *fp, int verify)
{
int startpage, start, size;
loff_t ofs, end;
- int i, r, chunk;
+ int i, r = 0, chunk;
int chip = 0;
struct fcb_block *fcb = &md->fcb.FCB_Block;
+ char *readbuf = NULL;
+
+ if (verify) {
+ readbuf = malloc(mtd_writesize(md));
+ if (NULL == readbuf)
+ return -1;
+ }
vp(md, "---------- Start to write the [ %s ]----\n", (char*)md->private);
for (i = 0; i < 2; i++) {
@@ -2530,7 +2566,7 @@ int write_boot_stream(struct mtd_data *md, FILE *fp)
r = fread(md->buf, 1, chunk, fp);
if (r < 0) {
fprintf(stderr, "mtd: Failed %d (fread %d)\n", r, chunk);
- return -1;
+ goto err_free;
}
if (r < chunk) {
memset(md->buf + r, 0, chunk - r);
@@ -2539,10 +2575,30 @@ int write_boot_stream(struct mtd_data *md, FILE *fp)
/* write page */
r = mtd_write_page(md, chip, ofs, 1);
- if (r != mtd_writesize(md))
+ if (r != mtd_writesize(md)) {
fprintf(stderr, "mtd: Failed to write BS @0x%llx (%d)\n",
ofs, r);
+ r = -1;
+ goto err_free;
+ }
+ if (verify) {
+ //------------------------------------------------------
+ // Verify the written data
+ //------------------------------------------------------
+ r = pread(md->part[chip].fd, readbuf,
+ mtd_writesize(md), ofs);
+ if (r != mtd_writesize(md)) {
+ fprintf(stderr, "mtd: Failed to read BS @0x%llx (%d)\n", ofs, r);
+ r = -1;
+ goto err_free;
+ }
+ if (memcmp(md->buf, readbuf, mtd_writesize(md))) {
+ fprintf(stderr, "mtd: Verification error @0x%llx\n", ofs);
+ r = -1;
+ goto err_free;
+ }
+ }
ofs += mtd_writesize(md);
size -= chunk;
}
@@ -2555,19 +2611,26 @@ int write_boot_stream(struct mtd_data *md, FILE *fp)
*/
memset(md->buf, 0, mtd_writesize(md));
r = mtd_write_page(md, chip, ofs, 1);
- if (r != mtd_writesize(md))
+ if (r != mtd_writesize(md)) {
fprintf(stderr, "Failed to write safe page\n");
+ r = -1;
+ goto err_free;
+ }
vp(md, "mtd: We write one page for save guard. *\n");
-
if (ofs >= end) {
fprintf(stderr, "mtd: Failed to write BS#%d\n", i);
- return -1;
+ r = -1;
+ goto err_free;
}
}
- return 0;
+
+err_free:
+ if (verify)
+ free(readbuf);
+ return r;
}
-int v0_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags)
+int v0_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags, int verify)
{
int startpage, start, size;
unsigned int search_area_sz, stride;
@@ -2666,7 +2729,9 @@ int v0_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags)
if (r < 0)
return r;
- mtd_commit_bcb(md, "NCB", 0, 1, 0, 1, size, false);
+ r = mtd_commit_bcb(md, "NCB", 0, 1, 0, 1, size, false, verify);
+ if (r < 0)
+ return r;
}
if (flags & UPDATE_LDLB) {
@@ -2675,7 +2740,10 @@ int v0_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags)
memset(md->buf, 0, mtd_writesize(md));
memcpy(md->buf, md->curr_ldlb, sizeof(*md->curr_ldlb));
- mtd_commit_bcb(md, "LDLB", 2, 3, 1, 1, mtd_writesize(md), true);
+ r = mtd_commit_bcb(md, "LDLB", 2, 3, 1, 1, mtd_writesize(md), true,
+ verify);
+ if (r < 0)
+ return r;
}
if (flags & UPDATE_DBBT) {
@@ -2684,7 +2752,11 @@ int v0_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags)
memset(md->buf, 0, mtd_writesize(md));
memcpy(md->buf, md->curr_dbbt, sizeof(*md->curr_dbbt));
- mtd_commit_bcb(md, "DBBT", 4, 5, 2, 1, mtd_writesize(md), true);
+ r = mtd_commit_bcb(md, "DBBT", 4, 5, 2, 1, mtd_writesize(md), true,
+ verify);
+ if (r < 0)
+ return r;
+
for (i = 0; i < 2; i++) {
for (j = 0; j < 2; j++) {
if (md->flags & F_MULTICHIP) {
@@ -2766,7 +2838,7 @@ static void write_dbbt(struct mtd_data *md, int dbbt_num)
}
}
-int v1_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags)
+int v1_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags, int verify)
{
int size ,r;
@@ -2779,8 +2851,11 @@ int v1_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags)
size = mtd_writesize(md) + mtd_oobsize(md);
r = fcb_encrypt(&md->fcb, md->buf, size, 1);
if (r < 0)
- return r;
- mtd_commit_bcb(md, "FCB", 0, 0, 0, 1, size, false);
+ return -1;
+
+ r = mtd_commit_bcb(md, "FCB", 0, 0, 0, 1, size, false, verify);
+ if (r < 0)
+ return -1;
//----------------------------------------------------------------------
// Write the DBBT search area.
@@ -2788,14 +2863,17 @@ int v1_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags)
memset(md->buf, 0, mtd_writesize(md));
memcpy(md->buf, &(md->dbbt28), sizeof(md->dbbt28));
dbbt_checksum(md, &md->dbbt28);
- mtd_commit_bcb(md, "DBBT", 1, 1, 1, 1, mtd_writesize(md), true);
+ r = mtd_commit_bcb(md, "DBBT", 1, 1, 1, 1, mtd_writesize(md), true,
+ verify);
+ if (r < 0)
+ return -1;
write_dbbt(md, 1); /* only write the DBBT for nand0 */
/* write the boot image. */
- return write_boot_stream(md, fp);
+ return write_boot_stream(md, fp, verify);
}
-int v2_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags)
+int v2_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags, int verify)
{
int startpage, start, size;
unsigned int search_area_size_in_bytes, stride_size_in_bytes;
@@ -2832,7 +2910,9 @@ int v2_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags)
memset(md->buf, 0, mtd_writesize(md));
memcpy(md->buf, &(md->fcb), sizeof(md->fcb));
- mtd_commit_bcb(md, "FCB", 0, 0, 0, 1, mtd_writesize(md), true);
+ r = mtd_commit_bcb(md, "FCB", 0, 0, 0, 1, mtd_writesize(md), true, verify);
+ if (r < 0)
+ return -1;
//----------------------------------------------------------------------
// Write the DBBT search area.
@@ -2841,7 +2921,9 @@ int v2_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags)
memset(md->buf, 0, mtd_writesize(md));
memcpy(md->buf, &(md->dbbt28), sizeof(md->dbbt28));
- mtd_commit_bcb(md, "DBBT", 1, 1, 1, 1, mtd_writesize(md), true);
+ r = mtd_commit_bcb(md, "DBBT", 1, 1, 1, 1, mtd_writesize(md), true, verify);
+ if (r < 0)
+ return -1;
//----------------------------------------------------------------------
// Write the DBBT table area.
@@ -2985,7 +3067,7 @@ int v2_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags)
return 0;
}
-int v4_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags)
+int v4_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags, int verify)
{
int size, i, r, chip = 0;
loff_t ofs;
@@ -2997,12 +3079,16 @@ int v4_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags)
r = fcb_encrypt(&md->fcb, md->buf, size, 1);
if (r < 0)
return r;
- mtd_commit_bcb(md, "FCB", 0, 0, 0, 1, size, false);
+ r = mtd_commit_bcb(md, "FCB", 0, 0, 0, 1, size, false, verify);
+ if (r < 0)
+ return r;
/* [2] Write the DBBT search area. */
memset(md->buf, 0, mtd_writesize(md));
memcpy(md->buf, &(md->dbbt50), sizeof(md->dbbt50));
- mtd_commit_bcb(md, "DBBT", 1, 1, 1, 1, mtd_writesize(md), true);
+ r = mtd_commit_bcb(md, "DBBT", 1, 1, 1, 1, mtd_writesize(md), true, verify);
+ if (r < 0)
+ return -1;
/* Write the DBBT table area. */
memset(md->buf, 0, mtd_writesize(md));
@@ -3023,7 +3109,7 @@ int v4_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags)
}
/* [3] Write the two boot streams. */
- return write_boot_stream(md, fp);
+ return write_boot_stream(md, fp, verify);
}
#undef ARG
diff --git a/src/mtd.h b/src/mtd.h
index 18e4d70..699e505 100644
--- a/src/mtd.h
+++ b/src/mtd.h
@@ -295,11 +295,11 @@ int mtd_markbad(struct mtd_data *md, int chip, loff_t ofs);
#define UPDATE_BS(x) (0x08 << ((x) & 1))
#define UPDATE_ALL (UPDATE_NCB | UPDATE_LDLB | UPDATE_DBBT | UPDATE_BS0 | UPDATE_BS1)
-int v0_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags);
-int v1_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags);
-int v2_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags);
-int v3_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags);
-int v4_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags);
+int v0_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags, int verify);
+int v1_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags, int verify);
+int v2_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags, int verify);
+int v3_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags, int verify);
+int v4_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags, int verify);
int mtd_set_ecc_mode(struct mtd_data *md, int ecc);
diff --git a/src/plat_boot_config.h b/src/plat_boot_config.h
index 8242ede..a3c03a7 100644
--- a/src/plat_boot_config.h
+++ b/src/plat_boot_config.h
@@ -55,7 +55,7 @@ typedef struct _platform_config_t {
uint32_t m_u32Arm_type;
uint32_t m_u32DBBT_FingerPrint;
int (* rom_mtd_init)(struct mtd_data *md, FILE *fp);
- int (* rom_mtd_commit_structures)(struct mtd_data *md, FILE *fp, int flags);
+ int (* rom_mtd_commit_structures)(struct mtd_data *md, FILE *fp, int flags, int verify);
} platform_config;
extern platform_config *plat_config_data;

View File

@ -1,24 +0,0 @@
From: Javier Viguera <javier.viguera@digi.com>
Date: Thu, 14 Nov 2013 16:46:01 +0100
Subject: [PATCH] disable use of nfc_geometry
Not supported in kernel v3.10
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
---
src/plat_boot_config.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/plat_boot_config.c b/src/plat_boot_config.c
index af7e03a47f1b..463045f0bc75 100644
--- a/src/plat_boot_config.c
+++ b/src/plat_boot_config.c
@@ -46,7 +46,7 @@ static platform_config mx28_boot_config = {
.m_u32EnDISBBM = 0,
.m_u32EnSoftEcc = 1,
.m_u32EnBootStreamVerify = 1,
- .m_u32UseNfcGeo = 1,
+ .m_u32UseNfcGeo = 0,
.m_u32UseMultiBootArea = 0,
.m_u32UseSinglePageStride = 1,
.m_u32DBBT_FingerPrint = DBBT_FINGERPRINT2,

View File

@ -1,23 +0,0 @@
From 62d43285dd08709c86b91ba0ae23c974e96c2905 Mon Sep 17 00:00:00 2001
From: Hector Palacios <hector.palacios@digi.com>
Date: Thu, 15 Oct 2015 12:31:24 +0200
Subject: [PATCH] mtd: configure 16-bit ECC for 4K page NAND with 224-byte OOB
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
---
src/mtd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mtd.c b/src/mtd.c
index 77ba3070de7a..4d04f4c2921d 100644
--- a/src/mtd.c
+++ b/src/mtd.c
@@ -2124,7 +2124,7 @@ int v1_rom_mtd_init(struct mtd_data *md, FILE *fp)
if (mtd_writesize(md) == 2048) {
geo->ecc_strength = ROM_BCH_Ecc_8bit << 1;
} else if (mtd_writesize(md) == 4096) {
- if (mtd_oobsize(md) == 218)
+ if (mtd_oobsize(md) == 218 || mtd_oobsize(md) == 224)
geo->ecc_strength = ROM_BCH_Ecc_16bit << 1;
else if ((mtd_oobsize(md) == 128))
geo->ecc_strength = ROM_BCH_Ecc_8bit << 1;

View File

@ -1,25 +0,0 @@
# Copyright 2013 Digi International. All rights reserved.
SUMMARY = "Freescale's mxs nand update utility"
SECTION = "base"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833"
inherit autotools
SRC_URI = " \
${DIGI_PKG_SRC}/${PN}-${PV}.tar.gz \
file://0001-makefile.am.patch \
file://0002-fix-mtd-defines.patch \
file://0003-cleanup-ROM-version-detection-code-and-add-cpx2-supp.patch \
file://0004-discover-boot-ROM-version-from-FDT-if-available.patch \
file://0005-dump-v1-boot-structures.patch \
file://0006-added-option-to-verify-data-written-to-flash.patch \
file://0007-disable-use-of-nfc_geometry.patch \
file://0008-mtd-configure-16-bit-ECC-for-4K-page-NAND-with-224-b.patch \
"
SRC_URI[md5sum] = "2a0e55b5063605b2664fd67c95a6c686"
SRC_URI[sha256sum] = "92d2f23add8c5d3102c77f241cae26ca55871ccc613a7af833bebbbac7afb8ea"
COMPATIBLE_MACHINE = "mxs"

View File

@ -1,39 +0,0 @@
# Copyright (C) 2013,2017 Digi International.
SUMMARY = "Digi's utilities library"
SECTION = "libs"
LICENSE = "GPL-2.0"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
SRC_URI = " \
file://cmdopt.c \
file://cmdopt.h \
file://crc32.c \
file://crc32.h \
file://digi-platforms.h \
file://log.c \
file://log.h \
file://mem.c \
file://mem.h \
file://misc_helper.h \
file://platform.c \
"
S = "${WORKDIR}"
do_compile() {
${CC} -O2 -Wall ${LDFLAGS} -c -o log.o log.c
${CC} -O2 -Wall ${LDFLAGS} -c -o cmdopt.o cmdopt.c
${CC} -O2 -Wall ${LDFLAGS} -c -o mem.o mem.c
${CC} -O2 -Wall ${LDFLAGS} -c -o crc32.o crc32.c
${CC} -O2 -Wall ${LDFLAGS} -c -o platform.o platform.c
${AR} -rcs libdigi.a log.o cmdopt.o mem.o crc32.o platform.o
}
do_install() {
mkdir -p ${D}${includedir}/libdigi ${D}${libdir}
install -m 0644 libdigi.a ${D}${libdir}
install -m 0644 cmdopt.h crc32.h digi-platforms.h log.h mem.h misc_helper.h ${D}${includedir}/libdigi
}
RDEPENDS_${PN}-dev = ""

View File

@ -1,366 +0,0 @@
/***********************************************************************
*
* Copyright 2001,2002 by FS-Forth Systeme GmbH.
* All rights reserved.
*
* $Id: cmdopt.c,v 1.4 2007-01-23 15:13:27 mpietrek Exp $
* @Author: Markus Pietrek
* @Descr: Provides some helper functions to access the command line
* options. The results are stored in global variables.
* This file is not thread safe.
*
********************************************************************** */
/*********************************************************************** *
* @History:
* 2002/10/21 : Purified for splint. Changed to new variable
* naming convention.
*
*********************************************************************** */
#include <assert.h>
#include <ctype.h> // toupper
#include <getopt.h> // getopt
#include <stdio.h>
#include <stdlib.h> // atoi
#include <string.h> // strlen
#include "cmdopt.h"
#include "log.h"
#include "misc_helper.h"
#define BUFFER_SIZE 1024
#define MAX_ENTRIES 32
/*@observer@*/
void (*fnCmdOptExtendedUsage) (char bCmdLine) = NULL;
const char* szCmdOptVersion = "$Revision: 1.4 $"; // if not
// overwritten take
// at least the
// revision of cmdopt
static CmdOptEntry cmdOptEntries[ MAX_ENTRIES ]; // to avoid malloc we
// use a static buffer
/*@noreturn@*/
static void usageAndExit( int argc,
char* argv[],
const CmdOptEntry entries[],
const char* szDescr,
char cWrongNumber );
static void updateVar( const CmdOptEntry entries[],
int nOptIndex,
const char* szStr );
/***********************************************************************
* @Function: cmdOptParse
* @Return: only if command line could be parsed otherwise ends
* the application. Result is only set if COT_MORE is specified
* and points to the first unprocessed entry
* @Descr: reads the command line and sets the variables. Displays a usage
* if values are wrong.
***********************************************************************/
int cmdOptParse( int argc,
char* argv[],
const CmdOptEntry entries[],
const char* szDescr )
{
char szOptLine[ BUFFER_SIZE ];
struct option axLongOptions[ MAX_ENTRIES ];
int nOptIndex = 0;
int nSize = 0;
int nSizeLong = 0;
signed char cOptChar;
int nOptIndexStatic = 0;
int nOptLongIndex = 0;
char cPrintVersion = 0;
char cPrintHelp = 0;
CmdOptEntry coePrintVersion =
{COT_BOOL, -1, &cPrintVersion, "version", "print version and exit" };
CmdOptEntry coePrintHelp =
{COT_BOOL, 'h', &cPrintHelp, "help", "print help" };
CmdOptEntry coeLogLevel =
{COT_INT, 'l', &logLevel, "log-level", "log level for messages" };
CLEAR( axLongOptions );
// add global default command line arguments
cmdOptEntries[ nOptIndexStatic++ ] = coePrintVersion;
cmdOptEntries[ nOptIndexStatic++ ] = coePrintHelp;
cmdOptEntries[ nOptIndexStatic++ ] = coeLogLevel;
// copy default command line entries
// will break when all entries are copied to global area
// or too much arguments
while( 1 )
{
if( nOptIndexStatic == MAX_ENTRIES )
{
logMsg( LOG_ERR, "cmdOptParse: too many command line options" );
exit( EXIT_FAILURE );
}
cmdOptEntries[ nOptIndexStatic ] = entries[ nOptIndex ];
if( entries[ nOptIndex ].type == COT_NONE )
// no more entries
break;
nOptIndexStatic++;
nOptIndex++;
}
// create parameter list for getopt
nOptIndex = 0;
szOptLine[ nOptIndex ] = 0;
while( cmdOptEntries[ nSize ].type != COT_NONE )
{
if( ( cmdOptEntries[ nSize ].type != COT_MORE ) &&
( cmdOptEntries[ nSize ].type != COT_MORE_OPT ) ) {
axLongOptions[ nSizeLong ].name = cmdOptEntries[ nSize ].szLabelStr;
axLongOptions[ nSizeLong ].has_arg =
((cmdOptEntries[ nSize ].type != COT_BOOL ) ? required_argument : no_argument);
axLongOptions[ nSizeLong ].flag = NULL;
axLongOptions[ nSizeLong ].val = -2 - nSize;
nSizeLong++;
}
if( NULL != cmdOptEntries[ nSize ].pbPresent )
*cmdOptEntries[ nSize ].pbPresent = 0;
if( !cmdOptEntries[ nSize ].cOptChar )
{
// parameter is not mandatory
nSize++;
continue;
}
if( nOptIndex >= BUFFER_SIZE - 2 )
{
logMsg( LOG_ERR,
"cmdOptParse: too long command line" );
exit( EXIT_FAILURE );
}
if( -1 != cmdOptEntries[ nSize ].cOptChar ) {
szOptLine[ nOptIndex++ ] = cmdOptEntries[ nSize ].cOptChar;
if( cmdOptEntries[ nSize ].type != COT_BOOL )
szOptLine[ nOptIndex++ ] = ':';
}
szOptLine[ nOptIndex ] = 0;
nSize++;
}
// parse optional command line options
while( ( cOptChar = getopt_long( argc, argv, szOptLine, axLongOptions, &nOptLongIndex ) ) != -1 )
{
char cFound = 0;
if( cOptChar < 0 ) {
cFound = 1;
updateVar( cmdOptEntries, -2 - cOptChar, optarg );
} else {
for( nOptIndex = 0; nOptIndex < nSize; nOptIndex++ )
{
if( cmdOptEntries[ nOptIndex ].cOptChar == cOptChar )
{
// optional arguments only
cFound = 1;
updateVar( cmdOptEntries, nOptIndex, optarg );
}
}
}
if( !cFound )
usageAndExit( argc, argv, cmdOptEntries, szDescr, 0 );
}
if( cPrintVersion )
{
fprintf( stdout, "%s %s\n",
argv[ 0 ],
szCmdOptVersion );
exit( EXIT_SUCCESS );
}
if( cPrintHelp )
usageAndExit( argc, argv, cmdOptEntries, szDescr, 0 );
// parse mandatory command line options
nOptIndex = 0;
for( nOptIndex = 0; nOptIndex < nSize; nOptIndex++ )
if( !cmdOptEntries[ nOptIndex ].cOptChar )
{
if( cmdOptEntries[ nOptIndex ].type == COT_MORE_OPT )
// don't parse the following arguments as they
// can't be covered by this lib yet
return optind;
if( !( argc - optind ) )
usageAndExit( argc, argv, cmdOptEntries, szDescr, 1 );
if( cmdOptEntries[ nOptIndex ].type == COT_MORE )
// don't parse the following arguments as they
// can't be covered by this lib yet
return optind;
updateVar( cmdOptEntries, nOptIndex, argv[ optind++ ] );
}
if( argc - optind )
// COT_MORE is aborted before
usageAndExit( argc, argv, cmdOptEntries, szDescr, 1 );
return 0;
}
void cmdOptUsageAndExit(
int argc,
char* argv[],
const CmdOptEntry entries[],
const char* szDescr )
{
usageAndExit( argc, argv, entries, szDescr, 0 );
}
/***********************************************************************
* @Function: usageAndExit
* @Return: never
* @Descr: displays usage and exits with EXIT_FAILURE. If wrongNumber is 1,
* a message "too many arguments is displayed".
***********************************************************************/
static void usageAndExit( /*@unused@*/ int argc,
char* argv[],
const CmdOptEntry entries[],
const char* szDescr,
char cWrongNumber )
{
int nOptIndex = 0;
size_t maxStrLen = 0;
fprintf( stdout, "Usage: %s ", argv[ 0 ] );
// print command line arguments
while( entries[ nOptIndex ].type != COT_NONE )
{
if( entries[ nOptIndex ].szLabelStr != NULL )
{
// determine max len of labelStr for formatted output
size_t strLen = strlen( entries[ nOptIndex ].szLabelStr );
if( strLen > maxStrLen )
maxStrLen = strLen;
}
switch( entries[ nOptIndex ].type )
{
case COT_BOOL:
case COT_INT:
case COT_STRING:
fprintf( stdout, "[--%s] ", entries[ nOptIndex ].szLabelStr );
break;
case COT_MORE:
case COT_MORE_OPT:
fprintf( stdout,
"%s ",
entries[ nOptIndex ].szLabelStr );
break;
case COT_NONE:
// will never happen but satisfies compiler
break;
}
nOptIndex++;
}
if( NULL != fnCmdOptExtendedUsage )
fnCmdOptExtendedUsage( 1 );
fprintf( stdout, "\n" );
// explain command line options
nOptIndex = 0;
while( entries[ nOptIndex ].type != COT_NONE )
{
fprintf( stdout, " " );
fprintf( stdout, " %-*s",
(int) maxStrLen,
entries[ nOptIndex ].szLabelStr );
if( entries[ nOptIndex ].cOptChar > 0)
fprintf( stdout, " [-%c]", entries[ nOptIndex ].cOptChar );
else
fprintf( stdout, " " );
/*@+matchanyintegral*/ // maxStrLen is size_t. We shall
// unrestrict for this case the
// behaviour of splint because the
// compiler should do some
// checking, too
/*@-matchanyintegral*/
if( entries[ nOptIndex ].szHelpStr != NULL )
fprintf( stdout, " : %s", entries[ nOptIndex ].szHelpStr );
fprintf( stdout, "\n" );
nOptIndex++;
}
if( NULL != fnCmdOptExtendedUsage )
fnCmdOptExtendedUsage( 0 );
fprintf( stdout, "\n%s\n", szDescr );
// explain failure
if( cWrongNumber )
fprintf( stderr, "\n*** Wrong # arguments ***\n" );
exit( EXIT_FAILURE );
}
/***********************************************************************
* @Function: updateVar
* @Return: nothing
* @Descr: sets the variable in entries[ index ] to the value in str
* and does conversion if necessary
***********************************************************************/
static void updateVar( const CmdOptEntry entries[],
int nOptIndex,
const char* szStr )
{
switch( entries[ nOptIndex ].type )
{
case COT_BOOL:
*((char*) entries[ nOptIndex ].vValuePtr) = 1;
break;
case COT_INT:
if( (int) strlen( szStr ) > 2 &&
((szStr[ 0 ] == '0' && (toupper( szStr[ 1 ] ) == 'X' ))))
{
sscanf( &szStr[ 2 ],
"%x",
((int*) entries[ nOptIndex ].vValuePtr ) );
break;
}
*((int*) entries[ nOptIndex ].vValuePtr) = atoi( szStr );
break;
case COT_STRING:
*((const char**) entries[ nOptIndex ].vValuePtr) = szStr;
break;
case COT_MORE:
case COT_MORE_OPT:
case COT_NONE:
// will never happen but satisfies compiler
break;
}
if( NULL != entries[ nOptIndex ].pbPresent )
*entries[ nOptIndex ].pbPresent = 1;
}

View File

@ -1,54 +0,0 @@
/*
* libdigi/cmdopt.h
*
* Copyright (C) 2001,2002 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* Description: Helper functions to access command line options.
* The results are stored in global variables.
*
*/
#ifndef DG_CMDOPT_H
#define DG_CMDOPT_H
typedef enum {
COT_BOOL, // if present,bool is set 1, otherwise unchanged
COT_INT, // sets *valuePtr to the int value
// with conversions (if 0x
// prefix is present)
COT_STRING, // sets *valuePtr to the string
COT_MORE, // to end the array. Any additional arguments
// are allowed
COT_MORE_OPT, // to end the array. Any optional arguments
// are allowed
COT_NONE // to end the array. Any additional arguments
// are considered as failures
} CmdOptTypes;
typedef struct {
CmdOptTypes type; // type of option to be read
signed char cOptChar; // character to identify that option, if 0, then
// no option is used but parameter is required
void *vValuePtr; // ptr to the variable where value is stored
const char *szLabelStr; // label displayed in command line
const char *szHelpStr; // displays this help string for the variable
char *pbPresent; // will be set to if this option is present
} CmdOptEntry;
/* can be set to display additional usage */
extern void (*fnCmdOptExtendedUsage) (char bCmdLine);
extern const char *szCmdOptVersion; // overwrite it before calling cmdOptParse to
// define version of application
int cmdOptParse(int argc, char *argv[], const CmdOptEntry entries[], const char *szDescr);
void cmdOptUsageAndExit(int argc,
char *argv[], const CmdOptEntry entries[], const char *szDescr);
#endif /* DG_CMDOPT_H */

View File

@ -1,86 +0,0 @@
/*
* crc32.c
*
* Copyright (C) 2006 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* Description: Flash Test Util
*
*/
#include "crc32.h"
static const crc32_t crc32_table[256] = {
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
0x2d02ef8dL
};
crc32_t crc32(crc32_t uiCRC, const void *pvBuf, size_t iLen)
{
const unsigned char *pcBuf = (const unsigned char *)pvBuf;
/* uiCRC starts with 0 on first block. If run on a block, undoes the
previous uiCRC ^ 0xffffffff. */
uiCRC ^= 0xffffffff;
while (iLen-- > 0)
uiCRC = crc32_table[(uiCRC ^ *pcBuf++) & 0xff] ^ (uiCRC >> 8);
/* if last block, this is the result. Otherwise this will be undone
on next crc32 call */
return uiCRC ^ 0xffffffff;
}

View File

@ -1,24 +0,0 @@
/*
* libdigi/crc32.h
*
* Copyright (C) 2006 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* Description: CRC32 functions
*
*/
#ifndef DG_CRC32_H
#define DG_CRC32_H
#include <stdint.h> /* uint32_t */
#include <stdlib.h> /* size_t */
typedef uint32_t crc32_t;
extern crc32_t crc32(crc32_t uiCRC, const void *pvBuf, size_t iLen);
#endif /* DG_CRC32_H */

View File

@ -1,116 +0,0 @@
/*
* libdigi/digi-platforms.h
*
* Copyright (C) 2011 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* Description: Digi platforms
*
*/
#ifndef DIGI_PLATFORMS_H
#define DIGI_PLATFORMS_H
#define PLATFORM_NAME(x) x ## _NAME
#define MACH_TYPE_CC7U 1017
#define MACH_TYPE_CC7U_NAME "cc7u"
#define MACH_TYPE_CWIEM 1033
#define MACH_TYPE_CWIEM_NAME "cwiem"
#define MACH_TYPE_CCW9C 1110
#define MACH_TYPE_CCW9C_NAME "ccw9c"
#define MACH_TYPE_CC9P9360DEV 1114
#define MACH_TYPE_CC9P9360DEV_NAME "cc9p9360dev"
#define MACH_TYPE_CC9P9750DEV 1115
#define MACH_TYPE_CC9P9750DEV_NAME "cc9p9750dev"
#define MACH_TYPE_CC9P9360VAL 1116
#define MACH_TYPE_CC9P9360VAL_NAME "cc9p9360val"
#define MACH_TYPE_CC9P9750VAL 1117
#define MACH_TYPE_CC9P9750VAL_NAME "cc9p9750val"
#define MACH_TYPE_CC9P9360JS 1264
#define MACH_TYPE_CC9P9360JS_NAME "cc9p9360js"
#define MACH_TYPE_CC9P9215 1445
#define MACH_TYPE_CC9P9215_NAME "cc9p9215"
#define MACH_TYPE_CC9P9210 1446
#define MACH_TYPE_CC9P9210_NAME "cc9p9210"
#define MACH_TYPE_CC9P9215JS 1447
#define MACH_TYPE_CC9P9215JS_NAME "cc9p9215js"
#define MACH_TYPE_CC9P9210JS 1448
#define MACH_TYPE_CC9P9210JS_NAME "cc9p9210js"
#define MACH_TYPE_CC7UCAMRY 1493
#define MACH_TYPE_CC7UCAMRY_NAME "cc7ucamry"
#define MACH_TYPE_CC9M2443JS 1663
#define MACH_TYPE_CC9M2443JS_NAME "cc9m2443js"
#define MACH_TYPE_CME9210 1712
#define MACH_TYPE_CME9210_NAME "cme9210"
#define MACH_TYPE_CCW9P9215JS 1811
#define MACH_TYPE_CCW9P9215JS_NAME "ccw9p9215js"
#define MACH_TYPE_CC9M2443 1815
#define MACH_TYPE_CC9M2443_NAME "cc9m2443"
#define MACH_TYPE_CME9210JS 1854
#define MACH_TYPE_CME9210JS_NAME "cme9210js"
#define MACH_TYPE_CC9P9360 1855
#define MACH_TYPE_CC9P9360_NAME "cc9p9360"
#define MACH_TYPE_CCW9P9215 2137
#define MACH_TYPE_CCW9P9215_NAME "ccw9p9215"
#define MACH_TYPE_CCW9M2443 2145
#define MACH_TYPE_CCW9M2443_NAME "ccw9m2443"
#define MACH_TYPE_CCW9M2443JS 2146
#define MACH_TYPE_CCW9M2443JS_NAME "ccw9m2443js"
#define MACH_TYPE_CC9P9215_3G 2397
#define MACH_TYPE_CC9P9215_3G_NAME "cc9p9215_3g"
#define MACH_TYPE_CC9P9215_3GJS 2398
#define MACH_TYPE_CC9P9215_3GJS_NAME "cc9p9215_3gjs"
#define MACH_TYPE_CCMX51 2516
#define MACH_TYPE_CCMX51_NAME "ccmx51"
#define MACH_TYPE_CCMX51JS 2517
#define MACH_TYPE_CCMX51JS_NAME "ccmx51js"
#define MACH_TYPE_CCWMX51 2518
#define MACH_TYPE_CCWMX51_NAME "ccwmx51"
#define MACH_TYPE_CCWMX51JS 2519
#define MACH_TYPE_CCWMX51JS_NAME "ccwmx51js"
#define MACH_TYPE_CWME9210 3320
#define MACH_TYPE_CWME9210_NAME "cwme9210"
#define MACH_TYPE_CWME9210JS 3321
#define MACH_TYPE_CWME9210JS_NAME "cwme9210js"
#define MACH_TYPE_CCMX53 3346
#define MACH_TYPE_CCMX53_NAME "ccmx53"
#define MACH_TYPE_CCMX53JS 3347
#define MACH_TYPE_CCMX53JS_NAME "ccmx53js"
#define MACH_TYPE_CCWMX53 3348
#define MACH_TYPE_CCWMX53_NAME "ccwmx53"
#define MACH_TYPE_CCWMX53JS 3349
#define MACH_TYPE_CCWMX53JS_NAME "ccwmx53js"
#define MACH_TYPE_CPX2 3419
#define MACH_TYPE_CPX2_NAME "cpx2"
#define MACH_TYPE_WR21 3737
#define MACH_TYPE_WR21_NAME "wr21"
#define MACH_TYPE_CCARDWMX28 3893
#define MACH_TYPE_CCARDWMX28_NAME "ccardwmx28"
#define MACH_TYPE_CCARDMX28 3894
#define MACH_TYPE_CCARDMX28_NAME "ccardmx28"
#define MACH_TYPE_CCARDWMX28JS 3917
#define MACH_TYPE_CCARDWMX28JS_NAME "ccardwmx28js"
#define MACH_TYPE_CCARDMX28JS 3918
#define MACH_TYPE_CCARDMX28JS_NAME "ccardmx28js"
#define MACH_TYPE_CCIMX53 9980
#define MACH_TYPE_CCIMX53_NAME "ccimx53"
#define MACH_TYPE_CCIMX53JS 9981
#define MACH_TYPE_CCIMX53JS_NAME "ccimx53js"
#define MACH_TYPE_CCIMX51 9982
#define MACH_TYPE_CCIMX51_NAME "ccimx51"
#define MACH_TYPE_CCIMX51JS 9983
#define MACH_TYPE_CCIMX51JS_NAME "ccimx51js"
#define MACH_TYPE_CCARDIMX28 9984
#define MACH_TYPE_CCARDIMX28_NAME "ccardimx28"
#define MACH_TYPE_CCARDIMX28JS 9985
#define MACH_TYPE_CCARDIMX28JS_NAME "ccardimx28js"
int get_platform_id(void);
char is_nand_oob_atomic(void);
#endif /* DIGI_PLATFORMS_H */

View File

@ -1,129 +0,0 @@
/*
* log.c
*
* Copyright (C) 2001,2002 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* Description: implements logging interface
*
*/
#include <stdio.h> // fprintf
#include <stdlib.h> // EXIT_FAILURE
#include <errno.h> // errno
#include <netdb.h> // h_errno
#include <string.h> // strerror
#include <stdarg.h> // vprintf
#include "log.h"
/* Globaly visible */
LogLevel logLevel = LOG_STATUS;
/***********************************************************************
* @Function: log
* @Return: nothing
* @Descr: format and arg1..arg3 are printed on stderr only if level
* is <= logLevel
* format may not contain any newline character.
***********************************************************************/
void logMsg(LogLevel level, const char *szFormat, ...)
{
if (level <= logLevel) {
va_list ap;
/*@-formatconst@ */
va_start(ap, szFormat);
vfprintf(stderr, szFormat, ap);
va_end(ap);
/*@-formatconst@ */
fputs("\n", stderr);
}
}
/***********************************************************************
* @Function: systemLog
* @Return: nothing
* @Descr: dumps the system error that happened just before
***********************************************************************/
void systemLog(const char *szFormat, ...)
{
char *szError = NULL;
va_list ap;
if (errno)
szError = strdup(strerror(errno));
else if (h_errno)
szError = strdup(hstrerror(h_errno));
/*@-formatconst@ */
va_start(ap, szFormat);
vfprintf(stderr, szFormat, ap);
va_end(ap);
/*@-formatconst@ */
if (NULL != szError)
fprintf(stderr, " (%s)", szError);
fputs("\n", stderr);
if (NULL != szError)
free(szError);
}
/***********************************************************************
* @Function: error
* @Return: never
* @Descr: format and arg1..arg3 are printed on stderr only if level
* is <= logLevel
* format may not contain any newline character.
***********************************************************************/
void error(const char *szFormat, ...)
{
va_list ap;
fprintf(stderr, "*** Error: ");
/*@-formatconst@ */
va_start(ap, szFormat);
vfprintf(stderr, szFormat, ap);
va_end(ap);
/*@-formatconst@ */
fputs("\n", stderr);
exit(EXIT_FAILURE);
}
/***********************************************************************
* @Function: systemError
* @Return: never
* @Descr: dumps the system error that happened just before and exits the
* application
***********************************************************************/
void systemError(const char *szFormat, ...)
{
char *szError = NULL;
va_list ap;
if (errno)
szError = strdup(strerror(errno));
else if (h_errno)
szError = strdup(hstrerror(h_errno));
fprintf(stderr, "*** Error: ");
/*@-formatconst@ */
va_start(ap, szFormat);
vfprintf(stderr, szFormat, ap);
va_end(ap);
/*@-formatconst@ */
if (NULL != szError)
fprintf(stderr, " (%s)", szError);
fputs("\n", stderr);
free(szError);
exit(EXIT_FAILURE);
}

View File

@ -1,34 +0,0 @@
/*
* libdigi/log.h
*
* Copyright (C) 2001,2002 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* Description: Logging facility for applications
*
*/
#ifndef DG_LOG_H
#define DG_LOG_H
typedef enum {
LOG_ERR = 0,
LOG_STATUS,
LOG_HARDWARE1,
LOG_HARDWARE2,
LOG_PACKET,
LOG_LAST
} LogLevel;
extern LogLevel logLevel;
extern void logMsg(LogLevel level, const char *szFormat, ...);
extern void systemLog(const char *szFormat, ...);
extern void error(const char *szFormat, ...);
extern void systemError(const char *szFormat, ...);
#endif /* DG_LOG_H */

View File

@ -1,90 +0,0 @@
/*
* mem.c
*
* Copyright (C) 2006 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* Description: provides MemCmp() and MemDump()
*
*/
#include <stdio.h> /* printf */
#include "mem.h"
/***********************************************************************
* !Function: MemCmp
* !Descr: compares memory
* !Return: offset of failure or -1 if none
***********************************************************************/
loff_t MemCmp(const void *pvS1, const void *pvS2, size_t iSize)
{
const char *pcS2 = (const char *)pvS2;
const char *pcS1 = (const char *)pvS1;
loff_t iOffset = 0;
while (iOffset < iSize) {
if (*pcS2 != *pcS1)
return iOffset;
pcS2++;
pcS1++;
iOffset++;
}
return -1;
}
/***********************************************************************
* !Function: MemDump
* !Descr: Prints memory from pvbase + iOffset to pvBase + iOffset + iLen
***********************************************************************/
void MemDump(const void *pvBase, loff_t iOffset, size_t iLen)
{
const unsigned char *pucBuf = (const unsigned char *)pvBase + iOffset;
const int COLUMN_COUNT = 16;
int i;
for (i = 0; i < iLen; i += COLUMN_COUNT) {
/* print one row */
int j, iRowLen;
if ((i + COLUMN_COUNT) <= iLen)
iRowLen = COLUMN_COUNT;
else
iRowLen = iLen - i;
printf("%08llx ", (long long)iOffset);
/* print hexadecimal representation */
for (j = 0; j < iRowLen; j++) {
printf("%02x ", *(pucBuf + j));
if (((COLUMN_COUNT / 2) - 1) == j)
/* additional separator */
printf(" ");
}
printf(" ");
/* print character representation row */
for (j = 0; j < iRowLen; j++) {
unsigned char c = *(pucBuf + j);
if ((c < 32) || (c > 127))
c = '.';
if (((COLUMN_COUNT / 2) - 1) == j)
/* additional separator */
printf(" ");
printf("%c", c);
}
printf("\r\n");
pucBuf += iRowLen;
iOffset += iRowLen;
}
}

View File

@ -1,23 +0,0 @@
/*
* libdigi/mem.h
*
* Copyright (C) 2006 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* Description: provides MemCmp() and MemDump()
*
*/
#ifndef DG_MEM_H
#define DG_MEM_H
#include <stdlib.h> /* size_t */
extern loff_t MemCmp(const void *pvS1, const void *pvS2, size_t iSize);
extern void MemDump(const void *pvBase, loff_t iOffset, size_t iLen);
#endif /* DG_MEM_H */

View File

@ -1,51 +0,0 @@
/*
* libdigi/misc_helper.h
*
* Copyright (C) 2006 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* Description: miscellaneous definitions that simplifies developing
* May require 'string.h' or 'log.h'
*
*/
#ifndef DG_MISC_HELPER_H
#define DG_MISC_HELPER_H
#include <stdio.h> /* snprintf */
#include <string.h> /* memset */
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(*(x)))
#define CLEAR(x) memset( &x, 0, sizeof( x ) )
/* round up to kB */
#define TO_KiB(x) (((x) + 1023) / 1024)
/* to bytes */
#define KiB(x) ((x) * 1024)
#define MiB(x) (KiB(x) * 1024)
#define MAX(a, b) ((a) < (b) ? (b) : (a))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define FREE(x) \
do { \
free((void *)x); \
x = NULL; \
} while (0)
#define CLOSE(x) \
do { \
if (close(x)) \
systemError("close"); \
x = -1; \
} while (0)
#define SPRINTF(acStr, args...) \
snprintf(acStr, sizeof(acStr), args)
#endif /* DG_MISC_HELPER_H */

View File

@ -1,110 +0,0 @@
/*
* Copyright (C) 2011 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version2 as published by
* the Free Software Foundation.
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "digi-platforms.h"
#include "log.h"
/*
* Gets the platform ID from the file /proc/cpuinfo
* (the kernel needs to write the machine ID in this file).
* Returns the machine ID or -1 on error
*/
int get_platform_id(void)
{
char buffer[80];
FILE *fp;
long id = -1;
fp = popen("cat /proc/cpuinfo | grep \"Machine ID\" | cut -f 2 -d :", "r");
if (fp == NULL)
systemError("cannot access /proc/cpuinfo");
if (fgets(buffer, sizeof(buffer) - 1, fp)) {
errno = 0; /* to distinguish success/failure after call */
id = strtol(buffer, NULL, 10);
if (errno != 0)
id = -1; /* don't care about the error code */
}
fclose(fp);
return id;
}
/*
* get_platform_name_from_fdt
*
* Read the device tree and return platform name or NULL
*/
static char *get_platform_name_from_fdt(void)
{
static const char *fdt = "/proc/device-tree/digi,machine,name";
static char buffer[64]; /* static buffer so it can be used in the caller function */
char *plat_name = NULL;
FILE *fp;
fp = fopen(fdt, "r");
if (fp == NULL)
goto out;
plat_name = fgets(buffer, sizeof(buffer), fp);
fclose(fp);
out:
return plat_name;
}
/*
* Checks whether platform requires an atomic access to NAND OOB
*/
char is_nand_oob_atomic(void)
{
int platform_id;
platform_id = get_platform_id();
if (platform_id != -1) {
/* The following platforms require atomic access to NAND OOB */
if (MACH_TYPE_CPX2 == platform_id ||
MACH_TYPE_WR21 == platform_id ||
MACH_TYPE_CCMX51 == platform_id ||
MACH_TYPE_CCMX51JS == platform_id ||
MACH_TYPE_CCWMX51 == platform_id ||
MACH_TYPE_CCWMX51JS == platform_id ||
MACH_TYPE_CCIMX51 == platform_id ||
MACH_TYPE_CCIMX51JS == platform_id ||
MACH_TYPE_CCMX53 == platform_id ||
MACH_TYPE_CCMX53JS == platform_id ||
MACH_TYPE_CCWMX53 == platform_id ||
MACH_TYPE_CCWMX53JS == platform_id ||
MACH_TYPE_CCIMX53 == platform_id ||
MACH_TYPE_CCIMX53JS == platform_id ||
MACH_TYPE_CCARDMX28 == platform_id ||
MACH_TYPE_CCARDMX28JS == platform_id ||
MACH_TYPE_CCARDWMX28 == platform_id ||
MACH_TYPE_CCARDWMX28JS == platform_id ||
MACH_TYPE_CCARDIMX28 == platform_id ||
MACH_TYPE_CCARDIMX28JS == platform_id)
return 1;
} else {
/*
* Workaround to detect is_nand_oob_atomic in ccardimx28 using
* linux 3.x
* TODO: generalize this.
*/
char *platform_name = get_platform_name_from_fdt();
if (platform_name && !strcmp(platform_name, "ccardimx28"))
return 1;
}
return 0;
}

View File

@ -1,46 +0,0 @@
# Copyright (C) 2013 Digi International.
SUMMARY = "Digi's NVRAM tool"
SECTION = "base"
LICENSE = "GPL-2.0"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
require recipes-bsp/u-boot/u-boot-dey-rev_${PV}.inc
DEPENDS = "libdigi"
SRC_URI += " \
file://main.c \
file://nvram_priv_linux.c \
"
S = "${WORKDIR}"
CMD_GIT_SHA1 = "$(cd ${THISDIR} && git rev-parse --short=7 HEAD)"
LIB_GIT_SHA1 = "$(cd ${WORKDIR}/git && git rev-parse --short=7 HEAD)"
EXTRA_CFLAGS = "-Wall -DLINUX -DCMD_GIT_SHA1=\"${CMD_GIT_SHA1}\" -DLIB_GIT_SHA1=\"${LIB_GIT_SHA1}\" -Ilib/include -I${STAGING_INCDIR}/libdigi"
do_configure() {
rm -f lib && ln -s ${UBOOT_NVRAM_LIBPATH}
}
do_compile() {
# 'libnvram.a' static library
${CC} ${CFLAGS} ${EXTRA_CFLAGS} -c -o nvram.o lib/src/nvram.c
${CC} ${CFLAGS} ${EXTRA_CFLAGS} -c -o nvram_cmdline.o lib/src/nvram_cmdline.c
${CC} ${CFLAGS} ${EXTRA_CFLAGS} -c -o nvram_priv_linux.o nvram_priv_linux.c
${AR} -rcs libnvram.a nvram.o nvram_cmdline.o nvram_priv_linux.o
# 'nvram' command-line tool
${CC} ${CFLAGS} ${EXTRA_CFLAGS} -c -o main.o main.c
${CC} ${LDFLAGS} -o nvram main.o libnvram.a -ldigi
}
do_install() {
mkdir -p ${D}${base_sbindir} ${D}${includedir} ${D}${libdir}
install -m 0644 libnvram.a ${D}${libdir}/
install -m 0644 lib/include/nvram.h lib/include/nvram_types.h ${D}${includedir}/
install -m 0755 nvram ${D}${base_sbindir}/
}
PACKAGE_ARCH = "${MACHINE_ARCH}"

View File

@ -1,266 +0,0 @@
/*
* nvram/src/main.c
*
* Copyright (C) 2006-2013 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version2 as published by
* the Free Software Foundation.
*/
/*
* !Author: Markus Pietrek
* !Descr: main() and user code for nvram.
*/
#include <errno.h> /* errno */
#include <fcntl.h> /* open */
#include <stdarg.h> /* vprintf */
#include <stdio.h> /* snprintf */
#include <stdlib.h> /* EXIT_SUCCESS */
#include <string.h> /* strdup */
#include <sys/stat.h>
/* from libdigi */
#include <cmdopt.h>
#include <log.h>
#include <misc_helper.h>
#include "nvram.h" /* Nv* */
#define CA(cmd) \
do { \
if( !cmd ) \
ExitError( #cmd ); \
} while( 0 )
#define VERSION "1.15" "-g"CMD_GIT_SHA1
/* Hack to change priv_linux mode */
void NvPrivLinuxSetMode(char bManufMode);
/* local functions */
static void ExitError(const char *szFormat, ...);
static void OnExit(void);
static void ExtendedUsage(char bCmdLine);
static void OSLoadFromFile(nv_os_type_e eOS, const char *szFile);
static void OSSaveToFile(nv_os_type_e eOS, const char *szFile);
static char l_bOptDetailed = 0;
static char quiet = 0;
static char l_bManufMode = 0;
int main(int argc, char *argv[])
{
char acVersion[128];
uint32_t uiLibVerMajor;
uint32_t uiLibVerMinor;
int iExtendedArgs;
const char *xPrintAll[] = { "printall" };
const char *szOSOutFile = NULL;
const char *szOSInFile = NULL;
const char *szOS = NULL;
char bSave = 0;
nv_os_type_e eOS = NVOS_NONE;
int ret;
CmdOptEntry aCmdEntries[] = {
/*@@-nullassign@@ */// only COT_NONE may have a NULL for vValuePtr
{COT_BOOL, 'e', &l_bOptDetailed, "error_detailed",
"detailed error messages"},
{COT_BOOL, 'b', &g_markBadBlocks, "bad-block-marking",
"On repeated error, mark block as bad."},
{COT_STRING, 'g', &szOSOutFile, "get_os_cfg",
"copies the os configuration block to file"},
{COT_STRING, 's', &szOSInFile, "set_os_cfg",
"copies the os configuration block from file"},
{COT_STRING, 'o', &szOS, "os",
"select's the OS to get configuration from"},
{COT_BOOL, 'q', &quiet, "quiet",
"display no error messages"},
{COT_BOOL, 'm', &l_bManufMode, "manuf-mode",
"manufacturing mode (no auto-repair, permit reset)"},
{COT_MORE_OPT, 0, NULL, "", ""},
{COT_NONE, 0, NULL, NULL, NULL},
/*@@+nullassign@@ */
};
NvGetLibVersion(&uiLibVerMajor, &uiLibVerMinor);
snprintf(acVersion,
sizeof(acVersion) - 1,
"Version: " VERSION ", NVRAM Library %u.%u-g" LIB_GIT_SHA1 ", compiled on "
__DATE__ "," __TIME__, uiLibVerMajor, uiLibVerMinor);
acVersion[sizeof(acVersion) - 1] = 0U;
szCmdOptVersion = acVersion;
fnCmdOptExtendedUsage = ExtendedUsage;
iExtendedArgs = cmdOptParse(argc, argv, aCmdEntries,
"NVRAM Tool for updating nvram settings");
logMsg(LOG_HARDWARE1,
"Sizes: Critical: %i\n"
" Module ID: %i\n"
" IP: %i\n"
" IP Device: %i\n"
" Partition Table: %i\n"
" Partition Entry: %i\n"
" OS Cfg Table: %i\n"
" OS Cfg: %i\n",
sizeof(nv_critical_t),
sizeof(nv_param_module_id_t),
sizeof(nv_param_ip_t),
sizeof(nv_param_ip_device_t),
sizeof(nv_param_part_table_t),
sizeof(nv_param_part_t),
sizeof(nv_param_os_cfg_table_t),
sizeof(nv_param_os_cfg_t));
/* so we can close everything even on error() or on return of main */
atexit(OnExit);
NvPrivLinuxSetMode(l_bManufMode);
/* In manufacturing mode, do not let library auto-repair the NVRAM */
ret = NvInit(l_bManufMode ? NVR_MANUAL : NVR_AUTO);
if (!ret) {
/* If NVRAM was not initialized, only continue if
* we are requesting a reset.
*/
if (argc == iExtendedArgs) {
ExitError("NvInit");
} else {
if (strcmp("reset", argv[iExtendedArgs]))
ExitError("NvInit");
}
}
if (NULL != szOS) {
if (!NvToOS(&eOS, szOS))
error("OS not known: %s\n", szOS);
}
if (NULL != szOSInFile) {
bSave = 1;
OSLoadFromFile(eOS, szOSInFile);
}
if (NULL != szOSOutFile)
/* it's load from NVRAM view */
OSSaveToFile(eOS, szOSOutFile);
if (argc == iExtendedArgs) {
if ((NULL == szOSInFile) && (NULL == szOSOutFile))
/* on -o, the user likes to read/write something */
CA(NvCmdLine(ARRAY_SIZE(xPrintAll), xPrintAll));
} else {
CA(NvCmdLine(argc - iExtendedArgs, (const char **)&argv[iExtendedArgs]));
if (!strcmp("set", argv[iExtendedArgs]) ||
!strcmp("reset", argv[iExtendedArgs]) ||
!strcmp("init", argv[iExtendedArgs]))
bSave = 1;
}
if (bSave)
CA(NvSave());
return EXIT_SUCCESS;
}
/* ********** local functions ********** */
static void ExtendedUsage(char bCmdLine)
{
if (bCmdLine == 1)
CA(NvPrintHelp());
}
static void ExitError(const char *szFormat, ...)
{
const char *szError = NULL;
const char *szWhat = NULL;
const char *szFunc = NULL;
const char *szFile = NULL;
int iLine;
va_list ap;
if (!quiet || l_bOptDetailed) {
fprintf(stderr, "*** Error: ");
if (l_bOptDetailed) {
/*@-formatconst@ */
va_start(ap, szFormat);
vfprintf(stderr, szFormat, ap);
va_end(ap);
fprintf(stderr, ": ");
/*@+formatconst@ */
}
if (NVE_GOOD != NvErrorMsg(&szError, &szWhat, &szFunc, &szFile, &iLine)) {
if (l_bOptDetailed)
fprintf(stderr, " %s: (%s) @ %s:%i (%s)",
szError, szWhat, szFile, iLine, szFunc);
else
fprintf(stderr, " %s: (%s)", szError, szWhat);
}
fprintf(stderr, "\n");
}
exit(EXIT_FAILURE);
}
static void OSLoadFromFile(nv_os_type_e eOS, const char *szFile)
{
int iFd;
nv_param_os_cfg_t xCfg;
void *pvTmp;
CA(NvOSCfgFind(&xCfg, eOS));
pvTmp = malloc(xCfg.uiSize);
if (NULL == pvTmp)
systemError("malloc: %i", xCfg.uiSize);
iFd = open(szFile, O_RDONLY);
if (-1 == iFd)
systemError("%s", szFile);
if (-1 == read(iFd, pvTmp, xCfg.uiSize))
systemError("read");
CLOSE(iFd);
CA(NvOSCfgSet(eOS, pvTmp, xCfg.uiSize));
FREE(pvTmp);
printf("Loaded from %s\n", szFile);
}
static void OSSaveToFile(nv_os_type_e eOS, const char *szFile)
{
int iFd;
nv_param_os_cfg_t xCfg;
void *pvTmp;
size_t iSize;
CA(NvOSCfgFind(&xCfg, eOS));
pvTmp = malloc(xCfg.uiSize);
if (NULL == pvTmp)
systemError("malloc: %i", xCfg.uiSize);
CA(NvOSCfgGet(eOS, pvTmp, xCfg.uiSize, &iSize));
iFd = open(szFile, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (-1 == iFd)
systemError("%s", szFile);
if (xCfg.uiSize != write(iFd, pvTmp, xCfg.uiSize))
systemError("write");
CLOSE(iFd);
FREE(pvTmp);
printf("Stored to %s\n", szFile);
}
/*! \brief closes all descriptors on any exit */
static void OnExit(void)
{
NvFinish();
}

View File

@ -1,302 +0,0 @@
/*
* nvram/src/nvram_priv_linux.c
*
* Copyright (C) 2006-2013 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version2 as published by
* the Free Software Foundation.
*/
/*
* !Author: Markus Pietrek
* !Descr: Defines the private functions needed by the nvram core to
* access I2C, Flash and a console for linux userspace.
*/
#define _XOPEN_SOURCE 500 /* for pread/pwrite */
#include <errno.h> /* ENOTSUP */
#include <fcntl.h> /* open */
#include <mtd/mtd-user.h> /* MEMERASE */
#include <stdarg.h> /* vprintf */
#include <sys/ioctl.h> /* ioctl */
#include <sys/stat.h> /* stat */
/* from libdigi */
#include <log.h> /* systemError */
#include <misc_helper.h> /* CLEAR */
#include "nvram_priv.h"
#define NVRAM_PARTITION 1
char g_markBadBlocks = 0;
/* ********** local variables ********** */
static char l_acMtd[32];
static int l_iFdMtd = -1;
static mtd_info_t l_xMtdInfo;
static unsigned char bbMaxRetries = 3;
extern void MemDump(const void *pvBase, loff_t iOffset, size_t iLen);
static char l_bManufMode = 0;
/* ********** global functions ********** */
void NvPrivLinuxSetMode(char bManufMode)
{
/* Hack so linux nvram can change behavior of priv_linux */
/* without ubootenv also changing. */
l_bManufMode = bManufMode;
}
int NvPrivOSInit(void)
{
struct stat xStat;
CLEAR(xStat);
/* detect NVRAM partition */
SPRINTF(l_acMtd, "/dev/mtd/%i", NVRAM_PARTITION);
/* determine whether we are /dev/mtd/ or /dev/mtd */
if (-1 == stat(l_acMtd, &xStat)) {
SPRINTF(l_acMtd, "/dev/mtd%i", NVRAM_PARTITION);
/* not dev fs */
if (-1 == stat(l_acMtd, &xStat))
return NV_SET_ERROR(NVE_NO_DEV, strerror(errno));
}
return 1;
}
int NvPrivOSFinish(void)
{
return 1;
}
int NvPrivOSPostInit(void)
{
return 1;
}
int NvPrivOSCriticalPostReset(struct nv_critical *pParams)
{
/* nothing to do */
return 1;
}
int NvPrivOSCriticalPartReset(struct nv_critical *pCrit, nv_os_type_e eForOS)
{
if (l_bManufMode) {
/*
* In manufacturing mode, don't return an error, assuming
* that caller knows what they're doing.
*/
return 1;
} else {
/*
* Retain previous behavior of returning an error, which
* will cause us to exit before calling NvSave(); this is
* done to prevent 'nvram reset' from linux from erasing the
* OSCfgTable, since we won't properly restore the ubootenv
* section.
*/
RETURN_NOT_IMPLEMENTED();
}
}
int NvPrivOSFlashOpen(char bForWrite)
{
l_iFdMtd = open(l_acMtd, bForWrite ? (O_RDWR | O_SYNC) : O_RDONLY);
if (-1 == l_iFdMtd)
return NV_SET_ERROR(NVE_NO_DEV, strerror(errno));
CLEAR(l_xMtdInfo);
/* read partition info */
if (ioctl(l_iFdMtd, MEMGETINFO, &l_xMtdInfo)) {
CLOSE(l_iFdMtd);
return NV_SET_ERROR(NVE_NO_DEV, strerror(errno));
}
return 1;
}
int NvPrivOSFlashClose(void)
{
CLOSE(l_iFdMtd);
return 1;
}
/* A block is marked as bad as a consequence of consecutive read/write errors,
* for example unrecoverable CRC errors, or if the data verification after a
* write finds data mismatch after a number of retries. */
static int NvPrivMarkBadBlock(int fd, loff_t iOffset)
{
logMsg(LOG_STATUS, "Marking offset %d as bad\n", (int)iOffset);
return (ioctl(fd, MEMSETBADBLOCK, &iOffset));
}
int NvPrivOSFlashRead(void *pvBuf, loff_t iOffs, size_t iLength)
{
int iRead;
int i, iRet;
for (i = 0; i < bbMaxRetries; i++) {
iRead = pread(l_iFdMtd, pvBuf, iLength, iOffs);
if (iRead != iLength) {
if (g_markBadBlocks) {
systemLog("Retrying failed read:Got %i "
"Bytes instead of %i.\n", iRead, iLength);
continue;
} else {
systemLog("read failed. Got %i Bytes "
"instead of %i\n", iRead, iLength);
return NV_SET_ERROR(NVE_IO, strerror(errno));
}
}
break;
}
if (g_markBadBlocks && (i >= bbMaxRetries)) {
/* Read error, for example unrecoverable ECC */
iRet = NvPrivMarkBadBlock(l_iFdMtd, iOffs);
return NV_SET_ERROR(NVE_IO, strerror(iRet));
}
return 1;
}
int NvPrivOSFlashErase(loff_t iOffs)
{
erase_info_t xErase;
CLEAR(xErase);
xErase.length = l_xMtdInfo.erasesize;
xErase.start = iOffs;
if (ioctl(l_iFdMtd, MEMERASE, &xErase))
return NV_SET_ERROR(NVE_IO, strerror(errno));
return 1;
}
int NvPrivOSFlashWrite( /*@in@ */ const void *pvBuf, loff_t iOffs, size_t iLength)
{
int iWritten, iRead;
int i, iRet;
unsigned char *pvRdBuf;
/* we are not called for bad sectors */
for (i = 0; i < bbMaxRetries; i++) {
iWritten = pwrite(l_iFdMtd, pvBuf, iLength, iOffs);
if (iWritten != iLength) {
if (g_markBadBlocks) {
systemLog("Retrying failed write:"
"Wrote %i Bytes"
" instead of %i.\n", iWritten, iLength);
continue;
} else {
logMsg(LOG_ERR, "write failed."
" Wrote %i Bytes" " instead of %i\n", iWritten, iLength);
return NV_SET_ERROR(NVE_IO, strerror(errno));
}
}
if (g_markBadBlocks) {
pvRdBuf = (unsigned char *)malloc(iLength);
if (NULL == pvRdBuf) {
systemLog("Malloc failed.\n");
return NV_SET_ERROR(NVE_IO, strerror(errno));
}
for (i = 0; i < bbMaxRetries; i++) {
iRead = pread(l_iFdMtd, pvRdBuf, iLength, iOffs);
if (iRead != iLength) {
systemLog("Retrying failed read:"
"%i < > %i.\n", iRead, iLength);
continue;
}
if (memcmp(pvRdBuf, pvBuf, iLength) != 0) {
logMsg(LOG_ERR,
"\nData mismatch at offset 0x%08x\n", iOffs);
logMsg(LOG_ERR, "Source is");
MemDump(pvBuf, iOffs & ~0xf, MIN(iLength, 0x20));
logMsg(LOG_ERR, "Flash is");
MemDump(pvRdBuf, iOffs & ~0xf, MIN(iRead, 0x20));
continue;
}
break;
}
FREE(pvRdBuf);
}
break;
}
if (g_markBadBlocks && (i >= bbMaxRetries)) {
iRet = NvPrivMarkBadBlock(l_iFdMtd, iOffs);
return NV_SET_ERROR(NVE_IO, strerror(iRet));
}
return 1;
}
int NvPrivOSFlashProtect(loff_t iOffs, size_t iLength, char bProtect)
{
erase_info_t xErase;
CLEAR(xErase);
xErase.length = l_xMtdInfo.erasesize;
xErase.start = iOffs;
if (ioctl(l_iFdMtd, (bProtect ? MEMLOCK : MEMUNLOCK), &xErase)) {
if (ENOTSUP != errno)
/* e.g. NAND */
return NV_SET_ERROR(NVE_IO, strerror(errno));
}
return 1;
}
int NvPrivOSFlashInfo(loff_t iOffs,
/*@out@*/ struct nv_priv_flash_status *pStatus)
{
int iRes;
CLEAR(*pStatus);
/* linux hasn't an interface yet to determine erase size at iOffs.
Anyway, we place NVRAM immediately after U-Boot, so we have unique
erase sizes */
pStatus->iEraseSize = l_xMtdInfo.erasesize;
pStatus->type = l_xMtdInfo.type;
/* determine whether block at iOffs is bad */
iRes = ioctl(l_iFdMtd, MEMGETBADBLOCK, &iOffs);
if (iRes > 0)
pStatus->bBad = 1;
else if ((iRes < 0) && (ENOTSUP != errno))
return NV_SET_ERROR(NVE_IO, strerror(errno));
/* else if not supported (NOR), is is assumed good */
return 1;
}
void NvPrivOSPrintf(const char *szFormat, ...)
{
va_list ap;
va_start(ap, szFormat);
vprintf(szFormat, ap);
va_end(ap);
}
void NvPrivOSPrintfError(const char *szFormat, ...)
{
va_list ap;
va_start(ap, szFormat);
vfprintf(stderr, szFormat, ap);
va_end(ap);
}

View File

@ -1,5 +0,0 @@
PV = "2013.01"
require recipes-bsp/nvram/nvram.inc
COMPATIBLE_MACHINE = "(ccardimx28)"

View File

@ -0,0 +1,50 @@
# Copyright (C) 2017 Digi International
SUMMARY = "NXP Code signing Tool for the High Assurance Boot library"
DESCRIPTION = "Provides software code signing support designed for use with \
i.MX processors that integrate the HAB library in the internal boot ROM."
HOMEPAGE = "https://www.nxp.com/webapp/Download?colCode=IMX_CST_TOOL"
LICENSE = "CLOSED"
DEPENDS = "openssl-native"
SRC_URI = " \
${@base_conditional('TRUSTFENCE_SIGN', '1', 'file://cst-${PV}.tar.gz', '', d)} \
file://0001-gen_auth_encrypted_data-reuse-existing-DEK-file.patch \
file://0002-hab4_pki_tree.sh-automate-script.patch \
file://0003-openssl_helper-use-dev-urandom-as-seed-source.patch \
file://0004-hab4_pki_tree.sh-usa-a-random-password-for-the-defau.patch \
file://Makefile \
"
# Usually local files (with file:// protocol) are not checked for
# premirrors. But in this case we want to be able to download the 'cst'
# package from a premirror in case it's not already in the DL_DIR, so prepend
# a premirror for the 'file://' protocol.
python() {
source_mirror_url = d.getVar('SOURCE_MIRROR_URL', True)
if source_mirror_url:
premirrors = d.getVar('PREMIRRORS', True)
d.setVar('PREMIRRORS', "file://cst.* %s \\n %s" % (source_mirror_url, premirrors))
}
S = "${WORKDIR}/cst-${PV}"
inherit native
do_configure() {
cp -f ${WORKDIR}/Makefile .
}
do_compile() {
oe_runmake clean && oe_runmake
}
do_install() {
install -d ${D}${bindir}
install -m 0755 linux64/cst ${D}${bindir}/cst
install -m 0755 $(find linux64 -type f -name srktool) ${D}${bindir}/srktool
install -m 0755 keys/hab4_pki_tree.sh ${D}${bindir}/trustfence-gen-pki.sh
install -m 0755 ca/openssl.cnf ${D}${bindir}/openssl.cnf
install -m 0755 ca/v3_ca.cnf ${D}${bindir}/v3_ca.cnf
install -m 0755 ca/v3_usr.cnf ${D}${bindir}/v3_usr.cnf
}

View File

@ -1,49 +1,3 @@
SUMMARY = "NXP Code signing Tool for the High Assurance Boot library"
DESCRIPTION = "Provides software code signing support designed for use with \
i.MX processors that integrate the HAB library in the internal boot ROM."
HOMEPAGE = "https://www.nxp.com/webapp/Download?colCode=IMX_CST_TOOL"
LICENSE = "CLOSED"
# Copyright (C) 2017 Digi International
DEPENDS = "openssl-native"
SRC_URI = " \
${@base_conditional('TRUSTFENCE_SIGN', '1', 'file://cst-${PV}.tar.gz', '', d)} \
file://0001-gen_auth_encrypted_data-reuse-existing-DEK-file.patch \
file://0002-hab4_pki_tree.sh-automate-script.patch \
file://0003-openssl_helper-use-dev-urandom-as-seed-source.patch \
file://0004-hab4_pki_tree.sh-usa-a-random-password-for-the-defau.patch \
file://Makefile \
"
# Usually local files (with file:// protocol) are not checked for
# premirrors. But in this case we want to be able to download the 'cst'
# package from a premirror in case it's not already in the DL_DIR, so prepend
# a premirror for the 'file://' protocol.
python() {
source_mirror_url = d.getVar('SOURCE_MIRROR_URL', True)
if source_mirror_url:
premirrors = d.getVar('PREMIRRORS', True)
d.setVar('PREMIRRORS', "file://cst.* %s \\n %s" % (source_mirror_url, premirrors))
}
S = "${WORKDIR}/cst-${PV}"
inherit native
do_configure() {
cp -f ${WORKDIR}/Makefile .
}
do_compile() {
oe_runmake clean && oe_runmake
}
do_install() {
install -d ${D}${bindir}
install -m 0755 linux64/cst ${D}${bindir}/cst
install -m 0755 linux64/srktool ${D}${bindir}/srktool
install -m 0755 keys/hab4_pki_tree.sh ${D}${bindir}/trustfence-gen-pki.sh
install -m 0755 ca/openssl.cnf ${D}${bindir}/openssl.cnf
install -m 0755 ca/v3_ca.cnf ${D}${bindir}/v3_ca.cnf
install -m 0755 ca/v3_usr.cnf ${D}${bindir}/v3_usr.cnf
}
require trustfence-cst-native.inc

View File

@ -0,0 +1,5 @@
# Copyright (C) 2017 Digi International
require trustfence-cst-native.inc
INSANE_SKIP_${PN} += "already-stripped"

View File

@ -1,16 +0,0 @@
#
# U-Boot bootscript for SD images created by Yocto.
#
# Layout:
# * U-Boot (raw copied)
# * Boot partion (FAT) with kernel images and DTB
# * Rootfs partion (EXT4)
#
# +--------------+----------------------+-------------------------+
# | U-BOOT (RAW) | BOOT_PARTITION (FAT) | ROOTFS_PARTITION (EXT4) |
# +--------------+----------------------+-------------------------+
#
setenv fdtimg uimage-imx28-ccardimx28js.dtb
setenv kimg uimage-ccardimx28js.bin
setenv mmc_rpart /dev/mmcblk0p3
dboot linux mmc 0:2

View File

@ -0,0 +1,35 @@
#
# U-Boot bootscript for EMMC/SD images created by Yocto.
#
#
# Set device tree filename depending on the board ID (if defined)
#
if test -n "${board_id}"; then
setenv fdt_file zImage-${soc_family}-ccimx6qpsbc-id${board_id}.dtb
else
#
# Set device tree filename depending on the hardware variant
#
if test "${module_variant}" = "0x01"; then
setenv fdt_file zImage-${soc_family}-ccimx6qpsbc-wb.dtb
else
echo "------ Using default fdt_file"
fi
fi
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
dboot linux mmc ${mmcbootdev}:${mmcpart}

View File

@ -0,0 +1,162 @@
#
# U-Boot script for installing Linux images created by Yocto from the SD
# card into the eMMC
#
echo "############################################################"
echo "# Linux firmware install from micro SD #"
echo "############################################################"
echo ""
echo " This process will erase your eMMC and will install a new"
echo " U-Boot and Linux firmware images on the eMMC."
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
sleep 10
if test $? -eq 1; then
echo "Aborted by user.";
exit;
fi
# Determine U-Boot file to program basing on module variant
if test -n "${module_variant}"; then
if test "${module_variant}" = "0x01"; then
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qpsbc2GB.imx;
fi
fi
# Use 'test -n ...' because 'test -z ...' does not work well on old versions of
# u-boot when the checked value is empty.
if test -n "${INSTALL_UBOOT_FILENAME}"; then
true;
else
echo "";
echo "[ERROR] Cannot determine U-Boot file for this module!";
echo "";
echo "1. Set variable 'INSTALL_UBOOT_FILENAME' depending on your ConnectCore 6 QuadPlus variant:";
echo " - For a QuadPlus CPU with 2GB DDR3, run:";
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qpsbc2GB.imx";
echo "";
echo "2. Run the install script again.";
echo "";
echo "Aborted";
echo "";
exit;
fi;
setenv INSTALL_MMCDEV 1
setenv INSTALL_LINUX_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6qpsbc.boot.vfat
setenv INSTALL_RECOVERY_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6qpsbc.recovery.vfat
setenv INSTALL_ROOTFS_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6qpsbc.ext4
# Check for presence of firmware files on the SD card
for install_f in ${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_RECOVERY_FILENAME} ${INSTALL_ROOTFS_FILENAME}; do
if test ! -e mmc ${INSTALL_MMCDEV}:1 ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1;
fi;
done
if test -n "${install_abort}"; then
echo "Aborted.";
exit;
fi
# Skip user confirmation for U-Boot update
setenv forced_update 1
# Set bootdelay to zero so that firmware update is run immediately after
# the first reset.
setenv bootdelay 0
# Set target MMC device index to eMMC
setenv mmcdev 0
# Update U-Boot
echo ""
echo ""
echo ">> Installing U-Boot boot loader (target will reset)"
echo ""
echo ""
update uboot mmc ${INSTALL_MMCDEV} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Save the environment
# - Partition the eMMC user data area for Linux
# - Update the 'linux' partition
# - Update the 'recovery' partition
# - Update the 'rootfs' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
setenv bootcmd "
env default -a;
saveenv;
echo \"\";
echo \"\";
echo \">> Creating Linux partition table on the eMMC\";
echo \"\";
echo \"\";
run partition_mmc_linux;
if test \$? -eq 1; then
echo \"[ERROR] Failed to create Linux partition table!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing Linux kernel and device tree files\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} fat ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing recovery\";
echo \"\";
echo \"\";
update recovery mmc ${INSTALL_MMCDEV} fat ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing Linux root file system\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} fat ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete. Rebooting into recovery mode for final deployment.\";
echo \"\";
echo \"\";
sleep 1;
reset;
"
saveenv
reset

View File

@ -1,11 +0,0 @@
# Copyright (C) 2013 Digi International
SRCBRANCH = "v2013.01/dub-2.0/maint"
SRCREV = "${AUTOREV}"
# Select internal or Github U-Boot repo
UBOOT_GIT_URI ?= "${@base_conditional('DIGI_INTERNAL_GIT', '1' , '${DIGI_GIT}u-boot-denx.git', '${DIGI_GITHUB_GIT}/u-boot.git', d)}"
SRC_URI = "${UBOOT_GIT_URI};branch=${SRCBRANCH}"
UBOOT_NVRAM_LIBPATH = "git/board/digi/common/cmd_nvram/lib"

View File

@ -1,26 +0,0 @@
# Copyright (C) 2012 Digi International
DESCRIPTION = "Bootloader for Digi platforms"
require recipes-bsp/u-boot/u-boot.inc
include u-boot-dey-rev_${PV}.inc
PROVIDES += "u-boot"
LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://COPYING;md5=1707d6db1d42237583f50183a5651ecb"
SRC_URI += "file://boot.txt"
S = "${WORKDIR}/git"
DEPENDS += "elftosb-native u-boot-mkimage-native"
do_compile_prepend() {
${S}/tools/setlocalversion --save-scmversion ${S}
}
do_deploy_append() {
mkimage -T script -n bootscript -C none -d ${WORKDIR}/boot.txt ${DEPLOYDIR}/boot.scr
}
COMPATIBLE_MACHINE = "(ccardimx28)"

View File

@ -88,4 +88,4 @@ pkg_postinst_${PN}() {
fi
}
COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul)"
COMPATIBLE_MACHINE = "(ccimx6sbc|ccimx6qpsbc|ccimx6ul)"

View File

@ -1,34 +0,0 @@
# Copyright (C) 2013 Digi International.
SUMMARY = "Digi's ubootenv tool"
SECTION = "base"
LICENSE = "GPL-2.0"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
DEPENDS = "libdigi nvram"
SRC_URI = " \
file://env_funcs.c \
file://env_funcs.h \
file://environment.h \
file://main_env.c \
"
S = "${WORKDIR}"
GIT_SHA1 = "$(cd ${THISDIR} && git rev-parse --short=7 HEAD)"
EXTRA_CFLAGS = "-Wall -DLINUX -DGIT_SHA1=\"${GIT_SHA1}\" -I${STAGING_INCDIR}/libdigi"
do_compile() {
${CC} ${CFLAGS} ${EXTRA_CFLAGS} -c -o main_env.o main_env.c
${CC} ${CFLAGS} ${EXTRA_CFLAGS} -c -o env_funcs.o env_funcs.c
${CC} ${LDFLAGS} -o ubootenv main_env.o env_funcs.o -lnvram -ldigi
}
do_install() {
mkdir -p ${D}${base_sbindir}
install -m 0755 ubootenv ${D}${base_sbindir}/
}
PACKAGE_ARCH = "${MACHINE_ARCH}"

View File

@ -1,183 +0,0 @@
/*
* env_funcs.c
*
* Copyright (C) 2006-2013 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* Description: Function prototypes for all the flavors of the NVRAM tool
*
*/
#include <stdio.h>
#include <string.h>
#include "env_funcs.h"
/*
* Function: get_var_value
* Return: NULL on failure/ pointer where var value starts on succes
* Description: Checks if the variable name is contained on the string and
* returns a pointer where the variable value starts.
*/
char *get_var_value(const char *from, const char *var_name, char sep)
{
char *separator;
char *start;
if (((separator = strchr(from, sep)) != NULL) &&
((start = strstr(from, var_name)) != NULL)) {
if (start < separator)
return (++separator);
}
return NULL;
}
/*
* Function: get_var_name
* Return: 1 on success, 0 otherwise
* Description: Retrieves the var name from a var string
*/
int get_var_name(const char *from, char *var_name, char sep)
{
char *separator;
if ((separator = strchr(from, sep)) != NULL) {
while (from < separator)
*var_name++ = *from++;
*var_name = 0;
return 1;
}
return 0;
}
/*
* Function: get_next_env_string
* Return: the string to the next environment variable in UBOOT or
* NULL on failure
* Description: returns the addr of the next string in a data structure
* <string>\0<string>\0\0
* It does an offset calculation to check for overflow.
*/
char *get_next_env_string(char *from, char *till)
{
if (*from == 0)
return NULL;
while (from < till && *from)
from++;
if (from == till && *from)
return NULL; // Indicate string to long
return (++from);
}
/*
* Function: get_var_addr
* Return: the pointer to the address string or NULL if not found.
* Description: Returns the addr of the variable in a data structure
* <string>\0<string>\0\0
* It does an offset calculation to check for overflow.
*/
char *get_var_addr(char *from, char *till, char *var_name)
{
char *data = from;
char *var_addr;
char var_name_temp[ENV_MAX_VAR_NAME_LEN + 1];
sprintf(var_name_temp, "%s%s", var_name, "=");
do {
if (*data && data < till) {
if ((var_addr = strstr(data, var_name_temp)) != NULL
&& (var_addr == data))
return var_addr < till ? var_addr : NULL;
}
} while ((data = get_next_env_string(data, till)) != NULL);
return NULL;
}
/*
* Function: get_end_mark
* Description:
*/
char *get_end_mark(char *from, char *till)
{
while (from < till) {
while (*from)
from++;
if (from >= till)
return NULL;
if (*(++from) == 0)
return from;
}
return NULL;
}
/*
* Function: remove_var
* Return: 1 on success, 0 otherwise
* Description: Remove environment variables
*/
int remove_var(char *from, char *till, char *var_name)
{
char *var_addr;
char *env_end;
char *var_end;
/* Check if variable already exists */
if ((var_addr = get_var_addr(from, till, var_name)) != NULL) {
if ((env_end = get_end_mark(var_addr, till)) != NULL) {
if ((var_end = get_next_env_string(var_addr, till)) != NULL) {
while (var_end <= env_end)
*var_addr++ = *var_end++;
while (var_addr <= env_end)
*var_addr++ = 0; /* Just to have a clean environment :-) */
return 1;
}
}
}
return 0;
}
/*
* Function: add_var
* Return: 1 on success, 0 otherwise
* Description: Add a new environment variable
*/
int add_var(char *from, char *till, char *var_str)
{
char *var_addr;
char var_name[ENV_MAX_VAR_NAME_LEN];
if (get_var_name(var_str, var_name, '=')) {
/* Check if variable already exists */
if ((var_addr = get_var_addr(from, till, var_name)) != NULL) {
/* @TODO: remove more?? could be that it were there more than once?? */
if (!remove_var(var_addr, till, var_name))
return 0;
}
/* Append the variable to the end */
if ((var_addr = get_end_mark(from, till)) != NULL) {
/* Check if environment is empty. If yes, start from the beginning */
if (var_addr == (from + 1))
var_addr--;
while (var_addr < till && *var_str)
*var_addr++ = *var_str++;
*var_addr++ = 0;
*var_addr = 0;
return 1;
} else {
fprintf(stderr, "Unable to find environment end\n");
}
}
return 0;
}

View File

@ -1,29 +0,0 @@
/*
* env_funcs.h
*
* Copyright (C) 2006-2013 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* Description: Data types and prototypes for parsing the NVRAM environment
*
*/
#ifndef ENV_FUNCS_H
#define ENV_FUNCS_H
#define ENV_MAX_VAR_NAME_LEN 50
#define ENV_MAX_VAR_VAL_LEN 256
char *get_var_value(const char *from, const char *var_name, char sep);
char *get_next_env_string(char *from, char *till);
char *get_var_addr(char *from, char *till, char *var_name);
char *get_end_mark(char *from, char *till);
int get_var_name(const char *from, char *var_name, char sep);
int add_var(char *from, char *till, char *var_str);
int remove_var(char *from, char *till, char *var_name);
#endif

View File

@ -1,26 +0,0 @@
/*
* environment.h
*
* Copyright (C) 2006-2013 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* Description: Data types and definitions for environment in NVRAM
*
*/
#ifndef __ENV_TOOL_H_
#define __ENV_TOOL_H_
#define VAR_SEP '\0'
#define VAR_ASIGN '='
typedef struct {
unsigned long crc;
char data[];
} env_t;
#endif

View File

@ -1,561 +0,0 @@
/*
* main_env.c
*
* Copyright (C) 2006-2013 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* Description: main() and user code to manage u-boot and linux environment
*
*/
#define VERSION "1.8" "-g"GIT_SHA1
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <mtd/mtd-user.h> /* MEMERASE */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h> /* ioctl */
#include <unistd.h>
#include <libdigi/crc32.h>
#include <nvram.h> /* Nv* */
#include "env_funcs.h"
#include "environment.h"
#define APP_UBOOTENV "ubootenv"
#define APP_PRODINFOENV "prodinfoenv"
static char *fileadd = NULL;
static char *printlist = NULL;
static char *setstring = NULL;
static char *eraselist = NULL;
static char *cmdname = NULL;
static int dump = 0, clean = 0;
static nv_os_type_e envType;
static const char *envTypes[] = {
[NVOS_NONE] = "None",
[NVOS_UBOOT] = "U-Boot",
[NVOS_PROD_INFO] = "Product Info",
};
static const size_t envDefaultSizes[] = {
[NVOS_NONE] = 0,
[NVOS_UBOOT] = 8192, /* Default value is CONFIG_ENV_SIZE, normally set by U-Boot */
[NVOS_PROD_INFO] = PROD_INFO_DATA_SIZE, /* Defined in nvram.h but shouldn't be except uboot needs it */
};
static const char* excludeVars[][2] = {
{"ethaddr", "ethaddr1" },
{"wlanaddr", "ethaddr2" },
{"eth1addr", "ethaddr3" },
{"ipaddr", "ip1" },
{"ipaddr_wlan", "ip2" },
{"ipaddr1", "ip3" },
{"netmask", "netmask1" },
{"netmask_wlan","netmask2" },
{"netmask1", "netmask3" },
{"serverip", "server" },
{"gatewayip", "gateway" },
{"dnsip", "dns1" },
{"dnsip2", "dns2" },
{"dhcp", "dhcp1" },
{"dhcp_wlan", "dhcp2" },
{"dhcp1", "dhcp3" },
};
static const char *env_os_type_to_string(void)
{
return envTypes[envType];
}
static int env_onetime_writable(void)
{
if (NVOS_PROD_INFO == envType)
return 1;
return 0;
}
static int env_is_empty(env_t * env, unsigned int envlen)
{
char *from = (char *)&env->data;
char *till = (char *)&env->data + envlen;
char *end;
end = get_end_mark(from, till);
/* Check if environment is empty. If yes, start from the beginning */
if (end == (from + 1))
return 1;
return 0;
}
static int env_have_to_use_nvram(const char *varname)
{
int j;
if (envType == NVOS_UBOOT) {
for (j = 0; j < ARRAY_SIZE(excludeVars); j++) {
if (strcmp(varname, excludeVars[j][0]) == 0)
return j;
}
}
return -1;
}
static void show_usage(void)
{
fprintf(stdout, "Usage: %s [options]\n"
"%s %s Copyright Digi International Inc.\n\n"
"Prints or updates the %s environment\n"
"\n"
" -d, --dump Prints the values of all the environment\n"
" -p, --print 'var_name_list' Prints the value of the list of variables\n"
" The list has to be simple quoted ('')\n"
" -s, --set 'var_name=var_value' Sets var_value in the variable var_name\n"
" The string has to be simple quoted ('') to allow\n"
" spaces\n"
" -e --erase 'var_name_list' Removes the list of variables (simple quoted)\n"
" -c --clean Removes all variables\n"
" -a --fileadd file_name Adds variables from file_name. To init the full\n"
" environment from file use -c -a simultaneously\n"
" -h --help Displays usage information\n\n",
cmdname, cmdname, VERSION, env_os_type_to_string());
if (env_onetime_writable()) {
fprintf(stdout, " WARNING: Variables can only be set the first time\n"
" and become read-only afterwards.\n");
}
}
static void show_usage_and_exit(int exit_code)
{
show_usage();
exit(exit_code);
}
static void process_options(int argc, char *argv[])
{
int opt_index, opt, optcount = 0;
static const char *short_options = "?hdcp:s:e:a:";
static const struct option long_options[] = {
{"dump", no_argument, NULL, 'd'},
{"help", no_argument, NULL, 'h'},
{"erase", required_argument, NULL, 'e'},
{"clean", no_argument, NULL, 'c'},
{"fileadd", required_argument, NULL, 'a'},
{"print", required_argument, NULL, 'p'},
{"set", required_argument, NULL, 's'},
{0, 0, 0, 0},
};
for (opt_index = 0;;) {
opt = getopt_long(argc, argv, short_options, long_options, &opt_index);
if (opt == EOF)
break;
switch (opt) {
case 'd':
dump = 1;
break;
case 'p':
printlist = optarg;
break;
case 's':
setstring = optarg;
break;
case 'a':
fileadd = optarg;
break;
case 'e':
eraselist = optarg;
break;
case 'c':
clean = 1;
break;
case 'h':
case '?':
show_usage_and_exit(EXIT_SUCCESS);
break;
}
optcount++;
}
if (optcount == 0)
show_usage_and_exit(EXIT_FAILURE);
/* Check options */
if (dump && (printlist != NULL)) {
fprintf(stderr, "--dump and --print can't be used simultaneously\n");
show_usage_and_exit(EXIT_FAILURE);
}
if (clean && (eraselist != NULL)) {
fprintf(stderr, "--clean and --erase can't be used simultaneously\n");
show_usage_and_exit(EXIT_FAILURE);
}
}
static int env_add_var(const char *varstring, env_t * env, unsigned int envlen)
{
char *nvramCmd[3] = { "set", "network", NULL };
char tmpstr[50];
char *varval;
int j;
if (varstring == NULL)
return -EINVAL;
if (!get_var_name(varstring, tmpstr, VAR_ASIGN))
return -EINVAL;
/* Check if is a special variable */
if ((j = env_have_to_use_nvram(tmpstr)) != -1) {
if ((varval = get_var_value(varstring, excludeVars[j][0], VAR_ASIGN)) != NULL) {
/* Define command to be used by nvram */
sprintf(tmpstr, "%s=%s", excludeVars[j][1], varval);
nvramCmd[2] = tmpstr;
if (!NvCmdLine(3, (const char **)nvramCmd)) {
return -EINVAL;
}
}
} else {
if (!add_var(env->data, env->data + envlen, (char *)varstring)) {
return -EINVAL;
}
}
return 0;
}
static int env_add_vars_from_file(char *filename, env_t * env, unsigned int envlen)
{
FILE *fp;
char line[ENV_MAX_VAR_NAME_LEN + ENV_MAX_VAR_VAL_LEN + 3];
int ret = EXIT_SUCCESS;
if ((fp = fopen(filename, "r")) == NULL)
return -errno;
while (!feof(fp)) {
if (fgets(line, sizeof(line), fp)) {
/* TODO should we remove comments starting with # ?? */
/* Remove '\n' */
if (line[strlen(line) - 1] == '\n')
line[strlen(line) - 1] = 0;
if (env_add_var((const char *)line, env, envlen)) {
fprintf(stderr, "Unable to add environment variable %s\n",
line);
ret = -EINVAL;
goto out;
}
}
}
out:
if (fp)
fclose(fp);
return ret;
}
static void env_remove_varlist(const char *varlist, env_t * env, unsigned int envlen)
{
char *var;
var = strtok((char *)varlist, " ");
while (var != NULL) {
if (!remove_var(env->data, env->data + envlen, var))
fprintf(stderr, "Unable to remove environment variable %s\n", var);
var = strtok(NULL, " ");
}
}
static int env_validate(env_t * env, int datalen, int verbose)
{
unsigned long new_crc;
/* Check stored crc with data */
new_crc = crc32(0, (const unsigned char *)env->data, datalen);
if ((unsigned int)env->crc != new_crc) {
if ( verbose ) {
fprintf(stderr, "CRC failure: got 0x%08x expected 0x%08x\n",
(unsigned int)env->crc, (unsigned int)new_crc);
}
return 1;
}
return 0;
}
static void env_printenv_nvram_vars(char *varname)
{
struct nv_critical *crit;
nv_param_ip_t *ip_params;
int index;
int oneloop = 0;
if (NvCriticalGet(&crit)) {
ip_params = &crit->s.p.xIP;
for (index = 3; index < ARRAY_SIZE(excludeVars); index++) {
if (varname != NULL) {
if ((index = env_have_to_use_nvram(varname)) == -1)
break;
oneloop = 1;
}
switch (index) {
case 3:
fprintf(stdout, "ipaddr=%s\n",
NvToStringIP(ip_params->axDevice[0].uiIP));
break;
case 4:
fprintf(stdout, "ipaddr_wlan=%s\n",
NvToStringIP(ip_params->axDevice[1].uiIP));
break;
case 5:
fprintf(stdout, "ipaddr1=%s\n",
NvToStringIP(crit->s.p.eth1dev.uiIP));
break;
case 6:
fprintf(stdout, "netmask=%s\n",
NvToStringIP(ip_params->axDevice[0].uiNetMask));
break;
case 7:
fprintf(stdout, "netmask_wlan=%s\n",
NvToStringIP(ip_params->axDevice[1].uiNetMask));
break;
case 8:
fprintf(stdout, "netmask1=%s\n",
NvToStringIP(crit->s.p.eth1dev.uiNetMask));
break;
case 9:
fprintf(stdout, "serverip=%s\n",
NvToStringIP(ip_params->uiIPServer));
break;
case 10:
fprintf(stdout, "gatewayip=%s\n",
NvToStringIP(ip_params->uiIPGateway));
break;
case 11:
fprintf(stdout, "dnsip=%s\n",
NvToStringIP(ip_params->auiIPDNS[0]));
break;
case 12:
fprintf(stdout, "dnsip2=%s\n",
NvToStringIP(ip_params->auiIPDNS[1]));
break;
case 13:
fprintf(stdout, "dhcp=%s\n",
(ip_params->axDevice[0].flags.bDHCP ? "on" : "off"));
break;
case 14:
fprintf(stdout, "dhcp_wlan=%s\n",
(ip_params->axDevice[1].flags.bDHCP ? "on" : "off"));
break;
case 15:
fprintf(stdout, "dhcp1=%s\n",
(crit->s.p.eth1dev.flags.bDHCP ? "on" : "off"));
break;
}
if (oneloop)
break;
}
}
}
static void env_printenv(int dump, char *varlist, env_t * env, unsigned int envlen)
{
char *var;
char *data = env->data;
char *varinenv;
if (dump) {
/* print the full environment */
while (data != NULL && *data) {
fprintf(stdout, "%s\n", data);
data = get_next_env_string(data, env->data + envlen);
}
if (envType == NVOS_UBOOT)
env_printenv_nvram_vars(NULL);
return;
} else {
var = strtok((char *)varlist, " ");
while (var != NULL) {
if (envType == NVOS_UBOOT)
env_printenv_nvram_vars(var);
if ((varinenv =
get_var_addr(env->data, env->data + envlen, var)) != NULL) {
fprintf(stdout, "%s\n", varinenv);
}
var = strtok(NULL, " ");
}
}
}
int main(int argc, char *argv[])
{
unsigned int envlen = 0;
env_t *env = NULL;
nv_param_os_cfg_t xCfg;
size_t iSize;
int save_env = 0;
int ret = EXIT_SUCCESS;
int found;
char *cmdstart;
cmdname = argv[0];
cmdname = *argv;
if ((cmdstart = strrchr(cmdname, '/')) != NULL) {
cmdname = cmdstart + 1;
}
if (strcmp(cmdname, APP_UBOOTENV) == 0)
envType = NVOS_UBOOT;
else if (strcmp(cmdname, APP_PRODINFOENV) == 0)
envType = NVOS_PROD_INFO;
else {
fprintf(stderr, "This application can be invoked as:\n"
"%s\n%s\n\n", APP_UBOOTENV, APP_PRODINFOENV);
return EXIT_FAILURE;
}
/* read and process command line */
process_options(argc, argv);
if (!NvInit(NVR_AUTO)) {
fprintf(stderr, "Unable to initialize nvram\n");
return EXIT_FAILURE;
}
found = NvOSCfgFind(&xCfg, envType);
if (!found && clean) {
/* Add missing section to nvram if --clean specified */
if (envDefaultSizes[envType] != 0 ) {
if (!NvOSCfgAdd(envType, envDefaultSizes[envType])) {
fprintf(stderr, "Unable to add missing %s environment to flash\n",
env_os_type_to_string());
return EXIT_FAILURE;
}
/* Try again to find our section */
found = NvOSCfgFind(&xCfg, envType);
}
}
if (!found) {
fprintf(stderr, "Unable to detect %s environment in flash\n",
env_os_type_to_string());
return EXIT_FAILURE;
}
env = malloc(xCfg.uiSize);
if (NULL == env) {
perror("malloc");
return EXIT_FAILURE;
}
memset(env, 0, xCfg.uiSize);
/* Adjust envlen for just for data, crc32 value not included */
envlen = xCfg.uiSize - sizeof(unsigned long);
if (!NvOSCfgGet(envType, (void *)env, xCfg.uiSize, &iSize)) {
/* This can't fail; we either found it, created it, or exited. */
/* But just to be safe... */
fprintf(stderr, "Unable to get %s environment from flash\n",
env_os_type_to_string());
ret = EXIT_FAILURE;
goto free_and_ret;
}
/* Check if env is one-time writable, is valid, and was already written */
if (env_onetime_writable() && !env_validate(env, envlen, 0) &&
!env_is_empty(env, envlen)) {
if ( clean || fileadd || eraselist || setstring ) {
fprintf(stderr, "Environment is one-time writable only\n");
ret = EXIT_FAILURE;
goto free_and_ret;
}
}
if (clean) {
memset(env, 0, xCfg.uiSize);
save_env = 1;
} else {
if (env_validate(env, envlen, 1)) {
fprintf(stderr, "Invalid %s environment found\n",
env_os_type_to_string());
ret = EXIT_FAILURE;
goto free_and_ret;
}
}
if (fileadd != NULL) {
if (env_add_vars_from_file(fileadd, env, envlen) < 0) {
fprintf(stderr, "Unable to add %s environment from file %s\n",
env_os_type_to_string(), fileadd);
ret = EXIT_FAILURE;
goto free_and_ret;
}
save_env = 1;
}
if (eraselist != NULL) {
env_remove_varlist(eraselist, env, envlen);
save_env = 1;
}
if (setstring != NULL) {
if (env_add_var(setstring, env, envlen)) {
fprintf(stderr, "Unable to add environment variable %s\n", setstring);
ret = EXIT_FAILURE;
goto free_and_ret;
}
save_env = 1;
}
if (dump) {
env_printenv(1, NULL, env, envlen);
} else if (printlist != NULL) {
env_printenv(0, printlist, env, envlen);
}
if (save_env) {
/* Compute new crc32 value just in case we are going to update the value in flash */
env->crc = crc32(0, (const unsigned char *)env->data, envlen);
if (!NvOSCfgSet(envType, env, xCfg.uiSize)) {
fprintf(stderr, "Unable to set %s environment to store in flash\n",
env_os_type_to_string());
ret = EXIT_FAILURE;
}
if (!NvSave()) {
fprintf(stderr, "Unable to save %s environment in flash\n",
env_os_type_to_string());
ret = EXIT_FAILURE;
}
}
free_and_ret:
free(env);
return ret;
}

View File

@ -1,26 +0,0 @@
# Copyright (C) 2013,2017 Digi International.
SUMMARY = "Digi's update test utility"
SECTION = "base"
LICENSE = "GPL-2.0"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
DEPENDS += "libdigi"
RDEPENDS_${PN}_append_mxs = " kobs-ng"
SRC_URI = "file://update_flash.c \
file://jffs2-user.h \
"
GIT_SHA1 = "$(cd ${THISDIR} && git rev-parse --short HEAD)"
S = "${WORKDIR}"
do_compile() {
${CC} -O2 -Wall ${LDFLAGS} -DGIT_SHA1=\"${GIT_SHA1}\" update_flash.c -o update_flash -ldigi
}
do_install() {
install -d ${D}${bindir}
install -m 0755 update_flash ${D}${bindir}
}

View File

@ -1,33 +0,0 @@
/*
* JFFS2 definitions for use in user space only
*/
#ifndef __JFFS2_USER_H__
#define __JFFS2_USER_H__
/* This file is blessed for inclusion by userspace */
#include <linux/jffs2.h>
#include <endian.h>
#include <byteswap.h>
#undef cpu_to_je16
#undef cpu_to_je32
#undef cpu_to_jemode
#undef je16_to_cpu
#undef je32_to_cpu
#undef jemode_to_cpu
extern int target_endian;
#define t16(x) ({ uint16_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); })
#define t32(x) ({ uint32_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); })
#define cpu_to_je16(x) ((jint16_t){t16(x)})
#define cpu_to_je32(x) ((jint32_t){t32(x)})
#define cpu_to_jemode(x) ((jmode_t){t32(x)})
#define je16_to_cpu(x) (t16((x).v16))
#define je32_to_cpu(x) (t32((x).v32))
#define jemode_to_cpu(x) (t32((x).m))
#endif /* __JFFS2_USER_H__ */

View File

@ -0,0 +1,2 @@
# Skip loading Spidev module
SUBSYSTEM=="spi", ACTION=="add", ENV{MODALIAS}=="spi:spidev", RUN="/bin/true"

View File

@ -1,15 +1,17 @@
# Copyright (C) 2013 Digi International.
# Copyright (C) 2013-2017 Digi International.
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
SRC_URI += " \
file://mount_bootparts.sh \
file://mount_partition.sh \
file://81-spi-spidev.rules \
"
do_install_append() {
install -m 0755 ${WORKDIR}/mount_bootparts.sh ${D}${sysconfdir}/udev/scripts/
install -m 0755 ${WORKDIR}/mount_partition.sh ${D}${sysconfdir}/udev/scripts/
install -m 0644 ${WORKDIR}/81-spi-spidev.rules ${D}${sysconfdir}/udev/rules.d/
# Bluetooth tty symlink
if [ -n "${BT_TTY}" ]; then

View File

@ -0,0 +1,32 @@
From: Michael Weiser <michael.weiser@gmx.de>
Date: Fri, 11 Nov 2016 18:09:32 +0100
Subject: [PATCH] Adjust to another change in the user page API
4.9.0 will replace the write and force flags of get_user_pages_remote()
with a gup_flags parameter[1]. Distinguish the two APIs based on kernel
version we're compiling for.
[1] https://github.com/torvalds/linux/commit/9beae1ea89305a9667ceaab6d0bf46a045ad71e7
---
zc.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/zc.c b/zc.c
index a97b49f75327..e766ee3eabc7 100644
--- a/zc.c
+++ b/zc.c
@@ -65,7 +65,13 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write,
ret = get_user_pages(
#endif
task, mm,
- (unsigned long)addr, pgcount, write, 0, pg, NULL);
+ (unsigned long)addr, pgcount,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))
+ write ? FOLL_WRITE : 0,
+#else
+ write, 0,
+#endif
+ pg, NULL);
up_read(&mm->mmap_sem);
if (ret != pgcount)
return -EINVAL;

View File

@ -1,3 +1,7 @@
# Copyright (C) 2016 Digi International.
# Copyright (C) 2016-2017 Digi International Inc.
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
SRC_URI_append = " file://0002-Adjust-to-another-change-in-the-user-page-API.patch"
KERNEL_MODULE_AUTOLOAD = "cryptodev"

View File

@ -1,50 +0,0 @@
# Copyright (C) 2013 Digi International.
SUMMARY = "Atheros's wireless driver"
LICENSE = "ISC"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/ISC;md5=f3b90e78ea0cffb20bf5cca7947a896d"
inherit module
SRCREV_external = ""
SRCREV_internal = "50dafb5890180cf33fdb42919c3e6f591d0cd2ea"
SRCREV = "${@base_conditional('DIGI_INTERNAL_GIT', '1' , '${SRCREV_internal}', '${SRCREV_external}', d)}"
SRC_URI_external = "${DIGI_GITHUB_GIT}/atheros.git;protocol=git;nobranch=1"
SRC_URI_internal = "${DIGI_GIT}linux-modules/atheros.git;protocol=git;nobranch=1"
SRC_URI = "${@base_conditional('DIGI_INTERNAL_GIT', '1' , '${SRC_URI_internal}', '${SRC_URI_external}', d)}"
SRC_URI += " \
file://atheros-pre-up \
file://Makefile \
file://0001-atheros-convert-NLA_PUT-macros.patch \
file://0002-atheros-update-renamed-struct-members.patch \
"
S = "${WORKDIR}/git"
EXTRA_OEMAKE += "DEL_PLATFORM=${MACHINE} KLIB_BUILD=${STAGING_KERNEL_DIR}"
do_configure_prepend() {
cp ${WORKDIR}/Makefile ${S}/
}
do_install_append() {
install -d ${D}${sysconfdir}/network/if-pre-up.d
install -m 0755 ${WORKDIR}/atheros-pre-up ${D}${sysconfdir}/network/if-pre-up.d/atheros
install -d ${D}${sysconfdir}/modprobe.d
cat >> ${D}${sysconfdir}/modprobe.d/atheros.conf <<-_EOF_
install ath6kl_sdio true
options ath6kl_sdio ath6kl_p2p=1 softmac_enable=1
_EOF_
}
FILES_${PN} += " \
${sysconfdir}/modprobe.d/ \
${sysconfdir}/network/ \
"
# 'modprobe' from kmod package is needed to load atheros driver. The one
# from busybox does not support '--ignore-install' option.
RDEPENDS_${PN} = "kmod"
COMPATIBLE_MACHINE = "(ccardimx28)"

View File

@ -1,235 +0,0 @@
From: Javier Viguera <javier.viguera@digi.com>
Date: Fri, 13 Sep 2013 11:12:04 +0200
Subject: [PATCH] atheros: update renamed struct members
struct genl_info: s/snd_pid/snd_portid
struct netlink_notify: s/pid/portid
struct netlink_skb_parms: s/pid/portid
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
---
compat-wireless/net/wireless/nl80211.c | 50 ++++++++++++++++----------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/compat-wireless/net/wireless/nl80211.c b/compat-wireless/net/wireless/nl80211.c
index c219a2ca027f..2cba63866a90 100644
--- a/compat-wireless/net/wireless/nl80211.c
+++ b/compat-wireless/net/wireless/nl80211.c
@@ -1122,7 +1122,7 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb)
continue;
if (++idx <= start)
continue;
- if (nl80211_send_wiphy(skb, NETLINK_CB(cb->skb).pid,
+ if (nl80211_send_wiphy(skb, NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, NLM_F_MULTI,
dev) < 0) {
idx--;
@@ -1145,7 +1145,7 @@ static int nl80211_get_wiphy(struct sk_buff *skb, struct genl_info *info)
if (!msg)
return -ENOMEM;
- if (nl80211_send_wiphy(msg, info->snd_pid, info->snd_seq, 0, dev) < 0) {
+ if (nl80211_send_wiphy(msg, info->snd_portid, info->snd_seq, 0, dev) < 0) {
nlmsg_free(msg);
return -ENOBUFS;
}
@@ -1590,7 +1590,7 @@ static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback *
if_idx++;
continue;
}
- if (nl80211_send_iface(skb, NETLINK_CB(cb->skb).pid,
+ if (nl80211_send_iface(skb, NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, NLM_F_MULTI,
rdev, wdev->netdev) < 0) {
mutex_unlock(&rdev->devlist_mtx);
@@ -1621,7 +1621,7 @@ static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info)
if (!msg)
return -ENOMEM;
- if (nl80211_send_iface(msg, info->snd_pid, info->snd_seq, 0,
+ if (nl80211_send_iface(msg, info->snd_portid, info->snd_seq, 0,
dev, netdev) < 0) {
nlmsg_free(msg);
return -ENOBUFS;
@@ -1922,7 +1922,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)
if (!msg)
return -ENOMEM;
- hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0,
+ hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
NL80211_CMD_NEW_KEY);
if (IS_ERR(hdr))
return PTR_ERR(hdr);
@@ -2628,7 +2628,7 @@ static int nl80211_dump_station(struct sk_buff *skb,
goto out_err;
if (nl80211_send_station(skb,
- NETLINK_CB(cb->skb).pid,
+ NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, NLM_F_MULTI,
netdev, mac_addr,
&sinfo) < 0)
@@ -2674,7 +2674,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info)
if (!msg)
return -ENOMEM;
- if (nl80211_send_station(msg, info->snd_pid, info->snd_seq, 0,
+ if (nl80211_send_station(msg, info->snd_portid, info->snd_seq, 0,
dev, mac_addr, &sinfo) < 0) {
nlmsg_free(msg);
return -ENOBUFS;
@@ -3062,7 +3062,7 @@ static int nl80211_dump_mpath(struct sk_buff *skb,
if (err)
goto out_err;
- if (nl80211_send_mpath(skb, NETLINK_CB(cb->skb).pid,
+ if (nl80211_send_mpath(skb, NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, NLM_F_MULTI,
netdev, dst, next_hop,
&pinfo) < 0)
@@ -3111,7 +3111,7 @@ static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info)
if (!msg)
return -ENOMEM;
- if (nl80211_send_mpath(msg, info->snd_pid, info->snd_seq, 0,
+ if (nl80211_send_mpath(msg, info->snd_portid, info->snd_seq, 0,
dev, dst, next_hop, &pinfo) < 0) {
nlmsg_free(msg);
return -ENOBUFS;
@@ -3337,7 +3337,7 @@ static int nl80211_get_mesh_config(struct sk_buff *skb,
msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
if (!msg)
return -ENOMEM;
- hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0,
+ hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
NL80211_CMD_GET_MESH_CONFIG);
if (!hdr)
goto out;
@@ -3612,7 +3612,7 @@ static int nl80211_get_reg(struct sk_buff *skb, struct genl_info *info)
goto out;
}
- hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0,
+ hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
NL80211_CMD_GET_REG);
if (!hdr)
goto put_failure;
@@ -4216,7 +4216,7 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb,
ASSERT_WDEV_LOCK(wdev);
- hdr = nl80211hdr_put(msg, NETLINK_CB(cb->skb).pid, seq, flags,
+ hdr = nl80211hdr_put(msg, NETLINK_CB(cb->skb).portid, seq, flags,
NL80211_CMD_NEW_SCAN_RESULTS);
if (!hdr)
return -1;
@@ -4451,7 +4451,7 @@ static int nl80211_dump_survey(struct sk_buff *skb,
}
if (nl80211_send_survey(skb,
- NETLINK_CB(cb->skb).pid,
+ NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, NLM_F_MULTI,
netdev,
&survey) < 0)
@@ -5010,7 +5010,7 @@ static int nl80211_testmode_dump(struct sk_buff *skb,
}
while (1) {
- void *hdr = nl80211hdr_put(skb, NETLINK_CB(cb->skb).pid,
+ void *hdr = nl80211hdr_put(skb, NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, NLM_F_MULTI,
NL80211_CMD_TESTMODE);
struct nlattr *tmdata;
@@ -5090,7 +5090,7 @@ struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy,
return NULL;
return __cfg80211_testmode_alloc_skb(rdev, approxlen,
- rdev->testmode_info->snd_pid,
+ rdev->testmode_info->snd_portid,
rdev->testmode_info->snd_seq,
GFP_KERNEL);
}
@@ -5427,7 +5427,7 @@ static int nl80211_remain_on_channel(struct sk_buff *skb,
if (!msg)
return -ENOMEM;
- hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0,
+ hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
NL80211_CMD_REMAIN_ON_CHANNEL);
if (IS_ERR(hdr)) {
@@ -5638,7 +5638,7 @@ static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info)
if (!rdev->ops->mgmt_tx)
return -EOPNOTSUPP;
- return cfg80211_mlme_register_mgmt(dev->ieee80211_ptr, info->snd_pid,
+ return cfg80211_mlme_register_mgmt(dev->ieee80211_ptr, info->snd_portid,
frame_type,
nla_data(info->attrs[NL80211_ATTR_FRAME_MATCH]),
nla_len(info->attrs[NL80211_ATTR_FRAME_MATCH]));
@@ -5708,7 +5708,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
if (!msg)
return -ENOMEM;
- hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0,
+ hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
NL80211_CMD_FRAME);
if (IS_ERR(hdr)) {
@@ -5820,7 +5820,7 @@ static int nl80211_get_power_save(struct sk_buff *skb, struct genl_info *info)
if (!msg)
return -ENOMEM;
- hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0,
+ hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
NL80211_CMD_GET_POWER_SAVE);
if (!hdr) {
err = -ENOBUFS;
@@ -5998,7 +5998,7 @@ static int nl80211_get_wowlan(struct sk_buff *skb, struct genl_info *info)
if (!msg)
return -ENOMEM;
- hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0,
+ hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
NL80211_CMD_GET_WOWLAN);
if (!hdr)
goto nla_put_failure;
@@ -6281,7 +6281,7 @@ static int nl80211_register_unexpected_frame(struct sk_buff *skb,
if (wdev->ap_unexpected_nlpid)
return -EBUSY;
- wdev->ap_unexpected_nlpid = info->snd_pid;
+ wdev->ap_unexpected_nlpid = info->snd_portid;
return 0;
}
@@ -6311,7 +6311,7 @@ static int nl80211_probe_client(struct sk_buff *skb,
if (!msg)
return -ENOMEM;
- hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0,
+ hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
NL80211_CMD_PROBE_CLIENT);
if (IS_ERR(hdr)) {
@@ -6349,7 +6349,7 @@ static int nl80211_register_beacons(struct sk_buff *skb, struct genl_info *info)
if (rdev->ap_beacons_nlpid)
return -EBUSY;
- rdev->ap_beacons_nlpid = info->snd_pid;
+ rdev->ap_beacons_nlpid = info->snd_portid;
return 0;
}
@@ -8357,8 +8357,8 @@ static int nl80211_netlink_notify(struct notifier_block * nb,
list_for_each_entry_rcu(rdev, &cfg80211_rdev_list, list) {
list_for_each_entry_rcu(wdev, &rdev->netdev_list, list)
- cfg80211_mlme_unregister_socket(wdev, notify->pid);
- if (rdev->ap_beacons_nlpid == notify->pid)
+ cfg80211_mlme_unregister_socket(wdev, notify->portid);
+ if (rdev->ap_beacons_nlpid == notify->portid)
rdev->ap_beacons_nlpid = 0;
}

View File

@ -1,42 +0,0 @@
ATH_DRV_BASEDIR := compat-wireless
ifneq ($(KERNELRELEASE),)
ATH_DEFINES += \
-DCOMPAT_BASE_TREE="\"$(shell cat $(src)/$(ATH_DRV_BASEDIR)/compat_base_tree)\"" \
-DCOMPAT_BASE_TREE_VERSION="\"$(shell cat $(src)/$(ATH_DRV_BASEDIR)/compat_base_tree_version)\"" \
-DCOMPAT_PROJECT="\"Compat-wireless\"" \
-DCOMPAT_VERSION="\"$(shell cat $(src)/$(ATH_DRV_BASEDIR)/compat_version)\""
NOSTDINC_FLAGS := -I$(M)/$(ATH_DRV_BASEDIR)/include/ \
-include $(M)/$(ATH_DRV_BASEDIR)/include/linux/compat-2.6.h \
$(ATH_DEFINES)
include $(src)/$(ATH_DRV_BASEDIR)/config.mk
SHELL_EXPORT := PATH=$(src)/$(ATH_DRV_BASEDIR)/scripts:$${PATH} \
COMPAT_CONFIG=$(src)/$(ATH_DRV_BASEDIR)/config.mk \
CONFIG_CHECK=.$(COMPAT_CONFIG)_md5sum.txt \
COMPAT_AUTOCONF=$(src)/$(ATH_DRV_BASEDIR)/include/linux/compat_autoconf.h
dummy := $(shell $(SHELL_EXPORT) bash -c "cd $(src)/$(ATH_DRV_BASEDIR) && ./scripts/check_config.sh || true")
obj-y := $(ATH_DRV_BASEDIR)/compat/
obj-y += $(ATH_DRV_BASEDIR)/net/wireless/
obj-y += $(ATH_DRV_BASEDIR)/drivers/net/wireless/ath/ath6kl/
else #ifneq ($(KERNELRELEASE),)
SRC := $(shell pwd)
all:
$(MAKE) -C $(KERNEL_SRC) M=$(SRC)
modules_install:
$(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install
# Fix installation directory of the modules.
find $(INSTALL_MOD_PATH)/lib/modules/$(KERNEL_VERSION)/extra/$(ATH_DRV_BASEDIR) -type f -name '*.ko' | \
xargs -I modfile mv -f modfile $(INSTALL_MOD_PATH)/lib/modules/$(KERNEL_VERSION)/extra/
rm -rf $(INSTALL_MOD_PATH)/lib/modules/*/extra/$(ATH_DRV_BASEDIR)
endif #ifneq ($(KERNELRELEASE),)

View File

@ -1,139 +0,0 @@
#!/bin/sh
#===============================================================================
#
# 10-atheros_pre-up
#
# Copyright (C) 2012 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
#
# !Description: Load Atheros' wireless driver
#
#===============================================================================
set -e
[ "${IFACE}" != "wlan0" ] && exit 0
FIRMWARE_DIR="/lib/firmware/ath6k/AR6003/hw2.1.1"
ATH6KL_DBG_NONE=0x0
ATH6KL_DBG_CREDIT=0x00000001
ATH6KL_DBG_WLAN_TX=0x00000004
ATH6KL_DBG_WLAN_RX=0x00000008
ATH6KL_DBG_BMI=0x00000010
ATH6KL_DBG_HTC=0x00000020
ATH6KL_DBG_HIF=0x00000040
ATH6KL_DBG_IRQ=0x00000080
ATH6KL_DBG_WMI=0x00000400
ATH6KL_DBG_TRC=0x00000800
ATH6KL_DBG_SCATTER=0x00001000
ATH6KL_DBG_WLAN_CFG=0x00002000
ATH6KL_DBG_RAW_BYTES=0x00004000
ATH6KL_DBG_AGGR=0x00008000
ATH6KL_DBG_SDIO=0x00010000
ATH6KL_DBG_SDIO_DUMP=0x00020000
ATH6KL_DBG_BOOT=0x00040000
ATH6KL_DBG_WMI_DUMP=0x00080000
ATH6KL_DBG_SUSPEND=0x00100000
ATH6KL_DBG_USB=0x00200000
ATH6KL_DBG_RECOVERY=0x00400000
ATH6KL_DBG_ANY=0xffffffff
ATH6KL_DEBUG_MASK="${ATH6KL_DBG_NONE}"
#
# Get the wlan MAC address from kernel command line. Use a default
# value if the address has not been set.
#
if [ -f "/proc/device-tree/wireless/mac-address" ]; then
MAC_ADDR="$(hexdump -ve '1/1 "%02X" ":"' /proc/device-tree/wireless/mac-address | sed 's/:$//g')"
else
MAC_ADDR="$(sed -ne 's,^.*ethaddr2=\([^[:blank:]]\+\)[:blank:]*.*,\1,g;T;p' /proc/cmdline)"
fi
if [ -z "${MAC_ADDR}" -o "${MAC_ADDR}" = "00:00:00:00:00:00" ]; then
MAC_ADDR="00:04:F3:4C:B1:D3"
fi
# We need to write the WLAN MAC address to softmac in the ath6k firmware
# directory. However, we don't want to rewrite the file if it already exists
# and the address is the same because we don't want to wear out NAND flash.
#
# So create the file on the RAM DRIVE first and compare the two. Only update
# the copy on NAND if the address has changed.
#
mac1="$(echo ${MAC_ADDR} | cut -d':' -f1)"
mac2="$(echo ${MAC_ADDR} | cut -d':' -f2)"
mac3="$(echo ${MAC_ADDR} | cut -d':' -f3)"
mac4="$(echo ${MAC_ADDR} | cut -d':' -f4)"
mac5="$(echo ${MAC_ADDR} | cut -d':' -f5)"
mac6="$(echo ${MAC_ADDR} | cut -d':' -f6)"
TMP_MACFILE="$(mktemp -t softmac.XXXXXX)"
printf "\x${mac1}\x${mac2}\x${mac3}\x${mac4}\x${mac5}\x${mac6}" > ${TMP_MACFILE}
if ! cmp -s ${TMP_MACFILE} ${FIRMWARE_DIR}/softmac; then
cp ${TMP_MACFILE} ${FIRMWARE_DIR}/softmac
fi
rm -f ${TMP_MACFILE}
# Figure out which wireless region we are in. The US has rules for
# what channels can be used and at what power level. We use a different set of
# rules for the other regions in the world that we sell into. The mod_cert field
# in OTP will be set to 0x0 for the US. Once we know the region, make sure the
# appropriate calibration file is loaded.
#
MACHINE="$(cat /proc/device-tree/digi,machine,name 2>/dev/null || \
cat /sys/kernel/machine/name)"
MOD_VARIANT="$(cat /proc/device-tree/digi,hwid,variant 2>/dev/null || \
cat /sys/kernel/${MACHINE}/mod_variant)"
REGION_CODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null || \
cat /sys/kernel/${MACHINE}/mod_cert)"
# 'ccimx6sbc' variants 0x05, 0x07 and 0x0a do not have bluetooth
# and use a different calibration file
US_CODE="0x0"
case "${MACHINE}:${MOD_VARIANT}:${REGION_CODE}" in
ccimx6sbc:0x05:${US_CODE}|ccimx6sbc:0x07:${US_CODE}|ccimx6sbc:0x0a:${US_CODE})
BDATA_SOURCE="Digi_6203_2_ANT-US.bin"
logger -t atheros "Setting US wireless region (no bluetooth)";;
ccimx6sbc:0x05:*|ccimx6sbc:0x07:*|ccimx6sbc:0x0a:*)
BDATA_SOURCE="Digi_6203_2_ANT-World.bin"
logger -t atheros "Setting non-US (world) wireless region (no bluetooth)";;
*:*:${US_CODE})
BDATA_SOURCE="Digi_6203-6233-US.bin"
logger -t atheros "Setting US wireless region";;
*:*:*)
BDATA_SOURCE="Digi_6203-6233-World.bin"
logger -t atheros "Setting non-US (world) wireless region";;
esac
# We don't want to rewrite NAND every time we boot so only
# change the link if it is wrong.
BDATA_LINK="${FIRMWARE_DIR}/bdata.bin"
if [ ! -e "${BDATA_LINK}" ] || ! cmp -s "${BDATA_LINK}" "${FIRMWARE_DIR}/${BDATA_SOURCE}"; then
ln -sf "${BDATA_SOURCE}" "${BDATA_LINK}"
fi
# Load 'cfg80211' and let it settle down (needed by 'ath6kl_sdio')
modprobe -q cfg80211 && sleep 0.2
# ath6kl_sdio.ko
if ! grep -qs ath6kl_sdio /proc/modules; then
RETRIES="5"
while [ "${RETRIES}" -gt "0" ]; do
modprobe --ignore-install -q ath6kl_sdio debug_mask="${ATH6KL_DEBUG_MASK}" || true
[ -d "/sys/class/net/wlan0" ] && break
RETRIES="$((RETRIES - 1))"
rmmod ath6kl_sdio > /dev/null
echo "Retrying to load wireless"
sleep 2
done
[ "${RETRIES}" -eq "0" ] && echo "Loading ath6kl_sdio module: [FAILED]"
fi
# Delay required for the interface 'wlan0' to settle down before trying to configure it.
sleep 0.5

View File

@ -56,4 +56,4 @@ FILES_${PN} += " \
${base_libdir}/firmware/wlan/qcom_cfg.ini \
"
COMPATIBLE_MACHINE = "(ccimx6ul)"
COMPATIBLE_MACHINE = "(ccimx6qpsbc|ccimx6ul)"

View File

@ -0,0 +1,71 @@
From: Javier Viguera <javier.viguera@digi.com>
Date: Tue, 10 Nov 2015 17:45:37 +0100
Subject: [PATCH] mxc: gpu: use recommended values for minimum GPU frequency
divisor
Freescale recommends the following default minimum GPU frequency divisors
depending on the CPU family:
- 3 for Dual/Quad
- 8 for DualLite/Solo
Adapted for the external Vivante GPU driver from commit a790ad3 in linux
git repository.
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
---
.../hal/os/linux/kernel/gc_hal_kernel_driver.c | 14 +++++++++++++-
.../platform/freescale/gc_hal_kernel_platform_imx6.c | 2 +-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_driver.c b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_driver.c
index 816aae0..15a8753 100644
--- a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_driver.c
+++ b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_driver.c
@@ -54,6 +54,7 @@
#include <linux/device.h>
+#include <linux/of.h>
#include <linux/slab.h>
#include <linux/miscdevice.h>
@@ -199,7 +200,7 @@ static uint type = 0;
module_param(type, uint, 0664);
MODULE_PARM_DESC(type, "0 - Char Driver (Default), 1 - Misc Driver");
-static int gpu3DMinClock = 1;
+static int gpu3DMinClock = 0;
static int contiguousRequested = 0;
@@ -1138,6 +1139,17 @@ static int __devinit gpu_probe(struct platform_device *pdev)
}
}
else {
+ /* If undefined, set Freescale recommended value. Else use the min freq. */
+ if (gpu3DMinClock == 0) {
+ if (of_machine_is_compatible("fsl,imx6dl"))
+ gpu3DMinClock = 8;
+ else if (of_machine_is_compatible("fsl,imx6q") ||
+ of_machine_is_compatible("fsl,imx6qp"))
+ gpu3DMinClock = 3;
+ else
+ gpu3DMinClock = 1;
+ }
+
ret = drv_init();
if (!ret) {
platform_set_drvdata(pdev, galDevice);
diff --git a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c
index 89706ec..65a54e2 100644
--- a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c
+++ b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c
@@ -123,7 +123,7 @@ extern int unregister_thermal_notifier(struct notifier_block *nb);
#define gcdFSL_CONTIGUOUS_SIZE (4 << 20)
#endif
-static int initgpu3DMinClock = 1;
+static int initgpu3DMinClock = 0;
module_param(initgpu3DMinClock, int, 0644);
struct platform_device *pdevice;

View File

@ -0,0 +1,26 @@
From: Hector Palacios <hector.palacios@digi.com>
Date: Tue, 1 Dec 2015 11:36:24 +0100
Subject: [PATCH] Use busfreq-imx6.h up to 3.15 kernel
For CC6 we're using Freescale 3.14.28 BSP. Even though we apply stability
patches that move the kernel version beyond 3.14.29 we still want to use
the GPU vivante external module build with the original BSP.
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
---
.../os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c
index 0eae8262c2ce..f166680affa2 100644
--- a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c
+++ b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c
@@ -81,7 +81,7 @@
#include <linux/pm_runtime.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
#include <mach/busfreq.h>
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 29)
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)
#include <linux/busfreq-imx6.h>
#include <linux/reset.h>
#else

View File

@ -0,0 +1,38 @@
From: Mike Engel <Mike.Engel@digi.com>
Date: Tue, 11 Apr 2017 11:13:23 +0200
Subject: [PATCH] gpu: Get GPU reserved memory from DT.
This commit adds support to specify the GPU reserved memory in
the DT.
Signed-off-by: Mike Engel <Mike.Engel@digi.com>
https://jira.digi.com/browse/DEL-3868
---
.../linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c
index dc7c976..fd2dbd3 100644
--- a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c
+++ b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c
@@ -568,7 +568,7 @@ gckPLATFORM_AdjustParam(
Args->registerMemSizeVG = res->end - res->start + 1;
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "contiguous_mem");
if (res)
{
@@ -577,8 +577,6 @@ gckPLATFORM_AdjustParam(
if( Args->contiguousSize == ~0U )
Args->contiguousSize = res->end - res->start + 1;
}
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
- Args->contiguousBase = 0;
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
prop = of_get_property(dn, "contiguousbase", NULL);
if(prop)

View File

@ -1,9 +0,0 @@
# Copyright (C) 2015-2017 Digi International
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
SRC_URI += " \
file://0001-mxc-gpu-use-recommended-values-for-minimum-GPU-frequ.patch \
file://0002-Use-busfreq-imx6.h-up-to-3.15-kernel.patch \
file://0003-gpu-Get-GPU-reserved-memory-from-DT.patch \
"

View File

@ -0,0 +1,11 @@
# Copyright (C) 2015-2017 Digi International
VER_DIR = "${@d.getVar('PV', True).split('+git')[0]}"
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}-${VER_DIR}:"
SRC_URI += " \
file://0001-mxc-gpu-use-recommended-values-for-minimum-GPU-frequ.patch \
file://0002-Use-busfreq-imx6.h-up-to-3.15-kernel.patch \
file://0003-gpu-Get-GPU-reserved-memory-from-DT.patch \
"

View File

@ -0,0 +1,18 @@
# Copyright (C) 2017 Digi International
SUMMARY = "Kernel loadable module for Vivante GPU"
DESCRIPTION = "This package uses an exact copy of the GPU kernel driver source code of \
the same version as base and include fixes and improvements developed by FSL Community"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e"
PV .= "+git${SRCPV}"
SRCREV = "3b9e057f29853fd29364aa666328a92b807007d7"
SRC_URI = "git://github.com/Freescale/kernel-module-imx-gpu-viv.git;protocol=https"
S = "${WORKDIR}/git"
inherit module
KERNEL_MODULE_AUTOLOAD = "galcore"

Some files were not shown because too many files have changed in this diff Show More