Git Product home page Git Product logo

Comments (9)

trufae avatar trufae commented on June 23, 2024 1

Fixed in b827e93

from r2ghidra.

trufae avatar trufae commented on June 23, 2024 1

the sleigh files are shipped in a separate zip in the release page. you can build them, but only with make for now

from r2ghidra.

anthraxx avatar anthraxx commented on June 23, 2024

@trufae great thanks. Do you have any pointer how one could build/distribute sleigh files themselves? Its important for us to be able to build them ourselves.

I think right now I figured it like this:

make -C ghidra sleigh-build
export R2_LIBR_PLUGINS=$(r2 -H R2_LIBR_PLUGINS)
DESTDIR="${pkgdir}" make -C ghidra install

from r2ghidra.

trufae avatar trufae commented on June 23, 2024

yep. thats how you build it if you think it's worth to have the instructions in the readme they can be added. it will be good to be able to build it with meson too, but i dont see it as a prioriy right now

from r2ghidra.

anthraxx avatar anthraxx commented on June 23, 2024

@trufae Sounds good enough for now, thank you! Compared the results to the provided zip and they seem to match. Good enough for now. If its ever moved over to meson please make us somehow aware :D

from r2ghidra.

trufae avatar trufae commented on June 23, 2024

Yeah the sleigh files are portable. You can generate them once and use them on different systems. The zip in the release page is generated by the ci.

i'll open a ticket to make that part meson friendly when i get bored :)

btw i have a patch installing the sleighc compiler, not sure if you want to package this bonary too. Or maybe in a separate package because that may allow users to build their own custom processors

from r2ghidra.

anthraxx avatar anthraxx commented on June 23, 2024

@trufae nice, good to hear. I've done some first meson adjustments for iaito but wanted to check in on some translations related topics. Can i reach you somewhere or should we discuss that on a bug ticket at iaito?

from r2ghidra.

trufae avatar trufae commented on June 23, 2024

Sure, use mail, telegram or discord

from r2ghidra.

milahu avatar milahu commented on June 23, 2024

workaround for meson in NixOS/nixpkgs#213388
using xargs to run sleighc in parallel
(using a sparse checkout of ghidra, 6 of 240 MB)

{
  # workround for https://github.com/radareorg/r2ghidra/issues/93
  # https://github.com/radareorg/r2ghidra/blob/master/ghidra/Makefile
  postBuild = ''
    GHIDRA_SLEIGH_HOME=../ghidra/src/Processors
    cp -v ../ghidra-processors.txt.default ../ghidra-processors.txt
    echo "Compiling processor files"
    ./sleighc -a $GHIDRA_SLEIGH_HOME/DATA
    cat ../ghidra-processors.txt | sed "s|^|$GHIDRA_SLEIGH_HOME/|" | xargs -n1 -P$NIX_BUILD_CORES ./sleighc -a 2>/dev/null
  '';

  # TODO use radare2.abiVersion https://github.com/radareorg/radare2/pull/20545
  postInstall = ''
    echo "Installing processor files to $out/lib/radare2/${radare2.version}/r2ghidra_sleigh"
    mkdir $out/lib/radare2/${radare2.version}/r2ghidra_sleigh
    for a in DATA $(cat ../ghidra-processors.txt); do
      for b in $GHIDRA_SLEIGH_HOME/$a/*/*/*.{cspec,ldefs,pspec,sla}; do
        cp $b $out/lib/radare2/${radare2.version}/r2ghidra_sleigh
      done
    done
  '';

for reference ...

https://mesonbuild.com/Custom-build-targets.html

all: sleigh-build
clean:
rm -rf ../ghidra-native ghidra/Ghidra
-include ../config.mk
include deps.mk
DD=$(DESTDIR)/$(R2_LIBR_PLUGINS)/r2ghidra_sleigh
DH=$(DESTDIR)/$(R2_USER_PLUGINS)/r2ghidra_sleigh
D?=$(DH)
install:
$(MAKE) sleigh-install D="$(DD)"

r2ghidra/ghidra/deps.mk

Lines 111 to 131 in a1495c5

GHIDRA_SLEIGH_HOME=$(GHIDRA_HOME)/src/Processors
GHIDRA_SLEIGH_SLASPECS=$(GHIDRA_SLEIGH_HOME)/*.slaspec
GHIDRA_SLEIGH_FILES=$(GHIDRA_SLEIGH_HOME)/*.cspec
GHIDRA_SLEIGH_FILES+=$(GHIDRA_SLEIGH_HOME)/*.ldefs
GHIDRA_SLEIGH_FILES+=$(GHIDRA_SLEIGH_HOME)/*.pspec
../ghidra-processors.txt:
cp -f ../ghidra-processors.txt.default ../ghidra-processors.txt
sleigh-build: sleighc ../ghidra-processors.txt
for a in DATA $(shell cat ../ghidra-processors.txt) ; do ./sleighc -a $(GHIDRA_SLEIGH_HOME)/$$a ; done
GHIDRA_PROCS=$(GHIDRA_SLEIGH_HOME)/*/*/*
sleigh-install:
mkdir -p "$(D)"
for a in DATA $(shell cat ../ghidra-processors.txt) ; do \
for b in cspec ldefs pspec sla ; do \
cp -f $(GHIDRA_SLEIGH_HOME)/$$a/*/*/*.$$b "$(D)"; \
done ;\
done

r2ghidra/Makefile

Lines 22 to 23 in 0799403

ghidra-processors.txt:
cp -f ghidra-processors.txt.default ghidra-processors.txt

from r2ghidra.

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.