From fb5ab6f49af875c00e0f6850ed49262d6f9f3634 Mon Sep 17 00:00:00 2001 From: Ivan Davidov Date: Sat, 2 Apr 2016 14:30:53 +0300 Subject: [PATCH] Updated the root FS generation process to support x86_64 machines. GNU libc dependencies have been reduced significantly and only the DNS related libraries are used. This works for x86_64 machines but hasn't been tested on pure 32-bit machines. --- .../glibc-busybox/08_generate_rootfs.sh | 38 +++++++------------ src/experimental/glibc-busybox/qemu32.sh | 2 +- src/experimental/glibc-busybox/qemu64.sh | 2 +- 3 files changed, 15 insertions(+), 27 deletions(-) diff --git a/src/experimental/glibc-busybox/08_generate_rootfs.sh b/src/experimental/glibc-busybox/08_generate_rootfs.sh index 08cb9b07b..e230b3bfe 100755 --- a/src/experimental/glibc-busybox/08_generate_rootfs.sh +++ b/src/experimental/glibc-busybox/08_generate_rootfs.sh @@ -21,9 +21,10 @@ cd ../../rootfs # Remove "linuxrc" which is used when we boot in "RAM disk" mode. rm -f linuxrc -# Create root FS folders +# Create root FS folders. mkdir dev mkdir etc +mkdir lib mkdir proc mkdir root mkdir src @@ -107,32 +108,13 @@ tty4::respawn:/bin/sh EOF -cat > nsswitch.conf << EOF -passwd: db files nis -shadow: files -group: db files nis - -hosts: files nisplus nis dns -networks: nisplus [NOTFOUND=return] files - -ethers: nisplus [NOTFOUND=return] db files -protocols: nisplus [NOTFOUND=return] db files -rpc: nisplus [NOTFOUND=return] db files -services: nisplus [NOTFOUND=return] db files - -EOF - cd .. # The "/init" script passes the execution to "/sbin/init" which in turn looks # for the configuration file "/etc/inittab". cat > init << EOF #!/bin/sh -echo "1111111111111111" -echo "1111111111111111" -echo "1111111111111111" -PATH=/lib:$PATH -export PATH + exec /sbin/init EOF @@ -147,10 +129,16 @@ chmod +rx src/*.sh chmod +r src/.config chmod +r src/*.txt -#cd bin -#cp -r $GLIBC_INSTALLED/lib/* . -#cd .. -cp -r $GLIBC_INSTALLED/* . +# Copy the necessary 'glibc' libraries for proper DNS resolving. +cp $GLIBC_INSTALLED/lib/libm.so.6 ./lib +cp $GLIBC_INSTALLED/lib/libc.so.6 ./lib +cp $GLIBC_INSTALLED/lib/ld-linux* ./lib +cp $GLIBC_INSTALLED/lib/libresolv.so.2 ./lib +cp $GLIBC_INSTALLED/lib/libnss_dns.so.2 ./lib + + +# Make sure x86_64 binaries can be loaded (for 64bit machines). +ln -s lib lib64 cd ../.. diff --git a/src/experimental/glibc-busybox/qemu32.sh b/src/experimental/glibc-busybox/qemu32.sh index 6beeb5dd4..3d0ca2a92 100755 --- a/src/experimental/glibc-busybox/qemu32.sh +++ b/src/experimental/glibc-busybox/qemu32.sh @@ -1,4 +1,4 @@ #!/bin/sh -qemu-system-i386 -m 256M -cdrom minimal_linux_live.iso +qemu-system-i386 -m 64M -cdrom minimal_linux_live.iso diff --git a/src/experimental/glibc-busybox/qemu64.sh b/src/experimental/glibc-busybox/qemu64.sh index 8e5174a01..34392b5ce 100755 --- a/src/experimental/glibc-busybox/qemu64.sh +++ b/src/experimental/glibc-busybox/qemu64.sh @@ -1,4 +1,4 @@ #!/bin/sh -qemu-system-x86_64 -cdrom minimal_linux_live.iso +qemu-system-x86_64 -m 64M -cdrom minimal_linux_live.iso