On Fri, 24 Jan 2014, Alan Barrett wrote:
I have successfully used "magic symlinks" (see symlink(7)) to allow i386 and amd64 to use different instances of /dev. The basic scheme is: Build a kernel with "options MAGICLINKS", or arrange to run sysctl -w vfs.generic.magiclinks=1 very early in /etc/rc. Putting the setting in /etc/sysctl.conf will probably be too late. mkdir /dev.i386 mkdir /dev.amd64 copy the i386 version of MAKEDEV to /dev.i386/MAKEDEV copy the amd64 version of MAKEDEV to /dev.amd64/MAKEDEV ( cd /dev.i386 && sh ./MAKEDEV all ) ( cd /dev.amd64 && sh ./MAKEDEV all ) mv /dev /dev.old && ln -sf dev.@machine /dev reboot. If it works then rm -rf /dev.old.
Oh, I forgot to address the issue of booting without "options MAGICLINKS" in the kernel. No matter how early in /etc/rc you try to put the "sysctl -w vfs.generic.magiclinks=1" command, init(8) will want to open /dev/console earlier than that. So you either have to enable magiclinks in the kernel (so it's already enabled before init(8) starts), or you have to arrange for /dev/console to work even before magiclinks are enabled via the sysctl command.
Adding a symlink from /dev.@machine to dev.i386 works for this (taking "dev.@machine" literally instead of as a magic expansion):
ln -s dev.i386 /dev.@machineThis is good enough for /dev/console and /dev/null, because the amd64 and i386 versions of those device nodes are identical.
--apb (Alan Barrett)