Progress...

This commit is contained in:
Cameron Thompson
2024-12-20 16:31:13 -05:00
parent d52f2c1b0f
commit ec07fb07ac
156 changed files with 474 additions and 576 deletions

View File

@@ -1,157 +0,0 @@
#!/bin/sh
# Modified by iamromulan to set up a proper entware environment for Quectel RM5xx series m.2 modems
TYPE='generic'
#|---------|-----------------|
#| TARGET | Quectel Modem |
#| ARCH | armv7sf-k3.2 |
#| LOADER | ld-linux.so.3 |
#| GLIBC | 2.27 |
#|---------|-----------------|
unset LD_LIBRARY_PATH
unset LD_PRELOAD
ARCH=armv7sf-k3.2
LOADER=ld-linux.so.3
GLIBC=2.27
PRE_OPKG_PATH=$(which opkg)
# Remount filesystem as read-write
mount -o remount,rw /
create_opt_mount() {
# Bind /usrdata/opt to /opt
echo -e '\033[32mInfo: Setting up /opt mount to /usrdata/opt...\033[0m'
cat <<EOF > /lib/systemd/system/opt.mount
[Unit]
Description=Bind /usrdata/opt to /opt
[Mount]
What=/usrdata/opt
Where=/opt
Type=none
Options=bind
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl start opt.mount
# Additional systemd service to ensure opt.mount starts at boot
echo -e '\033[32mInfo: Creating service to start opt.mount at boot...\033[0m'
cat <<EOF > /lib/systemd/system/start-opt-mount.service
[Unit]
Description=Ensure opt.mount is started at boot
After=network.target
[Service]
Type=oneshot
ExecStart=/bin/systemctl start opt.mount
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
ln -s /lib/systemd/system/start-opt-mount.service /lib/systemd/system/multi-user.target.wants/start-opt-mount.service
}
if [ -n "$PRE_OPKG_PATH" ]; then
# Automatically rename the existing opkg binary
mv "$PRE_OPKG_PATH" "${PRE_OPKG_PATH}_old"
echo -e "\033[32mFactory/Already existing opkg has been renamed to opkg_old.\033[0m"
else
echo "Info: no existing opkg binary detected, proceeding with installation"
fi
echo -e '\033[32mInfo: Creating /opt mount pointed to /usrdata/opt ...\033[0m'
create_opt_mount
echo -e '\033[32mInfo: Proceeding with main installation ...\033[0m'
echo -e '\033[32mInfo: Opkg package manager deployment...\033[0m'
URL=http://bin.entware.net/${ARCH}/installer
wget $URL/opkg -O /opt/bin/opkg
chmod 755 /opt/bin/opkg
wget $URL/opkg.conf -O /opt/etc/opkg.conf
echo -e '\033[32mInfo: Basic packages installation...\033[0m'
/opt/bin/opkg update
/opt/bin/opkg install entware-opt
# Fix for multiuser environment
chmod 777 /opt/tmp
for file in passwd group shells shadow gshadow; do
if [ $TYPE = 'generic' ]; then
if [ -f /etc/$file ]; then
ln -sf /etc/$file /opt/etc/$file
else
[ -f /opt/etc/$file.1 ] && cp /opt/etc/$file.1 /opt/etc/$file
fi
else
if [ -f /opt/etc/$file.1 ]; then
cp /opt/etc/$file.1 /opt/etc/$file
fi
fi
done
[ -f /etc/localtime ] && ln -sf /etc/localtime /opt/etc/localtime
# Create and enable rc.unslung service
echo -e '\033[32mInfo: Creating rc.unslung (Entware init.d service)...\033[0m'
cat <<EOF > /lib/systemd/system/rc.unslung.service
[Unit]
Description=Start Entware services
[Service]
Type=oneshot
# Add a delay to give /opt time to mount
ExecStartPre=/bin/sleep 5
ExecStart=/opt/etc/init.d/rc.unslung start
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
ln -s /lib/systemd/system/rc.unslung.service /lib/systemd/system/multi-user.target.wants/rc.unslung.service
systemctl start rc.unslung.service
echo -e '\033[32mInfo: Congratulations!\033[0m'
echo -e '\033[32mInfo: If there are no errors above then Entware was successfully initialized.\033[0m'
echo -e '\033[32mInfo: Add /opt/bin & /opt/sbin to $PATH variable\033[0m'
ln -sf /opt/bin/opkg /bin
echo -e '\033[32mInfo: Patching Quectel Login Binary\033[0m'
opkg update && opkg install shadow-login shadow-passwd shadow-useradd
if [ "$?" -ne 0 ]; then
echo -e "\e[1;31mPackage installation failed. Please check your internet connection and try again.\e[0m"
exit 1
fi
# Replace the login and passwd binaries and set home for root to a writable directory
rm /opt/etc/shadow
rm /opt/etc/passwd
cp /etc/shadow /opt/etc/
cp /etc/passwd /opt/etc
mkdir /usrdata/root
mkdir /usrdata/root/bin
touch /usrdata/root/.profile
echo "# Set PATH for all shells" > /usrdata/root/.profile
echo "export PATH=/bin:/usr/sbin:/usr/bin:/sbin:/opt/sbin:/opt/bin:/usrdata/root/bin" >> /usrdata/root/.profile
chmod +x /usrdata/root/.profile
sed -i '1s|/home/root:/bin/sh|/usrdata/root:/bin/bash|' /opt/etc/passwd
rm /bin/login /usr/bin/passwd
ln -sf /opt/bin/login /bin
ln -sf /opt/bin/passwd /usr/bin/
ln -sf /opt/bin/useradd /usr/bin/
echo -e "\e[1;31mPlease set the root password.\e[0m"
/usr/bin/passwd
# Install basic and useful utilites
opkg install mc htop dfc lsof
ln -sf /opt/bin/mc /bin
ln -sf /opt/bin/htop /bin
ln -sf /opt/bin/dfc /bin
ln -sf /opt/bin/lsof /bin
# Remount filesystem as read-only
mount -o remount,ro /

