Reorganisation de tout le systéme de build + debuggage os loader au autre scripts
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
rootfs.iso
|
rootfs.iso
|
||||||
chibrax.tar.gz
|
chibrax.tar.gz
|
||||||
rootfs
|
rootfs
|
||||||
|
libfs
|
||||||
linux-firmware
|
linux-firmware
|
||||||
disk.img
|
disk.img
|
||||||
diskoffset
|
diskoffset
|
||||||
|
|||||||
@@ -1,77 +1,104 @@
|
|||||||
#!/bin/bash
|
#!./bash-static
|
||||||
|
|
||||||
if [ "$EUID" = 0 ]
|
if [ "$EUID" = 0 ]
|
||||||
then echo "Please don't run this as root"
|
then echo "Please don't run this as root"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
unset LD_LIBRARY_PATH
|
||||||
|
export LD_LIBRARY_PATH=$(pwd)/libfs/usr/lib
|
||||||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/libfs/usr/lib32
|
||||||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/libfs/usr/lib64
|
||||||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/libfs/usr/local/lib64
|
||||||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/libfs/usr/local/lib
|
||||||
|
#host system for backup
|
||||||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib64
|
||||||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib
|
||||||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib32
|
||||||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64
|
||||||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib
|
||||||
|
|
||||||
|
unset LD_LIBRARY_PATH
|
||||||
|
|
||||||
|
echo $LD_LIBRARY_PATH
|
||||||
|
|
||||||
|
function makeroot {
|
||||||
|
mkdir -p ${1}/boot || exit 1
|
||||||
|
mkdir -p ${1}/chibrax || exit 1
|
||||||
|
mkdir -p ${1}/usr/local/bin || exit 1
|
||||||
|
mkdir -p ${1}/usr/local/sbin || exit 1
|
||||||
|
mkdir -p ${1}/usr/local/lib || exit 1
|
||||||
|
mkdir -p ${1}/usr/local/lib64 || exit 1
|
||||||
|
mkdir -p ${1}/usr/local/etc || exit 1
|
||||||
|
mkdir -p ${1}/usr/bin || exit 1
|
||||||
|
mkdir -p ${1}/usr/sbin || exit 1
|
||||||
|
mkdir -p ${1}/usr/lib || exit 1
|
||||||
|
mkdir -p ${1}/usr/lib32 || exit 1
|
||||||
|
mkdir -p ${1}/dev || exit 1
|
||||||
|
mkdir -p ${1}/sys || exit 1
|
||||||
|
mkdir -p ${1}/tmp || exit 1
|
||||||
|
mkdir -p ${1}/home || exit 1
|
||||||
|
mkdir -p ${1}/root || exit 1
|
||||||
|
mkdir -p ${1}/proc || exit 1
|
||||||
|
mkdir -p ${1}/run || exit 1
|
||||||
|
|
||||||
|
echo "creating ${1} links"
|
||||||
|
cd ${1}
|
||||||
|
ln -s usr/bin bin || exit 1
|
||||||
|
ln -s usr/sbin sbin || exit 1
|
||||||
|
ln -s usr/lib lib || exit 1
|
||||||
|
ln -s usr/lib lib64 || exit 1
|
||||||
|
cd -
|
||||||
|
cd ${1}/usr
|
||||||
|
ln -s lib lib64 || exit 1
|
||||||
|
cd -
|
||||||
|
}
|
||||||
|
|
||||||
# 2> /dev/null veut dire que l'on veut pas voire les erreurs
|
# 2> /dev/null veut dire que l'on veut pas voire les erreurs
|
||||||
sudo umount rootfs/proc -R 2> /dev/null
|
sudo umount rootfs/proc -R 2> /dev/null
|
||||||
sudo rm -rf rootfs/ 2> /dev/null
|
sudo rm -rf rootfs/ 2> /dev/null
|
||||||
|
sudo rm -rf libfs/ 2> /dev/null
|
||||||
sudo rm root.iso 2> /dev/null
|
sudo rm root.iso 2> /dev/null
|
||||||
sudo rm chibrax.tar.gz 2> /dev/null
|
sudo rm chibrax.tar.gz 2> /dev/null
|
||||||
mkdir -p rootfs/
|
makeroot libfs || exit 1
|
||||||
mkdir -p rootfs/boot
|
makeroot rootfs || exit 1
|
||||||
mkdir -p rootfs/chibrax
|
|
||||||
mkdir -p rootfs/usr/local/bin
|
|
||||||
mkdir -p rootfs/usr/local/sbin
|
|
||||||
mkdir -p rootfs/usr/local/lib
|
|
||||||
mkdir -p rootfs/usr/local/lib64
|
|
||||||
mkdir -p rootfs/usr/local/etc
|
|
||||||
mkdir -p rootfs/usr/bin
|
|
||||||
mkdir -p rootfs/usr/sbin
|
|
||||||
mkdir -p rootfs/usr/lib
|
|
||||||
mkdir -p rootfs/usr/lib32
|
|
||||||
mkdir -p rootfs/dev
|
|
||||||
mkdir -p rootfs/sys
|
|
||||||
mkdir -p rootfs/tmp
|
|
||||||
mkdir -p rootfs/home
|
|
||||||
mkdir -p rootfs/root
|
|
||||||
#TODO: faire des lien vers usr/bin et usr/sbin
|
|
||||||
mkdir -p rootfs/proc
|
|
||||||
mkdir -p rootfs/run
|
|
||||||
|
|
||||||
npm i
|
npm i
|
||||||
|
|
||||||
cd rootfs
|
|
||||||
ln -s usr/bin bin || exit 1
|
|
||||||
ln -s usr/sbin sbin || exit 1
|
|
||||||
ln -s usr/lib lib || exit 1
|
|
||||||
ln -s usr/lib lib64 || exit 1
|
|
||||||
cd -
|
|
||||||
cd rootfs/usr
|
cd rootfs/usr
|
||||||
ln -s lib lib64
|
ln -s lib lib64
|
||||||
|
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
|
echo "done"
|
||||||
|
|
||||||
echo "construction de la libc"
|
echo "construction de la libc"
|
||||||
chmod +x ./libc/build.sh
|
chmod +x ./libc/build.sh
|
||||||
cd libc && ./build.sh || exit 1 && cd -
|
cd libc && ./build.sh > /dev/null || exit 1 && cd -
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
echo "construction de gcc"
|
echo "construction de gcc"
|
||||||
chmod +x ./libgcc/build.sh
|
chmod +x ./libgcc/build.sh
|
||||||
cd libgcc && ./build.sh || exit 1 && cd -
|
cd libgcc && ./build.sh > /dev/null || exit 1 && cd -
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
echo "construction de eudev"
|
echo "construction de eudev"
|
||||||
chmod +x ./libudev/build.sh
|
chmod +x ./libudev/build.sh
|
||||||
cd libudev && ./build.sh || exit 1 && cd -
|
cd libudev && ./build.sh > /dev/null || exit 1 && cd -
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
echo "construction de lvm2(libdemapper)"
|
echo "construction de lvm2(libdemapper)"
|
||||||
chmod +x ./lvm2/build.sh
|
chmod +x ./lvm2/build.sh
|
||||||
cd lvm2 && ./build.sh || exit 1 && cd -
|
cd lvm2 && ./build.sh > /dev/null || exit 1 && cd -
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
echo "construction de liblzma"
|
echo "construction de liblzma"
|
||||||
chmod +x ./liblzma/build.sh
|
chmod +x ./liblzma/build.sh
|
||||||
cd liblzma && ./build.sh || exit 1 && cd -
|
cd liblzma && ./build.sh > /dev/null || exit 1 && cd -
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
echo "construction de grub"
|
echo "construction de grub"
|
||||||
chmod +x ./grub/build.sh
|
chmod +x ./grub/build.sh
|
||||||
cd grub && ./build.sh || exit 1 && cd -
|
cd grub && ./build.sh > /dev/null || exit 1 && cd -
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
echo "construction de Nodejs"
|
echo "construction de Nodejs"
|
||||||
@@ -80,9 +107,9 @@ cd nodejs && ./build.sh || exit 1 && cd -
|
|||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
echo "construction du loader"
|
echo "construction du loader"
|
||||||
chmod +x ./chibraxLoader/build.sh
|
chmod +x ./osLoader/build.sh
|
||||||
cd chibraxLoader && ./build.sh && cd -
|
cd osLoader && ./build.sh && cd -
|
||||||
sudo cp chibraxLoader/init rootfs/usr/bin/ || exit 1
|
sudo cp osLoader/init rootfs/usr/sbin/ || exit 1
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
echo "construction du bypass de sh"
|
echo "construction du bypass de sh"
|
||||||
@@ -91,7 +118,7 @@ cd fakesh && ./build.sh && cd -
|
|||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
echo "construction du kernel"
|
echo "construction du kernel"
|
||||||
cd kernel && ./from_current.sh && cd -
|
cd kernel && ./from_current.sh > /dev/null && cd -
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
echo "Cloning the firmware"
|
echo "Cloning the firmware"
|
||||||
@@ -103,7 +130,23 @@ sudo cp linux-firmware/* rootfs/usr/lib/firmware/ -r || exit 1
|
|||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
echo "rebuilding C++ hooks"
|
echo "rebuilding C++ hooks"
|
||||||
./clibs.sh || exit 1
|
./clibs.sh > /dev/null || exit 1
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
|
cp libfs/usr/lib64/libstdc++.so.6.0.29 rootfs/usr/lib/
|
||||||
|
cd rootfs/usr/lib/ && ln -s libstdc++.so.6.0.29 libstdc++.so.6 && ln -s libstdc++.so.6.0.29 libstdc++.so && cd -
|
||||||
|
cp libfs/usr/lib/libm.so.6 rootfs/usr/lib/
|
||||||
|
cp libfs/usr/lib/ld-linux-x86-64.so.2 rootfs/usr/lib
|
||||||
|
cp libfs/usr/lib/libgcc_s.so* rootfs/usr/lib
|
||||||
|
cp libfs/usr/lib/libc.so.6 rootfs/usr/lib
|
||||||
|
cp libfs/usr/lib/liblzma.so.5.0.4 rootfs/usr/lib
|
||||||
|
cd rootfs/usr/lib/ && ln -s liblzma.so.5.0.4 liblzma.so.5 && ln -s liblzma.so.5.0.4 liblzma.so && cd -
|
||||||
|
cp libfs/usr/lib/libdevmapper.so.1.02 rootfs/usr/lib
|
||||||
|
cd rootfs/usr/lib/ && ln -s libdevmapper.so.1.02 libdevmapper.so && cd -
|
||||||
|
cp libfs/sbin/ldconfig rootfs/sbin
|
||||||
|
|
||||||
sudo cp rootfs\ overrides/* rootfs/ -r || exit 1
|
sudo cp rootfs\ overrides/* rootfs/ -r || exit 1
|
||||||
|
|
||||||
|
unset LD_LIBRARY_PATH
|
||||||
|
|
||||||
|
#`libtool --finish /usr/lib
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
rm -rf rootfs
|
rm -rf rootfs
|
||||||
|
rm -rf libfs
|
||||||
rm -rf build
|
rm -rf build
|
||||||
rm -f disk.img
|
rm -f disk.img
|
||||||
rm -f diskoffset
|
rm -f diskoffset
|
||||||
+11
-5
@@ -5,22 +5,28 @@ then echo "Please run as root"
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d rootfs\ overrides/chibrax/node_modules ]
|
if [ ! -d rootfs\ overrides/core/node_modules ]
|
||||||
then
|
then
|
||||||
echo "please run npmi.sh"
|
echo "please run npmi.sh"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CHIBRAX_MOUNT_POINT="/tmp/chibraxMountPoint"
|
CHIBRAX_MOUNT_POINT="/tmp/core"
|
||||||
|
|
||||||
rm -f disk.img
|
rm -f disk.img
|
||||||
|
|
||||||
|
while umount -R rootfs/proc
|
||||||
|
do
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
|
|
||||||
#create a 8Gb iso
|
#create a 8Gb iso
|
||||||
dd if=/dev/zero of=disk.img bs=1024k seek=$((1000 * 8)) count=0
|
dd if=/dev/zero of=disk.img bs=1024k seek=$((1000 * 8)) count=0
|
||||||
|
|
||||||
#creating a msdos image for mbr boot
|
#creating a msdos image for mbr boot
|
||||||
parted disk.img mklabel msdos
|
parted disk.img mklabel msdos
|
||||||
parted disk.img mkpart primary ext4 0% 100%
|
parted disk.img mkpart primary ext4 0% 100%
|
||||||
|
#parted disk.img name 1 root
|
||||||
START_SECTOR=$(file disk.img | cut -d',' -f 8 | cut -d' ' -f3)
|
START_SECTOR=$(file disk.img | cut -d',' -f 8 | cut -d' ' -f3)
|
||||||
echo "Start sector :" $START_SECTOR
|
echo "Start sector :" $START_SECTOR
|
||||||
OFFSET=$((512*$START_SECTOR))
|
OFFSET=$((512*$START_SECTOR))
|
||||||
@@ -39,7 +45,7 @@ mkfs.ext4 ${LOOP}
|
|||||||
mount ${LOOP} $CHIBRAX_MOUNT_POINT
|
mount ${LOOP} $CHIBRAX_MOUNT_POINT
|
||||||
|
|
||||||
echo "rebuilding C++ hooks"
|
echo "rebuilding C++ hooks"
|
||||||
./clibs.sh
|
./clibs.sh > /dev/null 2> /dev/null
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
echo "coping rootfs"
|
echo "coping rootfs"
|
||||||
@@ -54,9 +60,9 @@ mount --rbind /sys $CHIBRAX_MOUNT_POINT/sys
|
|||||||
mount --make-rslave $CHIBRAX_MOUNT_POINT/sys
|
mount --make-rslave $CHIBRAX_MOUNT_POINT/sys
|
||||||
mount --rbind /tmp $CHIBRAX_MOUNT_POINT/tmp
|
mount --rbind /tmp $CHIBRAX_MOUNT_POINT/tmp
|
||||||
|
|
||||||
chroot $CHIBRAX_MOUNT_POINT /sbin/ldconfig -p
|
chroot $CHIBRAX_MOUNT_POINT /usr/sbin/ldconfig
|
||||||
chroot $CHIBRAX_MOUNT_POINT /usr/sbin/grub-install --target=i386-pc ${LOOP_ROOT} --modules=part_msdos
|
chroot $CHIBRAX_MOUNT_POINT /usr/sbin/grub-install --target=i386-pc ${LOOP_ROOT} --modules=part_msdos
|
||||||
chroot $CHIBRAX_MOUNT_POINT /usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg
|
#chroot $CHIBRAX_MOUNT_POINT /usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg
|
||||||
|
|
||||||
|
|
||||||
PARTUUID=$(lsblk $LOOP --fs | awk '{print $4}' | grep -v LABEL)
|
PARTUUID=$(lsblk $LOOP --fs | awk '{print $4}' | grep -v LABEL)
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
gcc fakesh.c -o executor
|
gcc fakesh.c -O3 -o executor
|
||||||
|
|
||||||
cp executor ../rootfs/bin/
|
cp executor ../rootfs/bin/
|
||||||
+6
-7
@@ -18,15 +18,14 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cd src
|
cd src
|
||||||
#no shure git.sv.gnu.org still exists but i had problems with my proxy anyway
|
#not sure git.sv.gnu.org still exists but i had problems with my proxy anyway
|
||||||
sed -i "s/git\:\/\/git\.sv\.gnu\.org\/gnulib/https\:\/\/git.savannah.gnu.org\/git\/gnulib.git/g" ./bootstrap
|
sed -i "s/git\:\/\/git\.sv\.gnu\.org\/gnulib/https\:\/\/git.savannah.gnu.org\/git\/gnulib.git/g" ./bootstrap
|
||||||
|
|
||||||
./bootstrap
|
./bootstrap
|
||||||
./configure --disable-werror --prefix=/usr
|
./configure \
|
||||||
make -j$(nproc)
|
--disable-werror \
|
||||||
|
--prefix=/usr || exit 1
|
||||||
|
make -j$(nproc) || exit 1
|
||||||
|
|
||||||
DESTDIR=$(pwd)/../../rootfs
|
sudo make install DESTDIR=$(realpath $(pwd)/../../rootfs)
|
||||||
|
|
||||||
sudo make install DESTDIR=$(realpath $DESTDIR)
|
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -6,6 +6,7 @@ fi
|
|||||||
|
|
||||||
git clone https://sourceware.org/git/glibc.git src
|
git clone https://sourceware.org/git/glibc.git src
|
||||||
cd src
|
cd src
|
||||||
|
git restore .
|
||||||
git checkout release/2.34/master
|
git checkout release/2.34/master
|
||||||
git pull
|
git pull
|
||||||
cd -
|
cd -
|
||||||
@@ -13,8 +14,8 @@ cd -
|
|||||||
mkdir src/build -p
|
mkdir src/build -p
|
||||||
cd src/build
|
cd src/build
|
||||||
pwd
|
pwd
|
||||||
../configure --sysconfdir=/etc -prefix=/usr --with-headers=/usr/include --with-bugurl=https://bugs.archlinux.org/ --enable-add-ons --enable-bind-now --enable-cet --enable-kernel=4.4 --enable-lock-elision --enable-multi-arch --enable-stack-protector=strong --enable-stackguard-randomization --enable-static-pie --enable-systemtap --disable-profile --disable-werror || exit 1
|
../configure --sysconfdir=/etc -prefix=/usr --with-headers=/usr/include --enable-add-ons --enable-bind-now --enable-cet --enable-kernel=5.14 --enable-lock-elision --enable-multi-arch --enable-stack-protector=strong --enable-stackguard-randomization --enable-static-pie --enable-systemtap --disable-profile --disable-werror || exit 1
|
||||||
make -j$(nproc) || exit 1
|
make -j$(nproc) || exit 1
|
||||||
DESTDIR=$(pwd)/../../../rootfs
|
DESTDIR=$(pwd)/../../../libfs
|
||||||
sudo make install DESTDIR=$(realpath $DESTDIR)
|
sudo make install DESTDIR=$(realpath $DESTDIR)
|
||||||
cd -
|
cd -
|
||||||
+1
-1
@@ -14,6 +14,6 @@ fi
|
|||||||
cd src
|
cd src
|
||||||
./configure --prefix=/usr
|
./configure --prefix=/usr
|
||||||
make -j$(nproc)
|
make -j$(nproc)
|
||||||
DESTDIR=$(pwd)/../../rootfs
|
DESTDIR=$(pwd)/../../libfs
|
||||||
sudo make install DESTDIR=$(realpath $DESTDIR)
|
sudo make install DESTDIR=$(realpath $DESTDIR)
|
||||||
cd -
|
cd -
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ git pull
|
|||||||
./configure --prefix /usr
|
./configure --prefix /usr
|
||||||
make -j$(nproc)
|
make -j$(nproc)
|
||||||
|
|
||||||
DESTDIR=$(pwd)/../../rootfs
|
DESTDIR=$(pwd)/../../libfs
|
||||||
sudo make install DESTDIR=$(realpath $DESTDIR)
|
sudo make install DESTDIR=$(realpath $DESTDIR)
|
||||||
|
|
||||||
cd -
|
cd -
|
||||||
+1
-1
@@ -16,7 +16,7 @@ cd src
|
|||||||
./configure --prefix=/usr --sysconfdir=/etc --enable-add-ons --enable-bind-now --enable-cet --enable-kernel=4.4 --enable-lock-elision --enable-stack-protector=strong --enable-stackguard-randomization --enable-static-pie --enable-systemtap --disable-profile --disable-werror
|
./configure --prefix=/usr --sysconfdir=/etc --enable-add-ons --enable-bind-now --enable-cet --enable-kernel=4.4 --enable-lock-elision --enable-stack-protector=strong --enable-stackguard-randomization --enable-static-pie --enable-systemtap --disable-profile --disable-werror
|
||||||
make -j$(nproc)
|
make -j$(nproc)
|
||||||
|
|
||||||
DESTDIR=$(pwd)/../../rootfs
|
DESTDIR=$(pwd)/../../libfs
|
||||||
|
|
||||||
sudo make install DESTDIR=$(realpath $DESTDIR)
|
sudo make install DESTDIR=$(realpath $DESTDIR)
|
||||||
cd -
|
cd -
|
||||||
+1
-1
@@ -7,6 +7,6 @@ git pull
|
|||||||
./autogen.sh
|
./autogen.sh
|
||||||
./configure
|
./configure
|
||||||
make -j$(nproc)
|
make -j$(nproc)
|
||||||
DESTDIR=$(pwd)/../../rootfs
|
DESTDIR=$(pwd)/../../libfs
|
||||||
sudo make install DESTDIR=$(realpath $DESTDIR)
|
sudo make install DESTDIR=$(realpath $DESTDIR)
|
||||||
cd -
|
cd -
|
||||||
+4
-7
@@ -5,7 +5,7 @@ then echo "Please don't run this as root"
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VERSION=17.5.0
|
export VERSION=17.6.0
|
||||||
|
|
||||||
if [ ! -f src/node-$VERSION/Makefile ]
|
if [ ! -f src/node-$VERSION/Makefile ]
|
||||||
then
|
then
|
||||||
@@ -14,17 +14,14 @@ cd src
|
|||||||
echo "clonning"
|
echo "clonning"
|
||||||
curl https://github.com/nodejs/node/archive/refs/tags/v$VERSION.zip -L --output $VERSION.zip || exit 1
|
curl https://github.com/nodejs/node/archive/refs/tags/v$VERSION.zip -L --output $VERSION.zip || exit 1
|
||||||
unzip $VERSION.zip || exit 1
|
unzip $VERSION.zip || exit 1
|
||||||
./patch.sh
|
|
||||||
cd -
|
cd -
|
||||||
|
./patch.sh || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "building"
|
echo "building"
|
||||||
#LD_LIBRARY_PATH=$(pwd)/../rootfs/lib:$(pwd)/../rootfs/lib64:$(pwd)/../rootfs/usr/lib:$(pwd)/../rootfs/usr/lib32:$(pwd)/../rootfs/usr/lib64:/lib:$(pwd)/lib64:$(pwd)/usr/lib:$(pwd)/usr/lib32:$(pwd)/usr/lib64
|
#privilégier les lib interne a l'os
|
||||||
cd src/node-$VERSION
|
cd src/node-$VERSION
|
||||||
#https://github.com/nodejs/node/issues/41497
|
./configure --prefix=/usr || exit 1
|
||||||
./configure --prefix=/usr --fully-static --enable-static || exit 1
|
|
||||||
for i in out/tools/v8_gypfiles/gen-regexp-special-case.target.mk out/test_crypto_engine.target.mk; do
|
|
||||||
sed -i 's/\-static//g' $i || echo "nevermind"; done
|
|
||||||
make -j$(nproc) || exit 1
|
make -j$(nproc) || exit 1
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
patch -R src/node-17.1.0/lib/child_process.js patches/child_process_executor.diff
|
patch -R src/node-${VERSION}/lib/child_process.js patches/child_process_executor.diff
|
||||||
@@ -4,4 +4,4 @@ then echo "Please don't run as root"
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
npm i
|
npm i
|
||||||
cd rootfs\ overrides/chibrax && npm i && cd -
|
cd rootfs\ overrides/core && npm i && cd -
|
||||||
+3
-1
@@ -4,4 +4,6 @@ then echo "Please don't run this as root"
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
gcc osLoader.c -static -O3 -o init
|
CFLAGS=""
|
||||||
|
|
||||||
|
gcc osLoader.c -o init
|
||||||
|
|||||||
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
//Chemin exacte de node (a changer aprés la creation d'un gestionnaire de packets)
|
//Chemin exacte de node (a changer aprés la creation d'un gestionnaire de packets)
|
||||||
#define node "/usr/local/bin/node"
|
#define NODE "/usr/local/bin/node"
|
||||||
#define chibrax "/core/index.js"
|
#define INIT "/core/index.js"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
execl(node, node, chibrax);
|
execl(NODE, NODE, INIT, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ if [ x$feature_default_font_path = xy ] ; then
|
|||||||
else
|
else
|
||||||
insmod part_gpt
|
insmod part_gpt
|
||||||
insmod ext2
|
insmod ext2
|
||||||
search --no-floppy --fs-uuid --set=root c461e81d-f7a8-4d29-a874-f441afe07e45
|
search --no-floppy --label --set=root root
|
||||||
font="/usr/share/grub/unicode.pf2"
|
font="/usr/share/grub/unicode.pf2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ terminal_input console
|
|||||||
terminal_output gfxterm
|
terminal_output gfxterm
|
||||||
insmod part_gpt
|
insmod part_gpt
|
||||||
insmod ext2
|
insmod ext2
|
||||||
search --no-floppy --fs-uuid --set=root c461e81d-f7a8-4d29-a874-f441afe07e45
|
search --no-floppy --label --set=root root
|
||||||
insmod gfxmenu
|
insmod gfxmenu
|
||||||
loadfont ($root)/usr/share/grub/themes/sleek/DejaVuSans-48.pf2
|
loadfont ($root)/usr/share/grub/themes/sleek/DejaVuSans-48.pf2
|
||||||
loadfont ($root)/usr/share/grub/themes/sleek/DejaVuSans-Regular-14.pf2
|
loadfont ($root)/usr/share/grub/themes/sleek/DejaVuSans-Regular-14.pf2
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//@ts-check
|
//@ts-check
|
||||||
const { exec, fork } = require('child_process');
|
const { exec, fork, spawn } = require('child_process');
|
||||||
/**
|
/**
|
||||||
* @param {string} path
|
* @param {string} path
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@@ -20,4 +20,33 @@ async function fHook(path) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { hookTo, fHook }
|
/**
|
||||||
|
* @param { string } cmd
|
||||||
|
* @param { import('child_process').SpawnOptionsWithoutStdio } [option]
|
||||||
|
*/
|
||||||
|
async function spawnAndWait(cmd, option) {
|
||||||
|
const child = spawn(cmd, option)
|
||||||
|
|
||||||
|
child.stdout.pipe(process.stdout)
|
||||||
|
child.stderr.pipe(process.stderr)
|
||||||
|
process.stdin.pipe(child.stdin)
|
||||||
|
|
||||||
|
await new Promise((res, rej) => {
|
||||||
|
child.on('exit', () => {
|
||||||
|
res()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
process.stdin.unpipe(child.stdin)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param { string } path
|
||||||
|
* @param { string[] } [args]
|
||||||
|
* @param { import('child_process').SpawnOptionsWithoutStdio } [options]
|
||||||
|
*/
|
||||||
|
async function startjs(path, args = [], options = {}) {
|
||||||
|
const arguments = args.map(arg => {return arg.includes(' ') ? `"${arg}"` : arg}).join(' ')
|
||||||
|
return spawnAndWait(`/usr/local/bin/node ${path} ${arguments}`, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { hookTo, fHook, spawnAndWait, startjs }
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
//@ts-check
|
//@ts-check
|
||||||
|
const fs = require('fs')
|
||||||
|
|
||||||
function panic() {
|
function panic() {
|
||||||
console.log("/!\\ INIT PANIK /!\\ LOSE CHIBRE")
|
console.log("/!\\ INIT PANIK /!\\ LOSE CHIBRE")
|
||||||
while(1) {}
|
while(1) {}
|
||||||
@@ -16,7 +17,11 @@ async function main() {
|
|||||||
await initd()
|
await initd()
|
||||||
|
|
||||||
//chainload into sheebr
|
//chainload into sheebr
|
||||||
|
if(fs.existsSync("/usr/bin/sheebr.js")) {
|
||||||
await fHook("/usr/bin/sheebr.js")
|
await fHook("/usr/bin/sheebr.js")
|
||||||
|
} else {
|
||||||
|
console.log('wrong shell path')
|
||||||
|
}
|
||||||
reboot.disableCtrlAltSupr()
|
reboot.disableCtrlAltSupr()
|
||||||
reboot.powerOff()
|
reboot.powerOff()
|
||||||
|
|
||||||
|
|||||||
@@ -40,4 +40,15 @@ function getFlags(interface) {
|
|||||||
return ip.getFlags(interface);
|
return ip.getFlags(interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { setFlags, getFlags, flags }
|
/**
|
||||||
|
* @param { string } interface
|
||||||
|
* @param { Uint8Array } address
|
||||||
|
*/
|
||||||
|
function setIpv4(interface, address) {
|
||||||
|
if( address.length !== 4) {
|
||||||
|
throw new Error('invalid address length');
|
||||||
|
}
|
||||||
|
ip.setIpv4(interface, address.join('.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { setFlags, getFlags, setIpv4, flags }
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
const audio = require('../../core/audio')
|
const audio = require('../../core/audio')
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
audio('/chibrax/sheeebr.wav')
|
audio('/core/sheeebr.wav')
|
||||||
}
|
}
|
||||||
|
|
||||||
const after = [ "filesystem.js" ] // list of init script to load before
|
const after = [ "filesystem.js" ] // list of init script to load before
|
||||||
|
|||||||
@@ -4,28 +4,7 @@ const { getline } = require('../lib/sheebr/utils')
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
let environment = require('../lib/sheebr/environment')
|
let environment = require('../lib/sheebr/environment')
|
||||||
let aliases = require("../lib/sheebr/aliases")
|
let aliases = require("../lib/sheebr/aliases")
|
||||||
let { spawn } = require('child_process')
|
const { startjs } = require('../../core/hook')
|
||||||
|
|
||||||
//utiliser ce code au lieux de execSync permet d'afficher le stdout au fur et a mesure ce qui fait qu'on a les logs quand une application throw une erreur
|
|
||||||
/**
|
|
||||||
* @param { string } cmd
|
|
||||||
* @param { import('child_process').SpawnOptionsWithoutStdio } [option]
|
|
||||||
*/
|
|
||||||
async function spawnAndWait(cmd, option) {
|
|
||||||
const child = spawn(cmd, option)
|
|
||||||
|
|
||||||
child.stdout.pipe(process.stdout)
|
|
||||||
child.stderr.pipe(process.stderr)
|
|
||||||
process.stdin.pipe(child.stdin)
|
|
||||||
|
|
||||||
await new Promise((res, rej) => {
|
|
||||||
child.on('exit', () => {
|
|
||||||
res()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
process.stdin.unpipe(child.stdin)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let current_dir = process.cwd()
|
let current_dir = process.cwd()
|
||||||
|
|
||||||
@@ -90,7 +69,9 @@ async function evaluateProgram(args){
|
|||||||
if(files.includes(`${args[0]}.js`)){
|
if(files.includes(`${args[0]}.js`)){
|
||||||
found = true;
|
found = true;
|
||||||
try {
|
try {
|
||||||
await spawnAndWait(`${environment.node} ${path + '/' + args[0]}.js ${args.map(arg => {return arg.includes(' ') ? `"${arg}"` : arg}).join(' ')}`, {cwd: current_dir, env: environment, shell: true});
|
const cmd = `${path + '/' + args[0]}.js`
|
||||||
|
const options = {cwd: current_dir, env: environment, shell: true}
|
||||||
|
await startjs(cmd, args, options)
|
||||||
tobreak = true;
|
tobreak = true;
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.log("Program crashed")
|
console.log("Program crashed")
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ let environment = {
|
|||||||
ln: [1, 36],
|
ln: [1, 36],
|
||||||
ex: [1, 32]
|
ex: [1, 32]
|
||||||
}),
|
}),
|
||||||
node: "/usr/local/bin/node"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = environment
|
module.exports = environment
|
||||||
+1
-1
@@ -18,6 +18,6 @@ cd src
|
|||||||
./autogen.sh || exit 1
|
./autogen.sh || exit 1
|
||||||
./configure || exit 1
|
./configure || exit 1
|
||||||
make -j$(nproc)|| exit 1
|
make -j$(nproc)|| exit 1
|
||||||
DESTDIR=$(pwd)/../../rootfs
|
DESTDIR=$(pwd)/../../libfs
|
||||||
sudo make install DESTDIR=$(realpath $DESTDIR)
|
sudo make install DESTDIR=$(realpath $DESTDIR)
|
||||||
cd -
|
cd -
|
||||||
Reference in New Issue
Block a user