Skip to content

Commit

Permalink
Merge pull request #42 from lone-boy/master
Browse files Browse the repository at this point in the history
add antsdr-e310v2 support
  • Loading branch information
lone-boy authored Feb 17, 2023
2 parents 89fdf11 + 729d6e9 commit 8bd7684
Show file tree
Hide file tree
Showing 260 changed files with 1,825,627 additions and 148 deletions.
21 changes: 20 additions & 1 deletion firmware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ $(error " 3] export VIVADO_VERSION=v20xx.x")
endif

TARGET ?= e200
SUPPORTED_TARGETS:=e200 e310v2


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


all : build build/uboot-env.txt build/uImage build/device_tree.dtb build/system_top.bit build/BOOT.bin \
build/rootfs.cpio.gz
Expand Down Expand Up @@ -92,6 +103,10 @@ buildroot/output/images/rootfs.cpio.gz:
build/rootfs.cpio.gz : buildroot/output/images/rootfs.cpio.gz | build
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 $@


## hdf
build/system_top.hdf: | build
bash -c "source $(VIVADO_SETTINGS) && make -C fpga/antsdr_$(TARGET) -j $(NCORES) && cp fpga/antsdr_$(TARGET)/antsdr_$(TARGET)/antsdr_$(TARGET).sdk/system_top.hdf $@"
Expand All @@ -116,11 +131,12 @@ build/boot.bif : build/u-boot.elf build/fsbl.elf
build/BOOT.bin : build/boot.bif
bash -c "source $(VIVADO_SETTINGS) && bootgen -image build/boot.bif -o i build/BOOT.bin"


SDIMGDIR=$(CURDIR)/build_sdimg
sdimg: build/
mkdir $(SDIMGDIR)
cp build/BOOT.bin $(SDIMGDIR)/
cp build/antsdr_$(TARGET).bit $(SDIMGDIR)/
cp build/antsdr_$(TARGET).bit $(SDIMGDIR)/antsdr.bit
cp build/uImage $(SDIMGDIR)/
cp build/uboot-env.txt $(SDIMGDIR)/uEnv.txt
cp build/device_tree.dtb $(SDIMGDIR)/devicetree.dtb
Expand All @@ -131,9 +147,12 @@ sdimg: build/
clean-build:
rm -rf build
rm -rf build_sdimg
make -C fpga/antsdr_$(TARGET) clean


clean: clean-build
make -C linux ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) distclean
make -C u-boot-xlnx ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) distclean
make -C fpga/antsdr_$(TARGET) clean
rm -rf build_sdimg

2 changes: 1 addition & 1 deletion firmware/buildroot/board/e200/post-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ ${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}/S40network ${TARGET_DIR}/etc/init.d/
# ${INSTALL} -D -m 0755 ${BOARD_DIR}/S41network ${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/
Expand All @@ -66,6 +65,7 @@ ${INSTALL} -D -m 0755 ${BOARD_DIR}/ifupdown.sh ${TARGET_DIR}/lib/mdev/ifupdown.s
${INSTALL} -D -m 0644 ${BOARD_DIR}/input-event-daemon.conf ${TARGET_DIR}/etc/
${INSTALL} -D -m 0755 ${BOARD_DIR}/net_set ${TARGET_DIR}/sbin
${INSTALL} -D -m 0755 ${BOARD_DIR}/e200 ${TARGET_DIR}/sbin
${INSTALL} -D -m 0755 ${BOARD_DIR}/ip_set ${TARGET_DIR}/bin
${INSTALL} -D -m 0755 ${BOARD_DIR}/S90device_start.sh ${TARGET_DIR}/etc/init.d/

${INSTALL} -D -m 0755 ${BOARD_DIR}/wpa_supplicant/* ${TARGET_DIR}/etc/wpa_supplicant/
Expand Down
23 changes: 23 additions & 0 deletions firmware/buildroot/board/e310v2/S10mdev
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh
#
# Start mdev....
#

case "$1" in
start)
echo -n "Starting mdev: "
echo /sbin/mdev >/proc/sys/kernel/hotplug
/sbin/mdev -s

[ $? = 0 ] && echo "OK" || echo "FAIL"
;;
stop)
;;
restart|reload)
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

exit $?
21 changes: 21 additions & 0 deletions firmware/buildroot/board/e310v2/S15watchdog
Original file line number Diff line number Diff line change
@@ -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 $?
26 changes: 26 additions & 0 deletions firmware/buildroot/board/e310v2/S20urandom
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#! /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 [email protected]
#

[ -c /dev/urandom ] || exit 0
#. /etc/default/rcS

case "$1" in
start|"")
echo -n "Starting initializing random number generator: "

dmesg | sha512sum > /dev/urandom
[ $? = 0 ] && echo "OK" || echo "FAIL"
;;
stop)

;;
*)
echo "Usage: urandom {start|stop}" >&2
exit 1
;;
esac
20 changes: 20 additions & 0 deletions firmware/buildroot/board/e310v2/S21misc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#! /bin/sh


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
[ $? = 0 ] && echo "OK" || echo "FAIL"
;;
stop)

;;
*)
echo "Usage: $0 {start|stop}" >&2
exit 1
;;
esac
55 changes: 55 additions & 0 deletions firmware/buildroot/board/e310v2/S40network
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/sh
#
# Start the network....
#

# Debian ifupdown needs the /run/network lock directory

source /etc/device_config

create_system_files () {

IFAC=/etc/network/interfaces

HOSTNAME=`fw_printenv -n hostname 2> /dev/null || cat /etc/hostname`
echo $HOSTNAME > /etc/hostname

ETH_IPADDR=`fw_printenv -n ipaddr_eth 2> /dev/null || echo 192.168.1.10`
ETH_NETMASK=`fw_printenv -n netmask_eth 2> /dev/null || echo 255.255.255.0`

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
else
echo -e "iface eth0 inet dhcp\n" >> $IFAC
fi
}

mkdir -p /run/network

case "$1" in
start)
create_system_files
printf "Starting network: "
/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 $?

28 changes: 28 additions & 0 deletions firmware/buildroot/board/e310v2/S41network
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/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
[ $? = 0 ] && echo "OK" || echo "FAIL"
;;

stop)
echo -n "Stopping dhcpd Daemon & httpd Server: "
start-stop-daemon -K -q -p /var/run/udhcpd.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
2 changes: 1 addition & 1 deletion firmware/buildroot/board/e310v2/S90device_start.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
case "$1" in
start)
echo -n "Starting device start : "
start-stop-daemon --start --background /sbin/e200
start-stop-daemon --start --background /sbin/e310v2
start-stop-daemon --start --background /sbin/net_set
[ $? = 0 ] && echo "OK" || echo "FAIL"
;;
Expand Down
87 changes: 87 additions & 0 deletions firmware/buildroot/board/e310v2/automounter.sh
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 8bd7684

Please sign in to comment.