105
installopkg.sh Normal file
View File

@@ -0,0 +1,105 @@
#!/bin/sh
#|---------|-------------------------|
#| TARGET | SDXLEMUR |
#| ARCH | arm_cortex-a7_neon-vfpv4|
#|---------|-------------------------|
# Based on entware, heavily modified by iamromulan
# This script sets up a custom opkg installation system for the SDXLEMUR platform
# The primary feed for this will be my feed and will be a combo of modified IPK files from multiple sources
# opkg is from entware and expects /opt to exist
# /opt will be setup as an overlay of lower / and upper /usrdata/rootfs-upper
# Most likely several mount binds will be setup at / to point back to /opt the overlay
# The real /lib/systemd will need to be able to be written to so we may bind that within /opt
# In active development; will decide if the entware feed gets re added later
ARCH=arm_cortex-a7_neon-vfpv4
#ARCH=armv7sf-k3.2
PRE_OPKG_PATH=$(which opkg)
URL=https://raw.githubusercontent.com/iamromulan/quectel-rgmii-toolkit/development-SDXLEMUR/opkg-feed/installer
# Remount filesystem as read-write
mount -o remount,rw /
# Will need to edit this. Will be an overlay instead of bind mount
# The package sdxlemur-mount-fix will make this run at boot
create_opt_overlay() {
[ ! -d "/opt" ] && mkdir /opt
[ ! -d "/usrdata/rootfs-upper" ] && mkdir /usrdata/rootfs-upper
[ ! -d "/usrdata/rootfs-work" ] && mkdir /usrdata/rootfs-work
mount -t overlay overlay_root -o lowerdir=/,upperdir=/usrdata/rootfs-upper,workdir=/usrdata/rootfs-work /opt
# add additional mount binds and dir
}
# Account for existing opkg binary on the RM502Q-AE
if [ -n "$PRE_OPKG_PATH" ]; then
# Automatically rename the existing opkg binary
mv "$PRE_OPKG_PATH" "${PRE_OPKG_PATH}_old"
echo -e "\033[32mFactory/Already existing opkg has been renamed to opkg_old.\033[0m"
else
echo "Info: no existing opkg binary detected, proceeding with installation"
fi
echo -e '\033[32mInfo: Creating /opt overlayfs with lower / and upper /usrdata/rootfs-upper \033[0m'
create_opt_overlay
echo -e '\033[32mInfo: Proceeding with main installation ...\033[0m'
echo -e '\033[32mInfo: Opkg package manager deployment...\033[0m'
wget $URL/opkg -O /opt/bin/opkg
chmod 755 /opt/bin/opkg
wget $URL/opkg.conf -O /opt/etc/opkg.conf
echo -e '\033[32mInfo: Basic packages installation...\033[0m'
/opt/bin/opkg update
#/opt/bin/opkg install entware-opt #Will revist this and its need
/opt/bin/opkg install sdxlemur-factory-packages
# Fix for multiuser environment
chmod 777 /opt/tmp
echo -e '\033[32mInfo: Add /opt/bin & /opt/sbin to $PATH variable\033[0m'
ln -sf /opt/bin/opkg /bin
echo -e '\033[32mInfo: Patching Quectel Login Binary\033[0m'
opkg update && opkg install shadow-login shadow-passwd shadow-useradd
if [ "$?" -ne 0 ]; then
echo -e "\e[1;31mPackage installation failed. Please check your internet connection and try again.\e[0m"
exit 1
fi
# Replace the login and passwd binaries and set home for root to a writable directory
rm /opt/etc/shadow
rm /opt/etc/passwd
cp /etc/shadow /opt/etc/
cp /etc/passwd /opt/etc
mkdir /usrdata/root
mkdir /usrdata/root/bin
touch /usrdata/root/.profile
echo "# Set PATH for all shells" > /usrdata/root/.profile
echo "export PATH=/bin:/usr/sbin:/usr/bin:/sbin:/opt/sbin:/opt/bin:/usrdata/root/bin" >> /usrdata/root/.profile
chmod +x /usrdata/root/.profile
sed -i '1s|/home/root:/bin/sh|/usrdata/root:/bin/bash|' /opt/etc/passwd
rm /bin/login /usr/bin/passwd
ln -sf /opt/bin/login /bin
ln -sf /opt/bin/passwd /usr/bin/
ln -sf /opt/bin/useradd /usr/bin/
echo -e "\e[1;31mPlease set the root password.\e[0m"
/usr/bin/passwd
# Install basic and useful utilites
opkg install mc htop dfc lsof
ln -sf /opt/bin/mc /bin
ln -sf /opt/bin/htop /bin
ln -sf /opt/bin/dfc /bin
ln -sf /opt/bin/lsof /bin
# Remount filesystem as read-only
mount -o remount,ro /
echo -e '\033[32mInfo: Congratulations!\033[0m'
echo -e '\033[32mInfo: If there are no errors above then Entware was successfully initialized.\033[0m'

