This commit adds support for CBMEM in sysfs. Useful for systems without access to /dev/mem e.g. Android. Linux kernel driver: drivers/firmware/google/cbmem.c Linux driver Kconfig: CONFIG_GOOGLE_CBMEM BUG=b:391874512 TEST=(devmem) cbmem -l; cbmem -x; cbmem -r 434f4e53; cbmem -t; cbmem -a 1200 TEST=modprobe cbmem; cbmem -l; cbmem -x; cbmem -r 434f4e53; cbmem -t; cbmem -a 1200 Change-Id: I527889509ffc84203be42d0160e5363c60eafd02 Signed-off-by: Jakub Czapiga <czapiga@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/86606 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
43 lines
1.1 KiB
Makefile
43 lines
1.1 KiB
Makefile
##
|
|
## SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
PROGRAM = cbmem
|
|
TOP ?= $(abspath ../..)
|
|
ROOT = $(TOP)/src
|
|
COMMONLIB = $(ROOT)/commonlib
|
|
CC ?= $(CROSS_COMPILE)gcc
|
|
INSTALL ?= /usr/bin/env install
|
|
PREFIX ?= /usr/local
|
|
CFLAGS ?= -O2
|
|
WERROR=-Werror
|
|
CFLAGS += -Wall -Wextra -Wmissing-prototypes -Wshadow $(WERROR)
|
|
CPPFLAGS += -I . -I $(ROOT)/commonlib/include -I $(ROOT)/commonlib/bsd/include
|
|
CPPFLAGS += -include $(ROOT)/commonlib/bsd/include/commonlib/bsd/compiler.h
|
|
|
|
OBJS = $(PROGRAM).o cbmem_drv.o devmem_drv.o sysfs_drv.o $(COMMONLIB)/bsd/ipchksum.o
|
|
|
|
all: $(PROGRAM)
|
|
|
|
$(PROGRAM): $(OBJS)
|
|
|
|
clean:
|
|
rm -f $(PROGRAM) $(OBJS:.c=.o) .dependencies *~ junit.xml
|
|
|
|
install: $(PROGRAM)
|
|
$(INSTALL) -d $(DESTDIR)$(PREFIX)/sbin/
|
|
$(INSTALL) cbmem $(DESTDIR)$(PREFIX)/sbin/
|
|
|
|
distclean: clean
|
|
|
|
.dependencies:
|
|
@$(CC) $(CFLAGS) $(CPPFLAGS) -MM *.c > .dependencies
|
|
|
|
help:
|
|
@echo "${PROGRAM}: View machine's cbmem contents"
|
|
@echo "Targets: all, clean, distclean, help, install"
|
|
@echo "To disable warnings as errors, run make as:"
|
|
@echo " make all WERROR=\"\""
|
|
|
|
.PHONY: all clean distclean install help
|
|
|
|
-include .dependencies
|