Step 1
git clone https://git.openwrt.org/openwrt/openwrt.gitWhen the menu appears, select "Target System" as (TI OMAP3/4/AM33xx), "Target Profile" as (TI AM335x BeagleBone Black), then < Exit >, < Yes > to save the configurations.
cd openwrt
make
It takes time to compile ...
Step 2
After the compiling is completed, write the image into a µSD card. Assume /dev/sdb is the target µSD card.zcat bin/targets/omap/generic/openwrt-omap-am335x-boneblack-ext4-sdcard.img.gz | sudo dd of=/dev/sdb bs=4096 conv=fsync
Step 3
Connect J1 console and plug the µSD card into BeagleBone Black. Apply power with S2 BOOT button pressed to boot from the µSD card.To support BeagleBone Green
BeagleBone Green needs am335x-bonegreen.dtb and we can find it atbuild_dir/target-arm_cortex-a8+vfpv3_musl_eabi/linux-omap/linux-4.14.43/arch/arm/boot/dts/am335x-bonegreen.dtb
Copy am335x-bonegreen.dtb into the dtbs directory in FAT partition of the µSD card. Step 3 again.
GPIO Output Control
Reference BeagleBone Black pin mux which pin to use and find the 'GPIO No.' Here take P8 pin 35 as example, the GPIO No. is 8.
In the console, execute,
echo 8 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio8/directionto set as output. Then,
echo 1 > /sys/class/gpio/gpio81/value echo 0 > /sys/class/gpio/gpio81/valueto control output high or low.
USB Gadget
make kernel_menuconfig Device Drivers --->
[*] USB support --->
<*> USB Gadget Support --->
<*> USB Gadget precomposed configurations (Ethernet Gadget (with CDC Ethernet support))