0.0.1 version of orangepi-pc SimpleLinux
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#------------- grub rescue ---------------------------
|
||||
grub_rescue() {
|
||||
grub-mkrescue -o $build/simplelinux.iso $rootfspath &>> $fulllogfile
|
||||
check $? "Build grub-rescue"
|
||||
cp -v $build/simplelinux.iso $out/ &>> $fulllogfile
|
||||
}
|
||||
#-----------------------------------------------------
|
||||
|
||||
#------------------ rootfs archive -------------------
|
||||
rootfs_archive() {
|
||||
cd $rootfspath
|
||||
tar -czvf $out/simplelinux-$version-rootfs.tar.gz . &>> $fulllogfile
|
||||
check $? "Build rootfs archive"
|
||||
}
|
||||
#-----------------------------------------------------
|
||||
+11
-69
@@ -1,85 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
#--------------------------------- Logo ---------------------------------------------------------------------
|
||||
# ####### ## ## ## ####### ## ####### | ## ## ## ## ## ## ## ## |
|
||||
# ## ## #### #### ## ## ## ## | ## ## ## ## ## ## ## ## |
|
||||
# ## ## ## ## ## ## ## ## | ## ## ## ## ## ## ## |
|
||||
# ## ## ## ## ## ## ## ## ## | ## ## ### ## ## ## ## |
|
||||
# ####### ## ## ## ####### ## ####### | ## ## #### ## ## ## ## |
|
||||
# ## ## ## ## ## ## ## | ## ## ## #### ## ## ## |
|
||||
# ## ## ## ## ## ## ## | ## ## ## ### ## ## ## ## |
|
||||
# ## ## ## ## ## ## ## | ## ## ## ## ## ## ## ## |
|
||||
# ####### ## ## ## ## ####### ####### | ####### ## ## ## ######## ## ## |
|
||||
#------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#--- import rolors ---
|
||||
. ./scripts/colors.sh
|
||||
#---------------------
|
||||
#--- import funcs ----
|
||||
. ./scripts/funcs.sh
|
||||
#---------------------
|
||||
#----- import config variables ----------
|
||||
. ./scripts/config.sh
|
||||
#----------------------------------------
|
||||
#----- import busybox build funcs ---
|
||||
. ./scripts/busybox.sh
|
||||
#------------------------------------
|
||||
|
||||
#-------- check root ------------------
|
||||
check_root
|
||||
#--------------------------------------
|
||||
|
||||
mkdir $out &>> $fulllogfile
|
||||
mkdir $root/.log &>> $fulllogfile
|
||||
|
||||
#--------- import Download sources funcs ------
|
||||
. ./scripts/funcs.sh
|
||||
. ./scripts/download.sh
|
||||
#----------------------------------------------
|
||||
|
||||
#---------- import build kernel funcs ---------
|
||||
. ./scripts/busybox.sh
|
||||
. ./scripts/kernel.sh
|
||||
#----------------------------------------------
|
||||
|
||||
#-------- import build glibc funcs ------------
|
||||
. ./scripts/glibc.sh
|
||||
#----------------------------------------------
|
||||
|
||||
#-------- import build initramfs funcs --------
|
||||
. ./scripts/initramfs.sh
|
||||
#----------------------------------------------
|
||||
|
||||
#----------- import build rootfs funcs --------
|
||||
. ./scripts/rootfs.sh
|
||||
#----------------------------------------------
|
||||
. ./scripts/uboot.sh
|
||||
. ./scripts/sdroot.sh
|
||||
|
||||
#----------- import cleaning funcs -------------
|
||||
. ./scripts/clean.sh
|
||||
#-----------------------------------------------
|
||||
#-------- import build artifacts funcs ---------
|
||||
. ./scripts/artifacts.sh
|
||||
#-----------------------------------------------
|
||||
|
||||
buid_image() {
|
||||
clean
|
||||
download_sources
|
||||
rootfs
|
||||
grub_rescue
|
||||
rootfs_archive
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
clean)
|
||||
clean
|
||||
;;
|
||||
case $1 in
|
||||
build)
|
||||
buid_image
|
||||
rootfs
|
||||
sdroot
|
||||
# kernel_with_rootfs
|
||||
# uboot
|
||||
# busybox_rootfs
|
||||
# kernel
|
||||
;;
|
||||
download)
|
||||
download_sources
|
||||
;;
|
||||
rootfs)
|
||||
rootfs
|
||||
;;
|
||||
*)
|
||||
printf "$UYELLOW** $0 script using: $0 {clean|build|download|rootfs}\n$RESET"
|
||||
exit 1
|
||||
|
||||
Regular → Executable
+8
-40
@@ -6,54 +6,22 @@
|
||||
#--- 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"
|
||||
}
|
||||
#------------------------------------------------------------------
|
||||
. ./scripts/config.sh
|
||||
|
||||
#----------- Building busybox for rootfs ----------
|
||||
busybox_rootfs() {
|
||||
printf "$UGREEN** Building busybox for rootfs\n$RESET"
|
||||
rm -rv $build/busybox &>> $fulllogfile
|
||||
mkdir -v $build/busybox &>> $fulllogfile
|
||||
rm -rv $build/busybox # &>> $fulllogfile
|
||||
mkdir -pv $build/busybox # &>> $fulllogfile
|
||||
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
|
||||
cp -v $root/busybox/busybox-rootfs-config .config &>> $fulllogfile
|
||||
cp -v $root/busybox/busybox-rootfs-config .config # &>> $fulllogfile
|
||||
printf "$UGREEN** Configuring busybox\n$RESET"
|
||||
make oldconfig &>> $fulllogfile
|
||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE oldconfig # &>> $fulllogfile
|
||||
check $? "Configure busybox all logs in .log"
|
||||
printf "$UGREEN** Building busybox\n$RESET"
|
||||
make $makeflags &>> $fulllogfile
|
||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE $makeflags # &>> $fulllogfile
|
||||
check $? "Build busybox all logs in .log"
|
||||
}
|
||||
#--------------------------------------------------
|
||||
|
||||
#------------------ Building busybox ------------------------------
|
||||
busybox() {
|
||||
case "$1" in
|
||||
initramfs)
|
||||
busybox_initramfs
|
||||
;;
|
||||
rootfs)
|
||||
busybox_rootfs
|
||||
;;
|
||||
esac
|
||||
}
|
||||
#------------------------------------------------------------------
|
||||
#--------------------------------------------------
|
||||
Regular → Executable
+6
-12
@@ -1,14 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
#---------- Cleaning build and out directory ---------
|
||||
clean() {
|
||||
printf "$UGREEN** Cleaning build and out directories\n$RESET"
|
||||
rm -rv $root/.log/* &>> $fulllogfile
|
||||
mkdir -p $root/.log
|
||||
rm -rv $out &>> $fulllogfile
|
||||
mkdir -p $out
|
||||
rm -rv $build &>> $fulllogfile
|
||||
mkdir -p $build
|
||||
printf "$UGREEN** SUCCESS: Cleaning build and out directories\n$RESET"
|
||||
} # clean
|
||||
#-----------------------------------------------------
|
||||
if [ -d out ]; then
|
||||
rm -rv out;
|
||||
fi
|
||||
if [ -d build ]; then
|
||||
rm -rv build
|
||||
fi
|
||||
|
||||
Regular → Executable
Regular → Executable
+20
-16
@@ -1,20 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
#------------ config ------------------
|
||||
version=0.0.1 # script version
|
||||
root=$(pwd) # root build directory
|
||||
disk="sdz" # disk to write install image
|
||||
distro_name="Simple" # distro name
|
||||
distro_desc="Simple linux distro" # distro desctiption
|
||||
distro_codename="zero_zero_one" # distro codename
|
||||
hyperv_support="false" # hyperv support for kernel image
|
||||
out=$root/out # output directory
|
||||
build=$root/build # build directory
|
||||
sourcesfilename=sources.txt # sources file for downloading
|
||||
initramfsfile=$root/initramfs/initramfs.txt # file to created directories for initramfs
|
||||
initramfspath=$build/initramfs # initramfs build directory
|
||||
rootfsfile=$root/rootfs/rootfs.txt # file to created directories for rootfs
|
||||
rootfspath=$build/rootfs # rootfs build directory
|
||||
fulllogfile=$root/.log/fulllog.log # file for full build logs
|
||||
makeflags=-j$(grep -c processor /proc/cpuinfo) # makeflags
|
||||
export PATH=$PATH:/opt/toolchains/arm-buildroot-linux-uclibcgnueabihf/bin
|
||||
export version=0.0.1 # script version
|
||||
export root=$(pwd) # root build directory
|
||||
# disk="sdz" # disk to write install image
|
||||
export distro_name="Simple" # distro name
|
||||
export distro_desc="Simple linux distro" # distro desctiption
|
||||
export distro_codename="zero_zero_one" # distro codename
|
||||
# hyperv_support="false" # hyperv support for kernel image
|
||||
export out=$root/out # output directory
|
||||
export build=$root/build # build directory
|
||||
export sourcesfilename=sources.txt # sources file for downloading
|
||||
# initramfsfile=$root/initramfs/initramfs.txt # file to created directories for initramfs
|
||||
# initramfspath=$build/initramfs # initramfs build directory
|
||||
export rootfsfile=$root/rootfs/rootfs.txt # file to created directories for rootfs
|
||||
export rootfspath=$build/rootfs # rootfs build directory
|
||||
export fulllogfile=$root/.log/fulllog.log # file for full build logs
|
||||
export makeflags=-j$(nproc) # makeflags
|
||||
export CROSS_COMPILE=arm-buildroot-linux-uclibcgnueabihf-
|
||||
export ARCH=arm
|
||||
export sdroot=$out/sdroot
|
||||
#--------------------------------------
|
||||
|
||||
Regular → Executable
+3
@@ -1,5 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./scripts/funcs.sh
|
||||
. ./scripts/config.sh
|
||||
|
||||
#------------ Download needed sources from sources.txt ------------------
|
||||
download_sources() {
|
||||
printf "$UGREEN** Downloading sources\n$RESET"
|
||||
|
||||
Regular → Executable
@@ -1,33 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#------------ glibc ----------------------------------------
|
||||
glibc() {
|
||||
printf "$UGREEN** Building glibc\n$RESET"
|
||||
mkdir -p $build/glibc &>> $fulllogfile
|
||||
cd $build/glibc
|
||||
tar -xvf $root/downloads/glibc-2.39.tar.xz &>> $fulllogfile
|
||||
check $? "Extract glibc"
|
||||
cd glibc-2.39
|
||||
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"
|
||||
}
|
||||
#-----------------------------------------------------------
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#------------------ Building initramfs.img ------------------------
|
||||
initramfs() {
|
||||
printf "$UGREEN** Building initramfs\n$RESET"
|
||||
|
||||
#--------- Creating directories and files -------------------
|
||||
rm -r $initramfspath &>> $fulllogfile >> $(tty)
|
||||
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
|
||||
#------------------------------------------------------------------
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#---- System update ----
|
||||
apt update -qq &&
|
||||
apt upgrade -y -qq &&
|
||||
#-----------------------
|
||||
|
||||
#-------------- Nodejs ---------------------------------------------
|
||||
apt install -y curl
|
||||
# curl -sL https://deb.nodesource.com/setup_6.x | sh - &&
|
||||
apt install -y --force-yes -qq build-essential make cmake u-boot-tools bc file wget &&
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
#----------- Toolchains --------------------------------------------
|
||||
mkdir -p /opt/toolchains /var/www/html &&
|
||||
cd /opt/toolchains &&
|
||||
tar -xf ${OLDPWD}/toolchains/x86_64-buildroot-linux-uclibc-gcc.tar.gz &&
|
||||
cd $OLDPWD
|
||||
#-------------------------------------------------------------------
|
||||
Regular → Executable
+34
-16
@@ -1,39 +1,57 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./scripts/colors.sh
|
||||
. ./scripts/funcs.sh
|
||||
. ./scripts/config.sh
|
||||
|
||||
#--------------- Building Linux Kernel ---------------------
|
||||
kernel() {
|
||||
printf "$UGREEN** Building Linux Kernel\n$RESET"
|
||||
rm -r $build/kernel &>> $fulllogfile
|
||||
mkdir -p $build/kernel &>> $fulllogfile
|
||||
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
|
||||
tar -xvf $root/downloads/linux-6.1.91.tar.xz # &>> $fulllogfile
|
||||
check $? "Extract Linux Kernel"
|
||||
cd linux-6.7.4
|
||||
cd linux-6.1.91
|
||||
printf "$UGREEN** Configuring Linux Kernel\n$RESET"
|
||||
make mrproper &>> $fulllogfile
|
||||
cp -v $root/kernel/config-6.7.4 .config &>> $fulllogfile
|
||||
make oldconfig &>> $fulllogfile
|
||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE mrproper # &>> $fulllogfile
|
||||
cp -v $root/kernel/config-6.1.91 .config # &>> $fulllogfile
|
||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE oldconfig # &>> $fulllogfile
|
||||
check $? "Configure Linux Kernel"
|
||||
printf "$UGREEN** Building Linux Kernel\n$RESET"
|
||||
make $makeflags &>> $fulllogfile
|
||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE $makeflags # &>> $fulllogfile
|
||||
check $? "Build Linux Kernel"
|
||||
ls -lh arch/x86/boot/bzImage
|
||||
ls -lh arch/$ARCH/boot/zImage
|
||||
} # 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
|
||||
cd $build/kernel/linux-6.1.91
|
||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE 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
|
||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE INSTALL_MOD_PATH=$rootfspath modules_install # &>> $fulllogfile
|
||||
rm -v $rootfspath/usr/lib/modules/6.1.91/{source,build}
|
||||
check $? "Install Linux Kernel modules"
|
||||
} # kernel_modules
|
||||
#-----------------------------------------------------------
|
||||
|
||||
#--------------- Building Linux Kernel with rootfs ---------
|
||||
kernel_with_rootfs() {
|
||||
printf "$UGREEN** Building Linux Kernel with rootfs\n$RESET"
|
||||
if [ ! -d $out ]; then
|
||||
mkdir -pv $out
|
||||
fi
|
||||
cd $build/kernel/linux-6.1.91
|
||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE CONFIG_INITRAMFS_SOURCE=$rootfspath $makeflags # &>> fulllogfile
|
||||
check $? "Build Linux Kernel with rootfs"
|
||||
printf "$UGREEN** Installing Linux Kernel into images path\n$RESET"
|
||||
# make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE INSTALL_MOD_PATH=$rootfspath modules_install # &>> $fulllogfile
|
||||
# rm -v $rootfspath/usr/lib/modules/6.1.91/{source,build}
|
||||
cp -v arch/$ARCH/boot/zImage $sdroot/boot
|
||||
check $? "Install Linux Kernel into images path"
|
||||
}
|
||||
#-----------------------------------------------------------
|
||||
|
||||
Regular → Executable
+27
-23
@@ -1,41 +1,45 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./scripts/colors.sh
|
||||
. ./scripts/funcs.sh
|
||||
. ./scripts/config.sh
|
||||
. ./scripts/busybox.sh
|
||||
. ./scripts/uclibc.sh
|
||||
. ./scripts/kernel.sh
|
||||
|
||||
#----------- Building rootfs ----------------------
|
||||
rootfs() {
|
||||
printf "$UGREEN** Building rootfs\n$RESET"
|
||||
rm -rv $rootfspath &>> $fulllogfile
|
||||
mkdir -pv $rootfspath &>> $fulllogfile
|
||||
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
|
||||
mkdir -pv $(cat $rootfsfile) # &>> $fulllogfile
|
||||
ln -sv usr/lib lib # &>> $fulllogfile
|
||||
ln -sv usr/lib lib32 # &>> $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
|
||||
ln -sv bin sbin # &>> $fulllogfile
|
||||
ln -sv lib lib32 # &>> $fulllogfile
|
||||
cd ..
|
||||
ln -sv /proc/mounts etc/mtab &>> $fulllogfile
|
||||
tar -xvf $root/downloads/initscripts-0.0.1-orangepi-pc.tar.gz
|
||||
cp -rv initscripts-0.0.1-orangepi-pc/* .
|
||||
rm -rv initscripts-0.0.1-orangepi-pc
|
||||
ln -sv /proc/mounts etc/mtab # &>> $fulllogfile
|
||||
|
||||
busybox rootfs
|
||||
cp -v $build/busybox/busybox-1.36.1/busybox $rootfspath/usr/bin &>> $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
|
||||
for i in $(cat $root/busybox/busybox_list); do ln -sv busybox $i; done
|
||||
cp -v $root/rootfs/init.in $rootfspath/init
|
||||
uclibc
|
||||
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 755 $rootfspath/etc/init.d/* $rootfspath/usr/share/udhcpc/default.script $rootfspath/init
|
||||
chmod 644 $rootfspath/etc/{passwd,group,hostname,hosts,fstab,shells,issue} $rootfspath/etc/network/interfaces
|
||||
|
||||
check $? "Build rootfs"
|
||||
} # rootfs
|
||||
#--------------------------------------------------
|
||||
#--------------------------------------------------
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./scripts/colors.sh
|
||||
. ./scripts/funcs.sh
|
||||
. ./scripts/config.sh
|
||||
. ./scripts/kernel.sh
|
||||
. ./scripts/uboot.sh
|
||||
|
||||
#--- sdroot ---
|
||||
sdroot() {
|
||||
if [ ! -d $sdroot ]; then
|
||||
mkdir -pv $sdroot
|
||||
fi
|
||||
mkdir -pv $sdroot/boot/{dtbs,extlinux}
|
||||
cp -v $root/extlinux/extlinux.conf $sdroot/boot/extlinux
|
||||
kernel_with_rootfs
|
||||
uboot
|
||||
cd $out
|
||||
rawsdrootsize=$(du -sh $sdroot)
|
||||
echo $rawsdrootsize
|
||||
sdrootsize=(${rawsdrootsize//./ })
|
||||
echo $sdrootsize
|
||||
echo $(($sdrootsize+2))
|
||||
dd if=/dev/zero of=rootfs.ext4 bs=1M count=$(($sdrootsize+2))
|
||||
mkfs.ext4 rootfs.ext4
|
||||
rawuuid=$(echo $(blkid rootfs.ext4 | echo $(awk '{print $2}')))
|
||||
echo $rawuuid
|
||||
uuidIN=(${rawuuid//=/ })
|
||||
uuid=${uuidIN[1]}
|
||||
echo $uuid
|
||||
cp -v $root/genimage/genimage.cfg .
|
||||
sed -i "s/FILEUUID/$uuid/g" genimage.cfg
|
||||
mkdir -v rootmnt
|
||||
sudo mount -v rootfs.ext4 rootmnt
|
||||
sudo cp -rv $sdroot/* rootmnt/
|
||||
sudo umount -v rootfs.ext4
|
||||
rm -rv rootmnt
|
||||
mkdir input
|
||||
mv -v ./{rootfs.ext4,u-boot-sunxi-with-spl.bin} input
|
||||
genimage --config genimage.cfg
|
||||
}
|
||||
#--------------
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./scripts/colors.sh
|
||||
. ./scripts/funcs.sh
|
||||
. ./scripts/config.sh
|
||||
|
||||
#--- uboot ---
|
||||
uboot() {
|
||||
printf "$UGREEN** Building uboot\n$RESET"
|
||||
mkdir -p $build/uboot # &>> $fulllogfile
|
||||
cd $build/uboot
|
||||
tar -xvf $root/downloads/u-boot-v2024.10.tar.gz # &>> $fulllogfile
|
||||
check $? "Extract uboot"
|
||||
cd u-boot-2024.10
|
||||
# cp -rv $root/uclibc/config-1.0.50 .config
|
||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE orangepi_pc_defconfig
|
||||
check $? "Configure uboot"
|
||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE $makeflags # &>> $fulllogfile
|
||||
check $? "Build uboot"
|
||||
cp -v u-boot-sunxi-with-spl.bin $out
|
||||
cp -v arch/arm/dts/sun8i-h3-orangepi-pc.dtb $sdroot/boot/dtbs
|
||||
# make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE DESTDIR=$rootfspath install # &>> $fulllogfile
|
||||
check $? "Install uboot to out directory"
|
||||
check $? "Build and install uboot to out directory"
|
||||
}
|
||||
#-------------
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./scripts/colors.sh
|
||||
. ./scripts/funcs.sh
|
||||
. ./scripts/config.sh
|
||||
|
||||
#------------ glibc ----------------------------------------
|
||||
uclibc() {
|
||||
printf "$UGREEN** Building uclibc\n$RESET"
|
||||
mkdir -p $build/uclibc # &>> $fulllogfile
|
||||
cd $build/uclibc
|
||||
tar -xvf $root/downloads/uClibc-ng-1.0.50.tar.xz # &>> $fulllogfile
|
||||
check $? "Extract uclibc"
|
||||
cd uClibc-ng-1.0.50
|
||||
cp -rv $root/uclibc/config-1.0.50 .config
|
||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE oldconfig
|
||||
check $? "Configure uclibc"
|
||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE $makeflags # &>> $fulllogfile
|
||||
check $? "Build uclibc"
|
||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE DESTDIR=$rootfspath install # &>> $fulllogfile
|
||||
check $? "Install uclibc to rootfs"
|
||||
cd $rootfspath
|
||||
find -name \*.a -delete # &>> $fulllogfile
|
||||
find -name \*.o -delete
|
||||
rm -v $rootfspath/usr/lib/libc.so
|
||||
${CROSS_COMPILE}strip --strip-unneeded $rootfspath/usr/lib/* $rootfspath/usr/bin/* # &>> $fulllogfile
|
||||
rm -rv $rootfspath/usr/include
|
||||
cd $root
|
||||
check $? "Build and install uclibc"
|
||||
}
|
||||
#-----------------------------------------------------------
|
||||
Reference in New Issue
Block a user