Advertisement
metalx1000

Cross Compile UPnP for Mipsel

Jun 1st, 2025 (edited)
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.43 KB | None | 0 0
  1. # Cross Compile UPnP for Mipsel - Thingino
  2. # download compiler
  3. sudo apt install gcc-mipsel-linux-gnu g++-mipsel-linux-gnu
  4.  
  5. # download and extract source code
  6. url="https://github.com/miniupnp/miniupnp/releases/download/miniupnpc_2_3_3/miniupnpc-2.3.3.tar.gz"
  7. wget "$url" -O miniupnpc.tar.gz
  8. tar xzvf miniupnpc.tar.gz
  9. cd "$(ls -d miniupnpc*/)"
  10.  
  11. # set these variables
  12. export CC=mipsel-linux-gnu-gcc
  13. export AR=mipsel-linux-gnu-ar
  14. export LD=mipsel-linux-gnu-ld
  15.  
  16. # find the following line in the Makefile
  17. $(BUILD)/upnpc-static:> $(BUILD)/upnpc.o $(LIBRARY)
  18. $(CC) $(LDFLAGS) -o $@ $^ $(LOADLIBES) $(LDLIBS)
  19.  
  20. # and change it to this
  21. $(BUILD)/upnpc-static:> $(BUILD)/upnpc.o $(LIBRARY)
  22. $(CC) $(LDFLAGS) -static -o $@ $^ $(LOADLIBES) $(LDLIBS)
  23.  
  24. # or just run this after make
  25. mipsel-linux-gnu-gcc -static -o build/upnpc-static build/upnpc.o build/libminiupnpc.a
  26.  
  27. # now run make
  28. make
  29.  
  30. # check and make sure that the binary is "statically linked"
  31. file build/upnpc-static
  32.  
  33. # copy upnpc-static to device
  34. # you might need to put this somewhere other then root because of size
  35. # ram disk - /tmp
  36. # rename to upnpc and
  37. # make it executable
  38. chmod +x upnpc
  39.  
  40. # example useage
  41. # add port forwarding
  42. upnpc -u http://192.168.1.1:1900/afdit/rootDesc.xml -a 192.168.1.30 554 554 tcp
  43.  
  44. # delete port forwarding
  45. upnpc -u http://192.168.1.1:1900/afdit/rootDesc.xml -d 554 tcp
  46.  
  47. # More info at https://gitlab.com/metalx1000/Thingino-Camera-Notes
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement