Skip to content

Instantly share code, notes, and snippets.

@zhanglongqi
Last active January 19, 2021 07:20
Show Gist options
  • Save zhanglongqi/d606e6bd42ee92b9f92207aaee5c1393 to your computer and use it in GitHub Desktop.
Save zhanglongqi/d606e6bd42ee92b9f92207aaee5c1393 to your computer and use it in GitHub Desktop.

disable autostarted services

sudo systemctl disable bonescript-autorun.service bonescript.socket node-red.socket nginx.service cloud9.socket

share internet from host by USB

on BBB

/sbin/route add default gw 192.168.7.1 metric 1
echo "nameserver 8.8.8.8" >> /etc/resolv.conf

on host

iptables --table nat --append POSTROUTING --out-interface wlp2s0 -j MASQUERADE
iptables --append FORWARD --in-interface enx7c669d6df111 -j ACCEPT
echo 1 >/proc/sys/net/ipv4/ip_forward

Turn off all LEDs

echo none > /sys/class/leds/beaglebone\:green\:usr0/trigger
echo none > /sys/class/leds/beaglebone\:green\:usr1/trigger
echo none > /sys/class/leds/beaglebone\:green\:usr2/trigger
echo none > /sys/class/leds/beaglebone\:green\:usr3/trigger
USER LED GPIO PIN
User led 0 GPIO1_21
User led 1 GPIO1_22
User led 2 GPIO1_23
User led 3 GPIO1_24

Disable USB image file

Add USB_IMAGE_FILE_DISABLED=yes to /etc/default/bb-boot

Disable etherent interface generated from CDC driver

Add USB_NETWORK_CDC_DISABLED=yes to /etc/default/bb-boot

cross compile

GNU compiler

sudo apt install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf

export CC=arm-linux-gnueabihf-gcc
export CXX=arm-linux-gnueabihf-g++
export AR=arm-linux-gnueabihf-ar
export RANLIB=arm-linux-gnueabihf-ranlib

common library

sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget

Cross compile OpenSSL

wget https://www.openssl.org/source/openssl-1.1.1d.tar.gz
tar xf openssl-1.1.1d.tar.gz
cd openssl-1.1.1d

./Configure --prefix=/usr/arm-linux-gnueabihf/ linux-armv4

make -j8 CC=$CC AR=$AR RANLIB=$RANLIB
make install

cross compile Python3

./configure --host=arm-linux-gnueabihf \
    --target=arm-linux-gnueabihf \
    --build=x86_64-linux-gnu \
    --prefix=$HOME/Documents/BBB/_install \
    --disable-ipv6 \
    --enable-shared \
    ac_cv_file__dev_ptmx=no \
    ac_cv_file__dev_ptc=no \
    ac_cv_have_long_long_format=yes

make -j8 HOSTPYTHON=./hostpython \
    BLDSHARED="arm-linux-gnueabihf-gcc -shared" \
    CROSS-COMPILE=arm-linux-gnueabihf- \
    CROSS_COMPILE_TARGET=yes \
    HOSTARCH=arm-linux \
    BUILDARCH=arm-linux-gnueabihf

make altinstall HOSTPYTHON=./hostpython \
    BLDSHARED="arm-linux-gnueabihf-gcc -shared" CROSS-COMPILE=arm-linux-gnueabihf- \
    CROSS_COMPILE_TARGET=yes HOSTARCH=arm-linux BUILDARCH=arm-linux-gnueabihf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment