update build_image.sh script added rootfs_archive and unified busybox building

This commit is contained in:
wt
2024-08-23 17:29:26 +07:00
parent 20ce8b22e0
commit 0ea96d011c
5 changed files with 112 additions and 49 deletions
+52 -48
View File
@@ -17,10 +17,10 @@ version=0.0.1 # script version
# TolaMironcenko is licensed under MIT # TolaMironcenko is licensed under MIT
#--- import rolors --- #--- import rolors ---
. ./colors.sh . ./scripts/colors.sh
#--------------------- #---------------------
#--- import funcs ---- #--- import funcs ----
. ./funcs.sh . ./scripts/funcs.sh
#--------------------- #---------------------
#------------ config ------------------ #------------ config ------------------
@@ -41,6 +41,10 @@ fulllogfile=$root/.log/fulllog.log # file for full build logs
makeflags=-j16 # makeflags makeflags=-j16 # makeflags
#-------------------------------------- #--------------------------------------
#----- import busybox build funcs ---
. ./scripts/busybox.sh
#------------------------------------
#-------- check root ------------------ #-------- check root ------------------
if [ $(id -u) -ne 0 ]; then if [ $(id -u) -ne 0 ]; then
printf "$URED** You are not root\n$RESET" printf "$URED** You are not root\n$RESET"
@@ -132,54 +136,54 @@ glibc() {
#----------------------------------------------------------- #-----------------------------------------------------------
# #------------------ Building busybox for initramfs ---------------- # #------------------ Building busybox for initramfs ----------------
busybox_initramfs() { # busybox_initramfs() {
printf "$UGREEN** Building busybox for initramfs\n$RESET" # printf "$UGREEN** Building busybox for initramfs\n$RESET"
rm -r $build/busybox &>> $fulllogfile # rm -r $build/busybox &>> $fulllogfile
mkdir -p $build/busybox # mkdir -p $build/busybox
cd $build/busybox # cd $build/busybox
tar -xjf $root/downloads/busybox-1.36.1.tar.bz2 # tar -xjf $root/downloads/busybox-1.36.1.tar.bz2
check $? "Extract busybox" # check $? "Extract busybox"
cd busybox-1.36.1 # cd busybox-1.36.1
cp $root/busybox/busybox-initramfs-config .config # cp $root/busybox/busybox-initramfs-config .config
export PATH=$PATH:/opt/toolchains/x86_64-buildroot-linux-uclibc-gcc/bin # export PATH=$PATH:/opt/toolchains/x86_64-buildroot-linux-uclibc-gcc/bin
printf "$UGREEN** Configuring busybox\n$RESET" # printf "$UGREEN** Configuring busybox\n$RESET"
make CROSS_COMPILE=x86_64-buildroot-linux-uclibc- oldconfig &> $fulllogfile # make CROSS_COMPILE=x86_64-buildroot-linux-uclibc- oldconfig &> $fulllogfile
check $? "Configure busybox all logs in .log" # check $? "Configure busybox all logs in .log"
printf "$UGREEN** Building busybox\n$RESET" # printf "$UGREEN** Building busybox\n$RESET"
make CROSS_COMPILE=x86_64-buildroot-linux-uclibc- $makeflags &> $fulllogfile # make CROSS_COMPILE=x86_64-buildroot-linux-uclibc- $makeflags &> $fulllogfile
check $? "Build busybox all logs in .log" # check $? "Build busybox all logs in .log"
} # }
# #------------------------------------------------------------------ # # #------------------------------------------------------------------
# #----------- Building busybox for rootfs ---------- # # #----------- Building busybox for rootfs ----------
busybox_rootfs() { # busybox_rootfs() {
printf "$UGREEN** Building busybox for rootfs\n$RESET" # printf "$UGREEN** Building busybox for rootfs\n$RESET"
rm -rv $build/busybox &>> $fulllogfile # rm -rv $build/busybox &>> $fulllogfile
mkdir -v $build/busybox &>> $fulllogfile # mkdir -v $build/busybox &>> $fulllogfile
cd $build/busybox # cd $build/busybox
tar -xvjf $root/downloads/busybox-1.36.1.tar.bz2 &>> $fulllogfile # tar -xvjf $root/downloads/busybox-1.36.1.tar.bz2 &>> $fulllogfile
cd busybox-1.36.1 # cd busybox-1.36.1
cp -v $root/busybox/busybox-rootfs-config .config &>> $fulllogfile # cp -v $root/busybox/busybox-rootfs-config .config &>> $fulllogfile
printf "$UGREEN** Configuring busybox\n$RESET" # printf "$UGREEN** Configuring busybox\n$RESET"
make oldconfig &>> $fulllogfile # make oldconfig &>> $fulllogfile
check $? "Configure busybox all logs in .log" # check $? "Configure busybox all logs in .log"
printf "$UGREEN** Building busybox\n$RESET" # printf "$UGREEN** Building busybox\n$RESET"
make $makeflags &>> $fulllogfile # make $makeflags &>> $fulllogfile
check $? "Build busybox all logs in .log" # check $? "Build busybox all logs in .log"
} # }
#-------------------------------------------------- # #--------------------------------------------------
#------------------ Building busybox ------------------------------ # #------------------ Building busybox ------------------------------
busybox() { # busybox() {
case "$1" in # case "$1" in
initramfs) # initramfs)
busybox_initramfs # busybox_initramfs
;; # ;;
rootfs) # rootfs)
busybox_rootfs # busybox_rootfs
;; # ;;
esac # esac
} # }
#------------------------------------------------------------------ #------------------------------------------------------------------
#------------------ Building initramfs.img ------------------------ #------------------ Building initramfs.img ------------------------
+59
View File
@@ -0,0 +1,59 @@
#!/bin/sh
#--- import rolors ---
. ./scripts/colors.sh
#---------------------
#--- import funcs ----
. ./scripts/funcs.sh
#---------------------
#------------------ Building busybox for initramfs ----------------
busybox_initramfs() {
printf "$UGREEN** Building busybox for initramfs\n$RESET"
rm -r $build/busybox &>> $fulllogfile
mkdir -p $build/busybox
cd $build/busybox
tar -xjf $root/downloads/busybox-1.36.1.tar.bz2
check $? "Extract busybox"
cd busybox-1.36.1
cp $root/busybox/busybox-initramfs-config .config
export PATH=$PATH:/opt/toolchains/x86_64-buildroot-linux-uclibc-gcc/bin
printf "$UGREEN** Configuring busybox\n$RESET"
make CROSS_COMPILE=x86_64-buildroot-linux-uclibc- oldconfig &>> $fulllogfile
check $? "Configure busybox all logs in .log"
printf "$UGREEN** Building busybox\n$RESET"
make CROSS_COMPILE=x86_64-buildroot-linux-uclibc- $makeflags &>> $fulllogfile
check $? "Build busybox all logs in .log"
}
#------------------------------------------------------------------
#----------- Building busybox for rootfs ----------
busybox_rootfs() {
printf "$UGREEN** Building busybox for rootfs\n$RESET"
rm -rv $build/busybox &>> $fulllogfile
mkdir -v $build/busybox &>> $fulllogfile
cd $build/busybox
tar -xvjf $root/downloads/busybox-1.36.1.tar.bz2 &>> $fulllogfile
cd busybox-1.36.1
cp -v $root/busybox/busybox-rootfs-config .config &>> $fulllogfile
printf "$UGREEN** Configuring busybox\n$RESET"
make oldconfig &>> $fulllogfile
check $? "Configure busybox all logs in .log"
printf "$UGREEN** Building busybox\n$RESET"
make $makeflags &>> $fulllogfile
check $? "Build busybox all logs in .log"
}
#--------------------------------------------------
#------------------ Building busybox ------------------------------
busybox() {
case "$1" in
initramfs)
busybox_initramfs
;;
rootfs)
busybox_rootfs
;;
esac
}
#------------------------------------------------------------------
View File
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
#--- Import colors --- #--- Import colors ---
. ./colors.sh . ./scripts/colors.sh
#--------------------- #---------------------
#------- Check errors func ----------------- #------- Check errors func -----------------