-mpreferred-stack-boundary=2 is not between 4 and 12

I received this error trying to cross-compile a kernel module for i386 on an x86-64 system. I had already cross-compiled and successfully booted an i386 kernel, so I thought my environment was setup correctly. Anyways, using the following Makefile, I received the following errors.

KDIR:=/lib/modules/$(shell uname -r)/build

obj-m := util.o

default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

clean:
$(RM) .*.cmd *.mod.c *.o *.ko -r .tmp* *~

$ ARCH=i386 make
make -C /home/jmmccune/Desktop/linux-2.6.20-rc5 SUBDIRS=/mnt/code/kmod modules
make[1]: Entering directory `/home/jmmccune/Desktop/linux-2.6.20-rc5′
CC [M] /mnt/code/kmod/util.o
/mnt/code/kmod/util.c:1: error: -mpreferred-stack-boundary=2 is not between 4 and 12
make[2]: *** [/mnt/code/kmod/util.o] Error 1
make[1]: *** [_module_/mnt/code/kmod] Error 2
make[1]: Leaving directory `/home/jmmccune/Desktop/linux-2.6.20-rc5′
make: *** [default] Error 2

The problem turned out to be with the clean: entry in the Makefile. I had made the clean: line in the above Makefile manually, thinking that deleting the necessary local files was sufficient. Apparently that is not the case. Using this instead, everything works:


clean:
make -C $(KDIR) M=$(PWD) clean

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s