diff --git a/src/02_get_kernel.sh b/src/02_get_kernel.sh index b52105798..c75c8983e 100755 --- a/src/02_get_kernel.sh +++ b/src/02_get_kernel.sh @@ -35,5 +35,5 @@ mkdir ../work/kernel # Full path will be something like 'work/kernel/linux-4.4.6'. tar -xvf $ARCHIVE_FILE -C ../work/kernel -cd .. +cd $SRC_DIR diff --git a/src/03_build_kernel.sh b/src/03_build_kernel.sh index 228bd6683..38e97a101 100755 --- a/src/03_build_kernel.sh +++ b/src/03_build_kernel.sh @@ -54,5 +54,5 @@ make \ echo "Generating kernel headers..." make headers_install -cd ../../.. +cd $SRC_DIR diff --git a/src/04_get_glibc.sh b/src/04_get_glibc.sh index 29b521a4c..55f0f1acc 100755 --- a/src/04_get_glibc.sh +++ b/src/04_get_glibc.sh @@ -35,5 +35,5 @@ mkdir ../work/glibc # Full path will be something like 'work/glibc/glibc-2.23'. tar -xvf $ARCHIVE_FILE -C ../work/glibc -cd .. +cd $SRC_DIR diff --git a/src/05_build_glibc.sh b/src/05_build_glibc.sh index 0e21fdd7f..9e475b254 100755 --- a/src/05_build_glibc.sh +++ b/src/05_build_glibc.sh @@ -1,10 +1,12 @@ #!/bin/sh +SRC_DIR=$(pwd) + # Find the kernel build directory. cd work/kernel cd $(ls -d linux-*) WORK_KERNEL_DIR=$(pwd) -cd ../../.. +cd $SRC_DIR cd work/glibc @@ -52,5 +54,5 @@ make install \ DESTDIR=$GLIBC_INSTALLED \ -j $(grep ^processor /proc/cpuinfo | wc -l) -cd ../../.. +cd $SRC_DIR diff --git a/src/06_prepare_glibc.sh b/src/06_prepare_glibc.sh index d91a3ce21..9148bc1eb 100755 --- a/src/06_prepare_glibc.sh +++ b/src/06_prepare_glibc.sh @@ -1,14 +1,16 @@ #!/bin/sh +SRC_DIR=$(pwd) + # Find the kernel build directory. cd work/kernel cd $(ls -d *) WORK_KERNEL_DIR=$(pwd) -cd ../../.. +cd $SRC_DIR cd work/glibc -echo "Preparing glibc..." +echo "Preparing glibc. This may take a while..." rm -rf glibc_prepared cp -r glibc_installed glibc_prepared @@ -46,5 +48,5 @@ ln -s $WORK_KERNEL_DIR/usr/include/asm asm ln -s $WORK_KERNEL_DIR/usr/include/asm-generic asm-generic ln -s $WORK_KERNEL_DIR/usr/include/mtd mtd -cd ../../../.. +cd $SRC_DIR diff --git a/src/07_get_busybox.sh b/src/07_get_busybox.sh index 8fa4f9a36..c0dbdbe68 100755 --- a/src/07_get_busybox.sh +++ b/src/07_get_busybox.sh @@ -35,5 +35,5 @@ mkdir ../work/busybox # Full path will be something like 'work/busybox/busybox-1.24.2'. tar -xvf $ARCHIVE_FILE -C ../work/busybox -cd .. +cd $SRC_DIR diff --git a/src/08_build_busybox.sh b/src/08_build_busybox.sh index aa481fdfb..0bc360158 100755 --- a/src/08_build_busybox.sh +++ b/src/08_build_busybox.sh @@ -59,5 +59,5 @@ make \ CONFIG_PREFIX="../busybox_installed" \ install -cd ../../.. +cd $SRC_DIR diff --git a/src/09_generate_rootfs.sh b/src/09_generate_rootfs.sh index 5f6f53341..9d49551b4 100755 --- a/src/09_generate_rootfs.sh +++ b/src/09_generate_rootfs.sh @@ -36,10 +36,10 @@ else echo "Source files and folders have been skipped." fi -# This is for the dynamic loader. Note that the file name and the the location -# are both specific for 32-bit and 64-bit machines. First we check the BusyBox -# executable and then we copy the loader to its appropriate location. -BUSYBOX_ARCH=$(file bin/busybox | cut -d\ -f3) +# This is for the dynamic loader. Note that the name and the location are both +# specific for 32-bit and 64-bit machines. First we check the BusyBox executable +# and then we copy the dynamic loader to its appropriate location. +BUSYBOX_ARCH=$(file bin/busybox | cut -d' ' -f3) if [ "$BUSYBOX_ARCH" = "64-bit" ] ; then mkdir lib64 cp $GLIBC_PREPARED/lib/ld-linux* lib64 diff --git a/src/10_pack_rootfs.sh b/src/10_pack_rootfs.sh index 00ce622ee..2f928ac05 100755 --- a/src/10_pack_rootfs.sh +++ b/src/10_pack_rootfs.sh @@ -1,5 +1,7 @@ #!/bin/sh +SRC_DIR=$(pwd) + cd work # Remove the old 'initramfs' archive if it exists. @@ -11,5 +13,5 @@ cd rootfs echo "Packing initramfs..." find . | cpio -R root:root -H newc -o | xz --check=none > ../rootfs.cpio.xz -cd ../.. +cd cd $SRC_DIR diff --git a/src/11_get_syslinux.sh b/src/11_get_syslinux.sh index dd71ac58c..042480bae 100755 --- a/src/11_get_syslinux.sh +++ b/src/11_get_syslinux.sh @@ -35,5 +35,5 @@ mkdir ../work/syslinux # Full path will be something like 'work/syslinux/syslinux-6.03'. tar -xvf $ARCHIVE_FILE -C ../work/syslinux -cd .. +cd $SRC_DIR diff --git a/src/12_generate_iso.sh b/src/12_generate_iso.sh index 3364d2362..90a6d4b4e 100755 --- a/src/12_generate_iso.sh +++ b/src/12_generate_iso.sh @@ -6,13 +6,13 @@ SRC_DIR=$(pwd) cd work/kernel cd $(ls -d *) WORK_KERNEL_DIR=$(pwd) -cd ../../.. +cd $SRC_DIR # Find the Syslinux build directory. cd work/syslinux cd $(ls -d *) WORK_SYSLINUX_DIR=$(pwd) -cd ../../.. +cd $SRC_DIR # Remove the old ISO file if it exists. rm -f minimal_linux_live.iso