2022-03-15 14:06:02 +08:00
#!/bin/bash
2022-03-28 13:36:51 +08:00
2022-04-05 19:45:39 +08:00
#
# envsetup.sh
# Copyright (C) 2022 YuzukiTsuru <gloomyghost@gloomyghost.com>. All rights reserved.
#
2022-04-05 15:45:14 +08:00
# WSL SUpport
2022-04-05 19:50:04 +08:00
if [ $( uname -r | grep -c "WSL1" ) -eq 1 ] ;
2022-03-28 13:36:51 +08:00
then
2022-04-05 15:45:14 +08:00
# Not support WSL 1
2022-04-05 19:45:39 +08:00
echo "#### Buildroot-YuzukiSBC Not Support WSL 1 ####"
2022-04-05 15:45:14 +08:00
exit 1
2022-04-05 19:50:04 +08:00
elif [ $( uname -r | grep -c "WSL2" ) -eq 1 ] ;
2022-03-28 13:36:51 +08:00
then
echo "Buildroot-YuzukiSBC Now running on WSL2, setting PATH..."
export PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib"
fi
2022-04-05 19:45:39 +08:00
# configure C compiler
export compiler = $( which gcc)
# get version code
MAJOR = $( echo __GNUC__ | $compiler -E -xc - | tail -n 1)
MINOR = $( echo __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1)
PATCHLEVEL = $( echo __GNUC_PATCHLEVEL__ | $compiler -E -xc - | tail -n 1)
2022-04-05 19:50:04 +08:00
if [ $MAJOR -lt 7 ] ;
2022-04-05 19:45:39 +08:00
then
echo "#### Buildroot-YuzukiSBC Not Support GCC Version less than 7 ####"
exit 1
2022-04-05 19:50:04 +08:00
elif [ $MAJOR -gt 12 ] ;
then
echo "#### Buildroot-YuzukiSBC Not Support GCC Version more than 12 ####"
exit 1
else
echo " Your Host GCC Version is $MAJOR . $MINOR . $PATCHLEVEL "
2022-04-05 19:45:39 +08:00
fi
# Add alias
2022-03-28 13:36:51 +08:00
# Alias
2022-04-05 15:38:53 +08:00
alias lunch = "cd buildroot && echo -e \"You're building on Linux\n\nLunch menu... \npick a combo by 'make xxx_defconfig':\" \nScaning combo... && make list-defconfigs"
2022-04-01 00:21:31 +08:00
alias rebuild_kernel = "touch ./output/images/a.dtb && rm ./output/images/*.dtb && make linux-rebuild -j8 && make"
2022-03-21 14:31:59 +08:00
alias rebuild_uboot = "make uboot-rebuild -j8 && make"
alias wsl_path = "export PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib\""
2022-03-21 15:46:00 +08:00
alias sync_kernel = "rm -rf output/build/linux* && rm -rf output/build/.linux* && make"
2022-03-21 14:31:59 +08:00
2022-04-05 15:45:51 +08:00
alias mm = "make"
alias m = "make"
alias mkernel = "rebuild_kernel"
2022-04-07 11:00:42 +08:00
alias rkernel = "rebuild_kernel"
2022-04-05 15:45:51 +08:00
2022-04-07 15:35:46 +08:00
alias mboot = "rebuild_uboot"
alias rboot = "rebuild_uboot"
2022-03-28 13:36:51 +08:00
echo "Setup env done! Please run lunch next."