diff --git a/firmware/Makefile b/firmware/Makefile new file mode 100644 index 0000000..79481fd --- /dev/null +++ b/firmware/Makefile @@ -0,0 +1,305 @@ + +#VIVADO_VERSION ?= 2020.1 +VIVADO_VERSION ?= 2022.2 +#VIVADO_VERSION ?= 2023.1 +export ADI_IGNORE_VERSION_CHECK = 1 +SKIP_LEGAL=1 +# Use Buildroot External Linaro GCC 7.3-2018.05 arm-linux-gnueabihf Toolchain +#CROSS_COMPILE = arm-linux-gnueabihf- +CROSS_COMPILE = arm-none-linux-gnueabihf- +TOOLS_PATH = PATH="$(CURDIR)/buildroot/output/host/bin:$(CURDIR)/buildroot/output/host/sbin:$(PATH)" +TOOLCHAIN = $(CURDIR)/buildroot/output/host/bin/$(CROSS_COMPILE)gcc +ABSOLUTE_PATH=$(shell cd `dirname "${BASH_SOURCE[0]}"` && pwd) +BOARD=$(ABSOLUTE_PATH/board)/ori/board +BR2_EXTERNAL=$(ABSOLUTE_PATH)/ori +BR2_PACKAGE_BUSYBOX_CONFIG=$(BR2_EXTERNAL)/ori/board/pluto/busybox-1.25.0.config + +BR2_EXTERNAL_PLUTOSDR_PATH=$(shell cd `dirname "${BASH_SOURCE[0]}"` && pwd)/ori +NCORES = $(shell grep -c ^processor /proc/cpuinfo) +VIVADO_SETTINGS ?= /opt/Xilinx/Vivado/$(VIVADO_VERSION)/settings64.sh +VSUBDIRS = buildroot linux u-boot-xlnx + +VERSION=$(shell git describe --abbrev=4 --always --tags) +PATCH=$(shell cd ori && ./applypatch.sh ) +$(shell git log --pretty=format:"%h - %ad : %s" > ori/board/pluto/overlay/root/fwhistory.txt) +#LATEST_TAG=$(shell git describe --abbrev=0 --tags) +UBOOT_VERSION=$(shell echo -n "PlutoSDR " && cd u-boot-xlnx && git describe --abbrev=0 --dirty --always --tags) +HAVE_VIVADO= $(shell bash -c "source $(VIVADO_SETTINGS) > /dev/null 2>&1 && vivado -version > /dev/null 2>&1 && echo 1 || echo 0") +#XSA_URL ?= http://github.com/maia-sdr/plutosdr-fw/releases/download/${LATEST_TAG}/system_top.xsa + +ifeq (1, ${HAVE_VIVADO}) + VIVADO_INSTALL= $(shell bash -c "source $(VIVADO_SETTINGS) > /dev/null 2>&1 && vivado -version | head -1 | awk '{print $2}'") + ifeq (, $(findstring $(VIVADO_VERSION), $(VIVADO_INSTALL))) +$(warning *** This repository has only been tested with $(VIVADO_VERSION),) +$(warning *** and you have $(VIVADO_INSTALL)) +$(warning *** Please 1] set the path to Vivado $(VIVADO_VERSION) OR) +$(warning *** 2] remove $(VIVADO_INSTALL) from the path OR) +$(error " 3] export VIVADO_VERSION=v20xx.x") + endif +endif + +##PATCH COMMAND NEED TO BE INVOCATED +ifneq (1, ${PATCH}) + $(warning patch granted $(PATCH)) +endif + +TARGET ?= pluto +SUPPORTED_TARGETS:=pluto plutoplus e200 +#XSA_FILE ?= ori/bitstream/${TARGET}/system_top.xsa + +$(warning *** Building target $(TARGET),) + +# Include target specific constants +include scripts/$(TARGET).mk + +ifeq (, $(shell which dfu-suffix)) +$(warning "No dfu-utils in PATH consider doing: sudo apt-get install dfu-util") +TARGETS = build/pluto.frm build/boot.frm +else +TARGETS = build/$(TARGET).dfu build/uboot-env.dfu build/pluto.frm build/boot.dfu build/boot.frm +endif + +ifeq ($(findstring $(TARGET),$(SUPPORTED_TARGETS)),) +all: + @echo "Invalid `TARGET variable ; valid values are: pluto, sidekiqz2, plutoplus" && + exit 1 +else +all: clean-build $(TARGETS) zip-all legal-info +endif + +.NOTPARALLEL: all + +TARGET_DTS_FILES:=$(foreach dts,$(TARGET_DTS_FILES),build/$(dts)) + +TOOLCHAIN: + make BR2_EXTERNAL=$(ABSOLUTE_PATH)/ori -C buildroot ARCH=arm zynq_pluto_ori_defconfig + make -C buildroot toolchain + +build: + mkdir -p $@ + +%: build/% + cp $< $@ + + +### u-boot ### + +u-boot-xlnx/u-boot u-boot-xlnx/tools/mkimage: TOOLCHAIN +# $(TOOLS_PATH) make -C u-boot-xlnx ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zynq_$(TARGET)_defconfig + $(TOOLS_PATH) make -C u-boot-xlnx ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zynq_$(TARGET)_defconfig + $(TOOLS_PATH) make -C u-boot-xlnx ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) UBOOTVERSION="$(UBOOT_VERSION)" + +.PHONY: u-boot-xlnx/u-boot + +build/u-boot.elf: u-boot-xlnx/u-boot | build + cp $< $@ + +build/uboot-env.txt: u-boot-xlnx/u-boot TOOLCHAIN | build + $(TOOLS_PATH) CROSS_COMPILE=$(CROSS_COMPILE) scripts/get_default_envs.sh > $@ + +build/uboot-env.bin: build/uboot-env.txt + u-boot-xlnx/tools/mkenvimage -s 0x20000 -o $@ $< + +### Linux ### + +linux/arch/arm/boot/zImage: TOOLCHAIN + $(TOOLS_PATH) make -C linux -j $(NCORES) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zynq_$(TARGET)_linux_defconfig zImage UIMAGE_LOADADDR=0x8000 + $(TOOLS_PATH) make -C linux -j $(NCORES) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zynq_$(TARGET)_linux_defconfig uImage UIMAGE_LOADADDR=0x8000 +## $(TOOLS_PATH) make -C linux ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) defconfig zynq_$(TARGET)_defconfig +##$(TOOLS_PATH) make BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE=$(ABSOLUTE_PATH)/datv/configs/zynq_$(TARGET)datv_linux_defconfig -C linux -j $(NCORES) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage UIMAGE_LOADADDR=0x8000 + +.PHONY: linux/arch/arm/boot/zImage +.PHONY: linux/arch/arm/boot/uImage + +build/zImage: linux/arch/arm/boot/zImage | build + cp $< $@ + +build/uImage: linux/arch/arm/boot/uImage | build + cp $< $@ + + +### Device Tree ### + +linux/arch/arm/boot/dts/%.dtb: TOOLCHAIN linux/arch/arm/boot/dts/%.dts linux/arch/arm/boot/dts/zynq-pluto-sdr.dtsi linux/arch/arm/boot/dts/zynq-pluto-sdr.dtsi + $(TOOLS_PATH) DTC_FLAGS=-@ make -C linux -j $(NCORES) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) $(notdir $@) + +build/%.dtb: linux/arch/arm/boot/dts/%.dtb | build + dtc -q -@ -I dtb -O dts $< | sed 's/axi {/amba {/g' | dtc -q -@ -I dts -O dtb -o $@ + + + +### Buildroot ### + +buildroot/output/images/rootfs.cpio.gz: + @echo device-fw $(VERSION)> $(BR2_EXTERNAL)/board/pluto/VERSIONS + @$(foreach dir,$(VSUBDIRS),echo $(dir) $(shell cd $(dir) && git describe --abbrev=4 --dirty --always --tags) >> $(BR2_EXTERNAL)/board/pluto/VERSIONS;) + make BR2_EXTERNAL=$(ABSOLUTE_PATH)/ori -C buildroot ARCH=arm zynq_pluto_ori_defconfig +## make -C buildroot ARCH=arm zynq_$(TARGET)_defconfig + +ifneq (1, ${SKIP_LEGAL}) + make -C buildroot legal-info + scripts/legal_info_html.sh "$(COMPLETE_NAME)" "$(CURDIR)/buildroot/board/pluto/VERSIONS" + cp build/LICENSE.html buildroot/board/pluto/msd/LICENSE.html +endif + + make -C buildroot BUSYBOX_CONFIG_FILE=$(BR2_EXTERNAL)/board/pluto/busybox-1.25.0.config all + +.PHONY: buildroot/output/images/rootfs.cpio.gz + + +## Invoke again buildroot to add datv bin in rootfs +build/rootfs.cpio.gz: buildroot/output/images/rootfs.cpio.gz | build + make -C buildroot BUSYBOX_CONFIG_FILE=$(BR2_EXTERNAL)/board/pluto/busybox-1.25.0.config all + cp $< $@ + +build/$(TARGET).itb: u-boot-xlnx/tools/mkimage build/zImage build/rootfs.cpio.gz $(TARGET_DTS_FILES) build/system_top.bit + u-boot-xlnx/tools/mkimage -f scripts/$(TARGET).its $@ + +build/system_top.xsa: | build +ifneq ($(XSA_FILE),) + cp $(XSA_FILE) $@ +else ifneq ($(XSA_URL),) + wget -T 3 -t 1 -N --directory-prefix build $(XSA_URL) +else ifeq (1, ${HAVE_VIVADO}) +#bash -c "source $(VIVADO_SETTINGS) && make -C maia-sdr/maia-hdl/projects/$(TARGET) && cp maia-sdr/maia-hdl/projects/$(TARGET)/$(TARGET).sdk/system_top.xsa $@" +#unzip -l $@ | grep -q ps7_init || cp maia-sdr/maia-hdl/projects/$(TARGET)/$(TARGET).srcs/sources_1/bd/system/ip/system_sys_ps7_0/ps7_init* build/ +ifeq ($(TARGET),pluto) + bash -c "source $(VIVADO_SETTINGS) && make -C ../projects/pluto && cp ../projects/pluto/pluto.sdk/system_top.xsa $@" + unzip -l $@ | grep -q ps7_init || cp ../projects/pluto/pluto.srcs/sources_1/bd/system/ip/system_sys_ps7_0/ps7_init* build/ +endif +ifeq ($(TARGET),plutoplus) + bash -c "source $(VIVADO_SETTINGS) && make -C ../hdl/projects/pluto-ori-plus && cp ../hdl/projects/pluto-ori-plus/pluto.sdk/system_top.xsa $@" + unzip -l $@ | grep -q ps7_init || cp ../hdl/projects/pluto-ori-plus/pluto.srcs/sources_1/bd/system/ip/system_sys_ps7_0/ps7_init* build/ +endif +ifeq ($(TARGET),e200) + bash -c "source $(VIVADO_SETTINGS) && make -C ../hdl/projects/pluto-ori-e200 && cp ../hdl/projects/pluto-ori-e200/e200.sdk/system_top.xsa $@" + unzip -l $@ | grep -q ps7_init || cp ../hdl/projects/pluto-ori-e200/e200.srcs/sources_1/bd/system/ip/system_sys_ps7_0/ps7_init* build/ +endif +#bash -c "source $(VIVADO_SETTINGS) && make -C ../hdl/projects/pluto-ori-plus" +endif + +### TODO: Build system_top.xsa from src if dl fails ... + +build/fsbl.elf build/system_top.bit : build/system_top.xsa + rm -Rf build/sdk +ifeq (1, ${HAVE_VIVADO}) + bash -c "source $(VIVADO_SETTINGS) && xsct scripts/create_fsbl_project.tcl" +else + unzip -o build/system_top.xsa system_top.bit -d build +endif + +build/boot.bin: build/fsbl.elf build/u-boot.elf + @echo img:{[bootloader] $^ } > build/boot.bif +ifeq (1, ${HAVE_VIVADO}) + cp build/sdk/fsbl/Release/fsbl.elf build/fsbl.elf + bash -c "source $(VIVADO_SETTINGS) && bootgen -image build/boot.bif -w -o $@" +else + cp ori/bitstream/$(TARGET)/fsbl.elf build/fsbl.elf + bash -c "bootgen -image build/boot.bif -w -o $@" +endif +### MSD update firmware file ### + +build/pluto.frm: build/$(TARGET).itb + md5sum $< | cut -d ' ' -f 1 > $@.md5 + cat $< $@.md5 > $@ + +build/boot.frm: build/boot.bin build/uboot-env.bin scripts/target_mtd_info.key + cat $^ | tee $@ | md5sum | cut -d ' ' -f1 | tee -a $@ + +### DFU update firmware file ### + +build/%.dfu: build/%.bin + cp $< $<.tmp + dfu-suffix -a $<.tmp -v $(DEVICE_VID) -p $(DEVICE_PID) + mv $<.tmp $@ + +build/$(TARGET).dfu: build/$(TARGET).itb + cp $< $<.tmp + dfu-suffix -a $<.tmp -v $(DEVICE_VID) -p $(DEVICE_PID) + mv $<.tmp $@ + +SDIMGDIR = build/sdimg +sdimg: build | build/rootfs.cpio.gz + mkdir -p $(SDIMGDIR) + cp ori/bitstream/$(TARGET)/fsbl.elf $(SDIMGDIR)/fsbl.elf + cp build/system_top.bit $(SDIMGDIR)/system_top.bit + cp build/u-boot.elf $(SDIMGDIR)/u-boot.elf + cp linux/arch/arm/boot/uImage $(SDIMGDIR)/uImage + +ifeq ($(TARGET),pluto) + cp build/zynq-pluto-sdr.dtb $(SDIMGDIR)/devicetree.dtb +endif +ifeq ($(TARGET),plutoplus) + cp build/zynq-plutoplus-maiasdr.dtb $(SDIMGDIR)/devicetree.dtb +endif +ifeq ($(TARGET),e200) + cp build/zynq-e200.dtb $(SDIMGDIR)/devicetree.dtb +endif + cp build/uboot-env.txt $(SDIMGDIR)/uEnv.txt + cp build/rootfs.cpio.gz $(SDIMGDIR)/ramdisk.image.gz + mkimage -A arm -T ramdisk -C gzip -d $(SDIMGDIR)/ramdisk.image.gz $(SDIMGDIR)/uramdisk.image.gz + touch $(SDIMGDIR)/boot.bif + echo "img : {[bootloader] $(SDIMGDIR)/fsbl.elf $(SDIMGDIR)/system_top.bit $(SDIMGDIR)/u-boot.elf}" > $(SDIMGDIR)/boot.bif + bootgen -image $(SDIMGDIR)/boot.bif -w -o i $(SDIMGDIR)/BOOT.bin + rm $(SDIMGDIR)/fsbl.elf + rm $(SDIMGDIR)/system_top.bit + rm $(SDIMGDIR)/u-boot.elf + rm $(SDIMGDIR)/ramdisk.image.gz + rm $(SDIMGDIR)/boot.bif + + +clean-build: + rm -f $(notdir $(wildcard build/*)) + rm -rf build/* + +clean: + make -C u-boot-xlnx clean + make -C linux clean + make -C buildroot clean + rm -f $(notdir $(wildcard build/*)) + rm -rf build/* + +zip-all: $(TARGETS) + mkdir -p Release && cd build && zip -r ../Release/$(ZIP_ARCHIVE_PREFIX)-fw-$(VERSION).zip *.dfu *.frm + +dfu-$(TARGET): build/$(TARGET).dfu + dfu-util -D build/$(TARGET).dfu -a firmware.dfu + dfu-util -e + +dfu-sf-uboot: build/boot.dfu build/uboot-env.dfu + echo "Erasing u-boot be careful - Press Return to continue... " && read key && \ + dfu-util -D build/boot.dfu -a boot.dfu && \ + dfu-util -D build/uboot-env.dfu -a uboot-env.dfu + dfu-util -e + +dfu-all: build/$(TARGET).dfu build/boot.dfu build/uboot-env.dfu + echo "Erasing u-boot be careful - Press Return to continue... " && read key && \ + dfu-util -D build/$(TARGET).dfu -a firmware.dfu && \ + dfu-util -D build/boot.dfu -a boot.dfu && \ + dfu-util -D build/uboot-env.dfu -a uboot-env.dfu + dfu-util -e + +dfu-ram: build/$(TARGET).dfu + sshpass -p analog ssh root@$(TARGET) '/usr/sbin/device_reboot ram;' + sleep 7 + dfu-util -D build/$(TARGET).dfu -a firmware.dfu + dfu-util -e + +jtag-bootstrap: build/u-boot.elf build/ps7_init.tcl build/system_top.bit scripts/run.tcl scripts/run-xsdb.tcl + $(TOOLS_PATH) $(CROSS_COMPILE)strip build/u-boot.elf + zip -j build/$(ZIP_ARCHIVE_PREFIX)-$@-$(VERSION).zip $^ + +sysroot: buildroot/output/images/rootfs.cpio.gz + tar czfh build/sysroot-$(VERSION).tar.gz --hard-dereference --exclude=usr/share/man --exclude=dev --exclude=etc -C buildroot/output staging + +legal-info: buildroot/output/images/rootfs.cpio.gz +ifneq (1, ${SKIP_LEGAL}) + tar czvf build/legal-info-$(VERSION).tar.gz -C buildroot/output legal-info +endif + + +git-update-all: + git submodule update --recursive --remote + +git-pull: + git pull --recurse-submodules diff --git a/firmware/download_and_test.sh b/firmware/download_and_test.sh new file mode 100755 index 0000000..4cd279c --- /dev/null +++ b/firmware/download_and_test.sh @@ -0,0 +1,35 @@ +#~/bin/sh +# This resets a connected pluto, loads firmware into ram, and boots it +# + +#default IP address +ipaddr=192.168.2.1 + +if [ ! -f ./build/pluto.dfu ] ; then + echo no file to upload + exit +fi + +ssh_cmd() +{ + sshpass -v -panalog ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oCheckHostIP=no root@${ipaddr} "$1" 2>/dev/null + if [ "$?" -ne "0" ] ; then + echo ssh command $1 failed + exit + fi +} +ssh_cmd "device_reboot ram" + +lines=0 +attempt=0 +while [ "${lines}" -le "8" -a "${attempt}" -le "10" ] +do + lines=$(sudo dfu-util -l -d 0456:b673,0456:b674 | wc -l) + if [ "${lines}" -le "8" ] ; then + sleep 1 + fi + ((attempt++)) +done + +# -R resets/terminates the dfu after we are done +sudo dfu-util -R -d 0456:b673,0456:b674 -D ./build/pluto.dfu -a firmware.dfu diff --git a/firmware/ori/Config.in b/firmware/ori/Config.in new file mode 100644 index 0000000..282657c --- /dev/null +++ b/firmware/ori/Config.in @@ -0,0 +1,29 @@ +#source pluto_cc.sh +menu "SKRORG" + + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/libfec/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/libtuntap/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/lamableu-apps/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/rtl-433/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/rtlsdr-airband/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/luaradio-basic/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/multimonng/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/libdvbmod/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/dvb2iq/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/suscan/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/sigutils/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/soapysdr/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/soapyplutosdr/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/soapyremote/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/rxtools/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/tx-tools/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/csdr/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/dump1090-pluto/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/civetwebws/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/soapysdr-master/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/soapyplutosdr-master/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/libgse/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/satdump/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/nng/Config.in" + source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/srt/Config.in" +endmenu diff --git a/firmware/ori/applypatch.sh b/firmware/ori/applypatch.sh new file mode 100755 index 0000000..a494e00 --- /dev/null +++ b/firmware/ori/applypatch.sh @@ -0,0 +1,33 @@ +#Extend frequencies +cp patches/linux/ad9361* ../linux/drivers/iio/adc/ +## Replace mosquitoo 2.0.17 (segfault) with 20.0.18 +cp patches/mosquitto/* ../buildroot/package/mosquitto/ + +## LINUX DTS + + + + +### LINUX CONFIGS ##### +cp configs/zynq_pluto_linux_defconfig ../linux/arch/arm/configs/ +cp configs/zynq_plutoplus_linux_defconfig ../linux/arch/arm/configs/ +cp configs/zynq_e200_linux_defconfig ../linux/arch/arm/configs/ + +####### E200 ################# + +cp patches/e200/linux/ad5660_mp.c ../linux/drivers/iio/adc/ +cp patches/e200/linux/Kconfig ../linux/drivers/iio/adc/ +cp patches/e200/linux/Makefile ../linux/drivers/iio/adc/ +cp patches/e200/linux/core.c ../linux/drivers/mtd/spi-nor/ +cp patches/e200/linux/zynq-e200.dts ../linux/arch/arm/boot/dts/ +cp patches/e200/linux/zynq-e200.dtsi ../linux/arch/arm/boot/dts/ +#replace axis by amba +cp patches/e200/linux/zynq-7000.dtsi ../linux/arch/arm/boot/dts/ + +## Customize u-boot env +cp patches/u-boot/zynq-common.h ../u-boot-xlnx/include/configs/ +cp patches/u-boot/zynq-plutoplus.dts ../u-boot-xlnx/arch/arm/dts/ +cp patches/u-boot/zynq-e200-sdr.dts ../u-boot-xlnx/arch/arm/dts/ +cp patches/u-boot/zynq_plutoplus_defconfig ../u-boot-xlnx/configs/ +cp patches/u-boot/zynq_e200_defconfig ../u-boot-xlnx/configs/ +cp patches/u-boot/Makefile ../u-boot-xlnx/arch/arm/dts/ diff --git a/firmware/ori/bitstream/e200/fsbl.elf b/firmware/ori/bitstream/e200/fsbl.elf new file mode 100755 index 0000000..fa9d75d Binary files /dev/null and b/firmware/ori/bitstream/e200/fsbl.elf differ diff --git a/firmware/ori/bitstream/e200/system_top.xsa b/firmware/ori/bitstream/e200/system_top.xsa new file mode 100644 index 0000000..da3e7a2 Binary files /dev/null and b/firmware/ori/bitstream/e200/system_top.xsa differ diff --git a/firmware/ori/bitstream/pluto/fsbl.elf b/firmware/ori/bitstream/pluto/fsbl.elf new file mode 100755 index 0000000..fc7520c Binary files /dev/null and b/firmware/ori/bitstream/pluto/fsbl.elf differ diff --git a/firmware/ori/bitstream/pluto/system_top.xsa b/firmware/ori/bitstream/pluto/system_top.xsa new file mode 100644 index 0000000..35510ce Binary files /dev/null and b/firmware/ori/bitstream/pluto/system_top.xsa differ diff --git a/firmware/ori/bitstream/plutoplus/fsbl.elf b/firmware/ori/bitstream/plutoplus/fsbl.elf new file mode 100755 index 0000000..5f1af53 Binary files /dev/null and b/firmware/ori/bitstream/plutoplus/fsbl.elf differ diff --git a/firmware/ori/bitstream/plutoplus/system_top.xsa b/firmware/ori/bitstream/plutoplus/system_top.xsa new file mode 100644 index 0000000..569290d Binary files /dev/null and b/firmware/ori/bitstream/plutoplus/system_top.xsa differ diff --git a/firmware/ori/board/pluto/S10mdev b/firmware/ori/board/pluto/S10mdev new file mode 100644 index 0000000..aea3d7d --- /dev/null +++ b/firmware/ori/board/pluto/S10mdev @@ -0,0 +1,24 @@ +#!/bin/sh +# +# Start mdev.... +# + +case "$1" in + start) + echo -n "Starting mdev: " + echo /sbin/mdev >/proc/sys/kernel/hotplug + /sbin/mdev -s + # coldplug modules + # find /sys/ -name modalias -print0 | xargs -0 sort -u -z | xargs -0 modprobe -abq + [ $? = 0 ] && echo "OK" || echo "FAIL" + ;; + stop) + ;; + restart|reload) + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? diff --git a/firmware/ori/board/pluto/S15watchdog b/firmware/ori/board/pluto/S15watchdog new file mode 100644 index 0000000..fdb9860 --- /dev/null +++ b/firmware/ori/board/pluto/S15watchdog @@ -0,0 +1,21 @@ +#!/bin/sh +# +# Start watchdog +# + +case "$1" in + start) + echo -n "Starting watchdog: " + watchdog -t 5 -T 10 /dev/watchdog + [ $? = 0 ] && echo "OK" || echo "FAIL" + ;; + stop) + ;; + restart|reload) + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? diff --git a/firmware/ori/board/pluto/S20urandom b/firmware/ori/board/pluto/S20urandom new file mode 100644 index 0000000..94551f8 --- /dev/null +++ b/firmware/ori/board/pluto/S20urandom @@ -0,0 +1,29 @@ +#! /bin/sh +# +# urandom This script saves the random seed between reboots. +# It is called from the boot, halt and reboot scripts. +# +# Version: @(#)urandom 1.33 22-Jun-1998 miquels@cistron.nl +# + +[ -c /dev/urandom ] || exit 0 +#. /etc/default/rcS + +case "$1" in + start|"") + echo -n "Starting initializing random number generator: " + + # Load and then save 512 bytes, + # which is the size of the entropy pool + + dmesg | sha512sum > /dev/urandom + [ $? = 0 ] && echo "OK" || echo "FAIL" + ;; + stop) + + ;; + *) + echo "Usage: urandom {start|stop}" >&2 + exit 1 + ;; +esac diff --git a/firmware/ori/board/pluto/S21misc b/firmware/ori/board/pluto/S21misc new file mode 100644 index 0000000..28c5739 --- /dev/null +++ b/firmware/ori/board/pluto/S21misc @@ -0,0 +1,36 @@ +#! /bin/sh + +xo_correction() { + + XO_ENV_VAL=`fw_printenv -n xo_correction 2> /dev/null` + if [ $? -eq 0 ]; then + + for dev in /sys/bus/iio/devices/*; do + [ `cat ${dev}/name` == "ad9361-phy" ] && DEV_NAME=`basename ${dev}` + done + + echo ${XO_ENV_VAL} > /sys/bus/iio/devices/${DEV_NAME}/xo_correction + fi +} + + +case "$1" in + start|"") + echo -n "Starting miscellaneous setup: " + # Restore saved password and Dropbear keys + [[ -d /mnt/jffs2/etc ]] && cd /mnt/jffs2/etc && md5sum -s -c password.md5 && cp passwd shadow group /etc + [[ -d /mnt/jffs2/etc/dropbear ]] && cd /mnt/jffs2/etc/dropbear && md5sum -s -c keys.md5 && cp dropbear* /etc/dropbear/ + [[ -d /mnt/jffs2/root/.ssh ]] && cd /mnt/jffs2/root/.ssh && md5sum -s -c keys.md5 && mkdir /root/.ssh && cp authorized_keys /root/.ssh + xo_correction + MAX_BS=`fw_printenv -n iio_max_block_size 2> /dev/null || echo 67108864` + echo ${MAX_BS} > /sys/module/industrialio_buffer_dma/parameters/max_block_size + [ $? = 0 ] && echo "OK" || echo "FAIL" + ;; + stop) + + ;; + *) + echo "Usage: $0 {start|stop}" >&2 + exit 1 + ;; +esac diff --git a/firmware/ori/board/pluto/S23udc b/firmware/ori/board/pluto/S23udc new file mode 100644 index 0000000..23ff09c --- /dev/null +++ b/firmware/ori/board/pluto/S23udc @@ -0,0 +1,209 @@ +#!/bin/sh + +source /etc/device_config + +CONFIGFS=/sys/kernel/config/usb_gadget +GADGET=$CONFIGFS/composite_gadget +IIOD_OPTS="-D -n $ENDPOINTS -F /dev/iio_ffs" +UDC_HANDLE_SUSPEND=`fw_printenv -n udc_handle_suspend 2> /dev/null || echo 0` +USB_ETH_MODE=`fw_printenv -n usb_ethernet_mode 2> /dev/null || echo rndis` +USB_AUDIO_GADGET=`fw_printenv -n audio_gadget 2> /dev/null` + +if [ "$USB_ETH_MODE" == "ncm" ] +then + USB_NET_FUNCTION=ncm.usb0 +elif [ "$USB_ETH_MODE" == "ecm" ] +then + USB_NET_FUNCTION=ecm.usb0 +else + USB_NET_FUNCTION=rndis.0 +fi + +echo "Usb gagdet : $USB_NET_FUNCTION" + +create_iiod_context_attributes() { + model=$1 + serial=$2 + model_variant=$3 + + if [ "$USBPID" == "0xb673" ]; then + # ADALM-PLUTO + for dev in /sys/bus/iio/devices/*; do + [ `cat ${dev}/name` == "ad9361-phy" ] && DEV_NAME=`basename ${dev}` + done + + AD936X_TYPE=$(cat /sys/bus/iio/devices/${DEV_NAME}/of_node/compatible | sed 's/adi,//g') + AD936X_TYPE_CAP=$(echo $AD936X_TYPE | tr a-z A-Z) + MODEL=$(echo $model | sed "s/AD936[34]/$AD936X_TYPE_CAP/") + else + MODEL=$model + fi + + echo "[Context Attributes]" > /etc/libiio.ini + echo "hw_model=$MODEL" >> /etc/libiio.ini + + if [ "$model_variant" == "n25q256a" ] + then + echo "hw_model_variant=0" >> /etc/libiio.ini + else + echo "hw_model_variant=1" >> /etc/libiio.ini + fi + + echo -e "hw_serial=$serial\n" >> /etc/libiio.ini + echo "fw_version=`grep device-fw /opt/VERSIONS | cut -d ' ' -f 2`" >> /etc/libiio.ini + if [ "$USBPID" == "0xb673" ]; then + echo ad9361-phy,xo_correction=`cat /sys/bus/iio/devices/${DEV_NAME}/xo_correction` >> /etc/libiio.ini + echo ad9361-phy,model=$AD936X_TYPE >> /etc/libiio.ini + + elif [ "$USBPID" == "0xb672" ]; then + cat /opt/${CALIBFILENAME} | grep ^cal,* >> /etc/libiio.ini + cat /opt/${CALIBFILENAME_TEMP_LUT} | grep ^cal,* >> /etc/libiio.ini + fi +} + +case "$1" in + start) + echo -n "Starting UDC Gadgets: " + mount configfs -t configfs /sys/kernel/config 2> /dev/null + + mkdir -p $GADGET + + model=`cat /sys/firmware/devicetree/base/model | tr / -` + model_variant=`dmesg | grep m25p80 | grep Kbytes | cut -d ' ' -f 3` + + serial=`dmesg | grep SPI-NOR-UniqueID` + serial=${serial#*SPI-NOR-UniqueID } + + create_iiod_context_attributes "$model" "$serial" "$model_variant" + + echo $serial > /etc/serial + sha1=`echo $serial | sha1sum` + + echo 0x0456 > $GADGET/idVendor + echo $USBPID > $GADGET/idProduct + + mkdir -p $GADGET/strings/0x409 + echo "Analog Devices Inc." > $GADGET/strings/0x409/manufacturer + echo $PRODUCT > $GADGET/strings/0x409/product + echo $serial > $GADGET/strings/0x409/serialnumber + + mkdir -p $GADGET/functions/ffs.iio_ffs + mkdir -p $GADGET/functions/acm.usb0 + mkdir -p $GADGET/functions/$USB_NET_FUNCTION + mkdir -p $GADGET/functions/mass_storage.0 + + if [ "$USB_AUDIO_GADGET" == "1" ]; then + mkdir -p $GADGET/functions/uac2.usb0 + mkdir -p $GADGET/functions/uac2.usb1 + fi + +# echo /opt/vfat.img > $GADGET/functions/mass_storage.0/lun.0/file + echo Y > $GADGET/functions/mass_storage.0/lun.0/removable + + host_addr=`echo -n 00:E0:22; echo $sha1 | dd bs=1 count=6 2>/dev/null | hexdump -v -e '/1 ":%01c""%c"'` + dev_addr=`echo -n 00:05:F7; echo $sha1 | dd bs=1 count=6 skip=6 2>/dev/null | hexdump -v -e '/1 ":%01c""%c"'` + + echo $host_addr > $GADGET/functions/$USB_NET_FUNCTION/host_addr + echo $dev_addr > $GADGET/functions/$USB_NET_FUNCTION/dev_addr + + mkdir -p $GADGET/configs/c.1 + mkdir -p $GADGET/configs/c.1/strings/0x409 + echo "RNDIS/MSD/ACM/IIOUSBD" > $GADGET/configs/c.1/strings/0x409/configuration + + # In case the M2k is powered via the Power USB, advertise low power on the DATA USB + if [ "$TARGET" == "m2k" ]; then + echo 905 > /sys/class/gpio/export + [ "`cat /sys/class/gpio/gpio905/value`" == "1" ] && echo 4 > $GADGET/configs/c.1/MaxPower || echo 500 > $GADGET/configs/c.1/MaxPower + else + echo 500 > $GADGET/configs/c.1/MaxPower + fi + + if [ "$USB_AUDIO_GADGET" == "1" ]; then + + echo "1" > $GADGET/functions/uac2.usb0/c_chmask + echo "1" > $GADGET/functions/uac2.usb0/p_chmask + echo "48000" > $GADGET/functions/uac2.usb0/c_srate + echo "48000" > $GADGET/functions/uac2.usb0/p_srate + echo "2" > $GADGET/functions/uac2.usb0/c_ssize + echo "2" > $GADGET/functions/uac2.usb0/p_ssize + + echo "1" > $GADGET/functions/uac2.usb1/c_chmask + echo "1" > $GADGET/functions/uac2.usb1/p_chmask + echo "22050" > $GADGET/functions/uac2.usb1/c_srate + echo "22050" > $GADGET/functions/uac2.usb1/p_srate + echo "2" > $GADGET/functions/uac2.usb1/c_ssize + echo "2" > $GADGET/functions/uac2.usb1/p_ssize + fi + ln -s $GADGET/functions/$USB_NET_FUNCTION $GADGET/configs/c.1 + ln -s $GADGET/functions/mass_storage.0 $GADGET/configs/c.1 + ln -s $GADGET/functions/acm.usb0 $GADGET/configs/c.1 + ln -s $GADGET/functions/ffs.iio_ffs $GADGET/configs/c.1/ffs.iio_ffs + if [ "$USB_AUDIO_GADGET" == "1" ]; then + ln -s $GADGET/functions/uac2.usb0 $GADGET/configs/c.1 + ln -s $GADGET/functions/uac2.usb1 $GADGET/configs/c.1 + fi + mkdir -p /dev/iio_ffs + mount iio_ffs -t functionfs /dev/iio_ffs 2> /dev/null + + start-stop-daemon -S -b -q -m -p /var/run/iiod.pid -x /usr/sbin/iiod -- $IIOD_OPTS + sleep 0.2 + + echo ci_hdrc.0 > $GADGET/UDC + + [ $? = 0 ] && echo "OK" || echo "FAIL" + + if [ "$UDC_HANDLE_SUSPEND" == "1" ]; then + start-stop-daemon -S -b -q -m -p /var/run/udc_handle_suspend.pid -x /sbin/udc_handle_suspend.sh + fi + + ;; + stop) + echo "Stopping UDC Gadgets" + + if [ "$UDC_HANDLE_SUSPEND" == "1" ]; then + start-stop-daemon -K -q -p /var/run/udc_handle_suspend.pid 2>/dev/null + fi + + echo "" > $GADGET/UDC + start-stop-daemon -K -q -p /var/run/iiod.pid 2>/dev/null + + rm $GADGET/configs/c.1/$USB_NET_FUNCTION + rm $GADGET/configs/c.1/mass_storage.0 + rm $GADGET/configs/c.1/acm.usb0 + rm $GADGET/configs/c.1/ffs.iio_ffs + if [ "$USB_AUDIO_GADGET" == "1" ]; then + rm $GADGET/configs/c.1/uac2.usb0 + rm $GADGET/configs/c.1/uac2.usb1 + fi + rmdir $GADGET/strings/0x409 + rmdir $GADGET/configs/c.1/strings/0x409 + rmdir $GADGET/configs/c.1 + + rmdir $GADGET/functions/ffs.iio_ffs + #rmdir $GADGET/functions/acm.usb0 + rmdir $GADGET/functions/$USB_NET_FUNCTION + rmdir $GADGET/functions/mass_storage.0 + if [ "$USB_AUDIO_GADGET" == "1" ]; then + rm $GADGET/functions/uac2.usb0 + rm $GADGET/functions/uac2.usb1 + fi + + rmdir $GADGET 2> /dev/null + + ;; + restart|reload) + "$0" stop + "$0" start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? + + + + + + diff --git a/firmware/ori/board/pluto/S40network b/firmware/ori/board/pluto/S40network new file mode 100755 index 0000000..338a076 --- /dev/null +++ b/firmware/ori/board/pluto/S40network @@ -0,0 +1,189 @@ +#!/bin/sh +# +# Start the network.... +# + +# Debian ifupdown needs the /run/network lock directory + +source /etc/device_config + +create_system_files () { + + UDHCPD_CONF=/etc/udhcpd.conf + CONF=/opt/config.txt + IFAC=/etc/network/interfaces + + HOSTNAME=`fw_printenv -n hostname 2> /dev/null || cat /etc/hostname` + echo $HOSTNAME > /etc/hostname + + IPADDR=`fw_printenv -n ipaddr 2> /dev/null || echo 192.168.2.1` + IPADDR_HOST=`fw_printenv -n ipaddr_host 2> /dev/null || echo 192.168.2.10` + NETMASK=`fw_printenv -n netmask 2> /dev/null || echo 255.255.255.0` + + ETH_IPADDR=`fw_printenv -n ipaddr_eth 2> /dev/null` + ETH_NETMASK=`fw_printenv -n netmask_eth 2> /dev/null || echo 255.255.255.0` + ETH_GW=`fw_printenv -n gateway_eth 2> /dev/null` + + ETH_IPADDR2=`fw_printenv -n ipaddr_eth2 2> /dev/null` + ETH_NETMASK2=`fw_printenv -n netmask_eth2 2> /dev/null || echo 255.255.255.0` + ETH_GW2=`fw_printenv -n gateway_eth2 2> /dev/null` + + + WLAN_SSID=`fw_printenv -n ssid_wlan 2> /dev/null` + WLAN_PWD=`fw_printenv -n pwd_wlan 2> /dev/null` + WLAN_IPADDR=`fw_printenv -n ipaddr_wlan 2> /dev/null` + + XO_CORRECTION=`fw_printenv -n xo_correction 2> /dev/null` + UDC_HANDLE_SUSPEND=`fw_printenv -n udc_handle_suspend 2> /dev/null || echo 0` + USB_ETH_MODE=`fw_printenv -n usb_ethernet_mode 2> /dev/null || echo rndis` + + ### /etc/udhcpd.conf ### + echo "start $IPADDR_HOST" > $UDHCPD_CONF + echo "end $IPADDR_HOST" >> $UDHCPD_CONF + echo "interface usb0" >> $UDHCPD_CONF + echo "option subnet $NETMASK" >> $UDHCPD_CONF + #router option could force the pc to have this gateway + # But bad idea when mounted before eth0 of PC + #echo "option router $IPADDR" >> $UDHCPD_CONF + + ### /etc/network/interfaces ### + echo -e "auto lo\n""iface lo inet loopback\n" > $IFAC + echo -e "auto usb0\n""iface usb0 inet static" >> $IFAC + echo -e "\taddress $IPADDR\n""\tnetmask $NETMASK\n" >> $IFAC + echo -e "auto usb1\n""iface usb1 inet dhcp\n" >> $IFAC + + echo -e "auto eth0" >> $IFAC + if [ -n "$ETH_IPADDR" ] + then + echo -e "iface eth0 inet static" >> $IFAC + echo -e "\taddress $ETH_IPADDR\n""\tnetmask $ETH_NETMASK\n" >> $IFAC + if [ -n "$ETH_GW" ]; then + echo -e "\tgateway $ETH_GW\n" >> $IFAC + fi + else + echo -e "iface eth0 inet dhcp\n" >> $IFAC + fi + + echo -e "auto eth1" >> $IFAC + if [ -n "$ETH_IPADDR2" ] + then + echo -e "iface eth1 inet static" >> $IFAC + echo -e "\taddress $ETH_IPADDR2\n""\tnetmask $ETH_NETMASK2\n" >> $IFAC + if [ -n "$ETH_GW2" ]; then + echo -e "\tgateway $ETH_GW2\n" >> $IFAC + fi + else + echo -e "iface eth1 inet dhcp\n" >> $IFAC + fi + + ### /etc/wpa.conf ### + if [ -n "$WLAN_SSID" ] + then + if [ "$WLAN_SSID" == "AP" ]; then + # We are in access point mode + echo -e "auto wlan0\n" >> $IFAC + echo -e "iface wlan0 inet static\n" >>$IFAC + echo -e "address 192.168.3.1\n" >>$IFAC + echo -e "netmask 255.255.255.0\n" >>$IFAC + + else + if [ -n "$WLAN_PWD" ] + then + wpa_passphrase $WLAN_SSID $WLAN_PWD > /etc/wpa.conf + else + echo "network={" > /etc/wpa.conf + echo " ssid=\"$WLAN_SSID\"" >> /etc/wpa.conf + echo " key_mgmt=NONE" >> /etc/wpa.conf + echo "}" >> /etc/wpa.conf + fi + + echo -e "auto wlan0" >> $IFAC + + if [ -n "$WLAN_IPADDR" ] + then + echo -e "iface wlan0 inet static" >> $IFAC + echo -e "\taddress $WLAN_IPADDR\n""\tnetmask 255.255.255.0" >> $IFAC + else + echo -e "iface wlan0 inet dhcp" >> $IFAC + fi + echo -e "\twpa-conf /etc/wpa.conf\n" >> $IFAC + fi + fi + + ### /opt/config.txt ### + echo "# $(cat /sys/firmware/devicetree/base/model | tr / -)"$'\r' > $CONF + echo "# Device Configuration File"$'\r' >> $CONF + echo "# 1. Open with an Editor"$'\r' >> $CONF + echo "# 2. Edit this file"$'\r' >> $CONF + echo "# 3. Save this file on the device USB drive"$'\r' >> $CONF + echo "# 4. Eject the device USB Drive"$'\r' >> $CONF + echo "# Doc: https://wiki.analog.com/university/tools/pluto/users/customizing"$'\r' >> $CONF + echo ""$'\r'>> $CONF + echo "[NETWORK]"$'\r' >> $CONF + echo "hostname = $HOSTNAME"$'\r' >> $CONF + echo "ipaddr = $IPADDR"$'\r' >> $CONF + echo "ipaddr_host = $IPADDR_HOST"$'\r' >> $CONF + echo "netmask = $NETMASK"$'\r' >> $CONF + echo ""$'\r'>> $CONF + echo "[WLAN]"$'\r' >> $CONF + echo "ssid_wlan = $WLAN_SSID"$'\r' >> $CONF + echo "pwd_wlan = $WLAN_PWD"$'\r' >> $CONF + echo "ipaddr_wlan = $WLAN_IPADDR"$'\r' >> $CONF + echo ""$'\r'>> $CONF + echo "[USB_ETHERNET]"$'\r' >> $CONF + echo "ipaddr_eth = $ETH_IPADDR"$'\r' >> $CONF + echo "netmask_eth = $ETH_NETMASK"$'\r' >> $CONF + echo "gateway_eth = $ETH_GW"$'\r' >> $CONF + echo "ipaddr_eth2 = $ETH_IPADDR2"$'\r' >> $CONF + echo "netmask_eth2 = $ETH_NETMASK2"$'\r' >> $CONF + echo "gateway_eth2 = $ETH_GW2"$'\r' >> $CONF + + echo ""$'\r'>> $CONF + echo "[SYSTEM]"$'\r' >> $CONF + echo "xo_correction = $XO_CORRECTION"$'\r' >> $CONF + echo "udc_handle_suspend = $UDC_HANDLE_SUSPEND"$'\r' >> $CONF + echo "# USB Communication Device Class Compatibility Mode [rndis|ncm|ecm]"$'\r' >> $CONF + echo "usb_ethernet_mode = $USB_ETH_MODE"$'\r' >> $CONF + echo ""$'\r'>> $CONF + echo "[ACTIONS]"$'\r' >> $CONF + echo "diagnostic_report = 0"$'\r' >> $CONF + echo "dfu = 0"$'\r' >> $CONF + echo "reset = 0"$'\r' >> $CONF + echo "calibrate = 0"$'\r' >> $CONF + echo ""$'\r'>> $CONF + + ### /www/index.html ### + + sed -i -e "s/#IP#/$IPADDR/g" -e "s/#HOSTIP#/$IPADDR_HOST/g" -e "s/#NETMASK#/$NETMASK/g" -e "s/#HOSTNAME#/$HOSTNAME/g" -e "s/#SSID_WLAN#/$WLAN_SSID/g" -e "s/#IPADDR_WLAN#/$WLAN_IPADDR/g" -e "s/#IPADDR_ETH#/$ETH_IPADDR/g" -e "s/#NETMASK_ETH#/$ETH_NETMASK/g" /www/index.html + + } + +mkdir -p /run/network + +case "$1" in + start) + printf "Starting network: " + + create_system_files + dos2unix /opt/config.txt + + /bin/hostname -F /etc/hostname + /sbin/ifup -a 2>&1 | logger + [ $? = 0 ] && echo "OK" || echo "FAIL" + ;; + stop) + printf "Stopping network: " + /sbin/ifdown -a + [ $? = 0 ] && echo "OK" || echo "FAIL" + ;; + restart|reload) + "$0" stop + "$0" start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? + diff --git a/firmware/ori/board/pluto/S41network b/firmware/ori/board/pluto/S41network new file mode 100644 index 0000000..dd54b38 --- /dev/null +++ b/firmware/ori/board/pluto/S41network @@ -0,0 +1,32 @@ +#!/bin/sh +# Server-side demuxing by default + +source /etc/device_config + +case "$1" in + start) + echo -n "Starting dhcpd Daemon & httpd Server: " + start-stop-daemon -S -q -p /var/run/udhcpd.pid -x /usr/sbin/udhcpd -- $UDHCPD_CONF + start-stop-daemon -S -q -p /var/run/udhcpdwan.pid -x /usr/sbin/udhcpd -- /etc/udhcpdwan.conf + httpd -h /www + [ $? = 0 ] && echo "OK" || echo "FAIL" + ;; + + stop) + echo -n "Stopping dhcpd Daemon & httpd Server: " + killall -7 httpd + start-stop-daemon -K -q -p /var/run/udhcpd.pid 2>/dev/null + start-stop-daemon -K -q -p /var/run/udhcpdwan.pid 2>/dev/null + [ $? = 0 ] && echo "OK" || echo "FAIL" + ;; + + restart) + $0 stop + sleep 1 + $0 start + ;; + + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac diff --git a/firmware/ori/board/pluto/S45msd b/firmware/ori/board/pluto/S45msd new file mode 100644 index 0000000..5529f4c --- /dev/null +++ b/firmware/ori/board/pluto/S45msd @@ -0,0 +1,75 @@ +#!/bin/sh +# Server-side demuxing by default + +source /etc/device_config + +CONF=/opt/config.txt +file=/sys/kernel/config/usb_gadget/composite_gadget/functions/mass_storage.0/lun.0/file +img=/opt/vfat.img + +patch_html_page() { + LINUX=`uname -a | tr / - | tr '\n' ';' ; echo -n $(nproc) "core(s)"` + MODEL=`cat /etc/libiio.ini | grep hw_model= | cut -d '=' -f 2` + SERIAL=`cat /sys/kernel/config/usb_gadget/composite_gadget/strings/0x409/serialnumber` + MACHOST=`cat /sys/kernel/config/usb_gadget/composite_gadget/functions/rndis.0/host_addr` + MAC=`cat /sys/kernel/config/usb_gadget/composite_gadget/functions/rndis.0/dev_addr` + IIO=`iio_info 2>/dev/null | grep "Library version:"` + BUILD=`grep device-fw /opt/VERSIONS | cut -d ' ' -f 2` + FPGA=`grep hdl /opt/VERSIONS | cut -d ' ' -f 2` + ROOTFS=`grep buildroot /opt/VERSIONS | cut -d ' ' -f 2` + UBOOT=`cat /proc/cmdline | tr "=" "\n" | grep "U-Boot"` + USB_ETH_MODE=`fw_printenv -n usb_ethernet_mode 2> /dev/null || echo rndis` + if [ "$USB_ETH_MODE" == "ncm" ]; then + NETWORKUSB="Communications Device Class – Network Control Model (CDC-NCM)" + elif [ "$USB_ETH_MODE" == "ecm" ]; then + NETWORKUSB="Communications Device Class – Ethernet Control Module (CDC-EMC)" + else + NETWORKUSB="Remote Network Driver Interface Specification (RNDIS)" + fi + + sed -i -e "s/#LINUX#/$LINUX/g" -e "s/#MODEL#/$MODEL/g" -e "s/#SERIAL#/$SERIAL/g" -e "s/#MACHOST#/$MACHOST/g" -e "s/#MAC#/$MAC/g" -e "s/#IIO#/$IIO/g" -e "s/#BUILD#/$BUILD/g" -e "s/#FPGA#/$FPGA/g" -e "s/#ROOTFS#/$ROOTFS/g" -e "s/#UBOOT#/$UBOOT/g" -e "s/#NETWORKUSB#/$NETWORKUSB/g" $1 + + sed -i -e "s/#BUILD#/$BUILD/g" $2 /etc/motd +} + + +case "$1" in + start) + echo -n "Starting MSD Daemon: " + patch_html_page /www/index.html /www/img/version.js + losetup /dev/loop7 $img -o 512 + mount /dev/loop7 /mnt/msd + + if [ "$TARGET" == "m2k" ]; then + cp /opt/${CALIBFILENAME} /mnt + md5sum /mnt/msd/${CALIBFILENAME} > /opt/${CALIBFILENAME}.md5 + fi + + cp $CONF /mnt/msd + md5sum /mnt/msd/config.txt > /opt/config.md5 + + cp -a /www/* /mnt/msd + mv /mnt/msd/index.html /mnt/msd/info.html + umount /mnt/msd + echo $img > $file + + start-stop-daemon -S -b -q -m -p /var/run/update.pid -x /bin/sh -- /sbin/update.sh + [ $? = 0 ] && echo "OK" || echo "FAIL" + ;; + + stop) + echo -n "Stopping MSD Daemon: " + start-stop-daemon -K -q -p /var/run/update.pid 2>/dev/null + [ $? = 0 ] && echo "OK" || echo "FAIL" + ;; + + restart) + $0 stop + sleep 1 + $0 start + ;; + + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac diff --git a/firmware/ori/board/pluto/VERSIONS b/firmware/ori/board/pluto/VERSIONS new file mode 100644 index 0000000..992d770 --- /dev/null +++ b/firmware/ori/board/pluto/VERSIONS @@ -0,0 +1,4 @@ +device-fw b340 +buildroot 2022.02.3-adi-5712-gf70f4a +linux adi-xilinx-2020.1-175882-ge14e351 +u-boot-xlnx v0.20-PlutoSDR-25-g90401c diff --git a/firmware/ori/board/pluto/automounter.sh b/firmware/ori/board/pluto/automounter.sh new file mode 100644 index 0000000..0d093a5 --- /dev/null +++ b/firmware/ori/board/pluto/automounter.sh @@ -0,0 +1,87 @@ +#!/bin/sh + +destdir=/media + +my_umount() +{ + if grep -qs "^/dev/$1 " /proc/mounts ; then + umount "${destdir}/$1"; + echo heartbeat > /sys/class/leds/led0:green/trigger + fi + + [ -d "${destdir}/$1" ] && rmdir "${destdir}/$1" +} + +do_mount() +{ + local errno + local err + + errno=0 + for I in $(seq 5) + do + err=$(mount -t auto -o sync "/dev/$1" "${destdir}/$1" 2>&1) + errno=$? + + # If we get a "Device or resource busy" error, retry again in a + # little bit, otherwise just return immediately. + if ! echo "${err}" | grep -q "Device or resource busy" + then + return ${errno} + fi + + sleep .25 + done + + echo "${err}" >&2 + return ${errno} +} + +my_mount() +{ + mkdir -p "${destdir}/$1" || exit 1 + + if ! do_mount $1; then + # failed to mount, clean up mountpoint + rmdir "${destdir}/$1" + exit 1 + fi + + echo default-on > /sys/class/leds/led0:green/trigger + + for i in ${destdir}/$1/runme??* ;do + + # Ignore dangling symlinks (if any). + [ ! -f "$i" ] && continue + + case "$i" in + *.sh) + # Source shell script for speed. + ( + trap - INT QUIT TSTP + set start + . $i + ) + ;; + *) + # No sh extension, so fork subprocess. + $i start + ;; + esac + done +} + +case "${ACTION}" in +add|"") + my_umount ${MDEV} + my_mount ${MDEV} + ;; +remove) + my_umount ${MDEV} + ;; +remove_all) + for i in ${destdir}/??* + do + my_umount $(basename $i) + done +esac diff --git a/firmware/ori/board/pluto/busybox-1.25.0.config b/firmware/ori/board/pluto/busybox-1.25.0.config new file mode 100644 index 0000000..66c7001 --- /dev/null +++ b/firmware/ori/board/pluto/busybox-1.25.0.config @@ -0,0 +1,1171 @@ +# +# Automatically generated make config: don't edit +# Busybox version: 1.29.3 +# Thu Jan 28 13:56:34 2021 +# +CONFIG_HAVE_DOT_CONFIG=y + +# +# Settings +# +CONFIG_DESKTOP=y +# CONFIG_EXTRA_COMPAT is not set +# CONFIG_FEDORA_COMPAT is not set +CONFIG_INCLUDE_SUSv2=y +CONFIG_LONG_OPTS=y +CONFIG_SHOW_USAGE=y +CONFIG_FEATURE_VERBOSE_USAGE=y +# CONFIG_FEATURE_COMPRESS_USAGE is not set +CONFIG_LFS=y +# CONFIG_PAM is not set +CONFIG_FEATURE_DEVPTS=y +CONFIG_FEATURE_UTMP=y +CONFIG_FEATURE_WTMP=y +CONFIG_FEATURE_PIDFILE=y +CONFIG_PID_FILE_PATH="/var/run" +CONFIG_BUSYBOX=y +CONFIG_FEATURE_INSTALLER=y +# CONFIG_INSTALL_NO_USR is not set +CONFIG_FEATURE_SUID=y +# CONFIG_FEATURE_SUID_CONFIG is not set +# CONFIG_FEATURE_SUID_CONFIG_QUIET is not set +# CONFIG_FEATURE_PREFER_APPLETS is not set +CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe" +# CONFIG_SELINUX is not set +CONFIG_FEATURE_CLEAN_UP=y +CONFIG_FEATURE_SYSLOG=y +CONFIG_PLATFORM_LINUX=y + +# +# Build Options +# +# CONFIG_STATIC is not set +# CONFIG_PIE is not set +# CONFIG_NOMMU is not set +# CONFIG_BUILD_LIBBUSYBOX is not set +# CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set +# CONFIG_FEATURE_INDIVIDUAL is not set +# CONFIG_FEATURE_SHARED_BUSYBOX is not set +CONFIG_CROSS_COMPILER_PREFIX="" +CONFIG_SYSROOT="" +CONFIG_EXTRA_CFLAGS="" +CONFIG_EXTRA_LDFLAGS="" +CONFIG_EXTRA_LDLIBS="" +# CONFIG_USE_PORTABLE_CODE is not set +CONFIG_STACK_OPTIMIZATION_386=y + +# +# Installation Options ("make install" behavior) +# +CONFIG_INSTALL_APPLET_SYMLINKS=y +# CONFIG_INSTALL_APPLET_HARDLINKS is not set +# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set +# CONFIG_INSTALL_APPLET_DONT is not set +# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set +# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set +# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set +CONFIG_PREFIX="./_install" + +# +# Debugging Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_PESSIMIZE is not set +# CONFIG_DEBUG_SANITIZE is not set +# CONFIG_UNIT_TEST is not set +# CONFIG_WERROR is not set +CONFIG_NO_DEBUG_LIB=y +# CONFIG_DMALLOC is not set +# CONFIG_EFENCE is not set + +# +# Library Tuning +# +# CONFIG_FEATURE_USE_BSS_TAIL is not set +CONFIG_FEATURE_RTMINMAX=y +CONFIG_FEATURE_BUFFERS_USE_MALLOC=y +# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set +# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set +CONFIG_PASSWORD_MINLEN=6 +CONFIG_MD5_SMALL=1 +CONFIG_SHA3_SMALL=1 +# CONFIG_FEATURE_FAST_TOP is not set +# CONFIG_FEATURE_ETC_NETWORKS is not set +# CONFIG_FEATURE_ETC_SERVICES is not set +CONFIG_FEATURE_EDITING=y +CONFIG_FEATURE_EDITING_MAX_LEN=1024 +CONFIG_FEATURE_EDITING_VI=y +CONFIG_FEATURE_EDITING_HISTORY=999 +CONFIG_FEATURE_EDITING_SAVEHISTORY=y +CONFIG_FEATURE_EDITING_SAVE_ON_EXIT=y +CONFIG_FEATURE_REVERSE_SEARCH=y +CONFIG_FEATURE_TAB_COMPLETION=y +# CONFIG_FEATURE_USERNAME_COMPLETION is not set +CONFIG_FEATURE_EDITING_FANCY_PROMPT=y +CONFIG_FEATURE_EDITING_WINCH=y +# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set +# CONFIG_LOCALE_SUPPORT is not set +# CONFIG_UNICODE_SUPPORT is not set +# CONFIG_UNICODE_USING_LOCALE is not set +# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set +CONFIG_SUBST_WCHAR=0 +CONFIG_LAST_SUPPORTED_WCHAR=0 +# CONFIG_UNICODE_COMBINING_WCHARS is not set +# CONFIG_UNICODE_WIDE_WCHARS is not set +# CONFIG_UNICODE_BIDI_SUPPORT is not set +# CONFIG_UNICODE_NEUTRAL_TABLE is not set +# CONFIG_UNICODE_PRESERVE_BROKEN is not set +CONFIG_FEATURE_NON_POSIX_CP=y +# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set +CONFIG_FEATURE_USE_SENDFILE=y +CONFIG_FEATURE_COPYBUF_KB=4 +CONFIG_FEATURE_SKIP_ROOTFS=y +CONFIG_MONOTONIC_SYSCALL=y +CONFIG_IOCTL_HEX2STR_ERROR=y +CONFIG_FEATURE_HWIB=y + +# +# Applets +# + +# +# Archival Utilities +# +# CONFIG_FEATURE_SEAMLESS_XZ is not set +# CONFIG_FEATURE_SEAMLESS_LZMA is not set +# CONFIG_FEATURE_SEAMLESS_BZ2 is not set +# CONFIG_FEATURE_SEAMLESS_GZ is not set +# CONFIG_FEATURE_SEAMLESS_Z is not set +CONFIG_AR=y +# CONFIG_FEATURE_AR_LONG_FILENAMES is not set +CONFIG_FEATURE_AR_CREATE=y +# CONFIG_UNCOMPRESS is not set +CONFIG_GUNZIP=y +CONFIG_ZCAT=y +CONFIG_FEATURE_GUNZIP_LONG_OPTIONS=y +CONFIG_BUNZIP2=y +CONFIG_BZCAT=y +CONFIG_UNLZMA=y +CONFIG_LZCAT=y +CONFIG_LZMA=y +CONFIG_UNXZ=y +CONFIG_XZCAT=y +CONFIG_XZ=y +# CONFIG_BZIP2 is not set +CONFIG_BZIP2_SMALL=0 +CONFIG_FEATURE_BZIP2_DECOMPRESS=y +CONFIG_CPIO=y +# CONFIG_FEATURE_CPIO_O is not set +# CONFIG_FEATURE_CPIO_P is not set +# CONFIG_DPKG is not set +# CONFIG_DPKG_DEB is not set +CONFIG_GZIP=y +# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set +CONFIG_GZIP_FAST=0 +# CONFIG_FEATURE_GZIP_LEVELS is not set +CONFIG_FEATURE_GZIP_DECOMPRESS=y +# CONFIG_LZOP is not set +# CONFIG_UNLZOP is not set +# CONFIG_LZOPCAT is not set +# CONFIG_LZOP_COMPR_HIGH is not set +# CONFIG_RPM is not set +# CONFIG_RPM2CPIO is not set +CONFIG_TAR=y +CONFIG_FEATURE_TAR_LONG_OPTIONS=y +CONFIG_FEATURE_TAR_CREATE=y +# CONFIG_FEATURE_TAR_AUTODETECT is not set +CONFIG_FEATURE_TAR_FROM=y +# CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set +# CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set +CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y +CONFIG_FEATURE_TAR_TO_COMMAND=y +# CONFIG_FEATURE_TAR_UNAME_GNAME is not set +# CONFIG_FEATURE_TAR_NOPRESERVE_TIME is not set +# CONFIG_FEATURE_TAR_SELINUX is not set +CONFIG_UNZIP=y +CONFIG_FEATURE_UNZIP_CDF=y +CONFIG_FEATURE_UNZIP_BZIP2=y +CONFIG_FEATURE_UNZIP_LZMA=y +CONFIG_FEATURE_UNZIP_XZ=y +# CONFIG_FEATURE_LZMA_FAST is not set + +# +# Coreutils +# +CONFIG_BASENAME=y +CONFIG_CAT=y +CONFIG_FEATURE_CATN=y +CONFIG_FEATURE_CATV=y +CONFIG_CHGRP=y +CONFIG_CHMOD=y +CONFIG_CHOWN=y +# CONFIG_FEATURE_CHOWN_LONG_OPTIONS is not set +CONFIG_CHROOT=y +CONFIG_CKSUM=y +# CONFIG_COMM is not set +CONFIG_CP=y +# CONFIG_FEATURE_CP_LONG_OPTIONS is not set +CONFIG_CUT=y +CONFIG_DATE=y +CONFIG_FEATURE_DATE_ISOFMT=y +CONFIG_FEATURE_DATE_NANO=y +CONFIG_FEATURE_DATE_COMPAT=y +CONFIG_DD=y +CONFIG_FEATURE_DD_SIGNAL_HANDLING=y +# CONFIG_FEATURE_DD_THIRD_STATUS_LINE is not set +CONFIG_FEATURE_DD_IBS_OBS=y +CONFIG_FEATURE_DD_STATUS=y +CONFIG_DF=y +# CONFIG_FEATURE_DF_FANCY is not set +CONFIG_DIRNAME=y +CONFIG_DOS2UNIX=y +CONFIG_UNIX2DOS=y +CONFIG_DU=y +CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y +CONFIG_ECHO=y +CONFIG_FEATURE_FANCY_ECHO=y +CONFIG_ENV=y +# CONFIG_EXPAND is not set +# CONFIG_UNEXPAND is not set +CONFIG_EXPR=y +CONFIG_EXPR_MATH_SUPPORT_64=y +CONFIG_FACTOR=y +CONFIG_FALSE=y +CONFIG_FOLD=y +# CONFIG_FSYNC is not set +CONFIG_HEAD=y +CONFIG_FEATURE_FANCY_HEAD=y +CONFIG_HOSTID=y +CONFIG_ID=y +# CONFIG_GROUPS is not set +CONFIG_INSTALL=y +CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y +CONFIG_LINK=y +CONFIG_LN=y +CONFIG_LOGNAME=y +CONFIG_LS=y +CONFIG_FEATURE_LS_FILETYPES=y +CONFIG_FEATURE_LS_FOLLOWLINKS=y +CONFIG_FEATURE_LS_RECURSIVE=y +CONFIG_FEATURE_LS_WIDTH=y +CONFIG_FEATURE_LS_SORTFILES=y +CONFIG_FEATURE_LS_TIMESTAMPS=y +CONFIG_FEATURE_LS_USERNAME=y +CONFIG_FEATURE_LS_COLOR=y +CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y +CONFIG_MD5SUM=y +CONFIG_SHA1SUM=y +CONFIG_SHA256SUM=y +CONFIG_SHA512SUM=y +CONFIG_SHA3SUM=y + +# +# Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum +# +CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y +CONFIG_MKDIR=y +CONFIG_MKFIFO=y +CONFIG_MKNOD=y +CONFIG_MKTEMP=y +CONFIG_MV=y +CONFIG_NICE=y +CONFIG_NL=y +CONFIG_NOHUP=y +CONFIG_NPROC=y +CONFIG_OD=y +CONFIG_PASTE=y +CONFIG_PRINTENV=y +CONFIG_PRINTF=y +CONFIG_PWD=y +CONFIG_READLINK=y +CONFIG_FEATURE_READLINK_FOLLOW=y +CONFIG_REALPATH=y +CONFIG_RM=y +CONFIG_RMDIR=y +CONFIG_SEQ=y +CONFIG_SHRED=y +# CONFIG_SHUF is not set +CONFIG_SLEEP=y +CONFIG_FEATURE_FANCY_SLEEP=y +CONFIG_FEATURE_FLOAT_SLEEP=y +CONFIG_SORT=y +CONFIG_FEATURE_SORT_BIG=y +# CONFIG_FEATURE_SORT_OPTIMIZE_MEMORY is not set +# CONFIG_SPLIT is not set +# CONFIG_FEATURE_SPLIT_FANCY is not set +# CONFIG_STAT is not set +# CONFIG_FEATURE_STAT_FORMAT is not set +# CONFIG_FEATURE_STAT_FILESYSTEM is not set +CONFIG_STTY=y +# CONFIG_SUM is not set +CONFIG_SYNC=y +# CONFIG_FEATURE_SYNC_FANCY is not set +# CONFIG_TAC is not set +CONFIG_TAIL=y +CONFIG_FEATURE_FANCY_TAIL=y +CONFIG_TEE=y +CONFIG_FEATURE_TEE_USE_BLOCK_IO=y +CONFIG_TEST=y +CONFIG_TEST1=y +CONFIG_TEST2=y +CONFIG_FEATURE_TEST_64=y +CONFIG_TIMEOUT=y +CONFIG_TOUCH=y +# CONFIG_FEATURE_TOUCH_NODEREF is not set +CONFIG_FEATURE_TOUCH_SUSV3=y +CONFIG_TR=y +CONFIG_FEATURE_TR_CLASSES=y +CONFIG_FEATURE_TR_EQUIV=y +CONFIG_TRUE=y +CONFIG_TRUNCATE=y +CONFIG_TTY=y +CONFIG_UNAME=y +CONFIG_UNAME_OSNAME="GNU/Linux" +CONFIG_BB_ARCH=y +CONFIG_UNIQ=y +CONFIG_UNLINK=y +CONFIG_USLEEP=y +CONFIG_UUDECODE=y +# CONFIG_BASE64 is not set +CONFIG_UUENCODE=y +CONFIG_WC=y +# CONFIG_FEATURE_WC_LARGE is not set +CONFIG_WHO=y +CONFIG_W=y +# CONFIG_USERS is not set +CONFIG_WHOAMI=y +CONFIG_YES=y + +# +# Common options +# +CONFIG_FEATURE_VERBOSE=y + +# +# Common options for cp and mv +# +CONFIG_FEATURE_PRESERVE_HARDLINKS=y + +# +# Common options for df, du, ls +# +CONFIG_FEATURE_HUMAN_READABLE=y + +# +# Console Utilities +# +CONFIG_CHVT=y +CONFIG_CLEAR=y +CONFIG_DEALLOCVT=y +CONFIG_DUMPKMAP=y +# CONFIG_FGCONSOLE is not set +# CONFIG_KBD_MODE is not set +CONFIG_LOADFONT=y +# CONFIG_SETFONT is not set +# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set +CONFIG_DEFAULT_SETFONT_DIR="" + +# +# Common options for loadfont and setfont +# +CONFIG_FEATURE_LOADFONT_PSF2=y +CONFIG_FEATURE_LOADFONT_RAW=y +CONFIG_LOADKMAP=y +CONFIG_OPENVT=y +CONFIG_RESET=y +CONFIG_RESIZE=y +CONFIG_FEATURE_RESIZE_PRINT=y +CONFIG_SETCONSOLE=y +# CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set +CONFIG_SETKEYCODES=y +CONFIG_SETLOGCONS=y +# CONFIG_SHOWKEY is not set + +# +# Debian Utilities +# +CONFIG_PIPE_PROGRESS=y +CONFIG_RUN_PARTS=y +CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y +# CONFIG_FEATURE_RUN_PARTS_FANCY is not set +CONFIG_START_STOP_DAEMON=y +CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS=y +CONFIG_FEATURE_START_STOP_DAEMON_FANCY=y +CONFIG_WHICH=y + +# +# klibc-utils +# +# CONFIG_MINIPS is not set +CONFIG_NUKE=y +CONFIG_RESUME=y +CONFIG_RUN_INIT=y + +# +# Editors +# +CONFIG_AWK=y +# CONFIG_FEATURE_AWK_LIBM is not set +CONFIG_FEATURE_AWK_GNU_EXTENSIONS=y +CONFIG_CMP=y +CONFIG_DIFF=y +# CONFIG_FEATURE_DIFF_LONG_OPTIONS is not set +CONFIG_FEATURE_DIFF_DIR=y +# CONFIG_ED is not set +CONFIG_PATCH=y +CONFIG_SED=y +CONFIG_VI=y +CONFIG_FEATURE_VI_MAX_LEN=4096 +CONFIG_FEATURE_VI_8BIT=y +CONFIG_FEATURE_VI_COLON=y +CONFIG_FEATURE_VI_YANKMARK=y +CONFIG_FEATURE_VI_SEARCH=y +# CONFIG_FEATURE_VI_REGEX_SEARCH is not set +CONFIG_FEATURE_VI_USE_SIGNALS=y +CONFIG_FEATURE_VI_DOT_CMD=y +CONFIG_FEATURE_VI_READONLY=y +CONFIG_FEATURE_VI_SETOPTS=y +CONFIG_FEATURE_VI_SET=y +CONFIG_FEATURE_VI_WIN_RESIZE=y +CONFIG_FEATURE_VI_ASK_TERMINAL=y +CONFIG_FEATURE_VI_UNDO=y +CONFIG_FEATURE_VI_UNDO_QUEUE=y +CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=256 +CONFIG_FEATURE_ALLOW_EXEC=y + +# +# Finding Utilities +# +CONFIG_FIND=y +CONFIG_FEATURE_FIND_PRINT0=y +CONFIG_FEATURE_FIND_MTIME=y +CONFIG_FEATURE_FIND_MMIN=y +CONFIG_FEATURE_FIND_PERM=y +CONFIG_FEATURE_FIND_TYPE=y +CONFIG_FEATURE_FIND_XDEV=y +CONFIG_FEATURE_FIND_MAXDEPTH=y +CONFIG_FEATURE_FIND_NEWER=y +# CONFIG_FEATURE_FIND_INUM is not set +CONFIG_FEATURE_FIND_EXEC=y +CONFIG_FEATURE_FIND_EXEC_PLUS=y +CONFIG_FEATURE_FIND_USER=y +CONFIG_FEATURE_FIND_GROUP=y +CONFIG_FEATURE_FIND_NOT=y +CONFIG_FEATURE_FIND_DEPTH=y +CONFIG_FEATURE_FIND_PAREN=y +CONFIG_FEATURE_FIND_SIZE=y +CONFIG_FEATURE_FIND_PRUNE=y +# CONFIG_FEATURE_FIND_DELETE is not set +CONFIG_FEATURE_FIND_PATH=y +CONFIG_FEATURE_FIND_REGEX=y +# CONFIG_FEATURE_FIND_CONTEXT is not set +# CONFIG_FEATURE_FIND_LINKS is not set +CONFIG_GREP=y +CONFIG_EGREP=y +CONFIG_FGREP=y +CONFIG_FEATURE_GREP_CONTEXT=y +CONFIG_XARGS=y +# CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set +CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y +CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y +CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y +CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y +CONFIG_FEATURE_XARGS_SUPPORT_PARALLEL=y +CONFIG_FEATURE_XARGS_SUPPORT_ARGS_FILE=y + +# +# Init Utilities +# +# CONFIG_BOOTCHARTD is not set +# CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set +# CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set +CONFIG_HALT=y +CONFIG_POWEROFF=y +CONFIG_REBOOT=y +CONFIG_FEATURE_WAIT_FOR_INIT=y +# CONFIG_FEATURE_CALL_TELINIT is not set +CONFIG_TELINIT_PATH="" +CONFIG_INIT=y +CONFIG_LINUXRC=y +CONFIG_FEATURE_USE_INITTAB=y +CONFIG_FEATURE_KILL_REMOVED=y +CONFIG_FEATURE_KILL_DELAY=0 +CONFIG_FEATURE_INIT_SCTTY=y +CONFIG_FEATURE_INIT_SYSLOG=y +CONFIG_FEATURE_INIT_QUIET=y +# CONFIG_FEATURE_INIT_COREDUMPS is not set +CONFIG_INIT_TERMINAL_TYPE="linux" +CONFIG_FEATURE_INIT_MODIFY_CMDLINE=y + +# +# Login/Password Management Utilities +# +CONFIG_FEATURE_SHADOWPASSWDS=y +# CONFIG_USE_BB_PWD_GRP is not set +# CONFIG_USE_BB_SHADOW is not set +CONFIG_USE_BB_CRYPT=y +CONFIG_USE_BB_CRYPT_SHA=y +# CONFIG_ADD_SHELL is not set +# CONFIG_REMOVE_SHELL is not set +CONFIG_ADDGROUP=y +# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set +CONFIG_ADDUSER=y +# CONFIG_FEATURE_CHECK_NAMES is not set +CONFIG_LAST_ID=60000 +CONFIG_FIRST_SYSTEM_ID=100 +CONFIG_LAST_SYSTEM_ID=999 +# CONFIG_CHPASSWD is not set +CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="md5" +# CONFIG_CRYPTPW is not set +CONFIG_MKPASSWD=y +CONFIG_DELUSER=y +CONFIG_DELGROUP=y +# CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set +CONFIG_GETTY=y +CONFIG_LOGIN=y +# CONFIG_LOGIN_SESSION_AS_CHILD is not set +# CONFIG_LOGIN_SCRIPTS is not set +CONFIG_FEATURE_NOLOGIN=y +CONFIG_FEATURE_SECURETTY=y +CONFIG_PASSWD=y +CONFIG_FEATURE_PASSWD_WEAK_CHECK=y +CONFIG_SU=y +CONFIG_FEATURE_SU_SYSLOG=y +CONFIG_FEATURE_SU_CHECKS_SHELLS=y +# CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set +CONFIG_SULOGIN=y +CONFIG_VLOCK=y + +# +# Linux Ext2 FS Progs +# +CONFIG_CHATTR=y +CONFIG_FSCK=y +CONFIG_LSATTR=y +# CONFIG_TUNE2FS is not set + +# +# Linux Module Utilities +# +# CONFIG_MODPROBE_SMALL is not set +# CONFIG_DEPMOD is not set +CONFIG_INSMOD=y +CONFIG_LSMOD=y +CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT=y +# CONFIG_MODINFO is not set +CONFIG_MODPROBE=y +# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set +CONFIG_RMMOD=y + +# +# Options common to multiple modutils +# +CONFIG_FEATURE_CMDLINE_MODULE_OPTIONS=y +# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set +# CONFIG_FEATURE_2_4_MODULES is not set +# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set +# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set +# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set +# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set +# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set +CONFIG_FEATURE_CHECK_TAINTED_MODULE=y +# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set +CONFIG_FEATURE_MODUTILS_ALIAS=y +CONFIG_FEATURE_MODUTILS_SYMBOLS=y +CONFIG_DEFAULT_MODULES_DIR="/lib/modules" +CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" + +# +# Linux System Utilities +# +# CONFIG_ACPID is not set +# CONFIG_FEATURE_ACPID_COMPAT is not set +# CONFIG_BLKDISCARD is not set +CONFIG_BLKID=y +# CONFIG_FEATURE_BLKID_TYPE is not set +# CONFIG_BLOCKDEV is not set +# CONFIG_CAL is not set +CONFIG_CHRT=y +CONFIG_DMESG=y +CONFIG_FEATURE_DMESG_PRETTY=y +CONFIG_EJECT=y +# CONFIG_FEATURE_EJECT_SCSI is not set +CONFIG_FALLOCATE=y +# CONFIG_FATATTR is not set +CONFIG_FBSET=y +CONFIG_FEATURE_FBSET_FANCY=y +CONFIG_FEATURE_FBSET_READMODE=y +CONFIG_FDFORMAT=y +CONFIG_FDISK=y +# CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set +CONFIG_FEATURE_FDISK_WRITABLE=y +# CONFIG_FEATURE_AIX_LABEL is not set +# CONFIG_FEATURE_SGI_LABEL is not set +# CONFIG_FEATURE_SUN_LABEL is not set +# CONFIG_FEATURE_OSF_LABEL is not set +CONFIG_FEATURE_GPT_LABEL=y +CONFIG_FEATURE_FDISK_ADVANCED=y +# CONFIG_FINDFS is not set +CONFIG_FLOCK=y +CONFIG_FDFLUSH=y +CONFIG_FREERAMDISK=y +# CONFIG_FSCK_MINIX is not set +CONFIG_FSFREEZE=y +CONFIG_FSTRIM=y +CONFIG_GETOPT=y +CONFIG_FEATURE_GETOPT_LONG=y +CONFIG_HEXDUMP=y +# CONFIG_FEATURE_HEXDUMP_REVERSE is not set +# CONFIG_HD is not set +CONFIG_XXD=y +CONFIG_HWCLOCK=y +CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS=y +# CONFIG_IONICE is not set +CONFIG_IPCRM=y +CONFIG_IPCS=y +CONFIG_LAST=y +# CONFIG_FEATURE_LAST_FANCY is not set +CONFIG_LOSETUP=y +CONFIG_LSPCI=y +CONFIG_LSUSB=y +CONFIG_MDEV=y +CONFIG_FEATURE_MDEV_CONF=y +CONFIG_FEATURE_MDEV_RENAME=y +# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set +CONFIG_FEATURE_MDEV_EXEC=y +CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y +CONFIG_MESG=y +CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP=y +CONFIG_MKE2FS=y +# CONFIG_MKFS_EXT2 is not set +# CONFIG_MKFS_MINIX is not set +# CONFIG_FEATURE_MINIX2 is not set +# CONFIG_MKFS_REISER is not set +CONFIG_MKDOSFS=y +CONFIG_MKFS_VFAT=y +CONFIG_MKSWAP=y +# CONFIG_FEATURE_MKSWAP_UUID is not set +CONFIG_MORE=y +CONFIG_MOUNT=y +# CONFIG_FEATURE_MOUNT_FAKE is not set +# CONFIG_FEATURE_MOUNT_VERBOSE is not set +# CONFIG_FEATURE_MOUNT_HELPERS is not set +# CONFIG_FEATURE_MOUNT_LABEL is not set +# CONFIG_FEATURE_MOUNT_NFS is not set +CONFIG_FEATURE_MOUNT_CIFS=y +CONFIG_FEATURE_MOUNT_FLAGS=y +CONFIG_FEATURE_MOUNT_FSTAB=y +CONFIG_FEATURE_MOUNT_OTHERTAB=y +CONFIG_MOUNTPOINT=y +# CONFIG_NSENTER is not set +CONFIG_PIVOT_ROOT=y +CONFIG_RDATE=y +# CONFIG_RDEV is not set +CONFIG_READPROFILE=y +CONFIG_RENICE=y +# CONFIG_REV is not set +# CONFIG_RTCWAKE is not set +# CONFIG_SCRIPT is not set +# CONFIG_SCRIPTREPLAY is not set +CONFIG_SETARCH=y +CONFIG_LINUX32=y +CONFIG_LINUX64=y +CONFIG_SETPRIV=y +CONFIG_FEATURE_SETPRIV_DUMP=y +CONFIG_FEATURE_SETPRIV_CAPABILITIES=y +CONFIG_FEATURE_SETPRIV_CAPABILITY_NAMES=y +CONFIG_SETSID=y +CONFIG_SWAPON=y +# CONFIG_FEATURE_SWAPON_DISCARD is not set +# CONFIG_FEATURE_SWAPON_PRI is not set +CONFIG_SWAPOFF=y +CONFIG_FEATURE_SWAPONOFF_LABEL=y +CONFIG_SWITCH_ROOT=y +CONFIG_TASKSET=y +# CONFIG_FEATURE_TASKSET_FANCY is not set +CONFIG_UEVENT=y +CONFIG_UMOUNT=y +CONFIG_FEATURE_UMOUNT_ALL=y +# CONFIG_UNSHARE is not set +# CONFIG_WALL is not set + +# +# Common options for mount/umount +# +CONFIG_FEATURE_MOUNT_LOOP=y +CONFIG_FEATURE_MOUNT_LOOP_CREATE=y +# CONFIG_FEATURE_MTAB_SUPPORT is not set +CONFIG_VOLUMEID=y + +# +# Filesystem/Volume identification +# +# CONFIG_FEATURE_VOLUMEID_BCACHE is not set +# CONFIG_FEATURE_VOLUMEID_BTRFS is not set +# CONFIG_FEATURE_VOLUMEID_CRAMFS is not set +CONFIG_FEATURE_VOLUMEID_EXFAT=y +CONFIG_FEATURE_VOLUMEID_EXT=y +CONFIG_FEATURE_VOLUMEID_F2FS=y +CONFIG_FEATURE_VOLUMEID_FAT=y +# CONFIG_FEATURE_VOLUMEID_HFS is not set +# CONFIG_FEATURE_VOLUMEID_ISO9660 is not set +# CONFIG_FEATURE_VOLUMEID_JFS is not set +# CONFIG_FEATURE_VOLUMEID_LFS is not set +# CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set +# CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set +# CONFIG_FEATURE_VOLUMEID_LUKS is not set +CONFIG_FEATURE_VOLUMEID_MINIX=y +# CONFIG_FEATURE_VOLUMEID_NILFS is not set +# CONFIG_FEATURE_VOLUMEID_NTFS is not set +# CONFIG_FEATURE_VOLUMEID_OCFS2 is not set +# CONFIG_FEATURE_VOLUMEID_REISERFS is not set +# CONFIG_FEATURE_VOLUMEID_ROMFS is not set +# CONFIG_FEATURE_VOLUMEID_SQUASHFS is not set +# CONFIG_FEATURE_VOLUMEID_SYSV is not set +CONFIG_FEATURE_VOLUMEID_UBIFS=y +# CONFIG_FEATURE_VOLUMEID_UDF is not set +# CONFIG_FEATURE_VOLUMEID_XFS is not set + +# +# Miscellaneous Utilities +# +# CONFIG_ADJTIMEX is not set +# CONFIG_BBCONFIG is not set +# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set +# CONFIG_BEEP is not set +CONFIG_FEATURE_BEEP_FREQ=0 +CONFIG_FEATURE_BEEP_LENGTH_MS=0 +# CONFIG_CHAT is not set +# CONFIG_FEATURE_CHAT_NOFAIL is not set +# CONFIG_FEATURE_CHAT_TTY_HIFI is not set +# CONFIG_FEATURE_CHAT_IMPLICIT_CR is not set +# CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set +# CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set +# CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set +# CONFIG_FEATURE_CHAT_CLR_ABORT is not set +# CONFIG_CONSPY is not set +CONFIG_CROND=y +# CONFIG_FEATURE_CROND_D is not set +# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set +CONFIG_FEATURE_CROND_SPECIAL_TIMES=y +CONFIG_FEATURE_CROND_DIR="/var/spool/cron" +CONFIG_CRONTAB=y +CONFIG_DC=y +# CONFIG_FEATURE_DC_LIBM is not set +# CONFIG_DEVFSD is not set +# CONFIG_DEVFSD_MODLOAD is not set +# CONFIG_DEVFSD_FG_NP is not set +# CONFIG_DEVFSD_VERBOSE is not set +# CONFIG_FEATURE_DEVFS is not set +CONFIG_DEVMEM=y +# CONFIG_FBSPLASH is not set +# CONFIG_FLASH_ERASEALL is not set +# CONFIG_FLASH_LOCK is not set +# CONFIG_FLASH_UNLOCK is not set +# CONFIG_FLASHCP is not set +CONFIG_HDPARM=y +CONFIG_FEATURE_HDPARM_GET_IDENTITY=y +# CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set +# CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF is not set +# CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set +# CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set +# CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set +CONFIG_HEXEDIT=y +CONFIG_I2CGET=y +CONFIG_I2CSET=y +CONFIG_I2CDUMP=y +CONFIG_I2CDETECT=y +# CONFIG_INOTIFYD is not set +CONFIG_LESS=y +CONFIG_FEATURE_LESS_MAXLINES=9999999 +CONFIG_FEATURE_LESS_BRACKETS=y +CONFIG_FEATURE_LESS_FLAGS=y +CONFIG_FEATURE_LESS_TRUNCATE=y +# CONFIG_FEATURE_LESS_MARKS is not set +CONFIG_FEATURE_LESS_REGEXP=y +# CONFIG_FEATURE_LESS_WINCH is not set +# CONFIG_FEATURE_LESS_ASK_TERMINAL is not set +# CONFIG_FEATURE_LESS_DASHCMD is not set +# CONFIG_FEATURE_LESS_LINENUMS is not set +# CONFIG_FEATURE_LESS_RAW is not set +# CONFIG_FEATURE_LESS_ENV is not set +CONFIG_LSSCSI=y +CONFIG_MAKEDEVS=y +# CONFIG_FEATURE_MAKEDEVS_LEAF is not set +CONFIG_FEATURE_MAKEDEVS_TABLE=y +# CONFIG_MAN is not set +CONFIG_MICROCOM=y +CONFIG_MT=y +# CONFIG_NANDWRITE is not set +# CONFIG_NANDDUMP is not set +CONFIG_PARTPROBE=y +# CONFIG_RAIDAUTORUN is not set +# CONFIG_READAHEAD is not set +# CONFIG_RFKILL is not set +CONFIG_RUNLEVEL=y +# CONFIG_RX is not set +CONFIG_SETFATTR=y +CONFIG_SETSERIAL=y +CONFIG_STRINGS=y +CONFIG_TIME=y +# CONFIG_TTYSIZE is not set +# CONFIG_UBIATTACH is not set +# CONFIG_UBIDETACH is not set +# CONFIG_UBIMKVOL is not set +# CONFIG_UBIRMVOL is not set +# CONFIG_UBIRSVOL is not set +# CONFIG_UBIUPDATEVOL is not set +CONFIG_UBIRENAME=y +# CONFIG_VOLNAME is not set +CONFIG_WATCHDOG=y + +# +# Networking Utilities +# +CONFIG_FEATURE_IPV6=y +# CONFIG_FEATURE_UNIX_LOCAL is not set +CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y +# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set +CONFIG_ARP=y +CONFIG_ARPING=y +CONFIG_BRCTL=y +CONFIG_FEATURE_BRCTL_FANCY=y +CONFIG_FEATURE_BRCTL_SHOW=y +CONFIG_DNSD=y +CONFIG_ETHER_WAKE=y +# CONFIG_FTPD is not set +# CONFIG_FEATURE_FTPD_WRITE is not set +# CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set +# CONFIG_FEATURE_FTPD_AUTHENTICATION is not set +# CONFIG_FTPGET is not set +# CONFIG_FTPPUT is not set +# CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set +CONFIG_HOSTNAME=y +CONFIG_DNSDOMAINNAME=y +CONFIG_HTTPD=y +CONFIG_FEATURE_HTTPD_RANGES=y +CONFIG_FEATURE_HTTPD_SETUID=y +CONFIG_FEATURE_HTTPD_BASIC_AUTH=y +CONFIG_FEATURE_HTTPD_AUTH_MD5=y +CONFIG_FEATURE_HTTPD_CGI=y +CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR=y +CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV=y +CONFIG_FEATURE_HTTPD_ENCODE_URL_STR=y +CONFIG_FEATURE_HTTPD_ERROR_PAGES=y +CONFIG_FEATURE_HTTPD_PROXY=y +CONFIG_FEATURE_HTTPD_GZIP=y +CONFIG_IFCONFIG=y +CONFIG_FEATURE_IFCONFIG_STATUS=y +CONFIG_FEATURE_IFCONFIG_SLIP=y +CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y +CONFIG_FEATURE_IFCONFIG_HW=y +# CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set +# CONFIG_IFENSLAVE is not set +# CONFIG_IFPLUGD is not set +CONFIG_IFUP=y +CONFIG_IFDOWN=y +CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate" +CONFIG_FEATURE_IFUPDOWN_IP=y +CONFIG_FEATURE_IFUPDOWN_IPV4=y +CONFIG_FEATURE_IFUPDOWN_IPV6=y +CONFIG_FEATURE_IFUPDOWN_MAPPING=y +# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set +CONFIG_INETD=y +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO=y +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD=y +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME=y +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME=y +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN=y +# CONFIG_FEATURE_INETD_RPC is not set +CONFIG_IP=y +CONFIG_IPADDR=y +CONFIG_IPLINK=y +CONFIG_IPROUTE=y +CONFIG_IPTUNNEL=y +CONFIG_IPRULE=y +CONFIG_IPNEIGH=y +CONFIG_FEATURE_IP_ADDRESS=y +CONFIG_FEATURE_IP_LINK=y +CONFIG_FEATURE_IP_ROUTE=y +CONFIG_FEATURE_IP_ROUTE_DIR="/etc/iproute2" +CONFIG_FEATURE_IP_TUNNEL=y +CONFIG_FEATURE_IP_RULE=y +CONFIG_FEATURE_IP_NEIGH=y +# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set +# CONFIG_IPCALC is not set +# CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set +# CONFIG_FEATURE_IPCALC_FANCY is not set +# CONFIG_FAKEIDENTD is not set +CONFIG_NAMEIF=y +# CONFIG_FEATURE_NAMEIF_EXTENDED is not set +# CONFIG_NBDCLIENT is not set +CONFIG_NC=y +CONFIG_NETCAT=y +CONFIG_NC_SERVER=y +CONFIG_NC_EXTRA=y +CONFIG_NC_110_COMPAT=y +CONFIG_NETSTAT=y +# CONFIG_FEATURE_NETSTAT_WIDE is not set +# CONFIG_FEATURE_NETSTAT_PRG is not set +CONFIG_NSLOOKUP=y +CONFIG_FEATURE_NSLOOKUP_BIG=y +CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS=y +# CONFIG_NTPD is not set +# CONFIG_FEATURE_NTPD_SERVER is not set +# CONFIG_FEATURE_NTPD_CONF is not set +CONFIG_PING=y +# CONFIG_PING6 is not set +CONFIG_FEATURE_FANCY_PING=y +# CONFIG_PSCAN is not set +CONFIG_ROUTE=y +# CONFIG_SLATTACH is not set +CONFIG_SSL_CLIENT=y +CONFIG_TC=y +CONFIG_FEATURE_TC_INGRESS=y +# CONFIG_TCPSVD is not set +# CONFIG_UDPSVD is not set +CONFIG_TELNET=y +CONFIG_FEATURE_TELNET_TTYPE=y +CONFIG_FEATURE_TELNET_AUTOLOGIN=y +CONFIG_FEATURE_TELNET_WIDTH=y +# CONFIG_TELNETD is not set +# CONFIG_FEATURE_TELNETD_STANDALONE is not set +# CONFIG_FEATURE_TELNETD_INETD_WAIT is not set +CONFIG_TFTP=y +# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set +# CONFIG_TFTPD is not set + +# +# Common options for tftp/tftpd +# +CONFIG_FEATURE_TFTP_GET=y +CONFIG_FEATURE_TFTP_PUT=y +CONFIG_FEATURE_TFTP_BLOCKSIZE=y +# CONFIG_TFTP_DEBUG is not set +CONFIG_TLS=y +CONFIG_TRACEROUTE=y +# CONFIG_TRACEROUTE6 is not set +# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set +# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set +CONFIG_TUNCTL=y +CONFIG_FEATURE_TUNCTL_UG=y +CONFIG_VCONFIG=y +CONFIG_WGET=y +CONFIG_FEATURE_WGET_LONG_OPTIONS=y +CONFIG_FEATURE_WGET_STATUSBAR=y +CONFIG_FEATURE_WGET_AUTHENTICATION=y +CONFIG_FEATURE_WGET_TIMEOUT=y +CONFIG_FEATURE_WGET_HTTPS=y +# CONFIG_FEATURE_WGET_OPENSSL is not set +# CONFIG_WHOIS is not set +# CONFIG_ZCIP is not set +CONFIG_UDHCPD=y +# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set +CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY=y +CONFIG_DHCPD_LEASES_FILE="/var/lib/misc/udhcpd.leases" +CONFIG_DUMPLEASES=y +CONFIG_DHCPRELAY=y +CONFIG_UDHCPC=y +CONFIG_FEATURE_UDHCPC_ARPING=y +CONFIG_FEATURE_UDHCPC_SANITIZEOPT=y +CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script" +# CONFIG_UDHCPC6 is not set +# CONFIG_FEATURE_UDHCPC6_RFC3646 is not set +# CONFIG_FEATURE_UDHCPC6_RFC4704 is not set +# CONFIG_FEATURE_UDHCPC6_RFC4833 is not set +# CONFIG_FEATURE_UDHCPC6_RFC5970 is not set + +# +# Common options for DHCP applets +# +# CONFIG_FEATURE_UDHCP_PORT is not set +CONFIG_UDHCP_DEBUG=0 +CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80 +# CONFIG_FEATURE_UDHCP_RFC3397 is not set +CONFIG_FEATURE_UDHCP_8021Q=y +CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n" + +# +# Print Utilities +# +# CONFIG_LPD is not set +# CONFIG_LPR is not set +# CONFIG_LPQ is not set + +# +# Mail Utilities +# +# CONFIG_MAKEMIME is not set +# CONFIG_POPMAILDIR is not set +# CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set +# CONFIG_REFORMIME is not set +# CONFIG_FEATURE_REFORMIME_COMPAT is not set +# CONFIG_SENDMAIL is not set +CONFIG_FEATURE_MIME_CHARSET="" + +# +# Process Utilities +# +CONFIG_FREE=y +CONFIG_FUSER=y +# CONFIG_IOSTAT is not set +CONFIG_KILL=y +CONFIG_KILLALL=y +CONFIG_KILLALL5=y +CONFIG_LSOF=y +# CONFIG_MPSTAT is not set +# CONFIG_NMETER is not set +CONFIG_PGREP=y +CONFIG_PKILL=y +CONFIG_PIDOF=y +CONFIG_FEATURE_PIDOF_SINGLE=y +CONFIG_FEATURE_PIDOF_OMIT=y +# CONFIG_PMAP is not set +# CONFIG_POWERTOP is not set +# CONFIG_FEATURE_POWERTOP_INTERACTIVE is not set +CONFIG_PS=y +# CONFIG_FEATURE_PS_WIDE is not set +# CONFIG_FEATURE_PS_LONG is not set +# CONFIG_FEATURE_PS_TIME is not set +# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set +# CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set +# CONFIG_PSTREE is not set +# CONFIG_PWDX is not set +# CONFIG_SMEMCAP is not set +CONFIG_BB_SYSCTL=y +CONFIG_TOP=y +CONFIG_FEATURE_TOP_INTERACTIVE=y +CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y +CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y +# CONFIG_FEATURE_TOP_SMP_CPU is not set +# CONFIG_FEATURE_TOP_DECIMALS is not set +# CONFIG_FEATURE_TOP_SMP_PROCESS is not set +# CONFIG_FEATURE_TOPMEM is not set +CONFIG_UPTIME=y +# CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set +CONFIG_WATCH=y +# CONFIG_FEATURE_SHOW_THREADS is not set + +# +# Runit Utilities +# +# CONFIG_CHPST is not set +# CONFIG_SETUIDGID is not set +# CONFIG_ENVUIDGID is not set +# CONFIG_ENVDIR is not set +# CONFIG_SOFTLIMIT is not set +# CONFIG_RUNSV is not set +# CONFIG_RUNSVDIR is not set +# CONFIG_FEATURE_RUNSVDIR_LOG is not set +# CONFIG_SV is not set +CONFIG_SV_DEFAULT_SERVICE_DIR="" +CONFIG_SVC=y +CONFIG_SVOK=y +# CONFIG_SVLOGD is not set +# CONFIG_CHCON is not set +# CONFIG_GETENFORCE is not set +# CONFIG_GETSEBOOL is not set +# CONFIG_LOAD_POLICY is not set +# CONFIG_MATCHPATHCON is not set +# CONFIG_RUNCON is not set +# CONFIG_SELINUXENABLED is not set +# CONFIG_SESTATUS is not set +# CONFIG_SETENFORCE is not set +# CONFIG_SETFILES is not set +# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set +# CONFIG_RESTORECON is not set +# CONFIG_SETSEBOOL is not set + +# +# Shells +# +CONFIG_SH_IS_ASH=y +# CONFIG_SH_IS_HUSH is not set +# CONFIG_SH_IS_NONE is not set +# CONFIG_BASH_IS_ASH is not set +# CONFIG_BASH_IS_HUSH is not set +CONFIG_BASH_IS_NONE=y +CONFIG_ASH=y +CONFIG_ASH_OPTIMIZE_FOR_SIZE=y +CONFIG_ASH_INTERNAL_GLOB=y +CONFIG_ASH_BASH_COMPAT=y +# CONFIG_ASH_BASH_SOURCE_CURDIR is not set +CONFIG_ASH_BASH_NOT_FOUND_HOOK=y +CONFIG_ASH_JOB_CONTROL=y +CONFIG_ASH_ALIAS=y +CONFIG_ASH_RANDOM_SUPPORT=y +CONFIG_ASH_EXPAND_PRMT=y +CONFIG_ASH_IDLE_TIMEOUT=y +# CONFIG_ASH_MAIL is not set +CONFIG_ASH_ECHO=y +CONFIG_ASH_PRINTF=y +CONFIG_ASH_TEST=y +CONFIG_ASH_HELP=y +CONFIG_ASH_GETOPTS=y +CONFIG_ASH_CMDCMD=y +# CONFIG_CTTYHACK is not set +# CONFIG_HUSH is not set +# CONFIG_HUSH_BASH_COMPAT is not set +# CONFIG_HUSH_BRACE_EXPANSION is not set +# CONFIG_HUSH_LINENO_VAR is not set +# CONFIG_HUSH_BASH_SOURCE_CURDIR is not set +# CONFIG_HUSH_INTERACTIVE is not set +# CONFIG_HUSH_SAVEHISTORY is not set +# CONFIG_HUSH_JOB is not set +# CONFIG_HUSH_TICK is not set +# CONFIG_HUSH_IF is not set +# CONFIG_HUSH_LOOPS is not set +# CONFIG_HUSH_CASE is not set +# CONFIG_HUSH_FUNCTIONS is not set +# CONFIG_HUSH_LOCAL is not set +# CONFIG_HUSH_RANDOM_SUPPORT is not set +# CONFIG_HUSH_MODE_X is not set +# CONFIG_HUSH_ECHO is not set +# CONFIG_HUSH_PRINTF is not set +# CONFIG_HUSH_TEST is not set +# CONFIG_HUSH_HELP is not set +# CONFIG_HUSH_EXPORT is not set +# CONFIG_HUSH_EXPORT_N is not set +# CONFIG_HUSH_READONLY is not set +# CONFIG_HUSH_KILL is not set +# CONFIG_HUSH_WAIT is not set +# CONFIG_HUSH_COMMAND is not set +# CONFIG_HUSH_TRAP is not set +# CONFIG_HUSH_TYPE is not set +# CONFIG_HUSH_TIMES is not set +# CONFIG_HUSH_READ is not set +# CONFIG_HUSH_SET is not set +# CONFIG_HUSH_UNSET is not set +# CONFIG_HUSH_ULIMIT is not set +# CONFIG_HUSH_UMASK is not set +# CONFIG_HUSH_GETOPTS is not set +# CONFIG_HUSH_MEMLEAK is not set + +# +# Options common to all shells +# +CONFIG_FEATURE_SH_MATH=y +CONFIG_FEATURE_SH_MATH_64=y +CONFIG_FEATURE_SH_EXTRA_QUIET=y +# CONFIG_FEATURE_SH_STANDALONE is not set +# CONFIG_FEATURE_SH_NOFORK is not set +CONFIG_FEATURE_SH_READ_FRAC=y +# CONFIG_FEATURE_SH_HISTFILESIZE is not set + +# +# System Logging Utilities +# +CONFIG_KLOGD=y +CONFIG_FEATURE_KLOGD_KLOGCTL=y +CONFIG_LOGGER=y +# CONFIG_LOGREAD is not set +# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set +CONFIG_SYSLOGD=y +CONFIG_FEATURE_ROTATE_LOGFILE=y +CONFIG_FEATURE_REMOTE_LOG=y +# CONFIG_FEATURE_SYSLOGD_DUP is not set +# CONFIG_FEATURE_SYSLOGD_CFG is not set +CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256 +# CONFIG_FEATURE_IPC_SYSLOG is not set +CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0 +# CONFIG_FEATURE_KMSG_SYSLOG is not set diff --git a/firmware/ori/board/pluto/device_config b/firmware/ori/board/pluto/device_config new file mode 100644 index 0000000..1159fc1 --- /dev/null +++ b/firmware/ori/board/pluto/device_config @@ -0,0 +1,15 @@ +#S23udc +PRODUCT="PlutoSDR (ADALM-PLUTO)" +USBPID=0xb673 +ENDPOINTS=3 + +#S40network / S41network +UDHCPD_CONF=/etc/udhcpd.conf +CONF=/opt/config.txt +IFAC=/etc/network/interfaces + +#update.sh +TARGET=plutosdr +FIRMWARE=/mnt/msd/pluto.frm +FRM_MAGIC="ITB PlutoSDR (ADALM-PLUTO)" + diff --git a/firmware/ori/board/pluto/device_format_jffs2 b/firmware/ori/board/pluto/device_format_jffs2 new file mode 100644 index 0000000..eb2e5ce --- /dev/null +++ b/firmware/ori/board/pluto/device_format_jffs2 @@ -0,0 +1,17 @@ +#!/bin/sh +set +e + +while true; +do + read -p "Are you sure to delete/format your mtd2 JFFS2 (/mnt/jffs2) partition? (yes/no) " answ + case $answ in + [Yy]* ) + umount /mnt/jffs2 + flash_erase -j /dev/mtd2 0 0 + mount -a + break + ;; + [Nn]* ) exit;; + * ) echo "Please answer yes or no.";; + esac +done diff --git a/firmware/ori/board/pluto/device_passwd b/firmware/ori/board/pluto/device_passwd new file mode 100644 index 0000000..c3c50dd --- /dev/null +++ b/firmware/ori/board/pluto/device_passwd @@ -0,0 +1,11 @@ +#!/bin/sh +set +e + +cat /proc/mounts | grep -q mtd2 || (echo "Filesystem not mounted use device_format_jffs2 command to setup your partition"; exit 1) + +passwd +install -D /etc/passwd /etc/shadow /etc/group -t /mnt/jffs2/etc +cd /etc +md5sum passwd shadow group 2>/dev/null > /mnt/jffs2/etc/password.md5 +sync + diff --git a/firmware/ori/board/pluto/device_persistent_keys b/firmware/ori/board/pluto/device_persistent_keys new file mode 100644 index 0000000..9c4d7bb --- /dev/null +++ b/firmware/ori/board/pluto/device_persistent_keys @@ -0,0 +1,21 @@ +#!/bin/sh +set +e + +KEYFILE=/etc/dropbear/dropbear_ecdsa_host_key +IDFILE=/root/.ssh/authorized_keys + +cat /proc/mounts | grep -q mtd2 || (echo "Filesystem not mounted use device_format_jffs2 command to setup your partition"; exit 1) + +#dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key +[[ ! -f ${KEYFILE} ]] && dropbearkey -t ecdsa -f ${KEYFILE} +install -D /etc/dropbear/dropbear_* -t /mnt/jffs2/etc/dropbear +cd /etc/dropbear +md5sum dropbear_* /etc/dropbear/ 2>/dev/null > /mnt/jffs2/etc/dropbear/keys.md5 + +if [ -f ${IDFILE} ]; then + install -D ${IDFILE} -t /mnt/jffs2/root/.ssh + cd /root/.ssh + md5sum authorized_keys 2>/dev/null > /mnt/jffs2/root/.ssh/keys.md5 +fi + +sync \ No newline at end of file diff --git a/firmware/ori/board/pluto/device_reboot b/firmware/ori/board/pluto/device_reboot new file mode 100644 index 0000000..1134b2a --- /dev/null +++ b/firmware/ori/board/pluto/device_reboot @@ -0,0 +1,32 @@ +#!/bin/sh + +case "$1" in + ram) + cause=7 + ;; + sf) + cause=3 + ;; + verbose) + cause=6 + ;; + break) + cause=2 + ;; + reset) + cause=0 + ;; + + *) + echo "Usage: $0 {ram|sf|reset|verbose|break}" + echo " sf : Reboot and enter Serial Flash DFU mode" + echo " ram : Reboot and enter RAM DFU mode" + echo " reset : Reboot" + echo " verbose: Reboot and start serial console Verbose" + echo " break : Reboot and HALT in u-boot" + exit 1 +esac + +echo $cause > /sys/kernel/debug/zynq_rst/code && /sbin/reboot + +exit 0 diff --git a/firmware/ori/board/pluto/dropbrear_localoptions.h b/firmware/ori/board/pluto/dropbrear_localoptions.h new file mode 100644 index 0000000..8d1cd4a --- /dev/null +++ b/firmware/ori/board/pluto/dropbrear_localoptions.h @@ -0,0 +1 @@ +#define DO_MOTD 1 diff --git a/firmware/ori/board/pluto/fw_env.config b/firmware/ori/board/pluto/fw_env.config new file mode 100644 index 0000000..402a340 --- /dev/null +++ b/firmware/ori/board/pluto/fw_env.config @@ -0,0 +1,2 @@ +# MTD device name Device offset Env. size Flash sector size +/dev/mtd1 0x0000 0x20000 0x20000 diff --git a/firmware/ori/board/pluto/genimage-msd.cfg b/firmware/ori/board/pluto/genimage-msd.cfg new file mode 100644 index 0000000..7ba896d --- /dev/null +++ b/firmware/ori/board/pluto/genimage-msd.cfg @@ -0,0 +1,20 @@ +image boot.vfat { + vfat { + extraargs = "-n PlutoSDR" + files = {"index.html"} + } + size = 30M +} + +image vfat.img { + hdimage { + } + + partition boot { + partition-type = 0xC + bootable = "false" + image = "boot.vfat" + } +} + + diff --git a/firmware/ori/board/pluto/ifupdown.sh b/firmware/ori/board/pluto/ifupdown.sh new file mode 100644 index 0000000..0e75ce1 --- /dev/null +++ b/firmware/ori/board/pluto/ifupdown.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +case "${ACTION}" in +add|"") + ifconfig ${MDEV} up + ifup ${MDEV} + echo $(ip -f inet -o addr show ${MDEV}|cut -d\ -f 7 | cut -d/ -f 1) > /opt/ipaddr-${MDEV} + ;; +remove) + ifdown ${MDEV} + ;; +esac diff --git a/firmware/ori/board/pluto/index.html b/firmware/ori/board/pluto/index.html new file mode 100644 index 0000000..b59f746 --- /dev/null +++ b/firmware/ori/board/pluto/index.html @@ -0,0 +1,197 @@ + + + + + + +ADALM-PLUTO On-board documentation + + + + + + + + + + + +
+ +Analog Devices logo + +
+Network Version | +
+
+ +
+
+

Welcome to the ADALM-PLUTO PAPR

+ADI Professor +

Thank you for joining PAPR

+
+Back to top +

Firmware

+

The ADALM-PLUTO Firmware refers to the U-Boot, HDL, Linux kernel, device drivers, and user space software, which runs on the PlutoSDR. This is bundled up and given a specific version number for the PlutoSDR. For help upgrading firmware, check out the online documentation.

+
+Back to top +

Version Information:

+

The various parts of the firmware all have their own unique versions as well:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Model#MODEL#
Serial#SERIAL#
Build#BUILD#
Linux#LINUX#
U-Boot#UBOOT#
FPGA#FPGA#
Root FS#ROOTFS#
IIO#IIO#
Network over USB#NETWORKUSB#
+Back to top +

Standalone Applications:

+

Custom C/C++ applications can be created/compiled on a host with a Linaro GNU Compiler Collection (GCC) toolchain (with the appropriate flags), transferred over and run directly on the PlutoSDR.

+ + + + + + + + + + + + + + + + + + + +
GCC Compiler Target Triple#GCC_TRIPLE#
GCC version#GCC_VERSION#
Binutils version#BIN_VERSION#
SysRootLatest SYSROOT
+Back to top +

Build Settings:

+

There are many settings which are set as part of the build configuration, and can not be changed without rebuilding the firmware.

+ + + + + + + + + + + +
Username:root
Password:#ROOTPASSWORD#
+Back to top +

Configuration Settings:

+

On the root file system, there are configuration settings that can modify the default configuration, they currently are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Hostname#HOSTNAME#
IP Address (PlutoSDR)#IP#
IP Address (HOST)#HOSTIP#
Netmask#NETMASK#
MAC Address (PlutoSDR)#MAC#
MAC Address (HOST)#MACHOST#
+Back to top +

Wi-Fi Update

+ + + + + + + + + + + + + + + +
SSID#SSID_WLAN#
WPA-PSK Passphrase********
IP Address#IPADDR_WLAN#
+Back to top +

Wired Ethernet using a USB Ethernet adapter. Update

+ + + + + + + + + + + +
IP Address#IPADDR_ETH#
Netmask#NETMASK_ETH#
+ +

To change these settings, check the on-line documentation.

+
+
+ + + + + + diff --git a/firmware/ori/board/pluto/info.html b/firmware/ori/board/pluto/info.html new file mode 100644 index 0000000..e69de29 diff --git a/firmware/ori/board/pluto/input-event-daemon.conf b/firmware/ori/board/pluto/input-event-daemon.conf new file mode 100644 index 0000000..96c1c9a --- /dev/null +++ b/firmware/ori/board/pluto/input-event-daemon.conf @@ -0,0 +1,12 @@ +# +# /etc/input-event-daemon.conf +# + +[Global] +listen = /dev/input/event0 + +[Keys] +BTN_0 = ACTION=remove_all /lib/mdev/automounter.sh + + + diff --git a/firmware/ori/board/pluto/mdev.conf b/firmware/ori/board/pluto/mdev.conf new file mode 100644 index 0000000..09ad12f --- /dev/null +++ b/firmware/ori/board/pluto/mdev.conf @@ -0,0 +1,7 @@ +# block devices +sd[a-z] root:root 660 */lib/mdev/automounter.sh +sd[a-z][0-9] root:root 660 */lib/mdev/automounter.sh +# net devices +wlan[0-9] root:root 660 */lib/mdev/ifupdown.sh +usb[0-9] root:root 660 */lib/mdev/ifupdown.sh +eth[0-9] root:root 660 */lib/mdev/ifupdown.sh diff --git a/firmware/ori/board/pluto/motd b/firmware/ori/board/pluto/motd new file mode 100644 index 0000000..f70854f --- /dev/null +++ b/firmware/ori/board/pluto/motd @@ -0,0 +1,8 @@ +______ _ _ ___________ _____ +| ___ \ | | | | _ | ___ \_ _| +| |_/ / |_ _| |_ ___ ______| | | | |_/ / | | +| __/| | | | | __/ _ \______| | | | / | | +| | | | |_| | || (_) | \ \_/ / |\ \ _| |_ +\_| |_|\__,_|\__\___/ \___/\_| \_|\___/ +#BUILD# F5OEO (2024) + diff --git a/firmware/ori/board/pluto/msd/.gitignore b/firmware/ori/board/pluto/msd/.gitignore new file mode 100644 index 0000000..ef2d66e --- /dev/null +++ b/firmware/ori/board/pluto/msd/.gitignore @@ -0,0 +1,2 @@ +LICENSE.html +index.html diff --git a/firmware/ori/board/pluto/msd/LICENSE b/firmware/ori/board/pluto/msd/LICENSE new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/firmware/ori/board/pluto/msd/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/firmware/ori/board/pluto/msd/img/ADI_Logo_AWP.png b/firmware/ori/board/pluto/msd/img/ADI_Logo_AWP.png new file mode 100644 index 0000000..231fa10 Binary files /dev/null and b/firmware/ori/board/pluto/msd/img/ADI_Logo_AWP.png differ diff --git a/firmware/ori/board/pluto/msd/img/download.png b/firmware/ori/board/pluto/msd/img/download.png new file mode 100644 index 0000000..8f7def1 Binary files /dev/null and b/firmware/ori/board/pluto/msd/img/download.png differ diff --git a/firmware/ori/board/pluto/msd/img/ez.png b/firmware/ori/board/pluto/msd/img/ez.png new file mode 100644 index 0000000..66cc22f Binary files /dev/null and b/firmware/ori/board/pluto/msd/img/ez.png differ diff --git a/firmware/ori/board/pluto/msd/img/favicon.ico b/firmware/ori/board/pluto/msd/img/favicon.ico new file mode 100644 index 0000000..0faa5e9 Binary files /dev/null and b/firmware/ori/board/pluto/msd/img/favicon.ico differ diff --git a/firmware/ori/board/pluto/msd/img/prof_blue.png b/firmware/ori/board/pluto/msd/img/prof_blue.png new file mode 100644 index 0000000..17ecd8f Binary files /dev/null and b/firmware/ori/board/pluto/msd/img/prof_blue.png differ diff --git a/firmware/ori/board/pluto/msd/img/style.css b/firmware/ori/board/pluto/msd/img/style.css new file mode 100644 index 0000000..f70076b --- /dev/null +++ b/firmware/ori/board/pluto/msd/img/style.css @@ -0,0 +1,164 @@ +body{ + font-family: "Helvetica Neue", sans-serif; + font-size: 16px; + font-weight: normal; + line-height: 1.3em; + color: #636363; + padding: 0 20px 0; + max-width: 1024px; + margin: auto; +} +hr{ + color: #ccc; + margin: 10px 0 20px; +} +h1, h3{ + font-family: "Arial Regular", sans-serif; + font-weight: bold; + margin-bottom:0; +} +h1{ + font-size: 32px; + color: #1e4056; + margin-bottom: 40px; +} +h3{ + font-size: 24px; +} +header{ + margin-bottom: 20px; +} +header img{ + margin-top: 10px; + width: 175px; +} +nav{ + margin-bottom: 20px; +} +ul{ + padding-left: 20px; +} +table{ + width: 100%; +} +th{ + background-color: #33b3ca; + color: #fff; + font-weight: normal; + padding: 10px; + text-align: left; +} +td{ + background-color: #f5f5f5; + font-size: 14px; + padding: 5px 10px; +} +th:first-of-type, +td:first-of-type{ + width: 25%; + font-weight: bold; +} +#versiontest{ + color: #27B34F; +} +a{ + color: #33b3ca; + text-decoration: none; +} +.button{ + background-color: #33b3ca; + border-radius: 15px; + color: #ffffff; + margin: 15px 10px 15px 10px; + padding: 5px 15px; + cursor: pointer; +} +.dropdown { + position: relative; + text-align: left; + display: inline-block; +} +.dropdown-content { + display: none; + position: absolute; + background-color: #f9f9f9; + min-width: 200px; + border-radius: 15px; + box-shadow: 0px 8px 24px 0px rgba(0,0,0,0.2); + padding: 10px 10px; + z-index: 1; +} +.dropdown:hover .dropdown-content { + display: block; +} +.download{ + background-image: url("download.png"); + padding: 1em 1em .5em 70px; + margin-bottom: 1.5em; + min-height: 68px; + background-position: 10px 50%; + background-repeat: no-repeat; + color: #000; + overflow: hidden; + box-sizing: border-box; + background-color: #d6efc2; + border-radius: 1.4em; +} +.quicklinks{ + float: right; + -webkit-column-count: 2; /* Chrome, Safari, Opera */ + -moz-column-count: 2; /* Firefox */ + column-count: 2; + -webkit-column-gap: 20px; /* Chrome, Safari, Opera */ + -moz-column-gap: 20px; /* Firefox */ + column-gap: 20px; + -webkit-column-rule: 1px solid lightblue; /* Chrome, Safari, Opera */ + -moz-column-rule: 1px solid lightblue; /* Firefox */ + column-rule: 1px solid lightblue; + list-style: none; + list-style-type: none; + list-style-image: none; + list-style-position: outside; + font-size: 12px; + line-height: 18px; + font-family: Helvetica,Arial,sans-serif; + margin-top: 2em; + margin-bottom: 0em; +} +.colLeft, .colRight{ + float: left; +} +.colLeft{ + width: 60%; +} +.colRight{ + width: 40%; + text-align: center; +} +.anchor{ + float: right; +} +.boxed { + box-sizing: border-box; + padding: 10px; + border: 1px solid; + border-color: #636363; + border-radius: 5px; +} +pre { + display: inline; + margin: 0; +} +.xterm { + color:#333; + display:block; + font-family:Monaco,Menlo,Consolas,"Courier New",monospace; + padding:9.5px; + margin:0 0 10px; + font-size:13px; + word-break:break-all; + word-wrap:break-word; + background-color:#f5f5f5; + border:1px solid #ccc; + border-radius:4px; +} diff --git a/firmware/ori/board/pluto/msd/img/tw.png b/firmware/ori/board/pluto/msd/img/tw.png new file mode 100644 index 0000000..afab2a9 Binary files /dev/null and b/firmware/ori/board/pluto/msd/img/tw.png differ diff --git a/firmware/ori/board/pluto/msd/img/version.js b/firmware/ori/board/pluto/msd/img/version.js new file mode 100644 index 0000000..71f0f84 --- /dev/null +++ b/firmware/ori/board/pluto/msd/img/version.js @@ -0,0 +1,278 @@ +function OnTheWeb() { + window.location.assign("https://wiki.analog.com/university/tools/pluto"); +} + +function versionCompare(v1, v2) { + var v1parts = ("" + v1).replace(/[a-zA-Z]/g, "").replace("-", ".").split("."), + v2parts = ("" + v2).replace(/[a-zA-Z]/g, "").replace("-", ".").split("."), + minLength = Math.min(v1parts.length, v2parts.length), + p1, p2, i; + console.log(v1parts + " || " + v2parts); + for(i = 0; i < minLength; i++) { + p1 = parseInt(v1parts[i], 10); + p2 = parseInt(v2parts[i], 10); + if (isNaN(p1)){ p1 = v1parts[i]; } + if (isNaN(p2)){ p2 = v2parts[i]; } + if (p1 == p2) { + continue; + }else if (p1 > p2) { + return 1; + }else if (p1 < p2) { + return -1; + } + return NaN; + } + if (v1parts.length === v2parts.length) { + return 0; + } + return (v1parts.length < v2parts.length) ? -1 : 1; +} + +var latest_libiio; +var mac = false; + +function GetDriverurl() { + mac = navigator.platform.match(/Mac/i) ? true : false; + if (mac) { + var uAgent = navigator.userAgent.toLowerCase(); + //uAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36".toLowerCase(); + var test = uAgent.match(/mac os x 10_[0-9]*/); + if (test) { + mac = "darwin-" + test[0].match(/10_[0-9]*/)[0].replace("_", "."); + } + document.getElementById('prompt0').innerHTML = "adi-mm:tests analogdevices$"; + document.getElementById('prompt1').innerHTML = "adi-mm:tests analogdevices$"; + } + var win = navigator.platform.indexOf('Win') > -1 ? true : false; + if (win) { + document.getElementById('prompt0').innerHTML = "C:\>"; + document.getElementById('prompt1').innerHTML = "C:\>"; + } else + document.getElementById('hidedriver').style.display = "none"; + var linux = navigator.platform.indexOf('Linux') > -1 ? true : false; + if (mac || win || linux) + document.getElementById('hidelib').style.display = "inline"; + else { + if (navigator.platform.match(/(Linux|iPhone|iPod|iPad|Android)/i)) { + document.getElementById('libtest').innerHTML = "Sorry, we don't support " + navigator.platform + " yet. Please ask."; + jQuery('#libtest').attr ('href', "https://ez.analog.com/university-program"); + } else + document.getElementById('libtest').innerHTML = "Unsupported host \"" + navigator.platform + "\". Please check, and report an issue"; + return; + } + + var i; var j; + + var req = jQuery.getJSON("https://api.github.com/repos/analogdevicesinc/libiio/releases/latest"); + req.fail(function() { + document.getElementById('hidelib').style.display = "none"; + latest_libiio = null; + }); + req.done(function(response) { + latest_libiio = response; + var select = document.getElementById("os-select"); + var suffix = ""; + var os; + for (i = 0; i < latest_libiio.assets.length; i++) { + os = latest_libiio.assets[i].name.split('-')[2]; + suffix = os.slice(-4); + if (suffix == ".zip" ) { + os = os.slice(0, os.length-4); + } + for (j = 0; j < select.length; j++) { + if (os.match(select[j].value)) + break; + } + if (j == select.length) { + select.options[select.options.length] = new Option(os); + if ((win && os == "Windows") || (mac && os == "darwin") || (linux && os == "ubuntu")) { + select.value = os; + libiio_type(); + } + } + } + if (latest_libiio.hasOwnProperty('tarball_url') || latest_libiio.hasOwnProperty('zipball_url')) + select.options[select.options.length] = new Option("source"); + }); + if (win) { + req = jQuery.getJSON("https://api.github.com/repos/analogdevicesinc/plutosdr-m2k-drivers-win/releases/latest"); + req.done(function(response) { + for (i = 0; i < response.assets.length; i++) { + if (response.assets[i].content_type == "application/x-msdownload") { + jQuery('#drivertest').attr ('href', response.assets[i].browser_download_url); + document.getElementById('drivertest').innerHTML = response.name; + } + } + }); + } else if (mac) { + document.getElementById('hidedriver').style.display = "none"; + } else { + document.getElementById('hidedriver').style.display = "none"; + } +} + +function libiio_type() { + var select = document.getElementById("type-select"); + var os = document.getElementById("os-select").value; + select.onchange = null; + var i; + var j; + for (i = select.options.length - 1 ; i >= 0 ; i--) { + select.remove(i); + } + var suffix = ""; + for (i = 0; i < latest_libiio.assets.length; i++) { + if (latest_libiio.assets[i].browser_download_url.match(os)) { + suffix = latest_libiio.assets[i].browser_download_url.slice(-4); + if (suffix == "r.gz" ) { + suffix = ".tar.gz"; + } + for (j = 0; j < select.length; j++) { + if (suffix.match(select[j].value)) + break; + } + if (j == select.length) { + select.options[select.options.length] = new Option(suffix); + if (os.match('centos') && suffix.match('.rpm')) { + select.value = suffix; + } + } + } + } + if (os.match('source')) { + if (latest_libiio.hasOwnProperty('tarball_url')) + select.options[select.options.length] = new Option('.tar'); + if (latest_libiio.hasOwnProperty('zipball_url')) + select.options[select.options.length] = new Option('.zip'); + } + select.onchange = libiio_ver; + libiio_ver(); +} + +function libiio_ver() { + var select = document.getElementById("ver-select"); + var os = document.getElementById("os-select").value; + var suffix = document.getElementById("type-select").value; + select.onchange = null; + var i; + for (i = select.options.length - 1 ; i >= 0 ; i--) { + select.remove(i); + } + for (i = 0; i < latest_libiio.assets.length; i++) { + if (latest_libiio.assets[i].browser_download_url.match(os) && latest_libiio.assets[i].browser_download_url.match(suffix)) { + var file = latest_libiio.assets[i].name.replace(/libiio-[0-9]*\.[0-9]*.[a-z0-9]*-/, ''); + file = file.slice(0, file.length - suffix.length); + select.options[select.options.length] = new Option(file); + if (mac && (file.match(mac) || + file.match(/darwin-10.[0-9]*/) < mac)) { + select.value = file; + console.log('hit'); + } + } + } + if (os.match('source')) { + select.options[select.options.length] = new Option(latest_libiio.tag_name); + } + select.onchange = libiio_url; + libiio_url(); +} + +function libiio_url() { + var os = document.getElementById("os-select").value; + var suffix = document.getElementById("type-select").value; + var ver = document.getElementById("ver-select").value; + var i, url; + for (i = 0; i < latest_libiio.assets.length; i++) { + url = latest_libiio.assets[i].browser_download_url; + if (url.match(ver) && url.match(os) && url.match(suffix)) { + jQuery('#libtest').attr ('href', url); + document.getElementById('libtest').innerHTML = latest_libiio.assets[i].name; + } + } + if (os.match('source')) { + if (suffix.match('.tar')) { + document.getElementById('libtest').innerHTML = "Source code (tar)"; + jQuery('#libtest').attr ('href', latest_libiio.tarball_url); + } + if (suffix.match('.zip')) { + document.getElementById('libtest').innerHTML = "Source code (zip)"; + jQuery('#libtest').attr ('href', latest_libiio.zipball_url); + } + + } +} + +function CheckFrmVersion() { + GetDriverurl(); + var req = jQuery.getJSON("https://api.github.com/repos/analogdevicesinc/plutosdr-fw/releases"); + req.fail(function() { + document.getElementById('versiontest').innerHTML = "Can't check right now, try manually"; + document.getElementById('sysroot').innerHTML = "Latest SysRoot"; + }); + req.done(function(response) { + var VerOnGithub = response[0].name; + var VerLocal = "#BUILD#"; + if (VerLocal.match(/BUILD/)) { + document.getElementById('versiontest').innerHTML = "Seems not to be deployed"; + document.getElementById('sysroot').innerHTML = "Unknown SysRoot"; + jQuery('#sysroot').removeAttr('href'); + } else { + var res = versionCompare(VerLocal, VerOnGithub); + var message; + var sysroot_message; + var j; + var k; + var sysroot_url = null; + for (j = 0; j < response.length; j++) { + if (response[j].name.match(VerLocal+"$")) { + for (k = 0; k < response[j].assets.length; k++) { + if (response[j].assets[k].name.match(/sysroot/i)) { + sysroot_url = response[j].assets[k].browser_download_url; + break; + } + } + break; + } + } + if (res < 0) { + message = "Newer version available online (Version " + VerOnGithub + " )"; + if (sysroot_url) + sysroot_message = "Old Sysroot for firmware " + VerLocal + + " (please upgrade firmware to " + VerOnGithub + ")"; + else + sysroot_message = "No Sysroot for firmware " + VerLocal + + " (please upgrade firmware to " + VerOnGithub + ")"; + document.getElementById('versionsection').className = "download"; + } else if (res > 0) { + message = "Wow! Your Pluto Firmware Version " + VerLocal + + " is newer than (" + VerOnGithub + ") on Github."; + sysroot_message = "Firmware " + VerLocal + " doesn't have pre-built SYSROOT"; + jQuery('#sysroot').removeAttr('href'); + document.getElementById('versionsection').className = ""; + document.getElementById('plutsdr-fw-download').style.visibility = "hidden"; + document.getElementById('hideupgrade').style.display = "none"; + } else if (res == 0) { + message = "Pluto is using the same version as latest release!"; + sysroot_message = "SYSROOT for firmware version " + VerOnGithub; + document.getElementById('versionsection').className = ""; + document.getElementById('plutsdr-fw-download').style.visibility = "hidden"; + document.getElementById('hideupgrade').style.display = "none"; + } else { + message = "Failure in comparing version, latest upstream is " + VerOnGithub; + sysroot_message = "SYSROOT for firmware version " + VerOnGithub; + document.getElementById('versionsection').className = ""; + } + document.getElementById('versiontest').innerHTML = message; + document.getElementById('plutsdr-fw-download').innerHTML = "Download version " + VerOnGithub; + jQuery('#plutsdr-fw-download').attr ('href', response[0].assets[0].browser_download_url); + + document.getElementById('sysroot').innerHTML = sysroot_message; + if(sysroot_url) + jQuery('#sysroot').attr ('href', sysroot_url); + else + jQuery('#sysroot').removeAttr('href'); + } + }); +} + +window.onload = CheckFrmVersion; diff --git a/firmware/ori/board/pluto/msd/runme0.sh b/firmware/ori/board/pluto/msd/runme0.sh new file mode 100755 index 0000000..613ef91 --- /dev/null +++ b/firmware/ori/board/pluto/msd/runme0.sh @@ -0,0 +1,43 @@ +# runme0.sh examples +# uncomment then eject PlutoSDR USB drive to run. + + +### Quick status report, available as txt file on USB mass storage. +#ps > /mnt/msd/status.txt +#echo " " >> /mnt/msd/status.txt +#uptime >> /mnt/msd/status.txt +#echo " " >> /mnt/msd/status.txt +#mount >> /mnt/msd/status.txt + +### Start WBFM stream (Luaradio) + +## Pluto streams audio to 0.0.0.0:4444/TCP. Goto host-scripts to listen radio. +#/root/wbfmradio-stdout 100500000 | /usr/bin/nmux -p 4444 -a 0.0.0.0 & +## or using nc : +#while true; do /root/wbfmradio-stdout 87900000 | /usr/bin/nc -l -p 4444; done & + +## listening on remote computer : +## cvlc tcp://pluto.local:4444 --demux=rawaud --rawaud-channels 1 --rawaud-samplerate 48000 +## or : nc pluto.local 4444 | ffplay -f s16le -ar 48k -ac 1 - +## or using vlc: --demux=rawaud --rawaud-channels 1 --rawaud-samplerate 48000 tcp://pluto.local:4444 + +### Kill WBFM streamer +#killall -9 nmux wbfmradio + +### Send sample picture SSTV +#/root/tx-sstv.sh 434000000 /tmp/send.png.wav + +### Send your own SSTV picture (drag sstv.png picture to USB mass storage, then eject) +#/root/send-sstv.sh 434000000 + +### RTL_433 (use 'telnet pluto.local 1234' on host computer for log) +#/usr/bin/rtl_433 -d driver=plutosdr,uri=local: -l 110 -g 58 -C si | nmux -a 0.0.0.0 -p 1234 & + +### Kill RTL_433 +#killall -9 rtl_433 nmux + +### Send CW message +#/usr/bin/python /root/CW-pluto.py -f 144250000 -w 15 "TEST TEST TEST DE $CALLSIGN $CALLSIGN" + +### Plot 100MHz BW spectrum centered on 900MHz, spacing 50kHz. Resulting plot : http://pluto.local/plot.html +#/root/signal.sh 750 850 50 diff --git a/firmware/ori/board/pluto/overlay/etc/chrony.conf b/firmware/ori/board/pluto/overlay/etc/chrony.conf new file mode 100644 index 0000000..8f36c1f --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/chrony.conf @@ -0,0 +1,10 @@ +server ntp.metas.ch +server swisstime.ethz.ch +server chronos.cru.fr +server ntp.univ-lyon1.fr + +# NTP via GPS +refclock SHM 0 refid NMEA offset 0.000 precision 1e-3 poll 3 +makestep 1 -1 + + diff --git a/firmware/ori/board/pluto/overlay/etc/exports b/firmware/ori/board/pluto/overlay/etc/exports new file mode 100644 index 0000000..870d457 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/exports @@ -0,0 +1,3 @@ +# /mnt/jffs2 192.168.0.0/16(rw,async,insecure,fsid=0,all_squash,anonuid=0,anongid=0,no_subtree_check) +/tmp 192.168.0.0/16(rw,async,insecure,fsid=0,all_squash,anonuid=0,anongid=0,no_subtree_check) + diff --git a/firmware/ori/board/pluto/overlay/etc/hostapd.conf b/firmware/ori/board/pluto/overlay/etc/hostapd.conf new file mode 100644 index 0000000..392839f --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/hostapd.conf @@ -0,0 +1,12 @@ +interface=wlan0 +# Kernel driver; most modern drivers use nl80211 +driver=nl80211 +# The AP "friendly name"; change to anything you like +ssid=PlutoAP +# Use 802.11g, not the glacially-slow b +hw_mode=g +# Arbitrarily choose radio channel from 1, 6, or 11, the only useful 2.4GHz ones +channel=11 + + +#hostapd -B /etc/hostapd.conf diff --git a/firmware/ori/board/pluto/overlay/etc/httpd.conf b/firmware/ori/board/pluto/overlay/etc/httpd.conf new file mode 100644 index 0000000..7e3715f --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/httpd.conf @@ -0,0 +1,2 @@ +*.php:/usr/bin/php-cgi +.svg:image/svg+xml \ No newline at end of file diff --git a/firmware/ori/board/pluto/overlay/etc/init.d/S49chrony b/firmware/ori/board/pluto/overlay/etc/init.d/S49chrony new file mode 100755 index 0000000..f75233f --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/init.d/S49chrony @@ -0,0 +1,26 @@ +#!/bin/sh +# +# Start chrony + +[ -r /etc/default/chrony ] && . /etc/default/chrony + +case "$1" in + start) + printf "Starting chrony: " + chronyd $CHRONY_ARGS && echo "OK" || echo "FAIL" + ;; + stop) + printf "Stopping chrony: " + killall chronyd && echo "OK" || echo "FAIL" + ;; + restart|reload) + "$0" stop + sleep 1 + "$0" start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? diff --git a/firmware/ori/board/pluto/overlay/etc/init.d/S50gpsd b/firmware/ori/board/pluto/overlay/etc/init.d/S50gpsd new file mode 100755 index 0000000..e039866 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/init.d/S50gpsd @@ -0,0 +1,43 @@ +#!/bin/sh +# +# Starts the gps daemon. +# + +NAME=gpsd +DAEMON=/usr/sbin/$NAME +DEVICES="/dev/ttyACM0" +PIDFILE=/var/run/$NAME.pid +GPSD_OPTIONS="-G -n -r" + +start() { + printf "Starting $NAME: " + start-stop-daemon -S -q -p $PIDFILE --exec $DAEMON -- -P $PIDFILE $DEVICES $GPSD_OPTIONS && echo "OK" || echo "Failed" + sleep 3 + gpsctl --nmea +} +stop() { + printf "Stopping $NAME: " + start-stop-daemon -K -q -p $PIDFILE && echo "OK" || echo "Failed" + rm -f $PIDFILE +} +restart() { + stop + start +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + restart + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? diff --git a/firmware/ori/board/pluto/overlay/etc/init.d/S91nfs-mount b/firmware/ori/board/pluto/overlay/etc/init.d/S91nfs-mount new file mode 100755 index 0000000..3e7b7a4 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/init.d/S91nfs-mount @@ -0,0 +1,50 @@ +#!/bin/sh +nfs_server=`fw_printenv -n nfs_server 2> /dev/null` + +start() { + if [[ -n $nfs_server ]] + then + + echo "mounting NFS volume : $nfs_server on /root/remote" + mkdir -p /root/remote + #eval 'mount -t nfs -o defaults,_netdev,bg,vers=3,intr,hard,timeo=50 $nfs_server /root/remote' + mount -t nfs $nfs_server /root/remote + #ex: fw_setenv nfs_server "192.168.2.10:/home/linuxdev/prog" + + else + + echo "Nothing to do" + fi +} + +stop() { + + umount /remote + echo "Stopping NFS" +} + +restart() { + stop + start +} + +# start/stop/restart +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? + + + diff --git a/firmware/ori/board/pluto/overlay/etc/mosquitto/mosquitto.conf b/firmware/ori/board/pluto/overlay/etc/mosquitto/mosquitto.conf new file mode 100644 index 0000000..8d43908 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/mosquitto/mosquitto.conf @@ -0,0 +1,7 @@ +user root +allow_anonymous true +listener 1883 +listener 9001 +protocol websockets + + diff --git a/firmware/ori/board/pluto/overlay/etc/motd b/firmware/ori/board/pluto/overlay/etc/motd new file mode 100644 index 0000000..c75cf33 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/motd @@ -0,0 +1,15 @@ +Welcome to: +______ _ _ ______ ___ _____ _ _ +| ___ \ | | | | _ \/ _ \_ _| | | | +| |_/ / |_ _| |_ ___ | | | / /_\ \| | | | | | +| __/| | | | | __/ _ \| | | | _ || | | | | | +| | | | |_| | || (_) | |/ /| | | || | \ \_/ / +\_| |_|\__,_|\__\___/|___/ \_| |_/\_/ \___/ + + __ __ _ __ _ +|_ \/ |_ |_ / \|_ / \ +|_) / | __)\_/|__\_/ + + +#BUILD# + diff --git a/firmware/ori/board/pluto/overlay/etc/ntp.conf b/firmware/ori/board/pluto/overlay/etc/ntp.conf new file mode 100644 index 0000000..1780676 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/ntp.conf @@ -0,0 +1,11 @@ +server ntp.metas.ch +server swisstime.ethz.ch +server chronos.cru.fr +server ntp.univ-lyon1.fr + +# NTP via GPS +server 127.127.28.0 +fudge 127.127.28.0 time1 0.183 flag1 1 refid GPS +server 127.127.28.1 minpoll 4 prefer +fudge 127.127.28.1 refid PPS +tinker panic 0 diff --git a/firmware/ori/board/pluto/overlay/etc/olsrd/olsrd.conf b/firmware/ori/board/pluto/overlay/etc/olsrd/olsrd.conf new file mode 100644 index 0000000..6f9356b --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/olsrd/olsrd.conf @@ -0,0 +1,22 @@ +LinkQualityFishEye 0 +AllowNoInt yes + +Interface "eth0" +{ +} + +Interface "gse0" +{ +} + +Interface "usb0" +{ +} + + +# This is only here to be able to generate a +# configuration file with the script +LoadPlugin "/usr/lib/olsrd_jsoninfo.so.1.1" +{ + PlParam "port" "56789" +} diff --git a/firmware/ori/board/pluto/overlay/etc/opkg/opkg.conf b/firmware/ori/board/pluto/overlay/etc/opkg/opkg.conf new file mode 100644 index 0000000..ac9f1e9 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/opkg/opkg.conf @@ -0,0 +1,3 @@ +dest root / +src web http://www.lamableu.net/pluto/ipk + diff --git a/firmware/ori/board/pluto/overlay/etc/php.ini b/firmware/ori/board/pluto/overlay/etc/php.ini new file mode 100755 index 0000000..4643452 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/php.ini @@ -0,0 +1,1914 @@ +[PHP] + +;;;;;;;;;;;;;;;;;;; +; About php.ini ; +;;;;;;;;;;;;;;;;;;; +; PHP's initialization file, generally called php.ini, is responsible for +; configuring many of the aspects of PHP's behavior. + +; PHP attempts to find and load this configuration from a number of locations. +; The following is a summary of its search order: +; 1. SAPI module specific location. +; 2. The PHPRC environment variable. (As of PHP 5.2.0) +; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0) +; 4. Current working directory (except CLI) +; 5. The web server's directory (for SAPI modules), or directory of PHP +; (otherwise in Windows) +; 6. The directory from the --with-config-file-path compile time option, or the +; Windows directory (C:\windows or C:\winnt) +; See the PHP docs for more specific information. +; http://php.net/configuration.file + +; The syntax of the file is extremely simple. Whitespace and lines +; beginning with a semicolon are silently ignored (as you probably guessed). +; Section headers (e.g. [Foo]) are also silently ignored, even though +; they might mean something in the future. + +; Directives following the section heading [PATH=/www/mysite] only +; apply to PHP files in the /www/mysite directory. Directives +; following the section heading [HOST=www.example.com] only apply to +; PHP files served from www.example.com. Directives set in these +; special sections cannot be overridden by user-defined INI files or +; at runtime. Currently, [PATH=] and [HOST=] sections only work under +; CGI/FastCGI. +; http://php.net/ini.sections + +; Directives are specified using the following syntax: +; directive = value +; Directive names are *case sensitive* - foo=bar is different from FOO=bar. +; Directives are variables used to configure PHP or PHP extensions. +; There is no name validation. If PHP can't find an expected +; directive because it is not set or is mistyped, a default value will be used. + +; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one +; of the INI constants (On, Off, True, False, Yes, No and None) or an expression +; (e.g. E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a +; previously set variable or directive (e.g. ${foo}) + +; Expressions in the INI file are limited to bitwise operators and parentheses: +; | bitwise OR +; ^ bitwise XOR +; & bitwise AND +; ~ bitwise NOT +; ! boolean NOT + +; Boolean flags can be turned on using the values 1, On, True or Yes. +; They can be turned off using the values 0, Off, False or No. + +; An empty string can be denoted by simply not writing anything after the equal +; sign, or by using the None keyword: + +; foo = ; sets foo to an empty string +; foo = None ; sets foo to an empty string +; foo = "None" ; sets foo to the string 'None' + +; If you use constants in your value, and these constants belong to a +; dynamically loaded extension (either a PHP extension or a Zend extension), +; you may only use these constants *after* the line that loads the extension. + +;;;;;;;;;;;;;;;;;;; +; About this file ; +;;;;;;;;;;;;;;;;;;; +; PHP comes packaged with two INI files. One that is recommended to be used +; in production environments and one that is recommended to be used in +; development environments. + +; php.ini-production contains settings which hold security, performance and +; best practices at its core. But please be aware, these settings may break +; compatibility with older or less security conscience applications. We +; recommending using the production ini in production and testing environments. + +; php.ini-development is very similar to its production variant, except it is +; much more verbose when it comes to errors. We recommend using the +; development version only in development environments, as errors shown to +; application users can inadvertently leak otherwise secure information. + +; This is php.ini-production INI file. + +;;;;;;;;;;;;;;;;;;; +; Quick Reference ; +;;;;;;;;;;;;;;;;;;; +; The following are all the settings which are different in either the production +; or development versions of the INIs with respect to PHP's default behavior. +; Please see the actual settings later in the document for more details as to why +; we recommend these changes in PHP's behavior. + +; display_errors +; Default Value: On +; Development Value: On +; Production Value: Off + +; display_startup_errors +; Default Value: Off +; Development Value: On +; Production Value: Off + +; error_reporting +; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED +; Development Value: E_ALL +; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT + +; html_errors +; Default Value: On +; Development Value: On +; Production value: On + +; log_errors +; Default Value: Off +; Development Value: On +; Production Value: On + +; max_input_time +; Default Value: -1 (Unlimited) +; Development Value: 60 (60 seconds) +; Production Value: 60 (60 seconds) + +; output_buffering +; Default Value: Off +; Development Value: 4096 +; Production Value: 4096 + +; register_argc_argv +; Default Value: On +; Development Value: Off +; Production Value: Off + +; request_order +; Default Value: None +; Development Value: "GP" +; Production Value: "GP" + +; session.gc_divisor +; Default Value: 100 +; Development Value: 1000 +; Production Value: 1000 + +; session.sid_bits_per_character +; Default Value: 4 +; Development Value: 5 +; Production Value: 5 + +; short_open_tag +; Default Value: On +; Development Value: Off +; Production Value: Off + +; track_errors +; Default Value: Off +; Development Value: On +; Production Value: Off + +; variables_order +; Default Value: "EGPCS" +; Development Value: "GPCS" +; Production Value: "GPCS" + +;;;;;;;;;;;;;;;;;;;; +; php.ini Options ; +;;;;;;;;;;;;;;;;;;;; +; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini" +;user_ini.filename = ".user.ini" + +; To disable this feature set this option to empty value +;user_ini.filename = + +; TTL for user-defined php.ini files (time-to-live) in seconds. Default is 300 seconds (5 minutes) +;user_ini.cache_ttl = 300 + +;;;;;;;;;;;;;;;;;;;; +; Language Options ; +;;;;;;;;;;;;;;;;;;;; + +; Enable the PHP scripting language engine under Apache. +; http://php.net/engine +engine = On + +; This directive determines whether or not PHP will recognize code between +; tags as PHP source which should be processed as such. It is +; generally recommended that should be used and that this feature +; should be disabled, as enabling it may result in issues when generating XML +; documents, however this remains supported for backward compatibility reasons. +; Note that this directive does not control the would work. +; http://php.net/syntax-highlighting +;highlight.string = #DD0000 +;highlight.comment = #FF9900 +;highlight.keyword = #007700 +;highlight.default = #0000BB +;highlight.html = #000000 + +; If enabled, the request will be allowed to complete even if the user aborts +; the request. Consider enabling it if executing long requests, which may end up +; being interrupted by the user or a browser timing out. PHP's default behavior +; is to disable this feature. +; http://php.net/ignore-user-abort +;ignore_user_abort = On + +; Determines the size of the realpath cache to be used by PHP. This value should +; be increased on systems where PHP opens many files to reflect the quantity of +; the file operations performed. +; http://php.net/realpath-cache-size +;realpath_cache_size = 4096k + +; Duration of time, in seconds for which to cache realpath information for a given +; file or directory. For systems with rarely changing files, consider increasing this +; value. +; http://php.net/realpath-cache-ttl +;realpath_cache_ttl = 120 + +; Enables or disables the circular reference collector. +; http://php.net/zend.enable-gc +zend.enable_gc = On + +; If enabled, scripts may be written in encodings that are incompatible with +; the scanner. CP936, Big5, CP949 and Shift_JIS are the examples of such +; encodings. To use this feature, mbstring extension must be enabled. +; Default: Off +;zend.multibyte = Off + +; Allows to set the default encoding for the scripts. This value will be used +; unless "declare(encoding=...)" directive appears at the top of the script. +; Only affects if zend.multibyte is set. +; Default: "" +;zend.script_encoding = + +;;;;;;;;;;;;;;;;; +; Miscellaneous ; +;;;;;;;;;;;;;;;;; + +; Decides whether PHP may expose the fact that it is installed on the server +; (e.g. by adding its signature to the Web server header). It is no security +; threat in any way, but it makes it possible to determine whether you use PHP +; on your server or not. +; http://php.net/expose-php +expose_php = On + +;;;;;;;;;;;;;;;;;;; +; Resource Limits ; +;;;;;;;;;;;;;;;;;;; + +; Maximum execution time of each script, in seconds +; http://php.net/max-execution-time +; Note: This directive is hardcoded to 0 for the CLI SAPI +max_execution_time = 90 + +; Maximum amount of time each script may spend parsing request data. It's a good +; idea to limit this time on productions servers in order to eliminate unexpectedly +; long running scripts. +; Note: This directive is hardcoded to -1 for the CLI SAPI +; Default Value: -1 (Unlimited) +; Development Value: 60 (60 seconds) +; Production Value: 60 (60 seconds) +; http://php.net/max-input-time +max_input_time = 120 + +; Maximum input variable nesting level +; http://php.net/max-input-nesting-level +;max_input_nesting_level = 64 + +; How many GET/POST/COOKIE input variables may be accepted +; max_input_vars = 1000 + +; Maximum amount of memory a script may consume (128MB) +; http://php.net/memory-limit +memory_limit = 128M + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Error handling and logging ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; This directive informs PHP of which errors, warnings and notices you would like +; it to take action for. The recommended way of setting values for this +; directive is through the use of the error level constants and bitwise +; operators. The error level constants are below here for convenience as well as +; some common settings and their meanings. +; By default, PHP is set to take action on all errors, notices and warnings EXCEPT +; those related to E_NOTICE and E_STRICT, which together cover best practices and +; recommended coding standards in PHP. For performance reasons, this is the +; recommend error reporting setting. Your production server shouldn't be wasting +; resources complaining about best practices and coding standards. That's what +; development servers and development settings are for. +; Note: The php.ini-development file has this setting as E_ALL. This +; means it pretty much reports everything which is exactly what you want during +; development and early testing. +; +; Error Level Constants: +; E_ALL - All errors and warnings (includes E_STRICT as of PHP 5.4.0) +; E_ERROR - fatal run-time errors +; E_RECOVERABLE_ERROR - almost fatal run-time errors +; E_WARNING - run-time warnings (non-fatal errors) +; E_PARSE - compile-time parse errors +; E_NOTICE - run-time notices (these are warnings which often result +; from a bug in your code, but it's possible that it was +; intentional (e.g., using an uninitialized variable and +; relying on the fact it is automatically initialized to an +; empty string) +; E_STRICT - run-time notices, enable to have PHP suggest changes +; to your code which will ensure the best interoperability +; and forward compatibility of your code +; E_CORE_ERROR - fatal errors that occur during PHP's initial startup +; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's +; initial startup +; E_COMPILE_ERROR - fatal compile-time errors +; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) +; E_USER_ERROR - user-generated error message +; E_USER_WARNING - user-generated warning message +; E_USER_NOTICE - user-generated notice message +; E_DEPRECATED - warn about code that will not work in future versions +; of PHP +; E_USER_DEPRECATED - user-generated deprecation warnings +; +; Common Values: +; E_ALL (Show all errors, warnings and notices including coding standards.) +; E_ALL & ~E_NOTICE (Show all errors, except for notices) +; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.) +; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) +; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED +; Development Value: E_ALL +; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT +; http://php.net/error-reporting +error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT + +; This directive controls whether or not and where PHP will output errors, +; notices and warnings too. Error output is very useful during development, but +; it could be very dangerous in production environments. Depending on the code +; which is triggering the error, sensitive information could potentially leak +; out of your application such as database usernames and passwords or worse. +; For production environments, we recommend logging errors rather than +; sending them to STDOUT. +; Possible Values: +; Off = Do not display any errors +; stderr = Display errors to STDERR (affects only CGI/CLI binaries!) +; On or stdout = Display errors to STDOUT +; Default Value: On +; Development Value: On +; Production Value: Off +; http://php.net/display-errors +display_errors = Off + +; The display of errors which occur during PHP's startup sequence are handled +; separately from display_errors. PHP's default behavior is to suppress those +; errors from clients. Turning the display of startup errors on can be useful in +; debugging configuration problems. We strongly recommend you +; set this to 'off' for production servers. +; Default Value: Off +; Development Value: On +; Production Value: Off +; http://php.net/display-startup-errors +display_startup_errors = Off + +; Besides displaying errors, PHP can also log errors to locations such as a +; server-specific log, STDERR, or a location specified by the error_log +; directive found below. While errors should not be displayed on productions +; servers they should still be monitored and logging is a great way to do that. +; Default Value: Off +; Development Value: On +; Production Value: On +; http://php.net/log-errors +log_errors = On + +; Set maximum length of log_errors. In error_log information about the source is +; added. The default is 1024 and 0 allows to not apply any maximum length at all. +; http://php.net/log-errors-max-len +log_errors_max_len = 1024 + +; Do not log repeated messages. Repeated errors must occur in same file on same +; line unless ignore_repeated_source is set true. +; http://php.net/ignore-repeated-errors +ignore_repeated_errors = Off + +; Ignore source of message when ignoring repeated messages. When this setting +; is On you will not log errors with repeated messages from different files or +; source lines. +; http://php.net/ignore-repeated-source +ignore_repeated_source = Off + +; If this parameter is set to Off, then memory leaks will not be shown (on +; stdout or in the log). This has only effect in a debug compile, and if +; error reporting includes E_WARNING in the allowed list +; http://php.net/report-memleaks +report_memleaks = On + +; This setting is on by default. +;report_zend_debug = 0 + +; Store the last error/warning message in $php_errormsg (boolean). Setting this value +; to On can assist in debugging and is appropriate for development servers. It should +; however be disabled on production servers. +; This directive is DEPRECATED. +; Default Value: Off +; Development Value: Off +; Production Value: Off +; http://php.net/track-errors +;track_errors = Off + +; Turn off normal error reporting and emit XML-RPC error XML +; http://php.net/xmlrpc-errors +;xmlrpc_errors = 0 + +; An XML-RPC faultCode +;xmlrpc_error_number = 0 + +; When PHP displays or logs an error, it has the capability of formatting the +; error message as HTML for easier reading. This directive controls whether +; the error message is formatted as HTML or not. +; Note: This directive is hardcoded to Off for the CLI SAPI +; Default Value: On +; Development Value: On +; Production value: On +; http://php.net/html-errors +html_errors = On + +; If html_errors is set to On *and* docref_root is not empty, then PHP +; produces clickable error messages that direct to a page describing the error +; or function causing the error in detail. +; You can download a copy of the PHP manual from http://php.net/docs +; and change docref_root to the base URL of your local copy including the +; leading '/'. You must also specify the file extension being used including +; the dot. PHP's default behavior is to leave these settings empty, in which +; case no links to documentation are generated. +; Note: Never use this feature for production boxes. +; http://php.net/docref-root +; Examples +;docref_root = "/phpmanual/" + +; http://php.net/docref-ext +;docref_ext = .html + +; String to output before an error message. PHP's default behavior is to leave +; this setting blank. +; http://php.net/error-prepend-string +; Example: +;error_prepend_string = "" + +; String to output after an error message. PHP's default behavior is to leave +; this setting blank. +; http://php.net/error-append-string +; Example: +;error_append_string = "" + +; Log errors to specified file. PHP's default behavior is to leave this value +; empty. +; http://php.net/error-log +; Example: +;error_log = php_errors.log +; Log errors to syslog (Event Log on Windows). +;error_log = syslog + +;windows.show_crt_warning +; Default value: 0 +; Development value: 0 +; Production value: 0 + +;;;;;;;;;;;;;;;;; +; Data Handling ; +;;;;;;;;;;;;;;;;; + +; The separator used in PHP generated URLs to separate arguments. +; PHP's default setting is "&". +; http://php.net/arg-separator.output +; Example: +;arg_separator.output = "&" + +; List of separator(s) used by PHP to parse input URLs into variables. +; PHP's default setting is "&". +; NOTE: Every character in this directive is considered as separator! +; http://php.net/arg-separator.input +; Example: +;arg_separator.input = ";&" + +; This directive determines which super global arrays are registered when PHP +; starts up. G,P,C,E & S are abbreviations for the following respective super +; globals: GET, POST, COOKIE, ENV and SERVER. There is a performance penalty +; paid for the registration of these arrays and because ENV is not as commonly +; used as the others, ENV is not recommended on productions servers. You +; can still get access to the environment variables through getenv() should you +; need to. +; Default Value: "EGPCS" +; Development Value: "GPCS" +; Production Value: "GPCS"; +; http://php.net/variables-order +variables_order = "GPCS" + +; This directive determines which super global data (G,P & C) should be +; registered into the super global array REQUEST. If so, it also determines +; the order in which that data is registered. The values for this directive +; are specified in the same manner as the variables_order directive, +; EXCEPT one. Leaving this value empty will cause PHP to use the value set +; in the variables_order directive. It does not mean it will leave the super +; globals array REQUEST empty. +; Default Value: None +; Development Value: "GP" +; Production Value: "GP" +; http://php.net/request-order +request_order = "GP" + +; This directive determines whether PHP registers $argv & $argc each time it +; runs. $argv contains an array of all the arguments passed to PHP when a script +; is invoked. $argc contains an integer representing the number of arguments +; that were passed when the script was invoked. These arrays are extremely +; useful when running scripts from the command line. When this directive is +; enabled, registering these variables consumes CPU cycles and memory each time +; a script is executed. For performance reasons, this feature should be disabled +; on production servers. +; Note: This directive is hardcoded to On for the CLI SAPI +; Default Value: On +; Development Value: Off +; Production Value: Off +; http://php.net/register-argc-argv +register_argc_argv = On + +; When enabled, the ENV, REQUEST and SERVER variables are created when they're +; first used (Just In Time) instead of when the script starts. If these +; variables are not used within a script, having this directive on will result +; in a performance gain. The PHP directive register_argc_argv must be disabled +; for this directive to have any affect. +; http://php.net/auto-globals-jit +auto_globals_jit = On + +; Whether PHP will read the POST data. +; This option is enabled by default. +; Most likely, you won't want to disable this option globally. It causes $_POST +; and $_FILES to always be empty; the only way you will be able to read the +; POST data will be through the php://input stream wrapper. This can be useful +; to proxy requests or to process the POST data in a memory efficient fashion. +; http://php.net/enable-post-data-reading +;enable_post_data_reading = Off + +; Maximum size of POST data that PHP will accept. +; Its value may be 0 to disable the limit. It is ignored if POST data reading +; is disabled through enable_post_data_reading. +; http://php.net/post-max-size +post_max_size = 30M + +; Automatically add files before PHP document. +; http://php.net/auto-prepend-file +auto_prepend_file = + +; Automatically add files after PHP document. +; http://php.net/auto-append-file +auto_append_file = + +; By default, PHP will output a media type using the Content-Type header. To +; disable this, simply set it to be empty. +; +; PHP's built-in default media type is set to text/html. +; http://php.net/default-mimetype +default_mimetype = "text/html" + +; PHP's default character set is set to UTF-8. +; http://php.net/default-charset +default_charset = "UTF-8" + +; PHP internal character encoding is set to empty. +; If empty, default_charset is used. +; http://php.net/internal-encoding +;internal_encoding = + +; PHP input character encoding is set to empty. +; If empty, default_charset is used. +; http://php.net/input-encoding +;input_encoding = + +; PHP output character encoding is set to empty. +; If empty, default_charset is used. +; See also output_buffer. +; http://php.net/output-encoding +;output_encoding = + +;;;;;;;;;;;;;;;;;;;;;;;;; +; Paths and Directories ; +;;;;;;;;;;;;;;;;;;;;;;;;; + +; UNIX: "/path1:/path2" +;include_path = ".:/php/includes" +; +; Windows: "\path1;\path2" +;include_path = ".;c:\php\includes" +; +; PHP's default setting for include_path is ".;/path/to/php/pear" +; http://php.net/include-path + +; The root of the PHP pages, used only if nonempty. +; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root +; if you are running php as a CGI under any web server (other than IIS) +; see documentation for security issues. The alternate is to use the +; cgi.force_redirect configuration below +; http://php.net/doc-root +doc_root = + +; The directory under which PHP opens the script using /~username used only +; if nonempty. +; http://php.net/user-dir +user_dir = + +; Directory in which the loadable extensions (modules) reside. +; http://php.net/extension-dir +; extension_dir = "./" +; On windows: +; extension_dir = "ext" + +; Directory where the temporary files should be placed. +; Defaults to the system default (see sys_get_temp_dir) +; sys_temp_dir = "/tmp" + +; Whether or not to enable the dl() function. The dl() function does NOT work +; properly in multithreaded servers, such as IIS or Zeus, and is automatically +; disabled on them. +; http://php.net/enable-dl +enable_dl = Off + +; cgi.force_redirect is necessary to provide security running PHP as a CGI under +; most web servers. Left undefined, PHP turns this on by default. You can +; turn it off here AT YOUR OWN RISK +; **You CAN safely turn this off for IIS, in fact, you MUST.** +; http://php.net/cgi.force-redirect +cgi.force_redirect = 0 + +; if cgi.nph is enabled it will force cgi to always sent Status: 200 with +; every request. PHP's default behavior is to disable this feature. +;cgi.nph = 1 + +; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape +; (iPlanet) web servers, you MAY need to set an environment variable name that PHP +; will look for to know it is OK to continue execution. Setting this variable MAY +; cause security issues, KNOW WHAT YOU ARE DOING FIRST. +; http://php.net/cgi.redirect-status-env +;cgi.redirect_status_env = + +; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's +; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok +; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting +; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting +; of zero causes PHP to behave as before. Default is 1. You should fix your scripts +; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. +; http://php.net/cgi.fix-pathinfo +;cgi.fix_pathinfo=1 + +; if cgi.discard_path is enabled, the PHP CGI binary can safely be placed outside +; of the web tree and people will not be able to circumvent .htaccess security. +; http://php.net/cgi.dicard-path +;cgi.discard_path=1 + +; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate +; security tokens of the calling client. This allows IIS to define the +; security context that the request runs under. mod_fastcgi under Apache +; does not currently support this feature (03/17/2002) +; Set to 1 if running under IIS. Default is zero. +; http://php.net/fastcgi.impersonate +;fastcgi.impersonate = 1 + +; Disable logging through FastCGI connection. PHP's default behavior is to enable +; this feature. +;fastcgi.logging = 0 + +; cgi.rfc2616_headers configuration option tells PHP what type of headers to +; use when sending HTTP response code. If set to 0, PHP sends Status: header that +; is supported by Apache. When this option is set to 1, PHP will send +; RFC2616 compliant header. +; Default is zero. +; http://php.net/cgi.rfc2616-headers +;cgi.rfc2616_headers = 0 + +; cgi.check_shebang_line controls whether CGI PHP checks for line starting with #! +; (shebang) at the top of the running script. This line might be needed if the +; script support running both as stand-alone script and via PHP CGI<. PHP in CGI +; mode skips this line and ignores its content if this directive is turned on. +; http://php.net/cgi.check-shebang-line +;cgi.check_shebang_line=1 + +;;;;;;;;;;;;;;;; +; File Uploads ; +;;;;;;;;;;;;;;;; + +; Whether to allow HTTP file uploads. +; http://php.net/file-uploads +file_uploads = On + +; Temporary directory for HTTP uploaded files (will use system default if not +; specified). +; http://php.net/upload-tmp-dir +upload_tmp_dir = /root/ + +; Maximum allowed size for uploaded files. +; http://php.net/upload-max-filesize +upload_max_filesize = 30M + +; Maximum number of files that can be uploaded via a single request +max_file_uploads = 20 + +;;;;;;;;;;;;;;;;;; +; Fopen wrappers ; +;;;;;;;;;;;;;;;;;; + +; Whether to allow the treatment of URLs (like http:// or ftp://) as files. +; http://php.net/allow-url-fopen +allow_url_fopen = On + +; Whether to allow include/require to open URLs (like http:// or ftp://) as files. +; http://php.net/allow-url-include +allow_url_include = Off + +; Define the anonymous ftp password (your email address). PHP's default setting +; for this is empty. +; http://php.net/from +;from="john@doe.com" + +; Define the User-Agent string. PHP's default setting for this is empty. +; http://php.net/user-agent +;user_agent="PHP" + +; Default timeout for socket based streams (seconds) +; http://php.net/default-socket-timeout +default_socket_timeout = 60 + +; If your scripts have to deal with files from Macintosh systems, +; or you are running on a Mac and need to deal with files from +; unix or win32 systems, setting this flag will cause PHP to +; automatically detect the EOL character in those files so that +; fgets() and file() will work regardless of the source of the file. +; http://php.net/auto-detect-line-endings +;auto_detect_line_endings = Off + +;;;;;;;;;;;;;;;;;;;;;; +; Dynamic Extensions ; +;;;;;;;;;;;;;;;;;;;;;; + +; If you wish to have an extension loaded automatically, use the following +; syntax: +; +; extension=modulename +; +; For example: +; +; extension=mysqli +; +; When the extension library to load is not located in the default extension +; directory, You may specify an absolute path to the library file: +; +; extension=/path/to/extension/mysqli.so +; +; Note : The syntax used in previous PHP versions ('extension=.so' and +; 'extension='php_.dll') is supported for legacy reasons and may be +; deprecated in a future PHP major version. So, when it is possible, please +; move to the new ('extension=) syntax. +; +; Notes for Windows environments : +; +; - ODBC support is built in, so no dll is needed for it. +; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+) +; extension folders as well as the separate PECL DLL download (PHP 5+). +; Be sure to appropriately set the extension_dir directive. +; +;extension=bz2 +;extension=curl +;extension=fileinfo +;extension=gd2 +;extension=gettext +;extension=gmp +;extension=intl +;extension=imap +;extension=interbase +;extension=ldap +;extension=mbstring +;extension=exif ; Must be after mbstring as it depends on it +;extension=mysqli +;extension=oci8_12c ; Use with Oracle Database 12c Instant Client +;extension=openssl +;extension=pdo_firebird +;extension=pdo_mysql +;extension=pdo_oci +;extension=pdo_odbc +;extension=pdo_pgsql +;extension=pdo_sqlite +;extension=pgsql +;extension=shmop + +; The MIBS data available in the PHP distribution must be installed. +; See http://www.php.net/manual/en/snmp.installation.php +;extension=snmp + +;extension=soap +;extension=sockets +;extension=sqlite3 +;extension=tidy +;extension=xmlrpc +;extension=xsl + +;;;;;;;;;;;;;;;;;;; +; Module Settings ; +;;;;;;;;;;;;;;;;;;; + +[CLI Server] +; Whether the CLI web server uses ANSI color coding in its terminal output. +cli_server.color = On + +[Date] +; Defines the default timezone used by the date functions +; http://php.net/date.timezone +date.timezone = UTC + +; http://php.net/date.default-latitude +;date.default_latitude = 31.7667 + +; http://php.net/date.default-longitude +;date.default_longitude = 35.2333 + +; http://php.net/date.sunrise-zenith +;date.sunrise_zenith = 90.583333 + +; http://php.net/date.sunset-zenith +;date.sunset_zenith = 90.583333 + +[filter] +; http://php.net/filter.default +;filter.default = unsafe_raw + +; http://php.net/filter.default-flags +;filter.default_flags = + +[iconv] +; Use of this INI entry is deprecated, use global input_encoding instead. +; If empty, default_charset or input_encoding or iconv.input_encoding is used. +; The precedence is: default_charset < intput_encoding < iconv.input_encoding +;iconv.input_encoding = + +; Use of this INI entry is deprecated, use global internal_encoding instead. +; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. +; The precedence is: default_charset < internal_encoding < iconv.internal_encoding +;iconv.internal_encoding = + +; Use of this INI entry is deprecated, use global output_encoding instead. +; If empty, default_charset or output_encoding or iconv.output_encoding is used. +; The precedence is: default_charset < output_encoding < iconv.output_encoding +; To use an output encoding conversion, iconv's output handler must be set +; otherwise output encoding conversion cannot be performed. +;iconv.output_encoding = + +[intl] +;intl.default_locale = +; This directive allows you to produce PHP errors when some error +; happens within intl functions. The value is the level of the error produced. +; Default is 0, which does not produce any errors. +;intl.error_level = E_WARNING +;intl.use_exceptions = 0 + +[sqlite3] +;sqlite3.extension_dir = + +[Pcre] +;PCRE library backtracking limit. +; http://php.net/pcre.backtrack-limit +;pcre.backtrack_limit=100000 + +;PCRE library recursion limit. +;Please note that if you set this value to a high number you may consume all +;the available process stack and eventually crash PHP (due to reaching the +;stack size limit imposed by the Operating System). +; http://php.net/pcre.recursion-limit +;pcre.recursion_limit=100000 + +;Enables or disables JIT compilation of patterns. This requires the PCRE +;library to be compiled with JIT support. +;pcre.jit=1 + +[Pdo] +; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off" +; http://php.net/pdo-odbc.connection-pooling +;pdo_odbc.connection_pooling=strict + +;pdo_odbc.db2_instance_name + +[Pdo_mysql] +; If mysqlnd is used: Number of cache slots for the internal result set cache +; http://php.net/pdo_mysql.cache_size +pdo_mysql.cache_size = 2000 + +; Default socket name for local MySQL connects. If empty, uses the built-in +; MySQL defaults. +; http://php.net/pdo_mysql.default-socket +pdo_mysql.default_socket= + +[Phar] +; http://php.net/phar.readonly +;phar.readonly = On + +; http://php.net/phar.require-hash +;phar.require_hash = On + +;phar.cache_list = + +[mail function] +; For Win32 only. +; http://php.net/smtp +SMTP = localhost +; http://php.net/smtp-port +smtp_port = 25 + +; For Win32 only. +; http://php.net/sendmail-from +;sendmail_from = me@example.com + +; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). +; http://php.net/sendmail-path +;sendmail_path = + +; Force the addition of the specified parameters to be passed as extra parameters +; to the sendmail binary. These parameters will always replace the value of +; the 5th parameter to mail(). +;mail.force_extra_parameters = + +; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename +mail.add_x_header = On + +; The path to a log file that will log all mail() calls. Log entries include +; the full path of the script, line number, To address and headers. +;mail.log = +; Log mail to syslog (Event Log on Windows). +;mail.log = syslog + +[ODBC] +; http://php.net/odbc.default-db +;odbc.default_db = Not yet implemented + +; http://php.net/odbc.default-user +;odbc.default_user = Not yet implemented + +; http://php.net/odbc.default-pw +;odbc.default_pw = Not yet implemented + +; Controls the ODBC cursor model. +; Default: SQL_CURSOR_STATIC (default). +;odbc.default_cursortype + +; Allow or prevent persistent links. +; http://php.net/odbc.allow-persistent +odbc.allow_persistent = On + +; Check that a connection is still valid before reuse. +; http://php.net/odbc.check-persistent +odbc.check_persistent = On + +; Maximum number of persistent links. -1 means no limit. +; http://php.net/odbc.max-persistent +odbc.max_persistent = -1 + +; Maximum number of links (persistent + non-persistent). -1 means no limit. +; http://php.net/odbc.max-links +odbc.max_links = -1 + +; Handling of LONG fields. Returns number of bytes to variables. 0 means +; passthru. +; http://php.net/odbc.defaultlrl +odbc.defaultlrl = 4096 + +; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char. +; See the documentation on odbc_binmode and odbc_longreadlen for an explanation +; of odbc.defaultlrl and odbc.defaultbinmode +; http://php.net/odbc.defaultbinmode +odbc.defaultbinmode = 1 + +;birdstep.max_links = -1 + +[Interbase] +; Allow or prevent persistent links. +ibase.allow_persistent = 1 + +; Maximum number of persistent links. -1 means no limit. +ibase.max_persistent = -1 + +; Maximum number of links (persistent + non-persistent). -1 means no limit. +ibase.max_links = -1 + +; Default database name for ibase_connect(). +;ibase.default_db = + +; Default username for ibase_connect(). +;ibase.default_user = + +; Default password for ibase_connect(). +;ibase.default_password = + +; Default charset for ibase_connect(). +;ibase.default_charset = + +; Default timestamp format. +ibase.timestampformat = "%Y-%m-%d %H:%M:%S" + +; Default date format. +ibase.dateformat = "%Y-%m-%d" + +; Default time format. +ibase.timeformat = "%H:%M:%S" + +[MySQLi] + +; Maximum number of persistent links. -1 means no limit. +; http://php.net/mysqli.max-persistent +mysqli.max_persistent = -1 + +; Allow accessing, from PHP's perspective, local files with LOAD DATA statements +; http://php.net/mysqli.allow_local_infile +;mysqli.allow_local_infile = On + +; Allow or prevent persistent links. +; http://php.net/mysqli.allow-persistent +mysqli.allow_persistent = On + +; Maximum number of links. -1 means no limit. +; http://php.net/mysqli.max-links +mysqli.max_links = -1 + +; If mysqlnd is used: Number of cache slots for the internal result set cache +; http://php.net/mysqli.cache_size +mysqli.cache_size = 2000 + +; Default port number for mysqli_connect(). If unset, mysqli_connect() will use +; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the +; compile-time value defined MYSQL_PORT (in that order). Win32 will only look +; at MYSQL_PORT. +; http://php.net/mysqli.default-port +mysqli.default_port = 3306 + +; Default socket name for local MySQL connects. If empty, uses the built-in +; MySQL defaults. +; http://php.net/mysqli.default-socket +mysqli.default_socket = + +; Default host for mysql_connect() (doesn't apply in safe mode). +; http://php.net/mysqli.default-host +mysqli.default_host = + +; Default user for mysql_connect() (doesn't apply in safe mode). +; http://php.net/mysqli.default-user +mysqli.default_user = + +; Default password for mysqli_connect() (doesn't apply in safe mode). +; Note that this is generally a *bad* idea to store passwords in this file. +; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw") +; and reveal this password! And of course, any users with read access to this +; file will be able to reveal the password as well. +; http://php.net/mysqli.default-pw +mysqli.default_pw = + +; Allow or prevent reconnect +mysqli.reconnect = Off + +[mysqlnd] +; Enable / Disable collection of general statistics by mysqlnd which can be +; used to tune and monitor MySQL operations. +; http://php.net/mysqlnd.collect_statistics +mysqlnd.collect_statistics = On + +; Enable / Disable collection of memory usage statistics by mysqlnd which can be +; used to tune and monitor MySQL operations. +; http://php.net/mysqlnd.collect_memory_statistics +mysqlnd.collect_memory_statistics = Off + +; Records communication from all extensions using mysqlnd to the specified log +; file. +; http://php.net/mysqlnd.debug +;mysqlnd.debug = + +; Defines which queries will be logged. +; http://php.net/mysqlnd.log_mask +;mysqlnd.log_mask = 0 + +; Default size of the mysqlnd memory pool, which is used by result sets. +; http://php.net/mysqlnd.mempool_default_size +;mysqlnd.mempool_default_size = 16000 + +; Size of a pre-allocated buffer used when sending commands to MySQL in bytes. +; http://php.net/mysqlnd.net_cmd_buffer_size +;mysqlnd.net_cmd_buffer_size = 2048 + +; Size of a pre-allocated buffer used for reading data sent by the server in +; bytes. +; http://php.net/mysqlnd.net_read_buffer_size +;mysqlnd.net_read_buffer_size = 32768 + +; Timeout for network requests in seconds. +; http://php.net/mysqlnd.net_read_timeout +;mysqlnd.net_read_timeout = 31536000 + +; SHA-256 Authentication Plugin related. File with the MySQL server public RSA +; key. +; http://php.net/mysqlnd.sha256_server_public_key +;mysqlnd.sha256_server_public_key = + +[OCI8] + +; Connection: Enables privileged connections using external +; credentials (OCI_SYSOPER, OCI_SYSDBA) +; http://php.net/oci8.privileged-connect +;oci8.privileged_connect = Off + +; Connection: The maximum number of persistent OCI8 connections per +; process. Using -1 means no limit. +; http://php.net/oci8.max-persistent +;oci8.max_persistent = -1 + +; Connection: The maximum number of seconds a process is allowed to +; maintain an idle persistent connection. Using -1 means idle +; persistent connections will be maintained forever. +; http://php.net/oci8.persistent-timeout +;oci8.persistent_timeout = -1 + +; Connection: The number of seconds that must pass before issuing a +; ping during oci_pconnect() to check the connection validity. When +; set to 0, each oci_pconnect() will cause a ping. Using -1 disables +; pings completely. +; http://php.net/oci8.ping-interval +;oci8.ping_interval = 60 + +; Connection: Set this to a user chosen connection class to be used +; for all pooled server requests with Oracle 11g Database Resident +; Connection Pooling (DRCP). To use DRCP, this value should be set to +; the same string for all web servers running the same application, +; the database pool must be configured, and the connection string must +; specify to use a pooled server. +;oci8.connection_class = + +; High Availability: Using On lets PHP receive Fast Application +; Notification (FAN) events generated when a database node fails. The +; database must also be configured to post FAN events. +;oci8.events = Off + +; Tuning: This option enables statement caching, and specifies how +; many statements to cache. Using 0 disables statement caching. +; http://php.net/oci8.statement-cache-size +;oci8.statement_cache_size = 20 + +; Tuning: Enables statement prefetching and sets the default number of +; rows that will be fetched automatically after statement execution. +; http://php.net/oci8.default-prefetch +;oci8.default_prefetch = 100 + +; Compatibility. Using On means oci_close() will not close +; oci_connect() and oci_new_connect() connections. +; http://php.net/oci8.old-oci-close-semantics +;oci8.old_oci_close_semantics = Off + +[PostgreSQL] +; Allow or prevent persistent links. +; http://php.net/pgsql.allow-persistent +pgsql.allow_persistent = On + +; Detect broken persistent links always with pg_pconnect(). +; Auto reset feature requires a little overheads. +; http://php.net/pgsql.auto-reset-persistent +pgsql.auto_reset_persistent = Off + +; Maximum number of persistent links. -1 means no limit. +; http://php.net/pgsql.max-persistent +pgsql.max_persistent = -1 + +; Maximum number of links (persistent+non persistent). -1 means no limit. +; http://php.net/pgsql.max-links +pgsql.max_links = -1 + +; Ignore PostgreSQL backends Notice message or not. +; Notice message logging require a little overheads. +; http://php.net/pgsql.ignore-notice +pgsql.ignore_notice = 0 + +; Log PostgreSQL backends Notice message or not. +; Unless pgsql.ignore_notice=0, module cannot log notice message. +; http://php.net/pgsql.log-notice +pgsql.log_notice = 0 + +[bcmath] +; Number of decimal digits for all bcmath functions. +; http://php.net/bcmath.scale +bcmath.scale = 0 + +[browscap] +; http://php.net/browscap +;browscap = extra/browscap.ini + +[Session] +; Handler used to store/retrieve data. +; http://php.net/session.save-handler +session.save_handler = files + +; Argument passed to save_handler. In the case of files, this is the path +; where data files are stored. Note: Windows users have to change this +; variable in order to use PHP's session functions. +; +; The path can be defined as: +; +; session.save_path = "N;/path" +; +; where N is an integer. Instead of storing all the session files in +; /path, what this will do is use subdirectories N-levels deep, and +; store the session data in those directories. This is useful if +; your OS has problems with many files in one directory, and is +; a more efficient layout for servers that handle many sessions. +; +; NOTE 1: PHP will not create this directory structure automatically. +; You can use the script in the ext/session dir for that purpose. +; NOTE 2: See the section on garbage collection below if you choose to +; use subdirectories for session storage +; +; The file storage module creates files using mode 600 by default. +; You can change that by using +; +; session.save_path = "N;MODE;/path" +; +; where MODE is the octal representation of the mode. Note that this +; does not overwrite the process's umask. +; http://php.net/session.save-path +;session.save_path = "/tmp" + +; Whether to use strict session mode. +; Strict session mode does not accept uninitialized session ID and regenerate +; session ID if browser sends uninitialized session ID. Strict mode protects +; applications from session fixation via session adoption vulnerability. It is +; disabled by default for maximum compatibility, but enabling it is encouraged. +; https://wiki.php.net/rfc/strict_sessions +session.use_strict_mode = 0 + +; Whether to use cookies. +; http://php.net/session.use-cookies +session.use_cookies = 1 + +; http://php.net/session.cookie-secure +;session.cookie_secure = + +; This option forces PHP to fetch and use a cookie for storing and maintaining +; the session id. We encourage this operation as it's very helpful in combating +; session hijacking when not specifying and managing your own session id. It is +; not the be-all and end-all of session hijacking defense, but it's a good start. +; http://php.net/session.use-only-cookies +session.use_only_cookies = 1 + +; Name of the session (used as cookie name). +; http://php.net/session.name +session.name = PHPSESSID + +; Initialize session on request startup. +; http://php.net/session.auto-start +session.auto_start = 0 + +; Lifetime in seconds of cookie or, if 0, until browser is restarted. +; http://php.net/session.cookie-lifetime +session.cookie_lifetime = 0 + +; The path for which the cookie is valid. +; http://php.net/session.cookie-path +session.cookie_path = / + +; The domain for which the cookie is valid. +; http://php.net/session.cookie-domain +session.cookie_domain = + +; Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser scripting languages such as JavaScript. +; http://php.net/session.cookie-httponly +session.cookie_httponly = + +; Handler used to serialize data. php is the standard serializer of PHP. +; http://php.net/session.serialize-handler +session.serialize_handler = php + +; Defines the probability that the 'garbage collection' process is started +; on every session initialization. The probability is calculated by using +; gc_probability/gc_divisor. Where session.gc_probability is the numerator +; and gc_divisor is the denominator in the equation. Setting this value to 1 +; when the session.gc_divisor value is 100 will give you approximately a 1% chance +; the gc will run on any give request. +; Default Value: 1 +; Development Value: 1 +; Production Value: 1 +; http://php.net/session.gc-probability +session.gc_probability = 1 + +; Defines the probability that the 'garbage collection' process is started on every +; session initialization. The probability is calculated by using the following equation: +; gc_probability/gc_divisor. Where session.gc_probability is the numerator and +; session.gc_divisor is the denominator in the equation. Setting this value to 1 +; when the session.gc_divisor value is 100 will give you approximately a 1% chance +; the gc will run on any give request. Increasing this value to 1000 will give you +; a 0.1% chance the gc will run on any give request. For high volume production servers, +; this is a more efficient approach. +; Default Value: 100 +; Development Value: 1000 +; Production Value: 1000 +; http://php.net/session.gc-divisor +session.gc_divisor = 1000 + +; After this number of seconds, stored data will be seen as 'garbage' and +; cleaned up by the garbage collection process. +; http://php.net/session.gc-maxlifetime +session.gc_maxlifetime = 1440 + +; NOTE: If you are using the subdirectory option for storing session files +; (see session.save_path above), then garbage collection does *not* +; happen automatically. You will need to do your own garbage +; collection through a shell script, cron entry, or some other method. +; For example, the following script would is the equivalent of +; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes): +; find /path/to/sessions -cmin +24 -type f | xargs rm + +; Check HTTP Referer to invalidate externally stored URLs containing ids. +; HTTP_REFERER has to contain this substring for the session to be +; considered as valid. +; http://php.net/session.referer-check +session.referer_check = + +; Set to {nocache,private,public,} to determine HTTP caching aspects +; or leave this empty to avoid sending anti-caching headers. +; http://php.net/session.cache-limiter +session.cache_limiter = nocache + +; Document expires after n minutes. +; http://php.net/session.cache-expire +session.cache_expire = 180 + +; trans sid support is disabled by default. +; Use of trans sid may risk your users' security. +; Use this option with caution. +; - User may send URL contains active session ID +; to other person via. email/irc/etc. +; - URL that contains active session ID may be stored +; in publicly accessible computer. +; - User may access your site with the same session ID +; always using URL stored in browser's history or bookmarks. +; http://php.net/session.use-trans-sid +session.use_trans_sid = 0 + +; Set session ID character length. This value could be between 22 to 256. +; Shorter length than default is supported only for compatibility reason. +; Users should use 32 or more chars. +; http://php.net/session.sid-length +; Default Value: 32 +; Development Value: 26 +; Production Value: 26 +session.sid_length = 26 + +; The URL rewriter will look for URLs in a defined set of HTML tags. +;
is special; if you include them here, the rewriter will +; add a hidden field with the info which is otherwise appended +; to URLs. tag's action attribute URL will not be modified +; unless it is specified. +; Note that all valid entries require a "=", even if no value follows. +; Default Value: "a=href,area=href,frame=src,form=" +; Development Value: "a=href,area=href,frame=src,form=" +; Production Value: "a=href,area=href,frame=src,form=" +; http://php.net/url-rewriter.tags +session.trans_sid_tags = "a=href,area=href,frame=src,form=" + +; URL rewriter does not rewrite absolute URLs by default. +; To enable rewrites for absolute pathes, target hosts must be specified +; at RUNTIME. i.e. use ini_set() +; tags is special. PHP will check action attribute's URL regardless +; of session.trans_sid_tags setting. +; If no host is defined, HTTP_HOST will be used for allowed host. +; Example value: php.net,www.php.net,wiki.php.net +; Use "," for multiple hosts. No spaces are allowed. +; Default Value: "" +; Development Value: "" +; Production Value: "" +;session.trans_sid_hosts="" + +; Define how many bits are stored in each character when converting +; the binary hash data to something readable. +; Possible values: +; 4 (4 bits: 0-9, a-f) +; 5 (5 bits: 0-9, a-v) +; 6 (6 bits: 0-9, a-z, A-Z, "-", ",") +; Default Value: 4 +; Development Value: 5 +; Production Value: 5 +; http://php.net/session.hash-bits-per-character +session.sid_bits_per_character = 5 + +; Enable upload progress tracking in $_SESSION +; Default Value: On +; Development Value: On +; Production Value: On +; http://php.net/session.upload-progress.enabled +;session.upload_progress.enabled = On + +; Cleanup the progress information as soon as all POST data has been read +; (i.e. upload completed). +; Default Value: On +; Development Value: On +; Production Value: On +; http://php.net/session.upload-progress.cleanup +;session.upload_progress.cleanup = On + +; A prefix used for the upload progress key in $_SESSION +; Default Value: "upload_progress_" +; Development Value: "upload_progress_" +; Production Value: "upload_progress_" +; http://php.net/session.upload-progress.prefix +;session.upload_progress.prefix = "upload_progress_" + +; The index name (concatenated with the prefix) in $_SESSION +; containing the upload progress information +; Default Value: "PHP_SESSION_UPLOAD_PROGRESS" +; Development Value: "PHP_SESSION_UPLOAD_PROGRESS" +; Production Value: "PHP_SESSION_UPLOAD_PROGRESS" +; http://php.net/session.upload-progress.name +;session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS" + +; How frequently the upload progress should be updated. +; Given either in percentages (per-file), or in bytes +; Default Value: "1%" +; Development Value: "1%" +; Production Value: "1%" +; http://php.net/session.upload-progress.freq +;session.upload_progress.freq = "1%" + +; The minimum delay between updates, in seconds +; Default Value: 1 +; Development Value: 1 +; Production Value: 1 +; http://php.net/session.upload-progress.min-freq +;session.upload_progress.min_freq = "1" + +; Only write session data when session data is changed. Enabled by default. +; http://php.net/session.lazy-write +;session.lazy_write = On + +[Assertion] +; Switch whether to compile assertions at all (to have no overhead at run-time) +; -1: Do not compile at all +; 0: Jump over assertion at run-time +; 1: Execute assertions +; Changing from or to a negative value is only possible in php.ini! (For turning assertions on and off at run-time, see assert.active, when zend.assertions = 1) +; Default Value: 1 +; Development Value: 1 +; Production Value: -1 +; http://php.net/zend.assertions +zend.assertions = -1 + +; Assert(expr); active by default. +; http://php.net/assert.active +;assert.active = On + +; Throw an AssertationException on failed assertions +; http://php.net/assert.exception +;assert.exception = On + +; Issue a PHP warning for each failed assertion. (Overridden by assert.exception if active) +; http://php.net/assert.warning +;assert.warning = On + +; Don't bail out by default. +; http://php.net/assert.bail +;assert.bail = Off + +; User-function to be called if an assertion fails. +; http://php.net/assert.callback +;assert.callback = 0 + +; Eval the expression with current error_reporting(). Set to true if you want +; error_reporting(0) around the eval(). +; http://php.net/assert.quiet-eval +;assert.quiet_eval = 0 + +[COM] +; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs +; http://php.net/com.typelib-file +;com.typelib_file = + +; allow Distributed-COM calls +; http://php.net/com.allow-dcom +;com.allow_dcom = true + +; autoregister constants of a components typlib on com_load() +; http://php.net/com.autoregister-typelib +;com.autoregister_typelib = true + +; register constants casesensitive +; http://php.net/com.autoregister-casesensitive +;com.autoregister_casesensitive = false + +; show warnings on duplicate constant registrations +; http://php.net/com.autoregister-verbose +;com.autoregister_verbose = true + +; The default character set code-page to use when passing strings to and from COM objects. +; Default: system ANSI code page +;com.code_page= + +[mbstring] +; language for internal character representation. +; This affects mb_send_mail() and mbstring.detect_order. +; http://php.net/mbstring.language +;mbstring.language = Japanese + +; Use of this INI entry is deprecated, use global internal_encoding instead. +; internal/script encoding. +; Some encoding cannot work as internal encoding. (e.g. SJIS, BIG5, ISO-2022-*) +; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. +; The precedence is: default_charset < internal_encoding < iconv.internal_encoding +;mbstring.internal_encoding = + +; Use of this INI entry is deprecated, use global input_encoding instead. +; http input encoding. +; mbstring.encoding_traslation = On is needed to use this setting. +; If empty, default_charset or input_encoding or mbstring.input is used. +; The precedence is: default_charset < intput_encoding < mbsting.http_input +; http://php.net/mbstring.http-input +;mbstring.http_input = + +; Use of this INI entry is deprecated, use global output_encoding instead. +; http output encoding. +; mb_output_handler must be registered as output buffer to function. +; If empty, default_charset or output_encoding or mbstring.http_output is used. +; The precedence is: default_charset < output_encoding < mbstring.http_output +; To use an output encoding conversion, mbstring's output handler must be set +; otherwise output encoding conversion cannot be performed. +; http://php.net/mbstring.http-output +;mbstring.http_output = + +; enable automatic encoding translation according to +; mbstring.internal_encoding setting. Input chars are +; converted to internal encoding by setting this to On. +; Note: Do _not_ use automatic encoding translation for +; portable libs/applications. +; http://php.net/mbstring.encoding-translation +;mbstring.encoding_translation = Off + +; automatic encoding detection order. +; "auto" detect order is changed according to mbstring.language +; http://php.net/mbstring.detect-order +;mbstring.detect_order = auto + +; substitute_character used when character cannot be converted +; one from another +; http://php.net/mbstring.substitute-character +;mbstring.substitute_character = none + +; overload(replace) single byte functions by mbstring functions. +; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(), +; etc. Possible values are 0,1,2,4 or combination of them. +; For example, 7 for overload everything. +; 0: No overload +; 1: Overload mail() function +; 2: Overload str*() functions +; 4: Overload ereg*() functions +; http://php.net/mbstring.func-overload +;mbstring.func_overload = 0 + +; enable strict encoding detection. +; Default: Off +;mbstring.strict_detection = On + +; This directive specifies the regex pattern of content types for which mb_output_handler() +; is activated. +; Default: mbstring.http_output_conv_mimetype=^(text/|application/xhtml\+xml) +;mbstring.http_output_conv_mimetype= + +[gd] +; Tell the jpeg decode to ignore warnings and try to create +; a gd image. The warning will then be displayed as notices +; disabled by default +; http://php.net/gd.jpeg-ignore-warning +;gd.jpeg_ignore_warning = 1 + +[exif] +; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS. +; With mbstring support this will automatically be converted into the encoding +; given by corresponding encode setting. When empty mbstring.internal_encoding +; is used. For the decode settings you can distinguish between motorola and +; intel byte order. A decode setting cannot be empty. +; http://php.net/exif.encode-unicode +;exif.encode_unicode = ISO-8859-15 + +; http://php.net/exif.decode-unicode-motorola +;exif.decode_unicode_motorola = UCS-2BE + +; http://php.net/exif.decode-unicode-intel +;exif.decode_unicode_intel = UCS-2LE + +; http://php.net/exif.encode-jis +;exif.encode_jis = + +; http://php.net/exif.decode-jis-motorola +;exif.decode_jis_motorola = JIS + +; http://php.net/exif.decode-jis-intel +;exif.decode_jis_intel = JIS + +[Tidy] +; The path to a default tidy configuration file to use when using tidy +; http://php.net/tidy.default-config +;tidy.default_config = /usr/local/lib/php/default.tcfg + +; Should tidy clean and repair output automatically? +; WARNING: Do not use this option if you are generating non-html content +; such as dynamic images +; http://php.net/tidy.clean-output +tidy.clean_output = Off + +[soap] +; Enables or disables WSDL caching feature. +; http://php.net/soap.wsdl-cache-enabled +soap.wsdl_cache_enabled=1 + +; Sets the directory name where SOAP extension will put cache files. +; http://php.net/soap.wsdl-cache-dir +soap.wsdl_cache_dir="/tmp" + +; (time to live) Sets the number of second while cached file will be used +; instead of original one. +; http://php.net/soap.wsdl-cache-ttl +soap.wsdl_cache_ttl=86400 + +; Sets the size of the cache limit. (Max. number of WSDL files to cache) +soap.wsdl_cache_limit = 5 + +[sysvshm] +; A default size of the shared memory segment +;sysvshm.init_mem = 10000 + +[ldap] +; Sets the maximum number of open links or -1 for unlimited. +ldap.max_links = -1 + +[dba] +;dba.default_handler= + +[opcache] +; Determines if Zend OPCache is enabled +;opcache.enable=1 + +; Determines if Zend OPCache is enabled for the CLI version of PHP +;opcache.enable_cli=0 + +; The OPcache shared memory storage size. +;opcache.memory_consumption=128 + +; The amount of memory for interned strings in Mbytes. +;opcache.interned_strings_buffer=8 + +; The maximum number of keys (scripts) in the OPcache hash table. +; Only numbers between 200 and 1000000 are allowed. +;opcache.max_accelerated_files=10000 + +; The maximum percentage of "wasted" memory until a restart is scheduled. +;opcache.max_wasted_percentage=5 + +; When this directive is enabled, the OPcache appends the current working +; directory to the script key, thus eliminating possible collisions between +; files with the same name (basename). Disabling the directive improves +; performance, but may break existing applications. +;opcache.use_cwd=1 + +; When disabled, you must reset the OPcache manually or restart the +; webserver for changes to the filesystem to take effect. +;opcache.validate_timestamps=1 + +; How often (in seconds) to check file timestamps for changes to the shared +; memory storage allocation. ("1" means validate once per second, but only +; once per request. "0" means always validate) +;opcache.revalidate_freq=2 + +; Enables or disables file search in include_path optimization +;opcache.revalidate_path=0 + +; If disabled, all PHPDoc comments are dropped from the code to reduce the +; size of the optimized code. +;opcache.save_comments=1 + +; Allow file existence override (file_exists, etc.) performance feature. +;opcache.enable_file_override=0 + +; A bitmask, where each bit enables or disables the appropriate OPcache +; passes +;opcache.optimization_level=0xffffffff + +;opcache.inherited_hack=1 +;opcache.dups_fix=0 + +; The location of the OPcache blacklist file (wildcards allowed). +; Each OPcache blacklist file is a text file that holds the names of files +; that should not be accelerated. The file format is to add each filename +; to a new line. The filename may be a full path or just a file prefix +; (i.e., /var/www/x blacklists all the files and directories in /var/www +; that start with 'x'). Line starting with a ; are ignored (comments). +;opcache.blacklist_filename= + +; Allows exclusion of large files from being cached. By default all files +; are cached. +;opcache.max_file_size=0 + +; Check the cache checksum each N requests. +; The default value of "0" means that the checks are disabled. +;opcache.consistency_checks=0 + +; How long to wait (in seconds) for a scheduled restart to begin if the cache +; is not being accessed. +;opcache.force_restart_timeout=180 + +; OPcache error_log file name. Empty string assumes "stderr". +;opcache.error_log= + +; All OPcache errors go to the Web server log. +; By default, only fatal errors (level 0) or errors (level 1) are logged. +; You can also enable warnings (level 2), info messages (level 3) or +; debug messages (level 4). +;opcache.log_verbosity_level=1 + +; Preferred Shared Memory back-end. Leave empty and let the system decide. +;opcache.preferred_memory_model= + +; Protect the shared memory from unexpected writing during script execution. +; Useful for internal debugging only. +;opcache.protect_memory=0 + +; Allows calling OPcache API functions only from PHP scripts which path is +; started from specified string. The default "" means no restriction +;opcache.restrict_api= + +; Mapping base of shared memory segments (for Windows only). All the PHP +; processes have to map shared memory into the same address space. This +; directive allows to manually fix the "Unable to reattach to base address" +; errors. +;opcache.mmap_base= + +; Enables and sets the second level cache directory. +; It should improve performance when SHM memory is full, at server restart or +; SHM reset. The default "" disables file based caching. +;opcache.file_cache= + +; Enables or disables opcode caching in shared memory. +;opcache.file_cache_only=0 + +; Enables or disables checksum validation when script loaded from file cache. +;opcache.file_cache_consistency_checks=1 + +; Implies opcache.file_cache_only=1 for a certain process that failed to +; reattach to the shared memory (for Windows only). Explicitly enabled file +; cache is required. +;opcache.file_cache_fallback=1 + +; Enables or disables copying of PHP code (text segment) into HUGE PAGES. +; This should improve performance, but requires appropriate OS configuration. +;opcache.huge_code_pages=1 + +; Validate cached file permissions. +;opcache.validate_permission=0 + +; Prevent name collisions in chroot'ed environment. +;opcache.validate_root=0 + +[curl] +; A default value for the CURLOPT_CAINFO option. This is required to be an +; absolute path. +;curl.cainfo = + +[openssl] +; The location of a Certificate Authority (CA) file on the local filesystem +; to use when verifying the identity of SSL/TLS peers. Most users should +; not specify a value for this directive as PHP will attempt to use the +; OS-managed cert stores in its absence. If specified, this value may still +; be overridden on a per-stream basis via the "cafile" SSL stream context +; option. +;openssl.cafile= + +; If openssl.cafile is not specified or if the CA file is not found, the +; directory pointed to by openssl.capath is searched for a suitable +; certificate. This value must be a correctly hashed certificate directory. +; Most users should not specify a value for this directive as PHP will +; attempt to use the OS-managed cert stores in its absence. If specified, +; this value may still be overridden on a per-stream basis via the "capath" +; SSL stream context option. +;openssl.capath= + +; Local Variables: +; tab-width: 4 +; End: diff --git a/firmware/ori/board/pluto/overlay/etc/profile b/firmware/ori/board/pluto/overlay/etc/profile new file mode 100644 index 0000000..cdf7354 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/profile @@ -0,0 +1,8 @@ +if [ "$PS1" ]; then + if [ "`id -u`" -eq 0 ]; then + export PS1="\e[0;32m[\h:\w]\# \e[m" + else + export PS1='$ ' + fi +fi + diff --git a/firmware/ori/board/pluto/overlay/etc/profile.d/aliases.sh b/firmware/ori/board/pluto/overlay/etc/profile.d/aliases.sh new file mode 100755 index 0000000..72d6f74 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/profile.d/aliases.sh @@ -0,0 +1,6 @@ +export PATH=$PATH:/root:/root/luaradio:/root/luaradio/radio +alias luaradio="cd /root/luaradio ; luaradio" +alias retrogram="retrogram-plutosdr --uri=local:" +alias rtl_433="rtl_433 -d driver=plutosdr,uri=local: -g 60 -C si" +alias ldd="LD_TRACE_LOADED_OBJECTS=1 $1" + diff --git a/firmware/ori/board/pluto/overlay/etc/resolv.conf b/firmware/ori/board/pluto/overlay/etc/resolv.conf new file mode 100644 index 0000000..cae093a --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/resolv.conf @@ -0,0 +1 @@ +nameserver 8.8.8.8 diff --git a/firmware/ori/board/pluto/overlay/etc/udhcpdwan.conf b/firmware/ori/board/pluto/overlay/etc/udhcpdwan.conf new file mode 100644 index 0000000..518b537 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/udhcpdwan.conf @@ -0,0 +1,5 @@ +start 192.168.3.10 +interface wlan0 +option subnet 255.255.255.0 +pidfile /var/run/udhcpdwan.pid +#udhcpd /etc/udhcpdwan.conf diff --git a/firmware/ori/board/pluto/overlay/etc/wpa_supplicant/action_wpa.sh b/firmware/ori/board/pluto/overlay/etc/wpa_supplicant/action_wpa.sh new file mode 100755 index 0000000..bb4c7c1 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/wpa_supplicant/action_wpa.sh @@ -0,0 +1,50 @@ +#!/bin/sh + +# Action script to enable/disable wpa-roam interfaces in reaction to +# ifplugd events. +# +# Copyright: Copyright (c) 2008-2010, Kel Modderman +# License: GPL-2 +# + +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +if [ ! -x /sbin/wpa_action ]; then + exit 0 +fi + +# ifplugd(8) - +# +# If an ifplugd managed interface is brought up, disconnect any +# wpa-roam managed interfaces so that only one "roaming" interface +# remains active on the system. + +IFPLUGD_IFACE="${1}" + +case "${2}" in + up) + COMMAND=disconnect + ;; + down) + COMMAND=reconnect + ;; + *) + echo "$0: unknown arguments: ${@}" >&2 + exit 1 + ;; +esac + +for CTRL in /run/wpa_supplicant/*; do + [ -S "${CTRL}" ] || continue + + IFACE="${CTRL#/run/wpa_supplicant/}" + + # skip if ifplugd is managing this interface + if [ "${IFPLUGD_IFACE}" = "${IFACE}" ]; then + continue + fi + + if wpa_action "${IFACE}" check; then + wpa_cli -i "${IFACE}" "${COMMAND}" + fi +done diff --git a/firmware/ori/board/pluto/overlay/etc/wpa_supplicant/functions.sh b/firmware/ori/board/pluto/overlay/etc/wpa_supplicant/functions.sh new file mode 100755 index 0000000..bf01819 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/wpa_supplicant/functions.sh @@ -0,0 +1,1006 @@ +#!/bin/sh + +##################################################################### +## Purpose +# This file contains common shell functions used by scripts of the +# wpasupplicant package to allow ifupdown to manage wpa_supplicant. +# It also contains some functions used by wpa_action(8) that allow +# ifupdown to be managed by wpa_cli(8) action events. +# +# This file is provided by the wpasupplicant package. + +##################################################################### +# Copyright (C) 2006 - 2009 Debian/Ubuntu wpasupplicant Maintainers +# +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# On Debian GNU/Linux systems, the text of the GPL license, +# version 2, can be found in /usr/share/common-licenses/GPL-2. + +##################################################################### +## global variables +# wpa_supplicant variables +WPA_SUP_BIN="/usr/sbin/wpa_supplicant" +WPA_SUP_PNAME="wpa_supplicant" +WPA_SUP_PIDFILE="/run/wpa_supplicant.${WPA_IFACE}.pid" +WPA_SUP_OMIT_DIR="/run/sendsigs.omit.d" +WPA_SUP_OMIT_PIDFILE="${WPA_SUP_OMIT_DIR}/wpasupplicant.wpa_supplicant.${WPA_IFACE}.pid" + +# wpa_cli variables +WPA_CLI_BIN="/usr/sbin/wpa_cli" +WPA_CLI_PNAME="wpa_cli" +WPA_CLI_PIDFILE="/run/wpa_action.${WPA_IFACE}.pid" +WPA_CLI_TIMESTAMP="/run/wpa_action.${WPA_IFACE}.timestamp" +WPA_CLI_IFUPDOWN="/run/wpa_action.${WPA_IFACE}.ifupdown" + +# default ctrl_interface socket directory +if [ -z "$WPA_CTRL_DIR" ]; then + WPA_CTRL_DIR="/run/wpa_supplicant" +fi + +# verbosity variables +if [ -n "$IF_WPA_VERBOSITY" ] || [ "$VERBOSITY" = "1" ]; then + TO_NULL="/dev/stdout" + DAEMON_VERBOSITY="--verbose" +else + TO_NULL="/dev/null" + DAEMON_VERBOSITY="--quiet" +fi + +##################################################################### +## wpa_cli wrapper +# Path to common ctrl_interface socket and iface supplied. +# NB: WPA_CTRL_DIR cannot be used for interactive commands, it is +# set only in the environment that wpa_cli provides when processing +# action events. +# +wpa_cli () { + "$WPA_CLI_BIN" -p "$WPA_CTRL_DIR" -i "$WPA_IFACE" "$@" + + return "$?" +} + +##################################################################### +## verbose and stderr message wrapper +# Ensures a standard and easily identifiable message is printed by +# scripts using this function library. +# +# log Log a message to syslog when called non-interactively +# by wpa_action +# +# verbose To stdout when IF_WPA_VERBOSITY or VERBOSITY is true +# +# action Same as verbose but without newline +# Useful for allowing wpa_cli commands to echo result +# value of 'OK' or 'FAILED' +# +# stderr Echo warning or error messages to stderr +# +# NB: when called by wpa_action, there is no redirection (verbose) +# +wpa_msg () { + if [ "$1" = "log" ]; then + shift + case "$WPA_ACTION" in + "CONNECTED"|"DISCONNECTED") + [ -x /usr/bin/logger ] || return + if [ "$#" -gt 0 ]; then + logger -t "wpa_action" "$@" + else + logger -t "wpa_action" + fi + ;; + *) + [ "$#" -gt 0 ] && echo "wpa_action: $@" + ;; + esac + return + fi + + case "$1" in + "verbose") + shift + echo "$WPA_SUP_PNAME: $@" >$TO_NULL + ;; + "action") + shift + echo -n "$WPA_SUP_PNAME: $@ -- " >$TO_NULL + ;; + "stderr") + shift + echo "$WPA_SUP_PNAME: $@" >/dev/stderr + ;; + *) + ;; + esac +} + +##################################################################### +## validate daemon pid files +# Test daemon process ID files via start-stop-daemon with a signal 0 +# given the exec binary and pidfile location. +# +# $1 daemon +# $2 pidfile +# +# Returns true when pidfile exists, the process ID exists _and_ was +# created by the exec binary. +# +# If the test fails, but the pidfile exists, it is stale +# +test_daemon_pidfile () { + local DAEMON + local PIDFILE + + if [ -n "$1" ]; then + DAEMON="$1" + fi + + if [ -f "$2" ]; then + PIDFILE="$2" + fi + + if [ -n "$DAEMON" ] && [ -f "$PIDFILE" ]; then + if start-stop-daemon --stop --quiet --signal 0 \ + --exec "$DAEMON" --pidfile "$PIDFILE"; then + return 0 + else + rm -f "$PIDFILE" + return 1 + fi + else + return 1 + fi +} + +# validate wpa_supplicant pidfile +test_wpa_supplicant () { + test_daemon_pidfile "$WPA_SUP_BIN" "$WPA_SUP_PIDFILE" +} + +# validate wpa_cli pidfile +test_wpa_cli () { + test_daemon_pidfile "$WPA_CLI_BIN" "$WPA_CLI_PIDFILE" +} + +##################################################################### +## daemonize wpa_supplicant +# Start wpa_supplicant via start-stop-dameon with all required +# options. Will start if environment variable WPA_SUP_CONF is present +# +# Default options: +# -B dameonize/background process +# -D driver backend ('wext' if none given) +# -P process ID file +# -C path to ctrl_interface socket directory +# -s log to syslog +# +# Conditional options: +# -c configuration file +# -W wait for wpa_cli to attach to ctrl_interface socket +# -b bridge interface name +# -f path to log file +# +init_wpa_supplicant () { + [ -n "$WPA_SUP_CONF" ] || return 0 + + local WPA_SUP_OPTIONS + WPA_SUP_OPTIONS="-B -P $WPA_SUP_PIDFILE -i $WPA_IFACE" + + if [ -n "$WPA_ACTION_SCRIPT" ]; then + if [ -x "$WPA_ACTION_SCRIPT" ]; then + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -W" + wpa_msg verbose "wait for wpa_cli to attach" + else + wpa_msg stderr "action script \"$WPA_ACTION_SCRIPT\" not executable" + return 1 + fi + fi + + if [ -n "$IF_WPA_BRIDGE" ]; then + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -b $IF_WPA_BRIDGE" + wpa_msg verbose "wpa-bridge $IF_WPA_BRIDGE" + fi + + if [ -n "$IF_WPA_DRIVER" ]; then + wpa_msg verbose "wpa-driver $IF_WPA_DRIVER" + case "$IF_WPA_DRIVER" in + hostap|ipw|madwifi|ndiswrapper) + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -D nl80211,wext" + wpa_msg stderr "\"$IF_WPA_DRIVER\" wpa-driver is unsupported" + wpa_msg stderr "using \"nl80211,wext\" wpa-driver instead ..." + ;; + *) + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -D $IF_WPA_DRIVER" + ;; + esac + else + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -D nl80211,wext" + wpa_msg verbose "wpa-driver nl80211,wext (default)" + fi + + if [ -n "$IF_WPA_DEBUG_LEVEL" ]; then + case "$IF_WPA_DEBUG_LEVEL" in + 3) + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -t -ddd" + ;; + 2) + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -t -dd" + ;; + 1) + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -t -d" + ;; + 0) + # wpa_supplicant default verbosity + ;; + -1) + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -q" + ;; + -2) + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -qq" + ;; + esac + wpa_msg verbose "using debug level: $IF_WPA_DEBUG_LEVEL" + fi + + if [ -n "$IF_WPA_LOGFILE" ]; then + # custom log file + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -f $IF_WPA_LOGFILE" + WPA_SUP_LOGFILE="$IF_WPA_LOGFILE" + wpa_msg verbose "logging to $IF_WPA_LOGFILE" + fi + + wpa_msg verbose "$WPA_SUP_BIN $WPA_SUP_OPTIONS $WPA_SUP_CONF" + + start-stop-daemon --start --oknodo $DAEMON_VERBOSITY \ + --name $WPA_SUP_PNAME --startas $WPA_SUP_BIN --pidfile $WPA_SUP_PIDFILE \ + -- $WPA_SUP_OPTIONS $WPA_SUP_CONF + + if [ "$?" -ne 0 ]; then + wpa_msg stderr "$WPA_SUP_BIN daemon failed to start" + return 1 + fi + + local WPA_PIDFILE_WAIT + local MAX_WPA_PIDFILE_WAIT + WPA_PIDFILE_WAIT="0" + MAX_WPA_PIDFILE_WAIT="5" + until [ -s "$WPA_SUP_PIDFILE" ]; do + if [ "$WPA_PIDFILE_WAIT" -ge "$MAX_WPA_PIDFILE_WAIT" ]; then + wpa_msg stderr "timed out waiting for creation of $WPA_SUP_PIDFILE" + return 1 + else + wpa_msg verbose "waiting for \"$WPA_SUP_PIDFILE\": " \ + "$WPA_PIDFILE_WAIT (max. $MAX_WPA_PIDFILE_WAIT)" + fi + + WPA_PIDFILE_WAIT=$(($WPA_PIDFILE_WAIT + 1)) + sleep 1 + done + if [ -d "${WPA_SUP_OMIT_DIR}" ]; then + wpa_msg verbose "creating sendsigs omission pidfile: $WPA_SUP_OMIT_PIDFILE" + cat "$WPA_SUP_PIDFILE" > "$WPA_SUP_OMIT_PIDFILE" + fi + + local WPA_SOCKET_WAIT + local MAX_WPA_SOCKET_WAIT + WPA_SOCKET_WAIT="0" + MAX_WPA_SOCKET_WAIT="5" + until [ -S "$WPA_CTRL_DIR/$WPA_IFACE" ]; do + if [ "$WPA_SOCKET_WAIT" -ge "$MAX_WPA_SOCKET_WAIT" ]; then + wpa_msg stderr "ctrl_interface socket not found at $WPA_CTRL_DIR/$WPA_IFACE" + return 1 + else + wpa_msg verbose "waiting for \"$WPA_CTRL_DIR/$WPA_IFACE\": " \ + "$WPA_SOCKET_WAIT (max. $MAX_WPA_SOCKET_WAIT)" + fi + + WPA_SOCKET_WAIT=$(($WPA_SOCKET_WAIT + 1)) + sleep 1 + done + + wpa_msg verbose "ctrl_interface socket located at $WPA_CTRL_DIR/$WPA_IFACE" +} + +##################################################################### +## stop wpa_supplicant process +# Kill wpa_supplicant via start-stop-daemon, given the location of +# the pidfile or ctrl_interface socket path and interface name +# +kill_wpa_supplicant () { + test_wpa_supplicant || return 0 + + wpa_msg verbose "terminating $WPA_SUP_PNAME daemon via pidfile $WPA_SUP_PIDFILE" + + start-stop-daemon --stop --oknodo $DAEMON_VERBOSITY \ + --exec $WPA_SUP_BIN --pidfile $WPA_SUP_PIDFILE + + if [ -f "$WPA_SUP_PIDFILE" ]; then + rm -f "$WPA_SUP_PIDFILE" + fi + + if [ -f "$WPA_SUP_OMIT_PIDFILE" ]; then + wpa_msg verbose "removing $WPA_SUP_OMIT_PIDFILE" + rm -f "$WPA_SUP_OMIT_PIDFILE" + fi +} + +##################################################################### +## reload wpa_supplicant process +# Sending a HUP signal causes wpa_supplicant to reparse its +# configuration file +# +reload_wpa_supplicant () { + if test_wpa_supplicant; then + wpa_msg verbose "reloading wpa_supplicant configuration file via HUP signal" + start-stop-daemon --stop --signal HUP \ + --name "$WPA_SUP_PNAME" --pidfile "$WPA_SUP_PIDFILE" + else + wpa_msg verbose "cannot $WPA_ACTION, $WPA_SUP_PIDFILE does not exist" + fi +} + +##################################################################### +## daemonize wpa_cli and action script +# If environment variable WPA_ACTION_SCRIPT is present, wpa_cli will +# be spawned via start-stop-daemon +# +# Required options: +# -a action script => wpa_action +# -P process ID file +# -B background process +# +init_wpa_cli () { + [ -n "$WPA_ACTION_SCRIPT" ] || return 0 + + local WPA_CLI_OPTIONS + WPA_CLI_OPTIONS="-B -P $WPA_CLI_PIDFILE -i $WPA_IFACE" + + wpa_msg verbose "$WPA_CLI_BIN $WPA_CLI_OPTIONS -p $WPA_CTRL_DIR -a $WPA_ACTION_SCRIPT" + + start-stop-daemon --start --oknodo $DAEMON_VERBOSITY \ + --name $WPA_CLI_PNAME --startas $WPA_CLI_BIN --pidfile $WPA_CLI_PIDFILE \ + -- $WPA_CLI_OPTIONS -p $WPA_CTRL_DIR -a $WPA_ACTION_SCRIPT + + if [ "$?" -ne 0 ]; then + wpa_msg stderr "$WPA_CLI_BIN daemon failed to start" + return 1 + fi +} + +##################################################################### +## stop wpa_cli process +# Kill wpa_cli via start-stop-daemon, given the location of the +# pidfile +# +kill_wpa_cli () { + test_wpa_cli || return 0 + + wpa_msg verbose "terminating $WPA_CLI_PNAME daemon via pidfile $WPA_CLI_PIDFILE" + + start-stop-daemon --stop --oknodo $DAEMON_VERBOSITY \ + --exec $WPA_CLI_BIN --pidfile $WPA_CLI_PIDFILE + + if [ -f "$WPA_CLI_PIDFILE" ]; then + rm -f "$WPA_CLI_PIDFILE" + fi + + if [ -f "$WPA_CLI_TIMESTAMP" ]; then + rm -f "$WPA_CLI_TIMESTAMP" + fi + + if [ -L "$WPA_CLI_IFUPDOWN" ]; then + rm -f "$WPA_CLI_IFUPDOWN" + fi +} + +##################################################################### +## higher level wpa_cli wrapper for variable and set_network commands +# wpa_cli_do [set_network variable] +# +# $1 envorinment variable +# $2 data type of variable {raw|ascii} +# $3 wpa_cli variable, if $3 is set_network, shift and take +# set_network subvariable +# $4 wpa-* string as it would appear in interfaces file, enhances +# verbose messages +# +wpa_cli_do () { + if [ -z "$1" ]; then + return 0 + fi + + local WPACLISET_VALUE + local WPACLISET_VARIABLE + local WPACLISET_DESC + + case "$2" in + ascii) + # Double quote + WPACLISET_VALUE="\"$1\"" + ;; + raw|*) + # Provide raw value + WPACLISET_VALUE="$1" + ;; + esac + + case "$3" in + set_network) + if [ -z "$WPA_ID" ]; then + return 1 + fi + shift + WPACLISET_VARIABLE="set_network $WPA_ID $3" + ;; + *) + WPACLISET_VARIABLE="$3" + ;; + esac + + case "$4" in + *-psk|*-passphrase|*-passwd*|*-password*|*-wep-key*) + WPACLISET_DESC="$4 *****" + ;; + *) + WPACLISET_DESC="$4 $WPACLISET_VALUE" + ;; + esac + + wpa_msg action "$WPACLISET_DESC" + + wpa_cli $WPACLISET_VARIABLE "$WPACLISET_VALUE" >$TO_NULL + + if [ "$?" -ne 0 ]; then + wpa_msg stderr "$WPACLISET_DESC failed!" + fi +} + +##################################################################### +## check value data type in plaintext or hex +# returns 0 if input consists of hexadecimal digits only, 1 otherwise +# +ishex () { + if [ -z "$1" ]; then + return 0 + fi + + case "$1" in + *[!0-9a-fA-F]*) + # plaintext + return 1 + ;; + *) + # hexadecimal + return 0 + ;; + esac +} + +##################################################################### +## sanity check and set psk|passphrase +# Warn about strange psk|passphrase values +# +# $1 psk or passphrase value +# +# If psk is surrounded by quotes strip them. +# +# If psk contains all hexadecimal characters and string length is 64: +# is 256bit hexadecimal +# else: +# is plaintext +# +# plaintext passphrases must be 8 - 63 characters in length +# 256-bit hexadecimal key must be 64 characters in length +# +wpa_key_check_and_set () { + if [ "$#" -ne 3 ]; then + return 0 + fi + + local KEY + local KEY_LEN + local KEY_TYPE + local ENC_TYPE + + case "$1" in + '"'*'"') + # Strip surrounding quotation marks + KEY=$(echo -n "$1" | sed 's/^"//;s/"$//') + ;; + *) + KEY="$1" + ;; + esac + + KEY_LEN="${#KEY}" + + case "$2" in + wep_key*) + ENC_TYPE="WEP" + ;; + psk) + ENC_TYPE="WPA" + ;; + *) + return 0 + ;; + esac + + if [ "$ENC_TYPE" = "WEP" ]; then + if ishex "$KEY"; then + case "$KEY_LEN" in + 10|26|32|58) + # 64/128/152/256-bit WEP + KEY_TYPE="raw" + ;; + *) + KEY_TYPE="ascii" + ;; + esac + else + KEY_TYPE="ascii" + fi + + if [ "$KEY_TYPE" = "ascii" ]; then + if [ "$KEY_LEN" -lt "5" ]; then + wpa_msg stderr "WARNING: plaintext or ascii WEP key has $KEY_LEN characters," + wpa_msg stderr "it must have at least 5 to be valid." + fi + fi + elif [ "$ENC_TYPE" = "WPA" ]; then + if ishex "$KEY"; then + case "$KEY_LEN" in + 64) + # 256-bit WPA + KEY_TYPE="raw" + ;; + *) + KEY_TYPE="ascii" + ;; + esac + else + KEY_TYPE="ascii" + fi + + if [ "$KEY_TYPE" = "ascii" ]; then + if [ "$KEY_LEN" -lt "8" ] || [ "$KEY_LEN" -gt "63" ]; then + wpa_msg stderr "WARNING: plaintext or ascii WPA key has $KEY_LEN characters," + wpa_msg stderr "it must have between 8 and 63 to be valid." + wpa_msg stderr "If the WPA key is a 256-bit hexadecimal key, it must have" + wpa_msg stderr "exactly 64 characters." + fi + fi + fi + + wpa_cli_do "$KEY" "$KEY_TYPE" set_network "$2" "$3" +} + +##################################################################### +## formulate a usable configuration from interfaces(5) wpa- lines +# A series of wpa_cli commands corresponding to environment variables +# created as a result of wpa- lines in an interfaces stanza. +# +# NB: no-act when roaming daemon is used (to avoid prematurely +# attaching to ctrl_interface socket) +# +conf_wpa_supplicant () { + if [ -n "$WPA_ACTION_SCRIPT" ]; then + return 0 + fi + + if [ "$IF_WPA_DRIVER" = "wired" ]; then + IF_WPA_AP_SCAN="0" + wpa_msg verbose "forcing ap_scan=0 (required for wired IEEE8021X auth)" + fi + + if [ -n "$IF_WPA_ESSID" ]; then + # #403316, be similar to wireless tools + IF_WPA_SSID="$IF_WPA_ESSID" + fi + + wpa_cli_do "$IF_WPA_AP_SCAN" raw \ + ap_scan wpa-ap-scan + + wpa_cli_do "$IF_WPA_PREAUTHENTICATE" raw \ + preauthenticate wpa-preauthenticate + + if [ -n "$IF_WPA_SSID" ] || [ "$IF_WPA_DRIVER" = "wired" ] || \ + [ -n "$IF_WPA_KEY_MGMT" ]; then + + case "$IF_WPA_SSID" in + '"'*'"') + IF_WPA_SSID=$(echo -n "$IF_WPA_SSID" | sed 's/^"//;s/"$//') + ;; + *) + ;; + esac + + WPA_ID=$(wpa_cli add_network) + + wpa_msg verbose "configuring network block -- $WPA_ID" + + wpa_cli_do "$IF_WPA_SSID" ascii \ + set_network ssid wpa-ssid + + wpa_cli_do "$IF_WPA_PRIORITY" raw \ + set_network priority wpa-priority + + wpa_cli_do "$IF_WPA_BSSID" raw \ + set_network bssid wpa-bssid + + if [ -s "$IF_WPA_PSK_FILE" ]; then + IF_WPA_PSK=$(cat "$IF_WPA_PSK_FILE") + fi + + # remain compat with wpa-passphrase-file + if [ -s "$IF_WPA_PASSPHRASE_FILE" ]; then + IF_WPA_PSK=$(cat "$IF_WPA_PASSPHRASE_FILE") + fi + + # remain compat with wpa-passphrase + if [ -n "$IF_WPA_PASSPHRASE" ]; then + IF_WPA_PSK="$IF_WPA_PASSPHRASE" + fi + + if [ -n "$IF_WPA_PSK" ]; then + wpa_key_check_and_set "$IF_WPA_PSK" \ + psk wpa-psk + fi + + wpa_cli_do "$IF_WPA_PAIRWISE" raw \ + set_network pairwise wpa-pairwise + + wpa_cli_do "$IF_WPA_GROUP" raw \ + set_network group wpa-group + + wpa_cli_do "$IF_WPA_MODE" raw \ + set_network mode wpa-mode + + wpa_cli_do "$IF_WPA_FREQUENCY" raw \ + set_network frequency wpa-frequency + + wpa_cli_do "$IF_WPA_SCAN_FREQ" raw \ + set_network scan_freq wpa-scan-freq + + wpa_cli_do "$IF_WPA_FREQ_LIST" raw \ + set_network freq_list wpa-freq-list + + wpa_cli_do "$IF_WPA_KEY_MGMT" raw \ + set_network key_mgmt wpa-key-mgmt + + wpa_cli_do "$IF_WPA_PROTO" raw \ + set_network proto wpa-proto + + wpa_cli_do "$IF_WPA_AUTH_ALG" raw \ + set_network auth_alg wpa-auth-alg + + wpa_cli_do "$IF_WPA_SCAN_SSID" raw \ + set_network scan_ssid wpa-scan-ssid + + wpa_cli_do "$IF_WPA_IDENTITY" ascii \ + set_network identity wpa-identity + + wpa_cli_do "$IF_WPA_ANONYMOUS_IDENTITY" ascii \ + set_network anonymous_identity wpa-anonymous-identity + + wpa_cli_do "$IF_WPA_EAP" raw \ + set_network eap wpa-eap + + wpa_cli_do "$IF_WPA_EAPPSK" raw \ + set_network eappsk wpa-eappsk + + wpa_cli_do "$IF_WPA_NAI" ascii \ + set_network nai wpa-nai + + wpa_cli_do "$IF_WPA_PASSWORD" ascii \ + set_network password wpa-password + + wpa_cli_do "$IF_WPA_CA_CERT" ascii \ + set_network ca_cert wpa-ca-cert + + wpa_cli_do "$IF_WPA_CA_PATH" ascii \ + set_network ca_path wpa-ca-path + + wpa_cli_do "$IF_WPA_CLIENT_CERT" ascii \ + set_network client_cert wpa-client-cert + + wpa_cli_do "$IF_WPA_PRIVATE_KEY" ascii \ + set_network private_key wpa-private-key + + wpa_cli_do "$IF_WPA_PRIVATE_KEY_PASSWD" ascii \ + set_network private_key_passwd wpa-private-key-passwd + + wpa_cli_do "$IF_WPA_DH_FILE" ascii \ + set_network dh_file wpa-dh-file + + wpa_cli_do "$IF_WPA_SUBJECT_MATCH" ascii \ + set_network subject_match wpa-subject-match + + wpa_cli_do "$IF_WPA_ALTSUBJECT_MATCH" ascii \ + set_network altsubject_match wpa-altsubject-match + + wpa_cli_do "$IF_WPA_CA_CERT2" ascii \ + set_network ca_cert2 wpa-ca-cert2 + + wpa_cli_do "$IF_WPA_CA_PATH2" ascii \ + set_network ca_path2 wpa-ca-path2 + + wpa_cli_do "$IF_WPA_CLIENT_CERT2" ascii \ + set_network client_cert2 wpa-client-cert2 + + wpa_cli_do "$IF_WPA_PRIVATE_KEY2" ascii \ + set_network private_key2 wpa-private-key2 + + wpa_cli_do "$IF_WPA_PRIVATE_KEY_PASSWD2" ascii \ + set_network private_key_passwd2 wpa-private-key-passwd2 + + wpa_cli_do "$IF_WPA_DH_FILE2" ascii \ + set_network dh_file2 wpa-dh-file2 + + wpa_cli_do "$IF_WPA_SUBJECT_MATCH2" ascii \ + set_network subject_match2 wpa-subject-match2 + + wpa_cli_do "$IF_WPA_ALTSUBJECT_MATCH2" ascii \ + set_network altsubject_match2 wpa-altsubject-match2 + + wpa_cli_do "$IF_WPA_EAP_METHODS" raw \ + set_network eap_methods wpa-eap-methods + + wpa_cli_do "$IF_WPA_PHASE1" ascii \ + set_network phase1 wpa-phase1 + + wpa_cli_do "$IF_WPA_PHASE2" ascii \ + set_network phase2 wpa-phase2 + + wpa_cli_do "$IF_WPA_PCSC" raw \ + set_network pcsc wpa-pcsc + + wpa_cli_do "$IF_WPA_PIN" ascii \ + set_network pin wpa-pin + + wpa_cli_do "$IF_WPA_ENGINE" raw \ + set_network engine wpa-engine + + wpa_cli_do "$IF_WPA_ENGINE_ID" ascii \ + set_network engine_id wpa-engine-id + + wpa_cli_do "$IF_WPA_KEY_ID" ascii \ + set_network key_id wpa-key-id + + wpa_cli_do "$IF_WPA_EAPOL_FLAGS" raw \ + set_network eapol_flags wpa-eapol-flags + + if [ -n "$IF_WPA_WEP_KEY0" ]; then + wpa_key_check_and_set "$IF_WPA_WEP_KEY0" \ + wep_key0 wpa-wep-key0 + fi + + if [ -n "$IF_WPA_WEP_KEY1" ]; then + wpa_key_check_and_set "$IF_WPA_WEP_KEY1" \ + wep_key1 wpa-wep-key1 + fi + + if [ -n "$IF_WPA_WEP_KEY2" ]; then + wpa_key_check_and_set "$IF_WPA_WEP_KEY2" \ + wep_key2 wpa-wep-key2 + fi + + if [ -n "$IF_WPA_WEP_KEY3" ]; then + wpa_key_check_and_set "$IF_WPA_WEP_KEY3" \ + wep_key3 wpa-wep-key3 + fi + + wpa_cli_do "$IF_WPA_WEP_TX_KEYIDX" raw \ + set_network wep_tx_keyidx wpa-wep-tx-keyidx + + wpa_cli_do "$IF_WPA_PROACTIVE_KEY_CACHING" raw \ + set_network proactive_key_caching wpa-proactive-key-caching + + wpa_cli_do "$IF_WPA_PAC_FILE" ascii \ + set_network pac_file wpa-pac-file + + wpa_cli_do "$IF_WPA_PEERKEY" raw \ + set_network peerkey wpa-peerkey + + wpa_cli_do "$IF_FRAGMENT_SIZE" raw \ + set_network fragment_size wpa-fragment-size + + wpa_cli_do "$IF_WPA_ID_STR" ascii \ + set_network id_str wpa-id-str + + wpa_cli_do "$WPA_ID" raw \ + enable_network "enabling network block" + fi +} + +##################################################################### +## Log wpa_cli environment variables +wpa_log_env () { + wpa_msg log "WPA_IFACE=$WPA_IFACE WPA_ACTION=$WPA_ACTION" + wpa_msg log "WPA_ID=$WPA_ID WPA_ID_STR=$WPA_ID_STR WPA_CTRL_DIR=$WPA_CTRL_DIR" +} + +##################################################################### +## hysteresis checking +# Networking tools such as dhcp clients used with ifupdown can +# synthesize artificial ACTION events, particularly just after a +# DISCONNECTED/CONNECTED events are experienced in quick succession. +# This can lead to infinite event loops, and in extreme cases has the +# potential to cause system instability. +# +wpa_hysteresis_event () { + echo "$(date +%s)" > "$WPA_CLI_TIMESTAMP" 2>/dev/null +} + +wpa_hysteresis_check () { + if [ -f "$WPA_CLI_TIMESTAMP" ]; then + local TIME + local TIMESTAMP + local TIMEWAIT + TIME=$(date +%s) + # current time minus 4 second event buffer + TIMEWAIT=$(($TIME-4)) + # get time of last event + TIMESTAMP=$(cat $WPA_CLI_TIMESTAMP) + # compare values, allowing new action to be processed + # only if last action was more than 4 seconds ago + if [ "$TIMEWAIT" -le "$TIMESTAMP" ]; then + wpa_msg log "$WPA_ACTION event blocked by hysteresis check" + return 1 + fi + fi + + return 0 +} + +##################################################################### +## ifupdown locking functions +# A collection of rudimentary locking functions to lock ifup/ifdown +# actions. +# + +ifupdown_lock () { + ln -s lock "$WPA_CLI_IFUPDOWN" +} + +ifupdown_locked () { + [ -L "$WPA_CLI_IFUPDOWN" ] && return 0 + + return 1 +} + +ifupdown_unlock () { + rm -f "$WPA_CLI_IFUPDOWN" +} + +##################################################################### +## apply mapping logic and ifup logical interface +# Apply mapping logic via id_str or external mapping script, check +# state of IFACE with respect to ifupdown and ifup logical interaface +# +ifup () { + local INTERFACES_FILE + local IFSTATE_FILE + local IFUP_RETVAL + local WPA_LOGICAL_IFACE + + if [ -e /etc/network/interfaces ]; then + INTERFACES_FILE="/etc/network/interfaces" + else + wpa_msg log "/etc/network/interfaces does not exist, $WPA_IFACE will not be configured" + return 1 + fi + + if [ -e /etc/network/run/ifstate ]; then + # debian's ifupdown + IFSTATE_FILE="/etc/network/run/ifstate" + elif [ -e /run/network/ifstate ]; then + # ubuntu's + IFSTATE_FILE="/run/network/ifstate" + else + unset IFSTATE_FILE + fi + + if [ -z "$IF_WPA_MAPPING_SCRIPT_PRIORITY" ] && [ -n "$WPA_ID_STR" ]; then + WPA_LOGICAL_IFACE="$WPA_ID_STR" + fi + + if [ -z "$WPA_LOGICAL_IFACE" ] && [ -n "$IF_WPA_MAPPING_SCRIPT" ]; then + local WPA_MAP_STDIN + + WPA_MAP_STDIN=$(set | sed -n 's/^\(IF_WPA_MAP[0-9]*\)=.*/echo \$\1/p') + + if [ -n "$WPA_MAP_STDIN" ]; then + WPA_LOGICAL_IFACE=$(eval "$WPA_MAP_STDIN" | "$IF_WPA_MAPPING_SCRIPT" "$WPA_IFACE") + else + WPA_LOGICAL_IFACE=$("$IF_WPA_MAPPING_SCRIPT" "$WPA_IFACE") + fi + + if [ -n "$WPA_LOGICAL_IFACE" ]; then + wpa_msg log "mapping script result: $WPA_LOGICAL_IFACE" + else + wpa_msg log "mapping script failed." + fi + fi + + if [ -z "$WPA_LOGICAL_IFACE" ]; then + if [ -n "$IF_WPA_ROAM_DEFAULT_IFACE" ]; then + WPA_LOGICAL_IFACE="$IF_WPA_ROAM_DEFAULT_IFACE" + else + WPA_LOGICAL_IFACE="default" + fi + fi + + if [ -n "$WPA_LOGICAL_IFACE" ]; then + if egrep -q "^iface[[:space:]]+${WPA_LOGICAL_IFACE}[[:space:]]+inet" "$INTERFACES_FILE"; then + : # logical network is defined + else + wpa_msg log "network settings not defined for $WPA_LOGICAL_IFACE in $INTERFACES_FILE" + WPA_LOGICAL_IFACE="default" + fi + + wpa_msg log "ifup $WPA_IFACE=$WPA_LOGICAL_IFACE" + + ifupdown_lock + + if [ -n "$IFSTATE_FILE" ] && grep -q "^$WPA_IFACE=$WPA_IFACE" "$IFSTATE_FILE"; then + # Force settings over the unconfigured "master" IFACE + /sbin/ifup -v --force "$WPA_IFACE=$WPA_LOGICAL_IFACE" + else + /sbin/ifup -v "$WPA_IFACE=$WPA_LOGICAL_IFACE" + fi + IFUP_RETVAL="$?" + + ifupdown_unlock + fi + + if [ -d "${WPA_SUP_OMIT_DIR}" ]; then + wpa_msg log "creating sendsigs omission pidfile: $WPA_SUP_OMIT_PIDFILE" + cat "$WPA_SUP_PIDFILE" > "$WPA_SUP_OMIT_PIDFILE" + fi + + return "$IFUP_RETVAL" +} + +##################################################################### +## ifdown IFACE +# Check IFACE state and ifdown as requested. +# +ifdown () { + wpa_msg log "ifdown $WPA_IFACE" + + ifupdown_lock + + /sbin/ifdown -v "$WPA_IFACE" + + ifupdown_unlock + + wpa_msg log "removing sendsigs omission pidfile: $WPA_SUP_OMIT_PIDFILE" + rm -f "$WPA_SUP_OMIT_PIDFILE" +} + +##################################################################### +## keep IFACE scanning +# After ifdown, the IFACE may be left "down", and inhibits +# wpa_supplicant's ability to continue roaming. +# +# NB: use iproute if present, flushing the IFACE first +# +if_post_down_up () { + if [ -x /bin/ip ]; then + ip addr flush dev "$WPA_IFACE" 2>/dev/null + ip link set "$WPA_IFACE" up + else + ifconfig "$WPA_IFACE" up + fi +} diff --git a/firmware/ori/board/pluto/overlay/etc/wpa_supplicant/ifupdown.sh b/firmware/ori/board/pluto/overlay/etc/wpa_supplicant/ifupdown.sh new file mode 100755 index 0000000..2c5b060 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/etc/wpa_supplicant/ifupdown.sh @@ -0,0 +1,172 @@ +#!/bin/sh + +##################################################################### +## Purpose +# This file is executed by ifupdown in pre-up, post-up, pre-down and +# post-down phases of network interface configuration. It allows +# ifup(8), and ifdown(8) to manage wpa_supplicant(8) and wpa_cli(8) +# processes running in daemon mode. +# +# /etc/wpa_supplicant/functions.sh is sourced by this file. +# +# This file is provided by the wpasupplicant package. + +##################################################################### +# Copyright (C) 2006 - 2009 Debian/Ubuntu wpasupplicant Maintainers +# +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# On Debian GNU/Linux systems, the text of the GPL license, +# version 2, can be found in /usr/share/common-licenses/GPL-2. + +if [ -n "$IF_WPA_MAINT_DEBUG" ]; then + set -x +fi + +# quit if we're called for the loopback +if [ "$IFACE" = lo ]; then + exit 0 +fi + +# allow wpa_supplicant interface to be specified via wpa-iface +# useful for starting wpa_supplicant on one interface of a bridge +if [ -n "$IF_WPA_IFACE" ]; then + WPA_IFACE="$IF_WPA_IFACE" +else + WPA_IFACE="$IFACE" +fi + +# source functions +if [ -f /etc/wpa_supplicant/functions.sh ]; then + . /etc/wpa_supplicant/functions.sh +else + exit 0 +fi + +# quit if executables are not installed +if [ ! -x "$WPA_SUP_BIN" ] || [ ! -x "$WPA_CLI_BIN" ]; then + exit 0 +fi + +do_start () { + if test_wpa_cli; then + # if wpa_action is active for this IFACE, do nothing + ifupdown_locked && exit 0 + + # if the administrator is calling ifup, say something useful + if [ "$PHASE" = "pre-up" ]; then + wpa_msg stderr "wpa_action is managing ifup/ifdown state of $WPA_IFACE" + wpa_msg stderr "execute \`ifdown --force $WPA_IFACE' to stop wpa_action" + fi + exit 1 + elif ! set | grep -q "^IF_WPA"; then + # no wpa- option defined for IFACE, do nothing + exit 0 + fi + + # ensure stale ifupdown_lock marker is purged + ifupdown_unlock + + # preliminary sanity checks for roaming daemon + if [ -n "$IF_WPA_ROAM" ]; then + if [ "$METHOD" != "manual" ]; then + wpa_msg stderr "wpa-roam can only be used with the \"manual\" inet METHOD" + exit 1 + fi + if [ -n "$IF_WPA_MAPPING_SCRIPT" ]; then + if ! type "$IF_WPA_MAPPING_SCRIPT" >/dev/null; then + wpa_msg stderr "wpa-mapping-script \"$IF_WPA_MAPPING_SCRIPT\" is not valid" + exit 1 + fi + fi + if [ -n "$IF_WPA_MAPPING_SCRIPT_PRIORITY" ] && [ -z "$IF_WPA_MAPPING_SCRIPT" ]; then + wpa_msg stderr "\"wpa-mapping-script-priority 1\" is invalid without a wpa-mapping-script" + exit 1 + fi + IF_WPA_CONF="$IF_WPA_ROAM" + WPA_ACTION_SCRIPT="/sbin/wpa_action" + fi + + # master function; determines if ifupdown.sh should do something or not + if [ -n "$IF_WPA_CONF" ] && [ "$IF_WPA_CONF" != "managed" ]; then + if [ ! -s "$IF_WPA_CONF" ]; then + wpa_msg stderr "cannot read contents of $IF_WPA_CONF" + exit 1 + fi + WPA_SUP_CONF_CTRL_DIR=$(sed -n -e 's/[[:space:]]*#.*//g' -e 's/[[:space:]]\+.*$//g' \ + -e 's/^ctrl_interface=\(DIR=\)\?\(.*\)/\2/p' "$IF_WPA_CONF") + if [ -n "$WPA_SUP_CONF_CTRL_DIR" ]; then + WPA_CTRL_DIR="$WPA_SUP_CONF_CTRL_DIR" + WPA_SUP_CONF="-c $IF_WPA_CONF" + else + # specify the default ctrl_interface since none was defined in + # the given IF_WPA_CONF + WPA_SUP_CONF="-c $IF_WPA_CONF -C $WPA_CTRL_DIR" + fi + else + # specify the default ctrl_interface + WPA_SUP_CONF="-C $WPA_CTRL_DIR" + fi +} + +do_stop () { + if test_wpa_cli; then + # if wpa_action is active for this IFACE and calling ifdown, + # do nothing + ifupdown_locked && exit 0 + elif test_wpa_supplicant; then + # wpa_supplicant process exists for this IFACE, but wpa_cli + # process does not. Allow stop mode to kill this process. + : + else + exit 0 + fi +} + +case "$MODE" in + start) + do_start + case "$PHASE" in + pre-up) + kill_wpa_supplicant + init_wpa_supplicant || exit 1 + conf_wpa_supplicant || { kill_wpa_supplicant; exit 1; } + ;; + post-up) + init_wpa_cli || { kill_wpa_supplicant; exit 1; } + ;; + esac + ;; + + stop) + do_stop + case "$PHASE" in + pre-down) + kill_wpa_cli + ;; + post-down) + kill_wpa_supplicant + ;; + *) + wpa_msg stderr "unknown phase: \"$PHASE\"" + exit 1 + ;; + esac + ;; + + *) + wpa_msg stderr "unknown mode: \"$MODE\"" + exit 1 + ;; +esac + +exit 0 diff --git a/firmware/ori/board/pluto/overlay/root/.ssh/authorized_keys b/firmware/ori/board/pluto/overlay/root/.ssh/authorized_keys new file mode 100644 index 0000000..1f6203c --- /dev/null +++ b/firmware/ori/board/pluto/overlay/root/.ssh/authorized_keys @@ -0,0 +1 @@ +ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBD4Nvk8kjuR999elP76i+bOuSZx69/tAAJIQmh1uB8spoDITyWCLRPaDr7Tu+U8moTaIPgxnUf3CcW45cJ8pSzs= linuxdev@linuxdev-labo diff --git a/firmware/ori/board/pluto/overlay/root/fwhistory.txt b/firmware/ori/board/pluto/overlay/root/fwhistory.txt new file mode 100644 index 0000000..2607012 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/root/fwhistory.txt @@ -0,0 +1,59 @@ +b3406b7 - Mon Jul 22 22:30:47 2024 +0200 : Add firmware submodules +942aa51 - Mon Jul 22 19:35:30 2024 +0000 : Update README.md +4c0ea7c - Mon Jul 22 19:11:04 2024 +0000 : Update README.md +a75fd44 - Mon Jul 22 19:06:30 2024 +0000 : Update README.md +c3e8a2c - Mon Jul 22 19:04:19 2024 +0000 : Update README.md +304af0e - Mon Jul 22 18:51:40 2024 +0000 : Update README.md +31fb9de - Mon Jul 22 13:26:26 2024 +0200 : Fix library include path +836102f - Mon Jul 22 12:25:38 2024 +0200 : Update README.md - TYpo +e043cd3 - Mon Jul 22 12:23:49 2024 +0200 : Add building direction to readme +a142ad6 - Mon Jul 22 12:14:01 2024 +0200 : Test hdl submodule +5a74c41 - Mon Jul 22 12:04:18 2024 +0200 : First local working out of tree library +bf446b4 - Sun Jul 21 23:14:18 2024 +0200 : Initial out of tree trial +c2167a2 - Thu Jul 18 04:19:26 2024 +0000 : Updated README.md +cfc37a6 - Wed Jul 17 18:36:09 2024 -0600 : Add README.md +71d0357 - Wed Jul 17 23:38:25 2024 +0000 : add submodules +c39d1f6 - Wed Jul 17 23:12:36 2024 +0000 : Create LICENSE.md +eb1fe92 - Wed Jul 17 22:37:29 2024 +0000 : add .gitignore +bf02ccd - Sun Jul 7 10:51:08 2024 -0600 : Update status register addition due to Vivado complaint +f954254 - Sun Jul 7 01:21:12 2024 -0600 : Add PRBS modules to msk_top +fce0ec0 - Sat Jul 6 01:14:50 2024 -0600 : Re-factor AXI interface, and add status readback for confirming operation in the FPGA +4e07e2f - Sun Jun 30 00:28:05 2024 -0600 : Improve config/status registers clock domain crossings +0e79c6a - Sat Jun 29 17:37:58 2024 -0600 : Added HASH_ID generic, updated register addresses, added HASH_ID readback, updated S-AXI readlogic +74b7ea1 - Sat Jun 29 15:41:05 2024 -0600 : Add conditional compile flag for GHDL +eb3e7e7 - Mon Jun 17 14:18:11 2024 -0600 : Update s-axis signal names +8bbfabb - Mon Jun 17 13:01:51 2024 -0600 : Add s_axi_awport and s_axi_arprot ports to entity +42d73ea - Thu Jun 13 02:10:04 2024 -0600 : Changed entity name for pi_controller and updated files where used +652df44 - Wed Jun 12 20:45:27 2024 -0600 : Update simulation +00f79ae - Wed Jun 12 19:41:09 2024 -0600 : Added enable/valid signals as a clock enable to all clocked processes; also made updated to serial to parallel converter. There is still an issue in this block, but works if initial state is aligned with transmitter. +3b204d6 - Tue Jun 11 00:41:41 2024 -0600 : Add header, license, copyright, comment blocks to all HDL source files. +6107ef4 - Mon Jun 10 20:34:50 2024 -0600 : Add DrawIO drawings for Tx Chain +07d0eb4 - Mon Jun 10 20:33:52 2024 -0600 : Simulation updates +9e4f0e2 - Mon Jun 10 20:32:13 2024 -0600 : Update MSK Top and Demodulator to use enable from axi_ad9361 and update rx_valid for data output to rx_dvalid and use rx_svalid for rx sample input valid. +216f01b - Mon Jun 10 19:15:52 2024 -0600 : Made tx data width configurable, number of bits on s-axis-data +e4617d4 - Mon Jun 10 18:20:09 2024 -0600 : Updated top-level ports +6bab9be - Mon May 20 15:21:07 2024 -0600 : Add timing diagrams for Tx interface +ab184d2 - Mon May 20 15:18:53 2024 -0600 : Updated MSK Top-Level diagram +d286645 - Mon May 20 15:18:31 2024 -0600 : Update for msk_math.md +bc1984b - Mon May 20 15:18:00 2024 -0600 : Updated simulation to use AXI-S for data and AXI for configuration +d0d41b9 - Mon May 20 15:16:05 2024 -0600 : Added AXI-S interface to Tx; added AXI for configuration/status; Added configuration registers; Added Tx Par2Ser converter. +ea3314a - Sat May 18 21:37:27 2024 -0600 : Simulaton updates +2e44064 - Sat May 18 01:42:51 2024 -0600 : Inverted data check, as in latest simulation data output is inverted +74ee8c3 - Sat May 18 01:40:49 2024 -0600 : Simulation updates +38e161e - Fri May 17 23:16:15 2024 -0600 : Add PTT for modulator; remove modulating multiplier and replace with mux +b4f767c - Thu May 16 20:31:33 2024 -0600 : Update simulation +5067594 - Thu May 16 20:30:58 2024 -0600 : Add Lyx file for MSK math +925380a - Thu May 16 20:26:34 2024 -0600 : Update configuration inputs, add loopback_ena signal and mux. +0dc6f0d - Fri May 10 01:07:01 2024 -0600 : Remove tclk from msk_top and adjust data latency for matching +c0ecc59 - Fri May 10 01:04:38 2024 -0600 : Math document update +4de0ce4 - Fri May 10 01:04:15 2024 -0600 : Simulation updates +429dc38 - Thu May 9 00:18:40 2024 -0600 : Update msk_top block diagram +b9d08df - Wed May 8 12:29:08 2024 -0600 : Add Drawio diagrams (and pngs) to docs +d0819ff - Wed May 8 12:28:00 2024 -0600 : Simulation updates +4cb31ce - Mon May 6 14:28:06 2024 -0600 : Simulation updates +ebfdfe7 - Mon May 6 14:21:16 2024 -0600 : Initial commits for documentation and diagrams +bce8101 - Mon May 6 14:18:35 2024 -0600 : Add GNU Radio files for reference +3c86946 - Mon May 6 14:14:06 2024 -0600 : Initial MSK Simulation commit +a622f7b - Mon May 6 14:12:48 2024 -0600 : Housekeeping +f7503c3 - Mon May 6 13:57:13 2024 -0600 : Updates to MSK Top-level for Massey modulator +8c6da46 - Mon May 6 00:05:15 2024 -0600 : Initial commit for MSK top-level using modulator s(t) = Icoscos + Qsinsin approach. \ No newline at end of file diff --git a/firmware/ori/board/pluto/overlay/root/regs.sh b/firmware/ori/board/pluto/overlay/root/regs.sh new file mode 100755 index 0000000..7e04d4b --- /dev/null +++ b/firmware/ori/board/pluto/overlay/root/regs.sh @@ -0,0 +1,87 @@ + + +print_status () { + name=$1 + base_addr=$2 + word_width=$3 + + if [ -z "$word_width" ]; then + word_width=1 + fi + + frame_count=$(devmem $((base_addr + 4))) + + last_frame_lenght=$(devmem $((base_addr + 8))) + + min_max=$(devmem $((base_addr + 12))) + max_length=$((min_max / 65536)) + min_length=$((min_max & 0xffff)) + + if [ "$max_length" = "0" ]; then + max_length="-" + max_length_bytes="-" + else + max_length=$(printf "%7d" $max_length) + max_length_bytes=$(printf "%7d" $((max_length * word_width))) + fi + + if [ "$min_length" = "65535" ]; then + min_length="-" + min_length_bytes="-" + else + min_length=$(printf "%7d" $min_length) + min_length_bytes=$(printf "%7d" $((min_length * word_width))) + fi + + word_count=$(devmem $((base_addr + 16))) + + strobes=$(devmem $((base_addr + 20))) + in_vld=$((strobes & 1)) + in_rdy=$(((strobes >> 1) & 1)) + out_vld=$(((strobes >> 2) & 1)) + out_rdy=$(((strobes >> 3) & 1)) + + printf "%015s |" "$name" + printf "%10d |" "$frame_count" + printf "%7d beats / %7d bytes |" "$last_frame_lenght" $((last_frame_lenght * word_width)) + printf "%7s / %7s |" "$min_length" "$min_length_bytes" + printf "%7s / %7s |" "$max_length" "$max_length_bytes" + printf "%7d / %8d |" "$word_count" "$((word_count * word_width))" + printf "%7d |" $in_vld + printf "%7d |" $in_rdy + printf "%8d |" $out_vld + printf "%8d" $out_rdy + printf "\n" +} + +print_ldpc_fifo_status () { + status=$(devmem 0x43c10004) + entries=$((status & 0x3fff)) + empty=$(((status >> 16) & 1)) + full=$(((status >> 17) & 1)) + printf "LDPC FIFO: " + printf "entries: %d, " $entries + printf "empty: %d, " $empty + printf "full: %d" $full +} + + +printf "Frames in flight: %d" "$(devmem 0x43c10008)" + +print_ldpc_fifo_status + +printf "%015s |" "Waypoint" +printf "%010s |" "Frames" +printf " Last frame length |" +printf " From |" +printf " To |" +printf " Pending |" +printf " in_vld | in_rdy | out_vld | out_rdy\n" + +print_status "input" 0x43C10D00 1 +print_status "BB scrambler" 0x43C10E00 1 +print_status "BCH encoder" 0x43C10F00 1 +print_status "LDPC encoder" 0x43C11000 1 +print_status "Bit interleaver" 0x43C11100 1 +print_status "plframe" 0x43C11200 4 +print_status "output" 0x43C11300 4 diff --git a/firmware/ori/board/pluto/overlay/root/spy_external_sdr.sh b/firmware/ori/board/pluto/overlay/root/spy_external_sdr.sh new file mode 100755 index 0000000..d2100b2 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/root/spy_external_sdr.sh @@ -0,0 +1,6 @@ +while : +do +change=$(inotifywait -e modify --format "%w/%f" /sys/bus/iio/devices/iio\:device*) 2>/dev/null +value=$(cat $change) +printf "ExternSDR: %s -> %s\n" "$change" "$value" +done diff --git a/firmware/ori/board/pluto/overlay/root/update_bitstream.sh b/firmware/ori/board/pluto/overlay/root/update_bitstream.sh new file mode 100755 index 0000000..11cd3b0 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/root/update_bitstream.sh @@ -0,0 +1,25 @@ +echo "unbind FPGA" +echo 79020000.cf-ad9361-lpc > /sys/bus/platform/drivers/cf_axi_adc/unbind +echo 79024000.cf-ad9361-dds-core-lpc > /sys/bus/platform/drivers/cf_axi_dds/unbind +echo 7c400000.dma > /sys/bus/platform/drivers/dma-axi-dmac/unbind +echo 7c420000.dma > /sys/bus/platform/drivers/dma-axi-dmac/unbind +sleep 1 + +echo "Flash bitstream $1" +echo 0 > /sys/class/fpga_manager/fpga0/flags +cp $1 /lib/firmware +echo $1 > /sys/class/fpga_manager/fpga0/firmware +sleep 1 + +echo "bind FPGA" +echo 7c420000.dma > /sys/bus/platform/drivers/dma-axi-dmac/bind +echo 7c400000.dma > /sys/bus/platform/drivers/dma-axi-dmac/bind +echo 79024000.cf-ad9361-dds-core-lpc > /sys/bus/platform/drivers/cf_axi_dds/bind +echo 79020000.cf-ad9361-lpc > /sys/bus/platform/drivers/cf_axi_adc/bind + +echo restart iiod +#dirty cause S23 restart doesn't work ) +(killall iiod && /etc/init.d/S23udc start) & + + + diff --git a/firmware/ori/board/pluto/overlay/root/update_frm_reboot.sh b/firmware/ori/board/pluto/overlay/root/update_frm_reboot.sh new file mode 100755 index 0000000..d3240b4 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/root/update_frm_reboot.sh @@ -0,0 +1,2 @@ +update_frm.sh $1 +reboot diff --git a/firmware/ori/board/pluto/overlay/usr/sbin/device_reboot b/firmware/ori/board/pluto/overlay/usr/sbin/device_reboot new file mode 100755 index 0000000..1134b2a --- /dev/null +++ b/firmware/ori/board/pluto/overlay/usr/sbin/device_reboot @@ -0,0 +1,32 @@ +#!/bin/sh + +case "$1" in + ram) + cause=7 + ;; + sf) + cause=3 + ;; + verbose) + cause=6 + ;; + break) + cause=2 + ;; + reset) + cause=0 + ;; + + *) + echo "Usage: $0 {ram|sf|reset|verbose|break}" + echo " sf : Reboot and enter Serial Flash DFU mode" + echo " ram : Reboot and enter RAM DFU mode" + echo " reset : Reboot" + echo " verbose: Reboot and start serial console Verbose" + echo " break : Reboot and HALT in u-boot" + exit 1 +esac + +echo $cause > /sys/kernel/debug/zynq_rst/code && /sbin/reboot + +exit 0 diff --git a/firmware/ori/board/pluto/overlay/usr/sbin/pluto_cli.sh b/firmware/ori/board/pluto/overlay/usr/sbin/pluto_cli.sh new file mode 100755 index 0000000..c18441e --- /dev/null +++ b/firmware/ori/board/pluto/overlay/usr/sbin/pluto_cli.sh @@ -0,0 +1,166 @@ +#!/bin/sh + + + + +function get_status () { + +cd /sys/bus/iio/devices/iio\:device1 + + echo " ****** RX ******" + echo "Freq : " $(cat out_altvoltage0_RX_LO_frequency) + echo "Samplerate : " $(cat in_voltage_sampling_frequency) + echo "BW : " $(cat in_voltage_rf_bandwidth) + echo "Gain : " $(cat in_voltage0_hardwaregain) " ("$(cat in_voltage0_gain_control_mode)" mode)" + echo "RSSI : " $(cat in_voltage0_rssi) + echo + echo + echo " ****** TX ******" + echo "Freq : " $(cat out_altvoltage1_TX_LO_frequency) + echo "Samplerate : " $(cat out_voltage_sampling_frequency) + echo "BW : " $(cat out_voltage_rf_bandwidth) + echo "Att. : " $(cat out_voltage0_hardwaregain) + echo + echo +#echo $status +#reset +} + + + +function display_cmds () { +echo " +*** ADALM-Pluto remote control +*** LamaBleu 05/2019 + + Pluto listener commands : + ----------------------- + +F 123456789 : set frequency (RX/TX) +BW : set Bandwidth (RX/TX) +SR : set Samplerate (RX/TX) +TXF : set TX frequency +TXBW : set TX bandwidth +TXGAIN [-89:0] : set TX attenuation ( 0 = max power) +RXF : set RX frequency +RXBW : set RX bandwidth +RXGAIN [0-73]: set RX gain +S : display status +H : display commands list +X or Q : disconnect +KK : disconnect and KILL server +" + +} + +display_cmds +get_status + + +#while true; do + +while : +do +command="" +freq="" +pluto_com="" +arg1="" +power="" +mode="" + +echo -n "Command : " +read pluto_com +reset +command=$(echo $pluto_com | awk '{print $1}') +arg1=$(echo $pluto_com | awk '{print $2}') +#arg1=${arg1//[![:digit:]]} +#echo $command + +echo +case $command in + F) echo " **** set Frequency $arg1" + if [ -z "$arg1" ]; then echo "**** noarg !"; fi + echo $arg1 + echo + /usr/bin/iio_attr -q -c ad9361-phy altvoltage1 frequency $((arg1)) 1>/dev/null + /usr/bin/iio_attr -q -c ad9361-phy altvoltage0 frequency $((arg1)) 1>/dev/null + get_status; + ;; + [XxQq]) echo " **** DISCONNECT " + echo " Goodbye. " + exit 0; + ;; + [Ss]) get_status; + ;; + [Hh]) display_cmds; + ;; + KK) echo "Disconnect and kill server - Goodbye forever !" + sudo killall socat + exit 0; + ;; + BW ) if [ -z "$arg1" ]; then echo "**** noarg !"; fi + echo " **** set TX/RX Bandwidth $arg1 " + echo + iio_attr -q -c ad9361-phy voltage0 rf_bandwidth $((arg1)) 1>/dev/null + get_status; + ;; + TXF ) echo " **** set TX Frequency $arg1" + if [ -z "$arg1" ]; then echo "**** noarg !"; fi + echo + sleep 1 + /usr/bin/iio_attr -q -c ad9361-phy altvoltage1 frequency $((arg1)) 1>/dev/null + get_status; + ;; + TXBW ) if [ -z "$arg1" ]; then echo "**** noarg !"; fi + echo " **** set TX Bandwidth $arg1 " + echo + iio_attr -q -c -o ad9361-phy voltage0 rf_bandwidth $((arg1)) 1>/dev/null + get_status; + ;; + TXGAIN ) echo " **** set TX attenuation $arg1" + echo + /usr/bin/iio_attr -q -c -o ad9361-phy voltage0 hardwaregain $((arg1)) 1>/dev/null + get_status; + ;; + RXF ) echo " **** set RX Frequency $arg1" + if [ -z "$arg1" ]; then echo "noarg"; fi + echo $arg1 + sleep 1 + /usr/bin/iio_attr -q -c ad9361-phy altvoltage0 frequency $((arg1)) 1>/dev/null + get_status; + ;; + RXBW ) if [ -z "$arg1" ]; then echo "**** noarg !"; fi + echo " **** set RX Bandwidth $arg1 " + echo + iio_attr -q -c -i ad9361-phy voltage0 rf_bandwidth $((arg1)) 1>/dev/null + get_status; + ;; + RXGAIN ) echo " **** set RX gain $arg1" + echo + /usr/bin/iio_attr -q -c -i ad9361-phy voltage0 gain_control_mode manual 1>/dev/null + /usr/bin/iio_attr -q -c -i ad9361-phy voltage0 hardwaregain $((arg1)) 1>/dev/null + get_status; + ;; + SR) echo " **** set TX/RX Samplerate $arg1" + /usr/bin/iio_attr -q -c ad9361-phy voltage0 sampling_frequency $((arg1)) 1>/dev/null + get_status; + ;; + f ) freq=$(/usr/bin/iio_attr -q -c ad9361-phy altvoltage0 frequency) 1>/dev/null + echo " **** Frequency : $freq" + ;; + *) command="" + echo "*** error 404 !" + freq="" + arg1="" + #get_status; + ;; +esac + + +command="" +freq="" +#pluto_com="" +arg1="" + +done + diff --git a/firmware/ori/board/pluto/overlay/usr/sbin/pluto_reboot b/firmware/ori/board/pluto/overlay/usr/sbin/pluto_reboot new file mode 120000 index 0000000..bea999e --- /dev/null +++ b/firmware/ori/board/pluto/overlay/usr/sbin/pluto_reboot @@ -0,0 +1 @@ +device_reboot \ No newline at end of file diff --git a/firmware/ori/board/pluto/overlay/usr/sbin/test_ensm_pinctrl.sh b/firmware/ori/board/pluto/overlay/usr/sbin/test_ensm_pinctrl.sh new file mode 100755 index 0000000..963b22e --- /dev/null +++ b/firmware/ori/board/pluto/overlay/usr/sbin/test_ensm_pinctrl.sh @@ -0,0 +1,130 @@ +#!/bin/sh + +find_zynq_base_gpio () { + for i in /sys/class/gpio/gpiochip*; do + if [ "zynq_gpio" = `cat $i/label` ]; then + echo $i | sed 's/^[^0-9]\+//' + break + fi + done + return -1 +} + +fdd_pin_control_test () { + echo Running FDD Pin Control Test + while true; do + echo high > $ENABLE # RX&TX ON + + sleep 1 + + echo low > $ENABLE # RX&TX OFF + + sleep 1 + + done +} + +fdd_independant_mode_pin_control_test () { + echo Running FDD Independant Pin Control Test + while true; do + echo high > $ENABLE # RX ON + echo low > $TXNRX # TX OFF + + sleep 1 + + echo high > $TXNRX #TX ON + + sleep 1 + + done +} + +tdd_pin_control_test () { + + echo Running TDD Pin Control Test + while true; do + + # RX + echo low > $ENABLE + echo low > $TXNRX + echo low > $TXNRX # add some extra delay required for VCO cal in single synthesizer mode. + echo high > $ENABLE + + sleep 1 + + # TX + echo low > $ENABLE + echo high > $TXNRX + echo high > $TXNRX # add some extra delay required for VCO cal in single synthesizer mode. + echo high > $ENABLE + + sleep 1 + done +} + +if [ `id -u` != "0" ] +then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +for i in $(find -L /sys/bus/iio/devices -maxdepth 2 -name name) +do + dev_name=$(cat $i) + if [ "$dev_name" = "ad9361-phy" ]; then + phy_path=$(echo $i | sed 's:/name$::') + ensm_modes=$(cat $phy_path/ensm_mode_available) + break + fi +done + +if [ "$dev_name" != "ad9361-phy" ]; then + echo "This test if for FMCOMMS2/3/4 and pluto only" + exit +fi + +GPIO_BASE=$(find_zynq_base_gpio) + +cd /sys/class/gpio + +if [ $GPIO_BASE -ge 0 ] +then + GPIO_ENABLE=`expr $GPIO_BASE + 69` + GPIO_TXNRX=`expr $GPIO_BASE + 70` + #Export the CTRL_IN GPIOs + echo $GPIO_ENABLE > export 2> /dev/null + echo $GPIO_TXNRX > export 2> /dev/null +else + echo ERROR: Wrong board? + exit +fi + +ENABLE=gpio${GPIO_ENABLE}/direction +TXNRX=gpio${GPIO_TXNRX}/direction + +echo low > $ENABLE +echo low > $TXNRX + +echo Press CTRL-C to exit + +case "$ensm_modes" in + *fdd*) + echo "Type: 0 for FDD Pin Control Mode" + echo "Type: 1 for FDD Independant Pin Control Mode" + + read mode + + if [ $mode = "1" ]; then + echo pinctrl_fdd_indep > $phy_path/ensm_mode #Enable Pincontrol Mode + fdd_independant_mode_pin_control_test + else + echo pinctrl > $phy_path/ensm_mode #Enable Pincontrol Mode + fdd_pin_control_test + fi + + ;; + *rx*) + echo pinctrl > $phy_path/ensm_mode #Enable Pincontrol Mode + tdd_pin_control_test + ;; +esac diff --git a/firmware/ori/board/pluto/overlay/www/colormap.js b/firmware/ori/board/pluto/overlay/www/colormap.js new file mode 100644 index 0000000..2893160 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/www/colormap.js @@ -0,0 +1,8 @@ +var turbo = [[48, 18, 59], [50, 21, 67], [51, 24, 74], [52, 27, 81], [53, 30, 88], [54, 33, 95], [55, 36, 102], [56, 39, 109], [57, 42, 115], [58, 45, 121], [59, 47, 128], [60, 50, 134], [61, 53, 139], [62, 56, 145], [63, 59, 151], [63, 62, 156], [64, 64, 162], [65, 67, 167], [65, 70, 172], [66, 73, 177], [66, 75, 181], [67, 78, 186], [68, 81, 191], [68, 84, 195], [68, 86, 199], [69, 89, 203], [69, 92, 207], [69, 94, 211], [70, 97, 214], [70, 100, 218], [70, 102, 221], [70, 105, 224], [70, 107, 227], [71, 110, 230], [71, 113, 233], [71, 115, 235], [71, 118, 238], [71, 120, 240], [71, 123, 242], [70, 125, 244], [70, 128, 246], [70, 130, 248], [70, 133, 250], [70, 135, 251], [69, 138, 252], [69, 140, 253], [68, 143, 254], [67, 145, 254], [66, 148, 255], [65, 150, 255], [64, 153, 255], [62, 155, 254], [61, 158, 254], [59, 160, 253], [58, 163, 252], [56, 165, 251], [55, 168, 250], [53, 171, 248], [51, 173, 247], [49, 175, 245], [47, 178, 244], [46, 180, 242], [44, 183, 240], [42, 185, 238], [40, 188, 235], [39, 190, 233], [37, 192, 231], [35, 195, 228], [34, 197, 226], [32, 199, 223], [31, 201, 221], [30, 203, 218], [28, 205, 216], [27, 208, 213], [26, 210, 210], [26, 212, 208], [25, 213, 205], [24, 215, 202], [24, 217, 200], [24, 219, 197], [24, 221, 194], [24, 222, 192], [24, 224, 189], [25, 226, 187], [25, 227, 185], [26, 228, 182], [28, 230, 180], [29, 231, 178], [31, 233, 175], [32, 234, 172], [34, 235, 170], [37, 236, 167], [39, 238, 164], [42, 239, 161], [44, 240, 158], [47, 241, 155], [50, 242, 152], [53, 243, 148], [56, 244, 145], [60, 245, 142], [63, 246, 138], [67, 247, 135], [70, 248, 132], [74, 248, 128], [78, 249, 125], [82, 250, 122], [85, 250, 118], [89, 251, 115], [93, 252, 111], [97, 252, 108], [101, 253, 105], [105, 253, 102], [109, 254, 98], [113, 254, 95], [117, 254, 92], [121, 254, 89], [125, 255, 86], [128, 255, 83], [132, 255, 81], [136, 255, 78], [139, 255, 75], [143, 255, 73], [146, 255, 71], [150, 254, 68], [153, 254, 66], [156, 254, 64], [159, 253, 63], [161, 253, 61], [164, 252, 60], [167, 252, 58], [169, 251, 57], [172, 251, 56], [175, 250, 55], [177, 249, 54], [180, 248, 54], [183, 247, 53], [185, 246, 53], [188, 245, 52], [190, 244, 52], [193, 243, 52], [195, 241, 52], [198, 240, 52], [200, 239, 52], [203, 237, 52], [205, 236, 52], [208, 234, 52], [210, 233, 53], [212, 231, 53], [215, 229, 53], [217, 228, 54], [219, 226, 54], [221, 224, 55], [223, 223, 55], [225, 221, 55], [227, 219, 56], [229, 217, 56], [231, 215, 57], [233, 213, 57], [235, 211, 57], [236, 209, 58], [238, 207, 58], [239, 205, 58], [241, 203, 58], [242, 201, 58], [244, 199, 58], [245, 197, 58], [246, 195, 58], [247, 193, 58], [248, 190, 57], [249, 188, 57], [250, 186, 57], [251, 184, 56], [251, 182, 55], [252, 179, 54], [252, 177, 54], [253, 174, 53], [253, 172, 52], [254, 169, 51], [254, 167, 50], [254, 164, 49], [254, 161, 48], [254, 158, 47], [254, 155, 45], [254, 153, 44], [254, 150, 43], [254, 147, 42], [254, 144, 41], [253, 141, 39], [253, 138, 38], [252, 135, 37], [252, 132, 35], [251, 129, 34], [251, 126, 33], [250, 123, 31], [249, 120, 30], [249, 117, 29], [248, 114, 28], [247, 111, 26], [246, 108, 25], [245, 105, 24], [244, 102, 23], [243, 99, 21], [242, 96, 20], [241, 93, 19], [240, 91, 18], [239, 88, 17], [237, 85, 16], [236, 83, 15], [235, 80, 14], [234, 78, 13], [232, 75, 12], [231, 73, 12], [229, 71, 11], [228, 69, 10], [226, 67, 10], [225, 65, 9], [223, 63, 8], [221, 61, 8], [220, 59, 7], [218, 57, 7], [216, 55, 6], [214, 53, 6], [212, 51, 5], [210, 49, 5], [208, 47, 5], [206, 45, 4], [204, 43, 4], [202, 42, 4], [200, 40, 3], [197, 38, 3], [195, 37, 3], [193, 35, 2], [190, 33, 2], [188, 32, 2], [185, 30, 2], [183, 29, 2], [180, 27, 1], [178, 26, 1], [175, 24, 1], [172, 23, 1], [169, 22, 1], [167, 20, 1], [164, 19, 1], [161, 18, 1], [158, 16, 1], [155, 15, 1], [152, 14, 1], [149, 13, 1], [146, 11, 1], [142, 10, 1], [139, 9, 2], [136, 8, 2], [133, 7, 2], [129, 6, 2], [126, 5, 2], [122, 4, 3]] +var fosphor = [[6, 0, 13], [7, 0, 14], [7, 0, 15], [7, 0, 16], [7, 0, 17], [7, 0, 18], [7, 0, 18], [7, 0, 19], [7, 0, 20], [7, 0, 21], [7, 0, 22], [7, 0, 23], [7, 0, 24], [7, 0, 25], [7, 0, 26], [6, 0, 27], [6, 0, 28], [6, 0, 29], [5, 0, 30], [5, 0, 31], [5, 0, 32], [4, 0, 33], [4, 0, 34], [3, 0, 35], [3, 0, 36], [2, 0, 36], [2, 0, 37], [1, 0, 38], [0, 0, 39], [0, 0, 40], [0, 1, 41], [0, 2, 42], [0, 3, 43], [0, 4, 44], [0, 5, 45], [0, 5, 46], [0, 6, 47], [0, 7, 48], [0, 8, 49], [0, 9, 50], [0, 10, 51], [0, 12, 52], [0, 13, 53], [0, 14, 54], [0, 15, 55], [0, 16, 56], [0, 18, 56], [0, 19, 57], [0, 20, 58], [0, 22, 59], [0, 23, 60], [0, 24, 61], [0, 26, 62], [0, 27, 63], [0, 29, 64], [0, 31, 65], [0, 32, 66], [0, 34, 67], [0, 36, 68], [0, 37, 69], [0, 39, 70], [0, 41, 71], [0, 43, 72], [0, 44, 73], [0, 46, 74], [0, 48, 74], [0, 50, 75], [0, 52, 76], [0, 54, 77], [0, 56, 78], [0, 58, 79], [0, 60, 80], [0, 63, 81], [0, 65, 82], [0, 67, 83], [0, 69, 84], [0, 71, 85], [0, 74, 86], [0, 76, 87], [0, 79, 88], [0, 81, 89], [0, 83, 90], [0, 86, 91], [0, 88, 92], [0, 91, 93], [0, 94, 94], [0, 94, 93], [0, 95, 92], [0, 96, 91], [0, 97, 90], [0, 98, 90], [0, 99, 89], [0, 100, 88], [0, 101, 87], [0, 102, 86], [0, 103, 85], [0, 104, 84], [0, 105, 83], [0, 106, 82], [0, 107, 80], [0, 108, 79], [0, 109, 78], [0, 110, 77], [0, 111, 75], [0, 112, 74], [0, 112, 73], [0, 113, 71], [0, 114, 70], [0, 115, 69], [0, 116, 67], [0, 117, 66], [0, 118, 64], [0, 119, 62], [0, 120, 61], [0, 121, 59], [0, 122, 57], [0, 123, 56], [0, 124, 54], [0, 125, 52], [0, 126, 50], [0, 127, 48], [0, 128, 47], [0, 129, 45], [0, 130, 43], [0, 131, 41], [0, 132, 39], [0, 132, 37], [0, 133, 35], [0, 134, 32], [0, 135, 30], [0, 136, 28], [0, 137, 26], [0, 138, 24], [0, 139, 21], [0, 140, 19], [0, 141, 17], [0, 142, 14], [0, 143, 12], [0, 144, 9], [0, 145, 7], [0, 146, 4], [0, 147, 2], [1, 148, 0], [3, 149, 0], [6, 150, 0], [9, 150, 0], [12, 151, 0], [14, 152, 0], [17, 153, 0], [20, 154, 0], [23, 155, 0], [26, 156, 0], [29, 157, 0], [32, 158, 0], [35, 159, 0], [38, 160, 0], [41, 161, 0], [44, 162, 0], [47, 163, 0], [50, 164, 0], [53, 165, 0], [57, 166, 0], [60, 167, 0], [63, 168, 0], [66, 169, 0], [70, 170, 0], [73, 170, 0], [77, 171, 0], [80, 172, 0], [84, 173, 0], [87, 174, 0], [91, 175, 0], [94, 176, 0], [98, 177, 0], [102, 178, 0], [105, 179, 0], [109, 180, 0], [113, 181, 0], [117, 182, 0], [120, 183, 0], [124, 184, 0], [128, 185, 0], [132, 186, 0], [136, 187, 0], [140, 188, 0], [144, 188, 0], [148, 189, 0], [152, 190, 0], [156, 191, 0], [161, 192, 0], [165, 193, 0], [169, 194, 0], [173, 195, 0], [178, 196, 0], [182, 197, 0], [186, 198, 0], [191, 199, 0], [195, 200, 0], [200, 201, 0], [202, 199, 0], [203, 197, 0], [204, 194, 0], [205, 191, 0], [206, 189, 0], [207, 186, 0], [208, 183, 0], [208, 180, 0], [209, 177, 0], [210, 174, 0], [211, 172, 0], [212, 169, 0], [213, 166, 0], [214, 163, 0], [215, 159, 0], [216, 156, 0], [217, 153, 0], [218, 150, 0], [219, 147, 0], [220, 144, 0], [221, 140, 0], [222, 137, 0], [223, 134, 0], [224, 130, 0], [225, 127, 0], [226, 123, 0], [226, 120, 0], [227, 116, 0], [228, 113, 0], [229, 109, 0], [230, 106, 0], [231, 102, 0], [232, 98, 0], [233, 95, 0], [234, 91, 0], [235, 87, 0], [236, 83, 0], [237, 79, 0], [238, 76, 0], [239, 72, 0], [240, 68, 0], [241, 64, 0], [242, 60, 0], [243, 56, 0], [244, 52, 0], [245, 47, 0], [246, 43, 0], [246, 39, 0], [247, 35, 0], [248, 31, 0], [249, 26, 0], [250, 22, 0], [251, 18, 0], [252, 13, 0], [253, 9, 0], [254, 4, 0], [255, 0, 0]] +var viridis = [[68, 1, 84], [68, 2, 86], [69, 4, 87], [69, 5, 89], [70, 7, 90], [70, 8, 92], [70, 10, 93], [70, 11, 94], [71, 13, 96], [71, 14, 97], [71, 16, 99], [71, 17, 100], [71, 19, 101], [72, 20, 103], [72, 22, 104], [72, 23, 105], [72, 24, 106], [72, 26, 108], [72, 27, 109], [72, 28, 110], [72, 29, 111], [72, 31, 112], [72, 32, 113], [72, 33, 115], [72, 35, 116], [72, 36, 117], [72, 37, 118], [72, 38, 119], [72, 40, 120], [72, 41, 121], [71, 42, 122], [71, 44, 122], [71, 45, 123], [71, 46, 124], [71, 47, 125], [70, 48, 126], [70, 50, 126], [70, 51, 127], [70, 52, 128], [69, 53, 129], [69, 55, 129], [69, 56, 130], [68, 57, 131], [68, 58, 131], [68, 59, 132], [67, 61, 132], [67, 62, 133], [66, 63, 133], [66, 64, 134], [66, 65, 134], [65, 66, 135], [65, 68, 135], [64, 69, 136], [64, 70, 136], [63, 71, 136], [63, 72, 137], [62, 73, 137], [62, 74, 137], [62, 76, 138], [61, 77, 138], [61, 78, 138], [60, 79, 138], [60, 80, 139], [59, 81, 139], [59, 82, 139], [58, 83, 139], [58, 84, 140], [57, 85, 140], [57, 86, 140], [56, 88, 140], [56, 89, 140], [55, 90, 140], [55, 91, 141], [54, 92, 141], [54, 93, 141], [53, 94, 141], [53, 95, 141], [52, 96, 141], [52, 97, 141], [51, 98, 141], [51, 99, 141], [50, 100, 142], [50, 101, 142], [49, 102, 142], [49, 103, 142], [49, 104, 142], [48, 105, 142], [48, 106, 142], [47, 107, 142], [47, 108, 142], [46, 109, 142], [46, 110, 142], [46, 111, 142], [45, 112, 142], [45, 113, 142], [44, 113, 142], [44, 114, 142], [44, 115, 142], [43, 116, 142], [43, 117, 142], [42, 118, 142], [42, 119, 142], [42, 120, 142], [41, 121, 142], [41, 122, 142], [41, 123, 142], [40, 124, 142], [40, 125, 142], [39, 126, 142], [39, 127, 142], [39, 128, 142], [38, 129, 142], [38, 130, 142], [38, 130, 142], [37, 131, 142], [37, 132, 142], [37, 133, 142], [36, 134, 142], [36, 135, 142], [35, 136, 142], [35, 137, 142], [35, 138, 141], [34, 139, 141], [34, 140, 141], [34, 141, 141], [33, 142, 141], [33, 143, 141], [33, 144, 141], [33, 145, 140], [32, 146, 140], [32, 146, 140], [32, 147, 140], [31, 148, 140], [31, 149, 139], [31, 150, 139], [31, 151, 139], [31, 152, 139], [31, 153, 138], [31, 154, 138], [30, 155, 138], [30, 156, 137], [30, 157, 137], [31, 158, 137], [31, 159, 136], [31, 160, 136], [31, 161, 136], [31, 161, 135], [31, 162, 135], [32, 163, 134], [32, 164, 134], [33, 165, 133], [33, 166, 133], [34, 167, 133], [34, 168, 132], [35, 169, 131], [36, 170, 131], [37, 171, 130], [37, 172, 130], [38, 173, 129], [39, 173, 129], [40, 174, 128], [41, 175, 127], [42, 176, 127], [44, 177, 126], [45, 178, 125], [46, 179, 124], [47, 180, 124], [49, 181, 123], [50, 182, 122], [52, 182, 121], [53, 183, 121], [55, 184, 120], [56, 185, 119], [58, 186, 118], [59, 187, 117], [61, 188, 116], [63, 188, 115], [64, 189, 114], [66, 190, 113], [68, 191, 112], [70, 192, 111], [72, 193, 110], [74, 193, 109], [76, 194, 108], [78, 195, 107], [80, 196, 106], [82, 197, 105], [84, 197, 104], [86, 198, 103], [88, 199, 101], [90, 200, 100], [92, 200, 99], [94, 201, 98], [96, 202, 96], [99, 203, 95], [101, 203, 94], [103, 204, 92], [105, 205, 91], [108, 205, 90], [110, 206, 88], [112, 207, 87], [115, 208, 86], [117, 208, 84], [119, 209, 83], [122, 209, 81], [124, 210, 80], [127, 211, 78], [129, 211, 77], [132, 212, 75], [134, 213, 73], [137, 213, 72], [139, 214, 70], [142, 214, 69], [144, 215, 67], [147, 215, 65], [149, 216, 64], [152, 216, 62], [155, 217, 60], [157, 217, 59], [160, 218, 57], [162, 218, 55], [165, 219, 54], [168, 219, 52], [170, 220, 50], [173, 220, 48], [176, 221, 47], [178, 221, 45], [181, 222, 43], [184, 222, 41], [186, 222, 40], [189, 223, 38], [192, 223, 37], [194, 223, 35], [197, 224, 33], [200, 224, 32], [202, 225, 31], [205, 225, 29], [208, 225, 28], [210, 226, 27], [213, 226, 26], [216, 226, 25], [218, 227, 25], [221, 227, 24], [223, 227, 24], [226, 228, 24], [229, 228, 25], [231, 228, 25], [234, 229, 26], [236, 229, 27], [239, 229, 28], [241, 229, 29], [244, 230, 30], [246, 230, 32], [248, 230, 33], [251, 231, 35], [253, 231, 37]] +var inferno = [[0, 0, 4], [1, 0, 5], [1, 1, 6], [1, 1, 8], [2, 1, 10], [2, 2, 12], [2, 2, 14], [3, 2, 16], [4, 3, 18], [4, 3, 20], [5, 4, 23], [6, 4, 25], [7, 5, 27], [8, 5, 29], [9, 6, 31], [10, 7, 34], [11, 7, 36], [12, 8, 38], [13, 8, 41], [14, 9, 43], [16, 9, 45], [17, 10, 48], [18, 10, 50], [20, 11, 52], [21, 11, 55], [22, 11, 57], [24, 12, 60], [25, 12, 62], [27, 12, 65], [28, 12, 67], [30, 12, 69], [31, 12, 72], [33, 12, 74], [35, 12, 76], [36, 12, 79], [38, 12, 81], [40, 11, 83], [41, 11, 85], [43, 11, 87], [45, 11, 89], [47, 10, 91], [49, 10, 92], [50, 10, 94], [52, 10, 95], [54, 9, 97], [56, 9, 98], [57, 9, 99], [59, 9, 100], [61, 9, 101], [62, 9, 102], [64, 10, 103], [66, 10, 104], [68, 10, 104], [69, 10, 105], [71, 11, 106], [73, 11, 106], [74, 12, 107], [76, 12, 107], [77, 13, 108], [79, 13, 108], [81, 14, 108], [82, 14, 109], [84, 15, 109], [85, 15, 109], [87, 16, 110], [89, 16, 110], [90, 17, 110], [92, 18, 110], [93, 18, 110], [95, 19, 110], [97, 19, 110], [98, 20, 110], [100, 21, 110], [101, 21, 110], [103, 22, 110], [105, 22, 110], [106, 23, 110], [108, 24, 110], [109, 24, 110], [111, 25, 110], [113, 25, 110], [114, 26, 110], [116, 26, 110], [117, 27, 110], [119, 28, 109], [120, 28, 109], [122, 29, 109], [124, 29, 109], [125, 30, 109], [127, 30, 108], [128, 31, 108], [130, 32, 108], [132, 32, 107], [133, 33, 107], [135, 33, 107], [136, 34, 106], [138, 34, 106], [140, 35, 105], [141, 35, 105], [143, 36, 105], [144, 37, 104], [146, 37, 104], [147, 38, 103], [149, 38, 103], [151, 39, 102], [152, 39, 102], [154, 40, 101], [155, 41, 100], [157, 41, 100], [159, 42, 99], [160, 42, 99], [162, 43, 98], [163, 44, 97], [165, 44, 96], [166, 45, 96], [168, 46, 95], [169, 46, 94], [171, 47, 94], [173, 48, 93], [174, 48, 92], [176, 49, 91], [177, 50, 90], [179, 50, 90], [180, 51, 89], [182, 52, 88], [183, 53, 87], [185, 53, 86], [186, 54, 85], [188, 55, 84], [189, 56, 83], [191, 57, 82], [192, 58, 81], [193, 58, 80], [195, 59, 79], [196, 60, 78], [198, 61, 77], [199, 62, 76], [200, 63, 75], [202, 64, 74], [203, 65, 73], [204, 66, 72], [206, 67, 71], [207, 68, 70], [208, 69, 69], [210, 70, 68], [211, 71, 67], [212, 72, 66], [213, 74, 65], [215, 75, 63], [216, 76, 62], [217, 77, 61], [218, 78, 60], [219, 80, 59], [221, 81, 58], [222, 82, 56], [223, 83, 55], [224, 85, 54], [225, 86, 53], [226, 87, 52], [227, 89, 51], [228, 90, 49], [229, 92, 48], [230, 93, 47], [231, 94, 46], [232, 96, 45], [233, 97, 43], [234, 99, 42], [235, 100, 41], [235, 102, 40], [236, 103, 38], [237, 105, 37], [238, 106, 36], [239, 108, 35], [239, 110, 33], [240, 111, 32], [241, 113, 31], [241, 115, 29], [242, 116, 28], [243, 118, 27], [243, 120, 25], [244, 121, 24], [245, 123, 23], [245, 125, 21], [246, 126, 20], [246, 128, 19], [247, 130, 18], [247, 132, 16], [248, 133, 15], [248, 135, 14], [248, 137, 12], [249, 139, 11], [249, 140, 10], [249, 142, 9], [250, 144, 8], [250, 146, 7], [250, 148, 7], [251, 150, 6], [251, 151, 6], [251, 153, 6], [251, 155, 6], [251, 157, 7], [252, 159, 7], [252, 161, 8], [252, 163, 9], [252, 165, 10], [252, 166, 12], [252, 168, 13], [252, 170, 15], [252, 172, 17], [252, 174, 18], [252, 176, 20], [252, 178, 22], [252, 180, 24], [251, 182, 26], [251, 184, 29], [251, 186, 31], [251, 188, 33], [251, 190, 35], [250, 192, 38], [250, 194, 40], [250, 196, 42], [250, 198, 45], [249, 199, 47], [249, 201, 50], [249, 203, 53], [248, 205, 55], [248, 207, 58], [247, 209, 61], [247, 211, 64], [246, 213, 67], [246, 215, 70], [245, 217, 73], [245, 219, 76], [244, 221, 79], [244, 223, 83], [244, 225, 86], [243, 227, 90], [243, 229, 93], [242, 230, 97], [242, 232, 101], [242, 234, 105], [241, 236, 109], [241, 237, 113], [241, 239, 117], [241, 241, 121], [242, 242, 125], [242, 244, 130], [243, 245, 134], [243, 246, 138], [244, 248, 142], [245, 249, 146], [246, 250, 150], [248, 251, 154], [249, 252, 157], [250, 253, 161], [252, 255, 164]] +var magma = [[0, 0, 4], [1, 0, 5], [1, 1, 6], [1, 1, 8], [2, 1, 9], [2, 2, 11], [2, 2, 13], [3, 3, 15], [3, 3, 18], [4, 4, 20], [5, 4, 22], [6, 5, 24], [6, 5, 26], [7, 6, 28], [8, 7, 30], [9, 7, 32], [10, 8, 34], [11, 9, 36], [12, 9, 38], [13, 10, 41], [14, 11, 43], [16, 11, 45], [17, 12, 47], [18, 13, 49], [19, 13, 52], [20, 14, 54], [21, 14, 56], [22, 15, 59], [24, 15, 61], [25, 16, 63], [26, 16, 66], [28, 16, 68], [29, 17, 71], [30, 17, 73], [32, 17, 75], [33, 17, 78], [34, 17, 80], [36, 18, 83], [37, 18, 85], [39, 18, 88], [41, 17, 90], [42, 17, 92], [44, 17, 95], [45, 17, 97], [47, 17, 99], [49, 17, 101], [51, 16, 103], [52, 16, 105], [54, 16, 107], [56, 16, 108], [57, 15, 110], [59, 15, 112], [61, 15, 113], [63, 15, 114], [64, 15, 116], [66, 15, 117], [68, 15, 118], [69, 16, 119], [71, 16, 120], [73, 16, 120], [74, 16, 121], [76, 17, 122], [78, 17, 123], [79, 18, 123], [81, 18, 124], [82, 19, 124], [84, 19, 125], [86, 20, 125], [87, 21, 126], [89, 21, 126], [90, 22, 126], [92, 22, 127], [93, 23, 127], [95, 24, 127], [96, 24, 128], [98, 25, 128], [100, 26, 128], [101, 26, 128], [103, 27, 128], [104, 28, 129], [106, 28, 129], [107, 29, 129], [109, 29, 129], [110, 30, 129], [112, 31, 129], [114, 31, 129], [115, 32, 129], [117, 33, 129], [118, 33, 129], [120, 34, 129], [121, 34, 130], [123, 35, 130], [124, 35, 130], [126, 36, 130], [128, 37, 130], [129, 37, 129], [131, 38, 129], [132, 38, 129], [134, 39, 129], [136, 39, 129], [137, 40, 129], [139, 41, 129], [140, 41, 129], [142, 42, 129], [144, 42, 129], [145, 43, 129], [147, 43, 128], [148, 44, 128], [150, 44, 128], [152, 45, 128], [153, 45, 128], [155, 46, 127], [156, 46, 127], [158, 47, 127], [160, 47, 127], [161, 48, 126], [163, 48, 126], [165, 49, 126], [166, 49, 125], [168, 50, 125], [170, 51, 125], [171, 51, 124], [173, 52, 124], [174, 52, 123], [176, 53, 123], [178, 53, 123], [179, 54, 122], [181, 54, 122], [183, 55, 121], [184, 55, 121], [186, 56, 120], [188, 57, 120], [189, 57, 119], [191, 58, 119], [192, 58, 118], [194, 59, 117], [196, 60, 117], [197, 60, 116], [199, 61, 115], [200, 62, 115], [202, 62, 114], [204, 63, 113], [205, 64, 113], [207, 64, 112], [208, 65, 111], [210, 66, 111], [211, 67, 110], [213, 68, 109], [214, 69, 108], [216, 69, 108], [217, 70, 107], [219, 71, 106], [220, 72, 105], [222, 73, 104], [223, 74, 104], [224, 76, 103], [226, 77, 102], [227, 78, 101], [228, 79, 100], [229, 80, 100], [231, 82, 99], [232, 83, 98], [233, 84, 98], [234, 86, 97], [235, 87, 96], [236, 88, 96], [237, 90, 95], [238, 91, 94], [239, 93, 94], [240, 95, 94], [241, 96, 93], [242, 98, 93], [242, 100, 92], [243, 101, 92], [244, 103, 92], [244, 105, 92], [245, 107, 92], [246, 108, 92], [246, 110, 92], [247, 112, 92], [247, 114, 92], [248, 116, 92], [248, 118, 92], [249, 120, 93], [249, 121, 93], [249, 123, 93], [250, 125, 94], [250, 127, 94], [250, 129, 95], [251, 131, 95], [251, 133, 96], [251, 135, 97], [252, 137, 97], [252, 138, 98], [252, 140, 99], [252, 142, 100], [252, 144, 101], [253, 146, 102], [253, 148, 103], [253, 150, 104], [253, 152, 105], [253, 154, 106], [253, 155, 107], [254, 157, 108], [254, 159, 109], [254, 161, 110], [254, 163, 111], [254, 165, 113], [254, 167, 114], [254, 169, 115], [254, 170, 116], [254, 172, 118], [254, 174, 119], [254, 176, 120], [254, 178, 122], [254, 180, 123], [254, 182, 124], [254, 183, 126], [254, 185, 127], [254, 187, 129], [254, 189, 130], [254, 191, 132], [254, 193, 133], [254, 194, 135], [254, 196, 136], [254, 198, 138], [254, 200, 140], [254, 202, 141], [254, 204, 143], [254, 205, 144], [254, 207, 146], [254, 209, 148], [254, 211, 149], [254, 213, 151], [254, 215, 153], [254, 216, 154], [253, 218, 156], [253, 220, 158], [253, 222, 160], [253, 224, 161], [253, 226, 163], [253, 227, 165], [253, 229, 167], [253, 231, 169], [253, 233, 170], [253, 235, 172], [252, 236, 174], [252, 238, 176], [252, 240, 178], [252, 242, 180], [252, 244, 182], [252, 246, 184], [252, 247, 185], [252, 249, 187], [252, 251, 189], [252, 253, 191]] +var jet = [[0, 0, 128], [0, 0, 132], [0, 0, 137], [0, 0, 141], [0, 0, 146], [0, 0, 150], [0, 0, 155], [0, 0, 159], [0, 0, 164], [0, 0, 168], [0, 0, 173], [0, 0, 178], [0, 0, 182], [0, 0, 187], [0, 0, 191], [0, 0, 196], [0, 0, 200], [0, 0, 205], [0, 0, 209], [0, 0, 214], [0, 0, 218], [0, 0, 223], [0, 0, 227], [0, 0, 232], [0, 0, 237], [0, 0, 241], [0, 0, 246], [0, 0, 250], [0, 0, 255], [0, 0, 255], [0, 0, 255], [0, 0, 255], [0, 0, 255], [0, 4, 255], [0, 8, 255], [0, 12, 255], [0, 16, 255], [0, 20, 255], [0, 24, 255], [0, 28, 255], [0, 32, 255], [0, 36, 255], [0, 40, 255], [0, 44, 255], [0, 48, 255], [0, 52, 255], [0, 56, 255], [0, 60, 255], [0, 64, 255], [0, 68, 255], [0, 72, 255], [0, 76, 255], [0, 80, 255], [0, 84, 255], [0, 88, 255], [0, 92, 255], [0, 96, 255], [0, 100, 255], [0, 104, 255], [0, 108, 255], [0, 112, 255], [0, 116, 255], [0, 120, 255], [0, 124, 255], [0, 128, 255], [0, 132, 255], [0, 136, 255], [0, 140, 255], [0, 144, 255], [0, 148, 255], [0, 152, 255], [0, 156, 255], [0, 160, 255], [0, 164, 255], [0, 168, 255], [0, 172, 255], [0, 176, 255], [0, 180, 255], [0, 184, 255], [0, 188, 255], [0, 192, 255], [0, 196, 255], [0, 200, 255], [0, 204, 255], [0, 208, 255], [0, 212, 255], [0, 216, 255], [0, 220, 254], [0, 224, 251], [0, 228, 248], [2, 232, 244], [6, 236, 241], [9, 240, 238], [12, 244, 235], [15, 248, 231], [19, 252, 228], [22, 255, 225], [25, 255, 222], [28, 255, 219], [31, 255, 215], [35, 255, 212], [38, 255, 209], [41, 255, 206], [44, 255, 202], [48, 255, 199], [51, 255, 196], [54, 255, 193], [57, 255, 190], [60, 255, 186], [64, 255, 183], [67, 255, 180], [70, 255, 177], [73, 255, 173], [77, 255, 170], [80, 255, 167], [83, 255, 164], [86, 255, 160], [90, 255, 157], [93, 255, 154], [96, 255, 151], [99, 255, 148], [102, 255, 144], [106, 255, 141], [109, 255, 138], [112, 255, 135], [115, 255, 131], [119, 255, 128], [122, 255, 125], [125, 255, 122], [128, 255, 119], [131, 255, 115], [135, 255, 112], [138, 255, 109], [141, 255, 106], [144, 255, 102], [148, 255, 99], [151, 255, 96], [154, 255, 93], [157, 255, 90], [160, 255, 86], [164, 255, 83], [167, 255, 80], [170, 255, 77], [173, 255, 73], [177, 255, 70], [180, 255, 67], [183, 255, 64], [186, 255, 60], [190, 255, 57], [193, 255, 54], [196, 255, 51], [199, 255, 48], [202, 255, 44], [206, 255, 41], [209, 255, 38], [212, 255, 35], [215, 255, 31], [219, 255, 28], [222, 255, 25], [225, 255, 22], [228, 255, 19], [231, 255, 15], [235, 255, 12], [238, 255, 9], [241, 252, 6], [244, 248, 2], [248, 245, 0], [251, 241, 0], [254, 237, 0], [255, 234, 0], [255, 230, 0], [255, 226, 0], [255, 222, 0], [255, 219, 0], [255, 215, 0], [255, 211, 0], [255, 208, 0], [255, 204, 0], [255, 200, 0], [255, 196, 0], [255, 193, 0], [255, 189, 0], [255, 185, 0], [255, 182, 0], [255, 178, 0], [255, 174, 0], [255, 171, 0], [255, 167, 0], [255, 163, 0], [255, 159, 0], [255, 156, 0], [255, 152, 0], [255, 148, 0], [255, 145, 0], [255, 141, 0], [255, 137, 0], [255, 134, 0], [255, 130, 0], [255, 126, 0], [255, 122, 0], [255, 119, 0], [255, 115, 0], [255, 111, 0], [255, 108, 0], [255, 104, 0], [255, 100, 0], [255, 96, 0], [255, 93, 0], [255, 89, 0], [255, 85, 0], [255, 82, 0], [255, 78, 0], [255, 74, 0], [255, 71, 0], [255, 67, 0], [255, 63, 0], [255, 59, 0], [255, 56, 0], [255, 52, 0], [255, 48, 0], [255, 45, 0], [255, 41, 0], [255, 37, 0], [255, 34, 0], [255, 30, 0], [255, 26, 0], [255, 22, 0], [255, 19, 0], [250, 15, 0], [246, 11, 0], [241, 8, 0], [237, 4, 0], [232, 0, 0], [228, 0, 0], [223, 0, 0], [218, 0, 0], [214, 0, 0], [209, 0, 0], [205, 0, 0], [200, 0, 0], [196, 0, 0], [191, 0, 0], [187, 0, 0], [182, 0, 0], [178, 0, 0], [173, 0, 0], [168, 0, 0], [164, 0, 0], [159, 0, 0], [155, 0, 0], [150, 0, 0], [146, 0, 0], [141, 0, 0], [137, 0, 0], [132, 0, 0], [128, 0, 0]] +var binary = [[255, 255, 255], [254, 254, 254], [253, 253, 253], [252, 252, 252], [251, 251, 251], [250, 250, 250], [249, 249, 249], [248, 248, 248], [247, 247, 247], [246, 246, 246], [245, 245, 245], [244, 244, 244], [243, 243, 243], [242, 242, 242], [241, 241, 241], [240, 240, 240], [239, 239, 239], [238, 238, 238], [237, 237, 237], [236, 236, 236], [235, 235, 235], [234, 234, 234], [233, 233, 233], [232, 232, 232], [231, 231, 231], [230, 230, 230], [229, 229, 229], [228, 228, 228], [227, 227, 227], [226, 226, 226], [225, 225, 225], [224, 224, 224], [223, 223, 223], [222, 222, 222], [221, 221, 221], [220, 220, 220], [219, 219, 219], [218, 218, 218], [217, 217, 217], [216, 216, 216], [215, 215, 215], [214, 214, 214], [213, 213, 213], [212, 212, 212], [211, 211, 211], [210, 210, 210], [209, 209, 209], [208, 208, 208], [207, 207, 207], [206, 206, 206], [205, 205, 205], [204, 204, 204], [203, 203, 203], [202, 202, 202], [201, 201, 201], [200, 200, 200], [199, 199, 199], [198, 198, 198], [197, 197, 197], [196, 196, 196], [195, 195, 195], [194, 194, 194], [193, 193, 193], [192, 192, 192], [191, 191, 191], [190, 190, 190], [189, 189, 189], [188, 188, 188], [187, 187, 187], [186, 186, 186], [185, 185, 185], [184, 184, 184], [183, 183, 183], [182, 182, 182], [181, 181, 181], [180, 180, 180], [179, 179, 179], [178, 178, 178], [177, 177, 177], [176, 176, 176], [175, 175, 175], [174, 174, 174], [173, 173, 173], [172, 172, 172], [171, 171, 171], [170, 170, 170], [169, 169, 169], [168, 168, 168], [167, 167, 167], [166, 166, 166], [165, 165, 165], [164, 164, 164], [163, 163, 163], [162, 162, 162], [161, 161, 161], [160, 160, 160], [159, 159, 159], [158, 158, 158], [157, 157, 157], [156, 156, 156], [155, 155, 155], [154, 154, 154], [153, 153, 153], [152, 152, 152], [151, 151, 151], [150, 150, 150], [149, 149, 149], [148, 148, 148], [147, 147, 147], [146, 146, 146], [145, 145, 145], [144, 144, 144], [143, 143, 143], [142, 142, 142], [141, 141, 141], [140, 140, 140], [139, 139, 139], [138, 138, 138], [137, 137, 137], [136, 136, 136], [135, 135, 135], [134, 134, 134], [133, 133, 133], [132, 132, 132], [131, 131, 131], [130, 130, 130], [129, 129, 129], [128, 128, 128], [127, 127, 127], [126, 126, 126], [125, 125, 125], [124, 124, 124], [123, 123, 123], [122, 122, 122], [121, 121, 121], [120, 120, 120], [119, 119, 119], [118, 118, 118], [117, 117, 117], [116, 116, 116], [115, 115, 115], [114, 114, 114], [113, 113, 113], [112, 112, 112], [111, 111, 111], [110, 110, 110], [109, 109, 109], [108, 108, 108], [107, 107, 107], [106, 106, 106], [105, 105, 105], [104, 104, 104], [103, 103, 103], [102, 102, 102], [101, 101, 101], [100, 100, 100], [99, 99, 99], [98, 98, 98], [97, 97, 97], [96, 96, 96], [95, 95, 95], [94, 94, 94], [93, 93, 93], [92, 92, 92], [91, 91, 91], [90, 90, 90], [89, 89, 89], [88, 88, 88], [87, 87, 87], [86, 86, 86], [85, 85, 85], [84, 84, 84], [83, 83, 83], [82, 82, 82], [81, 81, 81], [80, 80, 80], [79, 79, 79], [78, 78, 78], [77, 77, 77], [76, 76, 76], [75, 75, 75], [74, 74, 74], [73, 73, 73], [72, 72, 72], [71, 71, 71], [70, 70, 70], [69, 69, 69], [68, 68, 68], [67, 67, 67], [66, 66, 66], [65, 65, 65], [64, 64, 64], [63, 63, 63], [62, 62, 62], [61, 61, 61], [60, 60, 60], [59, 59, 59], [58, 58, 58], [57, 57, 57], [56, 56, 56], [55, 55, 55], [54, 54, 54], [53, 53, 53], [52, 52, 52], [51, 51, 51], [50, 50, 50], [49, 49, 49], [48, 48, 48], [47, 47, 47], [46, 46, 46], [45, 45, 45], [44, 44, 44], [43, 43, 43], [42, 42, 42], [41, 41, 41], [40, 40, 40], [39, 39, 39], [38, 38, 38], [37, 37, 37], [36, 36, 36], [35, 35, 35], [34, 34, 34], [33, 33, 33], [32, 32, 32], [31, 31, 31], [30, 30, 30], [29, 29, 29], [28, 28, 28], [27, 27, 27], [26, 26, 26], [25, 25, 25], [24, 24, 24], [23, 23, 23], [22, 22, 22], [21, 21, 21], [20, 20, 20], [19, 19, 19], [18, 18, 18], [17, 17, 17], [16, 16, 16], [15, 15, 15], [14, 14, 14], [13, 13, 13], [12, 12, 12], [11, 11, 11], [10, 10, 10], [9, 9, 9], [8, 8, 8], [7, 7, 7], [6, 6, 6], [5, 5, 5], [4, 4, 4], [3, 3, 3], [2, 2, 2], [1, 1, 1], [0, 0, 0]] +var colormaps = [turbo, fosphor, viridis, inferno, magma, jet, binary]; diff --git a/firmware/ori/board/pluto/overlay/www/index.html b/firmware/ori/board/pluto/overlay/www/index.html new file mode 100644 index 0000000..63b90c2 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/www/index.html @@ -0,0 +1,20 @@ + + + + + + Spectrum Plot + + + + + + + + + +
+
+
+ + diff --git a/firmware/ori/board/pluto/overlay/www/mqtt.js b/firmware/ori/board/pluto/overlay/www/mqtt.js new file mode 100644 index 0000000..41a9cd9 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/www/mqtt.js @@ -0,0 +1,73 @@ +// Create a client instance +var serverUrl = window.location.host; // i.e. "great-server.cloudmqtt.com" + var serverPort = 9001; // cloudmqtt only accepts WSS sockets on this port. Others will use 9001, 8883 or others + var clientId = "wsbrowser_"+new Date().getUTCMilliseconds(); // make client name unique +client = new Paho.MQTT.Client(window.location.host, Number(9001), "/wss"); + +// set callback handlers +client.onConnectionLost = onConnectionLost; +client.onMessageArrived = onMessageArrived; + +// connect the client +client.connect({onSuccess:onConnect}); + + +// called when the client connects +function onConnect() { + // Once a connection has been made, make a subscription and send a message. + console.log("onConnect"); + spectrum.toggleAutoScale(); + client.subscribe("cmd/pluto/+/rx/webfft/+"); + + + //message = new Paho.MQTT.Message("Hello"); + //message.destinationName = "World"; + //client.send(message); +} + +// called when the client loses its connection +function onConnectionLost(responseObject) { + if (responseObject.errorCode !== 0) { + console.log("onConnectionLost:"+responseObject.errorMessage); + } + //client.connect({onSuccess:onConnect}); +} + +// called when a message arrives +function onMessageArrived(message) { + let topic= message.destinationName; + console.log("onMessageArrived:"+message.payloadString+message.destinationName); + + if(topic.includes("frequency")) + { + spectrum.setCenterHz((message.payloadString/1000).toFixed(1)*1000); + + } + if(topic.includes("span")) + { + + spectrum.setSpanHz((message.payloadString)); + } + + if(topic.includes("average")) + { + spectrum.setAveraging((message.payloadString)); + } + + if(topic.includes("autoscale")) + { + spectrum.toggleAutoScale(); + } + + if(topic.includes("rangemin")) + { + spectrum.min_db=message.payloadString; + spectrum.updateAxes(); + } + + if(topic.includes("rangemax")) + { + spectrum.max_db=message.payloadString; + spectrum.updateAxes(); + } +} \ No newline at end of file diff --git a/firmware/ori/board/pluto/overlay/www/script.js b/firmware/ori/board/pluto/overlay/www/script.js new file mode 100644 index 0000000..5699265 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/www/script.js @@ -0,0 +1,78 @@ +'use strict'; + +var spectrum, logger, ws; + +function connectWebSocket(spectrum) { + + ws = new WebSocket("ws://" + window.location.host + ":7681/websocket"); + + spectrum.setWebSocket(ws); + + ws.onconnect = function (evt) { + ws.binaryType = 'arraybuffer'; + } + + ws.onopen = function (evt) { + ws.binaryType = 'arraybuffer'; + console.log("connected!"); + } + ws.onclose = function (evt) { + console.log("closed"); + setTimeout(function () { + connectWebSocket(spectrum); + }, 1000); + } + ws.onerror = function (evt) { + console.log("error: " + evt.message); + } + ws.onmessage = function (evt) { + + //spectrum.addData(evt.data); + + if (evt.data instanceof ArrayBuffer) { + + spectrum.addData(evt.data); + } + else { + var data = JSON.parse(evt.data); + + if (data.center) { + spectrum.setCenterHz(data.center); + } + if (data.span) { + spectrum.setSpanHz(data.span); + } + if (data.gain) { + spectrum.setGain(data.gain); + } + if (data.framerate) { + spectrum.setFps(data.framerate); + } + spectrum.log(" > Freq:" + data.center / 1000000 + " MHz | Span: " + data.span / 1000000 + " MHz | Gain: " + data.gain + "dB | Fps: " + data.framerate); + + } + } +} + + +function main() { + + // Create spectrum object on canvas with ID "waterfall" + spectrum = new Spectrum( + "waterfall", { + spectrumPercent: 50, + logger: 'log', + }); + + // Connect to websocket + connectWebSocket(spectrum); + + // Bind keypress handler + window.addEventListener("keydown", function (e) { + spectrum.onKeypress(e); + }); + + +} + +window.onload = main; diff --git a/firmware/ori/board/pluto/overlay/www/spectrum.js b/firmware/ori/board/pluto/overlay/www/spectrum.js new file mode 100644 index 0000000..b8dcaad --- /dev/null +++ b/firmware/ori/board/pluto/overlay/www/spectrum.js @@ -0,0 +1,612 @@ +/* + * Copyright (c) 2019 Jeppe Ledet-Pedersen + * This software is released under the MIT license. + * See the LICENSE file for further details. + */ + +'use strict'; + + + +Spectrum.prototype.squeeze = function(value, out_min, out_max) { + if (value <= this.min_db) + return out_min; + else if (value >= this.max_db) + return out_max; + else + return Math.round((value - this.min_db) / (this.max_db - this.min_db) * out_max); +} + +Spectrum.prototype.rowToImageData = function(bins) { + for (var i = 0; i < this.imagedata.data.length; i += 4) { + var cindex = this.squeeze(bins[i/4], 0, 255); + var color = this.colormap[cindex]; + this.imagedata.data[i+0] = color[0]; + this.imagedata.data[i+1] = color[1]; + this.imagedata.data[i+2] = color[2]; + this.imagedata.data[i+3] = 255; + } +} + +Spectrum.prototype.addWaterfallRow = function(bins) { + // Shift waterfall 1 row down + this.ctx_wf.drawImage(this.ctx_wf.canvas, + 0, 0, this.wf_size, this.wf_rows - 1, + 0, 1, this.wf_size, this.wf_rows - 1); + + this.wfrowcount++; + + // Draw new line on waterfall canvas + this.rowToImageData(bins); + this.ctx_wf.putImageData(this.imagedata, 0, 0); + + if (this.wfrowcount % 100 == 0) + { + var timeString = new Date().toLocaleTimeString(); + this.ctx_wf.font = "30px sans-serif"; + this.ctx_wf.fillStyle = "white"; + this.ctx_wf.textBaseline = "top"; + this.ctx_wf.fillText(timeString, 0, 0); // TODO: Fix font scaling + } + + var width = this.ctx.canvas.width; + var height = this.ctx.canvas.height; + + // Copy scaled FFT canvas to screen. Only copy the number of rows that will + // fit in waterfall area to avoid vertical scaling. + this.ctx.imageSmoothingEnabled = false; + var rows = Math.min(this.wf_rows, height - this.spectrumHeight); + this.ctx.drawImage(this.ctx_wf.canvas, + 0, 0, this.wf_size, rows, + 0, this.spectrumHeight, width, height - this.spectrumHeight); +} + +Spectrum.prototype.drawFFT = function(bins) { + this.ctx.beginPath(); + this.ctx.moveTo(-1, this.spectrumHeight + 1); + for (var i = 0; i < bins.length; i++) { + var y = this.spectrumHeight - this.squeeze(bins[i], 0, this.spectrumHeight); + if (y > this.spectrumHeight - 1) + y = this.spectrumHeight + 1; // Hide underflow + if (y < 0) + y = 0; + if (i == 0) + this.ctx.lineTo(-1, y); + this.ctx.lineTo(i, y); + if (i == bins.length - 1) + this.ctx.lineTo(this.wf_size + 1, y); + } + this.ctx.lineTo(this.wf_size + 1, this.spectrumHeight + 1); + this.ctx.strokeStyle = "#fefefe"; + this.ctx.stroke(); +} + +Spectrum.prototype.drawSpectrum = function(bins) { + var width = this.ctx.canvas.width; + var height = this.ctx.canvas.height; + + // Fill with black + this.ctx.fillStyle = "black"; + this.ctx.fillRect(0, 0, width, height); + + // FFT averaging + if (this.averaging > 0) { + if (!this.binsAverage || this.binsAverage.length != bins.length) { + this.binsAverage = Array.from(bins); + } else { + for (var i = 0; i < bins.length; i++) { + this.binsAverage[i] += this.alpha * (bins[i] - this.binsAverage[i]); + } + } + bins = this.binsAverage; + } + + // Max hold + if (this.maxHold) { + if (!this.binsMax || this.binsMax.length != bins.length) { + this.binsMax = Array.from(bins); + } else { + for (var i = 0; i < bins.length; i++) { + if (bins[i] > this.binsMax[i]) { + this.binsMax[i] = bins[i]; + } else { + // Decay + this.binsMax[i] = 1.0025 * this.binsMax[i]; + } + } + } + } + + // Do not draw anything if spectrum is not visible + if (this.ctx_axes.canvas.height < 1) + return; + + // Scale for FFT + this.ctx.save(); + this.ctx.scale(width / this.wf_size, 1); + + // Draw maxhold + if (this.maxHold) + this.drawFFT(this.binsMax); + + // Do autoscale axes + if (this.autoScale) + this.doAutoScale(bins); + + // Draw FFT bins + this.drawFFT(bins); + + // Restore scale + this.ctx.restore(); + + // Fill scaled path + this.ctx.fillStyle = this.gradient; + this.ctx.fill(); + + // Copy axes from offscreen canvas + this.ctx.drawImage(this.ctx_axes.canvas, 0, 0); +} + +Spectrum.prototype.updateAxes = function() { + var width = this.ctx_axes.canvas.width; + var height = this.ctx_axes.canvas.height; + + // Clear axes canvas + this.ctx_axes.clearRect(0, 0, width, height); + + // Draw axes + this.ctx_axes.font = "12px sans-serif"; + this.ctx_axes.fillStyle = "white"; + this.ctx_axes.textBaseline = "middle"; + + this.ctx_axes.textAlign = "left"; + var step = 10; + for (var i = this.min_db + 10; i <= this.max_db - 10; i += step) { + var y = height - this.squeeze(i, 0, height); + this.ctx_axes.fillText(i, 5, y); + + this.ctx_axes.beginPath(); + this.ctx_axes.moveTo(20, y); + this.ctx_axes.lineTo(width, y); + this.ctx_axes.strokeStyle = "rgba(200, 200, 200, 0.10)"; + this.ctx_axes.stroke(); + } + + this.ctx_axes.textBaseline = "bottom"; + for (var i = 0; i < 11; i++) { + var x = Math.round(width / 10) * i; + + if (this.spanHz > 0) { + var adjust = 0; + if (i == 0) { + this.ctx_axes.textAlign = "left"; + adjust = 3; + } else if (i == 10) { + this.ctx_axes.textAlign = "right"; + adjust = -3; + } else { + this.ctx_axes.textAlign = "center"; + } + + var freq = this.centerHz + this.spanHz / 10 * (i - 5); + if (this.centerHz + this.spanHz > 1e6) + freq = freq / 1e6 + "M"; + else if (this.centerHz + this.spanHz > 1e3) + freq = freq / 1e3 + "k"; + this.ctx_axes.fillText(freq, x + adjust, height - 3); + } + + this.ctx_axes.beginPath(); + this.ctx_axes.moveTo(x, 0); + this.ctx_axes.lineTo(x, height); + this.ctx_axes.strokeStyle = "rgba(200, 200, 200, 0.10)"; + this.ctx_axes.stroke(); + } +} + +Spectrum.prototype.addData = function(data) { + this.databin = new Uint16Array(data); + + if (!this.paused) { + if (this.databin.length != this.wf_size) { + this.wf_size = this.databin.length; + this.ctx_wf.canvas.width = this.databin.length; + this.ctx_wf.fillStyle = "black"; + this.ctx_wf.fillRect(0, 0, this.wf.width, this.wf.height); + this.imagedata = this.ctx_wf.createImageData(this.databin.length, 1); + } + this.drawSpectrum(this.databin); + this.addWaterfallRow(this.databin); + this.resize(); + } +} + +Spectrum.prototype.updateSpectrumRatio = function() { + this.spectrumHeight = Math.round(this.canvas.height * this.spectrumPercent / 100.0); + + this.gradient = this.ctx.createLinearGradient(0, 0, 0, this.spectrumHeight); + for (var i = 0; i < this.colormap.length; i++) { + var c = this.colormap[this.colormap.length - 1 - i]; + this.gradient.addColorStop(i / this.colormap.length, + "rgba(" + c[0] + "," + c[1] + "," + c[2] + ", 1.0)"); + } +} + +Spectrum.prototype.resize = function() { + var width = this.canvas.clientWidth; + var height = this.canvas.clientHeight; + + if (this.canvas.width != width || + this.canvas.height != height) { + this.canvas.width = width; + this.canvas.height = height; + this.updateSpectrumRatio(); + } + + if (this.axes.width != width || + this.axes.height != this.spectrumHeight) { + this.axes.width = width; + this.axes.height = this.spectrumHeight; + this.updateAxes(); + } + +} + +Spectrum.prototype.setSpectrumPercent = function(percent) { + if (percent >= 0 && percent <= 100) { + this.spectrumPercent = percent; + this.updateSpectrumRatio(); + } +} + +Spectrum.prototype.incrementSpectrumPercent = function() { + if (this.spectrumPercent + this.spectrumPercentStep <= 100) { + this.setSpectrumPercent(this.spectrumPercent + this.spectrumPercentStep); + } +} + +Spectrum.prototype.decrementSpectrumPercent = function() { + if (this.spectrumPercent - this.spectrumPercentStep >= 0) { + this.setSpectrumPercent(this.spectrumPercent - this.spectrumPercentStep); + } +} + +Spectrum.prototype.toggleColor = function() { + this.colorindex++; + if (this.colorindex >= colormaps.length) + this.colorindex = 0; + this.colormap = colormaps[this.colorindex]; + this.updateSpectrumRatio(); +} + +Spectrum.prototype.setRange = function(min_db, max_db) { + this.min_db = min_db; + this.max_db = max_db; + this.updateAxes(); +} + +Spectrum.prototype.rangeUp = function() { + this.setRange(this.min_db - 5, this.max_db - 5); +} + +Spectrum.prototype.rangeDown = function() { + this.setRange(this.min_db + 5, this.max_db + 5); +} + +Spectrum.prototype.rangeIncrease = function() { + this.setRange(this.min_db - 5, this.max_db + 5); +} + +Spectrum.prototype.rangeDecrease = function() { + if (this.max_db - this.min_db > 10) + this.setRange(this.min_db + 5, this.max_db - 5); +} + +Spectrum.prototype.doAutoScale = function(bins) { + var maxbinval = Math.max(...bins); + var minbinval = Math.min(...bins); + + this.setRange(Math.ceil(minbinval * 0.075) * 10, Math.ceil(maxbinval * 0.075) * 10); // 75% to nearest 10 + this.toggleAutoScale(); +} + +Spectrum.prototype.setCenterHz = function(hz) { + this.centerHz = hz; + this.updateAxes(); +} + +Spectrum.prototype.setSpanHz = function(hz) { + this.spanHz = hz; + this.updateAxes(); +} + +Spectrum.prototype.setGain = function(gain) { + this.gain = gain; + this.updateAxes(); +} + +Spectrum.prototype.setFps = function(fps) { + this.fps = fps; + this.updateAxes(); +} + +Spectrum.prototype.setAveraging = function(num) { + if (num >= 0) { + this.averaging = num; + this.alpha = 2 / (this.averaging + 1) + } +} + +Spectrum.prototype.setTuningStep = function(num) { + if (num > 0 && num < 10e6) + this.tuningStep = num; + this.log("Step: " + this.tuningStep); +} + +Spectrum.prototype.incrementAveraging = function() { + this.setAveraging(this.averaging + 1); +} + +Spectrum.prototype.decrementAveraging = function() { + if (this.averaging > 0) { + this.setAveraging(this.averaging - 1); + } +} + +Spectrum.prototype.incrementFrequency = function() { + var freq = { freq : this.centerHz + this.tuningStep }; + this.ws.send(JSON.stringify(freq)); +} + +Spectrum.prototype.decrementFrequency = function() { + var freq = { freq : this.centerHz - this.tuningStep}; + this.ws.send(JSON.stringify(freq)); +} + +Spectrum.prototype.incrementGain = function() { + var gain = { gain : this.gain + 1 }; + this.ws.send(JSON.stringify(gain)); +} + +Spectrum.prototype.decrementGain = function() { + var gain = { gain : this.gain - 1 }; + this.ws.send(JSON.stringify(gain)); +} + +Spectrum.prototype.incrementFps = function() { + var fps = { fps : this.fps + 5 }; + this.ws.send(JSON.stringify(fps)); +} + +Spectrum.prototype.decrementFps = function() { + var fps = { fps : this.fps - 5 }; + this.ws.send(JSON.stringify(fps)); +} + +Spectrum.prototype.decrementTuningStep = function() { // 1ex, 2.5ex, 5ex + if (this.tuningStep > 1) { + + var step; + var firstDigit = parseInt(this.tuningStep / Math.pow(10, parseInt(Math.log10(this.tuningStep)))); + + if (firstDigit == 2) + step = 2.5; + else + step = 2; + + this.setTuningStep(this.tuningStep / step); + } +} + +Spectrum.prototype.incrementTuningStep = function() { + if (this.tuningStep > 0) { + + var step; + var firstDigit = parseInt(this.tuningStep / Math.pow(10, parseInt(Math.log10(this.tuningStep)))); + + if (firstDigit > 1) + step = 2; + else + step = 2.5; + + this.setTuningStep(this.tuningStep * step); + + } +} + +Spectrum.prototype.downloadWFImage = function(){ + var link = document.createElement('a'); + var dateString = new Date().toISOString().replace(/:/g,'-'); + link.download = 'capture-' + dateString + '.png'; + link.href = this.wf.toDataURL(); + link.click(); +} + +Spectrum.prototype.setPaused = function(paused) { + this.paused = paused; +} + +Spectrum.prototype.togglePaused = function() { + this.setPaused(!this.paused); +} + +Spectrum.prototype.setMaxHold = function(maxhold) { + this.maxHold = maxhold; + this.binsMax = undefined; +} + +Spectrum.prototype.setAutoScale = function(autoscale) { + this.autoScale = autoscale; +} + +Spectrum.prototype.toggleMaxHold = function() { + this.setMaxHold(!this.maxHold); +} + +Spectrum.prototype.toggleAutoScale = function() { + this.setAutoScale(!this.autoScale); +} + +Spectrum.prototype.log = function(message) { + this.logger.innerHTML = message + '
'; + this.logger.scrollTop = this.logger.scrollHeight; +} + +Spectrum.prototype.setWebSocket = function(ws) { + this.ws = ws; +} + +Spectrum.prototype.toggleFullscreen = function() { + if (!this.fullscreen) { + if (this.canvas.requestFullscreen) { + this.canvas.requestFullscreen(); + } else if (this.canvas.mozRequestFullScreen) { + this.canvas.mozRequestFullScreen(); + } else if (this.canvas.webkitRequestFullscreen) { + this.canvas.webkitRequestFullscreen(); + } else if (this.canvas.msRequestFullscreen) { + this.canvas.msRequestFullscreen(); + } + this.fullscreen = true; + } else { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } + this.fullscreen = false; + } +} + +Spectrum.prototype.onKeypress = function(e) { + + switch (e.key) { + case " ": + this.togglePaused(); + break; + case "S": + this.toggleFullscreen(); + break; + case "c": + this.toggleColor(); + break; + case "ArrowUp": + this.rangeUp(); + break; + case "ArrowDown": + this.rangeDown(); + break; + case "ArrowLeft": + this.rangeDecrease(); + break; + case "ArrowRight": + this.rangeIncrease(); + break; + case "W": + this.incrementSpectrumPercent(); + break; + case "w": + this.decrementSpectrumPercent(); + break; + case "+": + this.incrementAveraging(); + break; + case "-": + this.decrementAveraging(); + break; + case "m": + this.toggleMaxHold(); + break; + case "a": + this.toggleAutoScale(); + break; + case "f": + this.decrementFrequency(); + break; + case "F": + this.incrementFrequency(); + break; + case "g": + this.decrementGain(); + break; + case "G": + this.incrementGain(); + break; + case "p": + this.decrementFps(); + break; + case "P": + this.incrementFps(); + break; + case "t": + this.decrementTuningStep(); + break; + case "T": + this.incrementTuningStep(); + break; + case "d": + this.downloadWFImage(); + break; + } +} + +function Spectrum(id, options) { + // Handle options + this.centerHz = (options && options.centerHz) ? options.centerHz : 0; + this.spanHz = (options && options.spanHz) ? options.spanHz : 0; + this.gain = (options && options.gain) ? options.gain : 0; + this.fps = (options && options.fps) ? options.fps : 0; + this.wf_size = (options && options.wf_size) ? options.wf_size : 0; + this.wf_rows = (options && options.wf_rows) ? options.wf_rows : 2048; + this.spectrumPercent = (options && options.spectrumPercent) ? options.spectrumPercent : 25; + this.spectrumPercentStep = (options && options.spectrumPercentStep) ? options.spectrumPercentStep : 5; + this.averaging = (options && options.averaging) ? options.averaging : 0; + this.maxHold = (options && options.maxHold) ? options.maxHold : false; + this.autoScale = (options && options.autoScale) ? options.autoScale : false; + + this.logger = (options && options.logger) ? document.getElementById(options.logger) : document.getElementById('log'); + + // Setup state + this.paused = false; + this.fullscreen = false; + this.min_db = 3000; + this.max_db = 5000; + this.spectrumHeight = 0; + this.tuningStep = 100000; + this.maxbinval = 0; + this.minbinval = 0; + this.wfrowcount = 0; + + // Colors + this.colorindex = 0; + this.colormap = colormaps[2]; + + // Create main canvas and adjust dimensions to match actual + this.canvas = document.getElementById(id); + this.canvas.height = this.canvas.clientHeight; + this.canvas.width = this.canvas.clientWidth; + this.ctx = this.canvas.getContext("2d"); + this.ctx.fillStyle = "black"; + this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height); + + // Create offscreen canvas for axes + this.axes = document.createElement("canvas"); + this.axes.height = 1; // Updated later + this.axes.width = this.canvas.width; + this.ctx_axes = this.axes.getContext("2d"); + + // Create offscreen canvas for waterfall + this.wf = document.createElement("canvas"); + this.wf.height = this.wf_rows; + this.wf.width = this.wf_size; + this.ctx_wf = this.wf.getContext("2d"); + + // Trigger first render + this.setAveraging(this.averaging); + this.updateSpectrumRatio(); + this.resize(); +} diff --git a/firmware/ori/board/pluto/overlay/www/style.css b/firmware/ori/board/pluto/overlay/www/style.css new file mode 100644 index 0000000..f1b2ea1 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/www/style.css @@ -0,0 +1,31 @@ +html, body { + width: 100%; + height: 100%; + margin: 0px; +} + +#waterfall { + display: block; + width: 100%; + height: 100%; +} + +.status { + position: fixed; + width: 100%; + top: 0; + right: 0; + left: 50px; + height: 30px; + text-align: left; + line-height: 30px; + color: white; + font-size: 14px; + font-family: "Lato", sans-serif; + font-weight: 100; +} + +#log { + white-space: nowrap; + text-shadow: 0 1px 0 darken(red, 10%); +} \ No newline at end of file diff --git a/firmware/ori/board/pluto/overlay/www/vendor/paho/js/paho-mqtt-min.js b/firmware/ori/board/pluto/overlay/www/vendor/paho/js/paho-mqtt-min.js new file mode 100644 index 0000000..d1c0934 --- /dev/null +++ b/firmware/ori/board/pluto/overlay/www/vendor/paho/js/paho-mqtt-min.js @@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2013, 2016 IBM Corp. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * http://www.eclipse.org/legal/epl-v10.html + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + *******************************************************************************/ +(function(p,s){"object"===typeof exports&&"object"===typeof module?module.exports=s():"function"===typeof define&&define.amd?define(s):"object"===typeof exports?exports=s():("undefined"===typeof p.Paho&&(p.Paho={}),p.Paho.MQTT=s())})(this,function(){return function(p){function s(a,b,c){b[c++]=a>>8;b[c++]=a%256;return c}function u(a,b,c,k){k=s(b,c,k);D(a,c,k);return k+b}function n(a){for(var b=0,c=0;c=k&&(c++,b++),b+=3):127=e){var g=a.charCodeAt(++k);if(isNaN(g))throw Error(f(h.MALFORMED_UNICODE,[e,g]));e=(e-55296<<10)+(g-56320)+65536}127>=e?b[c++]=e:(2047>=e?b[c++]=e>>6&31|192:(65535>=e?b[c++]=e>>12&15|224:(b[c++]=e>>18&7|240,b[c++]=e>>12&63|128),b[c++]=e>>6&63|128),b[c++]=e&63|128)}return b}function E(a,b,c){for(var k="",e,g=b;ge)){var m=a[g++]-128;if(0>m)throw Error(f(h.MALFORMED_UTF,[e.toString(16),m.toString(16), +""]));if(224>e)e=64*(e-192)+m;else{var d=a[g++]-128;if(0>d)throw Error(f(h.MALFORMED_UTF,[e.toString(16),m.toString(16),d.toString(16)]));if(240>e)e=4096*(e-224)+64*m+d;else{var l=a[g++]-128;if(0>l)throw Error(f(h.MALFORMED_UTF,[e.toString(16),m.toString(16),d.toString(16),l.toString(16)]));if(248>e)e=262144*(e-240)+4096*m+64*d+l;else throw Error(f(h.MALFORMED_UTF,[e.toString(16),m.toString(16),d.toString(16),l.toString(16)]));}}}65535>10)),e=56320+(e& +1023));k+=String.fromCharCode(e)}return k}var z=function(a,b){for(var c in a)if(a.hasOwnProperty(c))if(b.hasOwnProperty(c)){if(typeof a[c]!==b[c])throw Error(f(h.INVALID_TYPE,[typeof a[c],c]));}else{c="Unknown property, "+c+". Valid properties are:";for(var k in b)b.hasOwnProperty(k)&&(c=c+" "+k);throw Error(c);}},v=function(a,b){return function(){return a.apply(b,arguments)}},h={OK:{code:0,text:"AMQJSC0000I OK."},CONNECT_TIMEOUT:{code:1,text:"AMQJSC0001E Connect timed out."},SUBSCRIBE_TIMEOUT:{code:2, +text:"AMQJS0002E Subscribe timed out."},UNSUBSCRIBE_TIMEOUT:{code:3,text:"AMQJS0003E Unsubscribe timed out."},PING_TIMEOUT:{code:4,text:"AMQJS0004E Ping timed out."},INTERNAL_ERROR:{code:5,text:"AMQJS0005E Internal error. Error Message: {0}, Stack trace: {1}"},CONNACK_RETURNCODE:{code:6,text:"AMQJS0006E Bad Connack return code:{0} {1}."},SOCKET_ERROR:{code:7,text:"AMQJS0007E Socket error:{0}."},SOCKET_CLOSE:{code:8,text:"AMQJS0008I Socket closed."},MALFORMED_UTF:{code:9,text:"AMQJS0009E Malformed UTF data:{0} {1} {2}."}, +UNSUPPORTED:{code:10,text:"AMQJS0010E {0} is not supported by this browser."},INVALID_STATE:{code:11,text:"AMQJS0011E Invalid state {0}."},INVALID_TYPE:{code:12,text:"AMQJS0012E Invalid type {0} for {1}."},INVALID_ARGUMENT:{code:13,text:"AMQJS0013E Invalid argument {0} for {1}."},UNSUPPORTED_OPERATION:{code:14,text:"AMQJS0014E Unsupported operation."},INVALID_STORED_DATA:{code:15,text:"AMQJS0015E Invalid data in local storage key\x3d{0} value\x3d{1}."},INVALID_MQTT_MESSAGE_TYPE:{code:16,text:"AMQJS0016E Invalid MQTT message type {0}."}, +MALFORMED_UNICODE:{code:17,text:"AMQJS0017E Malformed Unicode string:{0} {1}."},BUFFER_FULL:{code:18,text:"AMQJS0018E Message buffer is full, maximum buffer size: {0}."}},H={0:"Connection Accepted",1:"Connection Refused: unacceptable protocol version",2:"Connection Refused: identifier rejected",3:"Connection Refused: server unavailable",4:"Connection Refused: bad user name or password",5:"Connection Refused: not authorized"},f=function(a,b){var c=a.text;if(b)for(var k,e,g=0;g>7;0d);f=g.length+1;b=new ArrayBuffer(b+f);d=new Uint8Array(b);d[0]=a;d.set(g,1);if(3==this.type)f=u(this.payloadMessage.destinationName,k,d,f);else if(1==this.type){switch(this.mqttVersion){case 3:d.set(A,f);f+=A.length; +break;case 4:d.set(B,f),f+=B.length}a=0;this.cleanSession&&(a=2);void 0!==this.willMessage&&(a=a|4|this.willMessage.qos<<3,this.willMessage.retained&&(a|=32));void 0!==this.userName&&(a|=128);void 0!==this.password&&(a|=64);d[f++]=a;f=s(this.keepAliveInterval,d,f)}void 0!==this.messageIdentifier&&(f=s(this.messageIdentifier,d,f));switch(this.type){case 1:f=u(this.clientId,n(this.clientId),d,f);void 0!==this.willMessage&&(f=u(this.willMessage.destinationName,n(this.willMessage.destinationName),d,f), +f=s(e.byteLength,d,f),d.set(e,f),f+=e.byteLength);void 0!==this.userName&&(f=u(this.userName,n(this.userName),d,f));void 0!==this.password&&u(this.password,n(this.password),d,f);break;case 3:d.set(h,f);break;case 8:for(g=0;gthis.disconnectedBufferSize)throw Error(f(h.BUFFER_FULL, +[this.disconnectedBufferSize]));0this.connectOptions.mqttVersion?new WebSocket(a,["mqttv3.1"]):new WebSocket(a,["mqtt"]);this.socket.binaryType="arraybuffer";this.socket.onopen=v(this._on_socket_open,this);this.socket.onmessage=v(this._on_socket_message, +this);this.socket.onerror=v(this._on_socket_error,this);this.socket.onclose=v(this._on_socket_close,this);this.sendPinger=new F(this,window,this.connectOptions.keepAliveInterval);this.receivePinger=new F(this,window,this.connectOptions.keepAliveInterval);this._connectTimeout&&(this._connectTimeout.cancel(),this._connectTimeout=null);this._connectTimeout=new w(this,window,this.connectOptions.timeout,this._disconnected,[h.CONNECT_TIMEOUT.code,f(h.CONNECT_TIMEOUT)])};d.prototype._schedule_message=function(a){this._msg_queue.push(a); +this.connected&&this._process_queue()};d.prototype.store=function(a,b){var c={type:b.type,messageIdentifier:b.messageIdentifier,version:1};switch(b.type){case 3:b.pubRecReceived&&(c.pubRecReceived=!0);c.payloadMessage={};for(var d="",e=b.payloadMessage.payloadBytes,g=0;g=e[g]?d+"0"+e[g].toString(16):d+e[g].toString(16);c.payloadMessage.payloadHex=d;c.payloadMessage.qos=b.payloadMessage.qos;c.payloadMessage.destinationName=b.payloadMessage.destinationName;b.payloadMessage.duplicate&& +(c.payloadMessage.duplicate=!0);b.payloadMessage.retained&&(c.payloadMessage.retained=!0);0===a.indexOf("Sent:")&&(void 0===b.sequence&&(b.sequence=++this._sequence),c.sequence=b.sequence);break;default:throw Error(f(h.INVALID_STORED_DATA,[key,c]));}localStorage.setItem(a+this._localKey+b.messageIdentifier,JSON.stringify(c))};d.prototype.restore=function(a){var b=localStorage.getItem(a),c=JSON.parse(b),d=new q(c.type,c);switch(c.type){case 3:for(var b=c.payloadMessage.payloadHex,e=new ArrayBuffer(b.length/ +2),e=new Uint8Array(e),g=0;2<=b.length;){var m=parseInt(b.substring(0,2),16),b=b.substring(2,b.length);e[g++]=m}b=new Paho.MQTT.Message(e);b.qos=c.payloadMessage.qos;b.destinationName=c.payloadMessage.destinationName;c.payloadMessage.duplicate&&(b.duplicate=!0);c.payloadMessage.retained&&(b.retained=!0);d.payloadMessage=b;break;default:throw Error(f(h.INVALID_STORED_DATA,[a,b]));}0===a.indexOf("Sent:"+this._localKey)?(d.payloadMessage.duplicate=!0,this._sentMessages[d.messageIdentifier]=d):0===a.indexOf("Received:"+ +this._localKey)&&(this._receivedMessages[d.messageIdentifier]=d)};d.prototype._process_queue=function(){for(var a=null,b=this._msg_queue.reverse();a=b.pop();)this._socket_send(a),this._notify_msg_sent[a]&&(this._notify_msg_sent[a](),delete this._notify_msg_sent[a])};d.prototype._requires_ack=function(a){var b=Object.keys(this._sentMessages).length;if(b>this.maxMessageIdentifier)throw Error("Too many messages:"+b);for(;void 0!==this._sentMessages[this._message_identifier];)this._message_identifier++; +a.messageIdentifier=this._message_identifier;this._sentMessages[a.messageIdentifier]=a;3===a.type&&this.store("Sent:",a);this._message_identifier===this.maxMessageIdentifier&&(this._message_identifier=1)};d.prototype._on_socket_open=function(){var a=new q(1,this.connectOptions);a.clientId=this.clientId;this._socket_send(a)};d.prototype._on_socket_message=function(a){this._trace("Client._on_socket_message",a.data);a=this._deframeMessages(a.data);for(var b=0;b>4,t=n&15,g=g+1,x=void 0,C=0,p=1;do{if(g==e.length){d=[null,m];break a}x=e[g++];C+=(x&127)*p;p*=128}while(0!==(x&128));x=g+C;if(x>e.length)d=[null,m];else{var y=new q(l);switch(l){case 2:e[g++]&1&&(y.sessionPresent= +!0);y.returnCode=e[g++];break;case 3:var m=t>>1&3,s=256*e[g]+e[g+1],g=g+2,u=E(e,g,s),g=g+s;0this._reconnectInterval&&(this._reconnectInterval*=2),this.connectOptions.uris?(this.hostIndex=0,this._doConnect(this.connectOptions.uris[0])):this._doConnect(this.uri))};d.prototype._disconnected=function(a,b){this._trace("Client._disconnected",a,b);if(void 0!==a&&this._reconnecting)this._reconnectTimeout=new w(this,window,this._reconnectInterval,this._reconnect); +else if(this.sendPinger.cancel(),this.receivePinger.cancel(),this._connectTimeout&&(this._connectTimeout.cancel(),this._connectTimeout=null),this._msg_queue=[],this._buffered_msg_queue=[],this._notify_msg_sent={},this.socket&&(this.socket.onopen=null,this.socket.onmessage=null,this.socket.onerror=null,this.socket.onclose=null,1===this.socket.readyState&&this.socket.close(),delete this.socket),this.connectOptions.uris&&this.hostIndexb)throw Error(f(h.INVALID_TYPE,[typeof b,"port"]));if("string"!==typeof c)throw Error(f(h.INVALID_TYPE,[typeof c,"path"]));e="ws://"+(-1!==a.indexOf(":")&&"["!==a.slice(0,1)&&"]"!==a.slice(-1)?"["+a+"]":a)+":"+b+c}for(var m= +g=0;m=n&&m++;g++}if("string"!==typeof k||65535a.mqttVersion)throw Error(f(h.INVALID_ARGUMENT,[a.mqttVersion,"connectOptions.mqttVersion"]));void 0=== +a.mqttVersion?(a.mqttVersionExplicit=!1,a.mqttVersion=4):a.mqttVersionExplicit=!0;if(void 0!==a.password&&void 0===a.userName)throw Error(f(h.INVALID_ARGUMENT,[a.password,"connectOptions.password"]));if(a.willMessage){if(!(a.willMessage instanceof r))throw Error(f(h.INVALID_TYPE,[a.willMessage,"connectOptions.willMessage"]));a.willMessage.stringPayload=null;if("undefined"===typeof a.willMessage.destinationName)throw Error(f(h.INVALID_TYPE,[typeof a.willMessage.destinationName,"connectOptions.willMessage.destinationName"])); +}"undefined"===typeof a.cleanSession&&(a.cleanSession=!0);if(a.hosts){if(!(a.hosts instanceof Array))throw Error(f(h.INVALID_ARGUMENT,[a.hosts,"connectOptions.hosts"]));if(1>a.hosts.length)throw Error(f(h.INVALID_ARGUMENT,[a.hosts,"connectOptions.hosts"]));for(var b=!1,d=0;da.ports[d])throw Error(f(h.INVALID_TYPE,[typeof a.ports[d],"connectOptions.ports["+d+"]"]));var b=a.hosts[d],g=a.ports[d];e="ws://"+(-1!==b.indexOf(":")?"["+b+"]":b)+":"+g+c;a.uris.push(e)}}}l.connect(a)};this.subscribe=function(a,b){if("string"!==typeof a)throw Error("Invalid argument:"+a);b=b||{};z(b,{qos:"number",invocationContext:"object",onSuccess:"function",onFailure:"function",timeout:"number"});if(b.timeout&&!b.onFailure)throw Error("subscribeOptions.timeout specified with no onFailure callback."); +if("undefined"!==typeof b.qos&&0!==b.qos&&1!==b.qos&&2!==b.qos)throw Error(f(h.INVALID_ARGUMENT,[b.qos,"subscribeOptions.qos"]));l.subscribe(a,b)};this.unsubscribe=function(a,b){if("string"!==typeof a)throw Error("Invalid argument:"+a);b=b||{};z(b,{invocationContext:"object",onSuccess:"function",onFailure:"function",timeout:"number"});if(b.timeout&&!b.onFailure)throw Error("unsubscribeOptions.timeout specified with no onFailure callback.");l.unsubscribe(a,b)};this.send=function(a,b,c,d){var e;if(0=== +arguments.length)throw Error("Invalid argument.length");if(1==arguments.length){if(!(a instanceof r)&&"string"!==typeof a)throw Error("Invalid argument:"+typeof a);e=a;if("undefined"===typeof e.destinationName)throw Error(f(h.INVALID_ARGUMENT,[e.destinationName,"Message.destinationName"]));}else e=new r(b),e.destinationName=a,3<=arguments.length&&(e.qos=c),4<=arguments.length&&(e.retained=d);l.send(e)};this.publish=function(a,b,c,d){console.log("Publising message to: ",a);var e;if(0===arguments.length)throw Error("Invalid argument.length"); +if(1==arguments.length){if(!(a instanceof r)&&"string"!==typeof a)throw Error("Invalid argument:"+typeof a);e=a;if("undefined"===typeof e.destinationName)throw Error(f(h.INVALID_ARGUMENT,[e.destinationName,"Message.destinationName"]));}else e=new r(b),e.destinationName=a,3<=arguments.length&&(e.qos=c),4<=arguments.length&&(e.retained=d);l.send(e)};this.disconnect=function(){l.disconnect()};this.getTraceLog=function(){return l.getTraceLog()};this.startTrace=function(){l.startTrace()};this.stopTrace= +function(){l.stopTrace()};this.isConnected=function(){return l.connected}};G.prototype={get host(){return this._getHost()},set host(a){this._setHost(a)},get port(){return this._getPort()},set port(a){this._setPort(a)},get path(){return this._getPath()},set path(a){this._setPath(a)},get clientId(){return this._getClientId()},set clientId(a){this._setClientId(a)},get onConnected(){return this._getOnConnected()},set onConnected(a){this._setOnConnected(a)},get disconnectedPublishing(){return this._getDisconnectedPublishing()}, +set disconnectedPublishing(a){this._setDisconnectedPublishing(a)},get disconnectedBufferSize(){return this._getDisconnectedBufferSize()},set disconnectedBufferSize(a){this._setDisconnectedBufferSize(a)},get onConnectionLost(){return this._getOnConnectionLost()},set onConnectionLost(a){this._setOnConnectionLost(a)},get onMessageDelivered(){return this._getOnMessageDelivered()},set onMessageDelivered(a){this._setOnMessageDelivered(a)},get onMessageArrived(){return this._getOnMessageArrived()},set onMessageArrived(a){this._setOnMessageArrived(a)}, +get trace(){return this._getTrace()},set trace(a){this._setTrace(a)}};var r=function(a){var b;if("string"===typeof a||a instanceof ArrayBuffer||a instanceof Int8Array||a instanceof Uint8Array||a instanceof Int16Array||a instanceof Uint16Array||a instanceof Int32Array||a instanceof Uint32Array||a instanceof Float32Array||a instanceof Float64Array)b=a;else throw f(h.INVALID_ARGUMENT,[a,"newPayload"]);this._getPayloadString=function(){return"string"===typeof b?b:E(b,0,b.length)};this._getPayloadBytes= +function(){if("string"===typeof b){var a=new ArrayBuffer(n(b)),a=new Uint8Array(a);D(b,a,0);return a}return b};var c;this._getDestinationName=function(){return c};this._setDestinationName=function(a){if("string"===typeof a)c=a;else throw Error(f(h.INVALID_ARGUMENT,[a,"newDestinationName"]));};var d=0;this._getQos=function(){return d};this._setQos=function(a){if(0===a||1===a||2===a)d=a;else throw Error("Invalid argument:"+a);};var e=!1;this._getRetained=function(){return e};this._setRetained=function(a){if("boolean"=== +typeof a)e=a;else throw Error(f(h.INVALID_ARGUMENT,[a,"newRetained"]));};var g=!1;this._getDuplicate=function(){return g};this._setDuplicate=function(a){g=a}};r.prototype={get payloadString(){return this._getPayloadString()},get payloadBytes(){return this._getPayloadBytes()},get destinationName(){return this._getDestinationName()},set destinationName(a){this._setDestinationName(a)},get topic(){return this._getDestinationName()},set topic(a){this._setDestinationName(a)},get qos(){return this._getQos()}, +set qos(a){this._setQos(a)},get retained(){return this._getRetained()},set retained(a){this._setRetained(a)},get duplicate(){return this._getDuplicate()},set duplicate(a){this._setDuplicate(a)}};return{Client:G,Message:r}}(window)}); \ No newline at end of file diff --git a/firmware/ori/board/pluto/post-build.sh b/firmware/ori/board/pluto/post-build.sh new file mode 100755 index 0000000..37cdcfd --- /dev/null +++ b/firmware/ori/board/pluto/post-build.sh @@ -0,0 +1,100 @@ +#!/bin/sh +# args from BR2_ROOTFS_POST_SCRIPT_ARGS +# $2 board name +. ${BR2_CONFIG} +set -e + +INSTALL=install + +date +"%d%m" > ${TARGET_DIR}/www/fwversion.txt +#touch ${TARGET_DIR}/www/releasenote.txt +#git --git-dir=${BR2_EXTERNAL}/.git log --pretty=oneline --abbrev-commit > ${TARGET_DIR}/www/releasenote.txt +# Add a console on tty1 +grep -qE '^ttyGS0::' ${TARGET_DIR}/etc/inittab || \ +sed -i '/GENERIC_SERIAL/a\ +ttyGS0::respawn:/sbin/getty -L ttyGS0 0 vt100 # USB console' ${TARGET_DIR}/etc/inittab + +grep -qE '^::sysinit:/bin/mount -t debugfs' ${TARGET_DIR}/etc/inittab || \ +sed -i '/hostname/a\ +::sysinit:/bin/mount -t debugfs none /sys/kernel/debug/' ${TARGET_DIR}/etc/inittab + +sed -i -e '/::sysinit:\/bin\/hostname -F \/etc\/hostname/d' ${TARGET_DIR}/etc/inittab + +grep -q mtd2 ${TARGET_DIR}/etc/fstab || echo "mtd2 /mnt/jffs2 jffs2 rw,noatime 0 0" >> ${TARGET_DIR}/etc/fstab + +BOARD_DIR="$(dirname $0)" +BOARD_NAME="$(basename ${BOARD_DIR})" +GENIMAGE_CFG="${BOARD_DIR}/genimage-msd.cfg" +GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" +GCC_VERSION=$(${BR2_TOOLCHAIN_EXTERNAL_PREFIX}-gcc --version | head -1 | sed 's/.*(\(.*\))/\1/') +BIN_VERSION=$(${BR2_TOOLCHAIN_EXTERNAL_PREFIX}-as --version | head -1 | sed 's/.*(\(.*\))/\1/') +GCC_TRIPLE=$(${BR2_TOOLCHAIN_EXTERNAL_PREFIX}-gcc -v -c 2>&1 | sed 's/ /\n/g' | grep -e "--target" | awk -F= '{print $2}') +if [ "$BR2_TARGET_GENERIC_ROOT_PASSWD" = "analog" ] ; then + ROOTPASSWD=$BR2_TARGET_GENERIC_ROOT_PASSWD; +else + ROOTPASSWD="********" +fi + +sed -e "s/#GCC_TRIPLE#/$GCC_TRIPLE/g" -e "s/#GCC_VERSION#/$GCC_VERSION/g" -e "s/#BIN_VERSION#/$BIN_VERSION/g" ${BOARD_DIR}/index.html -e "s/#ROOTPASSWORD#/$ROOTPASSWD/g" > ${BOARD_DIR}/msd/index.html + +rm -rf "${GENIMAGE_TMP}" + +genimage \ + --rootpath "${TARGET_DIR}" \ + --tmppath "${GENIMAGE_TMP}" \ + --inputpath "${BOARD_DIR}/msd" \ + --outputpath "${TARGET_DIR}/opt/" \ + --config "${GENIMAGE_CFG}" + +rm -f ${TARGET_DIR}/opt/boot.vfat +rm -f ${TARGET_DIR}/etc/init.d/S99iiod +rm -Rf ${TARGET_DIR}/etc/dropbear + +mkdir -p ${TARGET_DIR}/www/msd/img +mkdir -p ${TARGET_DIR}/www/msd +mkdir -p ${TARGET_DIR}/www/img +mkdir -p ${TARGET_DIR}/etc/wpa_supplicant/ +mkdir -p ${TARGET_DIR}/mnt/jffs2 +mkdir -p ${TARGET_DIR}/mnt/msd +mkdir -p ${TARGET_DIR}/etc/dropbear + +${INSTALL} -D -m 0755 ${BOARD_DIR}/update.sh ${TARGET_DIR}/sbin/ +${INSTALL} -D -m 0755 ${BOARD_DIR}/update_frm.sh ${TARGET_DIR}/sbin/ +${INSTALL} -D -m 0755 ${BOARD_DIR}/udc_handle_suspend.sh ${TARGET_DIR}/sbin/ +${INSTALL} -D -m 0755 ${BOARD_DIR}/S10mdev ${TARGET_DIR}/etc/init.d/ +${INSTALL} -D -m 0755 ${BOARD_DIR}/S15watchdog ${TARGET_DIR}/etc/init.d/ +${INSTALL} -D -m 0755 ${BOARD_DIR}/S20urandom ${TARGET_DIR}/etc/init.d/ +${INSTALL} -D -m 0755 ${BOARD_DIR}/S21misc ${TARGET_DIR}/etc/init.d/ +${INSTALL} -D -m 0755 ${BOARD_DIR}/S23udc ${TARGET_DIR}/etc/init.d/ +${INSTALL} -D -m 0755 ${BOARD_DIR}/S40network ${TARGET_DIR}/etc/init.d/ +${INSTALL} -D -m 0755 ${BOARD_DIR}/S41network ${TARGET_DIR}/etc/init.d/ +${INSTALL} -D -m 0755 ${BOARD_DIR}/S45msd ${TARGET_DIR}/etc/init.d/ +${INSTALL} -D -m 0644 ${BOARD_DIR}/fw_env.config ${TARGET_DIR}/etc/ +${INSTALL} -D -m 0644 ${BOARD_DIR}/VERSIONS ${TARGET_DIR}/opt/ +${INSTALL} -D -m 0755 ${BOARD_DIR}/device_reboot ${TARGET_DIR}/usr/sbin/ +${INSTALL} -D -m 0755 ${BOARD_DIR}/device_passwd ${TARGET_DIR}/usr/sbin/ +${INSTALL} -D -m 0755 ${BOARD_DIR}/device_persistent_keys ${TARGET_DIR}/usr/sbin/ +${INSTALL} -D -m 0755 ${BOARD_DIR}/device_format_jffs2 ${TARGET_DIR}/usr/sbin/ +${INSTALL} -D -m 0644 ${BOARD_DIR}/motd ${TARGET_DIR}/etc/ +${INSTALL} -D -m 0755 ${BOARD_DIR}/test_ensm_pinctrl.sh ${TARGET_DIR}/usr/sbin/ +${INSTALL} -D -m 0644 ${BOARD_DIR}/device_config ${TARGET_DIR}/etc/ +${INSTALL} -D -m 0644 ${BOARD_DIR}/mdev.conf ${TARGET_DIR}/etc/ +${INSTALL} -D -m 0755 ${BOARD_DIR}/automounter.sh ${TARGET_DIR}/lib/mdev/automounter.sh +${INSTALL} -D -m 0755 ${BOARD_DIR}/ifupdown.sh ${TARGET_DIR}/lib/mdev/ifupdown.sh +${INSTALL} -D -m 0644 ${BOARD_DIR}/input-event-daemon.conf ${TARGET_DIR}/etc/ + +${INSTALL} -D -m 0644 ${BOARD_DIR}/msd/img/* ${TARGET_DIR}/www/img/ +${INSTALL} -D -m 0644 ${BOARD_DIR}/msd/*.html ${TARGET_DIR}/www/ + +${INSTALL} -D -m 0755 ${BOARD_DIR}/wpa_supplicant/* ${TARGET_DIR}/etc/wpa_supplicant/ + +ln -sf ../../wpa_supplicant/ifupdown.sh ${TARGET_DIR}/etc/network/if-up.d/wpasupplicant +ln -sf ../../wpa_supplicant/ifupdown.sh ${TARGET_DIR}/etc/network/if-down.d/wpasupplicant +ln -sf ../../wpa_supplicant/ifupdown.sh ${TARGET_DIR}/etc/network/if-pre-up.d/wpasupplicant +ln -sf ../../wpa_supplicant/ifupdown.sh ${TARGET_DIR}/etc/network/if-post-down.d/wpasupplicant + +ln -sf device_reboot ${TARGET_DIR}/usr/sbin/pluto_reboot +#rm -rf ${TARGET_DIR}/usr/share/satdump/resources +#Remove not needed srt applictations +rm -rf ${TARGET_DIR}/usr/bin/srt-file-transmit +rm -rf ${TARGET_DIR}/usr/bin/srt-tunnel \ No newline at end of file diff --git a/firmware/ori/board/pluto/test_ensm_pinctrl.sh b/firmware/ori/board/pluto/test_ensm_pinctrl.sh new file mode 100755 index 0000000..963b22e --- /dev/null +++ b/firmware/ori/board/pluto/test_ensm_pinctrl.sh @@ -0,0 +1,130 @@ +#!/bin/sh + +find_zynq_base_gpio () { + for i in /sys/class/gpio/gpiochip*; do + if [ "zynq_gpio" = `cat $i/label` ]; then + echo $i | sed 's/^[^0-9]\+//' + break + fi + done + return -1 +} + +fdd_pin_control_test () { + echo Running FDD Pin Control Test + while true; do + echo high > $ENABLE # RX&TX ON + + sleep 1 + + echo low > $ENABLE # RX&TX OFF + + sleep 1 + + done +} + +fdd_independant_mode_pin_control_test () { + echo Running FDD Independant Pin Control Test + while true; do + echo high > $ENABLE # RX ON + echo low > $TXNRX # TX OFF + + sleep 1 + + echo high > $TXNRX #TX ON + + sleep 1 + + done +} + +tdd_pin_control_test () { + + echo Running TDD Pin Control Test + while true; do + + # RX + echo low > $ENABLE + echo low > $TXNRX + echo low > $TXNRX # add some extra delay required for VCO cal in single synthesizer mode. + echo high > $ENABLE + + sleep 1 + + # TX + echo low > $ENABLE + echo high > $TXNRX + echo high > $TXNRX # add some extra delay required for VCO cal in single synthesizer mode. + echo high > $ENABLE + + sleep 1 + done +} + +if [ `id -u` != "0" ] +then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +for i in $(find -L /sys/bus/iio/devices -maxdepth 2 -name name) +do + dev_name=$(cat $i) + if [ "$dev_name" = "ad9361-phy" ]; then + phy_path=$(echo $i | sed 's:/name$::') + ensm_modes=$(cat $phy_path/ensm_mode_available) + break + fi +done + +if [ "$dev_name" != "ad9361-phy" ]; then + echo "This test if for FMCOMMS2/3/4 and pluto only" + exit +fi + +GPIO_BASE=$(find_zynq_base_gpio) + +cd /sys/class/gpio + +if [ $GPIO_BASE -ge 0 ] +then + GPIO_ENABLE=`expr $GPIO_BASE + 69` + GPIO_TXNRX=`expr $GPIO_BASE + 70` + #Export the CTRL_IN GPIOs + echo $GPIO_ENABLE > export 2> /dev/null + echo $GPIO_TXNRX > export 2> /dev/null +else + echo ERROR: Wrong board? + exit +fi + +ENABLE=gpio${GPIO_ENABLE}/direction +TXNRX=gpio${GPIO_TXNRX}/direction + +echo low > $ENABLE +echo low > $TXNRX + +echo Press CTRL-C to exit + +case "$ensm_modes" in + *fdd*) + echo "Type: 0 for FDD Pin Control Mode" + echo "Type: 1 for FDD Independant Pin Control Mode" + + read mode + + if [ $mode = "1" ]; then + echo pinctrl_fdd_indep > $phy_path/ensm_mode #Enable Pincontrol Mode + fdd_independant_mode_pin_control_test + else + echo pinctrl > $phy_path/ensm_mode #Enable Pincontrol Mode + fdd_pin_control_test + fi + + ;; + *rx*) + echo pinctrl > $phy_path/ensm_mode #Enable Pincontrol Mode + tdd_pin_control_test + ;; +esac diff --git a/firmware/ori/board/pluto/udc_handle_suspend.sh b/firmware/ori/board/pluto/udc_handle_suspend.sh new file mode 100644 index 0000000..785482e --- /dev/null +++ b/firmware/ori/board/pluto/udc_handle_suspend.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +source /etc/device_config + +DEV_NAME= + +for dev in /sys/bus/iio/devices/*; do + [ `cat ${dev}/name` == "ad9361-phy" ] && DEV_NAME=`basename ${dev}` +done + +prev_ensm_mode=`cat /sys/bus/iio/devices/${DEV_NAME}/ensm_mode` + +while [ 1 ] +do + +state=`/sbin/poll_sysfs /sys/class/udc/ci_hdrc.0/state` +case "$state" in + suspended) + prev_ensm_mode=`cat /sys/bus/iio/devices/${DEV_NAME}/ensm_mode` + echo sleep > /sys/bus/iio/devices/${DEV_NAME}/ensm_mode + echo none > /sys/class/leds/led0:green/trigger + echo "UDC: $state: $prev_ensm_mode -> sleep" | logger + ;; + *) + current_ensm_mode=`cat /sys/bus/iio/devices/${DEV_NAME}/ensm_mode` + echo heartbeat > /sys/class/leds/led0:green/trigger + if [ "$current_ensm_mode" != "$prev_ensm_mode" ] + then + echo $prev_ensm_mode > /sys/bus/iio/devices/${DEV_NAME}/ensm_mode + fi + echo "UDC: $state: $current_ensm_mode -> $prev_ensm_mode" | logger + ;; +esac +done diff --git a/firmware/ori/board/pluto/update.sh b/firmware/ori/board/pluto/update.sh new file mode 100644 index 0000000..7568771 --- /dev/null +++ b/firmware/ori/board/pluto/update.sh @@ -0,0 +1,284 @@ +#!/bin/sh + +source /etc/device_config + +file=/sys/kernel/config/usb_gadget/composite_gadget/functions/mass_storage.0/lun.0/file +bootimage=/mnt/msd/boot.frm +conf=/mnt/msd/config.txt +img=/opt/vfat.img + +ini_parser() { + FILE=$1 + SECTION=$2 + eval `sed -e 's/[[:space:]]*\=[[:space:]]*/=/g' \ + -e 's/[#;\`].*$//' \ + -e 's/[[:space:]]*$//' \ + -e 's/^[[:space:]]*//' \ + -e "s/^\(.*\)=\([^\"']*\)$/\1=\"\2\"/" \ + < $FILE \ + | sed -n -e "/^\[$SECTION\]/,/^\s*\[/{/^[^;].*\=.*/p;}"` +} + +reset() { + echo "REBOOT/RESET using Watchdog timeout" + flash_indication_off + sync + device_reboot reset + sleep 10 +} + +dfu() { + echo "Entering DFU mode using SW Reset" + flash_indication_off + sync + device_reboot sf +} + +flash_indication_on() { + echo timer > /sys/class/leds/led0:green/trigger + echo 40 > /sys/class/leds/led0:green/delay_off + echo 40 > /sys/class/leds/led0:green/delay_on +} + +flash_indication_off() { + echo heartbeat > /sys/class/leds/led0:green/trigger +} + +make_diagnostic_report () { + FILE=$1 + cat /opt/VERSIONS /etc/os-release /var/log/messages /proc/cpuinfo /proc/interrupts /proc/iomem /proc/meminfo /proc/cmdline /sys/kernel/debug/clk/clk_summary > ${FILE} + grep -r "" /sys/kernel/debug/regmap/ >> ${FILE} 2>&1 + iio_info >> ${FILE} 2>&1 + ifconfig -a >> ${FILE} 2>&1 + mount >> ${FILE} 2>&1 + top -b -n1 >> ${FILE} 2>&1 + fw_printenv >> ${FILE} 2>&1 + unix2dos ${FILE} +} + +calibrate () { + /usr/sbin/ad936x_ref_cal -e $1 ad9361-phy + if [ $? -eq 0 ]; then + + for dev in /sys/bus/iio/devices/*; do + [ `cat ${dev}/name` == "ad9361-phy" ] && DEV_NAME=`basename ${dev}` + done + NEW_XO=`cat /sys/bus/iio/devices/${DEV_NAME}/xo_correction` + flash_indication_on + fw_setenv xo_correction $NEW_XO + flash_indication_off + + sed -i -e "s/^xo_correction .*$/xo_correction = $NEW_XO/" -e "s/^calibrate .*$/calibrate = 0/" $conf + else + sed -i -e "s/^calibrate .*$/calibrate = 0/" $conf + fi +} + +process_ini() { + FILE=$1 + + ini_parser $FILE "NETWORK" + ini_parser $FILE "WLAN" + ini_parser $FILE "SYSTEM" + ini_parser $FILE "USB_ETHERNET" + + rm -f /mnt/msd/SUCCESS_ENV_UPDATE /mnt/msd/FAILED_INVALID_UBOOT_ENV /mnt/msd/CAL_STATUS + + + fw_printenv qspiboot + if [ $? -eq 0 ]; then + flash_indication_on + echo "hostname $hostname" > /opt/fw_set.tmp + echo "ipaddr $ipaddr" >> /opt/fw_set.tmp + echo "ipaddr_host $ipaddr_host" >> /opt/fw_set.tmp + echo "netmask $netmask" >> /opt/fw_set.tmp + echo "ssid_wlan $ssid_wlan" >> /opt/fw_set.tmp + echo "ipaddr_wlan $ipaddr_wlan" >> /opt/fw_set.tmp + echo "pwd_wlan $pwd_wlan" >> /opt/fw_set.tmp + echo "xo_correction $xo_correction" >> /opt/fw_set.tmp + echo "udc_handle_suspend $udc_handle_suspend" >> /opt/fw_set.tmp + echo "usb_ethernet_mode $usb_ethernet_mode" >> /opt/fw_set.tmp + echo "ipaddr_eth $ipaddr_eth" >> /opt/fw_set.tmp + echo "netmask_eth $netmask_eth" >> /opt/fw_set.tmp + echo "gateway_eth $gateway_eth" >> /opt/fw_set.tmp + echo "ipaddr_eth2 $ipaddr_eth2" >> /opt/fw_set.tmp + echo "netmask_eth2 $netmask_eth2" >> /opt/fw_set.tmp + echo "gateway_eth2 $gateway_eth2" >> /opt/fw_set.tmp + + fw_setenv -s /opt/fw_set.tmp + rm /opt/fw_set.tmp + flash_indication_off + touch /mnt/msd/SUCCESS_ENV_UPDATE + + else + touch /mnt/msd/FAILED_INVALID_UBOOT_ENV + fi + + ini_parser $FILE "ACTIONS" + + if [ "$reset" == "1" ] + then + reset + fi + + if [ "$dfu" == "1" ] + then + dfu + fi + + if [ "$diagnostic_report" == "1" ] + then + make_diagnostic_report /mnt/msd/diagnostic_report + fi + + if [ "$calibrate" -gt "70000000" ] + then + calibrate $calibrate > /mnt/msd/CAL_STATUS + fi + + echo here_1: > /mnt/msd/status + + if [ "$revert_passwd" == "1" ] + then + echo here $revert_passwd >> /mnt/msd/status + rm -f /mnt/jffs2/etc/passwd /mnt/jffs2/etc/group /mnt/jffs2/etc/password.md5 /mnt/jffs2/etc/shadow 2>&1 >> /mnt/msd/status + echo here_2: >> /mnt/msd/status + fi + + md5sum $FILE > /opt/config.md5 +} + +handle_boot_frm () { + FILE="$1" + rm -f /mnt/msd/BOOT_SUCCESS /mnt/msd/BOOT_FAILED /mnt/msd/FAILED_MTD_PARTITION_ERROR /mnt/msd/FAILED_BOOT_CHSUM_ERROR + head -3 /proc/mtd | sed 's/00010000/00001000/g' > /opt/mtd + + md5=`tail -c 33 ${FILE}` + head -c -33 ${FILE} > /opt/boot_and_env_and_mtdinfo.bin + + tail -c 1024 /opt/boot_and_env_and_mtdinfo.bin | head -3 > /opt/mtd-info.txt + head -c -1024 /opt/boot_and_env_and_mtdinfo.bin > /opt/boot_and_env.bin + + tail -c 131072 /opt/boot_and_env.bin > /opt/u-boot-env.bin + head -c -131072 /opt/boot_and_env.bin > /opt/boot.bin + + frm=`md5sum /opt/boot_and_env_and_mtdinfo.bin | cut -d ' ' -f 1` + + if [ "$frm" = "$md5" ] + then + diff -w /opt/mtd /opt/mtd-info.txt + if [ $? -eq 0 ]; then + flash_indication_on + dd if=/opt/boot.bin of=/dev/mtdblock0 bs=64k && dd if=/opt/u-boot-env.bin of=/dev/mtdblock1 bs=64k && do_reset=1 && touch /mnt/msd/BOOT_SUCCESS || touch /mnt/msd/BOOT_FAILED + flash_indication_off + else + cat /opt/mtd /opt/mtd-info.txt > /mnt/msd/FAILED_MTD_PARTITION_ERROR + do_reset=0 + fi + else + echo $md5 $frm > /mnt/msd/FAILED_BOOT_CHSUM_ERROR + do_reset=0 + fi + + rm -f ${FILE} /opt/boot_and_env_and_mtdinfo.bin /opt/mtd-info.txt /opt/boot_and_env.bin /opt/u-boot-env.bin /opt/boot.bin /opt/mtd +} + + + +handle_frimware_frm () { + FILE="$1" + MAGIC="$2" + rm -f /mnt/msd/SUCCESS /mnt/msd/FAILED /mnt/msd/FAILED_FIRMWARE_CHSUM_ERROR + md5=`tail -c 33 ${FILE}` + head -c -33 ${FILE} > /opt/firmware.frm + FRM_SIZE=`cat /opt/firmware.frm | wc -c | xargs printf "%X\n"` + frm=`md5sum /opt/firmware.frm | cut -d ' ' -f 1` + if [ "$frm" = "$md5" ] + then + flash_indication_on + grep -q "${MAGIC}" /opt/firmware.frm && dd if=/opt/firmware.frm of=/dev/mtdblock3 bs=64k && fw_setenv fit_size ${FRM_SIZE} && do_reset=1 && touch /mnt/msd/SUCCESS || touch /mnt/msd/FAILED + flash_indication_off + else + echo $frm $md5 > /mnt/msd/FAILED_FIRMWARE_CHSUM_ERROR + do_reset=0 + fi + + rm -f ${FILE} /opt/firmware.frm + sync +} + +while [ 1 ] +do + if [[ -r ${file} ]] + then + lun=`cat $file` + if [ ${#lun} -eq 0 ] + then + do_reset=0 + losetup /dev/loop7 $img -o 512 + mkdir -p /mnt/msd + mount /dev/loop7 /mnt/msd + + if [[ -s /mnt/msd/$TARGET-fw-*.zip ]] + then + mv /mnt/msd/$TARGET-fw-*.zip /opt/ + unzip -o /opt/$TARGET-fw-*.zip *.frm -d /mnt/msd + rm /opt/$TARGET-fw-*.zip + fi + + if [[ -s ${FIRMWARE} ]] + then + handle_frimware_frm "${FIRMWARE}" "${FRM_MAGIC}" + fi + + if [[ -s ${bootimage} ]] + then + handle_boot_frm "${bootimage}" + fi + + md5sum -c /opt/config.md5 || process_ini $conf + + if [ "$TARGET" == "m2k" ]; then + if [[ -s /mnt/msd/${CALIBFILENAME} ]]; then + md5sum -c /opt/${CALIBFILENAME}.md5 + if [ $? -ne 0 ]; then + cp /mnt/msd/${CALIBFILENAME} /mnt/jffs2/${CALIBFILENAME} && do_reset=1 + fi + + else + rm /mnt/jffs2/${CALIBFILENAME} && do_reset=1 + fi + + if [[ -s /mnt/msd/${CALIBFILENAME_FACTORY} ]]; then + if [[ ! -s /mnt/jffs2/${CALIBFILENAME_FACTORY} ]]; then + cp /mnt/msd/${CALIBFILENAME_FACTORY} /mnt/jffs2/${CALIBFILENAME_FACTORY} + do_reset=1 + fi + fi + + if [[ -s /mnt/msd/${CALIBFILENAME_TEMP_LUT} ]]; then + cp /mnt/msd/${CALIBFILENAME_TEMP_LUT} /mnt/jffs2/${CALIBFILENAME_TEMP_LUT} + do_reset=1 + fi + fi + + if [[ $do_reset = 1 ]] + then + reset + fi + + cp /opt/ipaddr-* /mnt/msd 2>/dev/null + + umount /mnt/msd + #losetup -d /dev/loop7 + echo $img > $file + flash_indication_off + sleep 1 + fi +fi + +sleep 1 + +done + +exit 1 diff --git a/firmware/ori/board/pluto/update_frm.sh b/firmware/ori/board/pluto/update_frm.sh new file mode 100644 index 0000000..d0b42f1 --- /dev/null +++ b/firmware/ori/board/pluto/update_frm.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +#set -x + +source /etc/device_config + +FRM_FILE="$1" + +flash_indication_on() { + echo timer > /sys/class/leds/led0:green/trigger + echo 40 > /sys/class/leds/led0:green/delay_off + echo 40 > /sys/class/leds/led0:green/delay_on +} + +flash_indication_off() { + echo heartbeat > /sys/class/leds/led0:green/trigger +} + +handle_frimware_frm () { + FILE="$1" + MAGIC="$2" + md5=`tail -c 33 ${FILE}` + head -c -33 ${FILE} > /opt/firmware.frm + FRM_SIZE=`cat /opt/firmware.frm | wc -c | xargs printf "%X\n"` + frm=`md5sum /opt/firmware.frm | cut -d ' ' -f 1` + if [ "$frm" = "$md5" ] + then + flash_indication_on + grep -q "${MAGIC}" /opt/firmware.frm && dd if=/opt/firmware.frm of=/dev/mtdblock3 bs=64k && fw_setenv fit_size ${FRM_SIZE} && echo "Done" || echo "Failed" + flash_indication_off + rm -f /opt/firmware.frm + sync + exit 0 + else + rm -f /opt/firmware.frm + echo Failed Checksum error: $frm $md5 + exit 1 + fi +} + + + +if [[ -f ${FRM_FILE} ]] && [[ ${FRM_FILE: -4} == ".frm" ]] && [[ -s ${FRM_FILE} ]] +then + handle_frimware_frm "${FRM_FILE}" "${FRM_MAGIC}" +else + echo "Failed" + exit 1 +fi diff --git a/firmware/ori/board/pluto/wpa_supplicant/action_wpa.sh b/firmware/ori/board/pluto/wpa_supplicant/action_wpa.sh new file mode 100644 index 0000000..bb4c7c1 --- /dev/null +++ b/firmware/ori/board/pluto/wpa_supplicant/action_wpa.sh @@ -0,0 +1,50 @@ +#!/bin/sh + +# Action script to enable/disable wpa-roam interfaces in reaction to +# ifplugd events. +# +# Copyright: Copyright (c) 2008-2010, Kel Modderman +# License: GPL-2 +# + +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +if [ ! -x /sbin/wpa_action ]; then + exit 0 +fi + +# ifplugd(8) - +# +# If an ifplugd managed interface is brought up, disconnect any +# wpa-roam managed interfaces so that only one "roaming" interface +# remains active on the system. + +IFPLUGD_IFACE="${1}" + +case "${2}" in + up) + COMMAND=disconnect + ;; + down) + COMMAND=reconnect + ;; + *) + echo "$0: unknown arguments: ${@}" >&2 + exit 1 + ;; +esac + +for CTRL in /run/wpa_supplicant/*; do + [ -S "${CTRL}" ] || continue + + IFACE="${CTRL#/run/wpa_supplicant/}" + + # skip if ifplugd is managing this interface + if [ "${IFPLUGD_IFACE}" = "${IFACE}" ]; then + continue + fi + + if wpa_action "${IFACE}" check; then + wpa_cli -i "${IFACE}" "${COMMAND}" + fi +done diff --git a/firmware/ori/board/pluto/wpa_supplicant/functions.sh b/firmware/ori/board/pluto/wpa_supplicant/functions.sh new file mode 100644 index 0000000..bf01819 --- /dev/null +++ b/firmware/ori/board/pluto/wpa_supplicant/functions.sh @@ -0,0 +1,1006 @@ +#!/bin/sh + +##################################################################### +## Purpose +# This file contains common shell functions used by scripts of the +# wpasupplicant package to allow ifupdown to manage wpa_supplicant. +# It also contains some functions used by wpa_action(8) that allow +# ifupdown to be managed by wpa_cli(8) action events. +# +# This file is provided by the wpasupplicant package. + +##################################################################### +# Copyright (C) 2006 - 2009 Debian/Ubuntu wpasupplicant Maintainers +# +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# On Debian GNU/Linux systems, the text of the GPL license, +# version 2, can be found in /usr/share/common-licenses/GPL-2. + +##################################################################### +## global variables +# wpa_supplicant variables +WPA_SUP_BIN="/usr/sbin/wpa_supplicant" +WPA_SUP_PNAME="wpa_supplicant" +WPA_SUP_PIDFILE="/run/wpa_supplicant.${WPA_IFACE}.pid" +WPA_SUP_OMIT_DIR="/run/sendsigs.omit.d" +WPA_SUP_OMIT_PIDFILE="${WPA_SUP_OMIT_DIR}/wpasupplicant.wpa_supplicant.${WPA_IFACE}.pid" + +# wpa_cli variables +WPA_CLI_BIN="/usr/sbin/wpa_cli" +WPA_CLI_PNAME="wpa_cli" +WPA_CLI_PIDFILE="/run/wpa_action.${WPA_IFACE}.pid" +WPA_CLI_TIMESTAMP="/run/wpa_action.${WPA_IFACE}.timestamp" +WPA_CLI_IFUPDOWN="/run/wpa_action.${WPA_IFACE}.ifupdown" + +# default ctrl_interface socket directory +if [ -z "$WPA_CTRL_DIR" ]; then + WPA_CTRL_DIR="/run/wpa_supplicant" +fi + +# verbosity variables +if [ -n "$IF_WPA_VERBOSITY" ] || [ "$VERBOSITY" = "1" ]; then + TO_NULL="/dev/stdout" + DAEMON_VERBOSITY="--verbose" +else + TO_NULL="/dev/null" + DAEMON_VERBOSITY="--quiet" +fi + +##################################################################### +## wpa_cli wrapper +# Path to common ctrl_interface socket and iface supplied. +# NB: WPA_CTRL_DIR cannot be used for interactive commands, it is +# set only in the environment that wpa_cli provides when processing +# action events. +# +wpa_cli () { + "$WPA_CLI_BIN" -p "$WPA_CTRL_DIR" -i "$WPA_IFACE" "$@" + + return "$?" +} + +##################################################################### +## verbose and stderr message wrapper +# Ensures a standard and easily identifiable message is printed by +# scripts using this function library. +# +# log Log a message to syslog when called non-interactively +# by wpa_action +# +# verbose To stdout when IF_WPA_VERBOSITY or VERBOSITY is true +# +# action Same as verbose but without newline +# Useful for allowing wpa_cli commands to echo result +# value of 'OK' or 'FAILED' +# +# stderr Echo warning or error messages to stderr +# +# NB: when called by wpa_action, there is no redirection (verbose) +# +wpa_msg () { + if [ "$1" = "log" ]; then + shift + case "$WPA_ACTION" in + "CONNECTED"|"DISCONNECTED") + [ -x /usr/bin/logger ] || return + if [ "$#" -gt 0 ]; then + logger -t "wpa_action" "$@" + else + logger -t "wpa_action" + fi + ;; + *) + [ "$#" -gt 0 ] && echo "wpa_action: $@" + ;; + esac + return + fi + + case "$1" in + "verbose") + shift + echo "$WPA_SUP_PNAME: $@" >$TO_NULL + ;; + "action") + shift + echo -n "$WPA_SUP_PNAME: $@ -- " >$TO_NULL + ;; + "stderr") + shift + echo "$WPA_SUP_PNAME: $@" >/dev/stderr + ;; + *) + ;; + esac +} + +##################################################################### +## validate daemon pid files +# Test daemon process ID files via start-stop-daemon with a signal 0 +# given the exec binary and pidfile location. +# +# $1 daemon +# $2 pidfile +# +# Returns true when pidfile exists, the process ID exists _and_ was +# created by the exec binary. +# +# If the test fails, but the pidfile exists, it is stale +# +test_daemon_pidfile () { + local DAEMON + local PIDFILE + + if [ -n "$1" ]; then + DAEMON="$1" + fi + + if [ -f "$2" ]; then + PIDFILE="$2" + fi + + if [ -n "$DAEMON" ] && [ -f "$PIDFILE" ]; then + if start-stop-daemon --stop --quiet --signal 0 \ + --exec "$DAEMON" --pidfile "$PIDFILE"; then + return 0 + else + rm -f "$PIDFILE" + return 1 + fi + else + return 1 + fi +} + +# validate wpa_supplicant pidfile +test_wpa_supplicant () { + test_daemon_pidfile "$WPA_SUP_BIN" "$WPA_SUP_PIDFILE" +} + +# validate wpa_cli pidfile +test_wpa_cli () { + test_daemon_pidfile "$WPA_CLI_BIN" "$WPA_CLI_PIDFILE" +} + +##################################################################### +## daemonize wpa_supplicant +# Start wpa_supplicant via start-stop-dameon with all required +# options. Will start if environment variable WPA_SUP_CONF is present +# +# Default options: +# -B dameonize/background process +# -D driver backend ('wext' if none given) +# -P process ID file +# -C path to ctrl_interface socket directory +# -s log to syslog +# +# Conditional options: +# -c configuration file +# -W wait for wpa_cli to attach to ctrl_interface socket +# -b bridge interface name +# -f path to log file +# +init_wpa_supplicant () { + [ -n "$WPA_SUP_CONF" ] || return 0 + + local WPA_SUP_OPTIONS + WPA_SUP_OPTIONS="-B -P $WPA_SUP_PIDFILE -i $WPA_IFACE" + + if [ -n "$WPA_ACTION_SCRIPT" ]; then + if [ -x "$WPA_ACTION_SCRIPT" ]; then + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -W" + wpa_msg verbose "wait for wpa_cli to attach" + else + wpa_msg stderr "action script \"$WPA_ACTION_SCRIPT\" not executable" + return 1 + fi + fi + + if [ -n "$IF_WPA_BRIDGE" ]; then + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -b $IF_WPA_BRIDGE" + wpa_msg verbose "wpa-bridge $IF_WPA_BRIDGE" + fi + + if [ -n "$IF_WPA_DRIVER" ]; then + wpa_msg verbose "wpa-driver $IF_WPA_DRIVER" + case "$IF_WPA_DRIVER" in + hostap|ipw|madwifi|ndiswrapper) + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -D nl80211,wext" + wpa_msg stderr "\"$IF_WPA_DRIVER\" wpa-driver is unsupported" + wpa_msg stderr "using \"nl80211,wext\" wpa-driver instead ..." + ;; + *) + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -D $IF_WPA_DRIVER" + ;; + esac + else + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -D nl80211,wext" + wpa_msg verbose "wpa-driver nl80211,wext (default)" + fi + + if [ -n "$IF_WPA_DEBUG_LEVEL" ]; then + case "$IF_WPA_DEBUG_LEVEL" in + 3) + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -t -ddd" + ;; + 2) + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -t -dd" + ;; + 1) + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -t -d" + ;; + 0) + # wpa_supplicant default verbosity + ;; + -1) + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -q" + ;; + -2) + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -qq" + ;; + esac + wpa_msg verbose "using debug level: $IF_WPA_DEBUG_LEVEL" + fi + + if [ -n "$IF_WPA_LOGFILE" ]; then + # custom log file + WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -f $IF_WPA_LOGFILE" + WPA_SUP_LOGFILE="$IF_WPA_LOGFILE" + wpa_msg verbose "logging to $IF_WPA_LOGFILE" + fi + + wpa_msg verbose "$WPA_SUP_BIN $WPA_SUP_OPTIONS $WPA_SUP_CONF" + + start-stop-daemon --start --oknodo $DAEMON_VERBOSITY \ + --name $WPA_SUP_PNAME --startas $WPA_SUP_BIN --pidfile $WPA_SUP_PIDFILE \ + -- $WPA_SUP_OPTIONS $WPA_SUP_CONF + + if [ "$?" -ne 0 ]; then + wpa_msg stderr "$WPA_SUP_BIN daemon failed to start" + return 1 + fi + + local WPA_PIDFILE_WAIT + local MAX_WPA_PIDFILE_WAIT + WPA_PIDFILE_WAIT="0" + MAX_WPA_PIDFILE_WAIT="5" + until [ -s "$WPA_SUP_PIDFILE" ]; do + if [ "$WPA_PIDFILE_WAIT" -ge "$MAX_WPA_PIDFILE_WAIT" ]; then + wpa_msg stderr "timed out waiting for creation of $WPA_SUP_PIDFILE" + return 1 + else + wpa_msg verbose "waiting for \"$WPA_SUP_PIDFILE\": " \ + "$WPA_PIDFILE_WAIT (max. $MAX_WPA_PIDFILE_WAIT)" + fi + + WPA_PIDFILE_WAIT=$(($WPA_PIDFILE_WAIT + 1)) + sleep 1 + done + if [ -d "${WPA_SUP_OMIT_DIR}" ]; then + wpa_msg verbose "creating sendsigs omission pidfile: $WPA_SUP_OMIT_PIDFILE" + cat "$WPA_SUP_PIDFILE" > "$WPA_SUP_OMIT_PIDFILE" + fi + + local WPA_SOCKET_WAIT + local MAX_WPA_SOCKET_WAIT + WPA_SOCKET_WAIT="0" + MAX_WPA_SOCKET_WAIT="5" + until [ -S "$WPA_CTRL_DIR/$WPA_IFACE" ]; do + if [ "$WPA_SOCKET_WAIT" -ge "$MAX_WPA_SOCKET_WAIT" ]; then + wpa_msg stderr "ctrl_interface socket not found at $WPA_CTRL_DIR/$WPA_IFACE" + return 1 + else + wpa_msg verbose "waiting for \"$WPA_CTRL_DIR/$WPA_IFACE\": " \ + "$WPA_SOCKET_WAIT (max. $MAX_WPA_SOCKET_WAIT)" + fi + + WPA_SOCKET_WAIT=$(($WPA_SOCKET_WAIT + 1)) + sleep 1 + done + + wpa_msg verbose "ctrl_interface socket located at $WPA_CTRL_DIR/$WPA_IFACE" +} + +##################################################################### +## stop wpa_supplicant process +# Kill wpa_supplicant via start-stop-daemon, given the location of +# the pidfile or ctrl_interface socket path and interface name +# +kill_wpa_supplicant () { + test_wpa_supplicant || return 0 + + wpa_msg verbose "terminating $WPA_SUP_PNAME daemon via pidfile $WPA_SUP_PIDFILE" + + start-stop-daemon --stop --oknodo $DAEMON_VERBOSITY \ + --exec $WPA_SUP_BIN --pidfile $WPA_SUP_PIDFILE + + if [ -f "$WPA_SUP_PIDFILE" ]; then + rm -f "$WPA_SUP_PIDFILE" + fi + + if [ -f "$WPA_SUP_OMIT_PIDFILE" ]; then + wpa_msg verbose "removing $WPA_SUP_OMIT_PIDFILE" + rm -f "$WPA_SUP_OMIT_PIDFILE" + fi +} + +##################################################################### +## reload wpa_supplicant process +# Sending a HUP signal causes wpa_supplicant to reparse its +# configuration file +# +reload_wpa_supplicant () { + if test_wpa_supplicant; then + wpa_msg verbose "reloading wpa_supplicant configuration file via HUP signal" + start-stop-daemon --stop --signal HUP \ + --name "$WPA_SUP_PNAME" --pidfile "$WPA_SUP_PIDFILE" + else + wpa_msg verbose "cannot $WPA_ACTION, $WPA_SUP_PIDFILE does not exist" + fi +} + +##################################################################### +## daemonize wpa_cli and action script +# If environment variable WPA_ACTION_SCRIPT is present, wpa_cli will +# be spawned via start-stop-daemon +# +# Required options: +# -a action script => wpa_action +# -P process ID file +# -B background process +# +init_wpa_cli () { + [ -n "$WPA_ACTION_SCRIPT" ] || return 0 + + local WPA_CLI_OPTIONS + WPA_CLI_OPTIONS="-B -P $WPA_CLI_PIDFILE -i $WPA_IFACE" + + wpa_msg verbose "$WPA_CLI_BIN $WPA_CLI_OPTIONS -p $WPA_CTRL_DIR -a $WPA_ACTION_SCRIPT" + + start-stop-daemon --start --oknodo $DAEMON_VERBOSITY \ + --name $WPA_CLI_PNAME --startas $WPA_CLI_BIN --pidfile $WPA_CLI_PIDFILE \ + -- $WPA_CLI_OPTIONS -p $WPA_CTRL_DIR -a $WPA_ACTION_SCRIPT + + if [ "$?" -ne 0 ]; then + wpa_msg stderr "$WPA_CLI_BIN daemon failed to start" + return 1 + fi +} + +##################################################################### +## stop wpa_cli process +# Kill wpa_cli via start-stop-daemon, given the location of the +# pidfile +# +kill_wpa_cli () { + test_wpa_cli || return 0 + + wpa_msg verbose "terminating $WPA_CLI_PNAME daemon via pidfile $WPA_CLI_PIDFILE" + + start-stop-daemon --stop --oknodo $DAEMON_VERBOSITY \ + --exec $WPA_CLI_BIN --pidfile $WPA_CLI_PIDFILE + + if [ -f "$WPA_CLI_PIDFILE" ]; then + rm -f "$WPA_CLI_PIDFILE" + fi + + if [ -f "$WPA_CLI_TIMESTAMP" ]; then + rm -f "$WPA_CLI_TIMESTAMP" + fi + + if [ -L "$WPA_CLI_IFUPDOWN" ]; then + rm -f "$WPA_CLI_IFUPDOWN" + fi +} + +##################################################################### +## higher level wpa_cli wrapper for variable and set_network commands +# wpa_cli_do [set_network variable] +# +# $1 envorinment variable +# $2 data type of variable {raw|ascii} +# $3 wpa_cli variable, if $3 is set_network, shift and take +# set_network subvariable +# $4 wpa-* string as it would appear in interfaces file, enhances +# verbose messages +# +wpa_cli_do () { + if [ -z "$1" ]; then + return 0 + fi + + local WPACLISET_VALUE + local WPACLISET_VARIABLE + local WPACLISET_DESC + + case "$2" in + ascii) + # Double quote + WPACLISET_VALUE="\"$1\"" + ;; + raw|*) + # Provide raw value + WPACLISET_VALUE="$1" + ;; + esac + + case "$3" in + set_network) + if [ -z "$WPA_ID" ]; then + return 1 + fi + shift + WPACLISET_VARIABLE="set_network $WPA_ID $3" + ;; + *) + WPACLISET_VARIABLE="$3" + ;; + esac + + case "$4" in + *-psk|*-passphrase|*-passwd*|*-password*|*-wep-key*) + WPACLISET_DESC="$4 *****" + ;; + *) + WPACLISET_DESC="$4 $WPACLISET_VALUE" + ;; + esac + + wpa_msg action "$WPACLISET_DESC" + + wpa_cli $WPACLISET_VARIABLE "$WPACLISET_VALUE" >$TO_NULL + + if [ "$?" -ne 0 ]; then + wpa_msg stderr "$WPACLISET_DESC failed!" + fi +} + +##################################################################### +## check value data type in plaintext or hex +# returns 0 if input consists of hexadecimal digits only, 1 otherwise +# +ishex () { + if [ -z "$1" ]; then + return 0 + fi + + case "$1" in + *[!0-9a-fA-F]*) + # plaintext + return 1 + ;; + *) + # hexadecimal + return 0 + ;; + esac +} + +##################################################################### +## sanity check and set psk|passphrase +# Warn about strange psk|passphrase values +# +# $1 psk or passphrase value +# +# If psk is surrounded by quotes strip them. +# +# If psk contains all hexadecimal characters and string length is 64: +# is 256bit hexadecimal +# else: +# is plaintext +# +# plaintext passphrases must be 8 - 63 characters in length +# 256-bit hexadecimal key must be 64 characters in length +# +wpa_key_check_and_set () { + if [ "$#" -ne 3 ]; then + return 0 + fi + + local KEY + local KEY_LEN + local KEY_TYPE + local ENC_TYPE + + case "$1" in + '"'*'"') + # Strip surrounding quotation marks + KEY=$(echo -n "$1" | sed 's/^"//;s/"$//') + ;; + *) + KEY="$1" + ;; + esac + + KEY_LEN="${#KEY}" + + case "$2" in + wep_key*) + ENC_TYPE="WEP" + ;; + psk) + ENC_TYPE="WPA" + ;; + *) + return 0 + ;; + esac + + if [ "$ENC_TYPE" = "WEP" ]; then + if ishex "$KEY"; then + case "$KEY_LEN" in + 10|26|32|58) + # 64/128/152/256-bit WEP + KEY_TYPE="raw" + ;; + *) + KEY_TYPE="ascii" + ;; + esac + else + KEY_TYPE="ascii" + fi + + if [ "$KEY_TYPE" = "ascii" ]; then + if [ "$KEY_LEN" -lt "5" ]; then + wpa_msg stderr "WARNING: plaintext or ascii WEP key has $KEY_LEN characters," + wpa_msg stderr "it must have at least 5 to be valid." + fi + fi + elif [ "$ENC_TYPE" = "WPA" ]; then + if ishex "$KEY"; then + case "$KEY_LEN" in + 64) + # 256-bit WPA + KEY_TYPE="raw" + ;; + *) + KEY_TYPE="ascii" + ;; + esac + else + KEY_TYPE="ascii" + fi + + if [ "$KEY_TYPE" = "ascii" ]; then + if [ "$KEY_LEN" -lt "8" ] || [ "$KEY_LEN" -gt "63" ]; then + wpa_msg stderr "WARNING: plaintext or ascii WPA key has $KEY_LEN characters," + wpa_msg stderr "it must have between 8 and 63 to be valid." + wpa_msg stderr "If the WPA key is a 256-bit hexadecimal key, it must have" + wpa_msg stderr "exactly 64 characters." + fi + fi + fi + + wpa_cli_do "$KEY" "$KEY_TYPE" set_network "$2" "$3" +} + +##################################################################### +## formulate a usable configuration from interfaces(5) wpa- lines +# A series of wpa_cli commands corresponding to environment variables +# created as a result of wpa- lines in an interfaces stanza. +# +# NB: no-act when roaming daemon is used (to avoid prematurely +# attaching to ctrl_interface socket) +# +conf_wpa_supplicant () { + if [ -n "$WPA_ACTION_SCRIPT" ]; then + return 0 + fi + + if [ "$IF_WPA_DRIVER" = "wired" ]; then + IF_WPA_AP_SCAN="0" + wpa_msg verbose "forcing ap_scan=0 (required for wired IEEE8021X auth)" + fi + + if [ -n "$IF_WPA_ESSID" ]; then + # #403316, be similar to wireless tools + IF_WPA_SSID="$IF_WPA_ESSID" + fi + + wpa_cli_do "$IF_WPA_AP_SCAN" raw \ + ap_scan wpa-ap-scan + + wpa_cli_do "$IF_WPA_PREAUTHENTICATE" raw \ + preauthenticate wpa-preauthenticate + + if [ -n "$IF_WPA_SSID" ] || [ "$IF_WPA_DRIVER" = "wired" ] || \ + [ -n "$IF_WPA_KEY_MGMT" ]; then + + case "$IF_WPA_SSID" in + '"'*'"') + IF_WPA_SSID=$(echo -n "$IF_WPA_SSID" | sed 's/^"//;s/"$//') + ;; + *) + ;; + esac + + WPA_ID=$(wpa_cli add_network) + + wpa_msg verbose "configuring network block -- $WPA_ID" + + wpa_cli_do "$IF_WPA_SSID" ascii \ + set_network ssid wpa-ssid + + wpa_cli_do "$IF_WPA_PRIORITY" raw \ + set_network priority wpa-priority + + wpa_cli_do "$IF_WPA_BSSID" raw \ + set_network bssid wpa-bssid + + if [ -s "$IF_WPA_PSK_FILE" ]; then + IF_WPA_PSK=$(cat "$IF_WPA_PSK_FILE") + fi + + # remain compat with wpa-passphrase-file + if [ -s "$IF_WPA_PASSPHRASE_FILE" ]; then + IF_WPA_PSK=$(cat "$IF_WPA_PASSPHRASE_FILE") + fi + + # remain compat with wpa-passphrase + if [ -n "$IF_WPA_PASSPHRASE" ]; then + IF_WPA_PSK="$IF_WPA_PASSPHRASE" + fi + + if [ -n "$IF_WPA_PSK" ]; then + wpa_key_check_and_set "$IF_WPA_PSK" \ + psk wpa-psk + fi + + wpa_cli_do "$IF_WPA_PAIRWISE" raw \ + set_network pairwise wpa-pairwise + + wpa_cli_do "$IF_WPA_GROUP" raw \ + set_network group wpa-group + + wpa_cli_do "$IF_WPA_MODE" raw \ + set_network mode wpa-mode + + wpa_cli_do "$IF_WPA_FREQUENCY" raw \ + set_network frequency wpa-frequency + + wpa_cli_do "$IF_WPA_SCAN_FREQ" raw \ + set_network scan_freq wpa-scan-freq + + wpa_cli_do "$IF_WPA_FREQ_LIST" raw \ + set_network freq_list wpa-freq-list + + wpa_cli_do "$IF_WPA_KEY_MGMT" raw \ + set_network key_mgmt wpa-key-mgmt + + wpa_cli_do "$IF_WPA_PROTO" raw \ + set_network proto wpa-proto + + wpa_cli_do "$IF_WPA_AUTH_ALG" raw \ + set_network auth_alg wpa-auth-alg + + wpa_cli_do "$IF_WPA_SCAN_SSID" raw \ + set_network scan_ssid wpa-scan-ssid + + wpa_cli_do "$IF_WPA_IDENTITY" ascii \ + set_network identity wpa-identity + + wpa_cli_do "$IF_WPA_ANONYMOUS_IDENTITY" ascii \ + set_network anonymous_identity wpa-anonymous-identity + + wpa_cli_do "$IF_WPA_EAP" raw \ + set_network eap wpa-eap + + wpa_cli_do "$IF_WPA_EAPPSK" raw \ + set_network eappsk wpa-eappsk + + wpa_cli_do "$IF_WPA_NAI" ascii \ + set_network nai wpa-nai + + wpa_cli_do "$IF_WPA_PASSWORD" ascii \ + set_network password wpa-password + + wpa_cli_do "$IF_WPA_CA_CERT" ascii \ + set_network ca_cert wpa-ca-cert + + wpa_cli_do "$IF_WPA_CA_PATH" ascii \ + set_network ca_path wpa-ca-path + + wpa_cli_do "$IF_WPA_CLIENT_CERT" ascii \ + set_network client_cert wpa-client-cert + + wpa_cli_do "$IF_WPA_PRIVATE_KEY" ascii \ + set_network private_key wpa-private-key + + wpa_cli_do "$IF_WPA_PRIVATE_KEY_PASSWD" ascii \ + set_network private_key_passwd wpa-private-key-passwd + + wpa_cli_do "$IF_WPA_DH_FILE" ascii \ + set_network dh_file wpa-dh-file + + wpa_cli_do "$IF_WPA_SUBJECT_MATCH" ascii \ + set_network subject_match wpa-subject-match + + wpa_cli_do "$IF_WPA_ALTSUBJECT_MATCH" ascii \ + set_network altsubject_match wpa-altsubject-match + + wpa_cli_do "$IF_WPA_CA_CERT2" ascii \ + set_network ca_cert2 wpa-ca-cert2 + + wpa_cli_do "$IF_WPA_CA_PATH2" ascii \ + set_network ca_path2 wpa-ca-path2 + + wpa_cli_do "$IF_WPA_CLIENT_CERT2" ascii \ + set_network client_cert2 wpa-client-cert2 + + wpa_cli_do "$IF_WPA_PRIVATE_KEY2" ascii \ + set_network private_key2 wpa-private-key2 + + wpa_cli_do "$IF_WPA_PRIVATE_KEY_PASSWD2" ascii \ + set_network private_key_passwd2 wpa-private-key-passwd2 + + wpa_cli_do "$IF_WPA_DH_FILE2" ascii \ + set_network dh_file2 wpa-dh-file2 + + wpa_cli_do "$IF_WPA_SUBJECT_MATCH2" ascii \ + set_network subject_match2 wpa-subject-match2 + + wpa_cli_do "$IF_WPA_ALTSUBJECT_MATCH2" ascii \ + set_network altsubject_match2 wpa-altsubject-match2 + + wpa_cli_do "$IF_WPA_EAP_METHODS" raw \ + set_network eap_methods wpa-eap-methods + + wpa_cli_do "$IF_WPA_PHASE1" ascii \ + set_network phase1 wpa-phase1 + + wpa_cli_do "$IF_WPA_PHASE2" ascii \ + set_network phase2 wpa-phase2 + + wpa_cli_do "$IF_WPA_PCSC" raw \ + set_network pcsc wpa-pcsc + + wpa_cli_do "$IF_WPA_PIN" ascii \ + set_network pin wpa-pin + + wpa_cli_do "$IF_WPA_ENGINE" raw \ + set_network engine wpa-engine + + wpa_cli_do "$IF_WPA_ENGINE_ID" ascii \ + set_network engine_id wpa-engine-id + + wpa_cli_do "$IF_WPA_KEY_ID" ascii \ + set_network key_id wpa-key-id + + wpa_cli_do "$IF_WPA_EAPOL_FLAGS" raw \ + set_network eapol_flags wpa-eapol-flags + + if [ -n "$IF_WPA_WEP_KEY0" ]; then + wpa_key_check_and_set "$IF_WPA_WEP_KEY0" \ + wep_key0 wpa-wep-key0 + fi + + if [ -n "$IF_WPA_WEP_KEY1" ]; then + wpa_key_check_and_set "$IF_WPA_WEP_KEY1" \ + wep_key1 wpa-wep-key1 + fi + + if [ -n "$IF_WPA_WEP_KEY2" ]; then + wpa_key_check_and_set "$IF_WPA_WEP_KEY2" \ + wep_key2 wpa-wep-key2 + fi + + if [ -n "$IF_WPA_WEP_KEY3" ]; then + wpa_key_check_and_set "$IF_WPA_WEP_KEY3" \ + wep_key3 wpa-wep-key3 + fi + + wpa_cli_do "$IF_WPA_WEP_TX_KEYIDX" raw \ + set_network wep_tx_keyidx wpa-wep-tx-keyidx + + wpa_cli_do "$IF_WPA_PROACTIVE_KEY_CACHING" raw \ + set_network proactive_key_caching wpa-proactive-key-caching + + wpa_cli_do "$IF_WPA_PAC_FILE" ascii \ + set_network pac_file wpa-pac-file + + wpa_cli_do "$IF_WPA_PEERKEY" raw \ + set_network peerkey wpa-peerkey + + wpa_cli_do "$IF_FRAGMENT_SIZE" raw \ + set_network fragment_size wpa-fragment-size + + wpa_cli_do "$IF_WPA_ID_STR" ascii \ + set_network id_str wpa-id-str + + wpa_cli_do "$WPA_ID" raw \ + enable_network "enabling network block" + fi +} + +##################################################################### +## Log wpa_cli environment variables +wpa_log_env () { + wpa_msg log "WPA_IFACE=$WPA_IFACE WPA_ACTION=$WPA_ACTION" + wpa_msg log "WPA_ID=$WPA_ID WPA_ID_STR=$WPA_ID_STR WPA_CTRL_DIR=$WPA_CTRL_DIR" +} + +##################################################################### +## hysteresis checking +# Networking tools such as dhcp clients used with ifupdown can +# synthesize artificial ACTION events, particularly just after a +# DISCONNECTED/CONNECTED events are experienced in quick succession. +# This can lead to infinite event loops, and in extreme cases has the +# potential to cause system instability. +# +wpa_hysteresis_event () { + echo "$(date +%s)" > "$WPA_CLI_TIMESTAMP" 2>/dev/null +} + +wpa_hysteresis_check () { + if [ -f "$WPA_CLI_TIMESTAMP" ]; then + local TIME + local TIMESTAMP + local TIMEWAIT + TIME=$(date +%s) + # current time minus 4 second event buffer + TIMEWAIT=$(($TIME-4)) + # get time of last event + TIMESTAMP=$(cat $WPA_CLI_TIMESTAMP) + # compare values, allowing new action to be processed + # only if last action was more than 4 seconds ago + if [ "$TIMEWAIT" -le "$TIMESTAMP" ]; then + wpa_msg log "$WPA_ACTION event blocked by hysteresis check" + return 1 + fi + fi + + return 0 +} + +##################################################################### +## ifupdown locking functions +# A collection of rudimentary locking functions to lock ifup/ifdown +# actions. +# + +ifupdown_lock () { + ln -s lock "$WPA_CLI_IFUPDOWN" +} + +ifupdown_locked () { + [ -L "$WPA_CLI_IFUPDOWN" ] && return 0 + + return 1 +} + +ifupdown_unlock () { + rm -f "$WPA_CLI_IFUPDOWN" +} + +##################################################################### +## apply mapping logic and ifup logical interface +# Apply mapping logic via id_str or external mapping script, check +# state of IFACE with respect to ifupdown and ifup logical interaface +# +ifup () { + local INTERFACES_FILE + local IFSTATE_FILE + local IFUP_RETVAL + local WPA_LOGICAL_IFACE + + if [ -e /etc/network/interfaces ]; then + INTERFACES_FILE="/etc/network/interfaces" + else + wpa_msg log "/etc/network/interfaces does not exist, $WPA_IFACE will not be configured" + return 1 + fi + + if [ -e /etc/network/run/ifstate ]; then + # debian's ifupdown + IFSTATE_FILE="/etc/network/run/ifstate" + elif [ -e /run/network/ifstate ]; then + # ubuntu's + IFSTATE_FILE="/run/network/ifstate" + else + unset IFSTATE_FILE + fi + + if [ -z "$IF_WPA_MAPPING_SCRIPT_PRIORITY" ] && [ -n "$WPA_ID_STR" ]; then + WPA_LOGICAL_IFACE="$WPA_ID_STR" + fi + + if [ -z "$WPA_LOGICAL_IFACE" ] && [ -n "$IF_WPA_MAPPING_SCRIPT" ]; then + local WPA_MAP_STDIN + + WPA_MAP_STDIN=$(set | sed -n 's/^\(IF_WPA_MAP[0-9]*\)=.*/echo \$\1/p') + + if [ -n "$WPA_MAP_STDIN" ]; then + WPA_LOGICAL_IFACE=$(eval "$WPA_MAP_STDIN" | "$IF_WPA_MAPPING_SCRIPT" "$WPA_IFACE") + else + WPA_LOGICAL_IFACE=$("$IF_WPA_MAPPING_SCRIPT" "$WPA_IFACE") + fi + + if [ -n "$WPA_LOGICAL_IFACE" ]; then + wpa_msg log "mapping script result: $WPA_LOGICAL_IFACE" + else + wpa_msg log "mapping script failed." + fi + fi + + if [ -z "$WPA_LOGICAL_IFACE" ]; then + if [ -n "$IF_WPA_ROAM_DEFAULT_IFACE" ]; then + WPA_LOGICAL_IFACE="$IF_WPA_ROAM_DEFAULT_IFACE" + else + WPA_LOGICAL_IFACE="default" + fi + fi + + if [ -n "$WPA_LOGICAL_IFACE" ]; then + if egrep -q "^iface[[:space:]]+${WPA_LOGICAL_IFACE}[[:space:]]+inet" "$INTERFACES_FILE"; then + : # logical network is defined + else + wpa_msg log "network settings not defined for $WPA_LOGICAL_IFACE in $INTERFACES_FILE" + WPA_LOGICAL_IFACE="default" + fi + + wpa_msg log "ifup $WPA_IFACE=$WPA_LOGICAL_IFACE" + + ifupdown_lock + + if [ -n "$IFSTATE_FILE" ] && grep -q "^$WPA_IFACE=$WPA_IFACE" "$IFSTATE_FILE"; then + # Force settings over the unconfigured "master" IFACE + /sbin/ifup -v --force "$WPA_IFACE=$WPA_LOGICAL_IFACE" + else + /sbin/ifup -v "$WPA_IFACE=$WPA_LOGICAL_IFACE" + fi + IFUP_RETVAL="$?" + + ifupdown_unlock + fi + + if [ -d "${WPA_SUP_OMIT_DIR}" ]; then + wpa_msg log "creating sendsigs omission pidfile: $WPA_SUP_OMIT_PIDFILE" + cat "$WPA_SUP_PIDFILE" > "$WPA_SUP_OMIT_PIDFILE" + fi + + return "$IFUP_RETVAL" +} + +##################################################################### +## ifdown IFACE +# Check IFACE state and ifdown as requested. +# +ifdown () { + wpa_msg log "ifdown $WPA_IFACE" + + ifupdown_lock + + /sbin/ifdown -v "$WPA_IFACE" + + ifupdown_unlock + + wpa_msg log "removing sendsigs omission pidfile: $WPA_SUP_OMIT_PIDFILE" + rm -f "$WPA_SUP_OMIT_PIDFILE" +} + +##################################################################### +## keep IFACE scanning +# After ifdown, the IFACE may be left "down", and inhibits +# wpa_supplicant's ability to continue roaming. +# +# NB: use iproute if present, flushing the IFACE first +# +if_post_down_up () { + if [ -x /bin/ip ]; then + ip addr flush dev "$WPA_IFACE" 2>/dev/null + ip link set "$WPA_IFACE" up + else + ifconfig "$WPA_IFACE" up + fi +} diff --git a/firmware/ori/board/pluto/wpa_supplicant/ifupdown.sh b/firmware/ori/board/pluto/wpa_supplicant/ifupdown.sh new file mode 100644 index 0000000..2c5b060 --- /dev/null +++ b/firmware/ori/board/pluto/wpa_supplicant/ifupdown.sh @@ -0,0 +1,172 @@ +#!/bin/sh + +##################################################################### +## Purpose +# This file is executed by ifupdown in pre-up, post-up, pre-down and +# post-down phases of network interface configuration. It allows +# ifup(8), and ifdown(8) to manage wpa_supplicant(8) and wpa_cli(8) +# processes running in daemon mode. +# +# /etc/wpa_supplicant/functions.sh is sourced by this file. +# +# This file is provided by the wpasupplicant package. + +##################################################################### +# Copyright (C) 2006 - 2009 Debian/Ubuntu wpasupplicant Maintainers +# +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# On Debian GNU/Linux systems, the text of the GPL license, +# version 2, can be found in /usr/share/common-licenses/GPL-2. + +if [ -n "$IF_WPA_MAINT_DEBUG" ]; then + set -x +fi + +# quit if we're called for the loopback +if [ "$IFACE" = lo ]; then + exit 0 +fi + +# allow wpa_supplicant interface to be specified via wpa-iface +# useful for starting wpa_supplicant on one interface of a bridge +if [ -n "$IF_WPA_IFACE" ]; then + WPA_IFACE="$IF_WPA_IFACE" +else + WPA_IFACE="$IFACE" +fi + +# source functions +if [ -f /etc/wpa_supplicant/functions.sh ]; then + . /etc/wpa_supplicant/functions.sh +else + exit 0 +fi + +# quit if executables are not installed +if [ ! -x "$WPA_SUP_BIN" ] || [ ! -x "$WPA_CLI_BIN" ]; then + exit 0 +fi + +do_start () { + if test_wpa_cli; then + # if wpa_action is active for this IFACE, do nothing + ifupdown_locked && exit 0 + + # if the administrator is calling ifup, say something useful + if [ "$PHASE" = "pre-up" ]; then + wpa_msg stderr "wpa_action is managing ifup/ifdown state of $WPA_IFACE" + wpa_msg stderr "execute \`ifdown --force $WPA_IFACE' to stop wpa_action" + fi + exit 1 + elif ! set | grep -q "^IF_WPA"; then + # no wpa- option defined for IFACE, do nothing + exit 0 + fi + + # ensure stale ifupdown_lock marker is purged + ifupdown_unlock + + # preliminary sanity checks for roaming daemon + if [ -n "$IF_WPA_ROAM" ]; then + if [ "$METHOD" != "manual" ]; then + wpa_msg stderr "wpa-roam can only be used with the \"manual\" inet METHOD" + exit 1 + fi + if [ -n "$IF_WPA_MAPPING_SCRIPT" ]; then + if ! type "$IF_WPA_MAPPING_SCRIPT" >/dev/null; then + wpa_msg stderr "wpa-mapping-script \"$IF_WPA_MAPPING_SCRIPT\" is not valid" + exit 1 + fi + fi + if [ -n "$IF_WPA_MAPPING_SCRIPT_PRIORITY" ] && [ -z "$IF_WPA_MAPPING_SCRIPT" ]; then + wpa_msg stderr "\"wpa-mapping-script-priority 1\" is invalid without a wpa-mapping-script" + exit 1 + fi + IF_WPA_CONF="$IF_WPA_ROAM" + WPA_ACTION_SCRIPT="/sbin/wpa_action" + fi + + # master function; determines if ifupdown.sh should do something or not + if [ -n "$IF_WPA_CONF" ] && [ "$IF_WPA_CONF" != "managed" ]; then + if [ ! -s "$IF_WPA_CONF" ]; then + wpa_msg stderr "cannot read contents of $IF_WPA_CONF" + exit 1 + fi + WPA_SUP_CONF_CTRL_DIR=$(sed -n -e 's/[[:space:]]*#.*//g' -e 's/[[:space:]]\+.*$//g' \ + -e 's/^ctrl_interface=\(DIR=\)\?\(.*\)/\2/p' "$IF_WPA_CONF") + if [ -n "$WPA_SUP_CONF_CTRL_DIR" ]; then + WPA_CTRL_DIR="$WPA_SUP_CONF_CTRL_DIR" + WPA_SUP_CONF="-c $IF_WPA_CONF" + else + # specify the default ctrl_interface since none was defined in + # the given IF_WPA_CONF + WPA_SUP_CONF="-c $IF_WPA_CONF -C $WPA_CTRL_DIR" + fi + else + # specify the default ctrl_interface + WPA_SUP_CONF="-C $WPA_CTRL_DIR" + fi +} + +do_stop () { + if test_wpa_cli; then + # if wpa_action is active for this IFACE and calling ifdown, + # do nothing + ifupdown_locked && exit 0 + elif test_wpa_supplicant; then + # wpa_supplicant process exists for this IFACE, but wpa_cli + # process does not. Allow stop mode to kill this process. + : + else + exit 0 + fi +} + +case "$MODE" in + start) + do_start + case "$PHASE" in + pre-up) + kill_wpa_supplicant + init_wpa_supplicant || exit 1 + conf_wpa_supplicant || { kill_wpa_supplicant; exit 1; } + ;; + post-up) + init_wpa_cli || { kill_wpa_supplicant; exit 1; } + ;; + esac + ;; + + stop) + do_stop + case "$PHASE" in + pre-down) + kill_wpa_cli + ;; + post-down) + kill_wpa_supplicant + ;; + *) + wpa_msg stderr "unknown phase: \"$PHASE\"" + exit 1 + ;; + esac + ;; + + *) + wpa_msg stderr "unknown mode: \"$MODE\"" + exit 1 + ;; +esac + +exit 0 diff --git a/firmware/ori/configs/zynq_e200_linux_defconfig b/firmware/ori/configs/zynq_e200_linux_defconfig new file mode 100644 index 0000000..1507625 --- /dev/null +++ b/firmware/ori/configs/zynq_e200_linux_defconfig @@ -0,0 +1,322 @@ +CONFIG_SYSVIPC=y +CONFIG_USELIB=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_PREEMPT=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=15 +CONFIG_CGROUPS=y +CONFIG_BLK_DEV_INITRD=y +# CONFIG_RD_BZIP2 is not set +# CONFIG_RD_LZMA is not set +# CONFIG_RD_XZ is not set +# CONFIG_RD_LZO is not set +# CONFIG_RD_LZ4 is not set +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_SYSCTL_SYSCALL=y +CONFIG_EMBEDDED=y +CONFIG_PERF_EVENTS=y +CONFIG_SLAB=y +CONFIG_ARCH_ZYNQ=y +CONFIG_XILINX_RESET_CODE=y +CONFIG_PL310_ERRATA_588369=y +CONFIG_PL310_ERRATA_727915=y +CONFIG_PL310_ERRATA_769419=y +# CONFIG_ARM_ERRATA_643719 is not set +CONFIG_ARM_ERRATA_754322=y +CONFIG_ARM_ERRATA_754327=y +CONFIG_ARM_ERRATA_764369=y +CONFIG_ARM_ERRATA_775420=y +CONFIG_SMP=y +CONFIG_SCHED_MC=y +CONFIG_SCHED_SMT=y +CONFIG_HIGHMEM=y +# CONFIG_HIGHPTE is not set +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZBOOT_ROM_BSS=0x0 +CONFIG_CMDLINE="console=ttyPS0,115200n8 root=/dev/ram rw earlyprintk" +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_ARM_ZYNQ_CPUIDLE=y +CONFIG_VFP=y +CONFIG_NEON=y +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +CONFIG_MODVERSIONS=y +# CONFIG_BLK_DEV_BSG is not set +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set +# CONFIG_COMPACTION is not set +CONFIG_CMA=y +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +CONFIG_IP_PNP_RARP=y +CONFIG_NET_IPIP=m +# CONFIG_IPV6 is not set +CONFIG_VLAN_8021Q=m +CONFIG_CFG80211=y +CONFIG_MAC80211=y +CONFIG_MAC80211_LEDS=y +CONFIG_RFKILL=y +CONFIG_RFKILL_INPUT=y +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_DMA_CMA=y +CONFIG_CMA_SIZE_MBYTES=256 +CONFIG_CONNECTOR=y +CONFIG_MTD=y +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_BLOCK=y +CONFIG_MTD_CFI=y +CONFIG_MTD_CFI_AMDSTD=y +CONFIG_MTD_PHYSMAP=y +CONFIG_MTD_PHYSMAP_OF=y +CONFIG_MTD_M25P80=y +CONFIG_MTD_SPI_NOR=y +# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set +CONFIG_OF_OVERLAY=y +CONFIG_OF_CONFIGFS=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=16384 +CONFIG_SRAM=y +# CONFIG_MATHWORKS_IP_CORE is not set +CONFIG_SCSI=y +CONFIG_BLK_DEV_SD=y +CONFIG_CHR_DEV_SG=y +CONFIG_NETDEVICES=y +CONFIG_TUN=y +# CONFIG_NET_VENDOR_ALACRITECH is not set +# CONFIG_NET_VENDOR_AMAZON is not set +# CONFIG_NET_VENDOR_AQUANTIA is not set +# CONFIG_NET_VENDOR_ARC is not set +# CONFIG_NET_VENDOR_BROADCOM is not set +# CONFIG_NET_VENDOR_CIRRUS is not set +# CONFIG_NET_VENDOR_EZCHIP is not set +# CONFIG_NET_VENDOR_FARADAY is not set +# CONFIG_NET_VENDOR_HISILICON is not set +# CONFIG_NET_VENDOR_HUAWEI is not set +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_NETRONOME is not set +# CONFIG_NET_VENDOR_QUALCOMM is not set +# CONFIG_NET_VENDOR_RENESAS is not set +# CONFIG_NET_VENDOR_ROCKER is not set +# CONFIG_NET_VENDOR_SAMSUNG is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SOLARFLARE is not set +# CONFIG_NET_VENDOR_SMSC is not set +# CONFIG_NET_VENDOR_STMICRO is not set +# CONFIG_NET_VENDOR_SYNOPSYS is not set +# CONFIG_NET_VENDOR_VIA is not set +# CONFIG_NET_VENDOR_WIZNET is not set +# CONFIG_NET_VENDOR_XILINX is not set +CONFIG_USB_RTL8152=y +CONFIG_USB_LAN78XX=y +CONFIG_USB_USBNET=y +# CONFIG_USB_NET_CDC_NCM is not set +CONFIG_USB_NET_SMSC75XX=y +CONFIG_USB_NET_SMSC95XX=y +# CONFIG_USB_NET_NET1080 is not set +CONFIG_USB_NET_RNDIS_HOST=y +# CONFIG_USB_NET_CDC_SUBSET is not set +# CONFIG_USB_NET_ZAURUS is not set +# CONFIG_WLAN_VENDOR_ADMTEK is not set +# CONFIG_WLAN_VENDOR_ATH is not set +# CONFIG_WLAN_VENDOR_ATMEL is not set +# CONFIG_WLAN_VENDOR_BROADCOM is not set +# CONFIG_WLAN_VENDOR_CISCO is not set +# CONFIG_WLAN_VENDOR_INTEL is not set +# CONFIG_WLAN_VENDOR_INTERSIL is not set +# CONFIG_WLAN_VENDOR_MARVELL is not set +# CONFIG_WLAN_VENDOR_MEDIATEK is not set +CONFIG_RT2X00=y +CONFIG_RT2500USB=y +CONFIG_RT73USB=y +CONFIG_RT2800USB=y +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y +CONFIG_RT2800USB_RT55XX=y +CONFIG_RT2800USB_UNKNOWN=y +CONFIG_RTL8187=y +CONFIG_RTL8192CU=y +# CONFIG_RTLWIFI_DEBUG is not set +CONFIG_RTL8XXXU=y +CONFIG_RTL8XXXU_UNTESTED=y +# CONFIG_WLAN_VENDOR_RSI is not set +# CONFIG_WLAN_VENDOR_ST is not set +# CONFIG_WLAN_VENDOR_TI is not set +# CONFIG_WLAN_VENDOR_ZYDAS is not set +CONFIG_INPUT_FF_MEMLESS=y +CONFIG_INPUT_SPARSEKMAP=y +CONFIG_INPUT_EVDEV=y +CONFIG_KEYBOARD_GPIO=y +# CONFIG_INPUT_MOUSE is not set +CONFIG_VT_HW_CONSOLE_BINDING=y +# CONFIG_LEGACY_PTYS is not set +CONFIG_SERIAL_XILINX_PS_UART=y +CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_HW_RANDOM is not set +EEPROM_AT24=y +CONFIG_I2C=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_CADENCE=y +CONFIG_I2C_GPIO=y +CONFIG_I2C_XILINX=y +CONFIG_SPI=y +CONFIG_SPI_AXI_SPI_ENGINE=y +CONFIG_SPI_CADENCE=y +CONFIG_SPI_XILINX=y +CONFIG_SPI_ZYNQ_QSPI=y +CONFIG_SPI_SPIDEV=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_SYSFS=y +CONFIG_GPIO_ZYNQ=y +CONFIG_POWER_SUPPLY=y +CONFIG_THERMAL=y +CONFIG_WATCHDOG=y +CONFIG_XILINX_WATCHDOG=y +CONFIG_CADENCE_WATCHDOG=y +CONFIG_SSB=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y +CONFIG_HIDRAW=y +CONFIG_USB_HIDDEV=y +CONFIG_USB=y +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y +CONFIG_USB_OTG=y +CONFIG_USB_EHCI_HCD=y +# CONFIG_USB_EHCI_TT_NEWSCHED is not set +CONFIG_USB_STORAGE=y +CONFIG_USB_CHIPIDEA=y +CONFIG_USB_CHIPIDEA_UDC=y +CONFIG_USB_CHIPIDEA_HOST=y +CONFIG_USB_SERIAL=y +CONFIG_USB_SERIAL_GENERIC=y +CONFIG_USB_SERIAL_FTDI_SIO=y +CONFIG_USB_ULPI=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_VBUS_DRAW=500 +CONFIG_USB_GADGET_XILINX=y +CONFIG_USB_CONFIGFS=y +CONFIG_USB_CONFIGFS_SERIAL=y +CONFIG_USB_CONFIGFS_ACM=y +CONFIG_USB_CONFIGFS_NCM=y +CONFIG_USB_CONFIGFS_ECM=y +CONFIG_USB_CONFIGFS_ECM_SUBSET=y +CONFIG_USB_CONFIGFS_RNDIS=y +CONFIG_USB_CONFIGFS_EEM=y +CONFIG_USB_CONFIGFS_MASS_STORAGE=y +CONFIG_USB_CONFIGFS_F_FS=y +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_GPIO=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y +CONFIG_DMADEVICES=y +CONFIG_AXI_DMAC=y +CONFIG_UIO=y +CONFIG_UIO_PDRV_GENIRQ=y +CONFIG_UIO_DMEM_GENIRQ=y +CONFIG_UIO_XILINX_APM=y +CONFIG_STAGING=y +CONFIG_R8712U=y +CONFIG_R8188EU=y +CONFIG_COMMON_CLK_AXI_CLKGEN=y +# CONFIG_IOMMU_SUPPORT is not set +CONFIG_MEMORY=y +CONFIG_IIO=y +CONFIG_ADM1177=y +CONFIG_AD9361=y +CONFIG_AD9361_EXT_BAND_CONTROL=y +CONFIG_ADMC=y +CONFIG_XILINX_XADC=y +CONFIG_CF_AXI_DDS=y +CONFIG_FPGA=y +CONFIG_FPGA_MGR_ZYNQ_FPGA=y +CONFIG_EXT4_FS=y +# CONFIG_DNOTIFY is not set +CONFIG_MSDOS_FS=y +CONFIG_VFAT_FS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_JFFS2_FS=y +CONFIG_JFFS2_COMPRESSION_OPTIONS=y +CONFIG_NFS_FS=y +CONFIG_NFSD=y +CONFIG_NFSD_V3=y +CONFIG_CIFS=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +CONFIG_CRYPTO_ECB=y +CONFIG_CRYPTO_MICHAEL_MIC=y +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_FS=y +CONFIG_DETECT_HUNG_TASK=y +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=20 +# CONFIG_SCHED_DEBUG is not set +# CONFIG_DEBUG_PREEMPT is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=60 +# CONFIG_FTRACE is not set +CONFIG_DEBUG_LL=y +CONFIG_DEBUG_ZYNQ_UART0=y +CONFIG_EARLY_PRINTK=y +CONFIG_AD5660_MP=y +## FOR IP TABLES +CONFIG_NET_INGRESS=y +CONFIG_NETFILTER=y +CONFIG_NETFILTER_ADVANCED=y +CONFIG_BRIDGE_NETFILTER=m +CONFIG_NETFILTER_INGRESS=y +CONFIG_NETFILTER_FAMILY_BRIDGE=y +CONFIG_NF_CONNTRACK=y +CONFIG_NF_NAT=y +CONFIG_NF_NAT_NEEDED=y +CONFIG_NF_NAT_REDIRECT=y +CONFIG_NETFILTER_XTABLES=y +CONFIG_NETFILTER_XT_NAT=y +CONFIG_NETFILTER_XT_TARGET_NETMAP=y +CONFIG_NETFILTER_XT_TARGET_REDIRECT=y +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y +CONFIG_NETFILTER_XT_MATCH_STATE=y +CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y +CONFIG_NF_DEFRAG_IPV4=y +CONFIG_NF_NAT_IPV4=y +CONFIG_NF_NAT_MASQUERADE_IPV4=y +CONFIG_IP_NF_IPTABLES=y +CONFIG_IP_NF_FILTER=y +CONFIG_IP_NF_NAT=y +CONFIG_IP_NF_TARGET_MASQUERADE=y +CONFIG_IP_NF_TARGET_NETMAP=y +CONFIG_IP_NF_TARGET_REDIRECT=y +CONFIG_STP=y +CONFIG_LLC=y +CONFIG_MMC=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_SDHCI_OF_ARASAN=y +CONFIG_UEVENT_HELPER=y +CONFIG_MACB=y +CONFIG_MDIO_BITBANG=y +CONFIG_MARVELL_PHY=y +CONFIG_REALTEK_PHY=y +CONFIG_XILINX_GMII2RGMII=y +CONFIG_USB_NET_DM9601=y + diff --git a/firmware/ori/configs/zynq_pluto_linux_defconfig b/firmware/ori/configs/zynq_pluto_linux_defconfig new file mode 100644 index 0000000..a44c8a2 --- /dev/null +++ b/firmware/ori/configs/zynq_pluto_linux_defconfig @@ -0,0 +1,326 @@ +CONFIG_SYSVIPC=y +CONFIG_USELIB=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_PREEMPT=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=15 +CONFIG_CGROUPS=y +CONFIG_BLK_DEV_INITRD=y +# CONFIG_RD_BZIP2 is not set +# CONFIG_RD_LZMA is not set +# CONFIG_RD_XZ is not set +# CONFIG_RD_LZO is not set +# CONFIG_RD_LZ4 is not set +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_SYSCTL_SYSCALL=y +CONFIG_EMBEDDED=y +CONFIG_PERF_EVENTS=y +CONFIG_SLAB=y +CONFIG_ARCH_ZYNQ=y +CONFIG_XILINX_RESET_CODE=y +CONFIG_PL310_ERRATA_588369=y +CONFIG_PL310_ERRATA_727915=y +CONFIG_PL310_ERRATA_769419=y +# CONFIG_ARM_ERRATA_643719 is not set +CONFIG_ARM_ERRATA_754322=y +CONFIG_ARM_ERRATA_754327=y +CONFIG_ARM_ERRATA_764369=y +CONFIG_ARM_ERRATA_775420=y +CONFIG_SMP=y +CONFIG_SCHED_MC=y +CONFIG_SCHED_SMT=y +CONFIG_HIGHMEM=y +# CONFIG_HIGHPTE is not set +CONFIG_CMDLINE="console=ttyPS0,115200n8 root=/dev/ram rw earlyprintk" +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_ARM_ZYNQ_CPUIDLE=y +CONFIG_VFP=y +CONFIG_NEON=y +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +CONFIG_MODVERSIONS=y +# CONFIG_BLK_DEV_BSG is not set +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set +# CONFIG_COMPACTION is not set +CONFIG_CMA=y +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +CONFIG_IP_PNP_RARP=y +CONFIG_NET_IPIP=m +# CONFIG_IPV6 is not set +#CONFIG_BRIDGE=y +CONFIG_VLAN_8021Q=m +CONFIG_CFG80211=y +CONFIG_MAC80211=y +CONFIG_MAC80211_LEDS=y +CONFIG_RFKILL=y +CONFIG_RFKILL_INPUT=y +CONFIG_UEVENT_HELPER=y +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_CONNECTOR=y +CONFIG_MTD=y +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_BLOCK=y +CONFIG_MTD_CFI=y +CONFIG_MTD_CFI_AMDSTD=y +CONFIG_MTD_PHYSMAP=y +CONFIG_MTD_PHYSMAP_OF=y +CONFIG_MTD_SPI_NOR=y +# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set +CONFIG_OF_OVERLAY=y +CONFIG_OF_CONFIGFS=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=16384 +CONFIG_ADI_AXI_TDD=y +CONFIG_SRAM=y +# CONFIG_MATHWORKS_IP_CORE is not set +CONFIG_SCSI=y +CONFIG_BLK_DEV_SD=y +CONFIG_CHR_DEV_SG=y +CONFIG_NETDEVICES=y +CONFIG_TUN=y +# CONFIG_NET_VENDOR_ALACRITECH is not set +# CONFIG_NET_VENDOR_AMAZON is not set +# CONFIG_NET_VENDOR_AQUANTIA is not set +# CONFIG_NET_VENDOR_ARC is not set +# CONFIG_NET_VENDOR_BROADCOM is not set +# CONFIG_NET_VENDOR_CIRRUS is not set +# CONFIG_NET_VENDOR_EZCHIP is not set +# CONFIG_NET_VENDOR_FARADAY is not set +# CONFIG_NET_VENDOR_HISILICON is not set +# CONFIG_NET_VENDOR_HUAWEI is not set +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_NETRONOME is not set +# CONFIG_NET_VENDOR_QUALCOMM is not set +# CONFIG_NET_VENDOR_RENESAS is not set +# CONFIG_NET_VENDOR_ROCKER is not set +# CONFIG_NET_VENDOR_SAMSUNG is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SOLARFLARE is not set +# CONFIG_NET_VENDOR_SMSC is not set +# CONFIG_NET_VENDOR_STMICRO is not set +# CONFIG_NET_VENDOR_SYNOPSYS is not set +# CONFIG_NET_VENDOR_VIA is not set +# CONFIG_NET_VENDOR_WIZNET is not set +# CONFIG_NET_VENDOR_XILINX is not set +CONFIG_USB_RTL8150=y +CONFIG_USB_RTL8152=y +CONFIG_USB_LAN78XX=y +CONFIG_USB_USBNET=y +# CONFIG_USB_NET_CDC_NCM is not set +CONFIG_USB_NET_DM9601=y +CONFIG_USB_NET_SMSC75XX=y +CONFIG_USB_NET_SMSC95XX=y +# CONFIG_USB_NET_NET1080 is not set +CONFIG_USB_NET_RNDIS_HOST=y +# CONFIG_USB_NET_CDC_SUBSET is not set +# CONFIG_USB_NET_ZAURUS is not set +# CONFIG_WLAN_VENDOR_ADMTEK is not set +# CONFIG_WLAN_VENDOR_ATH is not set +# CONFIG_WLAN_VENDOR_ATMEL is not set +# CONFIG_WLAN_VENDOR_BROADCOM is not set +# CONFIG_WLAN_VENDOR_CISCO is not set +# CONFIG_WLAN_VENDOR_INTEL is not set +# CONFIG_WLAN_VENDOR_INTERSIL is not set +# CONFIG_WLAN_VENDOR_MARVELL is not set +# CONFIG_WLAN_VENDOR_MEDIATEK is not set +CONFIG_RT2X00=y +CONFIG_RT2500USB=y +CONFIG_RT73USB=y +CONFIG_RT2800USB=y +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y +CONFIG_RT2800USB_RT55XX=y +CONFIG_RT2800USB_UNKNOWN=y +CONFIG_RTL8187=y +CONFIG_RTL8192CU=y +# CONFIG_RTLWIFI_DEBUG is not set +CONFIG_RTL8XXXU=y +CONFIG_RTL8XXXU_UNTESTED=y +# CONFIG_WLAN_VENDOR_RSI is not set +# CONFIG_WLAN_VENDOR_ST is not set +# CONFIG_WLAN_VENDOR_TI is not set +# CONFIG_WLAN_VENDOR_ZYDAS is not set +CONFIG_INPUT_FF_MEMLESS=y +CONFIG_INPUT_SPARSEKMAP=y +CONFIG_INPUT_EVDEV=y +CONFIG_KEYBOARD_GPIO=y +# CONFIG_INPUT_MOUSE is not set +CONFIG_VT_HW_CONSOLE_BINDING=y +# CONFIG_LEGACY_PTYS is not set +CONFIG_SERIAL_XILINX_PS_UART=y +CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y +# CONFIG_HW_RANDOM is not set +CONFIG_I2C=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_CADENCE=y +CONFIG_I2C_GPIO=y +CONFIG_I2C_XILINX=y +CONFIG_SPI=y +CONFIG_SPI_AXI_SPI_ENGINE=y +CONFIG_SPI_CADENCE=y +CONFIG_SPI_XILINX=y +CONFIG_SPI_ZYNQ_QSPI=y +CONFIG_SPI_SPIDEV=y +CONFIG_PPS=y +CONFIG_NTP_PPS=y +CONFIG_PPS_CLIENT_KTIMER=y +CONFIG_PPS_CLIENT_LDISC=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_SYSFS=y +CONFIG_GPIO_ZYNQ=y +CONFIG_POWER_SUPPLY=y +CONFIG_THERMAL=y +CONFIG_WATCHDOG=y +CONFIG_XILINX_WATCHDOG=y +CONFIG_CADENCE_WATCHDOG=y +CONFIG_SSB=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y +CONFIG_MEDIA_SUPPORT=y +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_USB_SUPPORT=y +CONFIG_USB_VIDEO_CLASS=y +CONFIG_USB_STKWEBCAM=y +CONFIG_USB_S2255=y +CONFIG_VIDEO_USBTV=y +CONFIG_SOUND=y +CONFIG_SND=y +CONFIG_SND_USB_AUDIO=y +CONFIG_HIDRAW=y +CONFIG_USB_HIDDEV=y +CONFIG_USB=y +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y +CONFIG_USB_OTG=y +CONFIG_USB_EHCI_HCD=y +# CONFIG_USB_EHCI_TT_NEWSCHED is not set +CONFIG_USB_ACM=y +CONFIG_USB_STORAGE=y +CONFIG_USB_CHIPIDEA=y +CONFIG_USB_CHIPIDEA_UDC=y +CONFIG_USB_CHIPIDEA_HOST=y +CONFIG_USB_SERIAL=y +CONFIG_USB_SERIAL_GENERIC=y +CONFIG_USB_SERIAL_FTDI_SIO=y +#CONFIG_USB_SERIAL_CH341=y +CONFIG_USB_ULPI=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_VBUS_DRAW=500 +CONFIG_USB_GADGET_XILINX=y +CONFIG_USB_CONFIGFS=y +CONFIG_USB_CONFIGFS_SERIAL=y +CONFIG_USB_CONFIGFS_ACM=y +CONFIG_USB_CONFIGFS_NCM=y +CONFIG_USB_CONFIGFS_ECM=y +CONFIG_USB_CONFIGFS_ECM_SUBSET=y +CONFIG_USB_CONFIGFS_RNDIS=y +CONFIG_USB_CONFIGFS_EEM=y +CONFIG_USB_CONFIGFS_MASS_STORAGE=y +CONFIG_USB_CONFIGFS_F_FS=y +CONFIG_USB_CONFIGFS_F_UAC1=y +CONFIG_USB_CONFIGFS_F_UAC2=y +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_GPIO=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y +CONFIG_DMADEVICES=y +CONFIG_AXI_DMAC=y +CONFIG_UIO=y +CONFIG_UIO_PDRV_GENIRQ=y +CONFIG_UIO_DMEM_GENIRQ=y +CONFIG_UIO_XILINX_APM=y +CONFIG_STAGING=y +CONFIG_R8712U=y +CONFIG_R8188EU=y +CONFIG_COMMON_CLK_AXI_CLKGEN=y +# CONFIG_IOMMU_SUPPORT is not set +CONFIG_MEMORY=y +CONFIG_IIO=y +CONFIG_ADM1177=y +CONFIG_AD9361=y +CONFIG_ADMC=y +CONFIG_XILINX_XADC=y +CONFIG_ONE_BIT_ADC_DAC=y +CONFIG_CF_AXI_DDS=y +CONFIG_ADI_IIO_FAKEDEV=y +CONFIG_FPGA=y +CONFIG_FPGA_MGR_ZYNQ_FPGA=y +CONFIG_EXT4_FS=y +# CONFIG_DNOTIFY is not set +CONFIG_MSDOS_FS=y +CONFIG_VFAT_FS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_JFFS2_FS=y +CONFIG_JFFS2_COMPRESSION_OPTIONS=y +CONFIG_NFS_FS=y +CONFIG_NFSD=y +CONFIG_NFSD_V3=y +CONFIG_CIFS=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +CONFIG_CRYPTO_ECB=y +CONFIG_CRYPTO_MICHAEL_MIC=y +CONFIG_DMA_CMA=y +CONFIG_CMA_SIZE_MBYTES=256 +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_FS=y +CONFIG_DETECT_HUNG_TASK=y +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=20 +# CONFIG_SCHED_DEBUG is not set +# CONFIG_DEBUG_PREEMPT is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=60 +# CONFIG_FTRACE is not set +CONFIG_DEBUG_LL=y +CONFIG_DEBUG_ZYNQ_UART1=y +CONFIG_EARLY_PRINTK=y +CONFIG_NET_INGRESS=y +CONFIG_NETFILTER=y +CONFIG_NETFILTER_ADVANCED=y +CONFIG_BRIDGE_NETFILTER=m +CONFIG_NETFILTER_INGRESS=y +CONFIG_NETFILTER_FAMILY_BRIDGE=y +CONFIG_NF_CONNTRACK=y +CONFIG_NF_NAT=y +CONFIG_NF_NAT_NEEDED=y +CONFIG_NF_NAT_REDIRECT=y +CONFIG_NETFILTER_XTABLES=y +CONFIG_NETFILTER_XT_NAT=y +CONFIG_NETFILTER_XT_TARGET_NETMAP=y +CONFIG_NETFILTER_XT_TARGET_REDIRECT=y +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y +CONFIG_NETFILTER_XT_MATCH_STATE=y +CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y +CONFIG_NF_DEFRAG_IPV4=y +CONFIG_NF_NAT_IPV4=y +CONFIG_NF_NAT_MASQUERADE_IPV4=y +CONFIG_IP_NF_IPTABLES=y +CONFIG_IP_NF_FILTER=y +CONFIG_IP_NF_NAT=y +CONFIG_IP_NF_TARGET_MASQUERADE=y +CONFIG_IP_NF_TARGET_NETMAP=y +CONFIG_IP_NF_TARGET_REDIRECT=y +CONFIG_STP=y +CONFIG_LLC=y +CONFIG_USB_SERIAL_CP210X=y diff --git a/firmware/ori/configs/zynq_pluto_ori_defconfig b/firmware/ori/configs/zynq_pluto_ori_defconfig new file mode 100644 index 0000000..5e8758b --- /dev/null +++ b/firmware/ori/configs/zynq_pluto_ori_defconfig @@ -0,0 +1,113 @@ +BR2_arm=y +BR2_cortex_a9=y +BR2_ARM_ENABLE_NEON=y +BR2_ARM_ENABLE_VFP=y +BR2_ARM_FPU_NEON=y +BR2_TOOLCHAIN_EXTERNAL=y +#BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM=y +BR2_TOOLCHAIN_EXTERNAL_ARM_ARM=y +BR2_OPTIMIZE_2=y +BR2_TARGET_GENERIC_HOSTNAME="pluto" +BR2_TARGET_GENERIC_ISSUE="Welcome to PlutoORI" +BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y +BR2_TARGET_GENERIC_ROOT_PASSWD="analog" +BR2_TARGET_GENERIC_GETTY_PORT="ttyPS0" +BR2_ROOTFS_OVERLAY="${BR2_EXTERNAL}/board/pluto/overlay" +BR2_ROOTFS_POST_BUILD_SCRIPT="${BR2_EXTERNAL}/board/pluto/post-build.sh" +BR2_PACKAGE_BUSYBOX_CONFIG="${BR2_EXTERNAL}/board/pluto/busybox-1.25.0.config" +BR2_PACKAGE_ALSA_UTILS=y +BR2_PACKAGE_ALSA_UTILS_APLAY=y +BR2_PACKAGE_ZSTD=y +BR2_PACKAGE_PV=y +BR2_PACKAGE_JQ=y +BR2_PACKAGE_CIFS_UTILS=y +BR2_PACKAGE_MTD=y +# BR2_PACKAGE_MTD_NANDDUMP is not set +# BR2_PACKAGE_MTD_NANDTEST is not set +# BR2_PACKAGE_MTD_NANDWRITE is not set +# BR2_PACKAGE_MTD_UBIATTACH is not set +# BR2_PACKAGE_MTD_UBICRC32 is not set +# BR2_PACKAGE_MTD_UBIDETACH is not set +# BR2_PACKAGE_MTD_UBIFORMAT is not set +# BR2_PACKAGE_MTD_UBIMKVOL is not set +# BR2_PACKAGE_MTD_UBINFO is not set +# BR2_PACKAGE_MTD_UBINIZE is not set +# BR2_PACKAGE_MTD_UBIRENAME is not set +# BR2_PACKAGE_MTD_UBIRMVOL is not set +# BR2_PACKAGE_MTD_UBIRSVOL is not set +# BR2_PACKAGE_MTD_UBIUPDATEVOL is not set +# BR2_PACKAGE_MTD_UBIBLOCK is not set +BR2_PACKAGE_NFS_UTILS=y +BR2_PACKAGE_LINUX_FIRMWARE=y +BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT61=y +BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y +BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y +BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX=y +BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX=y +BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX=y +BR2_PACKAGE_GPSD=y +BR2_PACKAGE_GPSD_PPS=y +BR2_PACKAGE_GPSD_UBX=y +BR2_PACKAGE_INPUT_EVENT_DAEMON=y +BR2_PACKAGE_UBOOT_TOOLS=y +BR2_PACKAGE_ZLIB=y +BR2_PACKAGE_LIBAD9361_IIO=y +BR2_PACKAGE_LIBGPIOD=y +BR2_PACKAGE_LIBGPIOD_TOOLS=y +BR2_PACKAGE_LIBIIO_IIOD_USBD=y +BR2_PACKAGE_LIBIIO_TESTS=y +#BR2_PACKAGE_LIBRTLSDR=y +BR2_PACKAGE_NE10=y +#BR2_PACKAGE_JANSSON=y +BR2_PACKAGE_LIBINI=y +BR2_PACKAGE_LIBWEBSOCKETS=y +BR2_PACKAGE_FFTW_SINGLE=y +BR2_PACKAGE_FFTW_FAST=y +BR2_PACKAGE_BC=y +BR2_PACKAGE_AVAHI=y +BR2_PACKAGE_AVAHI_DAEMON=y +BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY=y +BR2_PACKAGE_DROPBEAR=y +BR2_PACKAGE_DROPBEAR_LOCALOPTIONS_FILE="board/pluto/dropbrear_localoptions.h" +BR2_PACKAGE_ETHTOOL=y +BR2_PACKAGE_HOSTAPD=y +BR2_PACKAGE_IPTABLES=y +BR2_PACKAGE_IW=y +BR2_PACKAGE_MOSQUITTO=y +BR2_PACKAGE_NTP=y +BR2_PACKAGE_NTP_NTPD_ATOM_PPS=y +BR2_PACKAGE_NTP_NTPDATE=y +BR2_PACKAGE_NTP_NTPDC=y +BR2_PACKAGE_NTP_NTPQ=y +BR2_PACKAGE_NTP_NTPTIME=y +BR2_PACKAGE_NTP_TICKADJ=y +#BR2_PACKAGE_OLSR=y +BR2_PACKAGE_SOCAT=y +BR2_PACKAGE_SSHPASS=y +BR2_PACKAGE_WPA_SUPPLICANT=y +BR2_PACKAGE_WPA_SUPPLICANT_CLI=y +BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y +BR2_PACKAGE_OPKG=y +BR2_PACKAGE_DIALOG=y +BR2_PACKAGE_INOTIFY_TOOLS=y +BR2_PACKAGE_HTOP=y +BR2_PACKAGE_NANO=y +BR2_PACKAGE_POLL_SYSFS=y +BR2_PACKAGE_AD936X_REF_CAL=y +BR2_TARGET_ROOTFS_CPIO=y +BR2_TARGET_ROOTFS_CPIO_GZIP=y +BR2_TARGET_ROOTFS_CPIO_UIMAGE=y +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_DTC=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_OPKG_UTILS=y +BR2_PACKAGE_CIVETWEBWS=y +BR2_PACKAGE_CIVETWEBWS_LIB=y +#BR2_PACKAGE_SOAPYSDR_MASTER=y +BR2_PACKAGE_LIBPCAP=y +BR2_PACKAGE_LIBUSB=y +BR2_PACKAGE_CHRONY=y +BR2_PACKAGE_NTP_NTP_SHM_CLK=y +BR2_PACKAGE_SRT=y +BR2_PACKAGE_VOLK=y diff --git a/firmware/ori/configs/zynq_plutodatv_defconfig b/firmware/ori/configs/zynq_plutodatv_defconfig new file mode 100644 index 0000000..ef6b7c4 --- /dev/null +++ b/firmware/ori/configs/zynq_plutodatv_defconfig @@ -0,0 +1,116 @@ +BR2_arm=y +BR2_cortex_a9=y +BR2_ARM_ENABLE_NEON=y +BR2_ARM_ENABLE_VFP=y +BR2_ARM_FPU_NEON=y +BR2_TOOLCHAIN_EXTERNAL=y +#BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM=y +BR2_TOOLCHAIN_EXTERNAL_ARM_ARM=y +BR2_OPTIMIZE_2=y +BR2_TARGET_GENERIC_HOSTNAME="pluto" +BR2_TARGET_GENERIC_ISSUE="Welcome to PlutoDVB2" +BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y +BR2_TARGET_GENERIC_ROOT_PASSWD="analog" +BR2_TARGET_GENERIC_GETTY_PORT="ttyPS0" +BR2_ROOTFS_OVERLAY="${BR2_EXTERNAL}/board/pluto/overlay" +BR2_ROOTFS_POST_BUILD_SCRIPT="${BR2_EXTERNAL}/board/pluto/post-build.sh" +BR2_PACKAGE_BUSYBOX_CONFIG="${BR2_EXTERNAL}/board/pluto/busybox-1.25.0.config" +BR2_PACKAGE_ALSA_UTILS=y +BR2_PACKAGE_ALSA_UTILS_APLAY=y +BR2_PACKAGE_ZSTD=y +BR2_PACKAGE_PV=y +BR2_PACKAGE_JQ=y +BR2_PACKAGE_CIFS_UTILS=y +BR2_PACKAGE_MTD=y +# BR2_PACKAGE_MTD_NANDDUMP is not set +# BR2_PACKAGE_MTD_NANDTEST is not set +# BR2_PACKAGE_MTD_NANDWRITE is not set +# BR2_PACKAGE_MTD_UBIATTACH is not set +# BR2_PACKAGE_MTD_UBICRC32 is not set +# BR2_PACKAGE_MTD_UBIDETACH is not set +# BR2_PACKAGE_MTD_UBIFORMAT is not set +# BR2_PACKAGE_MTD_UBIMKVOL is not set +# BR2_PACKAGE_MTD_UBINFO is not set +# BR2_PACKAGE_MTD_UBINIZE is not set +# BR2_PACKAGE_MTD_UBIRENAME is not set +# BR2_PACKAGE_MTD_UBIRMVOL is not set +# BR2_PACKAGE_MTD_UBIRSVOL is not set +# BR2_PACKAGE_MTD_UBIUPDATEVOL is not set +# BR2_PACKAGE_MTD_UBIBLOCK is not set +BR2_PACKAGE_NFS_UTILS=y +BR2_PACKAGE_LINUX_FIRMWARE=y +BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT61=y +BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y +BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y +BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX=y +BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX=y +BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX=y +BR2_PACKAGE_GPSD=y +BR2_PACKAGE_GPSD_PPS=y +BR2_PACKAGE_GPSD_UBX=y +BR2_PACKAGE_INPUT_EVENT_DAEMON=y +BR2_PACKAGE_UBOOT_TOOLS=y +BR2_PACKAGE_ZLIB=y +BR2_PACKAGE_LIBAD9361_IIO=y +BR2_PACKAGE_LIBGPIOD=y +BR2_PACKAGE_LIBGPIOD_TOOLS=y +BR2_PACKAGE_LIBIIO_IIOD_USBD=y +BR2_PACKAGE_LIBIIO_TESTS=y +#BR2_PACKAGE_LIBRTLSDR=y +#BR2_PACKAGE_LIBV4L=y +#BR2_PACKAGE_LIBV4L_UTILS=y +BR2_PACKAGE_NE10=y +#BR2_PACKAGE_JANSSON=y +BR2_PACKAGE_LIBINI=y +BR2_PACKAGE_LIBWEBSOCKETS=y +BR2_PACKAGE_FFTW_SINGLE=y +BR2_PACKAGE_FFTW_FAST=y +BR2_PACKAGE_BC=y +BR2_PACKAGE_AVAHI=y +BR2_PACKAGE_AVAHI_DAEMON=y +BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY=y +BR2_PACKAGE_DROPBEAR=y +BR2_PACKAGE_DROPBEAR_LOCALOPTIONS_FILE="board/pluto/dropbrear_localoptions.h" +BR2_PACKAGE_ETHTOOL=y +BR2_PACKAGE_HOSTAPD=y +BR2_PACKAGE_IPTABLES=y +BR2_PACKAGE_IW=y +BR2_PACKAGE_MOSQUITTO=y +BR2_PACKAGE_NTP=y +BR2_PACKAGE_NTP_NTPD_ATOM_PPS=y +BR2_PACKAGE_NTP_NTPDATE=y +BR2_PACKAGE_NTP_NTPDC=y +BR2_PACKAGE_NTP_NTPQ=y +BR2_PACKAGE_NTP_NTPTIME=y +BR2_PACKAGE_NTP_TICKADJ=y +#BR2_PACKAGE_OLSR=y +BR2_PACKAGE_SOCAT=y +BR2_PACKAGE_SSHPASS=y +BR2_PACKAGE_WPA_SUPPLICANT=y +BR2_PACKAGE_WPA_SUPPLICANT_CLI=y +BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y +BR2_PACKAGE_OPKG=y +BR2_PACKAGE_DIALOG=y +BR2_PACKAGE_INOTIFY_TOOLS=y +BR2_PACKAGE_HTOP=y +BR2_PACKAGE_NANO=y +BR2_PACKAGE_POLL_SYSFS=y +BR2_PACKAGE_AD936X_REF_CAL=y +BR2_TARGET_ROOTFS_CPIO=y +BR2_TARGET_ROOTFS_CPIO_GZIP=y +BR2_TARGET_ROOTFS_CPIO_UIMAGE=y +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_DTC=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_OPKG_UTILS=y +BR2_PACKAGE_CIVETWEBWS=y +BR2_PACKAGE_CIVETWEBWS_LIB=y +#BR2_PACKAGE_SOAPYSDR_MASTER=y +BR2_PACKAGE_LIBPCAP=y +BR2_PACKAGE_LIBGSE=y +BR2_PACKAGE_LIBUSB=y +BR2_PACKAGE_CHRONY=y +BR2_PACKAGE_NTP_NTP_SHM_CLK=y +BR2_PACKAGE_SRT=y +BR2_PACKAGE_VOLK=y diff --git a/firmware/ori/configs/zynq_plutoplus_linux_defconfig b/firmware/ori/configs/zynq_plutoplus_linux_defconfig new file mode 100644 index 0000000..d167001 --- /dev/null +++ b/firmware/ori/configs/zynq_plutoplus_linux_defconfig @@ -0,0 +1,335 @@ +CONFIG_SYSVIPC=y +CONFIG_USELIB=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_PREEMPT=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=15 +CONFIG_CGROUPS=y +CONFIG_BLK_DEV_INITRD=y +# CONFIG_RD_BZIP2 is not set +# CONFIG_RD_LZMA is not set +# CONFIG_RD_XZ is not set +# CONFIG_RD_LZO is not set +# CONFIG_RD_LZ4 is not set +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_SYSCTL_SYSCALL=y +CONFIG_EMBEDDED=y +CONFIG_PERF_EVENTS=y +CONFIG_SLAB=y +CONFIG_ARCH_ZYNQ=y +CONFIG_XILINX_RESET_CODE=y +CONFIG_PL310_ERRATA_588369=y +CONFIG_PL310_ERRATA_727915=y +CONFIG_PL310_ERRATA_769419=y +# CONFIG_ARM_ERRATA_643719 is not set +CONFIG_ARM_ERRATA_754322=y +CONFIG_ARM_ERRATA_754327=y +CONFIG_ARM_ERRATA_764369=y +CONFIG_ARM_ERRATA_775420=y +CONFIG_SMP=y +CONFIG_SCHED_MC=y +CONFIG_SCHED_SMT=y +CONFIG_HIGHMEM=y +# CONFIG_HIGHPTE is not set +CONFIG_CMDLINE="console=ttyPS0,115200n8 root=/dev/ram rw earlyprintk" +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_ARM_ZYNQ_CPUIDLE=y +CONFIG_VFP=y +CONFIG_NEON=y +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +CONFIG_MODVERSIONS=y +# CONFIG_BLK_DEV_BSG is not set +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set +# CONFIG_COMPACTION is not set +CONFIG_CMA=y +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +CONFIG_IP_PNP_RARP=y +CONFIG_NET_IPIP=m +# CONFIG_IPV6 is not set +CONFIG_VLAN_8021Q=m +CONFIG_CFG80211=y +CONFIG_MAC80211=y +CONFIG_MAC80211_LEDS=y +CONFIG_RFKILL=y +CONFIG_RFKILL_INPUT=y +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_DMA_CMA=y +CONFIG_CMA_SIZE_MBYTES=256 +CONFIG_CONNECTOR=y +CONFIG_MTD=y +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_BLOCK=y +CONFIG_MTD_CFI=y +CONFIG_MTD_CFI_AMDSTD=y +CONFIG_MTD_PHYSMAP=y +CONFIG_MTD_PHYSMAP_OF=y +CONFIG_MTD_SPI_NOR=y +# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set +CONFIG_OF_OVERLAY=y +CONFIG_OF_CONFIGFS=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=16384 +CONFIG_SRAM=y +# CONFIG_MATHWORKS_IP_CORE is not set +CONFIG_SCSI=y +CONFIG_BLK_DEV_SD=y +CONFIG_CHR_DEV_SG=y +CONFIG_NETDEVICES=y +CONFIG_TUN=y +# CONFIG_NET_VENDOR_ALACRITECH is not set +# CONFIG_NET_VENDOR_AMAZON is not set +# CONFIG_NET_VENDOR_AQUANTIA is not set +# CONFIG_NET_VENDOR_ARC is not set +# CONFIG_NET_VENDOR_BROADCOM is not set +# CONFIG_NET_VENDOR_CIRRUS is not set +# CONFIG_NET_VENDOR_EZCHIP is not set +# CONFIG_NET_VENDOR_FARADAY is not set +# CONFIG_NET_VENDOR_HISILICON is not set +# CONFIG_NET_VENDOR_HUAWEI is not set +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_NETRONOME is not set +# CONFIG_NET_VENDOR_QUALCOMM is not set +# CONFIG_NET_VENDOR_RENESAS is not set +# CONFIG_NET_VENDOR_ROCKER is not set +# CONFIG_NET_VENDOR_SAMSUNG is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SOLARFLARE is not set +# CONFIG_NET_VENDOR_SMSC is not set +# CONFIG_NET_VENDOR_STMICRO is not set +# CONFIG_NET_VENDOR_SYNOPSYS is not set +# CONFIG_NET_VENDOR_VIA is not set +# CONFIG_NET_VENDOR_WIZNET is not set +# CONFIG_NET_VENDOR_XILINX is not set +CONFIG_USB_RTL8150=y +CONFIG_USB_RTL8152=y +CONFIG_USB_LAN78XX=y +CONFIG_USB_USBNET=y +# CONFIG_USB_NET_CDC_NCM is not set +CONFIG_USB_NET_DM9601=y +CONFIG_USB_NET_SMSC75XX=y +CONFIG_USB_NET_SMSC95XX=y +# CONFIG_USB_NET_NET1080 is not set +CONFIG_USB_NET_RNDIS_HOST=y +# CONFIG_USB_NET_CDC_SUBSET is not set +# CONFIG_USB_NET_ZAURUS is not set +# CONFIG_WLAN_VENDOR_ADMTEK is not set +# CONFIG_WLAN_VENDOR_ATH is not set +# CONFIG_WLAN_VENDOR_ATMEL is not set +# CONFIG_WLAN_VENDOR_BROADCOM is not set +# CONFIG_WLAN_VENDOR_CISCO is not set +# CONFIG_WLAN_VENDOR_INTEL is not set +# CONFIG_WLAN_VENDOR_INTERSIL is not set +# CONFIG_WLAN_VENDOR_MARVELL is not set +# CONFIG_WLAN_VENDOR_MEDIATEK is not set +CONFIG_RT2X00=y +CONFIG_RT2500USB=y +CONFIG_RT73USB=y +CONFIG_RT2800USB=y +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y +CONFIG_RT2800USB_RT55XX=y +CONFIG_RT2800USB_UNKNOWN=y +CONFIG_RTL8187=y +CONFIG_RTL8192CU=y +# CONFIG_RTLWIFI_DEBUG is not set +CONFIG_RTL8XXXU=y +CONFIG_RTL8XXXU_UNTESTED=y +# CONFIG_WLAN_VENDOR_RSI is not set +# CONFIG_WLAN_VENDOR_ST is not set +# CONFIG_WLAN_VENDOR_TI is not set +# CONFIG_WLAN_VENDOR_ZYDAS is not set +CONFIG_INPUT_FF_MEMLESS=y +CONFIG_INPUT_SPARSEKMAP=y +CONFIG_INPUT_EVDEV=y +CONFIG_KEYBOARD_GPIO=y +# CONFIG_INPUT_MOUSE is not set +CONFIG_VT_HW_CONSOLE_BINDING=y +# CONFIG_LEGACY_PTYS is not set +CONFIG_SERIAL_XILINX_PS_UART=y +CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y +# CONFIG_HW_RANDOM is not set +CONFIG_I2C=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_CADENCE=y +CONFIG_I2C_GPIO=y +CONFIG_I2C_XILINX=y +CONFIG_SPI=y +CONFIG_SPI_AXI_SPI_ENGINE=y +CONFIG_SPI_CADENCE=y +CONFIG_SPI_XILINX=y +CONFIG_SPI_ZYNQ_QSPI=y +CONFIG_SPI_SPIDEV=y +#CONFIG_PPS=y +#CONFIG_NTP_PPS=y +#CONFIG_PPS_CLIENT_KTIMER=y +#CONFIG_PPS_CLIENT_LDISC=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_SYSFS=y +CONFIG_GPIO_ZYNQ=y +CONFIG_POWER_SUPPLY=y +CONFIG_THERMAL=y +CONFIG_WATCHDOG=y +CONFIG_XILINX_WATCHDOG=y +CONFIG_CADENCE_WATCHDOG=y +CONFIG_SSB=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y +CONFIG_MEDIA_SUPPORT=y +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_USB_SUPPORT=y +CONFIG_USB_VIDEO_CLASS=y +CONFIG_USB_STKWEBCAM=y +CONFIG_USB_S2255=y +CONFIG_VIDEO_USBTV=y +CONFIG_SOUND=y +CONFIG_SND=y +CONFIG_SND_USB_AUDIO=y +CONFIG_HIDRAW=y +CONFIG_USB_HIDDEV=y +CONFIG_USB=y +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y +CONFIG_USB_OTG=y +CONFIG_USB_EHCI_HCD=y +# CONFIG_USB_EHCI_TT_NEWSCHED is not set +CONFIG_USB_STORAGE=y +CONFIG_USB_CHIPIDEA=y +CONFIG_USB_CHIPIDEA_UDC=y +CONFIG_USB_CHIPIDEA_HOST=y +CONFIG_USB_SERIAL=y +CONFIG_USB_SERIAL_GENERIC=y +CONFIG_USB_SERIAL_FTDI_SIO=y +CONFIG_USB_ULPI=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_VBUS_DRAW=500 +CONFIG_USB_GADGET_XILINX=y +CONFIG_USB_CONFIGFS=y +CONFIG_USB_CONFIGFS_SERIAL=y +CONFIG_USB_CONFIGFS_ACM=y +CONFIG_USB_CONFIGFS_NCM=y +CONFIG_USB_CONFIGFS_ECM=y +CONFIG_USB_CONFIGFS_ECM_SUBSET=y +CONFIG_USB_CONFIGFS_RNDIS=y +CONFIG_USB_CONFIGFS_EEM=y +CONFIG_USB_CONFIGFS_MASS_STORAGE=y +CONFIG_USB_CONFIGFS_F_FS=y +CONFIG_USB_CONFIGFS_F_UAC1=y +CONFIG_USB_CONFIGFS_F_UAC2=y +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_GPIO=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y +CONFIG_DMADEVICES=y +CONFIG_AXI_DMAC=y +CONFIG_UIO=y +CONFIG_UIO_PDRV_GENIRQ=y +CONFIG_UIO_DMEM_GENIRQ=y +CONFIG_UIO_XILINX_APM=y +CONFIG_STAGING=y +CONFIG_R8712U=y +CONFIG_R8188EU=y +CONFIG_COMMON_CLK_AXI_CLKGEN=y +# CONFIG_IOMMU_SUPPORT is not set +CONFIG_MEMORY=y +CONFIG_IIO=y +CONFIG_ADM1177=y +CONFIG_AD9361=y +CONFIG_ADMC=y +CONFIG_XILINX_XADC=y +CONFIG_CF_AXI_DDS=y +CONFIG_FPGA=y +CONFIG_FPGA_MGR_ZYNQ_FPGA=y +CONFIG_EXT4_FS=y +# CONFIG_DNOTIFY is not set +CONFIG_MSDOS_FS=y +CONFIG_VFAT_FS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_JFFS2_FS=y +CONFIG_JFFS2_COMPRESSION_OPTIONS=y +CONFIG_NFS_FS=y +CONFIG_NFSD=y +CONFIG_NFSD_V3=y +CONFIG_CIFS=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +CONFIG_CRYPTO_ECB=y +CONFIG_CRYPTO_MICHAEL_MIC=y +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_FS=y +CONFIG_DETECT_HUNG_TASK=y +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=20 +# CONFIG_SCHED_DEBUG is not set +# CONFIG_DEBUG_PREEMPT is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=60 +# CONFIG_FTRACE is not set +CONFIG_DEBUG_LL=y +CONFIG_DEBUG_ZYNQ_UART1=y +CONFIG_EARLY_PRINTK=y +## FOR IP TABLES +CONFIG_NET_INGRESS=y +CONFIG_NETFILTER=y +CONFIG_NETFILTER_ADVANCED=y +CONFIG_BRIDGE_NETFILTER=m +CONFIG_NETFILTER_INGRESS=y +CONFIG_NETFILTER_FAMILY_BRIDGE=y +CONFIG_NF_CONNTRACK=y +CONFIG_NF_NAT=y +CONFIG_NF_NAT_NEEDED=y +CONFIG_NF_NAT_REDIRECT=y +CONFIG_NETFILTER_XTABLES=y +CONFIG_NETFILTER_XT_NAT=y +CONFIG_NETFILTER_XT_TARGET_NETMAP=y +CONFIG_NETFILTER_XT_TARGET_REDIRECT=y +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y +CONFIG_NETFILTER_XT_MATCH_STATE=y +CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y +CONFIG_NF_DEFRAG_IPV4=y +CONFIG_NF_NAT_IPV4=y +CONFIG_NF_NAT_MASQUERADE_IPV4=y +CONFIG_IP_NF_IPTABLES=y +CONFIG_IP_NF_FILTER=y +CONFIG_IP_NF_NAT=y +CONFIG_IP_NF_TARGET_MASQUERADE=y +CONFIG_IP_NF_TARGET_NETMAP=y +CONFIG_IP_NF_TARGET_REDIRECT=y +CONFIG_STP=y +CONFIG_LLC=y +# Pluto+ specific settings +CONFIG_MMC=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_SDHCI_OF_ARASAN=y +CONFIG_UEVENT_HELPER=y +CONFIG_MACB=y +CONFIG_OF_MDIO=y +CONFIG_REALTEK_PHY=y +CONFIG_ETHERNET=y +CONFIG_NET_VENDOR_XILINX=y +CONFIG_XILINX_AXI_EMAC=y + + + diff --git a/firmware/ori/configs/zynq_plutosat_defconfig b/firmware/ori/configs/zynq_plutosat_defconfig new file mode 100644 index 0000000..4be0156 --- /dev/null +++ b/firmware/ori/configs/zynq_plutosat_defconfig @@ -0,0 +1,122 @@ +BR2_arm=y +BR2_cortex_a9=y +BR2_ARM_ENABLE_NEON=y +BR2_ARM_ENABLE_VFP=y +BR2_ARM_FPU_NEON=y +BR2_TOOLCHAIN_EXTERNAL=y +#BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM=y +BR2_TOOLCHAIN_EXTERNAL_ARM_ARM=y +BR2_OPTIMIZE_2=y +BR2_TARGET_GENERIC_HOSTNAME="pluto" +BR2_TARGET_GENERIC_ISSUE="Welcome to PlutoDVB2" +BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y +BR2_TARGET_GENERIC_ROOT_PASSWD="analog" +BR2_TARGET_GENERIC_GETTY_PORT="ttyPS0" +BR2_ROOTFS_OVERLAY="${BR2_EXTERNAL}/board/pluto/overlay" +BR2_ROOTFS_POST_BUILD_SCRIPT="${BR2_EXTERNAL}/board/pluto/post-build.sh" +BR2_PACKAGE_BUSYBOX_CONFIG="${BR2_EXTERNAL}/board/pluto/busybox-1.25.0.config" +BR2_PACKAGE_ALSA_UTILS=y +BR2_PACKAGE_ALSA_UTILS_APLAY=y +BR2_PACKAGE_ZSTD=y +BR2_PACKAGE_PV=y +BR2_PACKAGE_JQ=y +BR2_PACKAGE_CIFS_UTILS=y +BR2_PACKAGE_MTD=y +# BR2_PACKAGE_MTD_NANDDUMP is not set +# BR2_PACKAGE_MTD_NANDTEST is not set +# BR2_PACKAGE_MTD_NANDWRITE is not set +# BR2_PACKAGE_MTD_UBIATTACH is not set +# BR2_PACKAGE_MTD_UBICRC32 is not set +# BR2_PACKAGE_MTD_UBIDETACH is not set +# BR2_PACKAGE_MTD_UBIFORMAT is not set +# BR2_PACKAGE_MTD_UBIMKVOL is not set +# BR2_PACKAGE_MTD_UBINFO is not set +# BR2_PACKAGE_MTD_UBINIZE is not set +# BR2_PACKAGE_MTD_UBIRENAME is not set +# BR2_PACKAGE_MTD_UBIRMVOL is not set +# BR2_PACKAGE_MTD_UBIRSVOL is not set +# BR2_PACKAGE_MTD_UBIUPDATEVOL is not set +# BR2_PACKAGE_MTD_UBIBLOCK is not set +BR2_PACKAGE_NFS_UTILS=y +BR2_PACKAGE_LINUX_FIRMWARE=y +BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT61=y +BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y +BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y +BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX=y +BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX=y +BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX=y +BR2_PACKAGE_GPSD=y +BR2_PACKAGE_GPSD_PPS=y +BR2_PACKAGE_GPSD_UBX=y +BR2_PACKAGE_INPUT_EVENT_DAEMON=y +BR2_PACKAGE_UBOOT_TOOLS=y +BR2_PACKAGE_ZLIB=y +BR2_PACKAGE_LIBAD9361_IIO=y +BR2_PACKAGE_LIBGPIOD=y +BR2_PACKAGE_LIBGPIOD_TOOLS=y +BR2_PACKAGE_LIBIIO_IIOD_USBD=y +BR2_PACKAGE_LIBIIO_TESTS=y +#BR2_PACKAGE_LIBRTLSDR=y +#BR2_PACKAGE_LIBV4L=y +#BR2_PACKAGE_LIBV4L_UTILS=y +BR2_PACKAGE_NE10=y +#BR2_PACKAGE_JANSSON=y +BR2_PACKAGE_LIBINI=y +BR2_PACKAGE_LIBWEBSOCKETS=y +BR2_PACKAGE_FFTW_SINGLE=y +BR2_PACKAGE_FFTW_FAST=y +BR2_PACKAGE_BC=y +BR2_PACKAGE_AVAHI=y +BR2_PACKAGE_AVAHI_DAEMON=y +BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY=y +BR2_PACKAGE_DROPBEAR=y +BR2_PACKAGE_DROPBEAR_LOCALOPTIONS_FILE="board/pluto/dropbrear_localoptions.h" +BR2_PACKAGE_ETHTOOL=y +BR2_PACKAGE_HOSTAPD=y +BR2_PACKAGE_IPTABLES=y +BR2_PACKAGE_IW=y +BR2_PACKAGE_MOSQUITTO=y +BR2_PACKAGE_NTP=y +BR2_PACKAGE_NTP_NTPD_ATOM_PPS=y +BR2_PACKAGE_NTP_NTPDATE=y +BR2_PACKAGE_NTP_NTPDC=y +BR2_PACKAGE_NTP_NTPQ=y +BR2_PACKAGE_NTP_NTPTIME=y +BR2_PACKAGE_NTP_TICKADJ=y +#BR2_PACKAGE_OLSR=y +BR2_PACKAGE_SOCAT=y +BR2_PACKAGE_SSHPASS=y +BR2_PACKAGE_WPA_SUPPLICANT=y +BR2_PACKAGE_WPA_SUPPLICANT_CLI=y +BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y +BR2_PACKAGE_OPKG=y +BR2_PACKAGE_DIALOG=y +BR2_PACKAGE_INOTIFY_TOOLS=y +BR2_PACKAGE_HTOP=y +BR2_PACKAGE_NANO=y +BR2_PACKAGE_POLL_SYSFS=y +BR2_PACKAGE_AD936X_REF_CAL=y +BR2_TARGET_ROOTFS_CPIO=y +BR2_TARGET_ROOTFS_CPIO_GZIP=y +BR2_TARGET_ROOTFS_CPIO_UIMAGE=y +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_DTC=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_OPKG_UTILS=y +BR2_PACKAGE_CIVETWEBWS=y +BR2_PACKAGE_CIVETWEBWS_LIB=y +#BR2_PACKAGE_SOAPYSDR_MASTER=y +BR2_PACKAGE_LIBPCAP=y +BR2_PACKAGE_LIBGSE=y +BR2_PACKAGE_LIBUSB=y +BR2_PACKAGE_CHRONY=y +BR2_PACKAGE_NTP_NTP_SHM_CLK=y +#DEPENDS SATDUMP +BR2_PACKAGE_NNG=y +BR2_PACKAGE_VOLK=y +BR2_PACKAGE_LIBPNG=y +BR2_PACKAGE_TIFF=y +BR2_PACKAGE_JEMALLOC=y + +BR2_PACKAGE_SATDUMP=y \ No newline at end of file diff --git a/firmware/ori/external.desc b/firmware/ori/external.desc new file mode 100644 index 0000000..2ccbab1 --- /dev/null +++ b/firmware/ori/external.desc @@ -0,0 +1,2 @@ +name: PLUTOSDR +desc: BR2_EXTERNAL_PLUTOSDR tree diff --git a/firmware/ori/external.mk b/firmware/ori/external.mk new file mode 100644 index 0000000..aefe3a3 --- /dev/null +++ b/firmware/ori/external.mk @@ -0,0 +1,2 @@ +include $(sort $(wildcard $(BR2_EXTERNAL_PLUTOSDR_PATH)/package/*/*.mk)) + diff --git a/firmware/ori/package/charon/0001-build.patch b/firmware/ori/package/charon/0001-build.patch new file mode 100644 index 0000000..d93b418 --- /dev/null +++ b/firmware/ori/package/charon/0001-build.patch @@ -0,0 +1,116 @@ +diff --git a/Makefile b/Makefile +index c87c596..242ab65 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,75 +1,19 @@ +-NAME ?= charon +-SUFFIX ?= .c +-DIRS ?= . ++LDFLAGS += -lliquid -liio -lad9361 -lc -lm -lfftw3 -lfftw3f -lini -lusb-1.0 \ ++-lserialport -lavahi-client -lavahi-common -lxml2 -lz -ldbus-1 -lfec -ltuntap + +-ARCH=arm +-VIVADO_SETTINGS ?= /opt/Xilinx/Vivado/2016.4/settings64.sh +-HAVE_VIVADO= $(shell bash -c "source $(VIVADO_SETTINGS) > /dev/null 2>&1 && vivado -version > /dev/null 2>&1 && echo 1 || echo 0") ++SRC := $(wildcard *.c) ++OBJ := $(addprefix build/,$(SRC:.c=.o)) + +-FLAGS ?= -O3 -std=c99 -I../buildroot/output/host/arm-buildroot-linux-gnueabi/sysroot/usr/include/\ +- --sysroot=../buildroot/output/host/arm-buildroot-linux-gnueabi/sysroot/\ +- -I./third_party/libtuntap/ ++bin/charon: $(OBJ) ++ @mkdir -p $(@D) ++ @$(CC) $(CXXFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@ + +-SYSROOT ?= ../buildroot/output/host/arm-buildroot-linux-gnueabi/sysroot/ ++build/%.o: %.c ++ @mkdir -p $(@D) ++ @$(CC) $(CXXFLAGS) $(CFLAGS) -MMD -MP -fPIC -c $< -o $@ + +-LDFLAGS ?= --sysroot=/opt/Xilinx/SDK/2016.4/gnu/arm/lin/arm-xilinx-linux-gnueabi/libc\ +- -L ../buildroot/output/host/arm-buildroot-linux-gnueabi/sysroot/\ +- -L /opt/Xilinx/SDK/2016.4/gnu/arm/lin/arm-xilinx-linux-gnueabi/libc\ +- -L /opt/Xilinx/SDK/2016.4/gnu/arm/lin/arm-xilinx-linux-gnueabi/libc/lib\ +- -L /opt/Xilinx/SDK/2016.4/gnu/arm/lin/arm-xilinx-linux-gnueabi/libc/usr/lib \ +- -L ./third_party/libfec\ +- -L ./third_party/libtuntap\ +- -L$(SYSROOT) -L$(SYSROOT)lib -L$(SYSROOT)usr -L$(SYSROOT)usr/lib \ +- -lliquid -liio -lad9361 -lc -lm -lfftw3 -lfftw3f -lini -lusb-1.0 -lserialport -lavahi-client -lavahi-common -lxml2 -lz -ldbus-1 -lfec -ltuntap +- +-PLATFORM := $(shell uname -s) +- +--include Make.config +- +- +-OUT_DIR := .build +-SRC := $(foreach dir, $(DIRS), $(wildcard $(dir)/*$(SUFFIX))) +-OBJ_ := $(SRC:$(SUFFIX)=.o) +-OBJ := $(addprefix $(OUT_DIR)/,$(OBJ_)) +-DEPS := $(OBJ:.o=.d) +-SHARED_SUFFIX := dll +-STATIC_SUFFIX := lib +- +-ifeq "$(PLATFORM)" "Linux" +- SHARED_SUFFIX := so +- STATIC_SUFFIX := a +-endif +- +-ifeq "$(LIBRARY)" "shared" +- OUT=lib$(NAME).$(SHARED_SUFFIX) +- LDFLAGS += -shared +-else ifeq "$(LIBRARY)" "static" +- OUT=lib$(NAME).$(STATIC_SUFFIX) +-else +- OUT=$(NAME) +-endif +- +-ifeq "$(SUFFIX)" ".cpp" +- COMPILER := $(CXX) +-else ifeq "$(SUFFIX)" ".c" +- COMPILER := $(CROSS_COMPILE)gcc +-endif +- +-.SUFFIXES: + .PHONY: clean +- +-$(OUT): $(OBJ) +-ifeq "$(LIBRARY)" "static" +- @$(AR) rcs $@ $^ +-else +- @$(COMPILER) $^ $(LDFLAGS) -o $@ +-endif +- +-$(OUT_DIR)/%.o: %$(SUFFIX) +- @mkdir -p $(dir $@) +- @$(COMPILER) $(CXXFLAGS) $(FLAGS) -MMD -MP -fPIC -c $< -o $@ +- + clean: +- @$(RM) -r $(OUT) $(OUT_DIR) ++ @rm -rf build bin + +--include: $(DEPS) ++-include: $(OBJ:.o=.d) +diff --git a/pluto.c b/pluto.c +index 1158564..eee917f 100644 +--- a/pluto.c ++++ b/pluto.c +@@ -86,7 +86,6 @@ static float complex x; // input sample + static float complex y[DECIMATE_INTERPOLATE_FACTOR]; // output samples + static int nbytes_tx; + static int llen; +-static int index=0; + static int tx_mod=0; + static int ii=0; + static int jj=0; +diff --git a/tap_device.c b/tap_device.c +index 944e699..dc2c2eb 100644 +--- a/tap_device.c ++++ b/tap_device.c +@@ -33,7 +33,6 @@ + #include + #include + #include +-#include + #include + #include "tuntap.h" + #include "tap_device.h" diff --git a/firmware/ori/package/charon/Config.in b/firmware/ori/package/charon/Config.in new file mode 100644 index 0000000..ec4390f --- /dev/null +++ b/firmware/ori/package/charon/Config.in @@ -0,0 +1,17 @@ +config BR2_PACKAGE_CHARON + bool "charon" + select BR2_PACKAGE_BATCTL + select BR2_PACKAGE_BRIDGE_UTILS + select BR2_PACKAGE_FFTWF + select BR2_PACKAGE_IPERF3 + select BR2_PACKAGE_IPROUTE2 + select BR2_PACKAGE_LIQUID_DSP + select BR2_PACKAGE_TUNCTL + select BR2_PACKAGE_UTIL_LINUX + select BR2_PACKAGE_UTIL_LINUX_SCHEDUTILS + select BR2_PACKAGE_LIBFEC + select BR2_PACKAGE_LIBTUNTAP + help + Enable your Pluto SDR to become a stand-alone OFDM transceiver with batman-adv mesh network routing capabilities + + https://github.com/tvelliott/charon diff --git a/firmware/ori/package/charon/charon.mk b/firmware/ori/package/charon/charon.mk new file mode 100644 index 0000000..d601bd6 --- /dev/null +++ b/firmware/ori/package/charon/charon.mk @@ -0,0 +1,17 @@ +CHARON_VERSION := af15fb0 +CHARON_SITE := https://github.com/tvelliott/charon.git +CHARON_SITE_METHOD := git +CHARON_DEPENDENCIES += batctl bridge-utils fftwf iperf3 iproute2 liquid-dsp tunctl util-linux libfec libtuntap +CHARON_INSTALL_TARGET := YES + +define CHARON_BUILD_CMDS + $(MAKE) WORKING_DIR=$(@D) CC="$(TARGET_CC)" CXX="$(TARGET_CXX)" LD="$(TARGET_LD)" -C $(@D) +endef + +define CHARON_INSTALL_TARGET_CMDS + $(INSTALL) -D -m 0755 $(@D)/bin/* $(TARGET_DIR)/usr/bin/ + cp -r $(@D)/changes_to_plutosdr_fw_configs_rel_to_v28/buildroot/output/target/root $(TARGET_DIR)/ + cp -r $(@D)/changes_to_plutosdr_fw_configs_rel_to_v28/buildroot/output/target/etc/init.d/* $(TARGET_DIR)/etc/init.d/ +endef + +$(eval $(generic-package)) diff --git a/firmware/ori/package/civetwebws/Config.in b/firmware/ori/package/civetwebws/Config.in new file mode 100644 index 0000000..037b2b4 --- /dev/null +++ b/firmware/ori/package/civetwebws/Config.in @@ -0,0 +1,40 @@ +config BR2_PACKAGE_CIVETWEBWS + bool "civetwebws" + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_USE_MMU # fork() + select BR2_PACKAGE_CIVETWEBWS_SERVER if !BR2_PACKAGE_CIVETWEBWS_LIB + help + Full featured embedded web server with Lua support. + + https://sourceforge.net/projects/civetweb + +if BR2_PACKAGE_CIVETWEBWS + +config BR2_PACKAGE_CIVETWEBWS_SERVER + bool "enable the web server application" + help + Include the web server and its config files. + +config BR2_PACKAGE_CIVETWEBWS_LIB + bool "enable library for embedding" + help + Enable the civetwebws library for embedding in another + application. + +config BR2_PACKAGE_CIVETWEBWS_WITH_LUA + bool "enable Lua support" + # required by the bundled Sqlite3 and Lua code + depends on !BR2_STATIC_LIBS + help + Enable Lua support in CIVETWEBWS. Note that this will use a + version of Lua and Sqlite bundled within the CIVETWEBWS + sources, and not the packages from Buildroot. + +comment "lua support needs a toolchain w/ dynamic library" + depends on BR2_STATIC_LIBS + +endif + +comment "civetwebws needs a toolchain w/ threads" + depends on BR2_USE_MMU + depends on !BR2_TOOLCHAIN_HAS_THREADS diff --git a/firmware/ori/package/civetwebws/civetwebws.hash b/firmware/ori/package/civetwebws/civetwebws.hash new file mode 100644 index 0000000..631dadf --- /dev/null +++ b/firmware/ori/package/civetwebws/civetwebws.hash @@ -0,0 +1,3 @@ +# Locally calculated +sha256 8cab1e2ad8fb3e2e81fed0b2321a5afbd7269a644c44ed4c3607e0a212c6d9e1 civetwebws-1.12.tar.gz +sha256 291622dfbbf4fb35829726fbe97177b7227c0d4d6392b350660af73af4f86df8 LICENSE.md diff --git a/firmware/ori/package/civetwebws/civetwebws.mk b/firmware/ori/package/civetwebws/civetwebws.mk new file mode 100644 index 0000000..22af13c --- /dev/null +++ b/firmware/ori/package/civetwebws/civetwebws.mk @@ -0,0 +1,93 @@ +################################################################################ +# +# civetwebws +# +################################################################################ + +CIVETWEBWS_VERSION = 1.12 +CIVETWEBWS_SITE = $(call github,civetweb,civetweb,v$(CIVETWEBWS_VERSION)) +CIVETWEBWS_LICENSE = MIT +CIVETWEBWS_LICENSE_FILES = LICENSE.md + +CIVETWEBWS_CONF_OPTS = TARGET_OS=LINUX WITH_IPV6=1 \ + $(if $(BR2_INSTALL_LIBSTDCPP),WITH_CPP=1) +CIVETWEBWS_COPT = -DHAVE_POSIX_FALLOCATE=0 +CIVETWEBWS_LIBS = -lpthread -lm +CIVETWEBWS_SYSCONFDIR = /etc +CIVETWEBWS_HTMLDIR = /var/www +CIVETWEBWS_INSTALL_OPTS = \ + DOCUMENT_ROOT="$(CIVETWEBWS_HTMLDIR)" \ + CONFIG_FILE2="$(CIVETWEBWS_SYSCONFDIR)/civetweb.conf" \ + HTMLDIR="$(TARGET_DIR)$(CIVETWEBWS_HTMLDIR)" \ + SYSCONFDIR="$(TARGET_DIR)$(CIVETWEBWS_SYSCONFDIR)" + +ifeq ($(BR2_TOOLCHAIN_HAS_SYNC_4),) +CIVETWEBWS_COPT += -DNO_ATOMICS=1 +endif + +ifeq ($(BR2_PACKAGE_CIVETWEBWS_WITH_LUA),y) +CIVETWEBWS_CONF_OPTS += WITH_LUA=1 +CIVETWEBWS_LIBS += -ldl +endif + +ifeq ($(BR2_PACKAGE_OPENSSL),y) +CIVETWEBWS_COPT += -DNO_SSL_DL +CIVETWEBWS_LIBS += `$(PKG_CONFIG_HOST_BINARY) --libs openssl` +CIVETWEBWS_DEPENDENCIES += openssl host-pkgconf +else +CIVETWEBWS_COPT += -DNO_SSL +endif + +ifeq ($(BR2_PACKAGE_ZLIB),y) +CIVETWEBWS_CONF_OPTS += WITH_ZLIB=1 +CIVETWEBWS_LIBS += -lz +CIVETWEBWS_DEPENDENCIES += zlib +endif + +ifeq ($(BR2_PACKAGE_CIVETWEBWS_SERVER),y) +CIVETWEBWS_BUILD_TARGETS += build +CIVETWEBWS_INSTALL_TARGETS += install +endif + +ifeq ($(BR2_PACKAGE_CIVETWEBWS_LIB),y) +CIVETWEBWS_CONF_OPTS += WITH_WEBSOCKET=1 +CIVETWEBWS_INSTALL_STAGING = YES +CIVETWEBWS_INSTALL_TARGETS += install-headers + +ifeq ($(BR2_STATIC_LIBS)$(BR2_STATIC_SHARED_LIBS),y) +CIVETWEBWS_BUILD_TARGETS += lib +CIVETWEBWS_INSTALL_TARGETS += install-lib +endif + +ifeq ($(BR2_SHARED_LIBS)$(BR2_STATIC_SHARED_LIBS),y) +CIVETWEBWS_BUILD_TARGETS += slib +CIVETWEBWS_INSTALL_TARGETS += install-slib +endif + +endif # BR2_PACKAGE_CIVETWEBWS_LIB + +define CIVETWEBWS_BUILD_CMDS + $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) $(CIVETWEBWS_BUILD_TARGETS) \ + $(CIVETWEBWS_CONF_OPTS) \ + COPT="$(CIVETWEBWS_COPT)" LIBS="$(CIVETWEBWS_LIBS)" +endef + +define CIVETWEBWS_INSTALL_STAGING_CMDS + mkdir -p $(STAGING_DIR)/usr/include + $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) $(CIVETWEBWS_INSTALL_TARGETS) \ + PREFIX="$(STAGING_DIR)/usr" \ + $(CIVETWEBWS_INSTALL_OPTS) \ + $(CIVETWEBWS_CONF_OPTS) \ + COPT='$(CIVETWEBWS_COPT)' +endef + +define CIVETWEBWS_INSTALL_TARGET_CMDS + mkdir -p $(TARGET_DIR)/usr/include + $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) $(CIVETWEBWS_INSTALL_TARGETS) \ + PREFIX="$(TARGET_DIR)/usr" \ + $(CIVETWEBWS_INSTALL_OPTS) \ + $(CIVETWEBWS_CONF_OPTS) \ + COPT='$(CIVETWEBWS_COPT)' +endef + +$(eval $(generic-package)) diff --git a/firmware/ori/package/csdr/Config.in b/firmware/ori/package/csdr/Config.in new file mode 100644 index 0000000..1f16b1c --- /dev/null +++ b/firmware/ori/package/csdr/Config.in @@ -0,0 +1,12 @@ +config BR2_PACKAGE_CSDR + bool "csdr" + depends on BR2_TOOLCHAIN_HAS_THREADS +# select BR2_PACKAGE_FFTW +# select BR2_PACKAGE_FFTW_PRECISION_SINGLE + help + csdr is a command line tool to carry out DSP tasks for Software Defined Radio. + + https://github.com/simonyiszk/csdr + +comment "csdr needs a toolchain w/ threads" + depends on !BR2_TOOLCHAIN_HAS_THREADS diff --git a/firmware/ori/package/csdr/csdr.mk b/firmware/ori/package/csdr/csdr.mk new file mode 100644 index 0000000..6e1079c --- /dev/null +++ b/firmware/ori/package/csdr/csdr.mk @@ -0,0 +1,32 @@ +################################################################################ +# +# csdr +# +################################################################################ + +CSDR_VERSION = 07236afacdf1fc06562072e4a3aec3330d2def92 +CSDR_SITE = https://github.com/simonyiszk/csdr.git +CSDR_SITE_METHOD = git +CSDR_LICENSE = BSD-3c +CSDR_DEPENDENCIES = fftw-double + +ifeq ($(BR2_ARM_CPU_HAS_NEON),y) +CSDR_CFLAGS += -mfpu=neon -mvectorize-with-neon-quad -funsafe-math-optimizations -Wformat=0 -DNEON_OPTS +endif + + +define CSDR_BUILD_CMDS + $(TARGET_CC) -std=gnu99 $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(CSDR_CFLAGS) $(@D)/fft_fftw.c $(@D)/libcsdr_wrapper.c -lm -lrt -lfftw3f -DUSE_FFTW -DLIBCSDR_GPL -DUSE_IMA_ADPCM -fpic -shared -Wl,-soname,libcsdr.so -o $(@D)/libcsdr.so +# $(TARGET_CC) -std=gnu99 $(@D)/csdr.c $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(CSDR_CFLAGS) -lm -lrt -lfftw-single -DUSE_FFTW -DLIBCSDR_GPL -DUSE_IMA_ADPCM -L$(@D) -lcsdr -ffast-math -fdump-tree-vect-details -o $(@D)/csdr + $(TARGET_CXX) $(@D)/nmux.cpp $(@D)/tsmpool.cpp $(CSDR_CFLAGS) -L$(@D) -lcsdr -lpthread -o $(@D)/nmux +endef + +define CSDR_INSTALL_TARGET_CMDS + $(INSTALL) -D -m 755 $(@D)/libcsdr.so $(TARGET_DIR)/usr/lib/libcsdr.so + $(INSTALL) -D -m 755 $(@D)/csdr $(TARGET_DIR)/usr/bin + $(INSTALL) -D -m 755 $(@D)/nmux $(TARGET_DIR)/usr/bin +endef + + +$(eval $(generic-package)) + diff --git a/firmware/ori/package/dump1090-pluto/Config.in b/firmware/ori/package/dump1090-pluto/Config.in new file mode 100644 index 0000000..b3e36da --- /dev/null +++ b/firmware/ori/package/dump1090-pluto/Config.in @@ -0,0 +1,11 @@ +config BR2_PACKAGE_DUMP1090_PLUTO + bool "dump1090-pluto" + depends on BR2_TOOLCHAIN_HAS_THREADS # librtlsdr + select BR2_PACKAGE_LIBAD9361_IIO + help + Dump1090 is a simple Mode S decoder for SDR devices (PlutoSDR fork) + + https://github.com/PlutoSDR/dump1090 + +comment "dump1090 needs a toolchain w/ threads" + depends on !BR2_TOOLCHAIN_HAS_THREADS diff --git a/firmware/ori/package/dump1090-pluto/dump1090-pluto.mk b/firmware/ori/package/dump1090-pluto/dump1090-pluto.mk new file mode 100644 index 0000000..f2c8822 --- /dev/null +++ b/firmware/ori/package/dump1090-pluto/dump1090-pluto.mk @@ -0,0 +1,30 @@ +################################################################################ +# +# dump1090-pluto +# +################################################################################ +DUMP1090_PLUTO_VERSION = master +DUMP1090_PLUTO_SITE = $(call github,PlutoSDR,dump1090,$(DUMP1090_PLUTO_VERSION)) +#DUMP1090_PLUTO_SOURCE = master +#DUMP1090_PLUTO_VERSION = 7f764ae8035d43ef5ceb3c8e3bfff8ec9dde66df +#DUMP1090_PLUTO_SITE = https://github.com/PlutoSDR/dump1090 +#DUMP1090_PLUTO_SITE = https://codeload.github.com/PlutoSDR/dump1090/zip/refs/heads/master +#DUMP1090_PLUTO_SITE_METHOD = git +DUMP1090_PLUTO_LICENSE = BSD-3-Clause +# no real license file +DUMP1090_PLUTO_LICENSE_FILES = README.md +DUMP1090_PLUTO_DEPENDENCIES = host-pkgconf libad9361-iio + +define DUMP1090_PLUTO_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) PREFIX=/usr -C $(@D) +endef + +define DUMP1090_PLUTO_INSTALL_TARGET_CMDS + $(INSTALL) -m 0755 -D $(@D)/dump1090 $(TARGET_DIR)/usr/bin/dump1090 +# $(INSTALL) -m 0755 -D $(@D)/view1090 $(TARGET_DIR)/usr/bin/view1090 +# mkdir -p $(TARGET_DIR)/www/dump1090 +# $(INSTALL) -d $(TARGET_DIR)/www/dump1090 +# cp -r $(@D)/public_html/* $(TARGET_DIR)/www/dump1090 +endef + +$(eval $(generic-package)) diff --git a/firmware/ori/package/dvb2iq/Config.in b/firmware/ori/package/dvb2iq/Config.in new file mode 100644 index 0000000..6df9afd --- /dev/null +++ b/firmware/ori/package/dvb2iq/Config.in @@ -0,0 +1,6 @@ +config BR2_PACKAGE_DVB2IQ + bool "dvb2iq" + help + A simple library to get I/Q symbols from a MPEG Transport stream + + https://github.com/F5OEO/libdvbmod diff --git a/firmware/ori/package/dvb2iq/dvb2iq.mk b/firmware/ori/package/dvb2iq/dvb2iq.mk new file mode 100644 index 0000000..2999180 --- /dev/null +++ b/firmware/ori/package/dvb2iq/dvb2iq.mk @@ -0,0 +1,29 @@ +################################################################################ +# +# DVB2IQ +# +################################################################################ + +#DVB2IQ_VERSION = 2.2.5 +DVB2IQ_SITE = /home/eric/libdvbmod/DvbTsToIQ +#DVB2IQ_SOURCE = /home/eric/plutosdr-fw/buildroot/dl/libdvbmod.tar.gz +#DVB2IQ_INSTALL_STAGING = YES +#DVB2IQ_AUTORECONF = YES +DVB2IQ_SITE_METHOD = local + + +define DVB2IQ_BUILD_CMDS + $(MAKE) CC="$(TARGET_CXX)" LD="$(TARGET_LD)" -C $(@D) + + +endef +# $(MAKE) CC="$(TARGET_CC)" +#define LIBDVBMOD_INSTALL_TARGET_CMDS +# $(INSTALL) -D -m 0755 $(@D)/hello $(TARGET_DIR)/usr/bin +#endef + +#$(eval $(generic-package)) + +#$(eval $(autotools-package)) +$(eval $(generic-package)) + diff --git a/firmware/ori/package/fs/Config.in b/firmware/ori/package/fs/Config.in new file mode 100644 index 0000000..d919d45 --- /dev/null +++ b/firmware/ori/package/fs/Config.in @@ -0,0 +1,21 @@ +menu "Filesystem images" + +#source "fs/axfs/Config.in" +#source "fs/btrfs/Config.in" +#source "fs/cloop/Config.in" +#source "fs/cpio/Config.in" +#source "fs/cramfs/Config.in" +#source "fs/ext2/Config.in" +#source "fs/f2fs/Config.in" +#source "fs/initramfs/Config.in" +#source "fs/iso9660/Config.in" +#source "fs/jffs2/Config.in" +#source "fs/romfs/Config.in" +#source "fs/squashfs/Config.in" +#source "fs/tar/Config.in" +#source "fs/ubi/Config.in" +#source "fs/ubifs/Config.in" +source "$BR2_EXTERNAL_PLUTOSDR_PATH/package/fs/ipk/Config.in" +#source "fs/yaffs2/Config.in" + +endmenu diff --git a/firmware/ori/package/fs/ipk/Config.in b/firmware/ori/package/fs/ipk/Config.in new file mode 100644 index 0000000..bff594d --- /dev/null +++ b/firmware/ori/package/fs/ipk/Config.in @@ -0,0 +1,13 @@ +config BR2_TARGET_ROOTFS_IPK_REPO + bool "Ipk repository with packages" + default y + help + Create a repository compatible with opkg/dpkg tools. + + Each selected packages is splitted in 4 parts: + - main package with debug symbols stripped off + - debug symbols + - development files + - documentation files + - locales + diff --git a/firmware/ori/package/fs/ipk/ipk.mk b/firmware/ori/package/fs/ipk/ipk.mk new file mode 100644 index 0000000..19d8747 --- /dev/null +++ b/firmware/ori/package/fs/ipk/ipk.mk @@ -0,0 +1,22 @@ +############################################################# +# +# Generate a repository for opkg +# +############################################################# + +define ROOTFS_IPK_REPO_CMD + mkdir -p $(BINARIES_DIR)/ipk_repository; \ + ( cd $(BINARIES_DIR)/ipk_repository && dpkg-scanpackages . ) > $(BINARIES_DIR)/ipk_repository/Packages; \ + gzip < $(BINARIES_DIR)/ipk_repository/Packages > $(BINARIES_DIR)/ipk_repository/Packages.gz; \ + echo "Archive: unstable" >> $(BINARIES_DIR)/ipk_repository/Release; \ + echo "Origin: Buildroot" >> $(BINARIES_DIR)/ipk_repository/Release; \ + echo "Label: Buildroot autogenerated repository" >> $(BINARIES_DIR)/ipk_repository/Release; \ + echo "Architecture: $(ARCH)" >> $(BINARIES_DIR)/ipk_repository/Release; \ + echo "Your repository is ready."; \ + echo "If you use opkg, add this line to your /etc/opkg/buildroot.conf:"; \ + echo " src/gz buildroot file://$(BINARIES_DIR)/ipk_repository"; \ + echo "If you use apt, add this one to /etc/apt/sources.list.d/buildroot.list:"; \ + echo " deb file://$(BINARIES_DIR)/ipk_repository ."; +endef + +$(eval $(call ROOTFS_TARGET,ipk_repo)) diff --git a/firmware/ori/package/lamableu-apps/Config.in b/firmware/ori/package/lamableu-apps/Config.in new file mode 100644 index 0000000..62fc2ed --- /dev/null +++ b/firmware/ori/package/lamableu-apps/Config.in @@ -0,0 +1,12 @@ +config BR2_PACKAGE_LAMABLEU_APPS + bool "LamaBleu-apps" + depends on BR2_PACKAGE_LIBIIO +# select BR2_PACKAGE_LAMABLEU_APPS + + help + Some tools for ADALM-Pluto + http://github.com/LamaBleu + + + + diff --git a/firmware/ori/package/lamableu-apps/LICENSE b/firmware/ori/package/lamableu-apps/LICENSE new file mode 100644 index 0000000..e69de29 diff --git a/firmware/ori/package/lamableu-apps/lamableu-apps.mk b/firmware/ori/package/lamableu-apps/lamableu-apps.mk new file mode 100644 index 0000000..3830fab --- /dev/null +++ b/firmware/ori/package/lamableu-apps/lamableu-apps.mk @@ -0,0 +1,36 @@ +################################################################################ +# +# LamaBleu apps +# +################################################################################ + + +#LAMABLEU_APPS_VERSION = 01747db5cd60ff64115a73ac1f3bb97911f5c58e +LAMABLEU_APPS_SITE = /home/eric/pluto032/buildroot/dl/lamableu-apps +LAMABLEU_APPS_SITE_METHOD = local +#LAMABLEU_APPS_SITE = https://github.com/lamableu +#LAMABLEU_APPS_SITE_METHOD = git +LAMABLEU_APPS_LICENSE = GPLv2 +LAMABLEU_APPS_LICENSE_FILES = LICENSE +LAMABLEU_APPS_DEPENDENCIES = libiio +LAMABLEU_APPS_VERSION = 0.2 +define LAMABLEU_APPS_BUILD_CMDS +# $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) \ +# $(@D)/timems.c -o $(@D)/timems -lm -lpthread + $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) \ + $(@D)/pow_pluto.c -o $(@D)/pow_pluto -lm -liio + $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) \ + $(@D)/pisstv.c -o $(@D)/pisstv -lm -lgd -lmagic +# $(TARGET_CC) -c $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(@D)/fly/fly.c + $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) \ + $(@D)/fly/fly.c -o $(@D)/fly/fly -lgd -lm -lz -lpng +endef + +define LAMABLEU_APPS_INSTALL_TARGET_CMDS +# $(INSTALL) -D -m 755 $(@D)/timems $(TARGET_DIR)/usr/bin/timems + $(INSTALL) -D -m 755 $(@D)/pow_pluto $(TARGET_DIR)/usr/bin/pow_pluto + $(INSTALL) -D -m 755 $(@D)/pisstv $(TARGET_DIR)/usr/bin/pisstv + $(INSTALL) -D -m 755 $(@D)/fly/fly $(TARGET_DIR)/usr/bin/fly +endef + +$(eval $(generic-package)) diff --git a/firmware/ori/package/lamableu-apps/lamableu.zip b/firmware/ori/package/lamableu-apps/lamableu.zip new file mode 100644 index 0000000..d7fba6b Binary files /dev/null and b/firmware/ori/package/lamableu-apps/lamableu.zip differ diff --git a/firmware/ori/package/lamableu-apps/new/conv.lua b/firmware/ori/package/lamableu-apps/new/conv.lua new file mode 100644 index 0000000..e25e41e --- /dev/null +++ b/firmware/ori/package/lamableu-apps/new/conv.lua @@ -0,0 +1,67 @@ +local binfin = "" +local open = io.open + +local function read_file(path) + local file = open(path, "rb") -- r read mode and b binary mode + if not file then return nil end + local content = file:read "*a" -- *a or *all reads the whole file + file:close() + return content +end + +-- local fileContent = read_file("toto.txt"); +-- print (fileContent); + + +function hex_dump(str) + local len = string.len( str ) + local dump = "" + local hex = "" + local asc = "" + + for i = 1, len do + if 1 == i % 8 then + dump = dump .. hex .. asc .. "\n" + hex = string.format( "%04x: ", i - 1 ) + asc = "" + end + + local ord = string.byte( str, i ) +-- toBits(ord, 32) + bin = table.concat(toBits(ord, 8)) + binfin = binfin .. bin + hex = hex .. string.format( "%02x ", ord ) + if ord >= 32 and ord <= 126 then + asc = asc .. string.char( ord ) + else + asc = asc .. "." + end + end + + + return dump .. hex + .. string.rep( " ", 8 - len % 8 ) .. asc +end + +bits=8 + + +function toBits(num, bits) + -- returns a table of bits + local t={} -- will contain the bits + for b=bits,1,-1 do + rest=math.fmod(num,2) + t[b]=rest + num=(num-rest)/2 + end + if num==0 then return t else return {'Not enough bits to represent this number'}end +end + +-- bits=toBits(num, bits) +-- print(table.concat(bits)) +hex_dump(read_file("toto.txt")) +-- print(hex_dump(read_file("toto.txt"))) +--print(hex_dump("rfghg")) +-- print(bin) +print(binfin) +-- print(table.concat(bits)) diff --git a/firmware/ori/package/lamableu-apps/new/fm-radio.c b/firmware/ori/package/lamableu-apps/new/fm-radio.c new file mode 100644 index 0000000..a62d05e --- /dev/null +++ b/firmware/ori/package/lamableu-apps/new/fm-radio.c @@ -0,0 +1,61 @@ +#include +#include +#include +#include + +const char *script_template = + "local radio = require('radio')" + "local frequency = tonumber(%f)" + "return radio.CompositeBlock():connect(" + " radio.SoapySDRSource('driver=plutosdr', frequency - 250e3, 960000, {gain=68})," + " radio.TunerBlock(-250e3, 170e3, 4, {128,hamming})," + " radio.WBFMMonoDemodulator()," + " radio.DownsamplerBlock(5)," + " radio.WAVFileSink('/www/record.wav', 1)" + ")"; + + +int main(int argc, char *argv[]) { + luaradio_t *radio; + char script[512]; + + if (argc < 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + fprintf(stderr, "Record WBFM. Output file: /www/record.wav\n"); + return -1; + } + + fprintf(stderr, "Recording WBFM on %s to /www/record.wav\n", argv[1]); + + /* Substitute station frequency in script template */ + snprintf(script, sizeof(script), script_template, atof(argv[1])); + + /* Create context */ + if ((radio = luaradio_new()) == NULL) { + perror("Allocating memory"); + return -1; + } + + /* Load flow graph */ + if (luaradio_load(radio, script) < 0) { + fprintf(stderr, "Error loading flow graph: %s\n", luaradio_strerror(radio)); + return -1; + } + + /* Start flow graph */ + if (luaradio_start(radio) < 0) { + fprintf(stderr, "Error starting flow graph: %s\n", luaradio_strerror(radio)); + return -1; + } + + /* Wait until completion */ + if (luaradio_wait(radio) < 0) { + fprintf(stderr, "Error waiting for flow graph: %s\n", luaradio_strerror(radio)); + return -1; + } + + /* Free context */ + luaradio_free(radio); + + return 0; +} diff --git a/firmware/ori/package/lamableu-apps/new/fm.lua b/firmware/ori/package/lamableu-apps/new/fm.lua new file mode 100644 index 0000000..5a37d91 --- /dev/null +++ b/firmware/ori/package/lamableu-apps/new/fm.lua @@ -0,0 +1,12 @@ +local radio = require('radio') +local frequency = tonumber(arg[1]) +local top = radio.CompositeBlock():connect( + radio.SoapySDRSource('driver=plutosdr',frequency - 250e3, 1102500, {gain=68}), + radio.TunerBlock(-250e3, 200e3, 5), + radio.WBFMMonoDemodulator(), + radio.DownsamplerBlock(5), + radio.WAVFileSink('/tmp/record.wav',1,8) +) +top:run() + + diff --git a/firmware/ori/package/lamableu-apps/new/fskmod.lua b/firmware/ori/package/lamableu-apps/new/fskmod.lua new file mode 100755 index 0000000..ebaf875 --- /dev/null +++ b/firmware/ori/package/lamableu-apps/new/fskmod.lua @@ -0,0 +1,73 @@ +-- Input : random bits (1200bit/s, output IQ stream) +-- Based on : http://luaradio.io/docs/creating-blocks.html#blocks +-- Transmit: use "./luaradio ./fskmod.lua | pv | iio_writedev -n 192.168.2.1 -b 1000000 cf-ad9361-dds-core-lpc" + + +local radio = require('radio') +local ffi = require('ffi') + +local BFSKModulator = radio.block.factory('BFSKModulator') + +function BFSKModulator:instantiate(deviation, sample_rate) + self.deviation = deviation + self.sample_rate = sample_rate + + self:add_type_signature({radio.block.Input("in", radio.types.Bit)}, + {radio.block.Output("out", radio.types.ComplexFloat32)}) +end + +ffi.cdef[[ +typedef struct fskmod_s * fskmod; +fskmod fskmod_create(unsigned int _m, unsigned int _k, float _bandwidth); +void fskmod_destroy(fskmod _q); +void fskmod_modulate(fskmod _q, unsigned int _s, complex_float32_t *_y); +]] +local libliquid = radio.platform.libs.liquid + +function BFSKModulator:initialize() + self.samples_per_bit = math.floor(self.sample_rate / radio.block.Block.get_rate(self)) + + self.modulator = ffi.gc( + libliquid.fskmod_create(1, self.samples_per_bit, (self.deviation / self.sample_rate)/2), + libliquid.fskmod_destroy + ) + if self.modulator == nil then + error("Creating liquid fskmod object.") + end + + self.out = radio.types.ComplexFloat32.vector() +end + +function BFSKModulator:get_rate() + return self.sample_rate +end + +function BFSKModulator:process(x) + local out = self.out:resize(x.length * self.samples_per_bit) + + for i = 0, x.length-1 do +-- libliquid.fskmod_modulate(self.modulator, x.data[i].value-48, out.data[i*self.samples_per_bit]) + libliquid.fskmod_modulate(self.modulator, x.data[i].value, out.data[i*self.samples_per_bit]) + end + + return out +end + +-- local source = radio.RawFileSource('/root/luaradio/bits.txt', radio.types.Bit,300, true) +local source = radio.UniformRandomSource(radio.types.Bit, 1200) +local bfsk = BFSKModulator(10e3 , 576e3) +local interpolator = radio.InterpolatorBlock(2) +local sink = radio.IQFileSink('/root/luaradio/toto.txt', 'f32le') +-- local sinkiio = radio.IQFileSink('/tmp/iq.test', 's16le') +local sinkiio = radio.IQFileSink(1, 's16le') + +-- Connections + + +local plutoiq = radio.CompositeBlock() + plutoiq:connect(source,radio.ThrottleBlock(),bfsk,sinkiio) +if os.getenv('DISPLAY') then + plutoiq:connect(bfsk,radio.ThrottleBlock(), radio.GnuplotSpectrumSink()) +end + +plutoiq:run() diff --git a/firmware/ori/package/lamableu-apps/new/fskmod_ok.lua b/firmware/ori/package/lamableu-apps/new/fskmod_ok.lua new file mode 100644 index 0000000..39eb5e9 --- /dev/null +++ b/firmware/ori/package/lamableu-apps/new/fskmod_ok.lua @@ -0,0 +1,73 @@ +-- Input : random bits (1200bit/s, output IQ stream) +-- Based on : http://luaradio.io/docs/creating-blocks.html#blocks +-- Transmit: use "./luaradio ./fskmod.lua | pv | iio_writedev -n 192.168.2.1 -b 1000000 cf-ad9361-dds-core-lpc" + + +local radio = require('radio') +local ffi = require('ffi') + +local BFSKModulator = radio.block.factory('BFSKModulator') + +function BFSKModulator:instantiate(deviation, sample_rate) + self.deviation = deviation + self.sample_rate = sample_rate + + self:add_type_signature({radio.block.Input("in", radio.types.Bit)}, + {radio.block.Output("out", radio.types.ComplexFloat32)}) +end + +ffi.cdef[[ +typedef struct fskmod_s * fskmod; +fskmod fskmod_create(unsigned int _m, unsigned int _k, float _bandwidth); +void fskmod_destroy(fskmod _q); +void fskmod_modulate(fskmod _q, unsigned int _s, complex_float32_t *_y); +]] +local libliquid = radio.platform.libs.liquid + +function BFSKModulator:initialize() + self.samples_per_bit = math.floor(self.sample_rate / radio.block.Block.get_rate(self)) + + self.modulator = ffi.gc( + libliquid.fskmod_create(1, self.samples_per_bit, (self.deviation / self.sample_rate)/2), + libliquid.fskmod_destroy + ) + if self.modulator == nil then + error("Creating liquid fskmod object.") + end + + self.out = radio.types.ComplexFloat32.vector() +end + +function BFSKModulator:get_rate() + return self.sample_rate +end + +function BFSKModulator:process(x) + local out = self.out:resize(x.length * self.samples_per_bit) + + for i = 0, x.length-1 do + libliquid.fskmod_modulate(self.modulator, x.data[i].value-48, out.data[i*self.samples_per_bit]) +-- libliquid.fskmod_modulate(self.modulator, x.data[i].value, out.data[i*self.samples_per_bit]) + end + + return out +end + +local source = radio.RawFileSource('bits.txt', radio.types.Bit,5000, true) +-- local source = radio.UniformRandomSource(radio.types.Bit, 300) +local bfsk = BFSKModulator(25e3 , 576e3) +local interpolator = radio.InterpolatorBlock(2) +local sink = radio.IQFileSink('/root/luaradio/toto.txt', 'f32le') +-- local sinkiio = radio.IQFileSink('/tmp/iq.test', 's16le') +local sinkiio = radio.IQFileSink(1, 's16le') + +-- Connections + + +local plutoiq = radio.CompositeBlock() + plutoiq:connect(source,radio.ThrottleBlock(), bfsk,sinkiio) +if os.getenv('DISPLAY') then + plutoiq:connect(bfsk,radio.ThrottleBlock(), radio.GnuplotSpectrumSink()) +end + +plutoiq:run() diff --git a/firmware/ori/package/lamableu-apps/new/plutoset.c b/firmware/ori/package/lamableu-apps/new/plutoset.c new file mode 100644 index 0000000..298fa1f --- /dev/null +++ b/firmware/ori/package/lamableu-apps/new/plutoset.c @@ -0,0 +1,27 @@ +#include + +int main (int argc, char **argv) +{ + struct iio_context *ctx; + struct iio_device *phy; + + ctx = iio_create_context_from_uri("local:"); + + phy = iio_context_find_device(ctx, "ad9361-phy"); + + iio_channel_attr_write_longlong( + iio_device_find_channel(phy, "altvoltage0", true), + "frequency", + 434000000); /* RX LO frequency 2.4GHz */ + + iio_channel_attr_write_longlong( + iio_device_find_channel(phy, "voltage0", false), + "sampling_frequency", + 2000000); /* RX baseband rate 5 MSPS */ + +/* receive(ctx); */ + + iio_context_destroy(ctx); + + return 0; +} diff --git a/firmware/ori/package/lamableu-apps/new/rds-timesync.c b/firmware/ori/package/lamableu-apps/new/rds-timesync.c new file mode 100644 index 0000000..2809d4a --- /dev/null +++ b/firmware/ori/package/lamableu-apps/new/rds-timesync.c @@ -0,0 +1,127 @@ +#include +#include +#include +#include +#include +#include + +#include + +const char *script_template = + "local frequency = tonumber(%f)\n" + "return radio.CompositeBlock():connect(" + " radio.SoapySDRSource('driver=plutosdr',frequency - 250e3, 1102500)," + " radio.TunerBlock(-250e3, 200e3, 5)," + " radio.RDSReceiver()," + " radio.RawFileSink('/tmp/rds.txt')" + ")"; + +/* radio.RDSFramerBlock.RDSFrameType */ +typedef struct { + uint16_t blocks[4]; +} rds_frame_t; + +static time_t rds_decode_time(const rds_frame_t *time_frame) { + /* See RDS Standard 3.1.5.6, pg. 28 */ + /* Extract modified julian date, hour, minute */ + uint32_t mjd = ((time_frame->blocks[1] & 0x3) << 15) | ((time_frame->blocks[2] & 0xfffe) >> 1); + uint32_t hour = ((time_frame->blocks[2] & 0x1) << 4) | ((time_frame->blocks[3] & 0xf000) >> 12); + uint32_t minute = ((time_frame->blocks[3] >> 6) & 0x3f); + + /* See RDS Standard Annex G, pg. 81 */ + /* Convert modified julian date to year, month, day */ + uint32_t yp = (uint32_t)(((float)mjd - 15078.2) / 365.25); + uint32_t mp = (uint32_t)(((float)mjd - 14956.1 - ((uint32_t)((float)yp * 365.25))) / 30.6001); + uint32_t k = (mp == 14 || mp == 15) ? 1 : 0; + uint32_t day = mjd - 14956 - ((uint32_t)((float)yp * 365.25))-((uint32_t)((float)mp * 30.6001)); + uint32_t month = mp - 1 - k * 12; + uint32_t year = yp + k; + + /* Convert hour, minute, year, month, day to time_t */ + struct tm tm = { + .tm_sec = 0, .tm_min = minute, .tm_hour = hour, + .tm_mday = day, .tm_mon = month - 1, .tm_year = year, + .tm_isdst = -1, + }; + return timegm(&tm); +} + +int main(int argc, char *argv[]) { + luaradio_t *radio; + char script[512]; + int sink_fds[2]; + rds_frame_t frame; + + if (argc < 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + return -1; + } + + /* Create a pair of connected file descriptors with pipe() */ + if (pipe(sink_fds) < 0) { + perror("pipe()"); + return -1; + } + + /* Substitute station frequency and write fd of pipe in script template */ + snprintf(script, sizeof(script), script_template, atof(argv[1]), sink_fds[1]); + + /* Create context */ + if ((radio = luaradio_new()) == NULL) { + perror("Allocating memory"); + return -1; + } + + /* Load flow graph */ + if (luaradio_load(radio, script) < 0) { + fprintf(stderr, "Error loading flow graph: %s\n", luaradio_strerror(radio)); + return -1; + } + + /* Start flow graph */ + if (luaradio_start(radio) < 0) { + fprintf(stderr, "Error starting flow graph: %s\n", luaradio_strerror(radio)); + return -1; + } + + for (unsigned int frame_count = 1; ; frame_count++) { + /* Read RDS frame from read fd of pipe */ + if (read(sink_fds[0], &frame, sizeof(frame)) != sizeof(frame)) { + perror("read()"); + return -1; + } + + printf("\rRDS frames received: % 5d", frame_count); + + /* Check if it's a time frame (group = 0x4, version = 0x0) */ + uint32_t group = (frame.blocks[1] >> 12) & 0xf; + uint32_t version = (frame.blocks[1] >> 11) & 0x1; + if (group == 0x4 && version == 0) { + printf("\nRDS time frame found!\n"); + break; + } + } + + /* Stop flow graph */ + if (luaradio_stop(radio) < 0) { + fprintf(stderr, "Error stopping flow graph: %s\n", luaradio_strerror(radio)); + return -1; + } + + /* Decode the time */ + time_t t = rds_decode_time(&frame); + + printf("Setting system time to %s", ctime(&t)); + + /* Set system time */ + struct timeval tv = { .tv_sec = t, .tv_usec = 0 }; + if (settimeofday(&tv, NULL) < 0) { + perror("settimeofday()"); + return -1; + } + + /* Free context */ + luaradio_free(radio); + + return 0; +} diff --git a/firmware/ori/package/lamableu-apps/new/read.lua b/firmware/ori/package/lamableu-apps/new/read.lua new file mode 100644 index 0000000..f745685 --- /dev/null +++ b/firmware/ori/package/lamableu-apps/new/read.lua @@ -0,0 +1,12 @@ +local open = io.open + +local function read_file(path) + local file = open(path, "rb") -- r read mode and b binary mode + if not file then return nil end + local content = file:read "*a" -- *a or *all reads the whole file + file:close() + return content +end + +local fileContent = read_file("toto.txt"); +print (fileContent); diff --git a/firmware/ori/package/lamableu-apps/new/readme.txt b/firmware/ori/package/lamableu-apps/new/readme.txt new file mode 100644 index 0000000..0e81f80 --- /dev/null +++ b/firmware/ori/package/lamableu-apps/new/readme.txt @@ -0,0 +1,3 @@ +# Another kind of alias +#function send() { pv | iio_writedev -b 1000000 cf-ad9361-dds-core-lpc } +sendssb() { /root/wav2ssb.armv7 "$1" "$2" | pv | iio_writedev -b 1000000 cf-ad9361-dds-core-lpc; } \ No newline at end of file diff --git a/firmware/ori/package/lamableu-apps/new/test_api b/firmware/ori/package/lamableu-apps/new/test_api new file mode 100755 index 0000000..683ba34 Binary files /dev/null and b/firmware/ori/package/lamableu-apps/new/test_api differ diff --git a/firmware/ori/package/lamableu-apps/new/wav2plutossb.c b/firmware/ori/package/lamableu-apps/new/wav2plutossb.c new file mode 100644 index 0000000..8d4d9d1 --- /dev/null +++ b/firmware/ori/package/lamableu-apps/new/wav2plutossb.c @@ -0,0 +1,118 @@ + + +/* LamaBleu - 09/2019 + Create IQ stream from WAV input file (48000Hz) + SR Pluto : 576000 */ + + +#include +#include +#include +#include +#include + + +const char *script_template = + "return radio.CompositeBlock():connect(" + " radio.WAVFileSource('%s',1)," + " radio.LowpassFilterBlock(128, 3400)," + " radio.HilbertTransformBlock(129)," + " radio.ComplexBandpassFilterBlock(129, {0, 3400})," + " radio.InterpolatorBlock(12)," + " radio.ComplexBandpassFilterBlock(130, {0, 5000})," + " radio.IQFileSink(1, 's16le')" + ")"; + + +int main(int argc, char *argv[]) { + luaradio_t *radio; + char script[512]; + + if (argc < 3) { + fprintf(stderr, "Generate 576kS/s IQ stream from WAV file (48000Hz).\n"); + fprintf(stderr, "Output to stdout (use pipe or redirect to file).\n"); + fprintf(stderr, "Usage: %s \n", argv[0]); + return -1; + } + + + + + /* Substitute station frequency in script template */ + snprintf(script, sizeof(script), script_template, argv[1]); + + /* Test: print frequency */ + /*char frequency = argv[2];*/ + fprintf(stderr, "Frequency: %s\n", argv[2]); + + + struct iio_context *ctx; + struct iio_device *phy; + + ctx = iio_create_context_from_uri("ip:192.168.2.1"); + + phy = iio_context_find_device(ctx, "ad9361-phy"); + + iio_channel_attr_write_longlong( + iio_device_find_channel(phy, "altvoltage0", true), + "frequency", + atof(argv[2])); /* RX LO frequency 2.4GHz */ + + iio_channel_attr_write_longlong( + iio_device_find_channel(phy, "voltage0", false), + "sampling_frequency", + 576000); /* RX baseband rate 5 MSPS */ + + + /* Create context */ + if ((radio = luaradio_new()) == NULL) { + perror("Allocating memory"); + return -1; + } + + /* Load flow graph */ + if (luaradio_load(radio, script) < 0) { + fprintf(stderr, "Error loading flow graph: %s\n", luaradio_strerror(radio)); + return -1; + } + + /* Start flow graph */ + if (luaradio_start(radio) < 0) { + fprintf(stderr, "Error starting flow graph: %s\n", luaradio_strerror(radio)); + return -1; + } + + /* Wait until completion */ + if (luaradio_wait(radio) < 0) { + fprintf(stderr, "Error waiting for flow graph: %s\n", luaradio_strerror(radio)); + return -1; + } + + /* Free context */ + luaradio_free(radio); + iio_context_destroy(ctx); + return 0; +} + + + +/* +io.stderr:write("Usage: " .. arg[0] .. " \n") + io.stderr:write("Input file /tmp/send.png.wav, output IQ to stdout \n") +const char *script_template = + + + + "if #arg < 1 then + "arg[1]='/tmp/send.png.wav' + + "end + + "local input_file = arg[1] + + + + + "local sinkiio = radio.IQFileSink(1, 's16le') + "local wav2iq = radio.CompositeBlock() + "wav2iq:connect(source, af_filter, hilbert, sb_filter, interpolator, filter2, sinkiio) */ diff --git a/firmware/ori/package/lamableu-apps/new/wav2plutossb1.c b/firmware/ori/package/lamableu-apps/new/wav2plutossb1.c new file mode 100644 index 0000000..dce4380 --- /dev/null +++ b/firmware/ori/package/lamableu-apps/new/wav2plutossb1.c @@ -0,0 +1,89 @@ + + +/* LamaBleu - 09/2019 + Create IQ stream from WAV input file (48000Hz) + SR Pluto : 576000 */ + + +#include +#include +#include +#include + + +const char *script_template = + "return radio.CompositeBlock():connect(" + " radio.WAVFileSource('/tmp/send.png.wav', 1)," + " radio.LowpassFilterBlock(128, 3400)," + " radio.HilbertTransformBlock(129)," + " radio.ComplexBandpassFilterBlock(129, {0, 3400})," + " radio.InterpolatorBlock(12)," + " radio.ComplexBandpassFilterBlock(130, {0, 5000})," + " radio.IQFileSink('/tmp/send.png.iq', 'f32le')" + ")"; + + +int main(int argc, char *argv[]) { + luaradio_t *radio; + char script[512]; + + if (argc < 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + return -1; + } + + /* Substitute station frequency in script template */ + snprintf(script, sizeof(script), script_template, argv[1]); + + /* Create context */ + if ((radio = luaradio_new()) == NULL) { + perror("Allocating memory"); + return -1; + } + + /* Load flow graph */ + if (luaradio_load(radio, script) < 0) { + fprintf(stderr, "Error loading flow graph: %s\n", luaradio_strerror(radio)); + return -1; + } + + /* Start flow graph */ + if (luaradio_start(radio) < 0) { + fprintf(stderr, "Error starting flow graph: %s\n", luaradio_strerror(radio)); + return -1; + } + + /* Wait until completion */ + if (luaradio_wait(radio) < 0) { + fprintf(stderr, "Error waiting for flow graph: %s\n", luaradio_strerror(radio)); + return -1; + } + + /* Free context */ + luaradio_free(radio); + + return 0; +} + + + +/* +io.stderr:write("Usage: " .. arg[0] .. " \n") + io.stderr:write("Input file /tmp/send.png.wav, output IQ to stdout \n") +const char *script_template = + + + + "if #arg < 1 then + "arg[1]='/tmp/send.png.wav' + + "end + + "local input_file = arg[1] + + + + + "local sinkiio = radio.IQFileSink(1, 's16le') + "local wav2iq = radio.CompositeBlock() + "wav2iq:connect(source, af_filter, hilbert, sb_filter, interpolator, filter2, sinkiio) */ diff --git a/firmware/ori/package/lamableu-apps/new/wav2ssb.c b/firmware/ori/package/lamableu-apps/new/wav2ssb.c new file mode 100644 index 0000000..344b9d6 --- /dev/null +++ b/firmware/ori/package/lamableu-apps/new/wav2ssb.c @@ -0,0 +1,111 @@ + + +/* LamaBleu - 10/2019 + Using LUAradio, create IQ stream from WAV input file (48000Hz) - output to stdout + Prepare pluto to transmit - Set tuner TX freq and SR to 576000 kSPS + To start transmission use : + 'wav2ssb | pv | iio_writedev -b 1000000 cf-ad9361-dds-core-lpc' +*/ + + +#include +#include +#include +#include +#include + + + +const char *script_template = + "return radio.CompositeBlock():connect(" + " radio.WAVFileSource('%s',1)," + " radio.LowpassFilterBlock(128, 3400)," + " radio.HilbertTransformBlock(129)," + " radio.ComplexBandpassFilterBlock(129, {0, 3400})," + " radio.InterpolatorBlock(12)," + " radio.ComplexBandpassFilterBlock(130, {0, 5000})," + " radio.IQFileSink(1, 's16le')" + ")"; + +float gain; +int main(int argc, char *argv[]) { + luaradio_t *radio; + char script[512]; + + if (argc == 1) { + fprintf(stderr, "Usage: %s \n\n", argv[0]); + fprintf(stderr, "Generate 576kS/s IQ stream from WAV file (48000Hz).\n"); + fprintf(stderr, "Output to stdout (use pipe or redirect to file).\n"); + fprintf(stderr, "\nPluto transmit example:\n\t %s /www/record.wav 434000000 -20 | pv | iio_writedev -b 1000000 cf-ad9361-dds-core-lpc\n\n",argv[0] ); + return -1; + } + /*gain = atof(argv[3]); + if (argc < 3) { + gain = atof("-10"); + } else { gain = atof(argv[3]); } +*/ + /* Substitute station frequency in script template */ + snprintf(script, sizeof(script), script_template, argv[1]); + + if (argc < 3) { + fprintf(stderr, "Incorrect parameters number\n"); + return -1; + } + + + + struct iio_context *ctx; + struct iio_device *phy; + + ctx = iio_create_context_from_uri("local:"); + + phy = iio_context_find_device(ctx, "ad9361-phy"); + fprintf(stderr, "Set frequency: %s\n", argv[2]); + iio_channel_attr_write_longlong( + iio_device_find_channel(phy, "altvoltage1", true), + "frequency", + atof(argv[2])); /* RX LO frequency 2.4GHz */ + fprintf(stderr, "Set samplerate: 576000\n"); + iio_channel_attr_write_longlong( + iio_device_find_channel(phy, "voltage0", false), + "sampling_frequency", + 576000); /* TX baseband rate 576 kSPS */ + + fprintf(stderr, "Set TX gain: %f\n", gain); + iio_channel_attr_write_longlong( + iio_device_find_channel(phy, "voltage0", true), + "hardwaregain", + gain); /* RX LO frequency 2.4GHz */ + + /* Create context */ + if ((radio = luaradio_new()) == NULL) { + perror("Allocating memory"); + return -1; + } + + /* Load flow graph */ + if (luaradio_load(radio, script) < 0) { + perror("Error loading flow graph.\n"); + iio_context_destroy(ctx); + return -1; + } + + /* Start flow graph */ + if (luaradio_start(radio) < 0) { + perror("Error starting flow graph. \n"); + iio_context_destroy(ctx); + return -1; + } + + /* Wait until completion */ + if (luaradio_wait(radio) < 0) { + perror("Error running for flow graph. \n"); + return -1; + } + + /* Free context */ + luaradio_free(radio); + iio_context_destroy(ctx); + return 0; +} + diff --git a/firmware/ori/package/lamableu-apps/new/wbfmradio-stdout.c b/firmware/ori/package/lamableu-apps/new/wbfmradio-stdout.c new file mode 100644 index 0000000..0ad8b67 --- /dev/null +++ b/firmware/ori/package/lamableu-apps/new/wbfmradio-stdout.c @@ -0,0 +1,64 @@ +#include +#include +#include +#include + +const char *script_template = + "local radio = require('radio')" + "local frequency = tonumber(%f)" + "return radio.CompositeBlock():connect(" + " radio.SoapySDRSource('driver=plutosdr', frequency - 250e3, 960000, {gain=68})," + " radio.TunerBlock(-250e3, 170e3, 4, {128,hamming})," + " radio.WBFMMonoDemodulator()," + " radio.DownsamplerBlock(5)," + " radio.RealFileSink(1, 's16le')" + ")"; + + +int main(int argc, char *argv[]) { + luaradio_t *radio; + char script[512]; + + if (argc < 2) { + fprintf(stderr, "\nUsage: %s \n", argv[0]); + fprintf(stderr, "Stream WBFM station. Output to stdout as RAW format (s16le)\n"); + fprintf(stderr, "\nPluto side, use : %s | nmux -p 1234 -a 0.0.0.0\n", argv[0]); + fprintf(stderr, "Remote side : nc pluto.local 1234 | ffplay -f s16le -ar 48k -ac 1 -\n"); + fprintf(stderr, "or : nc pluto.local 1234 | vlc --demux=rawaud --rawaud-channels 1 --rawaud-samplerate 48000 -\n\n"); + return -1; + } + + fprintf(stderr, "Recording WBFM on %s to /www/record.wav\n", argv[1]); + + /* Substitute station frequency in script template */ + snprintf(script, sizeof(script), script_template, atof(argv[1])); + + /* Create context */ + if ((radio = luaradio_new()) == NULL) { + perror("Allocating memory"); + return -1; + } + + /* Load flow graph */ + if (luaradio_load(radio, script) < 0) { + fprintf(stderr, "Error loading flow graph: %s\n", luaradio_strerror(radio)); + return -1; + } + + /* Start flow graph */ + if (luaradio_start(radio) < 0) { + fprintf(stderr, "Error starting flow graph: %s\n", luaradio_strerror(radio)); + return -1; + } + + /* Wait until completion */ + if (luaradio_wait(radio) < 0) { + fprintf(stderr, "Error waiting for flow graph: %s\n", luaradio_strerror(radio)); + return -1; + } + + /* Free context */ + luaradio_free(radio); + + return 0; +} diff --git a/firmware/ori/package/lamableu-apps/new/wbfmradio.c b/firmware/ori/package/lamableu-apps/new/wbfmradio.c new file mode 100644 index 0000000..a62d05e --- /dev/null +++ b/firmware/ori/package/lamableu-apps/new/wbfmradio.c @@ -0,0 +1,61 @@ +#include +#include +#include +#include + +const char *script_template = + "local radio = require('radio')" + "local frequency = tonumber(%f)" + "return radio.CompositeBlock():connect(" + " radio.SoapySDRSource('driver=plutosdr', frequency - 250e3, 960000, {gain=68})," + " radio.TunerBlock(-250e3, 170e3, 4, {128,hamming})," + " radio.WBFMMonoDemodulator()," + " radio.DownsamplerBlock(5)," + " radio.WAVFileSink('/www/record.wav', 1)" + ")"; + + +int main(int argc, char *argv[]) { + luaradio_t *radio; + char script[512]; + + if (argc < 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + fprintf(stderr, "Record WBFM. Output file: /www/record.wav\n"); + return -1; + } + + fprintf(stderr, "Recording WBFM on %s to /www/record.wav\n", argv[1]); + + /* Substitute station frequency in script template */ + snprintf(script, sizeof(script), script_template, atof(argv[1])); + + /* Create context */ + if ((radio = luaradio_new()) == NULL) { + perror("Allocating memory"); + return -1; + } + + /* Load flow graph */ + if (luaradio_load(radio, script) < 0) { + fprintf(stderr, "Error loading flow graph: %s\n", luaradio_strerror(radio)); + return -1; + } + + /* Start flow graph */ + if (luaradio_start(radio) < 0) { + fprintf(stderr, "Error starting flow graph: %s\n", luaradio_strerror(radio)); + return -1; + } + + /* Wait until completion */ + if (luaradio_wait(radio) < 0) { + fprintf(stderr, "Error waiting for flow graph: %s\n", luaradio_strerror(radio)); + return -1; + } + + /* Free context */ + luaradio_free(radio); + + return 0; +} diff --git a/firmware/ori/package/lamableu-apps/pisstv.c b/firmware/ori/package/lamableu-apps/pisstv.c new file mode 100644 index 0000000..5ee06f6 --- /dev/null +++ b/firmware/ori/package/lamableu-apps/pisstv.c @@ -0,0 +1,889 @@ +// PiSSTVpp + +// 2013 Robert Marshall KI4MCW +// 2014 Gerrit Polder, PA3BYA fixed header. +// 2014 Don Gi Min, KM4EQR, more protocols and option handling + +// Note: Compile me thus: gcc -lgd -lmagic -o sstvX sstvX.c + +// =========== +// includes +// =========== + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +// ================ +// macros/defines +// ================ + +#define RATE 11025 +#define MAXRATE 22050 +#define BITS 16 +#define CHANS 1 +#define VOLPCT 20 +// ^-- 90% max +#define MAXSAMPLES (300 * MAXRATE) + +// uncomment only one of these +#define AUDIO_WAV +//#define AUDIO_AIFF + +#define MAGIC_PNG ("PNG image data,") +#define MAGIC_JPG ("JPEG image data") +#define MAGIC_CNT 15 + +#define FILETYPE_ERR 0 +#define FILETYPE_PNG 1 +#define FILETYPE_JPG 2 + +// ========= +// globals +// ========= + +uint16_t g_audio[MAXSAMPLES] ; +uint32_t g_scale, g_samples ; +double g_twopioverrate , g_uspersample ; +double g_theta, g_fudge ; +uint8_t g_protocol; //VIS ID's for SSTV protocols + +FILE * g_imgfp ; +FILE * g_outfp ; +gdImagePtr g_imgp ; +uint16_t g_rate; + +// ======== +// protos +// ======== + +uint8_t filetype (char *filename) ; +void playtone (uint16_t tonefreq , double tonedur) ; +void addvisheader (void) ; +void addvistrailer (void) ; + +uint16_t toneval_rgb (uint8_t colorval) ; +uint16_t toneval_yuv (uint8_t colorval) ; + +void buildaudio_m (double pixeltime) ; +void buildaudio_s (double pixeltime) ; +void buildaudio_r36 (void) ; +void buildaudio_pd120 (void) ; + +#ifdef AUDIO_AIFF +void writefile_aiff (void) ; +#endif +#ifdef AUDIO_WAV +void writefile_wav (void) ; +#endif + + +// ================ +// main +// ================ + +int main(int argc, char *argv[]) { + + char *protocol; + int option; + + g_rate = RATE; + while ((option = getopt(argc, argv, "r:p:")) != -1) { + switch (option) { + case 'r': + g_rate = (atoi(optarg)); + break; + case 'p': + protocol = optarg; + break; + } + } + + //Set VIS codes + if ( strcmp(protocol, "m1") == 0 ) { + g_protocol = 44; //Martin 1 + } + else if ( strcmp(protocol,"m2") == 0) { + g_protocol = 40; //Martin 2 + } + else if ( strcmp(protocol,"s1") == 0) { + g_protocol = 60; //Scottie 1 + } + else if ( strcmp(protocol,"s2") == 0) { + g_protocol = 56; //Scottie 2 + } + else if ( strcmp(protocol,"sdx") == 0) { + g_protocol = 76; //Scottie DX + } + else if ( strcmp(protocol,"r36") == 0) { + g_protocol = 8; //Robot 36 + } + else if ( strcmp(protocol,"pd120") == 0) { + g_protocol = 95; //PD 120 + } + else { + printf("Unrecognized protocol option %s, defaulting to Martin 1...\n\n", protocol); + g_protocol = 44; + } + + + // locals + uint32_t starttime = time(NULL) ; + uint8_t ft ; + char inputfile[255], outputfile[255] ; + + // string hygeine + memset( inputfile , 0 , 255 ) ; + memset( outputfile , 0 , 255 ) ; + + // assign values to globals + + double temp1, temp2, temp3 ; + temp1 = (double)( 1 << (BITS - 1) ) ; + temp2 = VOLPCT / 100.0 ; + temp3 = temp1 * temp2 ; + g_scale = (uint32_t)temp3 ; + + g_twopioverrate = 2.0 * M_PI / g_rate ; + g_uspersample = 1000000.0 / (double)g_rate ; + + g_theta = 0.0 ; + g_samples = 0.0 ; + g_fudge = 0.0 ; + + printf( "Constants check:\n" ) ; + printf( " rate = %d\n" , g_rate ) ; + printf( " VIS code = %d\n" , g_protocol); + printf( " BITS = %d\n" , BITS ) ; + printf( " VOLPCT = %d\n" , VOLPCT ) ; + printf( " scale = %d\n" , g_scale ) ; + printf( " us/samp = %f\n" , g_uspersample ) ; + printf( " 2p/rate = %f\n\n" , g_twopioverrate ) ; + + // set filenames + strncpy( inputfile , argv[optind] , strlen( argv[optind] ) ) ; + ft = filetype( inputfile ) ; + if ( ft == FILETYPE_ERR ) + { + printf( "Exiting.\n" ) ; + return 2 ; + } + + strncpy( outputfile, inputfile , strlen( inputfile ) ) ; + +#ifdef AUDIO_AIFF + strcat( outputfile , ".aiff" ) ; +#endif +#ifdef AUDIO_WAV + strcat( outputfile , ".wav" ) ; +#endif + + printf( "Input file is [%s].\n" , inputfile ) ; + printf( "Output file is [%s].\n" , outputfile ) ; + + // prep + + g_imgfp = fopen( inputfile , "r" ) ; + g_outfp = fopen( outputfile , "w" ) ; + printf( "FILE ptrs opened.\n" ) ; + + if ( ft == FILETYPE_PNG ) + { g_imgp = gdImageCreateFromPng( g_imgfp ) ; } + else { + printf( "Some weird error!\n" ) ; + return 3 ; + } + + printf( "Image ptr opened.\n" ) ; + + // go! + + addvisheader() ; + + //Selects audio format mode + switch (g_protocol) { + case 44: //Martin 1 + buildaudio_m(457.6); + break; + case 40: //Martin 2 + buildaudio_m(228.8); + break; + case 60: //Scottie 1 + buildaudio_s(432.0); + break; + case 56: //Scottie 2 + buildaudio_s(275.2); + break; + case 76: //Scottie DX + buildaudio_s(1080.0); + break; + case 8: //Robot 36 + buildaudio_r36(); + break; + case 95: //PD 120 + buildaudio_pd120(); + break; + default: + printf("Something went horribly wrong: unknown protocol while building audio!\n"); + exit(2); + break; + } + + + addvistrailer() ; + +#ifdef AUDIO_AIFF + writefile_aiff() ; +#endif +#ifdef AUDIO_WAV + writefile_wav(); +#endif + + // cleanup + + fclose( g_imgfp ) ; + fclose( g_outfp ) ; + + // brag + + uint32_t endtime = time(NULL) ; + printf( "Created soundfile in %d seconds.\n" , ( endtime - starttime ) ) ; + + return 0 ; +} + + +// ===================== +// subs +// ===================== + + +// filetype -- Check to see if input file is in one of our +// supported formats (currently jus JPEG and PNG). +// Uses libmagic. + +uint8_t filetype( char *filename ) { + magic_t m ; + char m_str[ MAGIC_CNT + 2 ] ; + uint8_t retval ; + + printf( " Checking filetype for file [%s]\n" , filename ) ; + + retval = FILETYPE_ERR ; + + m = magic_open( MAGIC_NONE ) ; + if ( m && ( magic_load(m, NULL) == 0 ) ) + { + strncpy(m_str, magic_file(m, filename), MAGIC_CNT+1) ; + + if ( strncmp(m_str, MAGIC_PNG, MAGIC_CNT) == 0 ) + { + printf( " File is a PNG image.\n" ) ; + retval = FILETYPE_PNG ; + } + + else + { + printf( " This file format is not supported!\n" ) ; + printf( " Please use a JPEG or PNG file instead.\n" ) ; + } + } + + if ( m ) { magic_close(m) ; } + + return retval ; +} + + +// playtone -- Add waveform info to audio data. New waveform data is +// added in a phase-continuous manner according to the +// audio frequency and duration provided. Note that the +// audio is still in a purely hypothetical state - the +// format of the output file is not determined until +// the file is written, at the end of the process. +// Also, yes, a nod to Tom Hanks. + +void playtone( uint16_t tonefreq , double tonedur ) { + uint16_t tonesamples, voltage, i ; + double deltatheta ; + + tonedur += g_fudge ; + tonesamples = ( tonedur / g_uspersample ) + 0.5 ; + deltatheta = g_twopioverrate * tonefreq ; + + for ( i=1 ; i<=tonesamples ; i++ ) { + g_samples++ ; + + if ( tonefreq == 0 ) { g_audio[ g_samples ] = 32768 ; } + else { + +#ifdef AUDIO_AIFF + voltage = 32768 + (int)( sin( g_theta ) * g_scale ) ; +#endif +#ifdef AUDIO_WAV + voltage = 0 + (int)( sin( g_theta ) * g_scale ) ; +#endif + g_audio[g_samples] = voltage ; + g_theta += deltatheta ; + } + } // end for i + + g_fudge = tonedur - ( tonesamples * g_uspersample ) ; +} // end playtone + +uint16_t toneval_rgb ( uint8_t colorval ) { + return ( ( 800 * colorval ) / 256 ) + 1500 ; +} + +uint16_t toneval_yuv ( uint8_t colorval ) { + return ( (float)colorval * 3.1372549 ) + 1500.0 ; +} + +// addvisheader -- Add the specific audio tones that make up the +// Martin 1 VIS header to the audio data. Basically, +// this just means lots of calls to playtone(). + +void addvisheader() { + printf( "Adding VIS header to audio data.\n" ) ; + + // bit of silence + playtone( 0 , 500000 ) ; + + // attention tones + playtone( 1900 , 100000 ) ; // you forgot this one + playtone( 1500 , 100000 ) ; + playtone( 1900 , 100000 ) ; + playtone( 1500 , 100000 ) ; + playtone( 2300 , 100000 ) ; + playtone( 1500 , 100000 ) ; + playtone( 2300 , 100000 ) ; + playtone( 1500 , 100000 ) ; + + // VIS lead, break, mid, start + playtone( 1900 , 300000 ) ; + playtone( 1200 , 10000 ) ; + playtone( 1900 , 300000 ) ; + playtone( 1200 , 30000 ) ; + + int i; + int parity = 0; + + //write VIS data tones + for(i = 1; i <= 64; i = i<<1) { + if(i & g_protocol) { //digit is a 1 + playtone(1100, 30000); + parity = !parity; + } + else { + playtone(1300, 30000); //digit is a 0 + } + } + + //parity bit + if(parity) //odd parity + playtone(1100, 30000); + else //even parity + playtone(1300, 30000); + + // VIS stop + playtone( 1200 , 30000 ) ; + printf( "Done adding VIS header to audio data.\n" ) ; + +} // end addvisheader + +//Builds audio scan data for the Martin series of specifications. +//Applicable to Martin 1 and Martin 2 SSTV modes +//Each pixel is scanned for pixeltime microseconds +void buildaudio_m (double pixeltime) { + uint16_t x , y , k ; + uint32_t pixel ; + uint8_t r[320], g[320], b[320] ; + + printf( "Adding image to audio data.\n" ) ; + + for ( y=0 ; y<256 ; y++ ) { + + // read image data + for ( x=0 ; x<320 ; x++ ) { + pixel = gdImageGetTrueColorPixel( g_imgp, x, y ) ; + //printf( "Got pixel.\n" ) ; + + // get color data + r[x] = gdTrueColorGetRed( pixel ) ; + g[x] = gdTrueColorGetGreen( pixel ) ; + b[x] = gdTrueColorGetBlue( pixel ) ; + } + + // add row markers to audio + // sync + playtone( 1200 , 4862 ) ; + // porch + playtone( 1500 , 572 ) ; + + // each pixel is 457.6us long in Martin 1 + + // add audio for green channel for this row + for ( k=0 ; k<320 ; k++ ) + { playtone( toneval_rgb( g[k] ) , pixeltime ) ; } + + // separator tone + playtone( 1500 , 572 ) ; + + // bloo channel + for ( k=0 ; k<320 ; k++ ) + { playtone( toneval_rgb( b[k] ) , pixeltime ) ; } + + playtone( 1500 , 572 ) ; + + // red channel + for ( k=0 ; k<320 ; k++ ) + { playtone( toneval_rgb( r[k] ) , pixeltime ) ; } + + playtone( 1500 , 572 ) ; + + } // end for y + + printf( "Done adding image to audio data.\n" ) ; + +} // end buildaudio_m + +//Builds audio scan data for the Scottie series of specifications. +//Applicable to Scottie 1, Scottie 2, Scottie SSTV modes +//Each pixel is scanned for pixeltime microseconds +void buildaudio_s (double pixeltime) { + uint16_t x , y , k ; + uint32_t pixel ; + uint8_t r[320], g[320], b[320] ; + + printf( "Adding image to audio data.\n" ) ; + + //add starting sync pulse + playtone( 1200 , 9000); + + for ( y=0 ; y<256 ; y++ ) { + // read image data + for ( x=0 ; x<320 ; x++ ) { + pixel = gdImageGetTrueColorPixel( g_imgp, x, y ) ; + + // get color data + r[x] = gdTrueColorGetRed( pixel ) ; + g[x] = gdTrueColorGetGreen( pixel ) ; + b[x] = gdTrueColorGetBlue( pixel ) ; + } + //seperator pulse + playtone(1500, 1500); + + // add audio for green channel for this row + for ( k=0 ; k<320 ; k++ ) + playtone( toneval_rgb( g[k] ) , pixeltime ) ; + + // separator tone + playtone(1500, 1500) ; + + // blue channel + for ( k=0 ; k<320 ; k++ ) + playtone( toneval_rgb( b[k] ) , pixeltime ) ; + + + //sync pulse + playtone(1200, 9000); + + //sync porch + playtone(1500 , 1500) ; + + // red channel + for ( k=0 ; k<320 ; k++ ) + playtone( toneval_rgb( r[k] ) , pixeltime ) ; + + + } // end for y + + printf( "Done adding image to audio data.\n" ) ; + +} // end buildaudio_s + + +//Builds audio scan data for the Robot 36. +//Applicable to only Robot 36. +void buildaudio_r36 () { + + uint16_t x , y , k ; + uint32_t pixel1, pixel2; + uint8_t r1, g1, b1, r2, g2, b2, avgr, avgg, avgb; + uint8_t y1[320], y2[320], ry[320], by[320]; + + printf( "Adding image to audio data.\n" ) ; + + for ( y=0 ; y<240 ; y+=2 ) { + + // read image data + for ( x=0 ; x<320 ; x++ ) { + + //even line pixel + pixel1 = gdImageGetTrueColorPixel( g_imgp, x, y ) ; + //odd line pixel + pixel2 = gdImageGetTrueColorPixel( g_imgp, x, y+1) ; + + // get color data + r1 = gdTrueColorGetRed( pixel1 ); //first line (even) of red intensities + r2 = gdTrueColorGetRed( pixel2 ); //second line (odd) of red intensities + g1 = gdTrueColorGetGreen( pixel1 ); + g2 = gdTrueColorGetGreen( pixel2 ); + b1 = gdTrueColorGetBlue( pixel1 ); + b2 = gdTrueColorGetBlue( pixel2 ); + + avgr = (uint8_t)( ((uint16_t)r1 + (uint16_t)r2) / 2 ); + + avgg = (uint8_t)( ((uint16_t)g1 + (uint16_t)g2) / 2 ); + + avgb = (uint8_t)( ((uint16_t)b1 + (uint16_t)b2) / 2 ); + + //Y value of even lines + y1[x] = 16.0 + (0.003906 * ((65.738 * (float)r1) + (129.057 * (float)g1) + (25.064 * (float)b1))); + //Y value of odd lines + y2[x] = 16.0 + (0.003906 * ((65.738 * (float)r2) + (129.057 * (float)g2) + (25.064 * (float)b2))); + //R-Y value of the average of the two lines, to be transmitted even scans + ry[x] = 128.0 + (0.003906 * ((112.439 * (float)avgr) + (-94.154 * (float)avgg) + (-18.285 * (float)avgb))); + //B-Y value of the average of the two lines, to be transmitted odd scans + by[x] = 128.0 + (0.003906 * ((-37.945 * (float)avgr) + (-74.494 * (float)avgg) + (112.439 * (float)avgb))); + + } + +//begin robot 36 code +// TIMING SEQUENCE +// (1) Sync pulse 9.0ms 1200hz +// (2) Sync porch 3.0ms 1500hz +// (3) Y scan 88.0ms +// (4) "Even" separator pulse 4.5ms 1500hz +// (5) Porch 1.5ms 1900hz +// (6) R-Y scan 44ms +// (7) Sync pulse 9.0ms 1200hz +// (8) Sync porch 3.0ms 1500hz +// (9) Y scan 88.0ms +// (10) "Odd" separator pulse 4.5ms 2300hz +// (11) Porch 1.5ms 1900hz +// (12) B-Y scan 44ms +// Repeat the sequence above for 240 lines + + //even lines + //sync + playtone( 1200 , 9000 ) ; + //porch + playtone( 1500 , 3000 ) ; + + //y scan, even, 88ms total, 320 points, 275us per pixel + for ( k = 0; k < 320; k++ ) { + playtone( toneval_yuv( y1[k] ) , 275 ) ; + } + + //even line seperator + playtone( 1500 , 4500 ); + //porch + playtone( 1900 , 1500 ); + + //R-Y scan, 44ms total, 320 points, 137.5us per pixel + for ( k = 0; k < 320; k++ ) { + playtone( toneval_yuv( ry[k] ) , 137.5 ); + } + + //odd lines + // sync + playtone( 1200 , 9000 ) ; + // porch + playtone( 1500 , 3000 ) ; + + //y scan, odd, 88ms total, 320 points, 275us per pixel + for ( k = 0; k < 320; k++ ) { + playtone( toneval_yuv( y2[k] ) , 275 ) ; + } + + //odd line seperator + playtone( 2300 , 4500 ); + //porch + playtone( 1900 , 1500 ); + + //B-Y scan, 44ms total, 320 points, 137.5us per pixel + for ( k = 0; k < 320; k++) { + playtone( toneval_yuv( by[k] ) , 137.5); + } + + } // end for y + + printf( "Done adding image to audio data.\n" ) ; + +} // end buildaudio_r36 + +// addvistrailer -- Add tones for VIS trailer to audio stream. +// More calls to playtone(). + +//Builds audio scan data for the PD 120. +//Applicable to only PD 120. +void buildaudio_pd120 () { + + uint16_t x , y , k ; + uint32_t pixel1, pixel2; + uint8_t r1, g1, b1, r2, g2, b2, avgr, avgg, avgb; + uint8_t y1[640], y2[640], ry[640], by[640]; + + printf( "Adding image to audio data.\n" ) ; + + for ( y=0 ; y<496 ; y+=2 ) { + + // read image data + for ( x=0 ; x<640 ; x++ ) { + + //even line pixel + pixel1 = gdImageGetTrueColorPixel( g_imgp, x, y ) ; + //odd line pixel + pixel2 = gdImageGetTrueColorPixel( g_imgp, x, y+1) ; + + // get color data + r1 = gdTrueColorGetRed( pixel1 ); //first line (even) of red intensities + r2 = gdTrueColorGetRed( pixel2 ); //second line (odd) of red intensities + g1 = gdTrueColorGetGreen( pixel1 ); + g2 = gdTrueColorGetGreen( pixel2 ); + b1 = gdTrueColorGetBlue( pixel1 ); + b2 = gdTrueColorGetBlue( pixel2 ); + + avgr = (uint8_t)( ((uint16_t)r1 + (uint16_t)r2) / 2 ); + + avgg = (uint8_t)( ((uint16_t)g1 + (uint16_t)g2) / 2 ); + + avgb = (uint8_t)( ((uint16_t)b1 + (uint16_t)b2) / 2 ); + + //Y value of even lines + y1[x] = 16.0 + (0.003906 * ((65.738 * (float)r1) + (129.057 * (float)g1) + (25.064 * (float)b1))); + //Y value of odd lines + y2[x] = 16.0 + (0.003906 * ((65.738 * (float)r2) + (129.057 * (float)g2) + (25.064 * (float)b2))); + //R-Y value of the average of the two lines, to be transmitted even scans + ry[x] = 128.0 + (0.003906 * ((112.439 * (float)avgr) + (-94.154 * (float)avgg) + (-18.285 * (float)avgb))); + //B-Y value of the average of the two lines, to be transmitted odd scans + by[x] = 128.0 + (0.003906 * ((-37.945 * (float)avgr) + (-74.494 * (float)avgg) + (112.439 * (float)avgb))); + + } +// XXX: Dayton Paper says "odd then even" but "even then odd" is the "de facto standard" +// begin PD 120 code +// TIMING SEQUENCE +// Note: two complete lines are shown. +// (1) Sync pulse 20ms 1200hz +// (2) Porch 2.080ms 1500hz +// (3) Y scan (from even line) +// (4) R-Y scan averaged for two lines +// (5) B-Y averaged for two lines +// (6) Y scan (from odd line) +// Repeat until correct number of lines are transmitted for sub-mode. + + + // (1)sync pulse + playtone( 1200 , 20000 ) ; + //porch + playtone( 1500 , 2080 ) ; + + //(3) y scan, even, 121.6s total, 640 points, 190us per pixel + for ( k = 0; k < 640; k++ ) { + playtone( toneval_yuv( y1[k] ) , 190 ) ; + } + + //(4) R-Y scan, 121.6ms total, 640 points, 190us per pixel + for ( k = 0; k < 640; k++ ) { + playtone( toneval_yuv( ry[k] ) , 190 ); + } + + //(5) B-Y scan, 121.6ms total, 640 points, 190us per pixel + for ( k = 0; k < 640; k++) { + playtone( toneval_yuv( by[k] ) , 190); + } + //(6) y scan, odd, 121.6ms total, 640 points, 190us per pixel + for ( k = 0; k < 640; k++ ) { + playtone( toneval_yuv( y2[k] ) , 190 ) ; + } + } + + printf( "Done adding image to audio data.\n" ) ; + +} // end buildaudio_pd120 + + +void addvistrailer () { + printf( "Adding VIS trailer to audio data.\n" ) ; + + playtone( 2300 , 300000 ) ; + playtone( 1200 , 10000 ) ; + playtone( 2300 , 100000 ) ; + playtone( 1200 , 30000 ) ; + + // bit of silence + playtone( 0 , 500000 ) ; + + printf( "Done adding VIS trailer to audio data.\n" ) ; +} + +// writefile_aiff -- Save audio data to an AIFF file. Playback for +// AIFF format files is tricky. This worked on +// ARM Linux: +// aplay -r 11025 -c 1 -f U16_BE file.aiff +// The WAV output is much easier and more portable, +// but who knows - this code might be useful for +// something. + +#ifdef AUDIO_AIFF +void writefile_aiff () { + uint32_t totalsize , audiosize , i ; + audiosize = 8 + ( 2 * g_samples ) ; // header + 2bytes/samp + totalsize = 4 + 8 + 18 + 8 + audiosize ; + + printf( "Writing audio data to file.\n" ) ; + printf( "Got a total of [%d] samples.\n" , g_samples ) ; + + // "form" chunk + fputs( "FORM" , g_outfp ) ; + fputc( (totalsize & 0xff000000) >> 24 , g_outfp ) ; + fputc( (totalsize & 0x00ff0000) >> 16 , g_outfp ) ; + fputc( (totalsize & 0x0000ff00) >> 8 , g_outfp ) ; + fputc( (totalsize & 0x000000ff) , g_outfp ) ; + fputs( "AIFF" , g_outfp ) ; + + // "common" chunk + fputs( "COMM" , g_outfp ) ; + fputc( 0 , g_outfp ) ; // size + fputc( 0 , g_outfp ) ; + fputc( 0 , g_outfp ) ; + fputc( 18 , g_outfp ) ; + fputc( 0 , g_outfp ) ; // channels = 1 + fputc( 1 , g_outfp ) ; + fputc( (g_samples & 0xff000000) >> 24 , g_outfp ) ; // size + fputc( (g_samples & 0x00ff0000) >> 16 , g_outfp ) ; + fputc( (g_samples & 0x0000ff00) >> 8 , g_outfp ) ; + fputc( (g_samples & 0x000000ff) , g_outfp ) ; + fputc( 0 , g_outfp ) ; // bits/sample + fputc( 16 , g_outfp ) ; + fputc( 0x40 , g_outfp ) ; // 10 byte sample rate (??) + fputc( 0x0c , g_outfp ) ; // <--- 11025 + fputc( 0xac , g_outfp ) ; + fputc( 0x44 , g_outfp ) ; + fputc( 0 , g_outfp ) ; + fputc( 0 , g_outfp ) ; + fputc( 0 , g_outfp ) ; + fputc( 0 , g_outfp ) ; + fputc( 0 , g_outfp ) ; + fputc( 0 , g_outfp ) ; + + // audio data chunk + fputs( "SSND" , g_outfp ) ; + fputc( (audiosize & 0xff000000) >> 24 , g_outfp ) ; + fputc( (audiosize & 0x00ff0000) >> 16 , g_outfp ) ; + fputc( (audiosize & 0x0000ff00) >> 8 , g_outfp ) ; + fputc( (audiosize & 0x000000ff) , g_outfp ) ; + fputc( 0 , g_outfp ) ; + fputc( 0 , g_outfp ) ; + fputc( 0 , g_outfp ) ; + fputc( 0 , g_outfp ) ; + fputc( 0 , g_outfp ) ; + fputc( 0 , g_outfp ) ; + fputc( 0 , g_outfp ) ; + fputc( 0 , g_outfp ) ; + + // FINALLY, the audio data itself + for ( i=0 ; i<=g_samples ; i++ ) + { + fputc( ( g_audio[i] & 0xff00 ) >> 8 , g_outfp ) ; + fputc( ( g_audio[i] & 0x00ff ) , g_outfp ) ; + } + + printf( "Done writing to audio file.\n" ) ; +} +#endif + +// writefile_wav -- Write audio data to a WAV file. Once the file +// is written, any audio player in the world ought +// to be able to play the file without any funky +// command-line params. + +#ifdef AUDIO_WAV +void writefile_wav () { + uint32_t totalsize , audiosize , byterate , blockalign ; + uint32_t i ; + + audiosize = g_samples * CHANS * (BITS / 8) ; // bytes of audio + totalsize = 4 + (8 + 16) + (8 + audiosize) ; // audio + some headers + byterate = g_rate * CHANS * BITS / 8 ; // audio bytes / sec + blockalign = CHANS * BITS / 8 ; // total bytes / sample + + printf( "Writing audio data to file.\n" ) ; + printf( "Got a total of [%d] samples.\n" , g_samples ) ; + + // RIFF header + fputs( "RIFF" , g_outfp ) ; + + // total size, audio plus some headers (LE!!) + fputc( (totalsize & 0x000000ff) , g_outfp ) ; + fputc( (totalsize & 0x0000ff00) >> 8 , g_outfp ) ; + fputc( (totalsize & 0x00ff0000) >> 16 , g_outfp ) ; + fputc( (totalsize & 0xff000000) >> 24 , g_outfp ) ; + fputs( "WAVE" , g_outfp ) ; + + // sub chunk 1 (format spec) + + fputs( "fmt " , g_outfp ) ; // with a space! + + fputc( 16 , g_outfp ) ; // size of chunk (LE!!) + fputc( 0 , g_outfp ) ; + fputc( 0 , g_outfp ) ; + fputc( 0 , g_outfp ) ; + + fputc( 1 , g_outfp ) ; // format = 1 (PCM) (LE) + fputc( 0 , g_outfp ) ; + + fputc( 1 , g_outfp ) ; // channels = 1 (LE) + fputc( 0 , g_outfp ) ; + + // samples / channel / sec (LE!!) + fputc( (g_rate & 0x000000ff) , g_outfp ) ; + fputc( (g_rate & 0x0000ff00) >> 8 , g_outfp ) ; + fputc( (g_rate & 0x00ff0000) >> 16 , g_outfp ) ; + fputc( (g_rate & 0xff000000) >> 24 , g_outfp ) ; + + // bytes total / sec (LE!!) + fputc( (byterate & 0x000000ff) , g_outfp ) ; + fputc( (byterate & 0x0000ff00) >> 8 , g_outfp ) ; + fputc( (byterate & 0x00ff0000) >> 16 , g_outfp ) ; + fputc( (byterate & 0xff000000) >> 24 , g_outfp ) ; + + // block alignment (LE!!) + fputc( (blockalign & 0x00ff) , g_outfp ) ; + fputc( (blockalign & 0xff00) >> 8 , g_outfp ) ; + + fputc( (BITS & 0x00ff) , g_outfp ) ; // bits/sample (LE) + fputc( (BITS & 0xff00) >> 8 , g_outfp ) ; + + // sub chunk 2 + // header + fputs( "data" , g_outfp ) ; + + // audio bytes total (LE!!) + fputc( (audiosize & 0x000000ff) , g_outfp ) ; + fputc( (audiosize & 0x0000ff00) >> 8 , g_outfp ) ; + fputc( (audiosize & 0x00ff0000) >> 16 , g_outfp ) ; + fputc( (audiosize & 0xff000000) >> 24 , g_outfp ) ; + + // FINALLY, the audio data itself (LE!!) + for ( i=0 ; i<=g_samples ; i++ ) { + fputc( ( g_audio[i] & 0x00ff ) , g_outfp ) ; + fputc( ( g_audio[i] & 0xff00 ) >> 8 , g_outfp ) ; + } + + // no trailer + printf( "Done writing to audio file.\n" ) ; +} +#endif + + +// end diff --git a/firmware/ori/package/lamableu-apps/pow_pluto.c b/firmware/ori/package/lamableu-apps/pow_pluto.c new file mode 100644 index 0000000..dabd30d --- /dev/null +++ b/firmware/ori/package/lamableu-apps/pow_pluto.c @@ -0,0 +1,467 @@ +/* + * Fork LamaBleu - 04/2019 + * + * Adapted from : power - AD9361 IIO streaming example which calculates channel power from DDS + * + * Copyright (C) 2014 IABG mbH + * Author: Michael Feilen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + **/ + +#include +#include +#include +#include +#include +#include +#include +#ifdef __APPLE__ +#include +#else +#include +#endif +#define SAMPLES (1024*1024) +#include +#define MY_NAME "pow_pluto" + +#ifdef _WIN32 +#define snprintf sprintf_s +#endif + +static const struct option options[] = { + {"help", no_argument, 0, 'h'}, + {"gain", required_argument, 0, 'g'}, + {"lo", required_argument, 0, 'l'}, + {"fs", required_argument, 0, 'f'}, + {0, 0, 0, 0}, +}; + +static const char *options_descriptions[] = { + "Show this help and quit.", + "Set RX gain in dB.", + "Set LO frequency in Hz.", + "Set sampling frequency in MHz.", +}; + +static void usage(void) +{ + unsigned int i; + + printf("Usage:\n\t" MY_NAME " -g 10 -l 434000000 -f 20\n\t" + "\nMeasure power at a specific frequency \n" + "Result: Freq(Hz), Power(dB), RSSI (gathered through IIO)\n" + "Options:\n"); + for (i = 0; options[i].name; i++) + printf("\t-%c, --%s\t\t%s\n", + options[i].val, options[i].name, + options_descriptions[i]); +} + + +/* helper macros */ +#define MHZ(x) ((long long)(x*1000000.0 + .5)) +#define GHZ(x) ((long long)(x*1000000000.0 + .5)) +#define HZ(x) ((long long)(x*1.0 + .5)) + +#define ASSERT(expr) { \ + if (!(expr)) { \ + (void) fprintf(stderr, "assertion failed (%s:%d)\n", __FILE__, __LINE__); \ + (void) abort(); \ + } \ +} + +/* RX is input, TX is output */ +enum iodev { RX, TX }; + +/* common RX and TX streaming params */ +struct stream_cfg { + long long bw_hz; // Analog banwidth in Hz + long long fs_hz; // Baseband sample rate in Hz + long long lo_hz; // Local oscillator frequency in Hz + const char* rfport; // Port name +}; + +/* static scratch mem for strings */ +static char tmpstr[64]; + +/* IIO structs required for streaming */ +static struct iio_context *ctx = NULL; +static struct iio_channel *rx0_i = NULL; +static struct iio_channel *rx0_q = NULL; +static struct iio_buffer *rxbuf = NULL; + + +static bool stop; + +/* cleanup and exit */ +static void shutdown() +{ +// printf("* Destroying buffers\n"); + if (rxbuf) { + iio_buffer_destroy(rxbuf); + } + +// printf("* Disabling streaming channels\n"); + if (rx0_i) { + iio_channel_disable(rx0_i); + } + if (rx0_q) { + iio_channel_disable(rx0_q); + } + + +// printf("* Destroying context\n"); + if (ctx) { + iio_context_destroy(ctx); + } + exit(0); +} + +static void handle_sig(int sig) +{ + printf("Waiting for process to finish...\n"); + stop = true; +} + +/* check return value of attr_write function */ +static void errchk(int v, const char* what) +{ + if (v < 0) { + fprintf(stderr, + "Error %d writing to channel \"%s\"\nvalue may not be supported.\n", v, what); + shutdown(); + } +} + +/* write attribute: long long int */ +static void wr_ch_lli(struct iio_channel *chn, const char* what, long long val) +{ + errchk(iio_channel_attr_write_longlong(chn, what, val), what); +} + +/* write attribute: string */ +static void wr_ch_str(struct iio_channel *chn, const char* what, + const char* str) +{ + errchk(iio_channel_attr_write(chn, what, str), what); +} + +/* helper function generating channel names */ +static char* get_ch_name(const char* type, int id) +{ + snprintf(tmpstr, sizeof(tmpstr), "%s%d", type, id); + return tmpstr; +} + +/* returns ad9361 phy device */ +static struct iio_device* get_ad9361_phy(struct iio_context *ctx) +{ + struct iio_device *dev = iio_context_find_device(ctx, "ad9361-phy"); + ASSERT(dev && "No ad9361-phy found"); + return dev; +} + +/* finds AD9361 streaming IIO devices */ +static bool get_ad9361_stream_dev(struct iio_context *ctx, enum iodev d, + struct iio_device **dev) +{ + switch (d) { + case RX: + *dev = iio_context_find_device(ctx, "cf-ad9361-lpc"); + return *dev != NULL; + default: + ASSERT(0); + return false; + } +} +/* finds AD9361 streaming IIO channels */ +static bool get_ad9361_stream_ch(struct iio_context *ctx, enum iodev d, + struct iio_device *dev, int chid, struct iio_channel **chn) +{ + *chn = iio_device_find_channel(dev, get_ch_name("voltage", chid), d == TX); + if (!*chn) + *chn = iio_device_find_channel(dev, get_ch_name("altvoltage", chid), d == TX); + return *chn != NULL; +} + + +/* finds AD9361 phy IIO configuration channel with id chid */ +static bool get_phy_chan(struct iio_context *ctx, enum iodev d, int chid, + struct iio_channel **chn) +{ + switch (d) { + case RX: + *chn = iio_device_find_channel(get_ad9361_phy(ctx), get_ch_name("voltage", + chid), false); + return *chn != NULL; + default: + ASSERT(0); + return false; + } +} + +/* finds AD9361 local oscillator IIO configuration channels */ +static bool get_lo_chan(struct iio_context *ctx, enum iodev d, + struct iio_channel **chn) +{ + switch (d) { + // LO chan is always output, i.e. true + case RX: + *chn = iio_device_find_channel(get_ad9361_phy(ctx), get_ch_name("altvoltage", + 0), true); + return *chn != NULL; + default: + ASSERT(0); + return false; + } +} + +/* applies streaming configuration through IIO */ +bool cfg_ad9361_streaming_ch(struct iio_context *ctx, struct stream_cfg *cfg, + enum iodev type, int chid) +{ + struct iio_channel *chn = NULL; + + // Configure phy and lo channels + // printf("* Acquiring AD9361 phy channel %d\n", chid); + if (!get_phy_chan(ctx, type, chid, &chn)) { + return false; + } + wr_ch_str(chn, "rf_port_select", cfg->rfport); + wr_ch_lli(chn, "rf_bandwidth", cfg->bw_hz); + wr_ch_lli(chn, "sampling_frequency", cfg->fs_hz); + + // Configure LO channel + // printf("* Acquiring AD9361 %s lo channel\n", type == TX ? "TX" : "RX"); + if (!get_lo_chan(ctx, type, &chn)) { + return false; + } + wr_ch_lli(chn, "frequency", cfg->lo_hz); + return true; +} + +double channel_power(int16_t *i, int16_t *q) +{ + // Calculate the squared RMS of signal + double a,b,c,d,sum = 0; + for (int k=0; k 1) { + printf("More than one Pluto found:\n"); + + for (unsigned int i = 0; i < (size_t) ret; i++) { + printf("\t%d: %s [%s]\n", i, + iio_context_info_get_description(info[i]), + iio_context_info_get_uri(info[i])); + } + + printf("We will use the first one.\n"); + } + + const char* uri = iio_context_info_get_uri(info[0]); + // iio_context_info_list_free(info); + iio_scan_context_destroy(sctx); + + ASSERT((ctx = iio_create_context_from_uri(uri)) && "No context"); + ASSERT(iio_context_get_devices_count(ctx) > 0 && "No devices"); + + // printf("* Acquiring AD9361 streaming devices\n"); + ASSERT(get_ad9361_stream_dev(ctx, RX, &rx) && "No rx dev found"); + + // printf("* Configuring AD9361 for streaming\n"); + ASSERT(cfg_ad9361_streaming_ch(ctx, &rxcfg, RX, 0) && "RX port 0 not found"); + + // printf("* Initializing AD9361 IIO streaming channels\n"); + ASSERT(get_ad9361_stream_ch(ctx, RX, rx, 0, &rx0_i) && "RX chan i not found"); + ASSERT(get_ad9361_stream_ch(ctx, RX, rx, 1, &rx0_q) && "RX chan q not found"); + + // printf("* Enabling IIO streaming channels\n"); + iio_channel_enable(rx0_i); + iio_channel_enable(rx0_q); + + + // printf("* Creating non-cyclic IIO buffers\n"); + rxbuf = iio_device_create_buffer(rx, SAMPLES, false); + if (!rxbuf) { + perror("Could not create RX buffer"); + shutdown(); + } + +// printf("* Setting manual gains to: %d dB (RX)\n", rxgain); + struct iio_device *phy = iio_context_find_device(ctx, "ad9361-phy"); + ret = iio_channel_attr_write(iio_device_find_channel(phy, "voltage0", false), + "gain_control_mode", "manual"); + if (ret < 0) { + fprintf(stderr, "Failed to set AGC to manual mode: %d\n", ret); + shutdown(); + } + ret = iio_channel_attr_write_longlong(iio_device_find_channel(phy, "voltage0", + false), "hardwaregain", rxgain); + if (ret < 0) { + fprintf(stderr, "Failed to set RX gain: %d\n", ret); + shutdown(); + } + + + int16_t real_data[SAMPLES]; + int16_t imag_data[SAMPLES]; + double mean_channel_power = 0.0; + +// printf("* Starting IO streaming (press CTRL+C to cancel)\n"); +int ctr = 0; +// ctr increase = more samples = slower +while (ctr < 2) { +// while (!stop) { + ssize_t nbytes_rx; + char *p_dat, *p_end; + ptrdiff_t p_inc; + + // Refill RX buffer + nbytes_rx = iio_buffer_refill(rxbuf); + if (nbytes_rx < 0) { + printf("Error refilling buf %d\n",(int) nbytes_rx); + shutdown(); + } + usleep(2000); + // READ: Get pointers to RX buf and read IQ from RX buf port 0 + p_inc = iio_buffer_step(rxbuf); + p_end = iio_buffer_end(rxbuf); + int index = 0; + for (p_dat = (char *)iio_buffer_first(rxbuf, rx0_i); p_dat < p_end; + p_dat += p_inc) { + // Example: swap I and Q + real_data[index] = ((int16_t*)p_dat)[0]; // Real (I) + imag_data[index] = ((int16_t*)p_dat)[1]; // Imag (Q) + index++; + } + mean_channel_power = (mean_channel_power + channel_power(real_data, + imag_data))/2; + + + + // Read RSSI + usleep(2000); + iio_channel_attr_read( + iio_device_find_channel( + iio_context_find_device(ctx, "ad9361-phy"), + "voltage0", false), + "rssi", buf, sizeof(buf)); + rssi = atof(buf); + // printf("RSSI: %s \n", buf); + // printf("Power %8.4f dB - RSSI: %s\n", log10(channel_power(real_data,imag_data))*20, buf); + + + // Sample counter increment and status output + nrx += nbytes_rx / iio_device_get_sample_size(rx); + + + ctr=ctr+1; + } +// printf("Freq %lli | Power %8.4f dB (Average)| Samples processed %8.2f MSmp\n", +// rxcfg.lo_hz, log10(mean_channel_power)*20, nrx/1e6); + printf("%lld %.2f %.2f",rxcfg.lo_hz, log10(mean_channel_power)*20, rssi); + printf("\n"); + iio_context_info_list_free(info); + shutdown(); + + return 0; +} diff --git a/firmware/ori/package/lamableu-apps/readme.txt b/firmware/ori/package/lamableu-apps/readme.txt new file mode 100644 index 0000000..d6f7c7a --- /dev/null +++ b/firmware/ori/package/lamableu-apps/readme.txt @@ -0,0 +1 @@ +CONFIG_FEATURE_DATE_NANO=y \ No newline at end of file diff --git a/firmware/ori/package/lamableu-apps/timems.c b/firmware/ori/package/lamableu-apps/timems.c new file mode 100644 index 0000000..cab2a97 --- /dev/null +++ b/firmware/ori/package/lamableu-apps/timems.c @@ -0,0 +1,14 @@ +#include +#include +void main (void){ + long ms; + time_t s; + + struct timespec spec; + clock_gettime(CLOCK_REALTIME, &spec); + s = spec.tv_sec; + ms = (spec.tv_nsec / 1.0e6); + printf("%d.%03d\n", s, ms); +return 0; +} + diff --git a/firmware/ori/package/libdvbmod/Config.in b/firmware/ori/package/libdvbmod/Config.in new file mode 100644 index 0000000..79b6cb0 --- /dev/null +++ b/firmware/ori/package/libdvbmod/Config.in @@ -0,0 +1,6 @@ +config BR2_PACKAGE_LIBDVBMOD + bool "libdvbmod" + help + A simple library to get I/Q symbols from a MPEG Transport stream + + https://github.com/F5OEO/libdvbmod diff --git a/firmware/ori/package/libdvbmod/libdvbmod.mk b/firmware/ori/package/libdvbmod/libdvbmod.mk new file mode 100644 index 0000000..a320b75 --- /dev/null +++ b/firmware/ori/package/libdvbmod/libdvbmod.mk @@ -0,0 +1,30 @@ +################################################################################ +# +# LIBDVBMOD +# +################################################################################ + +#LIBDVBMOD_VERSION = 2.2.5 +#LIBDVBMOD_SITE = /home/eric/libdvbmod/libdvbmod +LIBDVBMOD_SITE = /ext/Eric/old_linux/libdvbmod +#LIBDVBMOD_SOURCE = /home/eric/plutosdr-fw/buildroot/dl/libdvbmod.tar.gz +#LIBDVBMOD_INSTALL_STAGING = YES +#LIBDVBMOD_AUTORECONF = YES +LIBDVBMOD_SITE_METHOD = local + + +define LIBDVBMOD_BUILD_CMDS + $(MAKE) $(CC)="$(TARGET_CXX)" LD="$(TARGET_LD)" -C $(@D)/libdvbmod + $(MAKE) $(CC)="$(TARGET_CXX)" LD="$(TARGET_LD)" -C $(@D)/DvbTsToIQ + +endef +# $(MAKE) CC="$(TARGET_CC)" +#define LIBDVBMOD_INSTALL_TARGET_CMDS +# $(INSTALL) -D -m 0755 $(@D)/hello $(TARGET_DIR)/usr/bin +#endef + +#$(eval $(generic-package)) + +#$(eval $(autotools-package)) +$(eval $(generic-package)) + diff --git a/firmware/ori/package/libfec/Config.in b/firmware/ori/package/libfec/Config.in new file mode 100644 index 0000000..8349d23 --- /dev/null +++ b/firmware/ori/package/libfec/Config.in @@ -0,0 +1,7 @@ +config BR2_PACKAGE_LIBFEC + bool "libfec" + select host-libfec + help + This package provides a set of functions that implement several popular forward error correction (FEC) algorithms and several low-level routines useful in modems implemented with digital signal processing (DSP). + + https://github.com/quiet/libfec diff --git a/firmware/ori/package/libfec/Config.in.host b/firmware/ori/package/libfec/Config.in.host new file mode 100644 index 0000000..ccf6dc9 --- /dev/null +++ b/firmware/ori/package/libfec/Config.in.host @@ -0,0 +1,6 @@ +config BR2_PACKAGE_HOST_LIBFEC + bool "host-libfec" + help + This package provides a set of functions that implement several popular forward error correction (FEC) algorithms and several low-level routines useful in modems implemented with digital signal processing (DSP). + + https://github.com/quiet/libfec diff --git a/firmware/ori/package/libfec/libfec.mk b/firmware/ori/package/libfec/libfec.mk new file mode 100644 index 0000000..3eb6838 --- /dev/null +++ b/firmware/ori/package/libfec/libfec.mk @@ -0,0 +1,17 @@ +LIBFEC_VERSION := 9750ca0 +LIBFEC_SITE := https://github.com/quiet/libfec +LIBFEC_SITE_METHOD := git +LIBFEC_DEPENDENCIES += host-libfec +LIBFEC_INSTALL_STAGING := YES +LIBFEC_INSTALL_TARGET := YES + +define HOST_LIBFEC_INSTALL_CMDS + $(INSTALL) -D -m 0755 $(@D)/{gen_ccsds,gen_ccsds_tal} $(HOST_DIR)/bin/ +endef + +define LIBFEC_INSTALL_STAGING_CMDS + $(INSTALL) -D -m 0644 $(@D)/*.so* $(STAGING_DIR)/usr/lib/ +endef + +$(eval $(cmake-package)) +$(eval $(host-cmake-package)) diff --git a/firmware/ori/package/libgse/Config.in b/firmware/ori/package/libgse/Config.in new file mode 100644 index 0000000..a03ab12 --- /dev/null +++ b/firmware/ori/package/libgse/Config.in @@ -0,0 +1,6 @@ +config BR2_PACKAGE_LIBGSE + bool "libgse" + help + LibGSE. + + https://github.com/CNES/libgse diff --git a/firmware/ori/package/libgse/libgse.mk b/firmware/ori/package/libgse/libgse.mk new file mode 100644 index 0000000..099cff2 --- /dev/null +++ b/firmware/ori/package/libgse/libgse.mk @@ -0,0 +1,13 @@ +################################################################################ +# +# libgse +# +################################################################################ + +LIBGSE_VERSION = master +LIBGSE_SITE = $(call github,F5OEO,libgse,$(LIBGSE_VERSION)) +LIBGSE_INSTALL_STAGING = YES +LIBGSE_AUTORECONF = YES +LIBGSE_DEPENDENCIES += libpcap + +$(eval $(autotools-package)) \ No newline at end of file diff --git a/firmware/ori/package/libosmoplutosdr/Config.in b/firmware/ori/package/libosmoplutosdr/Config.in new file mode 100644 index 0000000..b7d8ec8 --- /dev/null +++ b/firmware/ori/package/libosmoplutosdr/Config.in @@ -0,0 +1,6 @@ +config BR2_PACKAGE_LIBOSMOPLUTOSDR + bool "libosmoplutosdr" + help + lib for the experimental plutosdr kernel module + + https://github.com/Hoernchen/libosmoplutosdr diff --git a/firmware/ori/package/libosmoplutosdr/libosmoplutosdr.mk b/firmware/ori/package/libosmoplutosdr/libosmoplutosdr.mk new file mode 100644 index 0000000..cb0e118 --- /dev/null +++ b/firmware/ori/package/libosmoplutosdr/libosmoplutosdr.mk @@ -0,0 +1,6 @@ +LIBOSMOPLUTOSDR_VERSION := c78c8e6 +LIBOSMOPLUTOSDR_SITE := https://github.com/Hoernchen/libosmoplutosdr.git +LIBOSMOPLUTOSDR_SITE_METHOD := git +LIBOSMOPLUTOSDR_INSTALL_TARGET := YES + +$(eval $(cmake-package)) diff --git a/firmware/ori/package/libssp/Config.in b/firmware/ori/package/libssp/Config.in new file mode 100644 index 0000000..748db9f --- /dev/null +++ b/firmware/ori/package/libssp/Config.in @@ -0,0 +1,6 @@ +config BR2_PACKAGE_LIBSSP + bool "libssp" + help + Libssp. + + https://www.openmamba.org/pub/openmamba/devel/RPMS.arm/libssp-8.2.0-1mamba.arm.rpm diff --git a/firmware/ori/package/libssp/libssp.hash b/firmware/ori/package/libssp/libssp.hash new file mode 100644 index 0000000..5d79ab0 --- /dev/null +++ b/firmware/ori/package/libssp/libssp.hash @@ -0,0 +1,4 @@ +sha256 9ee4ae8c890d64870d2c84efdbe0058db202cf217a4537d27f3284e856b904ff libssp.tar.bz2 +md5 ed980a3c557233608298d2adbe45cd23 libssp.tar.bz2 + + diff --git a/firmware/ori/package/libssp/libssp.mk b/firmware/ori/package/libssp/libssp.mk new file mode 100644 index 0000000..799b0ee --- /dev/null +++ b/firmware/ori/package/libssp/libssp.mk @@ -0,0 +1,15 @@ +################################################################################ +# +# libssp +# +################################################################################ + +#LIBSSP_VERSION = 2.2.5 +LIBSSP_SITE = file:///plutosdr-fw/buildroot/dl +LIBSSP_SOURCE = libssp.tar.bz2 +#LIBSSP_INSTALL_STAGING = YES +LIBSSP_AUTORECONF = YES + +$(eval $(autotools-package)) +#$(eval $(generic-package)) + diff --git a/firmware/ori/package/libtuntap/0001-fix-dirs-for-cross-compile.patch b/firmware/ori/package/libtuntap/0001-fix-dirs-for-cross-compile.patch new file mode 100644 index 0000000..fc5b6f1 --- /dev/null +++ b/firmware/ori/package/libtuntap/0001-fix-dirs-for-cross-compile.patch @@ -0,0 +1,54 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 712443f..a65212a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -19,7 +19,6 @@ endif() + # ------------------- + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) +-set(CMAKE_INSTALL_PREFIX "/usr/local/") + set(${CMAKE_SYSTEM_NAME} True) + + # Global CPP definitions +@@ -36,18 +35,10 @@ set(SOURCES_LIST + # OS families specific things + # --------------------------- + if(UNIX) +- # Unix specific include directories +- # --------------------------------- +- include_directories( +- "${CMAKE_CURRENT_SOURCE_DIR}" +- /usr/include/ +- /usr/local/include +- ) +- + # Unix specific definitions + # ------------------------- + add_definitions(-DUnix) +- ++ + # Unix specific source files + # -------------------------- + set(SOURCES_LIST ${SOURCES_LIST} tuntap-unix.c ) +@@ -57,7 +48,7 @@ if(Windows) + # Windows specific definitions + # ---------------------------- + add_definitions(-DWindows) +- ++ + # Windows specific source files + # ----------------------------- + set(SOURCES_LIST ${SOURCES_LIST} tuntap-windows.c ) +@@ -67,7 +58,6 @@ endif(Windows) + # ------------------ + if(UNIX) + if(Linux) +- set(CMAKE_INSTALL_PREFIX "/usr/") + add_definitions(-D_GNU_SOURCE) + set(SOURCES_LIST ${SOURCES_LIST} tuntap-unix-linux.c) + elseif (OpenBSD) +@@ -133,4 +123,3 @@ include(CMakeLists.txt.local OPTIONAL) + if (ENABLE_REGRESS) + include(regress/CMakeLists.txt) + endif (ENABLE_REGRESS) +- diff --git a/firmware/ori/package/libtuntap/Config.in b/firmware/ori/package/libtuntap/Config.in new file mode 100644 index 0000000..2957386 --- /dev/null +++ b/firmware/ori/package/libtuntap/Config.in @@ -0,0 +1,6 @@ +config BR2_PACKAGE_LIBTUNTAP + bool "libtuntap" + help + The portable Tun/Tap devices configuration utility + + https://github.com/LaKabane/libtuntap diff --git a/firmware/ori/package/libtuntap/libtuntap.mk b/firmware/ori/package/libtuntap/libtuntap.mk new file mode 100644 index 0000000..c1cad0c --- /dev/null +++ b/firmware/ori/package/libtuntap/libtuntap.mk @@ -0,0 +1,12 @@ +LIBTUNTAP_VERSION := bf8e0fe +LIBTUNTAP_SITE := https://github.com/tvelliott/libtuntap.git +LIBTUNTAP_SITE_METHOD := git +LIBTUNTAP_INSTALL_STAGING := YES +LIBTUNTAP_INSTALL_TARGET := YES + +define LIBTUNTAP_INSTALL_STAGING_CMDS + $(INSTALL) -D -m 0644 $(@D)/*.h $(STAGING_DIR)/usr/include/ + $(INSTALL) -D -m 0644 $(@D)/lib/* $(STAGING_DIR)/usr/lib/ +endef + +$(eval $(cmake-package)) diff --git a/firmware/ori/package/luaradio-basic/Config.in b/firmware/ori/package/luaradio-basic/Config.in new file mode 100644 index 0000000..ea9e63d --- /dev/null +++ b/firmware/ori/package/luaradio-basic/Config.in @@ -0,0 +1,11 @@ +config BR2_PACKAGE_LUARADIO_BASIC + bool "luaradio-basic" + select BR2_PACKAGE_LUAJIT + + help + A lightweight, embeddable software-defined radio framework built on LuaJIT + + + http://luaradio.io + + diff --git a/firmware/ori/package/luaradio-basic/Makefile b/firmware/ori/package/luaradio-basic/Makefile new file mode 100644 index 0000000..cbdd1ae --- /dev/null +++ b/firmware/ori/package/luaradio-basic/Makefile @@ -0,0 +1,176 @@ +SRC_DIR = .. +EXAMPLE_DIR = examples +TEST_DIR = tests +BUILD_DIR = build +GEN_DIR = $(BUILD_DIR)/gen +PKG_CONFIG_PATH=/home/eric/pluto032/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/pkgconfig +CC=/home/eric/pluto032/buildroot/output/host/bin/arm-buildroot-linux-gnueabihf-cc +################################################################################ + +LIBNAME = luaradio +LIB_SRCS = luaradio.c +LUA_SRCS = $(shell find $(SRC_DIR)/radio -type f -name "*.lua") + +EXAMPLE_SRCS = $(EXAMPLE_DIR)/fm-radio.c $(EXAMPLE_DIR)/rds-timesync.c +TEST_SRCS = $(TEST_DIR)/test_api.c + +################################################################################ + +ifneq ($(shell uname -s),Darwin) +SHARED_LIB = $(BUILD_DIR)/lib$(LIBNAME).so +else +SHARED_LIB = $(BUILD_DIR)/lib$(LIBNAME).dylib +endif + +STATIC_LIB = $(BUILD_DIR)/lib$(LIBNAME).a + +LUA_C_SRCS := $(patsubst $(SRC_DIR)/%.lua, $(GEN_DIR)/%.c, $(LUA_SRCS)) +LIB_OBJS := $(patsubst $(GEN_DIR)/%.c, $(BUILD_DIR)/%.o, $(LUA_C_SRCS)) $(patsubst %.c, $(BUILD_DIR)/%.o, $(LIB_SRCS)) + +EXAMPLE_BINS = $(patsubst $(EXAMPLE_DIR)/%.c, $(BUILD_DIR)/$(EXAMPLE_DIR)/%, $(EXAMPLE_SRCS)) +TEST_BINS = $(patsubst $(TEST_DIR)/%.c, $(BUILD_DIR)/$(TEST_DIR)/%, $(TEST_SRCS)) + +################################################################################ + +ifneq ($(shell pkg-config luajit 2>/dev/null; echo $$?), 0) +$(error "LuaJIT library not found with pkg-config") +endif + +ifneq ($(shell which luajit 2>/dev/null),) +LUAJIT ?= luajit +else +LUAJIT ?= luajit-$(shell pkg-config --modversion luajit) +endif + +ifneq ($(shell $(LUAJIT) -v 1>/dev/null 2>/dev/null; echo $$?), 0) +$(error "LuaJIT executable not found") +endif + +INSTALL_CMOD = $(shell pkg-config luajit --variable INSTALL_CMOD) + +PREFIX ?= /usr/local + +################################################################################ + +OPT = -O3 +DEBUG = + +VERSION_MAJOR := $(shell cd ../; $(LUAJIT) -e "package.path = './?/init.lua;' .. package.path; print(require('radio').version_info.major)" 2>/dev/null) +VERSION_MINOR := $(shell cd ../; $(LUAJIT) -e "package.path = './?/init.lua;' .. package.path; print(require('radio').version_info.minor)" 2>/dev/null) +VERSION_PATCH := $(shell cd ../; $(LUAJIT) -e "package.path = './?/init.lua;' .. package.path; print(require('radio').version_info.patch)" 2>/dev/null) +VERSION_COMMIT := $(shell git describe --abbrev --always --tags --dirty 2>/dev/null || echo "") + +CFLAGS = -std=c99 -D_DEFAULT_SOURCE +CFLAGS += $(shell pkg-config --cflags luajit) +CFLAGS += -fPIC +CFLAGS += $(OPT) $(DEBUG) $(INCLUDES) +CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_PATCH=$(VERSION_PATCH) +CFLAGS += -DVERSION_COMMIT=\"$(VERSION_COMMIT)\" +CFLAGS += -Wall -Wextra -Wcast-align -Wcast-qual -Wimplicit +CFLAGS += -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type +CFLAGS += -Wshadow -Wunused -Wno-unused-parameter + +LIBFLAGS = $(shell pkg-config --libs luajit) + +ifneq ($(shell uname -s),Darwin) +LDFLAGS = -Wl,-E +EXTRA_LDFLAGS = +else +LDFLAGS = +EXTRA_LDFLAGS = -pagezero_size 10000 -image_base 100000000 +endif + +################################################################################ + +.PHONY: all +all: lib tests examples + +.PHONY: lib +lib: $(SHARED_LIB) $(STATIC_LIB) + +.PHONY: examples +examples: $(SHARED_LIB) $(EXAMPLE_BINS) + +.PHONY: tests +tests: $(SHARED_LIB) $(TEST_BINS) + +.PHONY: runtests +runtests: $(TEST_BINS) + for f in $(TEST_BINS); do \ + LD_LIBRARY_PATH=$(BUILD_DIR) DYLD_LIBRARY_PATH=$(BUILD_DIR) ./$$f; \ + done + +ifneq ($(shell uname -s),Darwin) +.PHONY: install +install: $(STATIC_LIB) $(SHARED_LIB) + install -d $(DESTDIR)$(PREFIX)/lib + install -m755 $(STATIC_LIB) $(DESTDIR)$(PREFIX)/lib/lib$(LIBNAME).a + install -m755 $(SHARED_LIB) $(DESTDIR)$(PREFIX)/lib/lib$(LIBNAME).so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) + ln -sf lib$(LIBNAME).so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) $(DESTDIR)$(PREFIX)/lib/lib$(LIBNAME).so.$(VERSION_MAJOR) + ln -sf lib$(LIBNAME).so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) $(DESTDIR)$(PREFIX)/lib/lib$(LIBNAME).so + install -d $(DESTDIR)$(PREFIX)/include + install -m644 luaradio.h $(DESTDIR)$(PREFIX)/include/luaradio.h + install -d $(DESTDIR)$(INSTALL_CMOD) + ln -sf $(PREFIX)/lib/lib$(LIBNAME).so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) $(DESTDIR)$(INSTALL_CMOD)/radio.so + install -d $(DESTDIR)$(PREFIX)/bin + install -m755 ../luaradio $(DESTDIR)$(PREFIX)/bin/luaradio + install -d $(DESTDIR)$(PREFIX)/share/licenses/luaradio + install -m644 ../LICENSE $(DESTDIR)$(PREFIX)/share/licenses/luaradio/LICENSE +else +# Mac OS X install +.PHONY: install +install: $(STATIC_LIB) $(SHARED_LIB) + install -d $(DESTDIR)$(PREFIX)/lib + install -m755 $(STATIC_LIB) $(DESTDIR)$(PREFIX)/lib/lib$(LIBNAME).a + install -m755 $(SHARED_LIB) $(DESTDIR)$(PREFIX)/lib/lib$(LIBNAME).$(VERSION_MAJOR).dylib + ln -sf lib$(LIBNAME).$(VERSION_MAJOR).dylib $(DESTDIR)$(PREFIX)/lib/lib$(LIBNAME).dylib + install -d $(DESTDIR)$(PREFIX)/include + install -m644 luaradio.h $(DESTDIR)$(PREFIX)/include/luaradio.h + install -d $(DESTDIR)$(INSTALL_CMOD) + ln -sf $(PREFIX)/lib/lib$(LIBNAME).$(VERSION_MAJOR).dylib $(DESTDIR)$(INSTALL_CMOD)/radio.so + install -d $(DESTDIR)$(PREFIX)/bin + install -m755 ../luaradio $(DESTDIR)$(PREFIX)/bin/luaradio + install -d $(DESTDIR)$(PREFIX)/share/licenses/luaradio + install -m644 ../LICENSE $(DESTDIR)$(PREFIX)/share/licenses/luaradio/LICENSE +endif + +.PHONY: clean +clean: + rm -rf $(BUILD_DIR) + +################################################################################ + +$(BUILD_DIR)/$(TEST_DIR)/%: $(TEST_DIR)/%.c $(SHARED_LIB) + @mkdir -p $(dir $@) + $(CC) $(CFLAGS) -I./ $< -o $@ -L$(BUILD_DIR) -l$(LIBNAME) $(LIBFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) + +$(BUILD_DIR)/$(EXAMPLE_DIR)/%: $(EXAMPLE_DIR)/%.c $(SHARED_LIB) + @mkdir -p $(dir $@) + $(CC) $(CFLAGS) -I./ $< -o $@ -L$(BUILD_DIR) -l$(LIBNAME) $(LIBFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) + +$(STATIC_LIB): $(LIB_OBJS) + /home/eric/pluto032/buildroot/output/host/bin/arm-buildroot-linux-gnueabihf-ar -rcs $@ $^ + +ifneq ($(shell uname -s),Darwin) +$(SHARED_LIB): $(LIB_OBJS) + $(CC) $(CFLAGS) -shared -Wl,-soname,lib$(LIBNAME).so.$(VERSION_MAJOR) -o $@.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) $^ $(LDFLAGS) + ln -sf lib$(LIBNAME).so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) $@.$(VERSION_MAJOR) + ln -sf lib$(LIBNAME).so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) $@ +else +# Mac OS X shared library build +$(SHARED_LIB): $(LIB_OBJS) + $(CC) $(CFLAGS) -dynamiclib -Wl,-undefined -Wl,dynamic_lookup -install_name "lib$(LIBNAME).$(VERSION_MAJOR).dylib" -current_version $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) -compatibility_version $(VERSION_MAJOR).$(VERSION_MINOR) -o $(subst .dylib,.$(VERSION_MAJOR).dylib,$@) $^ $(LDFLAGS) + ln -sf lib$(LIBNAME).$(VERSION_MAJOR).dylib $@ +endif + +$(BUILD_DIR)/%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +$(BUILD_DIR)/%.o: $(GEN_DIR)/%.c + @mkdir -p $(dir $@) + $(CC) $(CFLAGS) -c $< -o $@ + +.SECONDARY: $(LUA_C_SRCS) +$(GEN_DIR)/%.c: $(SRC_DIR)/%.lua + @mkdir -p $(dir $@) + $(LUAJIT) -bn $(subst .init, , $(subst /,., $(patsubst $(SRC_DIR)/%.lua, %, $<))) $< $@ diff --git a/firmware/ori/package/luaradio-basic/luaradio-basic.mk b/firmware/ori/package/luaradio-basic/luaradio-basic.mk new file mode 100644 index 0000000..ce44fa4 --- /dev/null +++ b/firmware/ori/package/luaradio-basic/luaradio-basic.mk @@ -0,0 +1,43 @@ +################################################################################ +# +#LUARADIO +# +################################################################################ +LUARADIO_BASIC_VERSION = 0.10.0 +LUARADIO_BASIC_SITE = https://github.com/vsergeev/luaradio/archive/v$(LUARADIO_BASIC_VERSION) +#LUARADIO_SITE_METHOD = git + +LUARADIO_BASIC_INSTALL_STAGING = YES +LUARADIO_BASIC_LICENSE = MIT +LUARADIO_BASIC_LICENSE_FILES = LICENSE +LUARADIO_BASIC_DEPENDENCIES += luajit + +#define_PLUTO_BUILD_CMDS +# $(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) PREFIX=/usr -C $(@D) +#endef + +#define LIBINST +# cd /home/eric/plutosdr-fw/buildroot/output/build/luaradio-0.5.1/embed +# make lib +#endef +#lib: $(MAKE) -C embed +define LUARADIO_BASIC_BUILD_CMDS + + mkdir -p $(TARGET_DIR)/root/luaradio/radio + cp -R $(@D)/radio/* $(TARGET_DIR)/root/luaradio/radio + $(INSTALL) -D -m 755 $(@D)/luaradio $(TARGET_DIR)/root/luaradio/luaradio + + +endef + +$(eval $(generic-package)) + + +define LUARADIO_BASIC_INSTALL_TARGET_CMDS + + mkdir -p $(TARGET_DIR)/root/luaradio/radio + cp -R $(@D)/radio/* $(TARGET_DIR)/root/luaradio/radio + $(INSTALL) -D -m 755 $(@D)/luaradio $(TARGET_DIR)/root/luaradio/luaradio + +endef + diff --git a/firmware/ori/package/luaradio-basic/readme.patch.txt b/firmware/ori/package/luaradio-basic/readme.patch.txt new file mode 100644 index 0000000..c22e91c --- /dev/null +++ b/firmware/ori/package/luaradio-basic/readme.patch.txt @@ -0,0 +1,165 @@ +new file mode 100644 +--- a/embed/Makefile 1999-12-12 02:49:52.514648099 +0200 ++++ b/Makefile 2018-10-12 02:49:52.514648099 +0200 +@@ -0,0 +1,161 @@ ++SRC_DIR = . ++EXAMPLE_DIR = embed/examples ++TEST_DIR = embed/tests ++BUILD_DIR = build ++GEN_DIR = $(BUILD_DIR)/gen ++ ++################################################################################ ++ ++LIBNAME = luaradio ++LIB_SRCS = luaradio.c ++LUA_SRCS = $(shell find $(SRC_DIR)/radio -type f -name "*.lua") ++ ++EXAMPLE_SRCS = $(EXAMPLE_DIR)/fm-radio.c $(EXAMPLE_DIR)/rds-timesync.c ++TEST_SRCS = $(TEST_DIR)/test_api.c ++ ++################################################################################ ++ ++ifneq ($(shell uname -s),Darwin) ++SHARED_LIB = $(BUILD_DIR)/lib$(LIBNAME).so ++else ++SHARED_LIB = $(BUILD_DIR)/lib$(LIBNAME).dylib ++endif ++ ++STATIC_LIB = $(BUILD_DIR)/lib$(LIBNAME).a ++ ++LUA_C_SRCS := $(patsubst $(SRC_DIR)/%.lua, $(GEN_DIR)/%.c, $(LUA_SRCS)) ++LIB_OBJS := $(patsubst $(GEN_DIR)/%.c, $(BUILD_DIR)/%.o, $(LUA_C_SRCS)) $(patsubst %.c, $(BUILD_DIR)/%.o, $(LIB_SRCS)) ++ ++EXAMPLE_BINS = $(patsubst $(EXAMPLE_DIR)/%.c, $(BUILD_DIR)/$(EXAMPLE_DIR)/%, $(EXAMPLE_SRCS)) ++TEST_BINS = $(patsubst $(TEST_DIR)/%.c, $(BUILD_DIR)/$(TEST_DIR)/%, $(TEST_SRCS)) ++ ++PREFIX ?= /usr ++ ++INSTALL_CMOD = $(shell pkg-config luajit --variable INSTALL_CMOD) ++ ++################################################################################ ++ ++OPT = -O3 ++DEBUG = ++ ++VERSION_MAJOR := $(shell cd ../; luajit -e "package.path = './?/init.lua;' .. package.path; print(require('radio').version_info.major)") ++VERSION_MINOR := $(shell cd ../; luajit -e "package.path = './?/init.lua;' .. package.path; print(require('radio').version_info.minor)") ++VERSION_PATCH := $(shell cd ../; luajit -e "package.path = './?/init.lua;' .. package.path; print(require('radio').version_info.patch)") ++VERSION_COMMIT := $(shell git describe --abbrev --always --tags --dirty 2>/dev/null || echo "") ++ ++CFLAGS = -std=c99 -D_DEFAULT_SOURCE ++CFLAGS += $(shell pkg-config --cflags luajit) ++CFLAGS += -fPIC -lpthread ++CFLAGS += $(OPT) $(DEBUG) $(INCLUDES) ++CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_PATCH=$(VERSION_PATCH) ++CFLAGS += -DVERSION_COMMIT=\"$(VERSION_COMMIT)\" ++CFLAGS += -Wall -Wextra -Wcast-align -Wcast-qual -Wimplicit ++CFLAGS += -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type ++CFLAGS += -Wshadow -Wunused -Wno-unused-parameter ++ ++LIBFLAGS = $(shell pkg-config --libs luajit) ++ ++ifneq ($(shell uname -s),Darwin) ++LDFLAGS = -Wl,-E ++EXTRA_LDFLAGS = ++else ++LDFLAGS = ++EXTRA_LDFLAGS = -pagezero_size 10000 -image_base 100000000 ++endif ++ ++LUAJIT = luajit ++ ++################################################################################ ++ ++.PHONY: all ++all: lib install examples ++ ++.PHONY: lib ++lib: $(SHARED_LIB) $(STATIC_LIB) ++ ++.PHONY: examples ++examples: $(SHARED_LIB) $(EXAMPLE_BINS) ++ ++.PHONY: tests ++tests: $(SHARED_LIB) $(TEST_BINS) ++ ++.PHONY: runtests ++runtests: $(TEST_BINS) ++ for f in $(TEST_BINS); do \ ++ LD_LIBRARY_PATH=$(BUILD_DIR) DYLD_LIBRARY_PATH=$(BUILD_DIR) ./$$f; \ ++ done ++ ++ifneq ($(shell uname -s),Darwin) ++.PHONY: install ++install: $(STATIC_LIB) $(SHARED_LIB) ++ install -d $(DESTDIR)$(PREFIX)/lib ++ install -m755 $(STATIC_LIB) $(DESTDIR)$(PREFIX)/lib/lib$(LIBNAME).a ++ install -m755 $(SHARED_LIB) $(DESTDIR)$(PREFIX)/lib/lib$(LIBNAME).so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) ++ ln -sf lib$(LIBNAME).so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) $(DESTDIR)$(PREFIX)/lib/lib$(LIBNAME).so.$(VERSION_MAJOR) ++ ln -sf lib$(LIBNAME).so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) $(DESTDIR)$(PREFIX)/lib/lib$(LIBNAME).so ++ install -d $(DESTDIR)$(PREFIX)/include ++ install -m644 luaradio.h $(DESTDIR)$(PREFIX)/include/luaradio.h ++ install -d $(DESTDIR)$(INSTALL_CMOD) ++ ln -sf $(PREFIX)/lib/lib$(LIBNAME).so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) $(DESTDIR)$(INSTALL_CMOD)/radio.so ++ install -d $(DESTDIR)$(PREFIX)/bin ++ install -m755 ../luaradio $(DESTDIR)$(PREFIX)/bin/luaradio ++ install -d $(DESTDIR)$(PREFIX)/share/licenses/luaradio ++ install -m644 ../LICENSE $(DESTDIR)$(PREFIX)/share/licenses/luaradio/LICENSE ++else ++# Mac OS X install ++.PHONY: install ++install: $(STATIC_LIB) $(SHARED_LIB) ++ install -d $(DESTDIR)$(PREFIX)/lib ++ install -m755 $(STATIC_LIB) $(DESTDIR)$(PREFIX)/lib/lib$(LIBNAME).a ++ install -m755 $(SHARED_LIB) $(DESTDIR)$(PREFIX)/lib/lib$(LIBNAME).$(VERSION_MAJOR).dylib ++ ln -sf lib$(LIBNAME).$(VERSION_MAJOR).dylib $(DESTDIR)$(PREFIX)/lib/lib$(LIBNAME).dylib ++ install -d $(DESTDIR)$(PREFIX)/include ++ install -m644 luaradio.h $(DESTDIR)$(PREFIX)/include/luaradio.h ++ install -d $(DESTDIR)$(INSTALL_CMOD) ++ ln -sf $(PREFIX)/lib/lib$(LIBNAME).$(VERSION_MAJOR).dylib $(DESTDIR)$(INSTALL_CMOD)/radio.so ++ install -d $(DESTDIR)$(PREFIX)/bin ++ install -m755 ../luaradio $(DESTDIR)$(PREFIX)/bin/luaradio ++ install -d $(DESTDIR)$(PREFIX)/share/licenses/luaradio ++ install -m644 ../LICENSE $(DESTDIR)$(PREFIX)/share/licenses/luaradio/LICENSE ++endif ++ ++.PHONY: clean ++clean: ++ rm -rf $(BUILD_DIR) ++ ++################################################################################ ++ ++$(BUILD_DIR)/$(TEST_DIR)/%: $(TEST_DIR)/%.c $(SHARED_LIB) ++ @mkdir -p $(dir $@) ++ $(CC) $(CFLAGS) -I./ $< -o $@ -L$(BUILD_DIR) -l$(LIBNAME) $(LIBFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) ++ ++$(BUILD_DIR)/$(EXAMPLE_DIR)/%: $(EXAMPLE_DIR)/%.c $(SHARED_LIB) ++ @mkdir -p $(dir $@) ++ $(CC) $(CFLAGS) -I./ $< -o $@ -L$(BUILD_DIR) -l$(LIBNAME) $(LIBFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) ++ ++$(STATIC_LIB): $(LIB_OBJS) ++ ar rcs $@ $^ ++ ++ifneq ($(shell uname -s),Darwin) ++$(SHARED_LIB): $(LIB_OBJS) ++ $(CC) $(CFLAGS) -shared -Wl,-soname,lib$(LIBNAME).so.$(VERSION_MAJOR) -o $@.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) $^ $(LDFLAGS) ++ ln -sf lib$(LIBNAME).so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) $@.$(VERSION_MAJOR) ++ ln -sf lib$(LIBNAME).so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) $@ ++else ++# Mac OS X shared library build ++$(SHARED_LIB): $(LIB_OBJS) ++ $(CC) $(CFLAGS) -dynamiclib -Wl,-undefined -Wl,dynamic_lookup -install_name "lib$(LIBNAME).$(VERSION_MAJOR).dylib" -current_version $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) -compatibility_version $(VERSION_MAJOR).$(VERSION_MINOR) -o $(subst .dylib,.$(VERSION_MAJOR).dylib,$@) $^ $(LDFLAGS) ++ ln -sf lib$(LIBNAME).$(VERSION_MAJOR).dylib $@ ++endif ++ ++$(BUILD_DIR)/%.o: %.c ++ $(CC) $(CFLAGS) -c $< -o $@ ++ ++$(BUILD_DIR)/%.o: $(GEN_DIR)/%.c ++ @mkdir -p $(dir $@) ++ $(CC) $(CFLAGS) -c $< -o $@ ++ ++.SECONDARY: $(LUA_C_SRCS) ++$(GEN_DIR)/%.c: $(SRC_DIR)/%.lua ++ @mkdir -p $(dir $@) ++ $(LUAJIT) -bn $(subst .init, , $(subst /,.,$(patsubst $(SRC_DIR)/%.lua, %, $<))) $< $@ diff --git a/firmware/ori/package/multimonng/Config.in b/firmware/ori/package/multimonng/Config.in new file mode 100644 index 0000000..7ee4866 --- /dev/null +++ b/firmware/ori/package/multimonng/Config.in @@ -0,0 +1,9 @@ +config BR2_PACKAGE_MULTIMONNG + bool "multimonng" + help + HAMRADIO : multimon-ng decodes the following digital transmission modes: + POCSAG512 POCSAG1200 POCSAG2400 FLEX EAS UFSK1200 CLIPFSK + AFSK1200 AFSK2400 AFSK2400_2 AFSK2400_3 HAPN4800 FSK9600 DTMF + ZVEI1 ZVEI2 ZVEI3 DZVEI PZVEI EEA EIA CCIR MORSE CW X10 + + https://github.com/EliasOenal/multimon-ng diff --git a/firmware/ori/package/multimonng/multimonng.hash b/firmware/ori/package/multimonng/multimonng.hash new file mode 100644 index 0000000..dc5a4b1 --- /dev/null +++ b/firmware/ori/package/multimonng/multimonng.hash @@ -0,0 +1 @@ +sha1 12aa10d5fb6760237ab3204c50578185ba5057fe 1.1.9.tar.gz diff --git a/firmware/ori/package/multimonng/multimonng.mk b/firmware/ori/package/multimonng/multimonng.mk new file mode 100644 index 0000000..23f0ee1 --- /dev/null +++ b/firmware/ori/package/multimonng/multimonng.mk @@ -0,0 +1,24 @@ +################################################################################ +# +# MULTIMONNG +# +################################################################################ + + +MULTIMONNG_VERSION = 1.1.9 +MULTIMONNG_SITE = https://github.com/EliasOenal/multimon-ng/archive/refs/tags +MULTIMONNG_SOURCE = $(MULTIMONNG_VERSION).tar.gz + + +MULTIMONNG_INSTALL_STAGING = YES +MULTIMONNG_LICENSE = GPL-2.0 +MULTIMONNG_LICENSE_FILES = COPYING +#MULTIMONNG_DEPENDENCIES = +#MULTIMONNG_SITE_METHOD = git + + + + +$(eval $(cmake-package)) + + diff --git a/firmware/ori/package/nng/Config.in b/firmware/ori/package/nng/Config.in new file mode 100644 index 0000000..4ffba2a --- /dev/null +++ b/firmware/ori/package/nng/Config.in @@ -0,0 +1,9 @@ +config BR2_PACKAGE_NNG + bool "nng-master" + help + NNG: Lightweight Messaging Library + github (release) + + https://github.com/nanomsg/nng + + diff --git a/firmware/ori/package/nng/nng-master.mk b/firmware/ori/package/nng/nng-master.mk new file mode 100644 index 0000000..1965bda --- /dev/null +++ b/firmware/ori/package/nng/nng-master.mk @@ -0,0 +1,15 @@ +################################################################################ +# +# nng +# +################################################################################ + + +NNG_VERSION = master +NNG_SITE = $(call github,nanomsg,nng,$(NNG_VERSION)) +NNG_INSTALL_STAGING = YES +NNG_CONF_OPTS = -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON + +$(eval $(cmake-package)) + + diff --git a/firmware/ori/package/rtl-433/Config.in b/firmware/ori/package/rtl-433/Config.in new file mode 100644 index 0000000..07fa8b2 --- /dev/null +++ b/firmware/ori/package/rtl-433/Config.in @@ -0,0 +1,10 @@ +config BR2_PACKAGE_RTL_433 + bool "rtl-433" + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_PACKAGE_SOAPYSDR + help + Program to decode traffic from Devices that are broadcasting on 433.9 MHz like temperature sensors + + https://github.com/merbanan/rtl_433 +comment "rtl_433 needs a toolchain w/ threads" + depends on !BR2_TOOLCHAIN_HAS_THREADS diff --git a/firmware/ori/package/rtl-433/rtl_433.mk b/firmware/ori/package/rtl-433/rtl_433.mk new file mode 100644 index 0000000..359ccd4 --- /dev/null +++ b/firmware/ori/package/rtl-433/rtl_433.mk @@ -0,0 +1,18 @@ +################################################################################ +# +# RTL_433 +# +################################################################################ +RTL_433_VERSION := master +#RTL_433_VERSION := 82d0f551a5ebb9267c034540592f7106a6a83fbc +RTL_433_SITE := https://github.com/merbanan/rtl_433.git +RTL_433_SITE_METHOD := git +RTL_433_INSTALL_TARGET := YES +RTL_433_INSTALL_STAGING := YES +RTL_433_LICENSE := GPL-2.0 +RTL_433_LICENSE_FILES := COPYING +RTL_433_DEPENDENCIES += soapysdr +RTL_433_CONF_OPTS := -DENABLE_SOAPYSDR=ON -DENABLE_RTLSDR=OFF +-DCFLAGS=$(TARGET_CC) -DCXXFLAGS=$(TARGET_CXX) + +$(eval $(cmake-package)) diff --git a/firmware/ori/package/rtlsdr-airband/Config.in b/firmware/ori/package/rtlsdr-airband/Config.in new file mode 100644 index 0000000..b11848d --- /dev/null +++ b/firmware/ori/package/rtlsdr-airband/Config.in @@ -0,0 +1,10 @@ +config BR2_PACKAGE_RTLSDR_AIRBAND + bool "rtlsdr-airband" + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_PACKAGE_SOAPYSDR + help + RTLSDR-Airband receives analog radio voice channels and produces audio streams which can be routed to various outputs, such as online streaming services like LiveATC.net. + + https://github.com/szpajder/RTLSDR-Airband +comment "RTLSDR_Airband needs a toolchain w/ threads" + depends on !BR2_TOOLCHAIN_HAS_THREADS diff --git a/firmware/ori/package/rtlsdr-airband/rtlsdr-airband.mk b/firmware/ori/package/rtlsdr-airband/rtlsdr-airband.mk new file mode 100644 index 0000000..ca34894 --- /dev/null +++ b/firmware/ori/package/rtlsdr-airband/rtlsdr-airband.mk @@ -0,0 +1,37 @@ +################################################################################ +# +# RTLSDR_AIRBAND +# +################################################################################ +RTLSDR_AIRBAND_VERSION := v3.2.1 +#RTLSDR_AIRBAND_VERSION := 82d0f551a5ebb9267c034540592f7106a6a83fbc +RTLSDR_AIRBAND_SITE := https://github.com/szpajder/RTLSDR-Airband +RTLSDR_AIRBAND_SITE_METHOD := git +RTLSDR_AIRBAND_INSTALL_TARGET := YES +RTLSDR_AIRBAND_INSTALL_STAGING := YES +RTLSDR_AIRBAND_LICENSE := GPL-2.0 +RTLSDR_AIRBAND_LICENSE_FILES := COPYING +RTLSDR_AIRBAND_DEPENDENCIES += +#RTLSDR_AIRBAND_DEPENDENCIES += soapysdr lame libshout lbvorbis +RTLSDR_AIRBAND_CONF_OPTS := -lstdc++ -DWITH_SOAPYSDR=1 -DNFM=1 -DPULSE=0 -DWITH_RTLSDR=0 + +#RTLSDR_AIRBAND_FLAGS := -lstdc++ + +define RTLSDR_AIRBAND_BUILD_CMDS +#RTLSDR_AIRBAND_CFLAGS := -lstdc++ + # PLATFORM=armv7-generic $(TARGET_MAKE_ENV) $(MAKE) CC="$(TARGET_CXX)" LD="$(TARGET_LD)" -C $(@D) WITH_SOAPYSDR=1 NFM=1 PULSE=0 WITH_RTLSDR=0 + +PLATFORM=armv7-generic $(TARGET_MAKE_ENV) $(MAKE) CXX="$(TARGET_CXX)" CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D) WITH_SOAPYSDR=1 NFM=1 PULSE=0 WITH_RTLSDR=0 + + +endef + + +define RTLSDR_AIRBAND_INSTALL_TARGET_CMDS + $(INSTALL) -m 0755 -D $(@D)/rtl_airband $(TARGET_DIR)/usr/bin/rtl_airband +# $(INSTALL) -m 0755 -D $(@D)/view1090 $(TARGET_DIR)/usr/bin/view1090 +# mkdir -p $(TARGET_DIR)/www/dump1090 +# $(INSTALL) -d $(TARGET_DIR)/www/dump1090 +# cp -r $(@D)/public_html/* $(TARGET_DIR)/www/dump1090 +endef +$(eval $(generic-package)) diff --git a/firmware/ori/package/rxtools/Config.in b/firmware/ori/package/rxtools/Config.in new file mode 100644 index 0000000..c2307eb --- /dev/null +++ b/firmware/ori/package/rxtools/Config.in @@ -0,0 +1,9 @@ +config BR2_PACKAGE_RXTOOLS + bool "rxtools" + depends on BR2_TOOLCHAIN_HAS_THREADS + help + rx_fm, rx_power, and rx_sdr tools for receiving data from SDRs, on rtl_fm, rtl_power, and rtl_sdr from librtlsdr, but using the SoapySDR vneutral SDR support library instead, intended to support a wider range of s than RTL-SDR + + https://github.com/rxseger/rx_tools +comment "rxtools needs a toolchain w/ threads" + depends on !BR2_TOOLCHAIN_HAS_THREADS diff --git a/firmware/ori/package/rxtools/old.0001-using-soapyplutosdr-native-convert.patch.txt b/firmware/ori/package/rxtools/old.0001-using-soapyplutosdr-native-convert.patch.txt new file mode 100644 index 0000000..b6a3e15 --- /dev/null +++ b/firmware/ori/package/rxtools/old.0001-using-soapyplutosdr-native-convert.patch.txt @@ -0,0 +1,79 @@ +diff --git "a/src/rtl_sdr.c" "b/src/rtl_sdr.c" +index 81b22c7..cb4de44 100644 +--- "a/src/rtl_sdr.c" ++++ "b/src/rtl_sdr.c" +@@ -96,7 +96,7 @@ int main(int argc, char **argv) + int sync_mode = 0; + int direct_sampling = 0; + FILE *file; +- int16_t *buffer; ++ void *buffer; + uint8_t *buf8 = NULL; + float *fbuf = NULL; // assumed 32-bit + char *dev_query = ""; +@@ -173,7 +173,7 @@ int main(int argc, char **argv) + out_block_size = DEFAULT_BUF_LENGTH; + } + +- buffer = malloc(out_block_size * SoapySDR_formatToSize(SOAPY_SDR_CS16)); ++ buffer = malloc(out_block_size * SoapySDR_formatToSize(output_format)); + if (output_format == SOAPY_SDR_CS8 || output_format == SOAPY_SDR_CU8) { + buf8 = malloc(out_block_size * SoapySDR_formatToSize(SOAPY_SDR_CS8)); + } else if (output_format == SOAPY_SDR_CF32) { +@@ -182,14 +182,22 @@ int main(int argc, char **argv) + + int tmp_stdout = suppress_stdout_start(); + // TODO: allow choosing input format, see https://www.reddit.com/r/RTLSDR/comments/4tpxv7/rx_tools_commandline_sdr_tools_for_rtlsdr_bladerf/d5ohfse?context=3 +- r = verbose_device_search(dev_query, &dev, &stream, SOAPY_SDR_CS16); ++ ++ if(output_format == SOAPY_SDR_CS8 || output_format == SOAPY_SDR_CU8){ ++ r = verbose_device_search(dev_query, &dev, &stream, SOAPY_SDR_CS8); ++ }else if (output_format == SOAPY_SDR_CS16){ ++ r = verbose_device_search(dev_query, &dev, &stream, SOAPY_SDR_CS16); ++ }else if(output_format == SOAPY_SDR_CF32){ ++ r = verbose_device_search(dev_query, &dev, &stream, SOAPY_SDR_CF32); ++ } ++ + + if (r != 0) { + fprintf(stderr, "Failed to open sdr device matching '%s'.\n", dev_query); + exit(1); + } + +- fprintf(stderr, "Using output format: %s (input format %s)\n", output_format, SOAPY_SDR_CS16); ++ fprintf(stderr, "Using output format: %s (input format %s)\n", output_format, output_format); + + #ifndef _WIN32 + sigact.sa_handler = sighandler; +@@ -283,26 +291,21 @@ int main(int argc, char **argv) + break; + } + } else if (output_format == SOAPY_SDR_CS8) { +- for (i = 0; i < n_read; ++i) { +- buf8[i] = ( (int16_t)buffer[i] / 32767.0 * 128.0 + 0.4); +- } +- if (fwrite(buf8, sizeof(uint8_t), n_read, file) != (size_t)n_read) { ++ if (fwrite(buffer, sizeof(int8_t), n_read, file) != (size_t)n_read) { + fprintf(stderr, "Short write, samples lost, exiting!\n"); + break; + } + } else if (output_format == SOAPY_SDR_CU8) { ++ int8_t* ptr=(int8_t*)buffer; + for (i = 0; i < n_read; ++i) { +- buf8[i] = ( (int16_t)buffer[i] / 32767.0 * 128.0 + 127.4); ++ buf8[i] = (ptr[i] + 127); + } + if (fwrite(buf8, sizeof(uint8_t), n_read, file) != (size_t)n_read) { + fprintf(stderr, "Short write, samples lost, exiting!\n"); + break; + } + } else if (output_format == SOAPY_SDR_CF32) { +- for (i = 0; i < n_read; ++i) { +- fbuf[i] = buffer[i] * 1.0f / SHRT_MAX; +- } +- if (fwrite(fbuf, sizeof(float), n_read, file) != (size_t)n_read) { ++ if (fwrite(buffer, sizeof(float), n_read, file) != (size_t)n_read) { + fprintf(stderr, "Short write, samples lost, exiting!\n"); + break; + } + diff --git a/firmware/ori/package/rxtools/rxtools.mk b/firmware/ori/package/rxtools/rxtools.mk new file mode 100644 index 0000000..59082bc --- /dev/null +++ b/firmware/ori/package/rxtools/rxtools.mk @@ -0,0 +1,24 @@ +################################################################################ +# +# RXTOOLS +# +################################################################################ + +#RXTOOLS_VERSION = f8f7e4560dd7a8bfaf5e3dfe50685a50ab1e04a9 +RXTOOLS_VERSION = master +RXTOOLS_SITE = https://github.com/LamaBleu/rx_tools/archive +#RXTOOLS_SITE = $(call github,LamaBleu,rx_tools,$(RXTOOLS_VERSION)) +#RXTOOLS_SOURCE = rxtools-$(RXTOOLS_VERSION).tar.gz +RXTOOLS_SOURCE = $(RXTOOLS_VERSION).tar.gz +#RXTOOLS_VERSION = 571cc9aeccb2004d81032cea484324aacb1a5852 +#RXTOOLS_SITE = https://github.com/rxseger/rx_tools.git +#oRXTOOLS_SITE_METHOD = git + +RXTOOLS_INSTALL_STAGING = YES +RXTOOLS_LICENSE = GPL-2.0 +RXTOOLS_LICENSE_FILES = COPYING +RXTOOLS_DEPENDENCIES = soapysdr + + +$(eval $(cmake-package)) +#https://github.com/LamaBleu/rx_tools/archive/refs/heads/master.zip diff --git a/firmware/ori/package/satdump/Config.in b/firmware/ori/package/satdump/Config.in new file mode 100644 index 0000000..41f141c --- /dev/null +++ b/firmware/ori/package/satdump/Config.in @@ -0,0 +1,13 @@ +config BR2_PACKAGE_SATDUMP + bool "satdump-master" + depends on BR2_PACKAGE_VOLK + depends on BR2_PACKAGE_LIBPNG + depends on BR2_PACKAGE_TIFF + depends on BR2_PACKAGE_JEMALLOC + help + generic satellite data processing software + github (release) + + https://github.com/SatDump/SatDump + + diff --git a/firmware/ori/package/satdump/satdump-master.mk b/firmware/ori/package/satdump/satdump-master.mk new file mode 100644 index 0000000..38e242b --- /dev/null +++ b/firmware/ori/package/satdump/satdump-master.mk @@ -0,0 +1,15 @@ +################################################################################ +# +# satdump +# +################################################################################ + + +SATDUMP_VERSION = master +SATDUMP_SITE = $(call github,SatDump,SatDump,$(SATDUMP_VERSION)) +SATDUMP_INSTALL_STAGING = YES +SATDUMP_CONF_OPTS = -DBUILD_GUI=OFF -DBUILD_ZIQ=OFF -DBUILD_OPENCL=OFF -DBUILD_OPENMP=OFF -DPLUGINS_ALL=OFF -DPLUGIN_DVB=ON +#SATDUMP_CONF_OPTS = -DBUILD_GUI=OFF -DBUILD_OPENMP=OFF +$(eval $(cmake-package)) + + diff --git a/firmware/ori/package/sigutils/Config.in b/firmware/ori/package/sigutils/Config.in new file mode 100644 index 0000000..bc6ec7c --- /dev/null +++ b/firmware/ori/package/sigutils/Config.in @@ -0,0 +1,10 @@ +config BR2_PACKAGE_SIGUTILS + bool "sigutils" + depends on BR2_TOOLCHAIN_HAS_THREADS +# depends on BR2_PACKAGE_SNDFILE + help + The sigutils library is a digital signal processing library written in C, designed for blind signal analysis and automatic demodulation in GNU/Linux. + + https://github.com/BatchDrake/sigutils +comment "sigutils needs a toolchain w/ threads" + depends on !BR2_TOOLCHAIN_HAS_THREADS diff --git a/firmware/ori/package/sigutils/sigutils.mk b/firmware/ori/package/sigutils/sigutils.mk new file mode 100644 index 0000000..1d7592d --- /dev/null +++ b/firmware/ori/package/sigutils/sigutils.mk @@ -0,0 +1,24 @@ +################################################################################ +# +# SIGUTILS +# +################################################################################ + + +SIGUTILS_VERSION = v0.1.0 +#SIGUTILS_VERSION = 050ad2ef10f6c8f8a67a1d8ed6f049e9dd8fc5fc +SIGUTILS_SITE = https://github.com/BatchDrake/sigutils +SIGUTILS_SOURCE = sigutils-0.1.0.tar.gz +#SIGUTILS-$(SIGUTILS_VERSION).tar.gz + +#SIGUTILS_VERSION = 571cc9aeccb2004d81032cea484324aacb1a5852 + +SIGUTILS_SITE_METHOD = git + +SIGUTILS_INSTALL_STAGING = YES +SIGUTILS_LICENSE = GPL-2.0 +SIGUTILS_LICENSE_FILES = COPYING +SIGUTILS_DEPENDENCIES += + + +$(eval $(cmake-package)) diff --git a/firmware/ori/package/soapyplutosdr-master/Config.in b/firmware/ori/package/soapyplutosdr-master/Config.in new file mode 100644 index 0000000..701acde --- /dev/null +++ b/firmware/ori/package/soapyplutosdr-master/Config.in @@ -0,0 +1,8 @@ +config BR2_PACKAGE_SOAPYPLUTOSDR_MASTER + bool "soapyplutosdr-master" + depends on BR2_TOOLCHAIN_HAS_THREADS + select BR2_PACKAGE_LIBIIO + select BR2_PACKAGE_LIBAD9361_IIO + help + Soapy SDR plugin for PlutoSDR + https://github.com/pothosware/SoapyPlutoSDR diff --git a/firmware/ori/package/soapyplutosdr-master/soapyplutosdr-master.mk b/firmware/ori/package/soapyplutosdr-master/soapyplutosdr-master.mk new file mode 100644 index 0000000..f7c9a1a --- /dev/null +++ b/firmware/ori/package/soapyplutosdr-master/soapyplutosdr-master.mk @@ -0,0 +1,26 @@ +################################################################################ +# +# SoapyPlutoSDR +# +################################################################################ +SOAPYPLUTOSDR_MASTER_VERSION = soapyplutosdr-master +SOAPYPLUTOSDR_MASTER_SOURCE_BASENAME = SoapyPlutoSDR-master +SOAPYPLUTOSDR_MASTER_SOURCE =$(SOAPYPLUTOSDR_MASTER_SOURCE_BASENAME).zip +SOAPYPLUTOSDR_MASTER_SITE = $(call github,pothosware,SoapyPlutoSDR,master) +SOAPYPLUTOSDR_MASTER_INSTALL_STAGING = YES +SOAPYPLUTOSDR_MASTER_LICENSE = Boost Software License 1.0 +SOAPYPLUTOSDR_MASTER_LICENSE_FILES = LICENSE_1_0.txt +#SOAPYPLUTOSDR_MASTER_DEPENDENCIES = python +#SOAPYPLUTOSDR_MASTER_CONF_OPTS = -DENABLE_PYTHON3=OFF -DENABLE_PYTHON=OFF +# -DCFLAGS=$(TARGET_CC) -DCXXFLAGS=$(TARGET_CXX) + +define SOAPYPLUTOSDR_MASTER_EXTRACT_CMDS + echo $(@D) + unzip $(DL_DIR)/$(SOAPYPLUTOSDR_MASTER_VERSION)/$(SOAPYPLUTOSDR_MASTER_SOURCE_BASENAME).zip -d $(@D) + mv $(@D)/$(SOAPYPLUTOSDR_MASTER_SOURCE_BASENAME)/* $(@D) + # rmdir $(@D)/$(SOAPYPLUTOSDR_MASTER_SOURCE_BASENAME) +endef + +$(eval $(cmake-package)) + + diff --git a/firmware/ori/package/soapyplutosdr/Config.in b/firmware/ori/package/soapyplutosdr/Config.in new file mode 100644 index 0000000..1391f3e --- /dev/null +++ b/firmware/ori/package/soapyplutosdr/Config.in @@ -0,0 +1,8 @@ +config BR2_PACKAGE_SOAPYPLUTOSDR + bool "soapyplutosdr" + depends on BR2_TOOLCHAIN_HAS_THREADS + select BR2_PACKAGE_LIBIIO + select BR2_PACKAGE_LIBAD9361_IIO + help + Soapy SDR plugin for PlutoSDR + https://github.com/pothosware/SoapyPlutoSDR diff --git a/firmware/ori/package/soapyplutosdr/soapyplutosdr.hash b/firmware/ori/package/soapyplutosdr/soapyplutosdr.hash new file mode 100644 index 0000000..b02d414 --- /dev/null +++ b/firmware/ori/package/soapyplutosdr/soapyplutosdr.hash @@ -0,0 +1 @@ +sha256 0300a91e3e18e1af95de9f9a0b99b3414052908aad1a05a75a229a6ecc9c5f1f soapy-plutosdr-0.2.1.tar.gz diff --git a/firmware/ori/package/soapyplutosdr/soapyplutosdr.mk b/firmware/ori/package/soapyplutosdr/soapyplutosdr.mk new file mode 100644 index 0000000..cd197b7 --- /dev/null +++ b/firmware/ori/package/soapyplutosdr/soapyplutosdr.mk @@ -0,0 +1,22 @@ +################################################################################ +# +# SoapyPlutoSDR +# +################################################################################ +#SOAPYSDR_SOURCE = soapy-sdr-$(SOAPYSDR_VERSION).tar.gz +#SOAPYSDR_SITE = https://github.com/pothosware/SoapySDR/archive +#SOAPYPLUTOSDR_VERSION = ac9a9da5c14c73e752796618d56e259ca1ac6b11 +#https://codeload.github.com/pothosware/SoapyPlutoSDR/tar.gz/refs/tags/soapy-plutosdr-0.2.1 +SOAPYPLUTOSDR_VERSION = soapy-plutosdr-0.2.1 +SOAPYPLUTOSDR_SOURCE = $(SOAPYPLUTOSDR_VERSION).tar.gz +#SOAPYPLUTOSDR_SOURCE = soapy-plutosdr-$(SOAPYPLUTOSDR_VERSION).tar.gz +SOAPYPLUTOSDR_SITE = https://github.com/pothosware/SoapyPlutoSDR +#SOAPYPLUTOSDR_SITE = https://github.com/pothosware/SoapyPlutoSDR +SOAPYPLUTOSDR_SITE_METHOD = git + +SOAPYPLUTOSDR_INSTALL_STAGING = YES +SOAPYPLUTOSDR_LICENSE = LGPL-2.1+ +SOAPYPLUTOSDR_LICENSE_FILE = LICENSE +SOAPYPLUTOSDR_DEPENDENCIES = libiio libad9361-iio + +$(eval $(cmake-package)) diff --git a/firmware/ori/package/soapyremote/Config.in b/firmware/ori/package/soapyremote/Config.in new file mode 100644 index 0000000..bbcd3f0 --- /dev/null +++ b/firmware/ori/package/soapyremote/Config.in @@ -0,0 +1,7 @@ +config BR2_PACKAGE_SOAPYREMOTE + bool "soapyremote" +# select BR2_PACKAGE_SOAPYSDR + help + Use any Soapy SDR remotely + + https://github.com/pothosware/SoapyRemote.git diff --git a/firmware/ori/package/soapyremote/soapyremote.hash b/firmware/ori/package/soapyremote/soapyremote.hash new file mode 100644 index 0000000..4bba4c1 --- /dev/null +++ b/firmware/ori/package/soapyremote/soapyremote.hash @@ -0,0 +1,3 @@ +sha1 c7248635d718aef4dbd854c3b6a5f2e71c155efd soapy-remote-0.4.3.tar.gz +sha1 fa60bef36aee9fa6bcda323ff297522a2c88e4b8 soapy-remote-0.5.0.tar.gz + diff --git a/firmware/ori/package/soapyremote/soapyremote.mk b/firmware/ori/package/soapyremote/soapyremote.mk new file mode 100644 index 0000000..be2f707 --- /dev/null +++ b/firmware/ori/package/soapyremote/soapyremote.mk @@ -0,0 +1,15 @@ +################################################################################ +# +# soapyremote +# +################################################################################ +SOAPYREMOTE_VERSION = 0.5.0 +SOAPYREMOTE_SOURCE = soapy-remote-$(SOAPYREMOTE_VERSION).tar.gz +SOAPYREMOTE_SITE = https://github.com/pothosware/SoapyRemote/archive +SOAPYREMOTE_INSTALL_STAGING = YES +SOAPYREMOTE_LICENSE = Boost Software License 1.0 +SOAPYREMOTE_LICENSE_FILES = LICENSE_1_0.txt +#SOAPYREMOTE_DEPENDENCIES = soapysdr + + +$(eval $(cmake-package)) diff --git a/firmware/ori/package/soapysdr-git/Config.in b/firmware/ori/package/soapysdr-git/Config.in new file mode 100644 index 0000000..35ac5ee --- /dev/null +++ b/firmware/ori/package/soapysdr-git/Config.in @@ -0,0 +1,9 @@ +config BR2_PACKAGE_SOAPYSDRGIT + bool "soapysdr-git" + help + Vendor and platform neutral SDR support library + github (release) + + https://github.com/pothosware/SoapySDR.git + + diff --git a/firmware/ori/package/soapysdr-git/soapysdr-git.mk b/firmware/ori/package/soapysdr-git/soapysdr-git.mk new file mode 100644 index 0000000..91bfca2 --- /dev/null +++ b/firmware/ori/package/soapysdr-git/soapysdr-git.mk @@ -0,0 +1,36 @@ +################################################################################ +# +# SoapySDR +# +################################################################################ +SOAPYSDRGIT_VERSION = a8df1c575ff7345fe72050c18ede8c545e255c46 +#SOAPYSDRGIT_VERSION = fe8dfd1879a8512aa305045ef1e6657a5a33f3b9 +#SOAPYSDRGIT_SITE = $(call github,pothosware,SoapySDR-master,$(SOAPYSDRGIT_VERSION)) +SOAPYSDR_SOURCE = SoapySDR-master.zip +SOAPYSDRGIT_SITE = https://github.com/pothosware/SoapySDR/archive +#SOAPYSDRGIT_SITE_METHOD = git +SOAPYSDRGIT_INSTALL_STAGING = YES +SOAPYSDRGIT_LICENSE = Boost Software License 1.0 +SOAPYSDRGIT_LICENSE_FILES = LICENSE_1_0.txt +#SOAPYSDRGIT_CONF_OPTS = -DENABLE_PYTHON3=OFF -DENABLE_PYTHON=ON +SOAPYSDRGIT_CONF_OPTS = -DCFLAGS=$(TARGET_CC) -DCXXFLAGS=$(TARGET_CXX) -DENABLE_PYTHON3=OFF -DENABLE_PYTHON=YES -DCFLAGS=-m32 -DCXXFLAGS=-m32 +#SOAPYSDRGIT_CONF_OPTS = -DPYTHON_EXECUTABLE=/usr/bin/python -DENABLE_PYTHON3=NO + + +$(eval $(cmake-package)) + +#-------------------- + +#SOAPYSDR_VERSION = 0.7.2 +#SOAPYSDR_SOURCE = soapy-sdr-$(SOAPYSDR_VERSION).tar.gz +#SOAPYSDR_SITE = https://github.com/pothosware/SoapySDR/archive +#SOAPYSDR_INSTALL_STAGING = YES +#SOAPYSDR_LICENSE = Boost Software License 1.0 +#SOAPYSDR_LICENSE_FILES = LICENSE_1_0.txt +#SOAPYSDR_DEPENDENCIES = python +#SOAPYSDR_CONF_OPTS = -DENABLE_PYTHON3=OFF -DENABLE_PYTHON=OFF +# -DCFLAGS=$(TARGET_CC) -DCXXFLAGS=$(TARGET_CXX) + +#$(eval $(cmake-package)) + + diff --git a/firmware/ori/package/soapysdr-master/Config.in b/firmware/ori/package/soapysdr-master/Config.in new file mode 100644 index 0000000..7de9b80 --- /dev/null +++ b/firmware/ori/package/soapysdr-master/Config.in @@ -0,0 +1,9 @@ +config BR2_PACKAGE_SOAPYSDR_MASTER + bool "soapysdr-master" + help + Vendor and platform neutral SDR support library + github (release) + + https://github.com/pothosware/SoapySDR.git + + diff --git a/firmware/ori/package/soapysdr-master/soapysdr-git.mk.old b/firmware/ori/package/soapysdr-master/soapysdr-git.mk.old new file mode 100644 index 0000000..91bfca2 --- /dev/null +++ b/firmware/ori/package/soapysdr-master/soapysdr-git.mk.old @@ -0,0 +1,36 @@ +################################################################################ +# +# SoapySDR +# +################################################################################ +SOAPYSDRGIT_VERSION = a8df1c575ff7345fe72050c18ede8c545e255c46 +#SOAPYSDRGIT_VERSION = fe8dfd1879a8512aa305045ef1e6657a5a33f3b9 +#SOAPYSDRGIT_SITE = $(call github,pothosware,SoapySDR-master,$(SOAPYSDRGIT_VERSION)) +SOAPYSDR_SOURCE = SoapySDR-master.zip +SOAPYSDRGIT_SITE = https://github.com/pothosware/SoapySDR/archive +#SOAPYSDRGIT_SITE_METHOD = git +SOAPYSDRGIT_INSTALL_STAGING = YES +SOAPYSDRGIT_LICENSE = Boost Software License 1.0 +SOAPYSDRGIT_LICENSE_FILES = LICENSE_1_0.txt +#SOAPYSDRGIT_CONF_OPTS = -DENABLE_PYTHON3=OFF -DENABLE_PYTHON=ON +SOAPYSDRGIT_CONF_OPTS = -DCFLAGS=$(TARGET_CC) -DCXXFLAGS=$(TARGET_CXX) -DENABLE_PYTHON3=OFF -DENABLE_PYTHON=YES -DCFLAGS=-m32 -DCXXFLAGS=-m32 +#SOAPYSDRGIT_CONF_OPTS = -DPYTHON_EXECUTABLE=/usr/bin/python -DENABLE_PYTHON3=NO + + +$(eval $(cmake-package)) + +#-------------------- + +#SOAPYSDR_VERSION = 0.7.2 +#SOAPYSDR_SOURCE = soapy-sdr-$(SOAPYSDR_VERSION).tar.gz +#SOAPYSDR_SITE = https://github.com/pothosware/SoapySDR/archive +#SOAPYSDR_INSTALL_STAGING = YES +#SOAPYSDR_LICENSE = Boost Software License 1.0 +#SOAPYSDR_LICENSE_FILES = LICENSE_1_0.txt +#SOAPYSDR_DEPENDENCIES = python +#SOAPYSDR_CONF_OPTS = -DENABLE_PYTHON3=OFF -DENABLE_PYTHON=OFF +# -DCFLAGS=$(TARGET_CC) -DCXXFLAGS=$(TARGET_CXX) + +#$(eval $(cmake-package)) + + diff --git a/firmware/ori/package/soapysdr-master/soapysdr-master.mk b/firmware/ori/package/soapysdr-master/soapysdr-master.mk new file mode 100644 index 0000000..91a9ae3 --- /dev/null +++ b/firmware/ori/package/soapysdr-master/soapysdr-master.mk @@ -0,0 +1,27 @@ +################################################################################ +# +# soapysdr +# +################################################################################ + +#https://github.com/pothosware/SoapySDR/archive/master/SoapySDR-master.zip +SOAPYSDR_MASTER_VERSION = soapysdr-master +SOAPYSDR_MASTER_SOURCE_BASENAME = SoapySDR-master +SOAPYSDR_MASTER_SOURCE =$(SOAPYSDR_MASTER_SOURCE_BASENAME).zip +SOAPYSDR_MASTER_SITE = $(call github,pothosware,SoapySDR,master) +SOAPYSDR_MASTER_INSTALL_STAGING = YES +SOAPYSDR_MASTER_LICENSE = Boost Software License 1.0 +SOAPYSDR_MASTER_LICENSE_FILES = LICENSE_1_0.txt +#SOAPYSDR_MASTER_DEPENDENCIES = python +SOAPYSDR_MASTER_CONF_OPTS = -DENABLE_PYTHON3=OFF -DENABLE_PYTHON=OFF +# -DCFLAGS=$(TARGET_CC) -DCXXFLAGS=$(TARGET_CXX) + +define SOAPYSDR_MASTER_EXTRACT_CMDS + echo $(@D) + unzip $(DL_DIR)/$(SOAPYSDR_MASTER_VERSION)/$(SOAPYSDR_MASTER_SOURCE_BASENAME).zip -d $(@D) + mv $(@D)/$(SOAPYSDR_MASTER_SOURCE_BASENAME)/* $(@D) + # rmdir $(@D)/$(SOAPYSDR_MASTER_SOURCE_BASENAME) +endef + +$(eval $(cmake-package)) + diff --git a/firmware/ori/package/soapysdr-master/soapysdr-master.mk.2 b/firmware/ori/package/soapysdr-master/soapysdr-master.mk.2 new file mode 100644 index 0000000..eef5511 --- /dev/null +++ b/firmware/ori/package/soapysdr-master/soapysdr-master.mk.2 @@ -0,0 +1,28 @@ +################################################################################ +# +# soapysdr +# +################################################################################ + +#https://github.com/pothosware/SoapySDR/archive/master/SoapySDR-master.zip +SOAPYSDR_MASTER_VERSION = soapysdr-master +SOAPYSDR_MASTER_SOURCE_BASENAME = SoapySDR-master +#SOAPYSDR_MASTER_SOURCE = master/$(SOAPYSDR_MASTER_SOURCE_BASENAME).zip +SOAPYSDR_MASTER_SOURCE = https://github.com/pothosware/SoapySDR +SOAPYSDR_MASTER_SITE = $(call github,pothosware,SoapySDR) +SOAPYSDR_MASTER_INSTALL_STAGING = YES +SOAPYSDR_MASTER_LICENSE = Boost Software License 1.0 +SOAPYSDR_MASTER_LICENSE_FILES = LICENSE_1_0.txt +#SOAPYSDR_MASTER_DEPENDENCIES = python +SOAPYSDR_MASTER_CONF_OPTS = -DENABLE_PYTHON3=OFF -DENABLE_PYTHON=OFF +# -DCFLAGS=$(TARGET_CC) -DCXXFLAGS=$(TARGET_CXX) + +define SOAPYSDR_MASTER_EXTRACT_CMDS + echo $(@D) + unzip $(DL_DIR)/$(SOAPYSDR_MASTER_VERSION)/$(SOAPYSDR_MASTER_SOURCE_BASENAME).zip -d $(@D) + mv $(@D)/$(SOAPYSDR_MASTER_SOURCE_BASENAME)/* $(@D) + # rmdir $(@D)/$(SOAPYSDR_MASTER_SOURCE_BASENAME) +endef + +$(eval $(cmake-package)) + diff --git a/firmware/ori/package/soapysdr/Config.in b/firmware/ori/package/soapysdr/Config.in new file mode 100644 index 0000000..49b197e --- /dev/null +++ b/firmware/ori/package/soapysdr/Config.in @@ -0,0 +1,7 @@ +config BR2_PACKAGE_SOAPYSDR + bool "soapysdr" +# select BR2_PACKAGE_PYTHON + help + Vendor and platform neutral SDR support library + + https://github.com/pothosware/SoapySDR.git diff --git a/firmware/ori/package/soapysdr/soapysdr.hash_old b/firmware/ori/package/soapysdr/soapysdr.hash_old new file mode 100644 index 0000000..637f045 --- /dev/null +++ b/firmware/ori/package/soapysdr/soapysdr.hash_old @@ -0,0 +1,4 @@ +sha1 890145cbffb2725a2d69c5bfa5f3f416a1bcebdd soapy-sdr-0.6.1.tar.gz +sha1 c422dc9f4874f4308c35596926f63335cb0d5bec soapy-sdr-0.7.0.tar.gz +sha1 f2639510f2ba006c1f8f96e53de6809dbbf41c51 soapy-sdr-0.7.2.tar.gz +sha1 ba9122b1a617e050e67790eb26d26cc6ad661ac0 soapy-sdr-0.8.0.tar.gz diff --git a/firmware/ori/package/soapysdr/soapysdr.mk b/firmware/ori/package/soapysdr/soapysdr.mk new file mode 100644 index 0000000..b1696a6 --- /dev/null +++ b/firmware/ori/package/soapysdr/soapysdr.mk @@ -0,0 +1,27 @@ +################################################################################ +# +# soapysdr +# +################################################################################ + + +#SOAPYSDR_VERSION = master +SOAPYSDR_SOURCE_BASENAME = SoapySDR +SOAPYSDR_SOURCE = soapysdr/SoapySDR.zip +SOAPYSDR_SITE = $(call github,pothosware,SoapySDR,master) +SOAPYSDR_INSTALL_STAGING = YES +SOAPYSDR_LICENSE = Boost Software License 1.0 +SOAPYSDR_LICENSE_FILES = LICENSE_1_0.txt +#SOAPYSDR_MASTER_DEPENDENCIES = python +SOAPYSDR_CONF_OPTS = -DENABLE_PYTHON3=OFF -DENABLE_PYTHON=OFF +# -DCFLAGS=$(TARGET_CC) -DCXXFLAGS=$(TARGET_CXX) + +define SOAPYSDR_EXTRACT_CMDS + echo $(@D) + unzip $(DL_DIR)/$(SOAPYSDR_SOURCE) -d $(@D) + mv $(@D)/$(SOAPYSDR_SOURCE_BASENAME)/* $(@D) + # rmdir $(@D)/$(SOAPYSDR_MASTER_SOURCE_BASENAME) +endef + +$(eval $(cmake-package)) + diff --git a/firmware/ori/package/soapysdr/soapysdr.mk.vava b/firmware/ori/package/soapysdr/soapysdr.mk.vava new file mode 100644 index 0000000..230459a --- /dev/null +++ b/firmware/ori/package/soapysdr/soapysdr.mk.vava @@ -0,0 +1,22 @@ +################################################################################ +# +# soapysdr +# +################################################################################ + + +SOAPYSDR_VERSION = FETCH_HEAD +#SOAPYSDR_SOURCE_BASENAME = soapysdr-$(SOAPYSDR_VERSION) +#SOAPYSDR_SOURCE = SoapySDR-$(SOAPYSDR_VERSION).zip +#SOAPYSDR_SITE = $(call github,pothosware,SoapySDR,$(SOAPYSDR_VERSION)) +SOAPYSDR_SITE = git://github.com/pothosware/SoapySDR.git +SOAPYSDR_INSTALL_STAGING = YES +SOAPYSDR_LICENSE = Boost Software License 1.0 +SOAPYSDR_LICENSE_FILES = LICENSE_1_0.txt +#SOAPYSDR_DEPENDENCIES = python +SOAPYSDR_CONF_OPTS = -DENABLE_PYTHON3=OFF -DENABLE_PYTHON=OFF +# -DCFLAGS=$(TARGET_CC) -DCXXFLAGS=$(TARGET_CXX) + + +$(eval $(cmake-package)) + diff --git a/firmware/ori/package/srt/Config.in b/firmware/ori/package/srt/Config.in new file mode 100644 index 0000000..eb30537 --- /dev/null +++ b/firmware/ori/package/srt/Config.in @@ -0,0 +1,9 @@ +config BR2_PACKAGE_SRT + bool "srt-master" + help + transport protocol for ultra low (sub-second) latency live + github (release) + + https://github.com/Haivision/srt + + diff --git a/firmware/ori/package/srt/srt-master.mk b/firmware/ori/package/srt/srt-master.mk new file mode 100644 index 0000000..4b7b3d5 --- /dev/null +++ b/firmware/ori/package/srt/srt-master.mk @@ -0,0 +1,15 @@ +################################################################################ +# +# srt +# +################################################################################ + + +SRT_VERSION = master +SRT_SITE = $(call github,Haivision,srt,$(SRT_VERSION)) +SRT_INSTALL_STAGING = YES +SRT_CONF_OPTS = -DENABLE_ENCRYPTION=OFF -DENABLE_STATIC=OFF + +$(eval $(cmake-package)) + + diff --git a/firmware/ori/package/suscan/Config.in b/firmware/ori/package/suscan/Config.in new file mode 100644 index 0000000..4866d3c --- /dev/null +++ b/firmware/ori/package/suscan/Config.in @@ -0,0 +1,10 @@ +config BR2_PACKAGE_SUSCAN + bool "suscan" + depends on BR2_TOOLCHAIN_HAS_THREADS +# depends on BR2_PACKAGE_SNDFILE + help + Suscan is a realtime DSP processing library. It provides a set of useful abstractions to perform dynamic digital signal analysis and demodulation. + + https://github.com/BatchDrake/suscan +comment "sigutils needs a toolchain w/ threads" + depends on !BR2_TOOLCHAIN_HAS_THREADS diff --git a/firmware/ori/package/suscan/suscan.mk b/firmware/ori/package/suscan/suscan.mk new file mode 100644 index 0000000..d4cd292 --- /dev/null +++ b/firmware/ori/package/suscan/suscan.mk @@ -0,0 +1,24 @@ +################################################################################ +# +# SUSCAN +# +################################################################################ + + +SUSCAN_VERSION = v0.1.0 +#SUSCAN_VERSION = 050ad2ef10f6c8f8a67a1d8ed6f049e9dd8fc5fc +SUSCAN_SITE = https://github.com/BatchDrake/suscan +SUSCAN_SOURCE = suscan-0.1.0.tar.gz +#SUSCAN-$(SUSCAN_VERSION).tar.gz + +#SUSCAN_VERSION = 571cc9aeccb2004d81032cea484324aacb1a5852 + +SUSCAN_SITE_METHOD = git + +SUSCAN_INSTALL_STAGING = YES +SUSCAN_LICENSE = GPL-2.0 +SUSCAN_LICENSE_FILES = COPYING +SUSCAN_DEPENDENCIES += + + +$(eval $(cmake-package)) diff --git a/firmware/ori/package/tx-tools/Config.in b/firmware/ori/package/tx-tools/Config.in new file mode 100644 index 0000000..d319420 --- /dev/null +++ b/firmware/ori/package/tx-tools/Config.in @@ -0,0 +1,10 @@ +config BR2_PACKAGE_TX-TOOLS + bool "tx-tools" + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_PACKAGE_SOAPYSDR + help + tx_sdr tool for transmitting data to SDRs, based on rtl_sdr from librtlsdr, and rx_sdr from rx_tools, using the SoapySDR vendor-neutral SDR support library, intended to support a wide range of TX-capable devices. + + https://github.com/triq-org/tx_tools +comment "tx_tools needs a toolchain w/ threads" + depends on !BR2_TOOLCHAIN_HAS_THREADS diff --git a/firmware/ori/package/tx-tools/tx_tools.mk b/firmware/ori/package/tx-tools/tx_tools.mk new file mode 100644 index 0000000..4ad7770 --- /dev/null +++ b/firmware/ori/package/tx-tools/tx_tools.mk @@ -0,0 +1,16 @@ +################################################################################ +# +# TX_TOOLS +# +################################################################################ +TX_TOOLS_VERSION := 252989cb06a7fe2f453f11ea9ebc72111fe77122 +TX_TOOLS_SITE := https://github.com/triq-org/tx_tools +TX_TOOLS_SITE_METHOD := git +TX_TOOLS_INSTALL_TARGET := YES +TX_TOOLS_INSTALL_STAGING := YES +TX_TOOLS_LICENSE := GPL-2.0 +TX_TOOLS_LICENSE_FILES := COPYING +TX_TOOLS_DEPENDENCIES += soapysdr +TX_TOOLS_CONF_OPTS := -DCFLAGS=$(TARGET_CC) -DCXXFLAGS=$(TARGET_CXX) + +$(eval $(cmake-package)) diff --git a/firmware/scripts/53-adi-plutosdr-usb.rules b/firmware/scripts/53-adi-plutosdr-usb.rules new file mode 100644 index 0000000..344f90e --- /dev/null +++ b/firmware/scripts/53-adi-plutosdr-usb.rules @@ -0,0 +1,11 @@ +# allow "plugdev" group read/write access to ADI PlutoSDR devices +# DFU Device +SUBSYSTEM=="usb", ATTRS{idVendor}=="0456", ATTRS{idProduct}=="b674", MODE="0664", GROUP="plugdev" +SUBSYSTEM=="usb", ATTRS{idVendor}=="2fa2", ATTRS{idProduct}=="5a32", MODE="0664", GROUP="plugdev" +# SDR Device +SUBSYSTEM=="usb", ATTRS{idVendor}=="0456", ATTRS{idProduct}=="b673", MODE="0664", GROUP="plugdev" +SUBSYSTEM=="usb", ATTRS{idVendor}=="2fa2", ATTRS{idProduct}=="5a02", MODE="0664", GROUP="plugdev" +# tell the ModemManager (part of the NetworkManager suite) that the device is not a modem, +# and don't send AT commands to it +SUBSYSTEM=="usb", ATTRS{idVendor}=="0456", ATTRS{idProduct}=="b673", ENV{ID_MM_DEVICE_IGNORE}="1" +SUBSYSTEM=="usb", ATTRS{idVendor}=="2fa2", ATTRS{idProduct}=="5a02", ENV{ID_MM_DEVICE_IGNORE}="1" diff --git a/firmware/scripts/create_fsbl_project.tcl b/firmware/scripts/create_fsbl_project.tcl new file mode 100644 index 0000000..4cbf1b7 --- /dev/null +++ b/firmware/scripts/create_fsbl_project.tcl @@ -0,0 +1,7 @@ +hsi open_hw_design build/system_top.xsa +set cpu_name [lindex [hsi get_cells -filter {IP_TYPE==PROCESSOR}] 0] + +setws ./build/sdk +app create -name fsbl -hw build/system_top.xsa -proc $cpu_name -os standalone -lang C -template {Zynq FSBL} +app config -name fsbl -set build-config release +app build -name fsbl diff --git a/firmware/scripts/e200.its b/firmware/scripts/e200.its new file mode 100644 index 0000000..ab039fd --- /dev/null +++ b/firmware/scripts/e200.its @@ -0,0 +1,174 @@ +/* + * U-Boot uImage source file with multiple kernels, ramdisks and FDT blobs + * This example makes use of the 'loadables' field + */ + +/* + * fdt get addr foo /images/fdt@1 data + */ + +/dts-v1/; + +/ { + description = "Configuration to load fpga before Kernel"; + magic = "ITB PlutoSDR (ADALM-PLUTO)"; + #address-cells = <1>; + images { + + fdt@1 { + description = "zynq-pluto-sdr"; + data = /incbin/("../build/zynq-e200.dtb"); + type = "flat_dt"; + arch = "arm"; + compression = "none"; + }; + + fdt@2 { + description = "zynq-pluto-sdr"; + data = /incbin/("../build/zynq-e200.dtb"); + type = "flat_dt"; + arch = "arm"; + compression = "none"; + }; + + fdt@3 { + description = "zynq-pluto-sdr"; + data = /incbin/("../build/zynq-e200.dtb"); + type = "flat_dt"; + arch = "arm"; + compression = "none"; + }; + + fpga@1 { + description = "FPGA"; + data = /incbin/("../build/system_top.bit"); + type = "fpga"; + arch = "arm"; + compression = "none"; + load = <0xF000000>; + hash@1 { + algo = "md5"; + }; + }; + + linux_kernel@1 { + description = "Linux"; + data = /incbin/("../build/zImage"); + type = "kernel"; + arch = "arm"; + os = "linux"; + compression = "none"; + load = <0x8000>; + entry = <0x8000>; + hash@1 { + algo = "md5"; + }; + }; + ramdisk@1 { + description = "Ramdisk"; + data = /incbin/("../build/rootfs.cpio.gz"); + type = "ramdisk"; + arch = "arm"; + os = "linux"; + compression = "gzip"; + hash@1 { + algo = "md5"; + }; + }; + + }; + + configurations { + default = "config@0"; + config@0 { + description = "Linux with fpga RevA"; + fdt = "fdt@1"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + /* all below is currently RevB ! */ + + config@1 { + description = "Linux with fpga RevB"; + fdt = "fdt@2"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@2 { + description = "Linux with fpga RevB"; + fdt = "fdt@2"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@3 { + description = "Linux with fpga RevB"; + fdt = "fdt@2"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@4 { + description = "Linux with fpga RevB"; + fdt = "fdt@2"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@5 { + description = "Linux with fpga RevB"; + fdt = "fdt@2"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@6 { + description = "Linux with fpga RevB"; + fdt = "fdt@2"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + + config@7 { + description = "Linux with fpga RevB"; + fdt = "fdt@2"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@8 { /* This one is actually RevC */ + description = "Linux with fpga RevC"; + fdt = "fdt@3"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@9 { /* This one is actually RevB */ + description = "Linux with fpga RevB"; + fdt = "fdt@2"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@10 { + description = "Linux with fpga RevB"; + fdt = "fdt@2"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + }; +}; diff --git a/firmware/scripts/e200.mk b/firmware/scripts/e200.mk new file mode 100644 index 0000000..39c1769 --- /dev/null +++ b/firmware/scripts/e200.mk @@ -0,0 +1,10 @@ + +# Target specific constants go here + +#HDF_URL:=http://github.com/analogdevicesinc/plutosdr-fw/releases/download/${LATEST_TAG}/system_top.hdf +TARGET_DTS_FILES:= zynq-e200.dtb +COMPLETE_NAME:=ANTSDR +ZIP_ARCHIVE_PREFIX:=antsdr +DEVICE_VID:=0x0456 +DEVICE_PID:=0xb673 + diff --git a/firmware/scripts/get_default_envs.sh b/firmware/scripts/get_default_envs.sh new file mode 100755 index 0000000..844ff6e --- /dev/null +++ b/firmware/scripts/get_default_envs.sh @@ -0,0 +1,34 @@ +#! /bin/bash +# +# Copyright (C) 2016, Lukasz Majewski +# +# SPDX-License-Identifier: GPL-2.0+ +# + +# This file extracts default envs from built u-boot +# usage: get_default_envs.sh > u-boot-env-default.txt +set -ue + +ENV_OBJ_FILE="env_common.o" +ENV_OBJ_FILE_COPY="copy_${ENV_OBJ_FILE}" + +echoerr() { echo "$@" 1>&2; } + +path=$(readlink -f $0) +env_obj_file_path=$(find ${path%/scripts*} -not -path "*/spl/*" \ + -name "${ENV_OBJ_FILE}") +[ -z "${env_obj_file_path}" ] && \ + { echoerr "File '${ENV_OBJ_FILE}' not found!"; exit 1; } + +cp ${env_obj_file_path} ${ENV_OBJ_FILE_COPY} + +# NOTE: objcopy saves its output to file passed in +# (copy_env_common.o in this case) +${CROSS_COMPILE}objcopy -O binary -j ".rodata.default_environment" ${ENV_OBJ_FILE_COPY} + +# Replace default '\0' with '\n' and sort entries +tr '\0' '\n' < ${ENV_OBJ_FILE_COPY} | sort -u + +rm ${ENV_OBJ_FILE_COPY} + +exit 0 diff --git a/firmware/scripts/legal_info_html.sh b/firmware/scripts/legal_info_html.sh new file mode 100755 index 0000000..2b36e93 --- /dev/null +++ b/firmware/scripts/legal_info_html.sh @@ -0,0 +1,368 @@ +#!/bin/bash +# +# Copyright 2018(c) Analog Devices, Inc. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# - Neither the name of Analog Devices, Inc. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# - The use of this software may or may not infringe the patent rights +# of one or more patent holders. This license does not release you +# from the requirement that you obtain separate licenses from these +# patent holders to use this software. +# +# THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE ARE DISCLAIMED. +# +# IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY +# RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +TARGET=$1 +TARGET_VERSIONS=$2 + +MANIFEST=buildroot/output/legal-info/manifest.csv +MANIFEST_SORT=/tmp/manifest.?? +sort ${MANIFEST} > ${MANIFEST_SORT} + +PACKAGE=1 +VERSION=2 +LICENSE=3 +LICENSE_FILES=4 +SOURCE_ARCHIVE=5 +SOURCE_SITE=6 + +FILE=build/LICENSE.html + +html_header () { + echo "" > ${FILE} + echo "" >> ${FILE} + echo "" >> ${FILE} + echo "" >> ${FILE} + echo "" >> ${FILE} + echo "" >> ${FILE} + echo "$1" >> ${FILE} + echo "" >> ${FILE} + echo "" >> ${FILE} + echo "" >> ${FILE} + echo "" >> ${FILE} + echo "" >> ${FILE} + echo "" >> ${FILE} + echo "" >> ${FILE} + + echo "
" >> ${FILE} + echo "" >> ${FILE} + echo "\"Analog" >> ${FILE} + echo "" >> ${FILE} + echo "
" >> ${FILE} + echo "Index" >> ${FILE} + echo "
" >> ${FILE} + + echo "
" >> ${FILE} + echo "
" >> ${FILE} +} + +html_footer () { + echo "" >> ${FILE} + echo "" >> ${FILE} +} + +html_h1 () { + echo "

$1

" >> ${FILE} +} + +html_h1_id () { + echo "" >> ${FILE} + echo "

$1

" >> ${FILE} +} + +html_h2 () { + echo "

$1

" >> ${FILE} +} + +html_p () { + echo "

$1

" >> ${FILE} +} + +html_pre_file () { + echo "
" >> ${FILE}
+	# get the file, but html sanitize a few things
+	find $1 -type f -exec cat {} + | sed -e "s/\o14//g" -e "s/\o302\o251/\©/g" -e "s/'/\'/g" -e "s//\>/g" >> ${FILE}
+	echo "
" >> ${FILE} +} + +html_li () { + echo "
  • $1
  • " >> ${FILE} +} + +html_li_start () { + echo "
      " >> ${FILE} +} + +html_li_stop () { + echo "
    " >> ${FILE} +} + +html_hr () { + echo "
    " >> ${FILE} +} + +get_column () { + echo ${1} | cut -d \" -f $(expr ${2} \* 2) +} + +get_version () { + cat ${TARGET_VERSIONS} | grep ${1} | cut -d ' ' -f2 +} + +package_list_items () { + html_li_start + html_li "Version: ${1}" + html_li "License: ${2}" + html_li "Source Site: ${3}" + html_li_stop +} + +strstr () { + echo $1 | grep --quiet $2 +} + +# package_table_items $((var++)) Linux $(get_version linux) "GPLv2" "https://github.com/analogdevicesinc/linux" +# 1 2 3 4 5 +package_table_items () { + url=$5 + + command curl -h > /dev/null 2>&1 + if [ "$?" = "0" ] ; then + if $(strstr $url sourceforge) ; then + url=$(echo ${url} | sed -e 's/downloads\.//' -e 's/project/projects/') + fi + while [ 1 ] ; do + if $(strstr $url "ftp://") ; then + break + fi + # We should use curl's -L, but then we couldn't track things + tmp=$(curl -IsS $url) + if [ $(echo "$tmp" | head -1 | grep -E "301|302" | wc -l) -gt 0 ] ; then + _url=$url + url=$(echo "$tmp" | grep -i "Location:" | awk '{print $2}' | sed -e 's/^[ \t]*//;s/[ \t]*$//') + url=${url%$'\r'} + if [[ $url != http* ]] ; then + url=$_url + break + fi + elif [ $(echo "$tmp" | head -1 | grep "404" | wc -l) -gt 0 ] ; then + url=$(echo $url | sed 's#/[^/]*$##' ) + elif [ $(echo "$tmp" | head -1 | grep "200" | wc -l) -gt 0 ] ; then + break + else + echo "err: ${url}" $(echo "$tmp" | head -1) "" >> ${FILE} + echo unknown error while trying ${url} + echo "${tmp}" + break + fi + done + fi + + echo "" >> ${FILE} + echo "${2}" >> ${FILE} + echo "${4}" >> ${FILE} + echo "${3}" >> ${FILE} + echo -n "" >> ${FILE} + if $(strstr $5 github) ; then + echo -n "Github" >> ${FILE} + elif $(strstr $5 sourceforge) ; then + echo -n "SourceForge" >> ${FILE} + elif $(strstr $5 freedesktop) ; then + echo -n "Freedesktop" >> ${FILE} + elif $(strstr $5 debian) ; then + echo -n "Debian Project" >> ${FILE} + elif $(strstr $5 kernel) ; then + echo -n "Kernel.org" >> ${FILE} + else + echo -n "Project" >> ${FILE} + fi + echo "" >> ${FILE} + echo "" >> ${FILE} +} + +# Borrowed concepts from : +# https://github.com/chadbraunduin/markdown.bash/blob/master/markdown.sh +# MIT License +# Copyright (c) 2016 Chad Braun-Duin +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +convert_md2html () { +temp_file="/tmp/markdown.$$" +cat "$1" > "$temp_file" +# All of this below business is for reference-style links and images +# We need to loop across newlines and not spaces +IFS=' +' +refs=$(sed -nr "/\[.+\]/p" "$1") +for ref in $refs +do + ref=$(echo -n "$ref" | sed "s/^.*\[/\[/") + ref_id=$(echo -n "$ref" | sed -nr "s/^\[(.+)\].*/\1/p" | tr -d '\n') + ref_url=$(echo -n "$ref" | sed -nr "s/^\[.+\]\((.+)/\1/p" | cut -d' ' -f1 | tr -d '\n') + ref_title=$(echo -n "$ref" | sed -nr "s/^\[.+\](.+) \"(.+)\"/\2/p" | sed 's@|@!@g' | tr -d '\n' | sed 's/).*$//') + # reference-style image using the label + sed -ri "s|!\[([^]]+)\]\[($ref_id)\]|\"\1\"|gI" "$temp_file" + # reference-style link using the label + sed -ri "s|\[($ref_id)\].*\($ref_url \"$ref_title\"\)|\1|gI" "$temp_file" + # implicit reference-style + sed -ri "s|!\[($ref_id)\]\[\]|\"\1\"|gI" "$temp_file" + # implicit reference-style + sed -ri "s|\[($ref_id)\]\[\]|\1|gI" "$temp_file" +done + +# delete the reference lines +sed -ri "/^\[.+\]: +/d" "$temp_file" +sed -nri "/^# /,/^# / { /^# /d ; p } " "$temp_file" +sed -ri -e 's/^$/

    /' "$temp_file" +cat ${temp_file} +rm ${temp_file} +} + +### main + +html_header "${TARGET} Legal Information" + +html_h1 "Legal Information" +html_h1 "${TARGET} Firmware $(get_version device-fw)" + +convert_md2html LICENSE.md >> ${FILE} + +echo "

    " >> ${FILE} +html_h2 "Written Offer" + +echo "

    As described above, the firmware included in the ${TARGET} contains copyrighted software that is released and distributed under many licenses, including the GPL. +A copy of the licenses are included in this file (below)." >> ${FILE} +if [ "$TARGET" == "PlutoSDR" ] ; then +echo "You may obtain the complete Corresponding Source code from us for a period of three years after our last shipment of this product, which will be no earlier than " >> ${FILE} +date --date="3 years 6 months" +"%d%b%Y" >> ${FILE} +echo ", by sending a money order or check for \$15 (USD) to:

    +
    +Director, Open Source Program Office
    +Analog Devices
    +Citypoint
    +65 Haymarket Terrace
    +Edinburgh EH5 3PN
    +United Kingdom
    +
    +

    Please write “source for the ${TARGET}” in the memo line of your payment. +Since the source does not fit on a DVD-RW, it will be delivered on a USB Thumb drive (hence the higher cost than just DVD or CD).

    +

    You will also find the source on-line, and are encouraged to obtain it for zero cost, at the project web sites.

    +
    " >> ${FILE} +else # not PlutoSDR +echo "Since you, the end user built this from source, for ${TARGET}, and didn't get a binary, there is no requirement for a written offer. +" >> ${FILE} +fi + +html_h2 "NO WARRANTY" + +echo "
    " >> ${FILE}
    +cat LICENSE.md | sed  -n '1,/# NO WARRANTY/!p' | sed "1d" >> ${FILE}
    +echo "
    " >> ${FILE} + +### Table of packages +html_h1 "Open source components/packages:" + +var=0 +echo "

    Version Information:

    " >> ${FILE} +echo "" >> ${FILE} +echo "" >> ${FILE} +echo "" >> ${FILE} +echo "" >> ${FILE} +echo "" >> ${FILE} +echo "" >> ${FILE} +echo "" >> ${FILE} +echo "" >> ${FILE} +echo "" >> ${FILE} +echo "" >> ${FILE} +package_table_items $((var++)) Linux $(get_version linux) "GPLv2" "https://github.com/analogdevicesinc/linux" +package_table_items $((var++)) U-Boot $(get_version u-boot-xlnx) "GPLv2" "https://github.com/analogdevicesinc/u-boot-xlnx" +while read -r line +do + package=$(get_column "${line}" $PACKAGE) + + if [ "$package" == "PACKAGE" ];then + continue + fi + + version=$(get_column "${line}" $VERSION) + license_file=$(get_column "${line}" $LICENSE_FILES) + license=$(get_column "${line}" $LICENSE) + source_site=$(get_column "${line}" $SOURCE_SITE) + + package_table_items $((var++)) $package $version $license $source_site + +done < "${MANIFEST_SORT}" + +echo "" >> ${FILE} +echo "
    PackageLicenseVersionLocation
    " >> ${FILE} + +var=0 +### Linux +html_hr +html_h1_id "Package: linux" "$((var++))" +package_list_items $(get_version linux) "GPLv2" "https://github.com/analogdevicesinc/linux" +html_h2 "License:" +html_pre_file linux/COPYING +html_hr +### U-Boot +html_h1_id "Package: u-boot" "$((var++))" +package_list_items $(get_version u-boot-xlnx) "GPLv2" "https://github.com/analogdevicesinc/u-boot-xlnx" +html_h2 "License:" +html_pre_file u-boot-xlnx/Licenses/gpl-2.0.txt +html_hr + +#### All other Buildroot Packages +while read -r line +do + package=$(get_column "${line}" $PACKAGE) + + if [ "$package" == "PACKAGE" ];then + continue + fi + + version=$(get_column "${line}" $VERSION) + license_file=$(get_column "${line}" $LICENSE_FILES) + license=$(get_column "${line}" $LICENSE) + source_site=$(get_column "${line}" $SOURCE_SITE) + + html_h1_id "Package: $package" "$((var++))" + + package_list_items $version $license $source_site + + html_h2 "License:" + html_pre_file "$(dirname $MANIFEST)/licenses/$package-$version/" + html_hr +done < "${MANIFEST_SORT}" + +html_footer + +rm ${MANIFEST_SORT} diff --git a/firmware/scripts/pluto.its b/firmware/scripts/pluto.its new file mode 100644 index 0000000..e69e417 --- /dev/null +++ b/firmware/scripts/pluto.its @@ -0,0 +1,174 @@ +/* + * U-Boot uImage source file with multiple kernels, ramdisks and FDT blobs + * This example makes use of the 'loadables' field + */ + +/* + * fdt get addr foo /images/fdt@1 data + */ + +/dts-v1/; + +/ { + description = "Configuration to load fpga before Kernel"; + magic = "ITB PlutoSDR (ADALM-PLUTO)"; + #address-cells = <1>; + images { + + fdt@1 { + description = "zynq-pluto-sdr"; + data = /incbin/("../build/zynq-pluto-sdr.dtb"); + type = "flat_dt"; + arch = "arm"; + compression = "none"; + }; + + fdt@2 { + description = "zynq-pluto-sdr-revb"; + data = /incbin/("../build/zynq-pluto-sdr-revb.dtb"); + type = "flat_dt"; + arch = "arm"; + compression = "none"; + }; + + fdt@3 { + description = "zynq-pluto-sdr-revc"; + data = /incbin/("../build/zynq-pluto-sdr-revc.dtb"); + type = "flat_dt"; + arch = "arm"; + compression = "none"; + }; + + fpga@1 { + description = "FPGA"; + data = /incbin/("../build/system_top.bit"); + type = "fpga"; + arch = "arm"; + compression = "none"; + load = <0xF000000>; + hash@1 { + algo = "md5"; + }; + }; + + linux_kernel@1 { + description = "Linux"; + data = /incbin/("../build/zImage"); + type = "kernel"; + arch = "arm"; + os = "linux"; + compression = "none"; + load = <0x8000>; + entry = <0x8000>; + hash@1 { + algo = "md5"; + }; + }; + ramdisk@1 { + description = "Ramdisk"; + data = /incbin/("../build/rootfs.cpio.gz"); + type = "ramdisk"; + arch = "arm"; + os = "linux"; + compression = "gzip"; + hash@1 { + algo = "md5"; + }; + }; + + }; + + configurations { + default = "config@0"; + config@0 { + description = "Linux with fpga RevA"; + fdt = "fdt@1"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + /* all below is currently RevB ! */ + + config@1 { + description = "Linux with fpga RevB"; + fdt = "fdt@2"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@2 { + description = "Linux with fpga RevB"; + fdt = "fdt@2"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@3 { + description = "Linux with fpga RevB"; + fdt = "fdt@2"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@4 { + description = "Linux with fpga RevB"; + fdt = "fdt@2"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@5 { + description = "Linux with fpga RevB"; + fdt = "fdt@2"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@6 { + description = "Linux with fpga RevB"; + fdt = "fdt@2"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + + config@7 { + description = "Linux with fpga RevB"; + fdt = "fdt@2"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@8 { /* This one is actually RevC */ + description = "Linux with fpga RevC"; + fdt = "fdt@3"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@9 { /* This one is actually RevB */ + description = "Linux with fpga RevB"; + fdt = "fdt@2"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@10 { + description = "Linux with fpga RevB"; + fdt = "fdt@2"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + }; +}; diff --git a/firmware/scripts/pluto.mk b/firmware/scripts/pluto.mk new file mode 100644 index 0000000..b3b48cb --- /dev/null +++ b/firmware/scripts/pluto.mk @@ -0,0 +1,9 @@ + +# Target specific constants go here + +TARGET_DTS_FILES:= zynq-pluto-sdr.dtb zynq-pluto-sdr-revb.dtb zynq-pluto-sdr-revc.dtb +COMPLETE_NAME:=PlutoSDR +ZIP_ARCHIVE_PREFIX:=plutosdr +DEVICE_VID:=0x0456 +DEVICE_PID:=0xb673 + diff --git a/firmware/scripts/plutoplus.its b/firmware/scripts/plutoplus.its new file mode 100644 index 0000000..37a8df4 --- /dev/null +++ b/firmware/scripts/plutoplus.its @@ -0,0 +1,157 @@ +/* + * U-Boot uImage source file with multiple kernels, ramdisks and FDT blobs + * This example makes use of the 'loadables' field + */ + +/* + * fdt get addr foo /images/fdt@1 data + */ + +/dts-v1/; + +/ { + description = "Configuration to load fpga before Kernel"; + magic = "ITB PlutoSDR (ADALM-PLUTO)"; + #address-cells = <1>; + images { + + fdt@1 { + description = "zynq-plutoplus"; + data = /incbin/("../build/zynq-plutoplus-maiasdr.dtb"); + type = "flat_dt"; + arch = "arm"; + compression = "none"; + }; + + fpga@1 { + description = "FPGA"; + data = /incbin/("../build/system_top.bit"); + type = "fpga"; + arch = "arm"; + compression = "none"; + load = <0xF000000>; + hash@1 { + algo = "md5"; + }; + }; + + linux_kernel@1 { + description = "Linux"; + data = /incbin/("../build/zImage"); + type = "kernel"; + arch = "arm"; + os = "linux"; + compression = "none"; + load = <0x8000>; + entry = <0x8000>; + hash@1 { + algo = "md5"; + }; + }; + ramdisk@1 { + description = "Ramdisk"; + data = /incbin/("../build/rootfs.cpio.gz"); + type = "ramdisk"; + arch = "arm"; + os = "linux"; + compression = "gzip"; + hash@1 { + algo = "md5"; + }; + }; + + }; + + configurations { + default = "config@0"; + /* TODO: can all these configurations be deleted except config@0 ? */ + config@0 { + description = "Linux with fpga Pluto+"; + fdt = "fdt@1"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@1 { + description = "Linux with fpga Pluto+"; + fdt = "fdt@1"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@2 { + description = "Linux with fpga Pluto+"; + fdt = "fdt@1"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@3 { + description = "Linux with fpga Pluto+"; + fdt = "fdt@1"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@4 { + description = "Linux with fpga Pluto+"; + fdt = "fdt@1"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@5 { + description = "Linux with fpga Pluto+"; + fdt = "fdt@1"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@6 { + description = "Linux with fpga Pluto+"; + fdt = "fdt@1"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + + config@7 { + description = "Linux with fpga Pluto+"; + fdt = "fdt@1"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@8 { + description = "Linux with fpga Pluto+"; + fdt = "fdt@1"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@9 { + description = "Linux with fpga Pluto+"; + fdt = "fdt@1"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + + config@10 { + description = "Linux with fpga Pluto+"; + fdt = "fdt@1"; + kernel = "linux_kernel@1"; + ramdisk = "ramdisk@1"; + fpga = "fpga@1"; + }; + }; +}; diff --git a/firmware/scripts/plutoplus.mk b/firmware/scripts/plutoplus.mk new file mode 100644 index 0000000..56448bb --- /dev/null +++ b/firmware/scripts/plutoplus.mk @@ -0,0 +1,8 @@ + +# Target specific constants go here + +TARGET_DTS_FILES:= zynq-plutoplus-maiasdr.dtb +COMPLETE_NAME:=Pluto+ +ZIP_ARCHIVE_PREFIX:=plutoplus +DEVICE_VID:=0x0456 +DEVICE_PID:=0xb673 diff --git a/firmware/scripts/run-xsdb.tcl b/firmware/scripts/run-xsdb.tcl new file mode 100644 index 0000000..b13ba7a --- /dev/null +++ b/firmware/scripts/run-xsdb.tcl @@ -0,0 +1,18 @@ +## JTAG bootstrap u-boot for initial SF/SPI flash programming +## Use Xilinx System Debug Tool +## type: xsdb run-xsdb.tcl + +#fpga -f system_top.bit + +connect +target 2 + +rst + +source ps7_init.tcl +ps7_init +ps7_post_config + +dow u-boot.elf +con +disconnect diff --git a/firmware/scripts/run.tcl b/firmware/scripts/run.tcl new file mode 100644 index 0000000..b14fd99 --- /dev/null +++ b/firmware/scripts/run.tcl @@ -0,0 +1,17 @@ +## JTAG bootstrap u-boot for initial SF/SPI flash programming +## Open Xilinx Command Line Tool +## type: xmd -tcl run.tcl + +#fpga -f system_top.bit + +connect arm hw +stop +xreset 64 + +source ps7_init.tcl +ps7_init +ps7_post_config + +dow u-boot.elf +run +disconnect 64 diff --git a/firmware/scripts/target_mtd_info.key b/firmware/scripts/target_mtd_info.key new file mode 100644 index 0000000..45f15f2 Binary files /dev/null and b/firmware/scripts/target_mtd_info.key differ diff --git a/firmware/test_onram.sh b/firmware/test_onram.sh new file mode 100755 index 0000000..c1dd8b5 --- /dev/null +++ b/firmware/test_onram.sh @@ -0,0 +1,4 @@ +#sshpass -p analog ssh root@pluto.local '/usr/sbin/pluto_reboot ram;' +#sleep 5 +sudo dfu-util -d 0456:b673,0456:b674 -D ./build/pluto.dfu -a firmware.dfu -R +