-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-dev.sh
More file actions
executable file
·62 lines (55 loc) · 1.78 KB
/
Copy pathinstall-dev.sh
File metadata and controls
executable file
·62 lines (55 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
set -e
detect_os() {
if [ -f /etc/os-release ]; then
. /etc/os-release
case "$ID" in
debian|ubuntu) OS="debian" ;;
fedora) OS="fedora" ;;
arch) OS="arch" ;;
*) echo "Unsupported OS: $ID"; exit 1 ;;
esac
else
echo "Cannot detect OS"; exit 1
fi
}
install_packages() {
case "$OS" in
debian)
sudo apt-get update
sudo apt-get install -y nasm qemu-system-x86 bochs bochs-x gdb grub2 xorriso mtools python3 python3-pip
pip3 install pyelftools
;;
fedora)
sudo dnf install -y nasm qemu-system-x86 bochs gdb grub2 xorriso mtools python3 python3-pip
pip3 install pyelftools
;;
arch)
sudo pacman -S --noconfirm nasm qemu bochs gdb grub xorriso mtools python python-pip
pip install pyelftools
;;
esac
}
setup_toolchain() {
TOOLCHAIN_DIR="toolchain"
TOOLCHAIN_FILE="i386-elf-15.1.0-Linux-x86_64.tar.gz"
TOOLCHAIN_URL="http://newos.org/toolchains//$TOOLCHAIN_FILE"
if [ ! -d "$TOOLCHAIN_DIR/i386-elf-15.1.0-Linux-x86_64/bin" ]; then
mkdir -p "$TOOLCHAIN_DIR"
wget -O "$TOOLCHAIN_DIR/$TOOLCHAIN_FILE" "$TOOLCHAIN_URL"
tar -xzf "$TOOLCHAIN_DIR/$TOOLCHAIN_FILE" -C "$TOOLCHAIN_DIR"
rm "$TOOLCHAIN_DIR/$TOOLCHAIN_FILE"
fi
}
main() {
detect_os
echo "Installing packages for $OS..."
install_packages
echo "Setting up cross-compiler toolchain..."
setup_toolchain
TOOLCHAIN_PATH="$PWD/$TOOLCHAIN_DIR/i386-elf-15.1.0-Linux-x86_64/bin"
echo "Environment ready for KintsugiOS development!"
echo "Run this command to add toolchain to PATH:"
echo "export PATH=\"$TOOLCHAIN_PATH:\$PATH\""
}
main "$@"