From 69e2af495d0063ff247abeecbc198a8544be220b Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 23 Oct 2024 11:22:17 -0300 Subject: [PATCH] pcireg: Make Linux port official --- .github/workflows/build.yml | 12 +++++++++++- clib/gcc.mk | 5 +++-- pcireg/Makefile.gcc | 2 +- pcireg/README.md | 6 +++++- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2cb31ea..2813acf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Install build tools - run: sudo apt update && sudo apt install build-essential xz-utils + run: sudo apt update && sudo apt install build-essential crossbuild-essential-i386 xz-utils - name: Download OpenWatcom if: steps.cache.outputs.cache-hit != 'true' run: | @@ -23,6 +23,14 @@ jobs: mkdir /opt/watcom wget -qO- https://github.com/open-watcom/open-watcom-v2/releases/download/2023-12-01-Build/ow-snapshot.tar.xz | tar -Jxv -C /opt/watcom echo "/opt/watcom/binl64:/opt/watcom/binl" >> $GITHUB_PATH + - name: Download and build libpci + if: steps.cache.outputs.cache-hit != 'true' + run: | + rm -rf /opt/pciutils-* + wget -qO- https://github.com/pciutils/pciutils/releases/download/v3.13.0/pciutils-3.13.0.tar.gz | tar -zxv -C /opt + cd /opt/pciutils-* + make CC=i686-linux-gnu-gcc ZLIB=no DNS=no SHARED=no + sudo make install-lib - uses: actions/checkout@v2 - name: Build `cp437` run: | @@ -49,6 +57,7 @@ jobs: cd ${{ github.workspace }}/pcireg wmake make -f Makefile.uefi ARCH=x86_64 + make -f Makefile.gcc CC=i686-linux-gnu-gcc CFLAGS=-I/usr/local/include LDFLAGS=-static python3 pciids.py - name: Build `usblgoff` run: | @@ -60,6 +69,7 @@ jobs: path: | **/*.EXE **/*.EFI + pcireg/pcireg **/*.BIN ac97/*.md acpi/*.md diff --git a/clib/gcc.mk b/clib/gcc.mk index ffe993d..c3b799e 100644 --- a/clib/gcc.mk +++ b/clib/gcc.mk @@ -16,14 +16,15 @@ # VPATH = . ../clib +CC ?= "gcc" default: $(DEST) %.o: %.c $(HEADERS) - gcc -I../clib -c $< -o $@ + $(CC) -I../clib $(CFLAGS) -c $< -o $@ $(DEST): $(OBJS) - gcc $(OBJS) $(CFLAGS) -o $@ + $(CC) $(OBJS) $(LDFLAGS) -o $@ chmod +x $@ || true clean: diff --git a/pcireg/Makefile.gcc b/pcireg/Makefile.gcc index ca90e78..69d1e85 100644 --- a/pcireg/Makefile.gcc +++ b/pcireg/Makefile.gcc @@ -17,6 +17,6 @@ export OBJS = pcireg.o clib_pci.o clib_std.o clib_sys.o clib_term.o export DEST = pcireg -export CFLAGS = -lpci +override LDFLAGS += -lpci include ../clib/gcc.mk diff --git a/pcireg/README.md b/pcireg/README.md index 433b744..0803056 100644 --- a/pcireg/README.md +++ b/pcireg/README.md @@ -1,6 +1,6 @@ pcireg ====== -DOS and UEFI tool for reading, writing and dumping PCI configuration space registers; scanning the PCI bus; and more. +DOS, UEFI and Linux tool for reading, writing and dumping PCI configuration space registers; scanning the PCI bus; and more. Usage ----- @@ -42,6 +42,10 @@ Building * **Linux:** Run `make -f Makefile.uefi ARCH=x86_64` with a GCC toolchain installed. * Note that 32-bit UEFI targets are not supported yet. +### Linux target + +* **Linux:** Run `make -f Makefile.gcc` with a GCC toolchain and development files for `libpci` installed. + ### PCI ID database * Run `python3 pciids.py` to update the `PCIIDS.BIN` file.