Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need help in compiling for openwrt #4

Closed
gregor-hh opened this issue Jul 3, 2019 · 11 comments
Closed

Need help in compiling for openwrt #4

gregor-hh opened this issue Jul 3, 2019 · 11 comments

Comments

@gregor-hh
Copy link

Hi,
Can someone help me with compiling passh for openwrt? (I never ever compiled something :-) )
And need passh for my micro wrt router (GL-AR750S)
Iam on OpenWrt 18.06.1, r7258-5eb055306f and installed "make" but it can't find "cc command".

Which is the best method for newbies to compile?

Maybe it's pssible that you can create a "compiled release" here??

best regards

@clarkwang
Copy link
Owner

I can find some time and help build for you. What's your router's platform/target?

@gregor-hh
Copy link
Author

gregor-hh commented Jul 3, 2019

Hi, wow that sound very good, awesome! Thank you very much.
I have this one https://www.gl-inet.com/products/gl-ar750s/ (it's a very nice device by the way)

Architecture Qualcomm Atheros QCA956X ver 1 rev 0
Firmware Version OpenWrt 18.06.1 r7258-5eb055306f / LuCI openwrt-18.06 branch (git-18.196.56128-9112198)
Kernel Version 4.9.120

kindly regards

@clarkwang
Copy link
Owner

clarkwang commented Jul 3, 2019

What's the download URL (like https://downloads.openwrt.org/releases/18.06.2/targets/ramips/mt7620/ ) to the install image for your router? I need to download the SDK from the same location.

@gregor-hh
Copy link
Author

gregor-hh commented Jul 3, 2019

Ohhh shit :-(

Hmm its from gl-inet
https://dl.gl-inet.com/firmware/ar750s/

any chance that I can determine via ssh command on which openwrt version it depends?

https://openwrt.org/toh/gl.inet/gl-ar750s

@clarkwang
Copy link
Owner

Found it. According to https://openwrt.org/toh/views/toh_fwdownload it should be under https://downloads.openwrt.org/snapshots/targets/ath79/generic/ . Will let you know when it's ready.

@gregor-hh
Copy link
Author

Great! Thank you very much.
kindly regards

@clarkwang
Copy link
Owner

clarkwang commented Jul 3, 2019

Try this: passh - ath79/generic (available for only 7 days)

@gregor-hh
Copy link
Author

gregor-hh commented Jul 3, 2019

Wow, you are fast :-)

NIce!!!

That works:

root@localhost:~# passh -help
Usage: passh [OPTION]... COMMAND...

  -c <N>          Send at most <N> passwords (0 means infinite. Default: 0)
  -C              Exit if prompted for the <N+1>th password
  -h              Help
  -i              Case insensitive for password prompt matching
  -n              Nohup the child (e.g. used for `ssh -f')
  -p <password>   The password (Default: `password')
  -p env:<var>    Read password from env var
  -p file:<file>  Read password from file
  -P <prompt>     Regexp (BRE) for the password prompt
                  (Default: `[Pp]assword: \{0,1\}$')
  -l <file>       Save data written to the pty
  -L <file>       Save data read from the pty
  -t <timeout>    Timeout waiting for next password prompt
                  (0 means no timeout. Default: 0)
  -T              Exit if timed out waiting for password prompt
  -y              Auto answer `(yes/no)?' questions

Report bugs to Clark Wang <dearvoid@gmail.com>

Thank you very very much.
Now I can make my script, awesome

kindly reagrds

@clarkwang
Copy link
Owner

Actually I'm using sexpect on my router now. It's more flexible than passh. You can try it if need more features. :)

@AndiTheBest
Copy link

Hi.
Could you tell me how you have cross-compiled it for openwrt?
When i compile my own stuff i have no problem, but when i try to compile passh:

mips-openwrt-linux-uclibc-gcc -L ~/softwareentwicklung/router/modbus-master-slave/sdk/OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/lib passh.c

i get this:
`
/media/tera/softwareentwicklung/router/modbus-master-slave/sdk/OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.3.3/../../../../mips-openwrt-linux-uclibc/bin/ld: warning: ld-uClibc.so.0, needed by /home/andi/softwareentwicklung/router/modbus-master-slave/sdk/OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/lib/libc.so, not found (try using -rpath or -rpath-link)

/tmp/cc4MGTL5.o: In function big_loop':
passh.c:(.text+0x1728): undefined reference to WIFCONTINUED'
/home/andi/softwareentwicklung/router/modbus-master-slave/sdk/OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/lib/libc.so: undefined reference to _dl_app_init_array'
/home/andi/softwareentwicklung/router/modbus-master-slave/sdk/OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/lib/libc.so: undefined reference to _dl_loaded_modules'
/home/andi/softwareentwicklung/router/modbus-master-slave/sdk/OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/lib/libc.so: undefined reference to _dl_app_fini_array'
collect2: ld returned 1 exit status`

I have no idea why it doesnt find ld-uClibc.so.0 ...
Regards, Andi

@clarkwang
Copy link
Owner

Hi Andi,

I'm not directly invoking the cross compile cc command. I made a simple Makefile and run make package/passh/compile (see https://openwrt.org/docs/guide-developer/using_the_sdk ).

The package/passh/Makefile:

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

include $(INCLUDE_DIR)/package.mk

define Package/passh
    SECTION := utils
    CATEGORY := Utilities
    TITLE := passh
endef

define Package/passh/description
    This is the package description.
endef

# Specify what needs to be done to prepare for building the package.
define Build/Prepare
        mkdir -p $(PKG_BUILD_DIR)
        $(CP) ./src/* $(PKG_BUILD_DIR)/
endef

# Specify where and how to install the program.
define Package/passh/install
        $(INSTALL_DIR) $(1)/bin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/passh $(1)/bin/
endef

# This line executes the necessary commands to compile our program.
$(eval $(call BuildPackage,passh))

The package/passh/src/Makefile:

passh: passh.o
        $(CC) $(LDFLAGS) passh.o -o passh

passh.o: passh.c
        $(CC) $(CFLAGS) -c passh.c

clean:
        rm *.o passh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants