mo packages

This commit is contained in:
Ella Stanforth 2022-04-23 10:46:17 +00:00
parent b712b661b0
commit 61a41d947c
6 changed files with 142 additions and 10 deletions

View file

@ -50,7 +50,17 @@ s2_build() {
PKGDIR=$1
PKGNAME=$2
cd $1/$2
[ -f .s2 ] || ${IP}iglupkg.sh --with-cross=x86_64 --with-cross-dir=$SYSROOT_S1 --for-cross --for-cross-dir=/ fbp
[ -f .s2 ] || ${IP}iglupkg.sh --with-cross=x86_64 --with-cross-dir=$SYSROOT_S1 --for-cross --for-cross-dir= fbp
touch .s2
# 2>$LOGS/$2.1.err > $LOGS/$2.1.out
cd ../../
}
s2e_build() {
PKGDIR=$1
PKGNAME=$2
cd $1/$2
[ -f .s2 ] || ${IP}iglupkg.sh --with-cross=x86_64 --with-cross-dir=$SYSROOT_S2 --for-cross --for-cross-dir= fbp
touch .s2
# 2>$LOGS/$2.1.err > $LOGS/$2.1.out
cd ../../
@ -78,14 +88,19 @@ export CXX=$CXX_INCL
echo === STAGE 2 === Assemble sysroot
[ -d "$SYSROOT_S2" ] || {
mkdir -p $SYSROOT_S2
s2_extract linux musl
s2_extract linux linux
s2_extract base libunwind
s2_extract base libcxx
}
s2_extract linux musl
s2_extract linux linux
s2_extract base libunwind
s2_extract base libcxx
echo === STAGE 2 === Build extra libs
s2e_build base zlib-ng
s2_extract base zlib-ng
s2e_build base libelf
s2_extract base libelf
s2e_build base openssl
s2_extract base openssl
echo === STAGE 3 === Build target packages
@ -99,7 +114,9 @@ s3_build() {
cd ../../
}
#s3_build linux linux
s3_build linux limine
s3_build linux linux
s3_build linux make_ext4fs
s3_build linux musl
s3_build linux busybox
s3_build base mksh
@ -110,6 +127,24 @@ export CXX=$CXX_NOINCL
s3_build base libcxx
export CXX=$CXX_INCL
s3_build base llvm
s3_build base oslo
s3_build base zlib-ng
s3_build base bmake
s3_build base byacc
s3_build base curl
s3_build base openssl
s3_build base doas
s3_build base expat
s3_build base flex
s3_build base libelf
s3_build base man-pages-posix
s3_build base netbsd-curses
s3_build base om4
s3_build base samurai
s3_build base zstd
s3_build bad bad
s3_build bad gmake
touch .autobuilt

View file

@ -10,6 +10,8 @@ cex() {
tar -xf iglunix/$PKGDIR/$PKGNAME/out/$PKGNAME.*.tar.zst -I zstd -C $CHROOT
}
cex linux limine
cex linux linux
cex linux musl
cex linux busybox
cex base mksh
@ -18,3 +20,4 @@ cex base compiler-rt
cex base libunwind
cex base libcxx
cex base llvm
cex base oslo

26
enter_chroot.sh Executable file
View file

@ -0,0 +1,26 @@
#!/bin/sh
SUDO=doas
command -V $SUDO 2> /dev/null > /dev/null || SUDO=sudo
[ $(id -u) -eq 0 ] || $SUDO "$0" "$@"
mkdir build/chroot/tmp
mkdir build/chroot/sys
mkdir build/chroot/proc
mkdir build/chroot/dev
mount -t tmpfs tmpfs build/chroot/tmp
mount -t sysfs sysfs build/chroot/sys
mount -t proc proc build/chroot/proc
mount --bind /dev build/chroot/dev
PATH=/sbin:/bin:/usr/sbin:/usr/bin chroot build/chroot /bin/sh
umount build/chroot/tmp
umount build/chroot/sys
umount build/chroot/proc
umount build/chroot/dev
rmdir build/chroot/tmp
rmdir build/chroot/sys
rmdir build/chroot/proc
rmdir build/chroot/dev

9
img.fdisk Normal file
View file

@ -0,0 +1,9 @@
o
n
p
1
2048
1048575
t
ef
w

49
initrd.sh Executable file
View file

@ -0,0 +1,49 @@
#!/bin/sh -e
# generate the installer initcpio image
mkdir -p build/initrd/
cex() {
PKGDIR=$1
PKGNAME=$2
tar -xf build/iglunix/$PKGDIR/$PKGNAME/out/$PKGNAME.*.tar.zst -I zstd -C build/initrd
}
cex linux musl
cex linux make_ext4fs
cex linux busybox
cex base mksh
cex base toybox
cex base zlib-ng # for make_ext4fs and zstd
cex base zstd # for extracting tarballs
cex linux limine # for installing mbr bootloader
cat > build/initrd/init <<EOF
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
mkdir -p /dev
mkdir -p /tmp
mkdir -p /proc
mkdir -p /sys
mkdir -p /mnt
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mount -t tmpfs tmpfs /tmp
mdev -s
mdev -d
echo 0 > /proc/sys/kernel/printk
mount \$(findfs LABEL=IGLUNIX) /mnt
exec /sbin/init
EOF
chmod +x build/initrd/init
cd build/initrd/
find . | cpio -o -H newc > ../initrd.cpio
cd ..
gzip -f initrd.cpio > initrd.cpio.gz
cd ..

10
qemu.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
fatal() {
echo "$@"
exit 1
}
[ -d build/chroot ] || fatal "run ./chroot.sh first"
qemu-system-x86_64 -drive if=pflash,format=raw,file="/usr/share/qemu/edk2-x86_64-code.fd" \
-nographic -net none -m 1024 \
-hda build/iglunix.img