View File

@@ -0,0 +1,8 @@
Package: sdxlemur-factory-packages
Version: 0.0.1
Source: github/iamromulan/tookit/sdxlemur-factory-packages
Section: base
URL: https://github.com/iamromulan
Maintainer: Cameron Thompson <github.com/iamromulan>
Architecture: sdxlemur
Description: An index of packages already included in the flashed firmware

View File

@@ -1,41 +0,0 @@
Notes for entware opkg
indexes at /opt/lib/opkg/
SDXLEMUR
Packages already installed at /lib from factory
libc
libm
libpthread
libutil
libresolv
librt
libnss_compat
libnss_dns
libnss_files
libdl
libsl
liban1
libgcc
libselinux
libsystemd
libsystemdq
libz
libBrokenLocale
libblkid
libmount
libuuid
libext2fs
libe2p
libcom_err
libtinfo
libcap
ld
ebtables
udev
systemd

View File

@@ -0,0 +1,46 @@
#!/bin/bash
# List of base file names to check
files=(
"libgmodule-2.0.so.0"
"libgmodule-2.0.so.0.8000.3"
"libglib-2.0.so.0"
"libgirepository-2.0.so.0.8000.3"
"libgthread-2.0.so.0.8000.3"
"libgthread-2.0.so.0"
"libgio-2.0.so"
"libgobject-2.0.so"
"libgirepository-2.0.so.0"
"libgobject-2.0.so.0.8000.3"
"libgmodule-2.0.so"
"libglib-2.0.so"
"libgio-2.0.so.0.8000.3"
"libgio-2.0.so.0"
"libgobject-2.0.so.0"
"libgthread-2.0.so"
"libglib-2.0.so.0.8000.3"
"libgirepository-2.0.so"
)
# Directories to check
check_dirs=("/lib" "/usr/lib")
echo "Checking for files in /lib and /usr/lib..."
# Loop through each file and check existence
for file in "${files[@]}"; do
found=false
for dir in "${check_dirs[@]}"; do
if [ -e "$dir/$file" ]; then
echo "FOUND: $dir/$file"
found=true
break
fi
done
if [ "$found" = false ]; then
echo "MISSING: $file"
fi
done

