8000 Sidekiqz2 build integration by commodo · Pull Request #18 · analogdevicesinc/plutosdr-fw · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Sidekiqz2 build integration #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Vim swap files
*.swp

# Object files
*.o
*.ko
Expand Down
75 changes: 46 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,36 @@ 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")

TARGET ?= pluto
SUPPORTED_TARGETS:=pluto sidekiqz2

# 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
TARGETS = build/$(TARGET).frm
ifeq (1, ${HAVE_VIVADO})
TARGETS += build/boot.frm jtag-bootstrap
endif
else
TARGETS = build/pluto.dfu build/uboot-env.dfu build/pluto.frm
TARGETS = build/$(TARGET).dfu build/uboot-env.dfu build/$(TARGET).frm
ifeq (1, ${HAVE_VIVADO})
TARGETS += build/boot.dfu build/boot.frm jtag-bootstrap
endif
endif

all: $(TARGETS) zip-all legal-info
ifeq ($(findstring $(TARGET),$(SUPPORTED_TARGETS)),)
all:
@echo "Invalid `TARGET variable ; valid values are: pluto, sidekiqz2" &&
exit 1
else
all: clean-build $(TARGETS) zip-all legal-info
endif

.NOTPARALLEL: all

TARGET_DTS_FILES:=$(foreach dts,$(TARGET_DTS_FILES),build/$(dts))

build:
mkdir -p $@
Expand All @@ -36,7 +51,7 @@ build:
### u-boot ###

u-boot-xlnx/u-boot u-boot-xlnx/tools/mkimage:
make -C u-boot-xlnx ARCH=arm zynq_pluto_defconfig
make -C u-boot-xlnx ARCH=arm zynq_$(TARGET)_defconfig
make -C u-boot-xlnx ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) UBOOTVERSION="$(UBOOT_VERSION)"

.PHONY: u-boot-xlnx/u-boot
Expand All @@ -53,7 +68,7 @@ build/uboot-env.bin: build/uboot-env.txt
### Linux ###

linux/arch/arm/boot/zImage:
make -C linux ARCH=arm zynq_pluto_defconfig
make -C linux ARCH=arm zynq_$(TARGET)_defconfig
make -C linux -j $(NCORES) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage UIMAGE_LOADADDR=0x8000

.PHONY: linux/arch/arm/boot/zImage
Expand All @@ -73,27 +88,29 @@ build/%.dtb: linux/arch/arm/boot/dts/%.dtb | build
### Buildroot ###

buildroot/output/images/rootfs.cpio.gz:
@echo device-fw $(VERSION)> $(CURDIR)/buildroot/board/pluto/VERSIONS
@$(foreach dir,$(VSUBDIRS),echo $(dir) $(shell cd $(dir) && git describe --abbrev=4 --dirty --always --tags) >> $(CURDIR)/buildroot/board/pluto/VERSIONS;)
make -C buildroot ARCH=arm zynq_pluto_defconfig
make -C buildroot legal-info
scripts/legal_info_html.sh "PlutoSDR" "$(CURDIR)/buildroot/board/pluto/VERSIONS"
cp build/LICENSE.html buildroot/board/pluto/msd/LICENSE.html
make -C buildroot TOOLCHAIN_EXTERNAL_INSTALL_DIR= ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) BUSYBOX_CONFIG_FILE=$(CURDIR)/buildroot/board/pluto/busybox-1.25.0.config all
@echo device-fw $(VERSION)> $(CURDIR)/buildroot/board/$(TARGET)/VERSIONS
@$(foreach dir,$(VSUBDIRS),echo $(dir) $(shell cd $(dir) && git describe --abbrev=4 --dirty --always --tags) >> $(CURDIR)/buildroot/board/$(TARGET)/VERSIONS;)
make -C buildroot ARCH=arm zynq_$(TARGET)_defconfig
ADI_LEGAL=$(ADI_LEGAL) make -C buildroot legal-info
ADI_LEGAL=$(ADI_LEGAL) scripts/legal_info_html.sh "$(COMPLETE_NAME)" "$(CURDIR)/buildroot/board/$(TARGET)/VERSIONS"
cp build/LICENSE.html buildroot/board/$(TARGET)/msd/LICENSE.html
make -C buildroot TOOLCHAIN_EXTERNAL_INSTALL_DIR= ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) BUSYBOX_CONFIG_FILE=$(CURDIR)/buildroot/board/$(TARGET)/busybox-1.25.0.config all

.PHONY: buildroot/output/images/rootfs.cpio.gz

build/rootfs.cpio.gz: buildroot/output/images/rootfs.cpio.gz | build
cp $< $@

build/pluto.itb: u-boot-xlnx/tools/mkimage build/zImage build/rootfs.cpio.gz build/zynq-pluto-sdr.dtb build/zynq-pluto-sdr-revb.dtb build/zynq-pluto-sdr-revc.dtb build/system_top.bit
u-boot-xlnx/tools/mkimage -f scripts/pluto.its $@
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.hdf: | build
ifeq (1, ${HAVE_VIVADO})
bash -c "source $(VIVADO_SETTINGS) && make -C hdl/projects/pluto && cp hdl/projects/pluto/pluto.sdk/system_top.hdf $@"
bash -c "source $(VIVADO_SETTINGS) && make -C hdl/projects/$(TARGET) && cp hdl/projects/$(TARGET)/$(TARGET).sdk/system_top.hdf $@"
else
wget -T 3 -t 1 -N --directory-prefix build http://github.com/analogdevicesinc/plutosdr-fw/releases/download/${LATEST_TAG}/system_top.hdf
ifneq ($(HDF_URL),)
wget -T 3 -t 1 -N --directory-prefix build $(HDF_URL)
endif
endif

