hi junichi, after thinking about things a bit, i think i may have a simpler solution!
i think the primary problem is that the ilist file is basically a bunch of
struct ilist objects written in serially in binary form. the struct ilist is
something like
struct ilist {
dev_t foo
ino_t bar
}
and i think the underlying problem is that sizeof(ino_t) depends on the
architecture wordsize so a file with 100 struct ilist on amd64 will be much
larger than the same on i386. however, if cowdancer is compiled with large
file support, then sizeof(ino_t) == sizeof(ino64_t) and is equivalent on both
architectures.
to test i modified the Makefile to compile everything with LFS (patch
attached) and re-created my i386 base.cow and everything seems to work as it
should!
the only potential issue i see is that on an arch where sizeof(ino_t) will
change with the addition of LFS, if an .ilist file already exists, things
will break in a similar way. if there were some way to prevent this from
happening, i think this solution would work. some possibilities off the top
of my head, though you will probably know what if anything will be best:
- always regenerate the .ilist file
- have a "version" or other "flag" dotfile in cow chroot that lets us know
whether it's an LFS ilist or not
- try to catch the error that might occur when the wrong wordsize is
encountered and try regenerating the ilist file once before giving up.
let me know what you think!
sean
diff --git a/Makefile b/Makefile
index 6dc8da7..baba748 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,11 @@ PREFIX=/usr
LIBDIR=$(PREFIX)/lib
export VERSION=$(shell sed -n '1s/.*(\(.*\)).*$$/\1/p' < debian/changelog )
+# standard compilation flags
+CFLAGS = -O2 -Wall
+# LFS support
+CFLAGS += $(shell getconf LFS_CFLAGS)
+
all: $(BINARY)
install: $(BINARY)
@@ -23,22 +28,22 @@ install: $(BINARY)
$(INSTALL_FILE) qemubuilder.8 $(DESTDIR)/usr/share/man/man8/qemubuilder.8
libcowdancer.so: cowdancer.lo ilistcreate.lo
- gcc -O2 -Wall -ldl -shared -o $@ $^
+ gcc $(CFLAGS) -ldl -shared -o $@ $^
cow-shell: cow-shell.o ilistcreate.o
- gcc -O2 -Wall -o $@ $^
+ gcc $(CFLAGS) -o $@ $^
cowbuilder: cowbuilder.o parameter.o ilistcreate.o
- gcc -O2 -Wall -o $@ $^
+ gcc $(CFLAGS) -o $@ $^
qemubuilder: qemubuilder.o parameter.o
- gcc -O2 -Wall -o $@ $^
+ gcc $(CFLAGS) -o $@ $^
%.lo: %.c
gcc -D_REENTRANT -fPIC $< -o $@ -c -Wall -O2 -g
%.o: %.c parameter.h
- gcc $< -o $@ -c -Wall -O2 -g -fno-strict-aliasing -D LIBDIR="\"${LIBDIR}\""
+ gcc $< -o $@ -c $(CFLAGS) -g -fno-strict-aliasing -D LIBDIR="\"${LIBDIR}\""
clean:
-rm -f *~ *.o *.lo $(BINARY)
signature.asc
Description: This is a digitally signed message part.

