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

Can you compiling file or opkg OpenWRT for MIPS, MIPSBE, MMIPS etc? ;) #545

Open
1o1o1 opened this issue May 30, 2022 · 14 comments
Open

Can you compiling file or opkg OpenWRT for MIPS, MIPSBE, MMIPS etc? ;) #545

1o1o1 opened this issue May 30, 2022 · 14 comments

Comments

@1o1o1
Copy link

1o1o1 commented May 30, 2022

Can you compiling file or opkg OpenWRT for MIPS, MIPSBE, MMIPS etc?
Its will be cool to use in routers too)

@arriven
Copy link
Owner

arriven commented May 30, 2022

went ahead and added all the goarch options that did compile with the code. I can't guarantee all the features will work though

@1o1o1
Copy link
Author

1o1o1 commented Jun 1, 2022

Ok) OpenWRT 19.07.8 on MikroTik SXT Lite2 CPU 600MHz AR9344 mips kernel-4.14.241

db1000n_linux_mips.tar.gz

[17:15][root@OpenWrt:~]# nice -n 19 .bins/db1000n
Illegal instruction

:)

@deputinizer
Copy link
Contributor

mipsle maybe?

https://go.dev/doc/install/source#environment

  | linux | mips
  | linux | mipsle
  | linux | mips64
  | linux | mips64le

@1o1o1
Copy link
Author

1o1o1 commented Jun 1, 2022

with mipsle :)

[17:25][root@OpenWrt:~]# .bins/db1000n
.bins/db1000n: line 1: syntax error: unexpected "("

It is MIPSBE :)

https://mikrotik.com/product/RBSXT2nDr3

need to compile for MIPSBE ....

@arriven
Copy link
Owner

arriven commented Jun 2, 2022

Based on what I'm seeing, I'm not sure go can cross compile for mipsbe but I'll check a bit more thoroughly in couple hours

@arriven
Copy link
Owner

arriven commented Jun 2, 2022

UPD: according to all the docs I've found mipsbe should be just mips. Go has an option to compile hardfloat vs softfloat (default being only hardfloat) though, maybe that could be the missing part?

@arriven
Copy link
Owner

arriven commented Jun 2, 2022

Ideally we'd want to try and install go on that machine and inspect env variables it sets here
https://go.dev/doc/install/source#environment
Not sure you'd be able to easily install go on microtik but in case softfloat doesn't work it's worth a try

@1o1o1
Copy link
Author

1o1o1 commented Jun 2, 2022

No) I can't install go 99.5 MB) there's not enough space) available 101.5 MB :)

@arriven
Copy link
Owner

arriven commented Jun 3, 2022

Have you tried mips_softfloat?

@1o1o1
Copy link
Author

1o1o1 commented Jun 3, 2022

yes

[08:55][root@OpenWrt:~]# nice -n 19 .bins/db1000n
Segmentation fault

@arriven
Copy link
Owner

arriven commented Jun 3, 2022

hmm, I think segfault in this case means that this is the architecture to use but there's a bug somewhere in the code itself that doesn't present itself on other systems (maybe some of the packages used have some bugs or logic that doesn't work for softfloat or smth like that).
I'll either need to setup a VM for that or get some sort of debug build that would at least print out the goroutines when getting that segfault, I'll check what is easier during the weekend

@arriven
Copy link
Owner

arriven commented Jun 4, 2022

so I've tried running mips binary via qemu and it seems to be working fine (weirdly enough it works both with softfloat and hardfloat)
As for "debug" build - I haven't managed to make a code that would produce such an error message. the one I'm getting is a lot more descriptive:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x76f88a]

goroutine 1 [running]:
go.uber.org/zap.(*Logger).check(0x0, 0x0, {0xcaafb1, 0xf})
        /home/arriven/go/pkg/mod/go.uber.org/zap@v1.21.0/logger.go:270 +0x6a
go.uber.org/zap.(*Logger).Info(0xc0001a8120?, {0xcaafb1?, 0xa?}, {0x0, 0x0, 0x0})
        /home/arriven/go/pkg/mod/go.uber.org/zap@v1.21.0/logger.go:191 +0x3b
main.main()
        /home/arriven/work/db1000n/main.go:67 +0x2b3

you could try building the executable yourself on your main OS with GOOS=linux GOARCH=mips GOMIPS=softfloat go build -o db1000n but I'm not sure it will be more descriptive on your system

@arriven
Copy link
Owner

arriven commented Jun 7, 2022

@1o1o1 I think I know what the issue is. How much RAM does that router have? db1000n needs at least 200mb to be able to run properly (and you'd need to provide --skip-encrypted argument, otherwise it's up to 500mb). I just tried running it in qemu with 100mb RAM and it does end up catching a panic (although it's still more descriptive)
I doubt I'll be able to optimize memory usage away without sacrificing functionality but we could figure out some alternatives (i.e. https://github.com/Yneth/distress-releases/releases which doesn't have mips support yet but I could talk to the author in theory)

@1o1o1
Copy link
Author

1o1o1 commented Jun 7, 2022

:) MikroTik SXT Lite2 CPU 600MHz AR9344 (--> RAM 64Mb <--) NAND 128Mb

with 256-512Mb is too much expensive and usually with arm cpu :)

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