update for rootfs_usable
This commit is contained in:
@@ -17,3 +17,6 @@ distclean:
|
|||||||
if [ -d downloads ]; then \
|
if [ -d downloads ]; then \
|
||||||
rm -rv downloads; \
|
rm -rv downloads; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dropbear:
|
||||||
|
./scripts/build_image.sh dropbear
|
||||||
|
|||||||
Executable
+1211
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,20 @@
|
|||||||
|
awk
|
||||||
|
blkid
|
||||||
|
cat
|
||||||
|
fdisk
|
||||||
|
find
|
||||||
|
findfs
|
||||||
|
grep
|
||||||
|
hdparm
|
||||||
|
ls
|
||||||
|
mkdir
|
||||||
|
mount
|
||||||
|
mountpoint
|
||||||
|
pivot_root
|
||||||
|
printf
|
||||||
|
sed
|
||||||
|
sh
|
||||||
|
sleep
|
||||||
|
switch_root
|
||||||
|
umount
|
||||||
|
vi
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
LABEL default
|
||||||
|
kernel /boot/zImage
|
||||||
|
initrd /boot/initramfs.img
|
||||||
|
devicetreedir /boot/dtbs
|
||||||
|
append root=UUID=ROOTUUID rw rootwait console=${console} rootfstype=ext4 panic=10
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
problem()
|
||||||
|
{
|
||||||
|
printf "Encountered a problem!\n\nDropping you to a shell.\n\n"
|
||||||
|
sh
|
||||||
|
}
|
||||||
|
|
||||||
|
no_device()
|
||||||
|
{
|
||||||
|
printf "The device %s, which is supposed to contain the\n" $1
|
||||||
|
printf "root file system, does not exist.\n"
|
||||||
|
printf "Please fix this problem and exit this shell.\n\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
no_mount()
|
||||||
|
{
|
||||||
|
printf "Could not mount device %s\n" $1
|
||||||
|
printf "Sleeping forever. Please reboot and fix the kernel command line.\n\n"
|
||||||
|
printf "Maybe the device is formatted with an unsupported file system?\n\n"
|
||||||
|
printf "Or maybe filesystem type autodetection went wrong, in which case\n"
|
||||||
|
printf "you should add the rootfstype=... parameter to the kernel command line.\n\n"
|
||||||
|
printf "Available partitions:\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
do_mount_root()
|
||||||
|
{
|
||||||
|
mkdir /.root
|
||||||
|
[ -n "$rootflags" ] && rootflags="$rootflags,"
|
||||||
|
rootflags="$rootflags$ro"
|
||||||
|
|
||||||
|
case "$root" in
|
||||||
|
/dev/* ) device=$root ;;
|
||||||
|
UUID=* ) eval $root; device="$(findfs UUID=$UUID)" ;;
|
||||||
|
PARTUUID=*) eval $root; device="/dev/disk/by-partuuid/$PARTUUID" ;;
|
||||||
|
LABEL=* ) eval $root; device="/dev/disk/by-label/$LABEL" ;;
|
||||||
|
"" ) echo "No root device specified." ; problem ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
while [ ! -b "$device" ] ; do
|
||||||
|
no_device $device
|
||||||
|
problem
|
||||||
|
done
|
||||||
|
|
||||||
|
if ! mount -n -t "$rootfstype" -o "$rootflags" "$device" /.root ; then
|
||||||
|
no_mount $device
|
||||||
|
cat /proc/partitions
|
||||||
|
while true ; do sleep 10000 ; done
|
||||||
|
else
|
||||||
|
echo "Successfully mounted device $root"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
init=/sbin/init
|
||||||
|
root=
|
||||||
|
rootdelay=
|
||||||
|
rootfstype=auto
|
||||||
|
ro="ro"
|
||||||
|
rootflags=
|
||||||
|
device=
|
||||||
|
resume=
|
||||||
|
noresume=false
|
||||||
|
|
||||||
|
mount -n -t devtmpfs devtmpfs /dev
|
||||||
|
mount -n -t proc proc /proc
|
||||||
|
mount -n -t sysfs sys /sys
|
||||||
|
mount -n -t tmpfs run /run
|
||||||
|
|
||||||
|
mkdir -p /dev/pts
|
||||||
|
|
||||||
|
#mountpoint -q proc || mount -t proc proc proc
|
||||||
|
#mountpoint -q sys || mount -t sysfs sys sys
|
||||||
|
#mknod /dev/null c 1 3
|
||||||
|
#if ! mountpoint -q dev
|
||||||
|
#then
|
||||||
|
# mount -t tmpfs -o size=64k,mode=0755 tmpfs dev
|
||||||
|
#mount -t tmpfs -o mode=1777 tmpfs tmp
|
||||||
|
#mkdir -p dev/pts
|
||||||
|
#mdev -s
|
||||||
|
#fi
|
||||||
|
|
||||||
|
read -r cmdline < /proc/cmdline
|
||||||
|
|
||||||
|
for param in $cmdline ; do
|
||||||
|
case $param in
|
||||||
|
init=* ) init=${param#init=} ;;
|
||||||
|
root=* ) root=${param#root=} ;;
|
||||||
|
rootdelay=* ) rootdelay=${param#rootdelay=} ;;
|
||||||
|
rootfstype=*) rootfstype=${param#rootfstype=} ;;
|
||||||
|
rootflags=* ) rootflags=${param#rootflags=} ;;
|
||||||
|
resume=* ) resume=${param#resume=} ;;
|
||||||
|
noresume ) noresume=true ;;
|
||||||
|
ro ) ro="ro" ;;
|
||||||
|
rw ) ro="rw" ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -n "$rootdelay" ]; then sleep "$rootdelay"; fi
|
||||||
|
do_mount_root
|
||||||
|
|
||||||
|
for i in dev proc sys; do
|
||||||
|
[ -d /.root/$i ] || mkdir /.root/$i
|
||||||
|
mount -o bind /$i /.root/$i
|
||||||
|
done
|
||||||
|
mount -t devpts none /.root/dev/pts
|
||||||
|
|
||||||
|
echo 0 > /proc/sys/kernel/printk
|
||||||
|
|
||||||
|
exec switch_root /.root "$init" "$@"
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
bin
|
||||||
|
dev
|
||||||
|
mnt
|
||||||
|
proc
|
||||||
|
root
|
||||||
|
sys
|
||||||
@@ -13,7 +13,6 @@ mnt
|
|||||||
opt
|
opt
|
||||||
proc
|
proc
|
||||||
root
|
root
|
||||||
run
|
|
||||||
srv
|
srv
|
||||||
sys
|
sys
|
||||||
usr
|
usr
|
||||||
|
|||||||
@@ -9,16 +9,23 @@
|
|||||||
. ./scripts/rootfs.sh
|
. ./scripts/rootfs.sh
|
||||||
. ./scripts/uboot.sh
|
. ./scripts/uboot.sh
|
||||||
. ./scripts/sdroot.sh
|
. ./scripts/sdroot.sh
|
||||||
|
. ./scripts/dropbear.sh
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
build)
|
build)
|
||||||
rootfs
|
# rootfs
|
||||||
sdroot
|
if [ "$image_usable_enable" = "true" ]; then
|
||||||
|
sdroot_usable
|
||||||
|
fi
|
||||||
|
# sdroot
|
||||||
# kernel_with_rootfs
|
# kernel_with_rootfs
|
||||||
# uboot
|
# uboot
|
||||||
# busybox_rootfs
|
# busybox_rootfs
|
||||||
# kernel
|
# kernel
|
||||||
;;
|
;;
|
||||||
|
dropbear)
|
||||||
|
dropbear
|
||||||
|
;;
|
||||||
download)
|
download)
|
||||||
download_sources
|
download_sources
|
||||||
;;
|
;;
|
||||||
|
|||||||
+22
-2
@@ -18,10 +18,30 @@ busybox_rootfs() {
|
|||||||
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 ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE oldconfig # &>> $fulllogfile
|
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- 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 ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE $makeflags # &>> $fulllogfile
|
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- $makeflags # &>> $fulllogfile
|
||||||
check $? "Build busybox all logs in .log"
|
check $? "Build busybox all logs in .log"
|
||||||
}
|
}
|
||||||
#--------------------------------------------------
|
#--------------------------------------------------
|
||||||
|
|
||||||
|
#------------------ 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 ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- oldconfig # &>> $fulllogfile
|
||||||
|
check $? "Configure busybox all logs in .log"
|
||||||
|
printf "$UGREEN** Building busybox\n$RESET"
|
||||||
|
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- $makeflags # &>> $fulllogfile
|
||||||
|
check $? "Build busybox all logs in .log"
|
||||||
|
}
|
||||||
|
#------------------------------------------------------------------
|
||||||
|
|||||||
+6
-3
@@ -12,13 +12,16 @@ export distro_codename="zero_zero_one" # distro codename
|
|||||||
export out=$root/out # output directory
|
export out=$root/out # output directory
|
||||||
export build=$root/build # build directory
|
export build=$root/build # build directory
|
||||||
export sourcesfilename=sources.txt # sources file for downloading
|
export sourcesfilename=sources.txt # sources file for downloading
|
||||||
# initramfsfile=$root/initramfs/initramfs.txt # file to created directories for initramfs
|
export initramfsfile=$root/initramfs/initramfs.txt # file to created directories for initramfs
|
||||||
# initramfspath=$build/initramfs # initramfs build directory
|
export initramfspath=$build/initramfs # initramfs build directory
|
||||||
export rootfsfile=$root/rootfs/rootfs.txt # file to created directories for rootfs
|
export rootfsfile=$root/rootfs/rootfs.txt # file to created directories for rootfs
|
||||||
export rootfspath=$build/rootfs # rootfs build directory
|
export rootfspath=$build/rootfs # rootfs build directory
|
||||||
export fulllogfile=$root/.log/fulllog.log # file for full build logs
|
export fulllogfile=$root/.log/fulllog.log # file for full build logs
|
||||||
export makeflags=-j$(nproc) # makeflags
|
export makeflags=-j$(nproc) # makeflags
|
||||||
export CROSS_COMPILE=arm-buildroot-linux-uclibcgnueabihf-
|
export CROSS_COMPILE=arm-buildroot-linux-uclibcgnueabihf
|
||||||
export ARCH=arm
|
export ARCH=arm
|
||||||
export sdroot=$out/sdroot
|
export sdroot=$out/sdroot
|
||||||
|
export ZLIB_ENABLE="true"
|
||||||
|
export DROPBEAR_ENABLE="true"
|
||||||
|
export image_usable_enable="true"
|
||||||
#--------------------------------------
|
#--------------------------------------
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. ./scripts/colors.sh
|
||||||
|
. ./scripts/funcs.sh
|
||||||
|
. ./scripts/config.sh
|
||||||
|
. ./scripts/zlib.sh
|
||||||
|
|
||||||
|
dropbear() {
|
||||||
|
if [ ! -d $build/zlib ]; then
|
||||||
|
zlib
|
||||||
|
fi
|
||||||
|
printf "$GREEN** Building and installing dropbear\n$RESET"
|
||||||
|
mkdir $build/dropbear
|
||||||
|
cd $build/dropbear
|
||||||
|
tar -xvf $root/downloads/DROPBEAR_2024.86.tar.gz
|
||||||
|
check $? "Extract dropbear"
|
||||||
|
cd dropbear-DROPBEAR_2024.86
|
||||||
|
./configure \
|
||||||
|
--prefix=/usr \
|
||||||
|
--host=$CROSS_COMPILE \
|
||||||
|
--with-zlib=$build/rootfs
|
||||||
|
# CC=${CROSS_COMPILE}gcc ./configure --prefix=/usr --shared
|
||||||
|
check $? "Configure dropbear"
|
||||||
|
make $makeflags
|
||||||
|
check $? "Build dropbear"
|
||||||
|
make DESTDIR=$rootfspath install
|
||||||
|
check $? "Installing to rootfs dropbear"
|
||||||
|
rm -rv $rootfspath/usr/include $rootfspath/usr/share/man $rootfspath/usr/lib/{pkgconfig,libz.a}
|
||||||
|
${CROSS_COMPILE}-strip $rootfspath/usr/bin/*
|
||||||
|
mkdir -pv $build/rootfs/etc/dropbear
|
||||||
|
# check $? "Installing to rootfs zlib"
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. ./scripts/colors.sh
|
||||||
|
. ./scripts/funcs.sh
|
||||||
|
. ./scripts/config.sh
|
||||||
|
. ./scripts/busybox.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 $(cat $root/busybox/busybox_initramfs_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
|
||||||
|
#------------------------------------------------------------------
|
||||||
+6
-6
@@ -15,12 +15,12 @@ kernel() {
|
|||||||
check $? "Extract Linux Kernel"
|
check $? "Extract Linux Kernel"
|
||||||
cd linux-6.1.91
|
cd linux-6.1.91
|
||||||
printf "$UGREEN** Configuring Linux Kernel\n$RESET"
|
printf "$UGREEN** Configuring Linux Kernel\n$RESET"
|
||||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE mrproper # &>> $fulllogfile
|
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- mrproper # &>> $fulllogfile
|
||||||
cp -v $root/kernel/config-6.1.91 .config # &>> $fulllogfile
|
cp -v $root/kernel/config-6.1.91 .config # &>> $fulllogfile
|
||||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE oldconfig # &>> $fulllogfile
|
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- oldconfig # &>> $fulllogfile
|
||||||
check $? "Configure Linux Kernel"
|
check $? "Configure Linux Kernel"
|
||||||
printf "$UGREEN** Building Linux Kernel\n$RESET"
|
printf "$UGREEN** Building Linux Kernel\n$RESET"
|
||||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE $makeflags # &>> $fulllogfile
|
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- $makeflags # &>> $fulllogfile
|
||||||
check $? "Build Linux Kernel"
|
check $? "Build Linux Kernel"
|
||||||
ls -lh arch/$ARCH/boot/zImage
|
ls -lh arch/$ARCH/boot/zImage
|
||||||
} # kernel
|
} # kernel
|
||||||
@@ -30,10 +30,10 @@ kernel() {
|
|||||||
kernel_modules() {
|
kernel_modules() {
|
||||||
printf "$UGREEN** Building Linux Kernel modules\n$RESET"
|
printf "$UGREEN** Building Linux Kernel modules\n$RESET"
|
||||||
cd $build/kernel/linux-6.1.91
|
cd $build/kernel/linux-6.1.91
|
||||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE modules # &>> fulllogfile
|
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- modules # &>> fulllogfile
|
||||||
check $? "Build Linux Kernel modules"
|
check $? "Build Linux Kernel modules"
|
||||||
printf "$UGREEN** Installing Linux Kernel modules into rootfs path\n$RESET"
|
printf "$UGREEN** Installing Linux Kernel modules into rootfs path\n$RESET"
|
||||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE 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}
|
rm -v $rootfspath/usr/lib/modules/6.1.91/{source,build}
|
||||||
check $? "Install Linux Kernel modules"
|
check $? "Install Linux Kernel modules"
|
||||||
} # kernel_modules
|
} # kernel_modules
|
||||||
@@ -46,7 +46,7 @@ kernel_with_rootfs() {
|
|||||||
mkdir -pv $out
|
mkdir -pv $out
|
||||||
fi
|
fi
|
||||||
cd $build/kernel/linux-6.1.91
|
cd $build/kernel/linux-6.1.91
|
||||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE CONFIG_INITRAMFS_SOURCE=$rootfspath $makeflags # &>> fulllogfile
|
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- CONFIG_INITRAMFS_SOURCE=$rootfspath $makeflags # &>> fulllogfile
|
||||||
check $? "Build Linux Kernel with rootfs"
|
check $? "Build Linux Kernel with rootfs"
|
||||||
printf "$UGREEN** Installing Linux Kernel into images path\n$RESET"
|
printf "$UGREEN** Installing Linux Kernel into images path\n$RESET"
|
||||||
# make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE INSTALL_MOD_PATH=$rootfspath modules_install # &>> $fulllogfile
|
# make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE INSTALL_MOD_PATH=$rootfspath modules_install # &>> $fulllogfile
|
||||||
|
|||||||
+8
-1
@@ -7,6 +7,7 @@
|
|||||||
. ./scripts/uclibc.sh
|
. ./scripts/uclibc.sh
|
||||||
. ./scripts/kernel.sh
|
. ./scripts/kernel.sh
|
||||||
. ./scripts/zlib.sh
|
. ./scripts/zlib.sh
|
||||||
|
. ./scripts/dropbear.sh
|
||||||
|
|
||||||
#----------- Building rootfs ----------------------
|
#----------- Building rootfs ----------------------
|
||||||
rootfs() {
|
rootfs() {
|
||||||
@@ -19,6 +20,7 @@ rootfs() {
|
|||||||
ln -sv usr/lib lib32 # &>> $fulllogfile
|
ln -sv usr/lib lib32 # &>> $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
|
||||||
|
ln -sv var/run run
|
||||||
cd usr
|
cd usr
|
||||||
ln -sv bin sbin # &>> $fulllogfile
|
ln -sv bin sbin # &>> $fulllogfile
|
||||||
ln -sv lib lib32 # &>> $fulllogfile
|
ln -sv lib lib32 # &>> $fulllogfile
|
||||||
@@ -36,7 +38,12 @@ rootfs() {
|
|||||||
uclibc
|
uclibc
|
||||||
kernel
|
kernel
|
||||||
kernel_modules
|
kernel_modules
|
||||||
zlib
|
if [ "$ZLIB_ENABLE" = "true" ]; then
|
||||||
|
zlib
|
||||||
|
fi
|
||||||
|
if [ "$DROPBEAR_ENABLE" = "true" ]; then
|
||||||
|
dropbear
|
||||||
|
fi
|
||||||
|
|
||||||
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 $rootfspath/init
|
chmod 755 $rootfspath/etc/init.d/* $rootfspath/usr/share/udhcpc/default.script $rootfspath/init
|
||||||
|
|||||||
@@ -5,10 +5,12 @@
|
|||||||
. ./scripts/config.sh
|
. ./scripts/config.sh
|
||||||
. ./scripts/kernel.sh
|
. ./scripts/kernel.sh
|
||||||
. ./scripts/uboot.sh
|
. ./scripts/uboot.sh
|
||||||
|
. ./scripts/initramfs.sh
|
||||||
|
|
||||||
#--- sdroot ---
|
#--- sdroot ---
|
||||||
sdroot() {
|
sdroot() {
|
||||||
printf "$GREEN** Generating sdroot\n$RESET"
|
printf "$GREEN** Generating sdroot\n$RESET"
|
||||||
|
rm -rv $sdroot
|
||||||
if [ ! -d $sdroot ]; then
|
if [ ! -d $sdroot ]; then
|
||||||
mkdir -pv $sdroot
|
mkdir -pv $sdroot
|
||||||
fi
|
fi
|
||||||
@@ -50,3 +52,53 @@ sdroot() {
|
|||||||
check $? "Generating sdcard.img"
|
check $? "Generating sdcard.img"
|
||||||
}
|
}
|
||||||
#--------------
|
#--------------
|
||||||
|
|
||||||
|
sdroot_usable() {
|
||||||
|
printf "$GREEN** Generating sdroot usable\n$RESET"
|
||||||
|
rm -rv $sdroot
|
||||||
|
if [ ! -d $sdroot ]; then
|
||||||
|
mkdir -pv $sdroot
|
||||||
|
fi
|
||||||
|
printf "$GREEN** Creating dirs\n$RESET"
|
||||||
|
mkdir -pv $sdroot/boot/{dtbs,extlinux}
|
||||||
|
check $? "Creating dirs"
|
||||||
|
printf "$GREEN** Copy extlinux.conf\n$RESET"
|
||||||
|
cp -v $root/extlinux/extlinux_usable.conf $sdroot/boot/extlinux/extlinux.conf
|
||||||
|
check $? "Copy extlinux.conf"
|
||||||
|
# kernel_with_rootfs
|
||||||
|
cp -rv $build/rootfs/* $sdroot/
|
||||||
|
initramfs
|
||||||
|
cp -v $build/initramfs.img $sdroot/boot
|
||||||
|
cp -v $build/kernel/linux-6.1.91/arch/$ARCH/boot/zImage $sdroot/boot
|
||||||
|
uboot
|
||||||
|
printf "$GREEN** Creating rootfs.ext4\n$RESET"
|
||||||
|
cd $out
|
||||||
|
rawsdrootsize=$(du -sh $sdroot)
|
||||||
|
echo $rawsdrootsize
|
||||||
|
sdrootsize=(${rawsdrootsize//M/ })
|
||||||
|
echo $sdrootsize
|
||||||
|
echo $(($sdrootsize+2))
|
||||||
|
dd if=/dev/zero of=rootfs.ext4 bs=1M count=$(($sdrootsize+3))
|
||||||
|
check $? "Write zero rootfs.ext4"
|
||||||
|
mkfs.ext4 rootfs.ext4
|
||||||
|
check $? "Creating ext4 filesystem"
|
||||||
|
rawuuid=$(echo $(blkid rootfs.ext4 | echo $(awk '{print $2}')))
|
||||||
|
echo $rawuuid
|
||||||
|
uuidIN=(${rawuuid//=/ })
|
||||||
|
uuid=${uuidIN[1]}
|
||||||
|
echo $uuid
|
||||||
|
cp -v $root/genimage/genimage.cfg .
|
||||||
|
check $? "Copy genimage.cfg"
|
||||||
|
sed -i "s/FILEUUID/$uuid/g" genimage.cfg
|
||||||
|
sed -i "s/ROOTUUID/$uuid/g" $sdroot/boot/extlinux/extlinux.conf
|
||||||
|
sed -i "s/sdcard.img/sdcard_usable.img/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
|
||||||
|
check $? "Generating sdcard_usable.img"
|
||||||
|
}
|
||||||
|
|||||||
+2
-2
@@ -13,9 +13,9 @@ uboot() {
|
|||||||
check $? "Extract uboot"
|
check $? "Extract uboot"
|
||||||
cd u-boot-2024.10
|
cd u-boot-2024.10
|
||||||
# cp -rv $root/uclibc/config-1.0.50 .config
|
# cp -rv $root/uclibc/config-1.0.50 .config
|
||||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE orangepi_pc_defconfig
|
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- orangepi_pc_defconfig
|
||||||
check $? "Configure uboot"
|
check $? "Configure uboot"
|
||||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE $makeflags # &>> $fulllogfile
|
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- $makeflags # &>> $fulllogfile
|
||||||
check $? "Build uboot"
|
check $? "Build uboot"
|
||||||
cp -v u-boot-sunxi-with-spl.bin $out
|
cp -v u-boot-sunxi-with-spl.bin $out
|
||||||
cp -v arch/arm/dts/sun8i-h3-orangepi-pc.dtb $sdroot/boot/dtbs
|
cp -v arch/arm/dts/sun8i-h3-orangepi-pc.dtb $sdroot/boot/dtbs
|
||||||
|
|||||||
+4
-4
@@ -13,17 +13,17 @@ uclibc() {
|
|||||||
check $? "Extract uclibc"
|
check $? "Extract uclibc"
|
||||||
cd uClibc-ng-1.0.50
|
cd uClibc-ng-1.0.50
|
||||||
cp -rv $root/uclibc/config-1.0.50 .config
|
cp -rv $root/uclibc/config-1.0.50 .config
|
||||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE oldconfig
|
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- oldconfig
|
||||||
check $? "Configure uclibc"
|
check $? "Configure uclibc"
|
||||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE $makeflags # &>> $fulllogfile
|
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- $makeflags # &>> $fulllogfile
|
||||||
check $? "Build uclibc"
|
check $? "Build uclibc"
|
||||||
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE DESTDIR=$rootfspath install # &>> $fulllogfile
|
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- DESTDIR=$rootfspath install # &>> $fulllogfile
|
||||||
check $? "Install uclibc to rootfs"
|
check $? "Install uclibc to rootfs"
|
||||||
cd $rootfspath
|
cd $rootfspath
|
||||||
find -name \*.a -delete # &>> $fulllogfile
|
find -name \*.a -delete # &>> $fulllogfile
|
||||||
find -name \*.o -delete
|
find -name \*.o -delete
|
||||||
rm -v $rootfspath/usr/lib/libc.so
|
rm -v $rootfspath/usr/lib/libc.so
|
||||||
${CROSS_COMPILE}strip --strip-unneeded $rootfspath/usr/lib/* $rootfspath/usr/bin/* # &>> $fulllogfile
|
${CROSS_COMPILE}-strip --strip-unneeded $rootfspath/usr/lib/* $rootfspath/usr/bin/* # &>> $fulllogfile
|
||||||
rm -rv $rootfspath/usr/include
|
rm -rv $rootfspath/usr/include
|
||||||
cd $root
|
cd $root
|
||||||
check $? "Build and install uclibc"
|
check $? "Build and install uclibc"
|
||||||
|
|||||||
+2
-2
@@ -11,12 +11,12 @@ zlib() {
|
|||||||
tar -xvf $root/downloads/zlib-1.3.1.tar.gz
|
tar -xvf $root/downloads/zlib-1.3.1.tar.gz
|
||||||
check $? "Extract zlib"
|
check $? "Extract zlib"
|
||||||
cd zlib-1.3.1
|
cd zlib-1.3.1
|
||||||
CC=${CROSS_COMPILE}gcc ./configure --prefix=/usr --shared
|
CC=${CROSS_COMPILE}-gcc ./configure --prefix=/usr --shared
|
||||||
check $? "Configure zlib"
|
check $? "Configure zlib"
|
||||||
make $makeflags
|
make $makeflags
|
||||||
check $? "Build zlib"
|
check $? "Build zlib"
|
||||||
make DESTDIR=$rootfspath install
|
make DESTDIR=$rootfspath install
|
||||||
rm -rv $rootfspath/usr/include $rootfspath/usr/share/man $rootfspath/usr/lib/{pkgconfig,libz.a}
|
rm -rv $rootfspath/usr/include $rootfspath/usr/share/man $rootfspath/usr/lib/{pkgconfig,libz.a}
|
||||||
${CROSS_COMPILE}strip $rootfspath/usr/lib/libz.so.1.3.1
|
${CROSS_COMPILE}-strip $rootfspath/usr/lib/libz.so.1.3.1
|
||||||
check $? "Installing to rootfs zlib"
|
check $? "Installing to rootfs zlib"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ https://downloads.uclibc-ng.org/releases/1.0.50/uClibc-ng-1.0.50.tar.xz
|
|||||||
https://github.com/TolaMironcenko/initscripts/archive/refs/tags/0.0.1-orangepi-pc/initscripts-0.0.1-orangepi-pc.tar.gz
|
https://github.com/TolaMironcenko/initscripts/archive/refs/tags/0.0.1-orangepi-pc/initscripts-0.0.1-orangepi-pc.tar.gz
|
||||||
https://github.com/u-boot/u-boot/archive/refs/tags/v2024.10/u-boot-v2024.10.tar.gz
|
https://github.com/u-boot/u-boot/archive/refs/tags/v2024.10/u-boot-v2024.10.tar.gz
|
||||||
https://www.zlib.net/zlib-1.3.1.tar.gz
|
https://www.zlib.net/zlib-1.3.1.tar.gz
|
||||||
|
https://github.com/mkj/dropbear/archive/refs/tags/DROPBEAR_2024.86.tar.gz
|
||||||
Reference in New Issue
Block a user