Initial commit for the already completed "28-Jul-2014" shell scripts.

This commit is contained in:
Ivan Davidov 2014-08-03 18:19:16 +03:00
parent 23bf6f6547
commit e1a84e397e
10 changed files with 133 additions and 0 deletions

11
src/.config Normal file
View File

@ -0,0 +1,11 @@
# You can find the latest Linux kernel source bundles here:
#
# http://kernel.org
#
KERNEL_SOURCE_URL=https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.15.6.tar.xz
# You can find the latest BusyBox source bundles here:
#
# http://busybox.net
#
BUSYBOX_SOURCE_URL=http://busybox.net/downloads/busybox-1.22.1.tar.bz2

5
src/0_prepare.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/sh
rm -rf work
mkdir work

13
src/1_get_kernel.sh Normal file
View File

@ -0,0 +1,13 @@
#/bin/sh
DOWNLOAD_URL=$(grep -i KERNEL_SOURCE_URL .config | cut -f2 -d'=')
ARCHIVE_FILE=${DOWNLOAD_URL##*/}
cd work
rm -f $ARCHIVE_FILE
wget $DOWNLOAD_URL
rm -rf kernel
mkdir kernel
tar -xvf $ARCHIVE_FILE -C kernel
cd ..

10
src/2_build_kernel.sh Normal file
View File

@ -0,0 +1,10 @@
#/bin/sh
cd work/kernel
cd $(ls -d *)
make clean
make defconfig
sed -i "s/.*CONFIG_DEFAULT_HOSTNAME.*/CONFIG_DEFAULT_HOSTNAME=\"minimal-linux-live\"/" .config
make vmlinux
cd ../../..

13
src/3_get_busybox.sh Normal file
View File

@ -0,0 +1,13 @@
#/bin/sh
DOWNLOAD_URL=$(grep -i BUSYBOX_SOURCE_URL .config | cut -f2 -d'=')
ARCHIVE_FILE=${DOWNLOAD_URL##*/}
cd work
rm -f $ARCHIVE_FILE
wget $DOWNLOAD_URL
rm -rf busybox
mkdir busybox
tar -xvf $ARCHIVE_FILE -C busybox
cd ..

11
src/4_build_busybox.sh Normal file
View File

@ -0,0 +1,11 @@
#/bin/sh
cd work/busybox
cd $(ls -d *)
make clean
make defconfig
sed -i "s/.*CONFIG_STATIC.*/CONFIG_STATIC=y/" .config
make busybox
make install
cd ../../..

42
src/5_generate_rootfs.sh Normal file
View File

@ -0,0 +1,42 @@
#/bin/sh
cd work
rm -rf rootfs
cd busybox
cd $(ls -d *)
cp -R _install ../../rootfs
cd ../../rootfs
rm -f linuxrc
mkdir dev
mkdir etc
mkdir proc
mkdir src
mkdir sys
mkdir tmp
cd etc
touch welcome.txt
echo >> welcome.txt
echo ' #####################################' >> welcome.txt
echo ' # #' >> welcome.txt
echo ' # Welcome to "Minimal Linux Live" #' >> welcome.txt
echo ' # #' >> welcome.txt
echo ' #####################################' >> welcome.txt
echo >> welcome.txt
cd ..
touch init
echo '#!/bin/sh' >> init
echo 'dmesg -n 1' >> init
echo 'mount -t devtmpfs none /dev' >> init
echo 'mount -t proc none /proc' >> init
echo 'mount -t sysfs none /sys' >> init
echo 'cat /etc/welcome.txt' >> init
echo 'while true' >> init
echo 'do' >> init
echo ' setsid cttyhack /bin/sh' >> init
echo 'done' >> init
echo >> init
chmod +x init
cp ../../*.sh src
cp ../../.config src
cd ../..

8
src/6_pack_rootfs.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/sh
cd work
rm -f rootfs.cpio.gz
cd rootfs
find . | cpio -H newc -o | gzip > ../rootfs.cpio.gz
cd ../..

9
src/7_generate_iso.sh Normal file
View File

@ -0,0 +1,9 @@
#/bin/sh
rm -f minimal_linux_live.iso
cd work/kernel
cd $(ls -d *)
make isoimage FDINITRD=../../rootfs.cpio.gz
cp arch/x86/boot/image.iso ../../../minimal_linux_live.iso
cd ../../..

View File

@ -0,0 +1,11 @@
#!/bin/sh
./0_prepare.sh
./1_get_kernel.sh
./2_build_kernel.sh
./3_get_busybox.sh
./4_build_busybox.sh
./5_generate_rootfs.sh
./6_pack_rootfs.sh
./7_generate_iso.sh