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

proposal: all: port to linux/mips_siflower #61254

Closed
wangjony opened this issue Jul 10, 2023 · 16 comments
Closed

proposal: all: port to linux/mips_siflower #61254

wangjony opened this issue Jul 10, 2023 · 16 comments
Labels
Proposal WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@wangjony
Copy link

wangjony commented Jul 10, 2023

GL.iNet GL-SFT1200 WiFi Router
Architecture: mips_siflower
Operating System: OpenWrt
The GL.iNet GL-SFT1200 comes with an Siflower SF19A28 mips_siflower processor,128 MB flash, and 128 MB RAM.
GL.iNet:https://github.com/gl-inet/gl-infra-builder
siflower SDK:https://github.com/Siflower/1806_SDK
Hope to adapt mips_siflower,Thank you so much

@gopherbot gopherbot added this to the Proposal milestone Jul 10, 2023
@seankhliao
Copy link
Member

What exactly is being proposed here?

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jul 10, 2023
@wangjony
Copy link
Author

wangjony commented Jul 10, 2023

What exactly is being proposed here?

support for openwrt( Linux )running on mips_siflower architecture.🙏🏻🙏🏻🙏🏻
希望go语言原生支持mips_siflower架构运行在openwrt。

@bcmills
Copy link
Contributor

bcmills commented Jul 10, 2023

(CC @golang/mips)

Go already supports four MIPS GOARCH settings: mips, mips64, mipsle, and mips64le, with two GOMIPS settings (hardfloat and softfloat). Does one of those combinations work with the instruction set supported by siflower? If not, what causes them to be incompatible?

@bcmills bcmills added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jul 10, 2023
@rittneje
Copy link

@bcmills I think you meant "GOARCH settings" not "GOOS" settings. (Just to avoid confusion.)

@bcmills
Copy link
Contributor

bcmills commented Jul 10, 2023

Indeed; edited my previous comment.

@Rongronggg9
Copy link
Member

Found more info here: messense/aliyundrive-webdav#485

虽然也是mips架构,但由于经过了魔改,不论是mips_24kc还是mipsel_24kc的elf均无法在其上运行。

Though it adopts MIPS too, tons of modifications make ELF built for mips(el)_24kc unable to execute on it.

@bcmills
Copy link
Contributor

bcmills commented Jul 10, 2023

That suggest that support for this chip would be considered a new port for Go. See https://go.dev/wiki/PortingPolicy#requirements-for-a-new-port for what is required to add one.

@bcmills bcmills added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jul 10, 2023
@seankhliao seankhliao changed the title proposal: Go 2: adapt mips_siflower proposal: all: port to linux/mips_siflower Jul 10, 2023
@Rongronggg9
Copy link
Member

/proc/cpuinfo

system type             : MIPS sf19a28
machine                 : GL-SFT1200
processor               : 0
cpu model               : MIPS interAptiv (multi) V2.8  FPU V0.0
BogoMIPS                : 531.66
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 64
extra interrupt vector  : yes
hardware watchpoint     : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa                     : mips1 mips2 mips32r1 mips32r2
ASEs implemented        : mips16 dsp dsp2 mt eva

Datasheet: https://www.siflower.com.cn/assets/upload/file/SF19A2890_datasheet.pdf

Its CPU is MIPS32® interAptiv, a MIPS32r2 CPU.

readelf

busybox_1.29.3-3_mips_siflower.ipk

ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 01 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       1
  Type:                              EXEC (Executable file)
  Machine:                           MIPS R3000
  Version:                           0x1
  Entry point address:               0x403760
  Start of program headers:          52 (bytes into file)
  Start of section headers:          0 (bytes into file)
  Flags:                             0x1005, noreorder, cpic, o32, mips1
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         9
  Size of section headers:           0 (bytes)
  Number of section headers:         0
  Section header string table index: 0
...
      [Requesting program interpreter: /lib/ld-musl-mipsel.so.1]
...
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so]

MIPS I (weird!) little-endian. ld.so is /lib/ld-musl-mipsel.so.1.

busybox_1.28.4-3_mipsel_24kc.ipk

ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 01 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       1
  Type:                              EXEC (Executable file)
  Machine:                           MIPS R3000
  Version:                           0x1
  Entry point address:               0x403940
  Start of program headers:          52 (bytes into file)
  Start of section headers:          0 (bytes into file)
  Flags:                             0x74001005, noreorder, cpic, o32, mips16, mips32r2
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         9
  Size of section headers:           0 (bytes)
  Number of section headers:         0
  Section header string table index: 0
...
      [Requesting program interpreter: /lib/ld-musl-mipsel-sf.so.1]
...
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so]

MIPS32r2 little-endian. ld.so is /lib/ld-musl-mipsel-sf.so.1.


The reason why one cannot "execute an ELF built for mipsel_24kc" is clear now:

  1. OpenWrt opkg refuses to install mipsel_24kc ipk as is not considered a compatible architecture.
  2. A dynamically linked ELF is unable to find a proper ld.so.

In theory, a static linked Go program should be able to execute on mips_siflower. So @wangjony, could you test?

In conclusion, I don't think it need a new port for Go to support mips_siflower, but the downstream OpenWrt GL.iNet provides is a bit "toxic". No much things can do from our side, but users needs to configure CGO properly.

@rsc
Copy link
Contributor

rsc commented Jul 12, 2023

Is the only difference the dynamic linker that's embedded in the binary?

@rsc
Copy link
Contributor

rsc commented Jul 12, 2023

This proposal has been added to the active column of the proposals project
and will now be reviewed at the weekly proposal review meetings.
— rsc for the proposal review group

@iGerman00
Copy link

In theory, a static linked Go program should be able to execute on mips_siflower

I can confirm that works.
Example of building a working binary for that platform

@ianlancetaylor
Copy link
Contributor

@wangjony Is there anything to do here? Thanks.

@rsc
Copy link
Contributor

rsc commented Jul 19, 2023

It sounds like if you want to compile for siflower from non-siflower systems you can do that by using static binaries but also by using dynamic binaries with go build -ldflags=-I=/lib/ld-musl-mipsel-sf.so.1. Do I have that correct?

@Rongronggg9
Copy link
Member

It sounds like if you want to compile for siflower from non-siflower systems you can do that by using static binaries

Yes.

but also by using dynamic binaries with go build -ldflags=-I=/lib/ld-musl-mipsel-sf.so.1.

Nope. It is /lib/ld-musl-mipsel.so.1. sf means soft-float instead of siflower. A mips-siflower downstream OpenWrt installation comes without ld-musl-mipsel-sf.so.1 as the SoC is of an FPU.

I think we've proved that the proposal is a mistake.

@rsc
Copy link
Contributor

rsc commented Jul 26, 2023

Based on the discussion above, this proposal seems like a likely decline.
— rsc for the proposal review group

@rsc
Copy link
Contributor

rsc commented Aug 2, 2023

No change in consensus, so declined.
— rsc for the proposal review group

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Proposal WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
Status: Declined
Development

No branches or pull requests

9 participants