linux-sunxi / sunxi-tools

A collection of command line tools for ARM devices with Allwinner SoCs.
http://linux-sunxi.org/
GNU General Public License v2.0
579 stars 421 forks source link

Installing on macOS #205

Closed retpolanne closed 9 months ago

retpolanne commented 10 months ago

In case anyone needs it

git clone https://github.com/dgibson/dtc.git
cd dtc
git checkout v1.6.1
make

then made these changes to the makefile

--- a/Makefile
+++ b/Makefile
@@ -35,6 +35,7 @@ DEFAULT_CFLAGS += -D_NETBSD_SOURCE
 endif

 DEFAULT_CFLAGS += -Iinclude/
+DEFAULT_CFLAGS += -I${HOME}/Dev/dtc/libfdt

 PKG_CONFIG ?= pkg-config

@@ -126,6 +127,7 @@ LIBUSB_LIBS ?= `$(PKG_CONFIG) --libs $(LIBUSB)`
 ZLIB = zlib
 ZLIB_CFLAGS ?= `$(PKG_CONFIG) --cflags $(ZLIB)`
 ZLIB_LIBS ?= `$(PKG_CONFIG) --libs $(ZLIB)`
+FDT_LIBS ?= -L ${HOME}/Dev/dtc/libfdt/

 ifeq ($(OS),Windows_NT)
        # Windows lacks mman.h / mmap()
@@ -143,7 +145,7 @@ SPI_FLASH:= fel-spiflash.c fel-spiflash.h fel-remotefunc-spi-data-transfer.h

 sunxi-fel: fel.c fit_image.c thunks/fel-to-spl-thunk.h $(PROGRESS) $(SOC_INFO) $(FEL_LIB) $(SPI_FLASH)
        $(CC) $(HOST_CFLAGS) $(LIBUSB_CFLAGS) $(ZLIB_CFLAGS) $(LDFLAGS) -o $@ \
-               $(filter %.c,$^) $(LIBS) $(LIBUSB_LIBS) $(ZLIB_LIBS) -lfdt
+               $(filter %.c,$^) $(LIBS) $(LIBUSB_LIBS) $(ZLIB_LIBS) $(FDT_LIBS) -lfdt

 sunxi-nand-part: nand-part-main.c nand-part.c nand-part-a10.h nand-part-a20.h
        $(CC) $(HOST_CFLAGS) -c -o nand-part-main.o nand-part-main.c
apritzel commented 10 months ago

Can't you just install dtc or libfdt with homebrew? And then just include the generic path to the headers and libs?

retpolanne commented 10 months ago

Hey @apritzel. I think so, didn't know there was a brew install dtc.

retpolanne commented 9 months ago

@apritzel I didn't have a Mac to test but now I do, looks like you can definitely include the generic path to headers and libs from homebrew :) sunxi-tools-macos.patch

I'll leave my patch here in case anybody needs it. Just brew install dtc, apply this patch and then make. Not perfect tho, but it works.