From f39e38b46a53807546cb94f3e554876fcbcf6acf Mon Sep 17 00:00:00 2001 From: Ivan Davidov Date: Sat, 18 Apr 2015 14:24:49 +0300 Subject: [PATCH] Forgot to add the files from the previous commit. There are few helper .sh files for "qemu". --- src/.config | 4 ++-- src/2_build_kernel.sh | 5 ++--- src/4_build_busybox.sh | 12 +++++++++--- src/5_generate_rootfs.sh | 17 +++++++++++++++++ src/7_generate_iso.sh | 4 +++- 5 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/.config b/src/.config index 1e4c4602b..72c6e3cb8 100644 --- a/src/.config +++ b/src/.config @@ -2,11 +2,11 @@ # # http://kernel.org # -KERNEL_SOURCE_URL=https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.18.6.tar.xz +KERNEL_SOURCE_URL=https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.0.tar.xz # You can find the latest BusyBox source bundles here: # # http://busybox.net # -BUSYBOX_SOURCE_URL=http://busybox.net/downloads/busybox-1.23.1.tar.bz2 +BUSYBOX_SOURCE_URL=http://busybox.net/downloads/busybox-1.23.2.tar.bz2 diff --git a/src/2_build_kernel.sh b/src/2_build_kernel.sh index bbe958721..1734a0270 100755 --- a/src/2_build_kernel.sh +++ b/src/2_build_kernel.sh @@ -14,11 +14,10 @@ make defconfig # Changes the name of the system sed -i "s/.*CONFIG_DEFAULT_HOSTNAME.*/CONFIG_DEFAULT_HOSTNAME=\"minimal\"/" .config -# Compile the kernel +# Compile the kernel with optimization for "parallel jobs" = "number of processors" # Good explanation of the different kernels # http://unix.stackexchange.com/questions/5518/what-is-the-difference-between-the-following-kernel-makefile-terms-vmlinux-vmlinux -# TODO - Suggested by Ronny Kalusniok - test this for parallel compilation: "make bzImage -j $(grep ^processor /proc/cpuinfo)". -make bzImage +make bzImage -j $(grep ^processor /proc/cpuinfo | wc -l) cd ../../.. diff --git a/src/4_build_busybox.sh b/src/4_build_busybox.sh index 9d0360f73..b54ada851 100755 --- a/src/4_build_busybox.sh +++ b/src/4_build_busybox.sh @@ -15,9 +15,15 @@ make defconfig # You could do this manually with 'make menuconfig' sed -i "s/.*CONFIG_STATIC.*/CONFIG_STATIC=y/" .config -# Compile busybox -# TODO - Suggested by Ronny Kalusniok - test this for parallel compilation: "make busybox -j $(grep ^processor /proc/cpuinfo)". -make busybox +# Busybox has "RPC networking" enabled in default configuration file. +# In glibc > 2.14 such support was removed by default. +# http://lists.busybox.net/pipermail/buildroot/2012-June/055173.html +# It causes failures on glibc toolchains without RPC support. +sed -e 's/.*CONFIG_FEATURE_HAVE_RPC.*/CONFIG_FEATURE_HAVE_RPC=n/' -i .config +sed -e 's/.*CONFIG_FEATURE_INETD_RPC.*/CONFIG_FEATURE_INETD_RPC=n/' -i .config + +# Compile busybox with optimization for "parallel jobs" = "number of processors" +make busybox -j $(grep ^processor /proc/cpuinfo | wc -l) # Create the symlinks for busybox # It uses the file 'busybox.links' for this diff --git a/src/5_generate_rootfs.sh b/src/5_generate_rootfs.sh index aab6dbe3b..2a28d98f3 100755 --- a/src/5_generate_rootfs.sh +++ b/src/5_generate_rootfs.sh @@ -31,10 +31,27 @@ mount -t devtmpfs none /dev mount -t proc none /proc mount -t sysfs none /sys +ip link set lo up +ip link set eth0 up +udhcpc -b -i eth0 -s /etc/rc.dhcp + EOF chmod +x bootscript.sh +cat > rc.dhcp << EOF +#!/bin/sh + +ip addr add \$ip/\$mask dev \$interface + +if [ -n "$router"]; then + ip route add default via \$router dev \$interface +fi + +EOF + +chmod +x rc.dhcp + cat > welcome.txt << EOF ##################################### diff --git a/src/7_generate_iso.sh b/src/7_generate_iso.sh index e9dcd39bb..e0df2d046 100755 --- a/src/7_generate_iso.sh +++ b/src/7_generate_iso.sh @@ -8,7 +8,9 @@ cd $(ls -d *) # Edit Makefile to look for genisoimage instead of mkisofs sed -i 's/mkisofs/genisoimage/g' arch/x86/boot/Makefile -make isoimage FDINITRD=../../rootfs.cpio.gz +# Generate the ISO image with optimization for "parallel jobs" = "number of processors" +make isoimage FDINITRD=../../rootfs.cpio.gz -j $(grep ^processor /proc/cpuinfo | wc -l) + cp arch/x86/boot/image.iso ../../../minimal_linux_live.iso cd ../../..