orangepi-pc #3

Merged
wt merged 41 commits from orangepi-pc into main 2025-08-17 07:25:32 +00:00
60 changed files with 6170 additions and 7732 deletions
Showing only changes of commit 29af752d10 - Show all commits

No files matched your search

-38
View File
@@ -1,38 +0,0 @@
stages:
- build
# needed environment variables
variables:
IMAGE_NAME: SimpleLinux
IMAGE_VERSION: 0.0.1
build-iso-image:
#image: ubuntu:18.04
stage: build
artifacts:
# artifacts archive name
name: "$IMAGE_NAME-$IMAGE_VERSION-$CI_COMMIT_BRANCH-$CI_PIPELINE_ID"
# artifacts path
paths:
- artifacts
# update environments and install needed packages
before_script:
- echo "Hello, $GITLAB_USER_LOGIN"
- make build_image
- uname -a
- apt update && apt upgrade -y && apt install build-essential bc file
# script for building artifacts
script:
- apt update && apt upgrade -y && apt install build-essential bc file
- ./scripts/build_image.sh build
# installing artifacts to artifacts directory
after_script:
- rm -rvf artifacts
- mkdir -v artifacts
- cp -v build/simplelinux.iso artifacts/$IMAGE_NAME-$IMAGE_VERSION-$CI_COMMIT_BRANCH-$CI_PIPELINE_ID.iso
- cp -v .log/fulllog.log actifacts/fulllog
+13 -7
View File
@@ -1,13 +1,19 @@
default: build_image
build_image:
@sudo ./scripts/build_image.sh build
./scripts/build_image.sh build
source:
./scripts/build_image.sh download
download:
./scripts/build_image.sh download
clean:
@sudo ./scripts/build_image.sh clean
./scripts/clean.sh
download_sources:
@sudo ./scripts/build_image.sh download
build_rootfs:
@sudo ./scripts/build_image.sh rootfs
distclean:
./scripts/clean.sh
if [ -d downloads ]; then \
rm -rv downloads; \
fi
-33
View File
@@ -1,33 +0,0 @@
# Simple Linux
### This is a scripts to build Simple Linux install media
## To start build
```shell
sudo ./scripts/build_image.sh build
```
### or
```shell
sudo make
```
### or
```shell
sudo make build
```
## Using for building initramfs
```
x86_64-buildroot-linux-uclibc-gcc
```
## Using for building rootfs
```
Host gcc and binutils
```
File diff suppressed because it is too large. Load diff
Regular → Executable
View File
File mode changed.
+371
View File
@@ -0,0 +1,371 @@
[
[[
acpid
add-shell
addgroup
adduser
adjtimex
ar
arch
arp
arping
ascii
awk
base32
base64
basename
bc
beep
blkdiscard
blkid
blockdev
bootchartd
brctl
bunzip2
bzcat
bzip2
cal
cat
chat
chattr
chgrp
chmod
chown
chpasswd
chroot
chrt
chvt
cksum
clear
cmp
comm
conspy
cp
cpio
crc32
crond
crontab
cryptpw
cttyhack
cut
date
dc
dd
deallocvt
delgroup
deluser
depmod
devmem
df
dhcprelay
diff
dirname
dmesg
dnsd
dnsdomainname
dos2unix
du
dumpkmap
dumpleases
echo
ed
egrep
eject
env
ether-wake
expand
expr
factor
fakeidentd
fallocate
false
fatattr
fbset
fbsplash
fdflush
fdformat
fdisk
fgconsole
fgrep
find
findfs
flock
fold
free
freeramdisk
fsck
fsfreeze
fstrim
fsync
ftpd
ftpget
ftpput
fuser
getopt
getty
grep
groups
gunzip
gzip
halt
hd
hdparm
head
hexdump
hexedit
hostid
hostname
httpd
hwclock
i2cdetect
i2cdump
i2cget
i2cset
i2ctransfer
id
ifconfig
ifdown
ifenslave
ifplugd
ifup
inetd
init
insmod
install
ionice
iostat
ip
ipaddr
ipcalc
ipcrm
ipcs
iplink
ipneigh
iproute
iprule
iptunnel
kbd_mode
kill
killall
killall5
klogd
last
less
link
linux32
linux64
linuxrc
ln
loadfont
loadkmap
logger
login
logname
logread
losetup
lpd
lpq
lpr
ls
lsattr
lsmod
lsof
lspci
lsscsi
lsusb
lzcat
lzma
lzop
lzopcat
makedevs
man
md5sum
mdev
mesg
microcom
mim
mkdir
mkdosfs
mke2fs
mkfifo
mkfs.ext2
mkfs.vfat
mknod
mkpasswd
mkswap
mktemp
modinfo
modprobe
more
mount
mountpoint
mpstat
mt
mv
nameif
nanddump
nandwrite
nbd-client
nc
netstat
nice
nl
nmeter
nohup
nologin
nproc
nsenter
nslookup
ntpd
od
openvt
partprobe
passwd
paste
patch
pgrep
pidof
ping
ping6
pivot_root
pkill
pmap
poweroff
powertop
printenv
printf
ps
pscan
pstree
pwd
pwdx
raidautorun
rdate
rdev
readahead
readlink
readprofile
realpath
reboot
remove-shell
renice
reset
resize
rev
rfkill
rm
rmdir
rmmod
route
rtcwake
run-parts
rx
script
scriptreplay
sed
seedrng
seq
setarch
setconsole
setfattr
setfont
setkeycodes
setlogcons
setpriv
setserial
setsid
sh
sha1sum
sha256sum
sha3sum
sha512sum
showkey
shred
shuf
slattach
sleep
smemcap
sort
split
ssl_client
stat
strings
stty
su
sulogin
sum
swapoff
swapon
switch_root
sync
sysctl
syslogd
tac
tail
tar
taskset
tcpsvd
tee
telnet
telnetd
test
tftp
tftpd
time
timeout
top
touch
tr
traceroute
traceroute6
tree
true
truncate
ts
tsort
tty
ttysize
tunctl
tune2fs
udhcpc
udhcpc6
udhcpd
udpsvd
uevent
umount
uname
uncompress
unexpand
uniq
unix2dos
unlink
unlzma
unlzop
unshare
unxz
unzip
uptime
users
usleep
uudecode
uuencode
vconfig
vi
vlock
volname
w
wall
watch
watchdog
wc
wget
who
whoami
whois
xargs
xxd
xz
xzcat
yes
zcat
zcip
+4
View File
@@ -0,0 +1,4 @@
LABEL default
kernel /boot/zImage
devicetreedir /boot/dtbs
append console=${console} panic=10
+20
View File
@@ -0,0 +1,20 @@
image sdcard.img {
partition u-boot {
in-partition-table = false
image = "u-boot-sunxi-with-spl.bin"
offset = 8K
size = 1000K # 1MB - 8KB(offset) - 16KB(GPT)
}
hdimage {
partition-table-type = "gpt"
gpt-location = 1008K # 1MB - 16KB(GPT)
gpt-no-backup = true
}
partition rootfs {
offset = 1M
image = "rootfs.ext4"
partition-uuid = FILEUUID
}
}
-109
View File
@@ -1,109 +0,0 @@
#!/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 dev /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 run tmp 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" "$@"
-6
View File
@@ -1,6 +0,0 @@
bin
dev
mnt
proc
root
sys
+5248
View File
File diff suppressed because it is too large. Load diff
-5263
View File
File diff suppressed because it is too large. Load diff
-6
View File
@@ -1,6 +0,0 @@
set timeout=5
menuentry 'Simple Linux Install Media' {
linux /boot/vmlinuz-linux root=/dev/sda
initrd /boot/initramfs.img
}
-1
View File
@@ -1 +0,0 @@
# disk mountpoint filesystem options 0 0/1
-1
View File
@@ -1 +0,0 @@
root:x:0:root
-1
View File
@@ -1 +0,0 @@
simple
-3
View File
@@ -1,3 +0,0 @@
127.0.0.1 localhost
::1 localhost
127.0.1.1 simple.localdomain simple
-82
View File
@@ -1,82 +0,0 @@
#!/bin/sh
#--- reset colors ---
RESET="\033[0m"
#--------------------
#--------- regularcolrs ---------
GREEN="\033[0;32m" #GREEN
BLUE="\033[0;34m" #BLUE
YELLOW="\033[1;33m" #YELLOW
RED="\033[0;31m" #RED
BLACK="\033[0;30m" #BLACK
PURPLE="\033[0;35m" #PURPLE
CYAN="\033[0;36m" #CYAN
WHITE="\033[0;37m" #WHITE
#--------------------------------
#-------- bold ------------------
BBLACK="\033[1;30m" #BLACK
BRED="\033[1;31m" #RED
BGREEN="\033[1;32m" #GREEN
BYELLOW="\033[1;33m" #YELLOW
BBLUE="\033[1;34m" #BLUE
BPURPLE="\033[1;35m" #PURPLE
BCYAN="\033[1;36m" #CYAN
BWHITE="\033[1;37m" #WHITE
#--------------------------------
#-------- Underline -------------
UBLACK="\033[4;30m" #BLACK
URED="\033[4;31m" #RED
UGREEN="\033[4;32m" #GREEN
UYELLOW="\033[4;33m" #YELLOW
UBLUE="\033[4;34m" #BLUE
UPURPLE="\033[4;35m" #PURPLE
UCYAN="\033[4;36m" #CYAN
UWHITE="\033[4;37m" #WHITE
#--------------------------------
#--------- Background -----------
ON_BLACK="\033[40m" #BLACK
ON_RED="\033[41m" #RED
ON_GREEN="\033[42m" #GREEN
ON_YELLOW="\033[43m" #YELLOW
ON_BLUE="\033[44m" #BLUE
ON_PURPLE="\033[45m" #PURPLE
ON_CYAN="\033[46m" #CYAN
ON_WHITE="\033[47m" #WHITE
#--------------------------------
#------ HighIntensity -----------
IBLACK="\033[0;90m" #BLACK
IRED="\033[0;91m" #RED
IGREEN="\033[0;92m" #GREEN
IYELLOW="\033[0;93m" #YELLOW
IBLUE="\033[0;94m" #BLUE
IPURPLE="\033[0;95m" #PURPLE
ICYAN="\033[0;96m" #CYAN
IWHITE="\033[0;97m" #WHITE
#--------------------------------
#------ BoldHighIntensity -------
BIBLACK="\033[1;90m" #BLACK
BIRED="\033[1;91m" #RED
BIGREEN="\033[1;92m" #GREEN
BIYELLOW="\033[1;93m" #YELLOW
BIBLUE="\033[1;94m" #BLUE
BIPURPLE="\033[1;95m" #PURPLE
BICYAN="\033[1;96m" #CYAN
BIWHITE="\033[1;97m" #WHITE
#--------------------------------
#--- HighIntensitybackgrounds ---
ON_IBLACK="\033[0;100m" #BLACK
ON_IRED="\033[0;101m" #RED
ON_IGREEN="\033[0;102m" #GREEN
ON_IYELLOW="\033[0;103m" #YELLOW
ON_IBLUE="\033[0;104m" #BLUE
ON_IPURPLE="\033[0;105m" #PURPLE
ON_ICYAN="\033[0;106m" #CYAN
ON_IWHITE="\033[0;107m" #WHITE
#--------------------------------
-44
View File
@@ -1,44 +0,0 @@
#!/bin/sh
#--- import colors ---
. /etc/init.d/funcs/colors.sh
#---------------------
#---------------------- rc function to poweron or poweroff ------------
rc() {
if [ -d /etc/rc.d ] && [ $0 == "/etc/init.d/rcK" ]; then
for i in $(ls -r /etc/rc.d); do
/etc/rc.d/$i stop
done
return 1
fi
for i in /etc/rc.d/??*; do
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
$i start
;;
esac
done
sleep 1
# clear
return 1
}
#----------------------------------------------------------------------
#---------- check status function -----------
check() {
if [ $1 -ne 0 ]; then
printf "$BBLUE**$BRED ERROR: $2\n$RESET"
return
fi
printf "$BBLUE**$BGREEN SUCCESS: $2\n$RESET"
}
#--------------------------------------------
-18
View File
@@ -1,18 +0,0 @@
#!/bin/sh
. /etc/init.d/funcs/colors.sh
. /etc/init.d/funcs/init-funcs
case "$1" in
start)
printf "$BBLUE**$BYELLOW Setting up hostname\n$RESET"
/bin/hostname -F /etc/hostname
check $? "Set up hostname"
;;
stop)
;;
*)
echo "$0 init script usage: $0 {start}"
return 1
esac
return $?
-29
View File
@@ -1,29 +0,0 @@
#!/bin/sh
. /etc/init.d/funcs/init-funcs
. /etc/init.d/funcs/colors.sh
case "$1" in
start)
printf "$BBLUE**$BYELLOW Starting networking\n$RESET"
/sbin/ifup -a &> /dev/null
check $? "networking"
echo $! > /var/run/networking.pid
;;
stop)
printf "$BBLUE**$BYELLOW Stopping netowrking\n$RESET"
/sbin/ifdown -a
check $? "Stop networking"
if [ -f /var/run/networking.pid ]; then
rm /var/run/networking.pid
fi
;;
restart|reload)
$0 stop
$0 start
;;
*)
echo "$0 init script usage: $0 {start|stop|restart|reload}"
return 1
esac
return $?
-1
View File
@@ -1 +0,0 @@
rcS
-3
View File
@@ -1,3 +0,0 @@
#!/bin/sh
. /etc/init.d/funcs/init-funcs
rc
-27
View File
@@ -1,27 +0,0 @@
#!/bin/sh
. /etc/init.d/funcs/init-funcs
. /etc/init.d/funcs/colors.sh
case "$1" in
start)
printf "$BBLUE**$BYELLOW Mounting virtual filesystems\n$RESET"
mount -t tmpfs tmpfs /var/run
check $? "Mount virtual filesystems"
echo $! > /var/run/networking.pid
;;
stop)
printf "$BBLUE**$BYELLOW Umounting virtual filesystems\n$RESET"
umount /var/run
check $? "Umount virtual filesystems"
rm /var/run/networking.pid
;;
restart|reload)
$0 stop
$0 start
;;
*)
echo "$0 init script usage: $0 {start|stop|restart|reload}"
return 1
esac
return $?
-9
View File
@@ -1,9 +0,0 @@
::sysinit:/etc/init.d/rcS
::ctrlaltdel:/sbin/reboot
::shutdown:/etc/init.d/rcK
tty1::respawn:/sbin/getty 38400 tty1
tty2::askfirst:/sbin/getty 38400 tty2
tty3::askfirst:/sbin/getty 38400 tty3
tty4::askfirst:/sbin/getty 38400 tty4
-1
View File
@@ -1 +0,0 @@
\h \r (\l)
-4
View File
@@ -1,4 +0,0 @@
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
-11
View File
@@ -1,11 +0,0 @@
passwd: files
group: files
shadow: files
hosts: files dns
networks: files
protocols: files
services: files
ethers: files
rpc: files
-1
View File
@@ -1 +0,0 @@
root:x:0:0:root:/root:/bin/sh
-11
View File
@@ -1,11 +0,0 @@
export RESET="\033[0m"
export GREEN="\033[1;32m"
export BLUE="\033[1;34m"
export RED="\033[1;31m"
export YELLOW="\033[1;33m"
export PS1="$BLUE**$BLUE \u$RESET@$RED\h: $GREEN\w $YELLOW\$(date +%d.%m.%Y) \t\n$GREEN\$ $RESET"
[ $(id -u) -eq 0 ] && export PS1="$RED** \u@\h: \w \$(date +%d.%m.%Y) \t\n\\\$ $RESET"
[ -f ~/.profile ] && source ~/.profile
-1
View File
@@ -1 +0,0 @@
../init.d/virtualfilesystems
-1
View File
@@ -1 +0,0 @@
../init.d/hostname
-1
View File
@@ -1 +0,0 @@
../init.d/networking
-1
View File
@@ -1 +0,0 @@
nameserver 10.0.2.3
-1
View File
@@ -1 +0,0 @@
root:F.fHA5x2Q.xNY:19797::::::
-2
View File
@@ -1,2 +0,0 @@
/bin/sh
/bin/ash
+37
View File
@@ -0,0 +1,37 @@
#!/bin/sh
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
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
echo 0 > /proc/sys/kernel/printk
exec /sbin/init
+2 -1
View File
@@ -26,4 +26,5 @@ usr/share
usr/src
var
var/log
var/run
var/run
tmp
-287
View File
@@ -1,287 +0,0 @@
#!/bin/sh
########## #### ####
########## #### ####
## ## ## ## ## ##
## ## ## ## ## ##
########## ## ## ## - PACKAGE MANAGER FOR SIMPLE LINUX
########## ## ## ## - AUTHOR -- TOLA MIRONCENKO
## ## ##
## ## ##
## ## ##
## ## ##
#----- colors -------
Green='\033[0;32m'
Color_off='\033[0m'
Red='\033[0;31m'
Bred='\033[1;31m'
Yellow='\033[1;33m'
White='\033[0;37m'
Bwhite='\033[1;37m'
#--------------------
#---------------- variables --------------------------
rootdir=/
repofile=$rootdir/etc/pm/repo
packagesqueryfile=$rootdir/usr/share/pm/query
reposquerydir=$rootdir/usr/share/pm/repos
cachedpkgdir=$rootdir/var/cache/pm/pkg
installedpackagesdir=$rootdir/usr/share/pm/packages
#-----------------------------------------------------
#---------------- check root priveleges function ------------------------
checkroot() {
if [[ $(id -u) != 0 ]]; then
printf "$Yellow**$Bred error:$Color_off you must be root\n"
exit 1
fi
}
checkroot
#------------------------------------------------------------------------
#----------------- add(install) package function ------------------------
add() {
if [[ "$1" == "" ]]; then
help
exit 0
fi
for i in $*; do
if [[ "$i" == "add" ]]; then
continue
fi
done
for i in $*; do
if [[ "$i" == "add" ]]; then
continue
fi
down $i
done
for i in $*; do
if [[ "$i" == "add" ]]; then
continue
fi
unpack $cachedpkgdir/$i.pkg.gz
done
}
#------------------------------------------------------------------------
#-------------------- download package without install function ---------
down() {
if [[ ! $1 ]]; then
help
exit 0
fi
servers=$(cat $repofile)
for i in $servers; do
serverdir=$(echo $i | sed -e "/http:\/\//s///")
repoquery=$(cat $reposquerydir/$serverdir/query | sed -e '/.pkg.gz/s///')
for j in $repoquery; do
if [[ $j == $1 ]]; then
if [ ! -f $cachedpkgdir/$1.pkg.gz ]; then
printf "$Yellow**$Color_off Downloading $Yellow$serverdir: $Bwhite$j\n$Color_off"
wget $i/$1.pkg.gz -P $cachedpkgdir
if [[ "$?" == "0" ]]; then
printf "$Yellow**$Green successful downloaded $1\n$Color_off"
return
else
printf "$Yellow**$Red error:$Color_off can't download package\n"
exit 1
fi
else
printf "$Yellow**$Green successful downloaded $1\n$Color_off"
return
fi
# exit 0
fi
done
done
printf "$Yellow**$Red error:$Color_off can't find package $1\n"
exit 1
}
#------------------------------------------------------------------------
#-------------------- unpack local package archive ----------------------
unpack() {
packagename=$(echo $1 | sed -e "/.gz/s///")
packagename=${packagename#*pkg/}
printf "$Yellow**$Green Installing ${packagename%.pkg*}\n$Color_off"
if [[ "$(cat $packagesqueryfile | grep ${packagename%.pkg*})" != "" ]]; then
printf "$Yellow**$Color_off Package already installed:$Yellow reinstalling\n"
fi
tar -xvf $1 -C $rootdir/tmp &> /dev/null
cd $rootdir/tmp/$packagename
mkdir $installedpackagesdir/$packagename &> /dev/null
mv -v list $installedpackagesdir/$packagename &> /dev/null
cp -rv ./* $rootdir &> /dev/null
if [ -f $rootdir/tmp/$packagename/post_install ]; then
sh -c $rootdir/tmp/$packagename/post_install
fi
if [[ "$(cat $packagesqueryfile | grep ${packagename%.pkg*})" == "" ]]; then
echo ${packagename%.pkg*} >> $packagesqueryfile
fi
rm -rv $rootdir/tmp/$packagename &> /dev/null
printf "$Yellow**$Green Installed ${packagename%.pkg*} successful\n$Color_off"
}
#------------------------------------------------------------------------
#------------------ delete package function -----------------------------
del() {
printf "$Yellow**$Green deleting\n$Color_off"
for i in $*; do
if [[ "$i" == "del" ]]; then
continue
fi
printf "$Yellow**$Green deleting $i\n$Color_off"
if [ ! -f $installedpackagesdir/$i.pkg/list ]; then
printf "$Yellow**$Bred error:$Color_off package not installed\n"
exit 0
fi
rm -v $rootdir/$(cat $installedpackagesdir/$i.pkg/list) &> /dev/null
rm -rv $installedpackagesdir/$i.pkg &> /dev/null
sed -i "/$i/d" $packagesqueryfile
printf "$Yellow**$Green delete $i successful\n$Color_off"
done
}
#------------------------------------------------------------------------
#------------------- list files in package function ---------------------
list() {
if [[ "$1" == "" ]]; then
help
exit 0
fi
if [[ "$(cat $packagesqueryfile | grep $1)" == "" ]]; then
printf "$Yellow**$Bred error:$Color_off package is not installed\n"
exit 1
fi
filelist=$(cat $installedpackagesdir/$1.pkg/list)
for i in $filelist; do
printf "$Yellow$1: $Bwhite$i$Color_off\n"
done
}
#------------------------------------------------------------------------
#------------------- show installed packages function -------------------
query() {
packagesquery=$(cat $packagesqueryfile)
if [[ "$packagesquery" == "" ]]; then
printf "$Yellow**$Bwhite No installed packages\n"
exit 0
fi
printf "$packagesquery\n"
}
#------------------------------------------------------------------------
#--------------------- show help function -------------------------------
help() {
printf "
$Yellow**$Green pm usage$Color_off :
$Bwhite pm add [package name] - download and install from repository
pm unpack [/path/to/package/archive] - unpack(install) from local package archive
pm down [package name] - download package from repository without install
pm del [package name] - delete package
pm list [package name] - list files in package
pm search [package name] - search package in repository
pm query - show installed packages
pm help - this help message
pm clear - clear all package archives from cached packages directory
pm sync - synchronize repository
$Yellow**$Green examples$Color_off :
$Bwhite pm add dnsmasq
pm unpack ./dnsmasq.pkg.gz
pm down dnsmasq
pm search dnsmasq
pm help
pm clear
pm sync
pm del dnsmasq
pm list dnsmasq
pm query
\n$Color_off"
}
#------------------------------------------------------------------------
#------------------- sync repo function ---------------------------------
sync() {
servers=$(cat $repofile)
for i in $servers; do
serverdir=$(echo $i | sed -e "/http:\//s///")
mkdir $reposquerydir/$serverdir &> /dev/null
wget $i/query -O $reposquerydir/$serverdir/query &> /dev/null
done
}
#------------------------------------------------------------------------
#----------------- search package in repo function ----------------------
search() {
servers=$(cat $repofile)
if [[ ! $1 ]]; then
for i in $servers; do
serverdir=$(echo $i | sed -e "/http:\/\//s///")
repoquery=$(cat $reposquerydir/$serverdir/query | sed -e '/.pkg.gz/s///')
for j in $repoquery; do
printf "$Yellow$serverdir: $Bwhite$j\n$Color_off"
done
done
exit 0
fi
for i in $servers; do
serverdir=$(echo $i | sed -e "/http:\/\//s///")
repoquery=$(cat $reposquerydir/$serverdir/query | sed -e '/.pkg.gz/s///')
for j in $repoquery; do
if [[ $j == $1 ]]; then
printf "$Yellow$serverdir: $Bwhite$j\n$Color_off"
exit 0
fi
done
done
printf "$Yellow**$Red error:$Color_off can't find package ($1)\n"
}
#------------------------------------------------------------------------
#------------------- clear cached packages directory --------------------
clear() {
rm -v $cachedpkgdir/*
}
#------------------------------------------------------------------------
case "$1" in
add)
add $*
;;
down)
down $2
;;
unpack)
unpack $2
;;
del)
del $*
;;
list)
list $2
;;
query)
query
;;
help)
help
;;
sync)
sync
;;
search)
search $2
;;
clear)
clear
;;
*)
help
;;
esac
-174
View File
@@ -1,174 +0,0 @@
#!/bin/sh
########## ##########
########## ##########
## ## ##
## ##
## ## - RC BOOT SCRIPTS MANAGER FOR SIMPLE LINUX
## ## - AUTHOR -- TOLA MIRONCENKO
## ##
## ##
## ##########
## ##########
#----- colors -------
Green='\033[0;32m'
Color_off='\033[0m'
Red='\033[0;31m'
Bred='\033[1;31m'
Yellow='\033[1;33m'
White='\033[0;37m'
Bwhite='\033[1;37m'
#--------------------
rootdir=/
#------------------------ add to boot function --------------
add() {
resultlink=$(cat /usr/share/rc/ordernumbers | grep $1)
if [ -f /etc/init.d/$1 ] && [ $resultlink ]; then
cd /etc/rc.d
ln -sv ../init.d/$1 "$resultlink" &> /dev/null
echo "added $1 to init."
else
help
fi
}
#------------------------------------------------------------
#--------------------- del from boot function ---------------
del() {
filetoremove=$(find /etc/rc.d/ | grep $1 )
if [ $filetoremove ]; then
rm -v $filetoremove &> /dev/null
echo "removed $1 from init."
else
help
fi
}
#------------------------------------------------------------
#---------------------- start daemon function ---------------
start() {
if [ -f /etc/init.d/$1 ]; then
/etc/init.d/$1 start
else
help
fi
}
#------------------------------------------------------------
#---------------- stop daemon function ----------------------
stop() {
if [ -f /etc/init.d/$1 ]; then
/etc/init.d/$1 stop
else
help
fi
}
#------------------------------------------------------------
#------------- restart daemon function ----------------------
restart() {
if [ -f /etc/init.d/$1 ]; then
/etc/init.d/$1 restart
else
help
fi
}
#------------------------------------------------------------
#------------------ list services ---------------------------
list() {
ls --color $rootdir/etc/init.d
}
#------------------------------------------------------------
#------------------ list enabled services -------------------
bootlist() {
ls --color $rootdir/etc/rc.d
}
#------------------------------------------------------------
#------------------ service status --------------------------
status() {
if [[ "$1" == "" ]]; then
help
exit 0
fi
if [[ "$(ls /etc/init.d | grep $1)" == "" ]]; then
printf "$Yellow**$Bred error:$Color_off can't find service /etc/init.d/$1\n"
exit 1
fi
printf "$Yellow**$Green $1$Color_off\n"
rcdservice=$(ls $rootdir/etc/rc.d | grep $1 2> /dev/null)
if [[ "$rcdservice" == "" ]]; then
printf "Loaded:$Yellow unloaded$Color_off (/etc/rc.d)\n"
else
printf "Loaded:$Green loaded$Color_off (/etc/rc.d/$rcdservice)\n"
fi
servicepid=$(ls $rootdir/var/run | grep $1)
if [[ "$servicepid" == "" ]]; then
printf "Active: deactive (${Yellow}deactive$Color_off)\n"
else
printf "Active: active (${Green}running$Color_off); pid (/var/run/$servicepid)\n"
fi
}
#------------------------------------------------------------
#-------------- print help function -------------------------
help() {
echo "
** rc usage:
rc add [init.d script name] - add service on boot
rc del [init.d script name] - delete service from boot
rc start [init.d script name] - start service
rc stop [init.d script name] - stop service
rc restart [init.d script name] - restart service
rc list - list all services
rc bootlist - list enabled services
rc status [init.d script name] - check service status
examples:
rc add httpd
rc del httpd
rc start httpd
rc stop httpd
rc restart httpd
rc list
rc bootlist
"
}
#------------------------------------------------------------
command="$1"
case ${command} in
add)
add $2 $3
;;
del)
del $2
;;
start)
start $2
;;
stop)
stop $2
;;
restart)
restart $2
;;
list)
list
;;
bootlist)
bootlist
;;
status)
status $2
;;
*)
help
;;
esac
-64
View File
@@ -1,64 +0,0 @@
#!/bin/sh
. /etc/init.d/funcs/colors.sh
[ -z "$1" ] && printf "$URED** ERROR: should be called from udhcpc\n$RESET" && exit 1
RESOLF_CONF="/etc/resolv.conf"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
# return 0 if root is mounted on a network filesystem
root_if_nfs() {
grep -qe '^/dev/root.*\(nfs\|smbfs\|ncp\|coda\) .*' /proc/mounts
}
have_bin_ip=0
if [ -x /bin/ip ]; then
have_bin_ip=1
fi
case "$1" in
deconfig)
if ! rootfs_is_nfs; then
if [ $have_bin_ip -eq 1 ]; then
ip a flush dev $interface
ip l set dev $interface up
else
/sbin/ifconfig $interface 0.0.0.0
fi
fi
;;
renew|bound)
if [ $have_bin_ip -eq 1 ]; then
ip a add dev $interface local $ip/$mask $BROADCAST
else
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
fi
if [ -n "$router" ]; then
if ! root_if_nfs; then
if [ $have_bin_ip -eq 1 ]; then
while ip r del default 2>/dev/null; do
:
done
else
while route del default gw 0.0.0.0 dev $interface 2>/dev/null; do
:
done
fi
fi
metric=0
for i in $router; do
if [ $have_bin_ip -eq 1 ]; then
ip r add default via $i metric $((metric++))
else
route add default gw $i dev $interface metric $((metric++)) 2>/dev/null
fi
done
fi
echo -n > $RESOLF_CONF
[ -n "$domain" ] && echo search $domain >> $RESOLF_CONF
for i in $dns; do
echo adding dns $i
echo nameserver $i >> $RESOLF_CONF
done
;;
esac
exit 0
-17
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
File mode changed.
Regular → Executable
+20 -16
View File
@@ -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
View File
@@ -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
View File
File mode changed.
-33
View File
@@ -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"
}
#-----------------------------------------------------------
-31
View File
@@ -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
#------------------------------------------------------------------
-19
View File
@@ -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
View File
@@ -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
View File
@@ -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
#--------------------------------------------------
#--------------------------------------------------
+42
View File
@@ -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
}
#--------------
+26
View File
@@ -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"
}
#-------------
+31
View File
@@ -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"
}
#-----------------------------------------------------------
+4 -3
View File
@@ -1,4 +1,5 @@
https://www.kernel.org/pub/linux/kernel/v6.x/linux-6.7.4.tar.xz
https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.1.91.tar.xz
https://busybox.net/downloads/busybox-1.36.1.tar.bz2
https://ftp.gnu.org/gnu/glibc/glibc-2.39.tar.xz
https://uclibc.org/downloads/uClibc-0.9.33.tar.bz2
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/u-boot/u-boot/archive/refs/tags/v2024.10/u-boot-v2024.10.tar.gz
Binary file not shown.
+263
View File
@@ -0,0 +1,263 @@
#
# Automatically generated file; DO NOT EDIT.
# uClibc-ng 1.0.50 C Library Configuration
#
# TARGET_aarch64 is not set
# TARGET_alpha is not set
# TARGET_arc is not set
TARGET_arm=y
# TARGET_avr32 is not set
# TARGET_bfin is not set
# TARGET_c6x is not set
# TARGET_cris is not set
# TARGET_csky is not set
# TARGET_frv is not set
# TARGET_h8300 is not set
# TARGET_hppa is not set
# TARGET_i386 is not set
# TARGET_ia64 is not set
# TARGET_kvx is not set
# TARGET_lm32 is not set
# TARGET_m68k is not set
# TARGET_metag is not set
# TARGET_microblaze is not set
# TARGET_mips is not set
# TARGET_nds32 is not set
# TARGET_nios2 is not set
# TARGET_or1k is not set
# TARGET_powerpc is not set
# TARGET_riscv64 is not set
# TARGET_riscv32 is not set
# TARGET_sh is not set
# TARGET_sparc is not set
# TARGET_sparc64 is not set
# TARGET_tile is not set
# TARGET_x86_64 is not set
# TARGET_xtensa is not set
TARGET_LDSO_NAME="ld-uClibc"
TARGET_ARCH_BITS=32
#
# Target Architecture Features and Options
#
TARGET_ARCH="arm"
FORCE_OPTIONS_FOR_ARCH=y
CONFIG_ARM_EABI=y
TARGET_SUBARCH=""
#
# Using ELF file format
#
ARCH_HAS_DEPRECATED_SYSCALLS=y
ARCH_ANY_ENDIAN=y
ARCH_LITTLE_ENDIAN=y
# ARCH_WANTS_BIG_ENDIAN is not set
ARCH_WANTS_LITTLE_ENDIAN=y
ARCH_HAS_MMU=y
ARCH_USE_MMU=y
UCLIBC_HAS_FLOATS=y
UCLIBC_HAS_FPU=y
DO_C99_MATH=y
DO_XSI_MATH=y
UCLIBC_HAS_LONG_DOUBLE_MATH=y
KERNEL_HEADERS="/home/tola/Documents/linux/orangepipc/buildroot-2024.08.2/output/build/linux-headers-6.1.91/usr/include"
HAVE_DOT_CONFIG=y
#
# General Library Settings
#
DOPIC=y
# STATIC_PIE is not set
ARCH_HAS_UCONTEXT=y
HAVE_LDSO=y
HAVE_SHARED=y
# FORCE_SHAREABLE_TEXT_SEGMENTS is not set
LDSO_LDD_SUPPORT=y
# LDSO_CACHE_SUPPORT is not set
LDSO_PRELOAD_ENV_SUPPORT=y
# LDSO_PRELOAD_FILE_SUPPORT is not set
# LDSO_STANDALONE_SUPPORT is not set
# LDSO_PRELINK_SUPPORT is not set
ARCH_VDSO_SUPPORT=y
# VDSO_SUPPORT is not set
# UCLIBC_STATIC_LDCONFIG is not set
LDSO_RUNPATH=y
LDSO_RUNPATH_OF_EXECUTABLE=y
LDSO_SAFE_RUNPATH=y
LDSO_SEARCH_INTERP_PATH=y
LDSO_LD_LIBRARY_PATH=y
UCLIBC_CTOR_DTOR=y
# LDSO_GNU_HASH_SUPPORT is not set
# HAS_NO_THREADS is not set
# UCLIBC_HAS_LINUXTHREADS is not set
UCLIBC_HAS_THREADS_NATIVE=y
UCLIBC_HAS_THREADS=y
UCLIBC_HAS_TLS=y
# PTHREADS_DEBUG_SUPPORT is not set
PTHREADS_STACK_DEFAULT_SIZE=2097152
UCLIBC_HAS_SYSLOG=y
UCLIBC_HAS_LFS=y
# MALLOC is not set
# MALLOC_SIMPLE is not set
MALLOC_STANDARD=y
UCLIBC_DYNAMIC_ATEXIT=y
UCLIBC_HAS_UTMPX=y
UCLIBC_HAS_UTMP=y
UCLIBC_SUSV2_LEGACY=y
UCLIBC_SUSV3_LEGACY=y
UCLIBC_HAS_CONTEXT_FUNCS=y
# UCLIBC_SUSV3_LEGACY_MACROS is not set
UCLIBC_SUSV4_LEGACY=y
# UCLIBC_STRICT_HEADERS is not set
# UCLIBC_HAS_STUBS is not set
UCLIBC_HAS_SHADOW=y
UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
UCLIBC_HAS___PROGNAME=y
UCLIBC_HAS_PTY=y
ASSUME_DEVPTS=y
UNIX98PTY_ONLY=y
UCLIBC_HAS_GETPT=y
UCLIBC_HAS_LIBUTIL=y
UCLIBC_HAS_TM_EXTENSIONS=y
UCLIBC_HAS_TZ_CACHING=y
UCLIBC_HAS_TZ_FILE=y
UCLIBC_HAS_TZ_FILE_READ_MANY=y
UCLIBC_TZ_FILE_PATH="/etc/TZ"
UCLIBC_FALLBACK_TO_ETC_LOCALTIME=y
UCLIBC_USE_TIME64=y
#
# Advanced Library Settings
#
UCLIBC_PWD_BUFFER_SIZE=256
UCLIBC_GRP_BUFFER_SIZE=256
#
# Support various families of functions
#
UCLIBC_LINUX_SPECIFIC=y
UCLIBC_HAS_GNU_ERROR=y
UCLIBC_BSD_SPECIFIC=y
UCLIBC_HAS_BSD_ERR=y
UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
# UCLIBC_HAS_BSD_B64_NTOP_B64_PTON is not set
# UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL is not set
# UCLIBC_NTP_LEGACY is not set
# UCLIBC_SV4_DEPRECATED is not set
UCLIBC_HAS_REALTIME=y
UCLIBC_HAS_ADVANCED_REALTIME=y
UCLIBC_HAS_EPOLL=y
UCLIBC_HAS_XATTR=y
UCLIBC_HAS_PROFILING=y
UCLIBC_HAS_CRYPT_IMPL=y
UCLIBC_HAS_SHA256_CRYPT_IMPL=y
UCLIBC_HAS_SHA512_CRYPT_IMPL=y
UCLIBC_HAS_CRYPT=y
UCLIBC_HAS_NETWORK_SUPPORT=y
UCLIBC_HAS_SOCKET=y
UCLIBC_HAS_IPV4=y
UCLIBC_HAS_IPV6=y
UCLIBC_USE_NETLINK=y
UCLIBC_SUPPORT_AI_ADDRCONFIG=y
# UCLIBC_HAS_BSD_RES_CLOSE is not set
UCLIBC_HAS_COMPAT_RES_STATE=y
# UCLIBC_HAS_EXTRA_COMPAT_RES_STATE is not set
UCLIBC_HAS_RESOLVER_SUPPORT=y
# UCLIBC_DNSRAND_MODE_URANDOM is not set
# UCLIBC_DNSRAND_MODE_CLOCK is not set
UCLIBC_DNSRAND_MODE_PRNGPLUS=y
# UCLIBC_DNSRAND_MODE_SIMPLECOUNTER is not set
#
# String and Stdio Support
#
UCLIBC_HAS_STRING_GENERIC_OPT=y
UCLIBC_HAS_STRING_ARCH_OPT=y
UCLIBC_HAS_STDIO_FUTEXES=y
UCLIBC_HAS_CTYPE_TABLES=y
UCLIBC_HAS_CTYPE_SIGNED=y
# UCLIBC_HAS_CTYPE_UNSAFE is not set
UCLIBC_HAS_CTYPE_CHECKED=y
# UCLIBC_HAS_CTYPE_ENFORCED is not set
UCLIBC_HAS_WCHAR=y
UCLIBC_HAS_LIBICONV=y
UCLIBC_HAS_LIBINTL=y
UCLIBC_HAS_LOCALE=y
UCLIBC_BUILD_MINIMAL_LOCALE=y
# UCLIBC_BUILD_ALL_LOCALE is not set
UCLIBC_BUILD_MINIMAL_LOCALES="en_US"
UCLIBC_HAS_XLOCALE=y
UCLIBC_HAS_HEXADECIMAL_FLOATS=y
# UCLIBC_HAS_GLIBC_DIGIT_GROUPING is not set
UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set
# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
UCLIBC_HAS_STDIO_BUFSIZ_4096=y
# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set
UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
UCLIBC_HAS_STDIO_GETC_MACRO=y
UCLIBC_HAS_STDIO_PUTC_MACRO=y
UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
# UCLIBC_HAS_FOPEN_CLOSEEXEC_MODE is not set
UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
UCLIBC_HAS_PRINTF_M_SPEC=y
UCLIBC_HAS_ERRNO_MESSAGES=y
# UCLIBC_HAS_SYS_ERRLIST is not set
UCLIBC_HAS_SIGNUM_MESSAGES=y
# UCLIBC_HAS_SYS_SIGLIST is not set
UCLIBC_HAS_GNU_GETOPT=y
UCLIBC_HAS_GETOPT_LONG=y
UCLIBC_HAS_GNU_GETSUBOPT=y
# UCLIBC_HAS_ARGP is not set
#
# Big and Tall
#
UCLIBC_HAS_REGEX=y
UCLIBC_HAS_FNMATCH=y
UCLIBC_HAS_WORDEXP=y
UCLIBC_HAS_NFTW=y
UCLIBC_HAS_FTW=y
# UCLIBC_HAS_FTS is not set
UCLIBC_HAS_GLOB=y
UCLIBC_HAS_GNU_GLOB=y
#
# Library Installation Options
#
RUNTIME_PREFIX="/"
DEVEL_PREFIX="/usr"
MULTILIB_DIR="lib"
HARDWIRED_ABSPATH=y
#
# Security options
#
# UCLIBC_BUILD_PIE is not set
# UCLIBC_HAS_SSP is not set
UCLIBC_BUILD_RELRO=y
UCLIBC_BUILD_NOW=y
UCLIBC_BUILD_NOEXECSTACK=y
#
# Development/debugging options
#
CROSS_COMPILER_PREFIX="/home/tola/Documents/linux/orangepipc/buildroot-2024.08.2/output/host/bin/arm-buildroot-linux-uclibcgnueabihf-"
UCLIBC_EXTRA_CFLAGS=""
# DODEBUG is not set
# DOSTRIP is not set
# DOASSERTS is not set
# SUPPORT_LD_DEBUG is not set
# SUPPORT_LD_DEBUG_EARLY is not set
# UCLIBC_MALLOC_DEBUGGING is not set
# UCLIBC_HAS_BACKTRACE is not set
WARNINGS="-Wall"
# EXTRA_WARNINGS is not set