aboutsummaryrefslogtreecommitdiffstats
path: root/roms/skiboot/external/shared
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
commitaf1a266670d040d2f4083ff309d732d648afba2a (patch)
tree2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/skiboot/external/shared
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/skiboot/external/shared')
-rw-r--r--roms/skiboot/external/shared/Makefile54
-rw-r--r--roms/skiboot/external/shared/config.h24
-rw-r--r--roms/skiboot/external/shared/rules.mk19
3 files changed, 97 insertions, 0 deletions
diff --git a/roms/skiboot/external/shared/Makefile b/roms/skiboot/external/shared/Makefile
new file mode 100644
index 000000000..9ea4adc51
--- /dev/null
+++ b/roms/skiboot/external/shared/Makefile
@@ -0,0 +1,54 @@
+# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
+.DEFAULT_GOAL := all
+GET_ARCH := ../../external/common/get_arch.sh
+include ../../external/common/rules.mk
+include rules.mk
+
+PREFIX ?= /usr/local/
+LIBDIR := $(PREFIX)/lib
+INCDIR := $(PREFIX)/include/libflash
+
+ifneq ($(ARCH), ARCH_ARM)
+CFLAGS += -m64
+endif
+CFLAGS += -Werror -Wall -g2 -ggdb -I. -fPIC
+
+LIBFLASH_OBJS := libflash-file.o libflash-libflash.o libflash-libffs.o \
+ libflash-ecc.o libflash-blocklevel.o
+ARCHFLASH_OBJS := common-arch_flash.o
+OBJS := $(LIBFLASH_OBJS) $(ARCHFLASH_OBJS)
+
+LIBFLASH_H := libflash/file.h libflash/libflash.h libflash/libffs.h \
+ libflash/ffs.h libflash/ecc.h libflash/blocklevel.h libflash/errors.h
+ARCHFLASH_H := common/arch_flash.h
+
+LIBFLASH_FILES := libflash.c libffs.c ecc.c blocklevel.c file.c
+LIBFLASH_SRC := $(addprefix libflash/,$(LIBFLASH_FILES))
+
+$(LIBFLASH_SRC): | links
+
+$(LIBFLASH_OBJS) : libflash-%.o : libflash/%.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
+
+clean:
+ rm -f $(OBJS) common-*.o *.so*
+
+distclean: clean
+ rm -f ccan libflash common
+
+all: links arch_links $(OBJS)
+ $(CC) -shared -Wl,-soname,libflash.so -o $(SHARED_NAME) $(OBJS)
+
+install-lib: all
+ install -D -m 0755 $(SHARED_NAME) $(DESTDIR)$(LIBDIR)/$(SHARED_NAME)
+ ln -sf $(SHARED_NAME) $(DESTDIR)$(LIBDIR)/libflash.so
+
+install-dev: links arch_links
+ mkdir -p $(DESTDIR)$(INCDIR)
+ install -m 0644 $(LIBFLASH_H) $(ARCHFLASH_H) $(DESTDIR)$(INCDIR)
+
+install: install-lib install-dev
+
+uninstall:
+ rm -f $(DESTDIR)$(LIBDIR)/libflash*
+ rm -rf $(DESTDIR)$(INCDIR)
diff --git a/roms/skiboot/external/shared/config.h b/roms/skiboot/external/shared/config.h
new file mode 100644
index 000000000..f78e30e08
--- /dev/null
+++ b/roms/skiboot/external/shared/config.h
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
+/*
+ * For CCAN
+ *
+ * Copyright 2016 IBM Corp.
+ */
+
+#include <endian.h>
+#include <byteswap.h>
+
+#define HAVE_TYPEOF 1
+#define HAVE_BUILTIN_TYPES_COMPATIBLE_P 1
+
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define HAVE_BIG_ENDIAN 0
+#define HAVE_LITTLE_ENDIAN 1
+#else
+#define HAVE_BIG_ENDIAN 1
+#define HAVE_LITTLE_ENDIAN 0
+#endif
+
+#define HAVE_BYTESWAP_H 1
+#define HAVE_BSWAP_64 1
diff --git a/roms/skiboot/external/shared/rules.mk b/roms/skiboot/external/shared/rules.mk
new file mode 100644
index 000000000..a3d83d166
--- /dev/null
+++ b/roms/skiboot/external/shared/rules.mk
@@ -0,0 +1,19 @@
+# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
+# NOTE: shared lib versioning has *NOTHING* to do with software package version
+#
+# If source code has changed, revision++
+# if any interfaces have been added, removed, or changed, current++, revision=0
+# if any interfaces have been added, age++
+# if any interfaces have been removed or changed, age=0
+#
+# i.e. AGE refers to backwards compatibility.
+# e.g. If we start with 5.3.0 and we're releasing new version:
+# - bug fix no api change: 5.4.0
+# - new API call, backwards compatible otherwise: 6.0.1
+# - API removed, or changed (i.e. not backwards compat): 6.0.0
+
+LIBFLASH_VERSION_CURRENT=5
+LIBFLASH_VERSION_REVISION=3
+LIBFLASH_VERSION_AGE=0
+
+SHARED_NAME=libflash.so.${LIBFLASH_VERSION_CURRENT}.${LIBFLASH_VERSION_REVISION}.${LIBFLASH_VERSION_AGE}