Working pi-gen with nodejs and other packages.
This commit is contained in:
parent
dc0fb57fb9
commit
f4e4d66a91
1
build.sh
1
build.sh
|
@ -1,5 +1,6 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
IMG_NAME='Raspbian'
|
||||
run_sub_stage()
|
||||
{
|
||||
log "Begin ${SUB_STAGE_DIR}"
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
IMG_SUFFIX="-lite"
|
|
@ -1,2 +0,0 @@
|
|||
NOOBS_NAME="Raspbian Lite"
|
||||
NOOBS_DESCRIPTION="A port of Debian Stretch for the Raspberry Pi (minimal version)"
|
4
stage3/02-wpantund/00-packages
Normal file
4
stage3/02-wpantund/00-packages
Normal file
|
@ -0,0 +1,4 @@
|
|||
dbus libreadline5
|
||||
#gcc g++ libdbus-1-dev libboost-dev libreadline-dev
|
||||
#libtool autoconf autoconf-archive
|
||||
#make
|
21
stage3/02-wpantund/00-run.sh
Executable file
21
stage3/02-wpantund/00-run.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
#install -m 755 files/wpantund ${ROOTFS_DIR}/usr/sbin/
|
||||
#install -m 755 files/wpanctl ${ROOTFS_DIR}/usr/bin/
|
||||
#install -d files/etc ${ROOTFS_DIR}/
|
||||
#install -d files/usr ${ROOTFS_DIR}/
|
||||
|
||||
install -d ${ROOTFS_DIR}/usr/local/bin/ ${ROOTFS_DIR}/usr/local/sbin/ ${ROOTFS_DIR}/usr/local/libexec/wpantund/
|
||||
install -m 755 files/usr/local/bin/wpanctl ${ROOTFS_DIR}/usr/local/bin/
|
||||
install -m 755 files/usr/local/sbin/wpantund ${ROOTFS_DIR}/usr/local/sbin/
|
||||
install -m 755 files/usr/local/libexec/wpantund/ncp-spinel.la ${ROOTFS_DIR}/usr/local/libexec/wpantund/
|
||||
install -m 755 files/usr/local/libexec/wpantund/ncp-dummy.so ${ROOTFS_DIR}/usr/local/libexec/wpantund/
|
||||
install -m 755 files/usr/local/libexec/wpantund/ncp-dummy.la ${ROOTFS_DIR}/usr/local/libexec/wpantund/
|
||||
install -m 755 files/usr/local/libexec/wpantund/ncp-spinel.so ${ROOTFS_DIR}/usr/local/libexec/wpantund/
|
||||
install -m 644 files/etc/dbus-1/system.d/wpantund.conf ${ROOTFS_DIR}/etc/dbus-1/system.d/
|
||||
install -m 644 files/etc/wpantund.conf ${ROOTFS_DIR}/etc/
|
||||
install -m 644 files/etc/systemd/system/wpantund.service ${ROOTFS_DIR}/etc/systemd/system/
|
||||
|
||||
on_chroot << EOF
|
||||
systemctl disable wpantund
|
||||
EOF
|
44
stage3/02-wpantund/files/etc/dbus-1/system.d/wpantund.conf
Normal file
44
stage3/02-wpantund/files/etc/dbus-1/system.d/wpantund.conf
Normal file
|
@ -0,0 +1,44 @@
|
|||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig>
|
||||
<policy user="root">
|
||||
<allow own="org.wpantund"/>
|
||||
<allow own="org.wpantund.wpanctl"/>
|
||||
|
||||
<allow send_interface="org.wpantund.Join"/>
|
||||
<allow send_interface="org.wpantund.Form"/>
|
||||
<allow send_interface="org.wpantund.Leave"/>
|
||||
<allow send_interface="org.wpantund.Attach"/>
|
||||
<allow send_interface="org.wpantund.Status"/>
|
||||
<allow send_interface="org.wpantund.Reset"/>
|
||||
<allow send_interface="org.wpantund.NetScanStart"/>
|
||||
<allow send_interface="org.wpantund.NetScanStop"/>
|
||||
<allow send_interface="org.wpantund.List"/>
|
||||
|
||||
|
||||
<!-- Deprecated -->
|
||||
<allow own="com.nestlabs.WPANTunnelDriver"/>
|
||||
<allow own="com.nestlabs.WPANTunnelDriver.wpanctl"/>
|
||||
<allow send_destination="com.nestlabs.WPANTunnelDriver"/>
|
||||
<allow send_interface="com.nestlabs.WPANTunnelDriver.Join"/>
|
||||
<allow send_interface="com.nestlabs.WPANTunnelDriver.Form"/>
|
||||
<allow send_interface="com.nestlabs.WPANTunnelDriver.Leave"/>
|
||||
<allow send_interface="com.nestlabs.WPANTunnelDriver.Resume"/>
|
||||
<allow send_interface="com.nestlabs.WPANTunnelDriver.Scan"/>
|
||||
<allow send_interface="com.nestlabs.WPANTunnelDriver.PermitJoin"/>
|
||||
<allow send_interface="com.nestlabs.WPANTunnelDriver.Status"/>
|
||||
<allow send_interface="com.nestlabs.WPANTunnelDriver.List"/>
|
||||
</policy>
|
||||
<policy at_console="true">
|
||||
<allow send_destination="org.wpantund"/>
|
||||
|
||||
<!-- Deprecated -->
|
||||
<allow send_destination="com.nestlabs.WPANTunnelDriver"/>
|
||||
</policy>
|
||||
<policy context="default">
|
||||
<deny send_destination="org.wpantund"/>
|
||||
|
||||
<!-- Deprecated -->
|
||||
<deny send_destination="com.nestlabs.WPANTunnelDriver"/>
|
||||
</policy>
|
||||
</busconfig>
|
10
stage3/02-wpantund/files/etc/systemd/system/wpantund.service
Normal file
10
stage3/02-wpantund/files/etc/systemd/system/wpantund.service
Normal file
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=Sub-GHz network daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/sbin/wpantund -o NCPSocketName /dev/ttyACM0 -o WPANInterfaceName wpan0
|
||||
StandardOutput=null
|
||||
|
||||
[Install]
|
||||
Alias=wpantund
|
154
stage3/02-wpantund/files/etc/wpantund.conf
Normal file
154
stage3/02-wpantund/files/etc/wpantund.conf
Normal file
|
@ -0,0 +1,154 @@
|
|||
# Example wpantund configuration file
|
||||
#
|
||||
|
||||
# The desired name of the network interface (not supported on all platforms)
|
||||
# Default value is `wpan0`.
|
||||
#
|
||||
#Config:TUN:InterfaceName wpan0
|
||||
|
||||
# Path to serial port used to communicate with the NCP.
|
||||
# Has special meaning when prefixed with `system:` or `serial:`.
|
||||
# If the path is an IPv4 address/port, it will use a TCP socket.
|
||||
#
|
||||
#Config:NCP:SocketPath "/dev/tty.usbmodem1234"
|
||||
#Config:NCP:SocketPath "127.0.0.1:4901"
|
||||
#Config:NCP:SocketPath "system:/usr/local/sbin/spi-server -p - -s /dev/spidev2.0"
|
||||
#Config:NCP:SocketPath "serial:/dev/ttyO1,raw,b115200,crtscts=1"
|
||||
|
||||
# The desired NCP driver to use.
|
||||
# Default value is `spinel`.
|
||||
#
|
||||
#Config:NCP:DriverName spinel
|
||||
|
||||
# Describes what type of serial reliability layer should be used, if any.
|
||||
# Generally this is set appropriately automatically, so you usually
|
||||
# don't need to bother setting this.
|
||||
#
|
||||
# Optional. Default value is automatic.
|
||||
#
|
||||
#Config:NCP:ReliabilityLayer libsoot
|
||||
|
||||
# The default transmit power of the NCP, measured in dBm
|
||||
# (0 dBm is one milliwatt, can be negative)
|
||||
#
|
||||
# Optional. Default value is NCP-specific.
|
||||
#
|
||||
#NCP:TXPower 0
|
||||
|
||||
# The CCA threshold value, measured in dBm
|
||||
#
|
||||
# Optional. Default value is NCP-specific.
|
||||
#
|
||||
#NCP:CCAThreshold -70
|
||||
|
||||
# Path to reset pin. This socket is opened and values sent to it
|
||||
# based on the desired reset state. wpantund sends `0\n` to
|
||||
# assert the reset pin and sends `1\n` to deassert the reset pin.
|
||||
# Can be used with the same `system:` and `serial:` prefixes defined
|
||||
# above to handle special cases. On linux, you would generally
|
||||
# set this to the `value` file of the RESET GPIO.
|
||||
#
|
||||
# Optional. If not set, only software resets will be possible.
|
||||
#
|
||||
#Config:NCP:HardResetPath "/sys/class/gpio/gpio49/value"
|
||||
|
||||
# Path to power pin. The semantics are similar to those for
|
||||
# `NCPHardResetPath` above, except that wpantund sends `0\n` to
|
||||
# indicate that the NCP power should be disabled and `1\n` to
|
||||
# indicate that the NCP power should be enabled.
|
||||
#
|
||||
# Optional. If not set, only software induced sleep will be used
|
||||
# for low-power states.
|
||||
#
|
||||
#Config:NCP:PowerPath "/sys/class/gpio/gpio11/value"
|
||||
|
||||
# Syslog mask adjustment. This property is a set of
|
||||
# boolean masks for manipulating the bitmask used by `syslog()`.
|
||||
# The string can contain the following words that represent
|
||||
# the associated bit. The presence of the word in the string
|
||||
# indicates that that bit should be set. Prefixing the word with
|
||||
# a `-` (dash/minus) indicates that that bit should be cleared.
|
||||
# The following keywords are supported:
|
||||
#
|
||||
# * `all` (All log levels)
|
||||
# * `emerg`
|
||||
# * `alert`
|
||||
# * `crit`
|
||||
# * `err`
|
||||
# * `warn`
|
||||
# * `notice`
|
||||
# * `info`
|
||||
# * `debug`
|
||||
#
|
||||
# So, for example, to get all log messages except debugging
|
||||
# messages, you would use `all -debug`.
|
||||
#
|
||||
# Optional. The default value for non-debug builds is
|
||||
# `all -info -debug`.
|
||||
#
|
||||
#Daemon:SyslogMask "all -info -debug"
|
||||
|
||||
# Drop root privileges to the given user (and that user's group)
|
||||
# after setting up all network interfaces and socket connections.
|
||||
# Doing this helps mitigate the implications of security exploits,
|
||||
# but may interfere with how hard resets are performed for certain
|
||||
# NCPs.
|
||||
#
|
||||
# Optional. Default value is empty, which means that privileges
|
||||
# are not dropped.
|
||||
#
|
||||
#Config:Daemon:PrivDropToUser "nobody"
|
||||
|
||||
# Call `chroot()` to change the root directory to the directory
|
||||
# indicated, after setting up all network interfaces and socket
|
||||
# connections, but before privileges are dropped for `PrivDropToUser`
|
||||
# (if set). Doing this helps mitigate the implications of security
|
||||
# exploits, but may interfere with how hard resets are performed
|
||||
# for certain NCPs.
|
||||
#
|
||||
# Optional. Default value is empty, which means that `chroot` is
|
||||
# not called.
|
||||
#
|
||||
#Config:Daemon:Chroot "/var/empty"
|
||||
|
||||
# Automatic firmware update enable/disable. This flag determines
|
||||
# if the automatic firmware update mechanism (which uses the
|
||||
# properties `FirmwareCheckCommand` and `FirmwareUpgradeCommand`,
|
||||
# described below) is enabled or disabled. This flag is used
|
||||
# when the driver determines that it doesn't know how to talk to
|
||||
# the version of the firmware that is running on the NCP.
|
||||
#
|
||||
# If set to true, the NCP association state will then be set to
|
||||
# `upgrading` and the firmware update process will begin. If set to
|
||||
# false, the NCP association state will change to `fault`.
|
||||
#
|
||||
# This property may be changed at runtime to more strictly
|
||||
# control when a firmware update is allowed to take place.
|
||||
#
|
||||
# Optional. The default value is false---which will prevent
|
||||
# automatic wpantund-driven firmware updates.
|
||||
#
|
||||
#Daemon:AutoFirmwareUpdate true
|
||||
|
||||
# Firmware update check command. This command is executed with
|
||||
# the retrieved version string of the NCP appended as the last
|
||||
# argument. If the command returns `0`, a firmware update is
|
||||
# necessary. This configuration option is fairly useless without
|
||||
# the `FirmwareUpgradeCommand` option also being set, defined below.
|
||||
#
|
||||
# Optional. If left blank, wpantund-driven firmware updates will
|
||||
# be disabled.
|
||||
#
|
||||
#Config:NCP:FirmwareCheckCommand "test 'MyFunStack/1.0' !="
|
||||
#Config:NCP:FirmwareCheckCommand "/usr/local/sbin/zb-loader --is-update-required /usr/share/ncp-firmware/ip-modem-app.bin"
|
||||
|
||||
# Firmware upgrade command. This is the command that is actually
|
||||
# executed that performs the firmware update. Before calling this
|
||||
# command, `wpantund` disconnects entirely from the NCP. While
|
||||
# this command is executing, the association state reported
|
||||
# for this interface will be `upgrading`.
|
||||
#
|
||||
# Optional. If left blank, wpantund-driven firmware updates will
|
||||
# be disabled.
|
||||
#
|
||||
#Config:NCP:FirmwareUpgradeCommand "/usr/local/sbin/zb-loader /dev/ttyO1 --app-easyload /usr/share/ncp-firmware/ip-modem-app.bin"
|
BIN
stage3/02-wpantund/files/usr/local/bin/wpanctl
Executable file
BIN
stage3/02-wpantund/files/usr/local/bin/wpanctl
Executable file
Binary file not shown.
41
stage3/02-wpantund/files/usr/local/libexec/wpantund/ncp-dummy.la
Executable file
41
stage3/02-wpantund/files/usr/local/libexec/wpantund/ncp-dummy.la
Executable file
|
@ -0,0 +1,41 @@
|
|||
# ncp-dummy.la - a libtool library file
|
||||
# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11
|
||||
#
|
||||
# Please DO NOT delete this file!
|
||||
# It is necessary for linking the library.
|
||||
|
||||
# The name that we can dlopen(3).
|
||||
dlname='ncp-dummy.so'
|
||||
|
||||
# Names of this library.
|
||||
library_names='ncp-dummy.so ncp-dummy.so ncp-dummy.so'
|
||||
|
||||
# The name of the static archive.
|
||||
old_library=''
|
||||
|
||||
# Linker flags that can not go in dependency_libs.
|
||||
inherited_linker_flags=''
|
||||
|
||||
# Libraries that this one depends upon.
|
||||
dependency_libs=' -lutil'
|
||||
|
||||
# Names of additional weak libraries provided by this library
|
||||
weak_library_names=''
|
||||
|
||||
# Version information for ncp-dummy.
|
||||
current=0
|
||||
age=0
|
||||
revision=0
|
||||
|
||||
# Is this an already installed library?
|
||||
installed=yes
|
||||
|
||||
# Should we warn about portability when linking against -modules?
|
||||
shouldnotlink=yes
|
||||
|
||||
# Files to dlopen/dlpreopen
|
||||
dlopen=''
|
||||
dlpreopen=''
|
||||
|
||||
# Directory that this library needs to be installed in:
|
||||
libdir='/usr/local/libexec/wpantund'
|
BIN
stage3/02-wpantund/files/usr/local/libexec/wpantund/ncp-dummy.so
Executable file
BIN
stage3/02-wpantund/files/usr/local/libexec/wpantund/ncp-dummy.so
Executable file
Binary file not shown.
41
stage3/02-wpantund/files/usr/local/libexec/wpantund/ncp-spinel.la
Executable file
41
stage3/02-wpantund/files/usr/local/libexec/wpantund/ncp-spinel.la
Executable file
|
@ -0,0 +1,41 @@
|
|||
# ncp-spinel.la - a libtool library file
|
||||
# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11
|
||||
#
|
||||
# Please DO NOT delete this file!
|
||||
# It is necessary for linking the library.
|
||||
|
||||
# The name that we can dlopen(3).
|
||||
dlname='ncp-spinel.so'
|
||||
|
||||
# Names of this library.
|
||||
library_names='ncp-spinel.so ncp-spinel.so ncp-spinel.so'
|
||||
|
||||
# The name of the static archive.
|
||||
old_library=''
|
||||
|
||||
# Linker flags that can not go in dependency_libs.
|
||||
inherited_linker_flags=''
|
||||
|
||||
# Libraries that this one depends upon.
|
||||
dependency_libs=' -lutil'
|
||||
|
||||
# Names of additional weak libraries provided by this library
|
||||
weak_library_names=''
|
||||
|
||||
# Version information for ncp-spinel.
|
||||
current=0
|
||||
age=0
|
||||
revision=0
|
||||
|
||||
# Is this an already installed library?
|
||||
installed=yes
|
||||
|
||||
# Should we warn about portability when linking against -modules?
|
||||
shouldnotlink=yes
|
||||
|
||||
# Files to dlopen/dlpreopen
|
||||
dlopen=''
|
||||
dlpreopen=''
|
||||
|
||||
# Directory that this library needs to be installed in:
|
||||
libdir='/usr/local/libexec/wpantund'
|
BIN
stage3/02-wpantund/files/usr/local/libexec/wpantund/ncp-spinel.so
Executable file
BIN
stage3/02-wpantund/files/usr/local/libexec/wpantund/ncp-spinel.so
Executable file
Binary file not shown.
BIN
stage3/02-wpantund/files/usr/local/sbin/wpantund
Executable file
BIN
stage3/02-wpantund/files/usr/local/sbin/wpantund
Executable file
Binary file not shown.
143
stage3/03-nodejs/00-run.sh
Executable file
143
stage3/03-nodejs/00-run.sh
Executable file
|
@ -0,0 +1,143 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
BASE_DIR=$(pwd)
|
||||
|
||||
|
||||
########################
|
||||
# Install dependencies #
|
||||
########################
|
||||
#dpkg --add-architecture i386
|
||||
|
||||
apt-get update
|
||||
apt-get install -y make python build-essential
|
||||
apt-get install -y curl
|
||||
apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
|
||||
#apt-get install -y gcc-multilib g++-multilib
|
||||
#apt-get install -y libc6-dev-i386
|
||||
|
||||
#apt-get install -y libc6-dev
|
||||
|
||||
apt-get --purge remove node
|
||||
apt-get --purge remove nodejs
|
||||
curl -sL https://deb.nodesource.com/setup_6.x | /bin/bash -e -
|
||||
apt-get install -y nodejs
|
||||
npm install -g npm@5.3.0
|
||||
#npm cache clean --force
|
||||
|
||||
#ln -s /usr/include/asm-generic /usr/include/asm
|
||||
|
||||
|
||||
#################
|
||||
# Checkout node #
|
||||
#################
|
||||
NODE_BUILD_PATH=${BASE_DIR}/build/node
|
||||
if [ ! -d "$NODE_BUILD_PATH" ]; then
|
||||
git clone https://github.com/nodejs/node.git $NODE_BUILD_PATH
|
||||
fi
|
||||
cd $NODE_BUILD_PATH
|
||||
git checkout v6.11.2
|
||||
|
||||
|
||||
#######################
|
||||
# Cross-build Node.js #
|
||||
#######################
|
||||
|
||||
#export BASEDIR=$(pwd)
|
||||
#export STAGING_DIR=${BASEDIR}/staging_dir
|
||||
#export V8SOURCE=${BASEDIR}/v8m-rb
|
||||
export PREFIX=arm-linux-gnueabihf-
|
||||
export LIBPATH=${ROOTFS_DIR}/usr/lib/arm-linux-gnueabihf/
|
||||
export TARGET_PATH=${ROOTFS_DIR}
|
||||
|
||||
# ARM cross-compile exports
|
||||
export CC=${PREFIX}gcc
|
||||
export CXX=${PREFIX}g++
|
||||
export AR=${PREFIX}ar
|
||||
export RANLIB=${PREFIX}ranlib
|
||||
export LINK=${PREFIX}g++
|
||||
export CPP="${PREFIX}gcc -E"
|
||||
export STRIP=${PREFIX}strip
|
||||
export OBJCOPY=${PREFIX}objcopy
|
||||
export LD=${PREFIX}g++
|
||||
export OBJDUMP=${PREFIX}objdump
|
||||
export NM=${PREFIX}nm
|
||||
export AS=${PREFIX}as
|
||||
export PS1="[${PREFIX}] \w$ "
|
||||
#export LDFLAGS='-Wl,-L'${LIBPATH}
|
||||
export LDFLAGS='-Wl,-rpath-link '${LIBPATH}
|
||||
|
||||
export TARGET_ARCH="-march=armv7l"
|
||||
#export TARGET_TUNE="-mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mthumb-interwork -mno-thumb"
|
||||
export CXX_TARGET_ARCH="-march-armv7l"
|
||||
|
||||
export V8_TARGET_ARCH="-march-armv7l"
|
||||
export CXX_host="g++ -m32"
|
||||
export CC_host="gcc -m32"
|
||||
export LINK_host="g++ -m32"
|
||||
|
||||
|
||||
make clean
|
||||
make distclean
|
||||
|
||||
#./configure --prefix=${TARGET_PATH} --dest-cpu=arm --dest-os=linux --without-snapshot --with-arm-float-abi=hard --with-arm-fpu=vfpv3
|
||||
./configure --prefix=${TARGET_PATH} --dest-cpu=arm --dest-os=linux --without-snapshot --with-arm-float-abi=hard --with-arm-fpu=vfpv3 --without-intl
|
||||
|
||||
#./configure --without-snapshot --dest-cpu=arm --dest-os=linux --with-arm-float-abi=softfp --with-intl=full-icu --download=all
|
||||
|
||||
make snapshot=off -j4
|
||||
make install
|
||||
|
||||
|
||||
#########################
|
||||
# Install node packages #
|
||||
#########################
|
||||
cd ${BASE_DIR}
|
||||
|
||||
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||
# WAR for node-gyp build
|
||||
#mkdir -p ${ROOTFS_DIR}/lib/node_modules/node-red/node_modules/bcrypt
|
||||
#chown -R $USER:$GROUP ${ROOTFS_DIR}/lib/node_modules/node-red/node_modules/bcrypt
|
||||
|
||||
#mkdir -p ${ROOTFS_DIR}/lib/node_modules/node-red/node_modules/bcrypt/build
|
||||
#chown -R $USER:$GROUP ${ROOTFS_DIR}/lib/node_modules/node-red/node_modules/bcrypt/build
|
||||
|
||||
#ls -la ${ROOTFS_DIR}/lib/node_modules/node-red/node_modules/bcrypt/build
|
||||
#ls -la ${ROOTFS_DIR}
|
||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
|
||||
export npm_config_arch=arm
|
||||
export npm_config_nodedir=${NODE_BUILD_PATH}
|
||||
|
||||
npm_install () {
|
||||
npm install -g --prefix=${TARGET_PATH} --target_arch=arm --target_platform=linux "$1"
|
||||
}
|
||||
|
||||
#npm --prefix=${TARGET_PATH} --target_arch=arm --target_platform=linux cache clean --force
|
||||
|
||||
npm_install npm@5.3.0
|
||||
npm_install node-red
|
||||
npm_install coap
|
||||
npm_install node-red-dashboard
|
||||
|
||||
# Running `npm_install repos/node-red-contrib-juliet` fails, this is a workaround
|
||||
cd repos/node-red-contrib-juliet
|
||||
npm install --target_arch=arm --target_platform=linux
|
||||
npm_install
|
||||
|
||||
|
||||
#######################################
|
||||
# Install WPAN service Node-RED flows #
|
||||
#######################################
|
||||
cd ${BASE_DIR}
|
||||
|
||||
NODE_DIR=${ROOTFS_DIR}/home/pi/.node-red
|
||||
install -m 755 -d ${NODE_DIR}
|
||||
install -m 755 -d ${NODE_DIR}/scripts/
|
||||
install -m 644 -D files/flows_*.json ${NODE_DIR}/
|
||||
install -m 755 -D files/*.sh ${NODE_DIR}/scripts/
|
||||
install -m 755 -D files/usbreset ${ROOTFS_DIR}/usr/sbin/
|
||||
|
||||
on_chroot << EOF
|
||||
chown -R pi:pi /home/pi/.node-red
|
||||
EOF
|
||||
|
14
stage3/03-nodejs/01-run.sh
Executable file
14
stage3/03-nodejs/01-run.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
export NODE_SERVICE_DIR=node-service
|
||||
|
||||
git clone https://github.com/node-red/raspbian-deb-package.git ${NODE_SERVICE_DIR}
|
||||
|
||||
install -m 644 ${NODE_SERVICE_DIR}/resources/nodered.service ${ROOTFS_DIR}/lib/systemd/system/
|
||||
install -m 755 ${NODE_SERVICE_DIR}/resources/node-red-start ${ROOTFS_DIR}/usr/bin
|
||||
install -m 755 ${NODE_SERVICE_DIR}/resources/node-red-stop ${ROOTFS_DIR}/usr/bin
|
||||
install -m 755 ${NODE_SERVICE_DIR}/resources/node-red-log ${ROOTFS_DIR}/usr/bin
|
||||
|
||||
on_chroot << EOF
|
||||
systemctl enable nodered
|
||||
EOF
|
1
stage3/03-nodejs/files/flows_raspberrypi.json
Normal file
1
stage3/03-nodejs/files/flows_raspberrypi.json
Normal file
File diff suppressed because one or more lines are too long
1
stage3/03-nodejs/files/flows_raspberrypi_cred.json
Normal file
1
stage3/03-nodejs/files/flows_raspberrypi_cred.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"$":"f240ab1c9f66a39a3e45e7de7649ac74L9Q="}
|
BIN
stage3/03-nodejs/files/usbreset
Executable file
BIN
stage3/03-nodejs/files/usbreset
Executable file
Binary file not shown.
9
stage3/03-nodejs/files/wpan_configure.sh
Executable file
9
stage3/03-nodejs/files/wpan_configure.sh
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
XPANID=`cat /home/pi/.node-red/scripts/wpan_network_xpanid`
|
||||
NETWORK_KEY=`cat /home/pi/.node-red/scripts/wpan_network_key`
|
||||
NETWORK_NAME=`cat /home/pi/.node-red/scripts/wpan_network_name`
|
||||
|
||||
wpanctl setprop Network:XPANID $XPANID
|
||||
wpanctl setprop Network:Key $NETWORK_KEY
|
||||
wpanctl form -c 11 $NETWORK_NAME
|
13
stage3/03-nodejs/files/wpan_new_configuration.sh
Executable file
13
stage3/03-nodejs/files/wpan_new_configuration.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
CONFIG_ROOT=/home/pi/.node-red/scripts
|
||||
|
||||
# Insecure /dev/urandom can be used xpanid and name
|
||||
XPANID=`head -c 64 /dev/urandom | sha256sum -b | head -c 16`
|
||||
NETWORK_NAME=RPi-`head -c 64 /dev/urandom | sha256sum -b | head -c 4`
|
||||
|
||||
echo -n $XPANID > $CONFIG_ROOT/wpan_network_xpanid
|
||||
echo -n $NETWORK_NAME > $CONFIG_ROOT/wpan_network_name
|
||||
|
||||
# Secure /dev/random MUST be used when generating network key
|
||||
head -c 64 /dev/random | sha256sum -b | head -c 32 > $CONFIG_ROOT/wpan_network_key
|
8
stage3/03-nodejs/files/wpan_reset_usb.sh
Executable file
8
stage3/03-nodejs/files/wpan_reset_usb.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
USBNAME=STMicroelectronics
|
||||
LSUSB=$(lsusb | grep --ignore-case $USBNAME)
|
||||
FOLD="/dev/bus/usb/"$(echo $LSUSB | cut --delimiter=' ' --fields='2')"/"$(echo $LSUSB | cut --delimiter=' ' --fields='4' | tr --delete ":")
|
||||
echo $LSUSB
|
||||
echo "-----------"
|
||||
echo $FOLD
|
||||
usbreset $FOLD
|
14
stage3/03-nodejs/files/wpan_restart.sh
Executable file
14
stage3/03-nodejs/files/wpan_restart.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
ROOT_DIR=`dirname $0`
|
||||
|
||||
$ROOT_DIR/wpan_reset_usb.sh
|
||||
sleep 1
|
||||
|
||||
systemctl restart wpantund.service
|
||||
sleep 1
|
||||
|
||||
$ROOT_DIR/wpan_configure.sh
|
||||
sleep 1
|
||||
|
||||
wpanctl commissioner -e
|
1
stage3/03-nodejs/repos/node-red-contrib-juliet
Submodule
1
stage3/03-nodejs/repos/node-red-contrib-juliet
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 1733029da8a9ac402c6204fb4c74d99f2eb71fe4
|
1
stage3/04-hwrng/00-packages
Normal file
1
stage3/04-hwrng/00-packages
Normal file
|
@ -0,0 +1 @@
|
|||
rng-tools
|
5
stage3/04-hwrng/00-run-chroot.sh
Executable file
5
stage3/04-hwrng/00-run-chroot.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo 'HRNGDEVICE=/dev/hwrng' | tee --append /etc/default/rng-tools
|
||||
|
||||
systemctl enable rng-tools
|
1
stage3/EXPORT_IMAGE
Normal file
1
stage3/EXPORT_IMAGE
Normal file
|
@ -0,0 +1 @@
|
|||
IMG_SUFFIX='-nodejs'
|
|
@ -1 +0,0 @@
|
|||
IMG_SUFFIX="-4GB"
|
|
@ -1 +0,0 @@
|
|||
IMG_SUFFIX=""
|
|
@ -1,2 +0,0 @@
|
|||
NOOBS_NAME="Raspbian"
|
||||
NOOBS_DESCRIPTION="A port of Debian Stretch for the Raspberry Pi (full desktop version)"
|
Loading…
Reference in New Issue
Block a user