#include <stdint.h>
-extern const uint32_t crc32_table[256];
-
-/* Return a 32-bit CRC of the contents of the buffer. */
-static inline uint32_t crc32(uint32_t val, const void *ss, int len)
-{
- const unsigned char *s = ss;
-
- while (--len >= 0)
- val = crc32_table[(val ^ *s++) & 0xff] ^ (val >> 8);
- return val;
-}
+/* Return a 32-bit CRC of the contents of the buffer */
+extern uint32_t crc32(uint32_t val, const void *ss, int len);
#endif /* __CRC32_H__ */
# CFLAGS += -Werror
CPPFLAGS += -I../include
-LIBS = libmtd
-TARGETS = libmtd.a
+LIBS = libmtd libcrc32
+TARGETS = libmtd.a libcrc32.a
include ../common.mk
$(BUILDDIR)/libmtd.a: $(addprefix $(BUILDDIR)/,\
- libmtd.o libmtd_legacy.o crc32.o fec.o)
+ libmtd.o libmtd_legacy.o libcrc32.o libfec.o)
clean::
rm -f $(addsuffix .a, $(LIBS))
#include <stdint.h>
-const uint32_t crc32_table[256] = {
+const static uint32_t crc32_table[256] = {
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
0x2d02ef8dL
};
+
+uint32_t crc32(uint32_t val, const void *ss, int len)
+{
+ const unsigned char *s = ss;
+
+ while (--len >= 0)
+ val = crc32_table[(val ^ *s++) & 0xff] ^ (val >> 8);
+ return val;
+}
TARGETS = mkfs.ubifs
LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid -L$(BUILDDIR)/../ubi-utils/ -lubi
-LDLIBS_mkfs.ubifs += -L$(BUILDDIR)/../lib -lmtd
+LDLIBS_mkfs.ubifs += -L$(BUILDDIR)/../lib -lmtd -lcrc32
LDLIBS_mkfs.ubifs += $(ZLIBLDFLAGS) $(LZOLDFLAGS)
include ../common.mk