glibc added
This commit is contained in:
1 parent
a7aaa3a0d9
commit
ca896ea9cb
6 files changed
+97
-31
No files matched your search
+78
-30
@@ -37,7 +37,7 @@ initramfsfile=$root/initramfs/initramfs.txt # file to created directories for in
|
|||||||
initramfspath=$build/initramfs # initramfs build directory
|
initramfspath=$build/initramfs # initramfs build directory
|
||||||
rootfsfile=$root/rootfs/rootfs.txt # file to created directories for rootfs
|
rootfsfile=$root/rootfs/rootfs.txt # file to created directories for rootfs
|
||||||
rootfspath=$build/rootfs # rootfs build directory
|
rootfspath=$build/rootfs # rootfs build directory
|
||||||
fulllogfile=/dev/null # file for full build logs
|
fulllogfile=$root/.log/fulllog.log # file for full build logs
|
||||||
makeflags=-j16 # makeflags
|
makeflags=-j16 # makeflags
|
||||||
#--------------------------------------
|
#--------------------------------------
|
||||||
|
|
||||||
@@ -48,8 +48,8 @@ if [ $(id -u) -ne 0 ]; then
|
|||||||
fi
|
fi
|
||||||
#--------------------------------------
|
#--------------------------------------
|
||||||
|
|
||||||
mkdir $out &> $fulllogfile
|
mkdir $out &>> $fulllogfile
|
||||||
mkdir $root/.log &> $fulllogfile
|
mkdir $root/.log &>> $fulllogfile
|
||||||
|
|
||||||
#------------ Download needed sources from sources.txt ------------------
|
#------------ Download needed sources from sources.txt ------------------
|
||||||
download_sources() {
|
download_sources() {
|
||||||
@@ -64,18 +64,18 @@ download_sources() {
|
|||||||
#--------------- Building Linux Kernel ---------------------
|
#--------------- Building Linux Kernel ---------------------
|
||||||
kernel() {
|
kernel() {
|
||||||
printf "$UGREEN** Building Linux Kernel\n$RESET"
|
printf "$UGREEN** Building Linux Kernel\n$RESET"
|
||||||
rm -r $build/kernel &> $fulllogfile
|
rm -r $build/kernel &>> $fulllogfile
|
||||||
mkdir -p $build/kernel &> $fulllogfile
|
mkdir -p $build/kernel &>> $fulllogfile
|
||||||
cd $build/kernel
|
cd $build/kernel
|
||||||
printf "$UGREEN** Extracting Linux Kernel\n$RESET"
|
printf "$UGREEN** Extracting Linux Kernel\n$RESET"
|
||||||
tar -xvf $root/downloads/linux-*.tar.xz &> $fulllogfile
|
tar -xvf $root/downloads/linux-*.tar.xz &>> $fulllogfile
|
||||||
check $? "Extract Linux Kernel"
|
check $? "Extract Linux Kernel"
|
||||||
cd linux-*
|
cd linux-*
|
||||||
printf "$UGREEN** Configuring Linux Kernel\n$RESET"
|
printf "$UGREEN** Configuring Linux Kernel\n$RESET"
|
||||||
make defconfig &> $fulllogfile
|
make defconfig &>> $fulllogfile
|
||||||
check $? "Configure Linux Kernel"
|
check $? "Configure Linux Kernel"
|
||||||
printf "$UGREEN** Building Linux Kernel\n$RESET"
|
printf "$UGREEN** Building Linux Kernel\n$RESET"
|
||||||
make $makeflags &> $fulllogfile
|
make $makeflags &>> $fulllogfile
|
||||||
check $? "Build Linux Kernel"
|
check $? "Build Linux Kernel"
|
||||||
ls -lh arch/x86/boot/bzImage
|
ls -lh arch/x86/boot/bzImage
|
||||||
} # kernel
|
} # kernel
|
||||||
@@ -90,19 +90,51 @@ kernel_modules() {
|
|||||||
printf "$UGREEN** Installing Linux Kernel modules into rootfs path\n$RESET"
|
printf "$UGREEN** Installing Linux Kernel modules into rootfs path\n$RESET"
|
||||||
mkdir -pv $rootfspath/usr/lib &> fulllogfile
|
mkdir -pv $rootfspath/usr/lib &> fulllogfile
|
||||||
cd $rootfspath
|
cd $rootfspath
|
||||||
ln -sv usr/lib lib &> $fulllogfile
|
ln -sv usr/lib lib &>> $fulllogfile
|
||||||
cd $root/build/kernel/linux-*
|
cd $root/build/kernel/linux-*
|
||||||
make INSTALL_MOD_PATH=$rootfspath modules_install &> $fulllogfile
|
make INSTALL_MOD_PATH=$rootfspath modules_install &>> $fulllogfile
|
||||||
check $? "Install Linux Kernel modules"
|
check $? "Install Linux Kernel modules"
|
||||||
} # kernel_modules
|
} # kernel_modules
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
|
|
||||||
|
#------------ glibc ----------------------------------------
|
||||||
|
glibc() {
|
||||||
|
printf "$UGREEN** Building glibc\n$RESET"
|
||||||
|
mkdir -p $build/glibc &>> $fulllogfile
|
||||||
|
cd $build/glibc
|
||||||
|
tar -xvf $root/downloads/glibc-*.tar.xz &>> $fulllogfile
|
||||||
|
check $? "Extract glibc"
|
||||||
|
cd glibc-*
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
echo "rootsbindir=/usr/bin" > configparms
|
||||||
|
../configure \
|
||||||
|
--prefix=/usr \
|
||||||
|
--disable-werror \
|
||||||
|
--enable-kernel=4.19 \
|
||||||
|
--enable-stack-protector=strong \
|
||||||
|
--disable-nscd \
|
||||||
|
libc_cv_slibdir=/usr/lib &>> $fulllogfile
|
||||||
|
check $? "Configure glibc"
|
||||||
|
make $makeflags &>> $fulllogfile
|
||||||
|
check $? "Build glibc"
|
||||||
|
make DESTDIR=$rootfspath install &>> $fulllogfile
|
||||||
|
check $? "Install glibc to rootfs"
|
||||||
|
cd $rootfspath
|
||||||
|
find -name \*.a -delete &>> $fulllogfile
|
||||||
|
strip --strip-unneeded $rootfspath/usr/lib/* $rootfspath/usr/bin/* &>> $fulllogfile
|
||||||
|
chroot $rootfspath /bin/sh -c "mkdir -p /usr/lib/locale;localedef -i C -f UTF-8 C.UTF-8;localedef -i en_US -f UTF-8 en_US.UTF-8;localedef -i ru_RU -f UTF-8 ru_RU-UTF-8;"
|
||||||
|
cd $root
|
||||||
|
check $? "Build and install glibc"
|
||||||
|
}
|
||||||
|
#-----------------------------------------------------------
|
||||||
|
|
||||||
#------------------ Building initramfs.img ------------------------
|
#------------------ Building initramfs.img ------------------------
|
||||||
initramfs() {
|
initramfs() {
|
||||||
printf "$UGREEN** Building initramfs\n$RESET"
|
printf "$UGREEN** Building initramfs\n$RESET"
|
||||||
|
|
||||||
#--------- Creating directories and files -------------------
|
#--------- Creating directories and files -------------------
|
||||||
rm -r $initramfspath &> $fulllogfile
|
rm -r $initramfspath &>> $fulllogfile
|
||||||
mkdir -p $initramfspath;
|
mkdir -p $initramfspath;
|
||||||
cd $initramfspath;
|
cd $initramfspath;
|
||||||
mkdir -p $(cat $initramfsfile);
|
mkdir -p $(cat $initramfsfile);
|
||||||
@@ -111,7 +143,7 @@ initramfs() {
|
|||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
|
||||||
#------------ Building initramfs busybox and copy to initramfs directory --------------------
|
#------------ 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
|
||||||
tar -xjf $root/downloads/busybox-1.36.1.tar.bz2
|
tar -xjf $root/downloads/busybox-1.36.1.tar.bz2
|
||||||
@@ -143,36 +175,44 @@ initramfs() {
|
|||||||
#----------- Building rootfs ----------------------
|
#----------- Building rootfs ----------------------
|
||||||
rootfs() {
|
rootfs() {
|
||||||
printf "$UGREEN** Building rootfs\n$RESET"
|
printf "$UGREEN** Building rootfs\n$RESET"
|
||||||
rm -rv $rootfspath &> $fulllogfile
|
rm -rv $rootfspath &>> $fulllogfile
|
||||||
mkdir -pv $rootfspath &> $fulllogfile
|
mkdir -pv $rootfspath &>> $fulllogfile
|
||||||
cd $rootfspath
|
cd $rootfspath
|
||||||
mkdir -pv $(cat $rootfsfile) &> $fulllogfile
|
mkdir -pv $(cat $rootfsfile) &>> $fulllogfile
|
||||||
ln -sv usr/lib lib &> $fulllogfile
|
ln -sv usr/lib lib &>> $fulllogfile
|
||||||
ln -sv usr/lib lib64 &> $fulllogfile
|
ln -sv usr/lib lib64 &>> $fulllogfile
|
||||||
ln -sv usr/bin bin &> $fulllogfile
|
ln -sv usr/bin bin &>> $fulllogfile
|
||||||
ln -sv usr/bin sbin &> $fulllogfile
|
ln -sv usr/bin sbin &>> $fulllogfile
|
||||||
cd usr
|
cd usr
|
||||||
ln -sv bin sbin &> $fulllogfile
|
ln -sv bin sbin &>> $fulllogfile
|
||||||
ln -sv lib lib64 &> $fulllogfile
|
ln -sv lib lib64 &>> $fulllogfile
|
||||||
cp -rv $root/rootfs/etc/* $rootfspath/etc/ &> $fulllogfile
|
cp -rv $root/rootfs/etc/* $rootfspath/etc/ &>> $fulllogfile
|
||||||
cp -rv $root/rootfs/usr/* $rootfspath/usr/ &> $fulllogfile
|
cp -rv $root/rootfs/usr/* $rootfspath/usr/ &>> $fulllogfile
|
||||||
|
cp -rv $root/rootfs/boot/* $rootfspath/boot/ &>> $fulllogfile
|
||||||
|
|
||||||
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-*.tar.bz2 &> $fulllogfile
|
tar -xvjf $root/downloads/busybox-*.tar.bz2 &>> $fulllogfile
|
||||||
cd busybox-*
|
cd busybox-*
|
||||||
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 &> $root/.log/busybox-configure.log
|
make oldconfig &> $root/.log/busybox-configure.log
|
||||||
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 &> $root/.log/busybox-build.log
|
make $makeflags &> $root/.log/busybox-build.log
|
||||||
check $? "Build busybox all logs in .log"
|
check $? "Build busybox all logs in .log"
|
||||||
cp -v busybox $rootfspath/usr/bin &> $fulllogfile
|
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
|
||||||
|
|
||||||
|
glibc
|
||||||
|
kernel
|
||||||
|
cp -v $root/build/kernel/linux-*/arch/x86/boot/bzImage $rootfspath/boot/vmlinuz-linux
|
||||||
|
kernel_modules
|
||||||
|
initramfs
|
||||||
|
cp -v $root/build/initramfs.img $rootfspath/boot/
|
||||||
|
|
||||||
chmod 640 $rootfspath/etc/shadow $rootfspath/etc/inittab
|
chmod 640 $rootfspath/etc/shadow $rootfspath/etc/inittab
|
||||||
chmod 755 $rootfspath/etc/init.d/* $rootfspath/usr/share/udhcpc/default.script
|
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
|
chmod 644 $rootfspath/etc/{passwd,group,hostname,hosts,fstab,shells,issue} $rootfspath/etc/network/interfaces
|
||||||
@@ -184,12 +224,19 @@ rootfs() {
|
|||||||
#---------- Cleaning build and out directory ---------
|
#---------- Cleaning build and out directory ---------
|
||||||
clean() {
|
clean() {
|
||||||
printf "$UGREEN** Cleaning build and out directories\n$RESET"
|
printf "$UGREEN** Cleaning build and out directories\n$RESET"
|
||||||
rm -rv $out &> $fulllogfile
|
rm -rv $root/.log/* &>> $fulllogfile
|
||||||
rm -rv $build &> $fulllogfile
|
rm -rv $out &>> $fulllogfile
|
||||||
|
rm -rv $build &>> $fulllogfile
|
||||||
printf "$UGREEN** SUCCESS: Cleaning build and out directories\n$RESET"
|
printf "$UGREEN** SUCCESS: Cleaning build and out directories\n$RESET"
|
||||||
} # clean
|
} # clean
|
||||||
#-----------------------------------------------------
|
#-----------------------------------------------------
|
||||||
|
|
||||||
|
#------------- grub rescue ---------------------------
|
||||||
|
grub_rescue() {
|
||||||
|
grub-mkrescue -o $build/simplelinux.iso $rootfspath
|
||||||
|
}
|
||||||
|
#-----------------------------------------------------
|
||||||
|
|
||||||
if [ "$1" = "clean" ]; then
|
if [ "$1" = "clean" ]; then
|
||||||
clean
|
clean
|
||||||
exit 0
|
exit 0
|
||||||
@@ -201,3 +248,4 @@ clean
|
|||||||
# kernel_modules
|
# kernel_modules
|
||||||
# initramfs
|
# initramfs
|
||||||
rootfs
|
rootfs
|
||||||
|
grub_rescue
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
set timeout=5
|
||||||
|
|
||||||
|
menuentry 'Simple Linux Install Media' {
|
||||||
|
linux /boot/vmlinuz-linux root=/dev/sda
|
||||||
|
initrd /boot/initramfs.img
|
||||||
|
}
|
||||||
Whitespace-only changes.
+1
-1
@@ -1 +1 @@
|
|||||||
\h \r (\l)
|
\h \r (\l)\n
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
passwd: files
|
||||||
|
group: files
|
||||||
|
shadow: files
|
||||||
|
|
||||||
|
hosts: files dns
|
||||||
|
networks: files
|
||||||
|
|
||||||
|
protocols: files
|
||||||
|
services: files
|
||||||
|
ethers: files
|
||||||
|
rpc: files
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
https://www.kernel.org/pub/linux/kernel/v6.x/linux-6.7.4.tar.xz
|
https://www.kernel.org/pub/linux/kernel/v6.x/linux-6.7.4.tar.xz
|
||||||
https://busybox.net/downloads/busybox-1.36.1.tar.bz2
|
https://busybox.net/downloads/busybox-1.36.1.tar.bz2
|
||||||
|
https://ftp.gnu.org/gnu/glibc/glibc-2.39.tar.xz
|
||||||
Reference in new issue
Block a user