build scripts
This commit is contained in:
1 parent
c52cf00e6d
commit
1a6972ea2e
4 files changed
+123
-108
No files matched your search
+12
-108
@@ -12,9 +12,9 @@
|
|||||||
# ####### ## ## ## ## ####### ####### | ####### ## ## ## ######## ## ## |
|
# ####### ## ## ## ## ####### ####### | ####### ## ## ## ######## ## ## |
|
||||||
#------------------------------------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Script to build linux install media image
|
#--- script version ---
|
||||||
version=0.0.1 # script version
|
version=0.0.1
|
||||||
# TolaMironcenko is licensed under MIT
|
#----------------------
|
||||||
|
|
||||||
#--- import rolors ---
|
#--- import rolors ---
|
||||||
. ./scripts/colors.sh
|
. ./scripts/colors.sh
|
||||||
@@ -40,117 +40,21 @@ mkdir $root/.log &>> $fulllogfile
|
|||||||
. ./scripts/download.sh
|
. ./scripts/download.sh
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
|
|
||||||
#--------------- Building Linux Kernel ---------------------
|
#---------- import build kernel funcs ---------
|
||||||
kernel() {
|
. ./scripts/kernel.sh
|
||||||
printf "$UGREEN** Building Linux Kernel\n$RESET"
|
#----------------------------------------------
|
||||||
rm -r $build/kernel &>> $fulllogfile
|
|
||||||
mkdir -p $build/kernel &>> $fulllogfile
|
|
||||||
cd $build/kernel
|
|
||||||
printf "$UGREEN** Extracting Linux Kernel\n$RESET"
|
|
||||||
tar -xvf $root/downloads/linux-6.7.4.tar.xz &>> $fulllogfile
|
|
||||||
check $? "Extract Linux Kernel"
|
|
||||||
cd linux-6.7.4
|
|
||||||
printf "$UGREEN** Configuring Linux Kernel\n$RESET"
|
|
||||||
make mrproper &>> $fulllogfile
|
|
||||||
cp -v $root/kernel/config-6.7.4 .config &>> $fulllogfile
|
|
||||||
make oldconfig &>> $fulllogfile
|
|
||||||
check $? "Configure Linux Kernel"
|
|
||||||
printf "$UGREEN** Building Linux Kernel\n$RESET"
|
|
||||||
make $makeflags &>> $fulllogfile
|
|
||||||
check $? "Build Linux Kernel"
|
|
||||||
ls -lh arch/x86/boot/bzImage
|
|
||||||
} # kernel
|
|
||||||
#-----------------------------------------------------------
|
|
||||||
|
|
||||||
#----------- Build and Install kernel modules --------------
|
|
||||||
kernel_modules() {
|
|
||||||
printf "$UGREEN** Building Linux Kernel modules\n$RESET"
|
|
||||||
cd $build/kernel/linux-6.7.4
|
|
||||||
make modules &>> fulllogfile
|
|
||||||
check $? "Build Linux Kernel modules"
|
|
||||||
printf "$UGREEN** Installing Linux Kernel modules into rootfs path\n$RESET"
|
|
||||||
mkdir -pv $rootfspath/usr/lib &>> fulllogfile
|
|
||||||
cd $rootfspath
|
|
||||||
ln -sv usr/lib lib &>> $fulllogfile
|
|
||||||
cd $root/build/kernel/linux-6.7.4
|
|
||||||
make INSTALL_MOD_PATH=$rootfspath modules_install &>> $fulllogfile
|
|
||||||
check $? "Install Linux Kernel modules"
|
|
||||||
} # kernel_modules
|
|
||||||
#-----------------------------------------------------------
|
|
||||||
|
|
||||||
#-------- import build glibc funcs ------------
|
#-------- import build glibc funcs ------------
|
||||||
. ./scripts/glibc.sh
|
. ./scripts/glibc.sh
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
|
|
||||||
#------------------ Building initramfs.img ------------------------
|
#-------- import build initramfs funcs --------
|
||||||
initramfs() {
|
. ./scripts/initramfs.sh
|
||||||
printf "$UGREEN** Building initramfs\n$RESET"
|
#----------------------------------------------
|
||||||
|
|
||||||
#--------- Creating directories and files -------------------
|
#----------- import build rootfs funcs --------
|
||||||
rm -r $initramfspath &>> $fulllogfile
|
. ./scripts/rootfs.sh
|
||||||
mkdir -p $initramfspath
|
#----------------------------------------------
|
||||||
cd $initramfspath
|
|
||||||
mkdir -p $(cat $initramfsfile)
|
|
||||||
cp $root/initramfs/init.in $initramfspath/init
|
|
||||||
chmod 755 $initramfspath/init
|
|
||||||
#------------------------------------------------------------
|
|
||||||
|
|
||||||
#------------ Building initramfs busybox and copy to initramfs directory --------------------
|
|
||||||
busybox initramfs
|
|
||||||
cp $build/busybox/busybox-1.36.1/busybox $initramfspath/bin
|
|
||||||
cd $initramfspath/bin
|
|
||||||
for i in $(./busybox --list); do ln -s busybox $i; done
|
|
||||||
cd ..
|
|
||||||
#--------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#--------------------- Creating initramfs.img image ------------
|
|
||||||
find . | cpio -H newc -o | gzip > ../initramfs.img
|
|
||||||
check $? "Build initramfs.img image"
|
|
||||||
cd $root
|
|
||||||
#---------------------------------------------------------------
|
|
||||||
|
|
||||||
} # initramfs
|
|
||||||
#------------------------------------------------------------------
|
|
||||||
|
|
||||||
#----------- Building rootfs ----------------------
|
|
||||||
rootfs() {
|
|
||||||
printf "$UGREEN** Building rootfs\n$RESET"
|
|
||||||
rm -rv $rootfspath &>> $fulllogfile
|
|
||||||
mkdir -pv $rootfspath &>> $fulllogfile
|
|
||||||
cd $rootfspath
|
|
||||||
mkdir -pv $(cat $rootfsfile) &>> $fulllogfile
|
|
||||||
ln -sv usr/lib lib &>> $fulllogfile
|
|
||||||
ln -sv usr/lib lib64 &>> $fulllogfile
|
|
||||||
ln -sv usr/bin bin &>> $fulllogfile
|
|
||||||
ln -sv usr/bin sbin &>> $fulllogfile
|
|
||||||
cd usr
|
|
||||||
ln -sv bin sbin &>> $fulllogfile
|
|
||||||
ln -sv lib lib64 &>> $fulllogfile
|
|
||||||
cp -rv $root/rootfs/etc/* $rootfspath/etc/ &>> $fulllogfile
|
|
||||||
cp -rv $root/rootfs/usr/* $rootfspath/usr/ &>> $fulllogfile
|
|
||||||
cp -rv $root/rootfs/boot/* $rootfspath/boot/ &>> $fulllogfile
|
|
||||||
cd ..
|
|
||||||
ln -sv /proc/mounts etc/mtab &>> $fulllogfile
|
|
||||||
|
|
||||||
busybox rootfs
|
|
||||||
cp -v $build/busybox/busybox-1.36.1/busybox $rootfspath/usr/bin &>> $fulllogfile
|
|
||||||
cd $rootfspath/usr/bin
|
|
||||||
for i in $(./busybox --list); do ln -s busybox $i; done
|
|
||||||
|
|
||||||
glibc
|
|
||||||
kernel
|
|
||||||
cp -v $root/build/kernel/linux-6.7.4/arch/x86/boot/bzImage $rootfspath/boot/vmlinuz-linux &>> $fulllogfile
|
|
||||||
kernel_modules
|
|
||||||
initramfs
|
|
||||||
cp -v $root/build/initramfs.img $rootfspath/boot/ &>> $fulllogfile
|
|
||||||
|
|
||||||
chmod 640 $rootfspath/etc/shadow $rootfspath/etc/inittab
|
|
||||||
chmod 755 $rootfspath/etc/init.d/* $rootfspath/usr/share/udhcpc/default.script
|
|
||||||
chmod 644 $rootfspath/etc/{passwd,group,hostname,hosts,fstab,shells,issue} $rootfspath/etc/network/interfaces
|
|
||||||
|
|
||||||
check $? "Build rootfs"
|
|
||||||
} # rootfs
|
|
||||||
#--------------------------------------------------
|
|
||||||
|
|
||||||
#----------- import cleaning funcs -------------
|
#----------- import cleaning funcs -------------
|
||||||
. ./scripts/clean.sh
|
. ./scripts/clean.sh
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#------------------ Building initramfs.img ------------------------
|
||||||
|
initramfs() {
|
||||||
|
printf "$UGREEN** Building initramfs\n$RESET"
|
||||||
|
|
||||||
|
#--------- Creating directories and files -------------------
|
||||||
|
rm -r $initramfspath &>> $fulllogfile
|
||||||
|
mkdir -p $initramfspath
|
||||||
|
cd $initramfspath
|
||||||
|
mkdir -p $(cat $initramfsfile)
|
||||||
|
cp $root/initramfs/init.in $initramfspath/init
|
||||||
|
chmod 755 $initramfspath/init
|
||||||
|
#------------------------------------------------------------
|
||||||
|
|
||||||
|
#------------ Building initramfs busybox and copy to initramfs directory --------------------
|
||||||
|
busybox initramfs
|
||||||
|
cp $build/busybox/busybox-1.36.1/busybox $initramfspath/bin
|
||||||
|
cd $initramfspath/bin
|
||||||
|
for i in $(./busybox --list); do ln -s busybox $i; done
|
||||||
|
cd ..
|
||||||
|
#--------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#--------------------- Creating initramfs.img image ------------
|
||||||
|
find . | cpio -H newc -o | gzip > ../initramfs.img
|
||||||
|
check $? "Build initramfs.img image"
|
||||||
|
cd $root
|
||||||
|
#---------------------------------------------------------------
|
||||||
|
|
||||||
|
} # initramfs
|
||||||
|
#------------------------------------------------------------------
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#--------------- Building Linux Kernel ---------------------
|
||||||
|
kernel() {
|
||||||
|
printf "$UGREEN** Building Linux Kernel\n$RESET"
|
||||||
|
rm -r $build/kernel &>> $fulllogfile
|
||||||
|
mkdir -p $build/kernel &>> $fulllogfile
|
||||||
|
cd $build/kernel
|
||||||
|
printf "$UGREEN** Extracting Linux Kernel\n$RESET"
|
||||||
|
tar -xvf $root/downloads/linux-6.7.4.tar.xz &>> $fulllogfile
|
||||||
|
check $? "Extract Linux Kernel"
|
||||||
|
cd linux-6.7.4
|
||||||
|
printf "$UGREEN** Configuring Linux Kernel\n$RESET"
|
||||||
|
make mrproper &>> $fulllogfile
|
||||||
|
cp -v $root/kernel/config-6.7.4 .config &>> $fulllogfile
|
||||||
|
make oldconfig &>> $fulllogfile
|
||||||
|
check $? "Configure Linux Kernel"
|
||||||
|
printf "$UGREEN** Building Linux Kernel\n$RESET"
|
||||||
|
make $makeflags &>> $fulllogfile
|
||||||
|
check $? "Build Linux Kernel"
|
||||||
|
ls -lh arch/x86/boot/bzImage
|
||||||
|
} # kernel
|
||||||
|
#-----------------------------------------------------------
|
||||||
|
|
||||||
|
#----------- Build and Install kernel modules --------------
|
||||||
|
kernel_modules() {
|
||||||
|
printf "$UGREEN** Building Linux Kernel modules\n$RESET"
|
||||||
|
cd $build/kernel/linux-6.7.4
|
||||||
|
make modules &>> fulllogfile
|
||||||
|
check $? "Build Linux Kernel modules"
|
||||||
|
printf "$UGREEN** Installing Linux Kernel modules into rootfs path\n$RESET"
|
||||||
|
mkdir -pv $rootfspath/usr/lib &>> fulllogfile
|
||||||
|
cd $rootfspath
|
||||||
|
ln -sv usr/lib lib &>> $fulllogfile
|
||||||
|
cd $root/build/kernel/linux-6.7.4
|
||||||
|
make INSTALL_MOD_PATH=$rootfspath modules_install &>> $fulllogfile
|
||||||
|
check $? "Install Linux Kernel modules"
|
||||||
|
} # kernel_modules
|
||||||
|
#-----------------------------------------------------------
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#----------- Building rootfs ----------------------
|
||||||
|
rootfs() {
|
||||||
|
printf "$UGREEN** Building rootfs\n$RESET"
|
||||||
|
rm -rv $rootfspath &>> $fulllogfile
|
||||||
|
mkdir -pv $rootfspath &>> $fulllogfile
|
||||||
|
cd $rootfspath
|
||||||
|
mkdir -pv $(cat $rootfsfile) &>> $fulllogfile
|
||||||
|
ln -sv usr/lib lib &>> $fulllogfile
|
||||||
|
ln -sv usr/lib lib64 &>> $fulllogfile
|
||||||
|
ln -sv usr/bin bin &>> $fulllogfile
|
||||||
|
ln -sv usr/bin sbin &>> $fulllogfile
|
||||||
|
cd usr
|
||||||
|
ln -sv bin sbin &>> $fulllogfile
|
||||||
|
ln -sv lib lib64 &>> $fulllogfile
|
||||||
|
cp -rv $root/rootfs/etc/* $rootfspath/etc/ &>> $fulllogfile
|
||||||
|
cp -rv $root/rootfs/usr/* $rootfspath/usr/ &>> $fulllogfile
|
||||||
|
cp -rv $root/rootfs/boot/* $rootfspath/boot/ &>> $fulllogfile
|
||||||
|
cd ..
|
||||||
|
ln -sv /proc/mounts etc/mtab &>> $fulllogfile
|
||||||
|
|
||||||
|
busybox rootfs
|
||||||
|
cp -v $build/busybox/busybox-1.36.1/busybox $rootfspath/usr/bin &>> $fulllogfile
|
||||||
|
cd $rootfspath/usr/bin
|
||||||
|
for i in $(./busybox --list); do ln -s busybox $i; done
|
||||||
|
|
||||||
|
glibc
|
||||||
|
kernel
|
||||||
|
cp -v $root/build/kernel/linux-6.7.4/arch/x86/boot/bzImage $rootfspath/boot/vmlinuz-linux &>> $fulllogfile
|
||||||
|
kernel_modules
|
||||||
|
initramfs
|
||||||
|
cp -v $root/build/initramfs.img $rootfspath/boot/ &>> $fulllogfile
|
||||||
|
|
||||||
|
chmod 640 $rootfspath/etc/shadow $rootfspath/etc/inittab
|
||||||
|
chmod 755 $rootfspath/etc/init.d/* $rootfspath/usr/share/udhcpc/default.script
|
||||||
|
chmod 644 $rootfspath/etc/{passwd,group,hostname,hosts,fstab,shells,issue} $rootfspath/etc/network/interfaces
|
||||||
|
|
||||||
|
check $? "Build rootfs"
|
||||||
|
} # rootfs
|
||||||
|
#--------------------------------------------------
|
||||||
Reference in new issue
Block a user