### TODO: Build system_top.hdf from src if dl fails - need 2016.2 for that ...
Expand All @@ -116,7 +133,7 @@ build/boot.bin: build/sdk/fsbl/Release/fsbl.elf build/u-boot.elf

### MSD update firmware file ###

build/pluto.frm: build/pluto.itb
build/$(TARGET).frm: build/$(TARGET).itb
md5sum $< | cut -d ' ' -f 1 > $@.md5
cat $< $@.md5 > $@

Expand All @@ -127,12 +144,12 @@ build/boot.frm: build/boot.bin build/uboot-env.bin scripts/target_mtd_info.key

build/%.dfu: build/%.bin
cp $< $<.tmp
dfu-suffix -a $<.tmp -v 0x0456 -p 0xb673
dfu-suffix -a $<.tmp -v $(DEVICE_VID) -p $(DEVICE_PID)
mv $<.tmp $@

build/pluto.dfu: build/pluto.itb
build/$(TARGET).dfu: build/$(TARGET).itb
cp $< $<.tmp
dfu-suffix -a $<.tmp -v 0x0456 -p 0xb673
dfu-suffix -a $<.tmp -v $(DEVICE_VID) -p $(DEVICE_PID)
mv $<.tmp $@

clean-build:
Expand All @@ -148,10 +165,10 @@ clean:
rm -rf build/*

zip-all: $(TARGETS)
zip -j build/plutosdr-fw-$(VERSION).zip $^
zip -j build/$(ZIP_ARCHIVE_PREFIX)-fw-$(VERSION).zip $^

dfu-pluto: build/pluto.dfu
dfu-util -D build/pluto.dfu -a firmware.dfu
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
Expand All @@ -160,22 +177,22 @@ dfu-sf-uboot: build/boot.dfu build/uboot-env.dfu
dfu-util -D build/uboot-env.dfu -a uboot-env.dfu
dfu-util -e

dfu-all: build/pluto.dfu build/boot.dfu build/uboot-env.dfu
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/pluto.dfu -a firmware.dfu && \
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/pluto.dfu
sshpass -p analog ssh root@pluto '/usr/sbin/device_reboot ram;'
dfu-ram: build/$(TARGET).dfu
sshpass -p analog ssh root@$(TARGET) '/usr/sbin/device_reboot ram;'
sleep 5
dfu-util -D build/pluto.dfu -a firmware.dfu
dfu-util -D build/$(TARGET).dfu -a firmware.dfu
dfu-util -e

jtag-bootstrap: build/u-boot.elf build/sdk/hw_0/ps7_init.tcl build/sdk/hw_0/system_top.bit scripts/run.tcl
$(CROSS_COMPILE)strip build/u-boot.elf
zip -j build/plutosdr-$@-$(VERSION).zip $^
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 -C buildroot/output staging
Expand Down
3 changes: 3 additions & 0 deletions scripts/53-adi-plutosdr-usb.rules
Original file line number Diff line number Diff line change
@@ -1,8 +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"
8 changes: 6 additions & 2 deletions scripts/legal_info_html.sh
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,9 @@ echo "<div class="boxed">" >> ${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).
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 01Jan2021, by sending a money order or check for \$15 (USD) to:
A copy of the licenses are included in this file (below)." >> ${FILE}
if [ "$ADI_LEGAL" == "1" ] ; 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 01Jan2021, by sending a money order or check for \$15 (USD) to:
<pre>
GPL Compliance
Systems Development Group
Expand All @@ -276,6 +277,9 @@ Please write “<i>source for the ${TARGET}</i>” in the memo line of your paym
Since the source does not fit on a DVD-RW, it will be delivered on a USB Thumb drive (hense the higher cost than just DVD or CD).
<p><b>You will also find a the source on-line, and are encouraged to obtain it for zero cost, at the project web sites.</b></p>
</div>" >> ${FILE}
else # not ADI_LEGAL
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"

Expand Down
12 changes: 12 additions & 0 deletions scripts/pluto.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# Target specific constants go here

ADI_LEGAL:=1

HDF_URL:=http://github.com/analogdevicesinc/plutosdr-fw/releases/download/${LATEST_TAG}/system_top.hdf
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

174 changes: 174 additions & 0 deletions scripts/sidekiqz2.its
Original file line number Diff line number Diff line change
@@ -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 Sidekiq Z2";
#address-cells = <1>;
images {

fdt@1 {
description = "zynq-sidekiqz2";
data = /incbin/("../build/zynq-sidekiqz2-revb.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
};

fdt@2 {
description = "zynq-sidekiqz2-revb";
data = /incbin/("../build/zynq-sidekiqz2-revb.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
};

fdt@3 {
description = "zynq-sidekiqz2-revc";
data = /incbin/("../build/zynq-sidekiqz2-revb.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";
};
};
};
Loading
0