Created
June 30, 2024 05:49
-
-
Save vinhjaxt/8a7eea2e6bb1738556adfa68eb78e138 to your computer and use it in GitHub Desktop.
OpenWrt Orange Pi Zero2 wifi works, but still no Access Point functional
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cat >/dev/null <<'EOF' | |
# terminal 1 | |
mkdir /tmp/rootfs/ | |
sudo mount /dev/sdb1 /tmp/rootfs/ | |
cd /tmp/rootfs/ | |
sudo rm -rf * ./.* | |
# terminal 2 | |
mount-img /home/openwrt/openwrt-23.05.3-sunxi-cortexa7-xunlong_orangepi-2-ext4-sdcard.img | |
# terminal 3 | |
mkdir /tmp/temp | |
sudo mount /dev/nbd1p2 /tmp/temp/ | |
cd /tmp/temp/ | |
sudo tar czvf /home/openwrt/openwrt-opi2-rootfs.tgz . | |
cd /tmp/ | |
# Ctrl+C in terminal 2 | |
# terminal 1 | |
cd /tmp/rootfs/ | |
sudo tar xzvf /home/openwrt/openwrt-opi2-rootfs.tgz -C . | |
sudo cp /home/openwrt/modprobe.sh /tmp/rootfs/ | |
sudo tar xzvf /home/openwrt/opi_root_debian-ok-wifi.tgz -C . ./boot ./usr/lib/firmware ./usr/lib/modules | |
# sudo mv ./usr/lib/firmware/* ./lib/firmware/ | |
# sudo mv ./usr/lib/firmware/brcm/* ./lib/firmware/brcm/ | |
sudo rm -rf ./lib/firmware | |
sudo mv ./usr/lib/firmware ./lib/firmware | |
sudo sed 's/^rootdev=/# rootdev=/g' -i boot/orangepiEnv.txt | |
echo -ne '\nrootdev=LABEL=opi_root\n' | sudo tee -a boot/orangepiEnv.txt | |
cd /tmp/ | |
sudo umount /tmp/rootfs | |
# eject usb | |
# boot orange pi zero 2 | |
ip a add 192.168.2.18/24 dev end0 | |
ip link set end0 up | |
ip r add default via 192.168.2.1 | |
vi /etc/resolv.conf | |
opkg update | |
opkg install wireless-tools | |
opkg install kmod-cfg80211 | |
wifi config | |
wifi up | |
uci set wireless.radioN.disabled='0' | |
uci commit wireless | |
wifi reload | |
wifi up | |
iw phy | |
iw dev wlan0 scan | |
# example | |
find wifi sys path | |
find /sys/devices/platform/ -name '*wifi*' | |
# example /etc/config/wireless | |
config wifi-device radio0 | |
option type 'mac80211' | |
option channel 'auto' | |
option disabled '0' | |
option path 'platform/soc/4021000.mmc/mmc_host/mmc1/mmc1:8800/mmc1:8800:1' | |
EOF | |
# Sort by "Used by" => Load parrent first, then childrens | |
# Module Size Used by | |
cat > /tmp/lsmod.txt << EOF | |
overlay 131072 0 | |
af_alg 24576 6 algif_hash,algif_skcipher | |
algif_hash 16384 1 | |
algif_skcipher 16384 1 | |
ecc 32768 1 ecdh_generic | |
ecdh_generic 16384 2 bluetooth | |
sunrpc 290816 1 | |
lz4hc 16384 0 | |
lz4 16384 0 | |
polyval_generic 16384 1 polyval_ce | |
polyval_ce 16384 0 | |
rc_core 49152 2 sunxi_cir | |
sunxi_cir 20480 0 | |
dw_hdmi_cec 16384 0 | |
mc 53248 5 sunxi_cedrus,videodev,videobuf2_v4l2,videobuf2_common,v4l2_mem2mem | |
videodev 204800 4 sunxi_cedrus,videobuf2_v4l2,videobuf2_common,v4l2_mem2mem | |
videobuf2_common 49152 5 sunxi_cedrus,videobuf2_dma_contig,videobuf2_v4l2,v4l2_mem2mem,videobuf2_memops | |
videobuf2_memops 20480 1 videobuf2_dma_contig | |
videobuf2_dma_contig 24576 1 sunxi_cedrus | |
videobuf2_v4l2 24576 2 sunxi_cedrus,v4l2_mem2mem | |
v4l2_mem2mem 36864 1 sunxi_cedrus | |
sunxi_cedrus 45056 0 | |
display_connector 20480 0 | |
joydev 32768 0 | |
apple_mfi_fastcharge 20480 0 | |
zram 28672 3 | |
binfmt_misc 24576 1 | |
sunxi_addr 20480 1 sprdwl_ng | |
rfkill 36864 7 sprdbt_tty,bluetooth,cfg80211 | |
bluetooth 720896 29 btrtl,btqca,btintel,hci_uart,btbcm,bnep | |
bnep 28672 2 | |
btqca 24576 1 hci_uart | |
btrtl 28672 1 hci_uart | |
btbcm 20480 1 hci_uart | |
btintel 40960 1 hci_uart | |
hci_uart 126976 1 | |
uwe5622_bsp_sdio 204800 2 sprdbt_tty,sprdwl_ng | |
cfg80211 376832 1 sprdwl_ng | |
sprdbt_tty 36864 2 | |
sprdwl_ng 352256 0 | |
fuse 126976 1 | |
dm_mod 131072 0 | |
realtek 32768 1 | |
mdio_mux 16384 1 dwmac_sun8i | |
dwmac_sun8i 28672 0 | |
EOF | |
ln -s "/usr/lib/modules/$(uname -r)" "/lib/modules/$(uname -r)" 2>/dev/null | |
mkdir "/lib/modules/$(uname -r)" 2>/dev/null | |
cnt=0 | |
for mod in $(cat /tmp/lsmod.txt | awk -F' ' '{ print $1 }'); do | |
if [ ! -z "${mod}" ]; then | |
let 'cnt++' | |
echo ${cnt}: insmod ${mod}.. | |
mod_path=$(find /usr/lib/modules -name "${mod}.ko") | |
if [ -z "${mod_path}" ]; then | |
mod_path=$(find /usr/lib/modules -name "${mod/_/-}.ko") | |
fi | |
if [ -z "${mod_path}" ]; then | |
echo not found | |
continue | |
fi | |
if insmod "${mod_path}" ; then | |
while ! lsmod | grep -q "${mod}"; do | |
echo waiting for loaded.. | |
sleep 1 | |
echo loaded | |
done | |
fi | |
echo OK | |
fi | |
done | |
echo done! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment