diff --git a/build_utils b/build_utils new file mode 100755 index 0000000..7b69825 --- /dev/null +++ b/build_utils @@ -0,0 +1,27 @@ + + +cp_packages (){ + #IMPORTANT: must be run from the folder where the iglunix repo is. + #NOTE: this will assume that there always is a '*-dev'/'*-doc' package,\n this is not true. + # That's why the errors are shown to some one who cares. + + echo "Hello this is build-utils" + + + for pkg in ${packages[@]} + do + if [ ! -d pkgs/${pkg}/out ]; then + echo "NOTE: ${pkg} was not yet build, building it now" + cd pkgs/${pkg}/ + ../../iglupkg.sh + cd ../.. + fi + + echo "Going to copy: $pkg to $1" + tar -xf pkgs/${pkg}/out/${pkg}.*.tar.xz -C $1 + tar -xf pkgs/${pkg}/out/${pkg}-dev.*.tar.xz -C $1 2> /dev/null + tar -xf pkgs/${pkg}/out/${pkg}-doc.*.tar.xz -C $1 2> /dev/null + + done +} + diff --git a/geninitrd.sh b/geninitrd.sh index 651bf94..5e1c6d6 100755 --- a/geninitrd.sh +++ b/geninitrd.sh @@ -10,37 +10,30 @@ # # Create the root fs dir + +echo "geninitrd.sh" + +source build_utils + +rm -rf isoout isoroot mkdir isoroot mkdir isoout -mkdir diskroot -cp_packages (){ - #NOTE: this will assume that there always is a '*-dev'/'*-doc' package,\n this is not true. - # That's why the errors are shown to some one who cares. - for pkg in ${packages[@]} - do - echo "Going to copy: $pkg to $1" - tar -xf pkgs/${pkg}/out/${pkg}.*.tar.xz -C $1 - tar -xf pkgs/${pkg}/out/${pkg}-dev.*.tar.xz -C $1 2> /dev/null - tar -xf pkgs/${pkg}/out/${pkg}-doc.*.tar.xz -C $1 2> /dev/null - done -} +# This should be a minimal number of packages, if we want fast boot times. +# The remaining packages are in createimg.sh #packages=(musl mksh bmake gmake libressl cmake curl rsync linux flex byacc om4 zlib samurai libffi python ca-certificates zlib expat gettext-tiny git kati netbsd-curses kakoune iglunix) packages=(musl linux mksh busybox toybox iglunix) cp_packages ./isoroot -#packages=(musl mksh busybox toybox llvm bmake gmake libressl cmake curl rsync linux flex byacc om4 zlib samurai libffi python ca-certificates zlib expat gettext-tiny git kati netbsd-curses kakoune iglunix rust less heirloom-doctools file pci-ids) -#cp_packages ./diskroot - cat >isoroot/init << EOF #!/bin/sh exec /sbin/init EOF rm isoroot/sbin/init -cat >isoroot/sbin/init << EOF +cat >isoroot/sbin/init << 'EOF' #!/bin/sh export PATH=/usr/sbin:/usr/bin:/sbin:/bin @@ -54,17 +47,17 @@ mount -t tmpfs tmpfs /tmp busybox mdev -s busybox mdev -d -exec /bin/sh - mkdir /mnt -# while not mount $(blkid -L IGLUNIX_BS_MEDIA) /mnt; do -# echo "Failed to mount boot disk" -# echo "Retrying" -# sleep 0.5 -# done +while ! mount $(findfs LABEL=__IGLUNIX_ROOT) /mnt; do + echo "Failed to mount boot disk" + echo "Retrying" + sleep 0.5 +done -exec switch_root /mnt + +echo "Starting switch_root" +exec switch_root /mnt /bin/sh EOF @@ -115,6 +108,8 @@ chmod +x isoroot/sbin/init # cp /etc/inittab isoroot/etc/ +cp /etc/hostname ./isoroot/hostname + cd isoroot find . | cpio -ov | gzip -9 >../isoout/initramfs.img cp boot/vmlinuz ../isoout/vmlinuz diff --git a/pkgs/e2fsprogs/build.sh b/pkgs/e2fsprogs/build.sh new file mode 100644 index 0000000..ea56348 --- /dev/null +++ b/pkgs/e2fsprogs/build.sh @@ -0,0 +1,51 @@ +pkgname=e2fsprogs +pkgver=1.45.6 +bad="gmake" + + +fetch() { + curl -L "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v$pkgver/$pkgname-$pkgver.tar.xz" -o $pkgname-$pkgver.tar.xz + tar -xf $pkgname-$pkgver.tar.xz +} + +build() { + cd $pkgname-$pkgver + + echo "$pkgdir" + ./configure \ + --prefix=/usr \ + --build=x86_64-unknown-linux-musl \ + --host=x86_64-unknown-linux-musl \ + + #--exec_prefix=/ + + gmake +} + +package() { + cd $pkgname-$pkgver + # Doesn't work :( + #gmake install DESTDIR=$pkgdir PREFIX=/usr + + # We're not moving util/subst + # Do we need to? IDK + + mkdir -p $pkgdir/usr/bin + mkdir -p $pkgdir/usr/lib + + + mv misc/badblocks misc/blkid misc/chattr misc/dumpe2fs misc/e2freefrag misc/e2fuzz misc/e2image \ + misc/e2initrd_helper misc/e2undo misc/e4crypt misc/e4defrag misc/filefrag misc/fsck \ + misc/logsave misc/lsattr misc/mke2fs misc/mklost+found misc/tune2fs misc/uuidd misc/uuidgen \ + $pkgdir/usr/bin + + mv e2fsck/e2fsck debugfs/debugfs resize/resize2fs $pkgdir/usr/bin + + cd lib + mv libblkid.a libe2p.a libss.a libuuid.a libcom_err.a libext2fs.a libsupport.a $pkgdir/usr/lib +} + +license() { + cd $pkgname-$pkgver + cat NOTICE +} diff --git a/pkgs/kbd/build.sh b/pkgs/kbd/build.sh new file mode 100644 index 0000000..7c06c6e --- /dev/null +++ b/pkgs/kbd/build.sh @@ -0,0 +1,29 @@ +pkgname=kbd +pkgver=2.4.0 + + + +fetch() { + curl "https://mirrors.edge.kernel.org/pub/linux/utils/kbd/kbd-$pkgver.tar.xz" -o $pkgname-$pkgver.tar.xz + tar -xf $pkgname-$pkgver.tar.xz +} + +build() { + cd $pkgname-$pkgver + ./configure \ + --prefix=/usr \ + --build=x86_64-unknown-linux-musl \ + --host=x86_64-unknown-linux-musl + + make +} + +package() { + cd $pkgname-$pkgver + make install DESTDIR=$pkgdir +} + +license() { + cd $pkgname-$pkgver + cat COPYING +} diff --git a/pkgs/linux-pam/build.sh b/pkgs/linux-pam/build.sh index 593b596..c891887 100644 --- a/pkgs/linux-pam/build.sh +++ b/pkgs/linux-pam/build.sh @@ -26,6 +26,5 @@ package() { license() { cd $pkgname-$pkgver - cat LICENSE -# cat COPYING + cat COPYING } diff --git a/pkgs/tiny-linux-bootloader/build.sh b/pkgs/tiny-linux-bootloader/build.sh index 6dc5e3a..d604697 100644 --- a/pkgs/tiny-linux-bootloader/build.sh +++ b/pkgs/tiny-linux-bootloader/build.sh @@ -11,6 +11,8 @@ fetch() { package() { cd $pkgname-$pkgver + + rm -rf /tiny-linux-bootloader mkdir /tiny-linux-bootloader CURR_DIR=$(pwd)