added busybox_rootfs busybox_initramfs funcs

This commit is contained in:
wt
2024-08-22 18:54:56 +07:00
parent 4bc070a2b5
commit 48dfa1c0a2
+42 -28
View File
@@ -131,20 +131,9 @@ glibc() {
} }
#----------------------------------------------------------- #-----------------------------------------------------------
#------------------ Building initramfs.img ------------------------ #------------------ Building busybox for initramfs ----------------
initramfs() { busybox_initramfs() {
printf "$UGREEN** Building initramfs\n$RESET" printf "$UGREEN** Building busybox for 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 --------------------
rm -r $build/busybox &>> $fulllogfile rm -r $build/busybox &>> $fulllogfile
mkdir -p $build/busybox mkdir -p $build/busybox
cd $build/busybox cd $build/busybox
@@ -159,7 +148,25 @@ initramfs() {
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"
cp busybox $initramfspath/bin }
#------------------------------------------------------------------
#------------------ 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 cd $initramfspath/bin
for i in $(./busybox --list); do ln -s busybox $i; done for i in $(./busybox --list); do ln -s busybox $i; done
cd .. cd ..
@@ -174,6 +181,24 @@ initramfs() {
} # initramfs } # initramfs
#------------------------------------------------------------------ #------------------------------------------------------------------
#----------- 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 rootfs ---------------------- #----------- Building rootfs ----------------------
rootfs() { rootfs() {
printf "$UGREEN** Building rootfs\n$RESET" printf "$UGREEN** Building rootfs\n$RESET"
@@ -194,19 +219,8 @@ rootfs() {
cd .. cd ..
ln -sv /proc/mounts etc/mtab &>> $fulllogfile ln -sv /proc/mounts etc/mtab &>> $fulllogfile
rm -rv $build/busybox &>> $fulllogfile busybox_rootfs
mkdir -v $build/busybox &>> $fulllogfile cp -v $build/busybox/busybox-1.36.1/busybox $rootfspath/usr/bin &>> $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"
cp -v busybox $rootfspath/usr/bin &>> $fulllogfile
cd $rootfspath/usr/bin cd $rootfspath/usr/bin
for i in $(./busybox --list); do ln -s busybox $i; done for i in $(./busybox --list); do ln -s busybox $i; done