orangepi-pc #3

Merged
wt merged 41 commits from orangepi-pc into main 2025-08-17 14:25:32 +07:00
9 changed files with 169 additions and 9 deletions
Showing only changes of commit f3518956c6 - Show all commits
+23
View File
@@ -0,0 +1,23 @@
#!/bin/sh
. ./scripts/colors.sh
. ./scripts/funcs.sh
. ./scripts/config.sh
bash() {
printf "$GREEN** Building and installing bash\n$RESET"
mkdir $build/bash
cd $build/bash
tar -xvf $root/downloads/bash-5.2.32.tar.gz
check $? "Extract bash"
cd bash-5.2.32
./configure \
--prefix=/usr \
--host=$CROSS_COMPILE
check $? "Configure bash"
make $makeflags
check $? "Build bash"
cp -v bash $rootfspath/usr/bin
$CROSS_COMPILE-strip --strip-unneeded $rootfspath/usr/bin/bash
check $? "Installing to rootfs bash"
}
+7 -3
View File
@@ -21,8 +21,12 @@ export makeflags=-j$(nproc) # makeflags
export CROSS_COMPILE=arm-buildroot-linux-uclibcgnueabihf
export ARCH=arm
export sdroot=$out/sdroot
export ZLIB_ENABLE="true"
export DROPBEAR_ENABLE="true"
export ZLIB_ENABLE="false"
export DROPBEAR_ENABLE="false"
export image_usable_enable="true"
export sftp_server_enable="true"
export sftp_server_enable="false"
export curl_enable="false"
export bash_enable="false"
export git_enable="false"
export gitea_enable="true"
#--------------------------------------
+38
View File
@@ -0,0 +1,38 @@
#!/bin/sh
. ./scripts/colors.sh
. ./scripts/funcs.sh
. ./scripts/config.sh
. ./scripts/zlib.sh
curl() {
if [ ! -d $build/zlib ]; then
zlib
fi
printf "$GREEN** Building and installing curl\n$RESET"
mkdir $build/curl
cd $build/curl
tar -xvf $root/downloads/curl-8.9.1.tar.xz
check $? "Extract curl"
cd curl-8.9.1
./configure \
--prefix=/usr \
--host=$CROSS_COMPILE \
--without-ssl \
--disable-static \
--enable-shared \
--with-zlib=$rootfspath
check $? "Configure curl"
make $makeflags
check $? "Build curl"
make DESTDIR=$rootfspath install
rm \
-rv \
$rootfspath/usr/include \
$rootfspath/usr/share \
$rootfspath/usr/lib/*.a \
$rootfspath/usr/lib/*.la \
$rootfspath/usr/lib/pkgconfig
$CROSS_COMPILE-strip --strip-unneeded $rootfspath/usr/bin/curl $rootfspath/usr/lib/libcurl.so.4.8.0
check $? "Installing to rootfs curl"
}
+30
View File
@@ -0,0 +1,30 @@
#!/bin/sh
. ./scripts/colors.sh
. ./scripts/funcs.sh
. ./scripts/config.sh
. ./scripts/curl.sh
git() {
if [ ! -d $build/curl ]; then
curl
fi
printf "$GREEN** Building and installing git\n$RESET"
mkdir $build/git
cd $build/git
tar -xvf $root/downloads/git-2.46.0.tar.xz
check $? "Extract git"
cd git-2.46.0
./configure \
--prefix=/usr \
--host=$CROSS_COMPILE \
NO_ICONV=true \
ac_cv_fread_reads_directories=true \
ac_cv_snprintf_returns_bogus=false
check $? "Configure git"
make $makeflags
check $? "Build git"
make DESTDIR=$rootfspath install
$CROSS_COMPILE-strip --strip-unneeded $rootfspath/usr/bin/* $rootfspath/libexec/git-core/*
printf "$GREEN** SUCCESS: Building and installing git\n$RESET"
}
+35
View File
@@ -0,0 +1,35 @@
#!/bin/sh
. ./scripts/colors.sh
. ./scripts/funcs.sh
. ./scripts/config.sh
. ./scripts/zlib.sh
. ./scripts/dropbear.sh
. ./scripts/sftp_server.sh
. ./scripts/curl.sh
. ./scripts/bash.sh
. ./scripts/git.sh
gitea() {
if [ ! -d $build/zlib ]; then
zlib
fi
if [ ! -d $build/dropbear ]; then
dropbear
fi
if [ ! -d $build/sftp_server ]; then
sftp_server
fi
if [ ! -d $build/curl ]; then
curl
fi
if [ ! -d $build/curl ]; then
bash
fi
if [ ! -d $build/git ]; then
git
fi
cp -v $root/downloads/gitea-1.22.4-linux-arm-5 $rootfspath/usr/bin/gitea
chmod +x $rootfspath/usr/bin/gitea
check $? "download and install gitea to rootfs"
}
+16
View File
@@ -9,6 +9,10 @@
. ./scripts/zlib.sh
. ./scripts/dropbear.sh
. ./scripts/sftp_server.sh
. ./scripts/curl.sh
. ./scripts/bash.sh
. ./scripts/git.sh
. ./scripts/gitea.sh
#----------- Building rootfs ----------------------
rootfs() {
@@ -49,6 +53,18 @@ rootfs() {
if [ "$sftp_server_enable" = "true" ]; then
sftp_server
fi
if [ "$curl_enable" = "true" ]; then
curl
fi
if [ "$bash_enable" = "true" ]; then
bash
fi
if [ "$git_enable" = "true" ]; then
git
fi
if [ "$gitea_enable" = "true" ]; then
gitea
fi
chmod 640 $rootfspath/etc/shadow $rootfspath/etc/inittab
chmod 755 $rootfspath/etc/init.d/* $rootfspath/usr/share/udhcpc/default.script $rootfspath/init
+14 -4
View File
@@ -29,7 +29,7 @@ sdroot() {
sdrootsize=(${rawsdrootsize// / })
echo $sdrootsize
echo $(($sdrootsize+2))
dd if=/dev/zero of=rootfs.ext4 bs=1K count=$(($sdrootsize+3000))
dd if=/dev/zero of=rootfs.ext4 bs=1K count=$(($sdrootsize+$sdrootsize))
check $? "Write zero rootfs.ext4"
mkfs.ext4 rootfs.ext4
check $? "Creating ext4 filesystem"
@@ -66,7 +66,12 @@ sdroot_usable() {
cp -v $root/extlinux/extlinux_usable.conf $sdroot/boot/extlinux/extlinux.conf
check $? "Copy extlinux.conf"
# kernel_with_rootfs
cp -rv $build/rootfs/* $sdroot/
# cp -rv $build/rootfs/* $sdroot/
cd $rootfspath
tar -czvf /tmp/rootfs.tar.gz.tmp .
cd $sdroot
tar -xvf /tmp/rootfs.tar.gz.tmp
initramfs
cp -v $build/initramfs.img $sdroot/boot
cp -v $build/kernel/linux-6.1.91/arch/$ARCH/boot/zImage $sdroot/boot
@@ -78,7 +83,7 @@ sdroot_usable() {
sdrootsize=(${rawsdrootsize// / })
echo $sdrootsize
echo $(($sdrootsize+2))
dd if=/dev/zero of=rootfs.ext4 bs=1K count=$(($sdrootsize+3000))
dd if=/dev/zero of=rootfs.ext4 bs=1K count=$(($sdrootsize+$sdrootsize))
check $? "Write zero rootfs.ext4"
mkfs.ext4 rootfs.ext4
check $? "Creating ext4 filesystem"
@@ -94,7 +99,12 @@ sdroot_usable() {
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/
cd $sdroot
sudo tar -czvf /tmp/sdroot.tar.gz.tmp .
cd $root/out/rootmnt
sudo tar -xvf /tmp/sdroot.tar.gz.tmp
cd $out
# sudo cp -rv $sdroot/* rootmnt/
sudo umount -v rootfs.ext4
rm -rv rootmnt
mkdir input
+4
View File
@@ -6,3 +6,7 @@ https://github.com/u-boot/u-boot/archive/refs/tags/v2024.10/u-boot-v2024.10.tar.
https://www.zlib.net/zlib-1.3.1.tar.gz
https://github.com/mkj/dropbear/archive/refs/tags/DROPBEAR_2024.86.tar.gz
https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.9p1.tar.gz
https://curl.se/download/curl-8.9.1.tar.xz
https://ftp.gnu.org/gnu/bash/bash-5.2.32.tar.gz
https://www.kernel.org/pub/software/scm/git/git-2.46.0.tar.xz
https://dl.gitea.com/gitea/1.22.4/gitea-1.22.4-linux-arm-5