View File

@@ -0,0 +1,20 @@
root@sdxlemur:~# fndfiles
Checking for files in /lib and /usr/lib...
FOUND: /usr/lib/libgmodule-2.0.so.0
MISSING: libgmodule-2.0.so.0.8000.3
FOUND: /usr/lib/libglib-2.0.so.0
MISSING: libgirepository-2.0.so.0.8000.3
MISSING: libgthread-2.0.so.0.8000.3
FOUND: /usr/lib/libgthread-2.0.so.0
MISSING: libgio-2.0.so
MISSING: libgobject-2.0.so
MISSING: libgirepository-2.0.so.0
MISSING: libgobject-2.0.so.0.8000.3
MISSING: libgmodule-2.0.so
MISSING: libglib-2.0.so
MISSING: libgio-2.0.so.0.8000.3
FOUND: /usr/lib/libgio-2.0.so.0
FOUND: /usr/lib/libgobject-2.0.so.0
MISSING: libgthread-2.0.so
MISSING: libglib-2.0.so.0.8000.3
MISSING: libgirepository-2.0.so

View File

@@ -0,0 +1,6 @@
root@sdxlemur:~# fndfiles
Checking for files in /lib and /usr/lib...
FOUND: /usr/lib/libattr.so.1
MISSING: libattr.so.1.1.2502
MISSING: xattr.conf
MISSING: libattr.so

View File

@@ -0,0 +1,4 @@
root@sdxlemur:~# fndfiles
Checking for files in /lib and /usr/lib...
FOUND: /lib/libblkid.so.1.1.0
MISSING: ibblkid.so.1

View File

@@ -0,0 +1,29 @@
root@sdxlemur:~# fndfiles
Checking for files in /lib and /usr/lib...
FOUND: /lib/libnsl.so.1
FOUND: /etc/nsswitch.conf
MISSING: libanl-2.27.so
MISSING: libnss_files-2.27.so
FOUND: /lib/libm.so.6
MISSING: libc-2.27.so
MISSING: libnss_dns-2.27.so
MISSING: libpcprofile.so
FOUND: /lib/libnss_files.so.2
MISSING: libresolv-2.27.so
FOUND: /lib/libanl.so.1
MISSING: libdl-2.27.so
MISSING: ld-2.27.so
FOUND: /lib/libresolv.so.2
FOUND: /lib/libutil.so.1
FOUND: /lib/libdl.so.2
MISSING: libutil-2.27.so
MISSING: libnsl-2.27.so
FOUND: /lib/libc.so.6
FOUND: /lib/libnss_dns.so.2
MISSING: libmemusage.so
MISSING: libm-2.27.so
MISSING: libcidn.so.1
MISSING: libcrypt-2.27.so
MISSING: libcrypt.so.1
MISSING: libcidn-2.27.so
MISSING: ld-linux.so.3

View File

@@ -0,0 +1,4 @@
root@sdxlemur:~# fndfiles
Checking for files in /lib and /usr/lib...
FOUND: /usr/lib/libexpat.so.1
MISSING: libexpat.so.1.9.2

View File

@@ -0,0 +1,4 @@
root@sdxlemur:~# fndfiles
Checking for files in /lib and /usr/lib...
FOUND: /usr/lib/libgmp.so.10
MISSING: libgmp.so.10.5.0

View File

@@ -0,0 +1,4 @@
root@sdxlemur:~# fndfiles
Checking for files in /lib and /usr/lib...
FOUND: /lib/libpthread.so.0
MISSING: libpthread-2.27.so

View File

@@ -0,0 +1,4 @@
root@sdxlemur:~# fndfiles
Checking for files in /lib and /usr/lib...
MISSING: librt-2.27.so
FOUND: /lib/librt.so.1

View File

@@ -0,0 +1,4 @@
root@sdxlemur:~# fndfiles
Checking for files in /lib and /usr/lib...
MISSING: libstdc++.so.6.0.25
FOUND: /usr/lib/libstdc++.so.6

Some files were not shown because too many files have changed in this diff Show More