Code Monkey home page Code Monkey logo

Comments (6)

tohojo avatar tohojo commented on June 14, 2024

from xdp-tools.

bofengxiaoshuai avatar bofengxiaoshuai commented on June 14, 2024

bofengxiaoshuai @.***> writes:
hello,I want to know how to compile xdp-loader in mips arch? I mean I want to run xdp-loader program in cpu with mips arch,thanks a lot
Well, theoretically, the same way you would compile any other program for that arch. I have no idea if there's anything that will break for such a compile, but if there is, patches are very welcome. However, I'm not sure how useful xdp-loader actually is on MIPS; the kernel support for BPF on that arch is quite limited. Haven't played with it myself, though, so YMMV.

Thank you very much for your answers.
I try to fix it,it's all steps I do,hope you can give me some advise, thanks!

1、I see lines 60-71 of the configure script file:

: ${PKG_CONFIG:=pkg-config}
: ${CC=gcc}
: ${LD=ld}
: ${OBJCOPY=objcopy}
: ${CLANG=clang}
: ${LLC=llc}
: ${M4=m4}
: ${EMACS=emacs}
: ${BPFTOOL=bpftool}
: ${READELF=readelf}
: ${ARCH_INCLUDES=}
: ${ARCH_NAME=}

2、then I modify it to:

: ${PKG_CONFIG:=pkg-config}	
: ${CC=mips64el-linux-gcc}
: ${LD=mips64el-linux-ld}
: ${OBJCOPY=mips64el-linux-objcopy}
: ${CLANG=clang}
: ${LLC=llc}
: ${M4=m4}
: ${EMACS=emacs}
: ${BPFTOOL=bpftool}

3、then ./configure,below is output:

root@ubuntu:~/xdp-tools# ./configure
Found clang binary 'clang' with version 19 (from 'Ubuntu clang version 19.0.0 (++20240222053038+26d71d9ed56c-1~exp1~20240222173217.940)')
/usr/sbin/bpftool
using /usr/lib/linux-tools/5.15.0-67-generic/bpftool v5.15.85
libbpf support: submodule v1.2.0
  perf_buffer__consume support: yes (submodule)
  btf__load_from_kernel_by_id support: yes (submodule)
  btf__type_cnt support: yes (submodule)
  bpf_object__next_map support: yes (submodule)
  bpf_object__next_program support: yes (submodule)
  bpf_program__insn_cnt support: yes (submodule)
  bpf_program__type support: yes (submodule)
  bpf_program__flags support: yes (submodule)
  bpf_program__expected_attach_type support: yes (submodule)
  bpf_map_create support: yes (submodule)
  perf_buffer__new_raw support: yes (submodule)
  bpf_xdp_attach support: yes (submodule)
  bpf_map__set_autocreate support: yes (submodule)
  bpf_prog_test_run_opts support: yes (submodule)
  bpf_xdp_query support: yes (submodule)
zlib support: yes
ELF support: yes
pcap support: yes
secure_getenv support: yes
cap-ng support: no
root@ubuntu:~/xdp-tools# 

4、then I make

root@ubuntu:~/xdp-tools/xdp-loader# make
	CC       xdp-loader
In file included from ../lib/libbpf/src/root/usr/include/bpf/bpf.h:26:0,
				 from xdp-loader.c:11:
../lib/../headers/linux/bpf.h:12:30: fatal error: linux/bpf_common.h: No such file or directory
 #include <linux/bpf_common.h>
							  ^
compilation terminated.
make: *** [../lib/common.mk:107:xdp-loader] 错误 1
root@ubuntu:~/xdp-tools/xdp-loader# 

from xdp-tools.

tohojo avatar tohojo commented on June 14, 2024

from xdp-tools.

bofengxiaoshuai avatar bofengxiaoshuai commented on June 14, 2024

You don't need to edit the file, you can just set these when running configure: CC=mips64el-linux-gcc LD=mips64el-linux-ld OBJCOPY=mips64el-linux-objcopy READELF=mips64el-linux-readelf ARCH_NAME=mips ./configure (or export all of them before running configure).


thank you so much for your answer,thanks you for telling me the way to assign the MACRO.
Now I have a question:

 : ${PKG_CONFIG:=pkg-config}
 : ${CC=mips64el-linux-gcc}
 : ${LD=mips64el-linux-ld}
 : ${OBJCOPY=mips64el-linux-objcopy}
 : ${CLANG=clang}
 : ${LLC=llc}
 : ${M4=m4}
 : ${EMACS=emacs}
 : ${BPFTOOL=bpftool}
 : ${READELF=mips64el-linux-readelf}
 : ${ARCH_INCLUDES=}
 : ${ARCH_NAME=mips}`

I want to know which parameter need to assign,
now I have already assigned 4,I don’t know whether it‘s enough.
and if I want to build for mips arch,
what value should assigned for INCLUDES and ARCH_NAME ?

from xdp-tools.

tohojo avatar tohojo commented on June 14, 2024

from xdp-tools.

bofengxiaoshuai avatar bofengxiaoshuai commented on June 14, 2024

bofengxiaoshuai @.***> writes:

You don't need to edit the file, you can just set these when running configure: CC=mips64el-linux-gcc LD=mips64el-linux-ld OBJCOPY=mips64el-linux-objcopy READELF=mips64el-linux-readelf ARCH_NAME=mips ./configure (or export all of them before running configure). ------------------------------------------------------------------------------------------------------------ thank you so much for your answer,thanks you for telling me the way to assign the MACRO. Now I have a question: : ${PKG_CONFIG:=pkg-config} : ${CC=mips64el-linux-gcc} : ${LD=mips64el-linux-ld} : ${OBJCOPY=mips64el-linux-objcopy} : ${CLANG=clang} : ${LLC=llc} : ${M4=m4} : ${EMACS=emacs} : ${BPFTOOL=bpftool} : ${READELF=mips64el-linux-readelf} : ${ARCH_INCLUDES=} : ${ARCH_NAME=mips}` I want to know which parameter need to assign, now I have already assigned 4,I don’t know whether it‘s enough. and if I want to build for mips arch, what value should assigned for INCLUDES and ARCH_NAME ?
No idea. I don't actually have much experience cross-compiling for MIPS, so I'm afraid you'll have to find an actual expert to answer this :)

OK,I see, Thank you so much for answer my questions!

from xdp-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.