Jump to content

Recommended Posts

Posted

Hi, my previous Armbian (21.08.1 focal 5.10.60 desktop) was successfully installed to emmc. (install_aml_gxl_emmc.sh)


After I tried the latest firmware (Armbian_23.02.0-trunk_Aml-s9xx-box_kinetic_edge_6.0.12_xfce_desktop), I felt a big change in speed.
The problem is, I've tried several times to move it to emmc and it always fails to boot. (install-aml.sh)

Any suggestions I need to look into before running the script again?

Thank you 

Posted
4 hours ago, bryant said:

install_aml_gxl_emmc.sh

What build (exact file name) and download location did you have installed?  This file you mention isn't anything I am familiar with, thus I would like to know where it came from.

Posted

Armbian_21.08.1_Amlogic-GXL_focal_current_5.10.60_desktop.img

 

I followed a tutorial from youtube. If you need the .sh file, I'll attach it.

 

 

#!/bin/sh

echo "Start script create MBR and filesystem"

hasdrives=$(lsblk | grep -oE '(mmcblk[0-9])' | sort | uniq)
if [ "$hasdrives" = "" ]
then
	echo "UNABLE TO FIND ANY EMMC OR SD DRIVES ON THIS SYSTEM!!! "
	exit 1
fi
avail=$(lsblk | grep -oE '(mmcblk[0-9]|sda[0-9])' | sort | uniq)
if [ "$avail" = "" ]
then
	echo "UNABLE TO FIND ANY DRIVES ON THIS SYSTEM!!!"
	exit 1
fi
runfrom=$(lsblk | grep /$ | grep -oE '(mmcblk[0-9]|sda[0-9])')
if [ "$runfrom" = "" ]
then
	echo " UNABLE TO FIND ROOT OF THE RUNNING SYSTEM!!! "
	exit 1
fi
emmc=$(echo $avail | sed "s/$runfrom//" | sed "s/sd[a-z][0-9]//g" | sed "s/ //g")
if [ "$emmc" = "" ]
then
	echo " UNABLE TO FIND YOUR EMMC DRIVE OR YOU ALREADY RUN FROM EMMC!!!"
	exit 1
fi
if [ "$runfrom" = "$avail" ]
then
	echo " YOU ARE RUNNING ALREADY FROM EMMC!!! "
	exit 1
fi
if [ $runfrom = $emmc ]
then
	echo " YOU ARE RUNNING ALREADY FROM EMMC!!! "
	exit 1
fi
if [ "$(echo $emmc | grep mmcblk)" = "" ]
then
	echo " YOU DO NOT APPEAR TO HAVE AN EMMC DRIVE!!! "
	exit 1
fi

DEV_EMMC="/dev/$emmc"

echo $DEV_EMMC

echo "Start backup u-boot default"

dd if="${DEV_EMMC}" of=/root/u-boot-default-aml.img bs=1M count=4

echo "Start create MBR and partittion"

parted -s "${DEV_EMMC}" mklabel msdos
parted -s "${DEV_EMMC}" mkpart primary fat32 700M 956M
parted -s "${DEV_EMMC}" mkpart primary ext4 957M 100%

echo "Start restore u-boot"

dd if=/root/u-boot-default-aml.img of="${DEV_EMMC}" conv=fsync bs=1 count=442
dd if=/root/u-boot-default-aml.img of="${DEV_EMMC}" conv=fsync bs=512 skip=1 seek=1

sync

echo "Done"

echo "Start copy system for eMMC."

mkdir -p /ddbr
chmod 777 /ddbr

PART_BOOT="${DEV_EMMC}p1"
PART_ROOT="${DEV_EMMC}p2"
DIR_INSTALL="/ddbr/install"

if [ -d $DIR_INSTALL ] ; then
    rm -rf $DIR_INSTALL
fi
mkdir -p $DIR_INSTALL

if grep -q $PART_BOOT /proc/mounts ; then
    echo "Unmounting BOOT partiton."
    umount -f $PART_BOOT
fi
echo -n "Formatting BOOT partition..."
mkfs.vfat -n "BOOT_EMMC" $PART_BOOT
echo "done."

mount -o rw $PART_BOOT $DIR_INSTALL

echo -n "Cppying BOOT..."
cp -r /boot/* $DIR_INSTALL && sync
echo "done."

echo -n "Edit init config..."
sed -e "s/ROOTFS/ROOT_EMMC/g" \
 -i "$DIR_INSTALL/extlinux/extlinux.conf"
echo "done."

rm $DIR_INSTALL/s9*
rm $DIR_INSTALL/aml*

if [ -f /boot/u-boot.ext ] ; then
    mv -f $DIR_INSTALL/u-boot.ext $DIR_INSTALL/u-boot.emmc

    sed -e "s/u-boot.ext/u-boot.emmc/g" \
     -i "$DIR_INSTALL/boot.ini"
    echo "done."

    sync
fi

umount $DIR_INSTALL

if grep -q $PART_ROOT /proc/mounts ; then
    echo "Unmounting ROOT partiton."
    umount -f $PART_ROOT
fi

echo "Formatting ROOT partition..."
mke2fs -F -q -t ext4 -L ROOT_EMMC -m 0 $PART_ROOT
e2fsck -n $PART_ROOT
echo "done."

echo "Copying ROOTFS."

mount -o rw $PART_ROOT $DIR_INSTALL

cd /
echo "Copy BIN"
tar -cf - bin | (cd $DIR_INSTALL; tar -xpf -)
#echo "Copy BOOT"
#mkdir -p $DIR_INSTALL/boot
#tar -cf - boot | (cd $DIR_INSTALL; tar -xpf -)
echo "Create DEV"
mkdir -p $DIR_INSTALL/dev
#tar -cf - dev | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy ETC"
tar -cf - etc | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy HOME"
tar -cf - home | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy LIB"
tar -cf - lib | (cd $DIR_INSTALL; tar -xpf -)
echo "Create MEDIA"
mkdir -p $DIR_INSTALL/media
#tar -cf - media | (cd $DIR_INSTALL; tar -xpf -)
echo "Create MNT"
mkdir -p $DIR_INSTALL/mnt
#tar -cf - mnt | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy OPT"
tar -cf - opt | (cd $DIR_INSTALL; tar -xpf -)
echo "Create PROC"
mkdir -p $DIR_INSTALL/proc
echo "Copy ROOT"
tar -cf - root | (cd $DIR_INSTALL; tar -xpf -)
echo "Create RUN"
mkdir -p $DIR_INSTALL/run
echo "Copy SBIN"
tar -cf - sbin | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy SELINUX"
tar -cf - selinux | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy SRV"
tar -cf - srv | (cd $DIR_INSTALL; tar -xpf -)
echo "Create SYS"
mkdir -p $DIR_INSTALL/sys
echo "Create TMP"
mkdir -p $DIR_INSTALL/tmp
echo "Copy USR"
tar -cf - usr | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy VAR"
tar -cf - var | (cd $DIR_INSTALL; tar -xpf -)
sync

echo "Copy fstab"

rm $DIR_INSTALL/etc/fstab
cp -a /root/fstab $DIR_INSTALL/etc/fstab

rm $DIR_INSTALL/root/install*.sh
rm $DIR_INSTALL/root/fstab


cd /
sync

umount $DIR_INSTALL

echo "*******************************************"
echo "Complete copy OS to eMMC "
echo "*******************************************"

 

Thank you 😊

Posted
2 hours ago, SteeMan said:

download location

 

Where did you download this build from?  It doesn't look like a build that originated from armbian.

54 minutes ago, bryant said:

I followed a tutorial from youtube

What tutorial?

Posted

Previously, I knew Armbian from YouTube and downloaded it from the link given in the description.
I hope the version I'm using now (Armbian_23.02.0-trunk_Aml-s9xx-box_kinetic_edge_6.0.12_xfce_desktop) can be installed on eMMC, because it's more stable and faster

Posted

Since I don't know what previous version you had installed in emmc (i.e. where it came from, who built it, etc).  That means from my perspective you are trying to run the emmc install script on top of an unknown environment.  So i'm left to guessing what your issues might be.  The cleanest solution would be to flash android back to the emmc so you have a known starting point and then reinstalling the current armbian build.  This assumes you have/can find a copy of android firmware for your box, or that you made a backup before you installed to emmc.

If that doesn't work, I suspect the problem is that you are trying to 'reinstall' into emmc.  The script is only tested for installing into a fresh environment that has android on it, not an environment that already has linux.  So you may need to look at the script and only do the portions that are involved in the copying over of the files from the sd card, but omit that part that is creating the partitions and other work on the disk.  To verify this is what is happening, I would need you to capture the entire output of your running of the install-aml.sh script for me to review.

Posted
On 12/21/2022 at 8:16 PM, SteeMan said:

To verify this is what is happening, I would need you to capture the entire output of your running of the install-aml.sh script for me to review

Sory for late posting . I'm a bit busy at work.

You mean the log? 

Posted

Hello, i have similar problem, seem to be installed but dont boot, the log is here:

root@S905x:~# ./install-aml.sh
Start script create MBR and filesystem
/dev/mmcblk1
Start backup u-boot default
4+0 records in
4+0 records out
4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.461703 s, 9.1 MB/s
Start create MBR and partittion
Start restore u-boot
442+0 records in
442+0 records out
442 bytes copied, 0.00630148 s, 70.1 kB/s
8191+0 records in
8191+0 records out
4193792 bytes (4.2 MB, 4.0 MiB) copied, 1.05499 s, 4.0 MB/s
Done
Start copy system for eMMC.
Formatting BOOT partition...mkfs.fat 4.2 (2021-01-31)
done.
Copying BOOT...done.
Edit init config...done.
sed: can't read /ddbr/install/boot.ini: No such file or directory
done.
Formatting ROOT partition...
/dev/mmcblk1p2 contains a ext4 file system labelled 'ROOT_EMMC'
        last mounted on /ddbr/install on Sat Mar  4 12:38:17 2023
e2fsck 1.46.5 (30-Dec-2021)
ROOT_EMMC: clean, 11/385024 files, 46572/1539328 blocks
done.
Copying ROOTFS.
Copy BIN
Create DEV
Copy ETC
Copy HOME
Copy LIB
Copy LIB64
tar: lib64: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
Create MEDIA
Create MNT
Copy OPT
Create PROC
Copy ROOT
Create RUN
Copy SBIN
Copy SELINUX
Copy SRV
Create SYS
Create TMP
Copy USR
Copy VAR
tar: var/lib/samba/private/msg.sock/4572: socket ignored
tar: var/lib/samba/private/msg.sock/2230: socket ignored
tar: var/lib/samba/private/msg.sock/2203: socket ignored
tar: var/lib/samba/private/msg.sock/4560: socket ignored
tar: var/lib/samba/private/msg.sock/2187: socket ignored
tar: var/lib/samba/private/msg.sock/2082: socket ignored
tar: var/lib/samba/private/msg.sock/2073: socket ignored
tar: var/lib/samba/private/msg.sock/2186: socket ignored
tar: var/lib/samba/private/msg.sock/2070: socket ignored
tar: var/lib/samba/private/msg.sock/2078: socket ignored
tar: var/lib/samba/private/msg.sock/4573: socket ignored
tar: var/lib/samba/private/msg.sock/2053: socket ignored
tar: var/lib/samba/private/msg.sock/2071: socket ignored
tar: var/lib/samba/private/msg.sock/2079: socket ignored
tar: var/lib/samba/private/msg.sock/1940: socket ignored
tar: var/lib/samba/private/msg.sock/2072: socket ignored
tar: var/lib/samba/private/msg.sock/2063: socket ignored
tar: var/lib/samba/private/msg.sock/2081: socket ignored
tar: var/lib/samba/private/msg.sock/2068: socket ignored
tar: var/lib/samba/private/msg.sock/1991: socket ignored
Copy fstab
rm: cannot remove '/ddbr/install/usr/bin/ddbr': No such file or directory
*******************************************
Complete copy OS to eMMC
*******************************************

Posted

@bacco70  Please provide some basic information about your setup.  What box do you have?  What build do you have installed (file name and where downloaded from)?

 

13 hours ago, bacco70 said:

Formatting ROOT partition...
/dev/mmcblk1p2 contains a ext4 file system labelled 'ROOT_EMMC'
        last mounted on /ddbr/install on Sat Mar  4 12:38:17 2023

This would indicate that you are trying to install on to a none clean emmc.  The script assumes you are installing on top of the native android firmware.  This message indicates you have other stuff previously installed.  Please explain what you have done before this attempt.

Posted (edited)
8 hours ago, SteeMan said:

This would indicate that you are trying to install on to a none clean emmc.  The script assumes you are installing on top of the native android firmware.  This message indicates you have other stuff previously installed.  Please explain what you have done before this attempt.

Yes, this is 2nd or 3rt try, but the 1st was no good also. i have try with various images, 23.02.2 bullseye and  jammy, but the result was the same keep from https://imola.armbian.com/dl/aml-s9xx-box/archive/

now reflash android rom and do claen install, the box dont boot, uboot start but dont find the kernel?

boot_s905.jpg

Edited by bacco70
Posted (edited)

excelvan t95n s905x 1Gb ram 8Gb emmc

during install to emmc, miss 1 file, boot.ini. you know if is possible to put this file in boot folder to configure u-boot?

Edited by bacco70
Posted

First of all, thank you so much for your guide. I was able to turn a $20 Android TV box into a PiHole.

 

However it's been giving me errors which I suspect are due to the SD card, and so I would like to install to emmc.

 

Running sh install-aml.sh says UNABLE TO FIND ROOT OF THE RUNNING SYSTEM!!!

 

I am currently booting it with meson-gxl-s905l2-ipbs9505.dtb. Is this impossible to write to emmc?

Posted

@ext23  What box do you have? (The thread you have posted this question in is for a B680H).  What build are you using?  I've never seen that dtb file, where did you get it from?

Posted

I bought a generic box on AliExpress that said it was the S905X but I am now led to believe that it's an S905L2. I got the dtb from here https://github.com/ophub/amlogic-s9xxx-armbian and am using Armbian_23.8.1_Aml-s9xx-box_bookworm_current_6.1.50_minimal. Sorry if this is too far off topic, I just wanted to confirm whether it's possible for me to install to emmc.

Posted

The dtb you downloaded is not from armbian.  That site is a fork of armbian and they use the armbian name without permission.  They do not participate in armbian development, nor do they contribute to these forums.

The armbian build you did download doesn't support the s905l2 specifically (there are no dtbs in the mainline linux kernel for that specific cpu).  I don't have any boxes with this chip so it is unlikely that I or anyone here has much guidance for you.

Posted
#!/bin/sh

echo "Start script create MBR and filesystem"

hasdrives=$(lsblk | grep -oE '(mmcblk[0-9])' | sort | uniq)
if [ "$hasdrives" = "" ]
then
    echo "UNABLE TO FIND ANY EMMC OR SD DRIVES ON THIS SYSTEM!!! "
    exit 1
fi
avail=$(lsblk | grep -oE '(mmcblk[0-9]|sda[0-9])' | sort | uniq)
if [ "$avail" = "" ]
then
    echo "UNABLE TO FIND ANY DRIVES ON THIS SYSTEM!!!"
    exit 1
fi

# Unmount /var/log.hdd so logic below can find the root partition
umount /var/log.hdd

# Use mount instead of lsblk to find the root device
runfrom=$(mount | grep ' / ' | awk '{print $1}')

# Ensure we found the root device
if [ "$runfrom" = "" ]
then
    echo " UNABLE TO FIND ROOT OF THE RUNNING SYSTEM!!! "
    exit 1
fi

# Extract only the base device name (e.g., mmcblk0 instead of mmcblk0p2)
runfrom_base=$(echo "$runfrom" | sed 's/[0-9]//g')

# List available eMMC/SD devices and remove the root device from the list
avail=$(lsblk | grep -oE '(mmcblk[0-9]|sda[0-9])' | sort | uniq | grep -v "$runfrom_base")

# Ensure we found some available drives after excluding the root device
if [ "$avail" = "" ]
then
    echo "UNABLE TO FIND ANY DRIVES ON THIS SYSTEM!!!"
    exit 1
fi

# Now identify the target eMMC (mmcblk1)
emmc=$(echo "$avail" | grep 'mmcblk1')

# Ensure mmcblk1 is found and that we're not running from it
if [ "$emmc" = "" ]
then
    echo " UNABLE TO FIND YOUR EMMC DRIVE OR YOU ARE ALREADY RUNNING FROM EMMC!!!"
    exit 1
fi

DEV_EMMC="/dev/$emmc"
echo "Target eMMC device is: $DEV_EMMC"

# Rest of your script logic continues from here...

try changing the script to this it worked for me (the suggestion is made by chatgpt, no guarantee it will work and contains details that probably only applies to my device)

Posted

Why is so much of the eMMC unused at the start? In the old script, the first partition starts at 700M (M = million bytes), and in Armbian 23.11.1, that has been increased to 1000M. These are the parted commands:

parted -s "${DEV_EMMC}" mklabel msdos
parted -s "${DEV_EMMC}" mkpart primary fat32 1000M 1512M
parted -s "${DEV_EMMC}" mkpart primary ext4 1513M 100%

 

BTW The Armbian 23.11.1 version also contains the umount /var/log.hdd fix from the post above.

Posted
4 hours ago, dreamlayers said:

Why is so much of the eMMC unused at the start? In the old script, the first partition starts at 700M (M = million bytes), and in Armbian 23.11.1, that has been increased to 1000M.

It has been 1000M since the aml-s9xx-box community builds were introduced two years ago.  (https://github.com/armbian/build/commit/8dcab2be64c253ed6554fbcd32d901ed6c882ead#diff-4ab8640d43fd31e3a33d5d74c4723e7004b0aeb107b4d573597c2be4221a654f)

 

The value was inherited from the previous work done by balbes150. 

 

The reason that this space is preserved on the emmc is because various parts of the native android u-boot use various data in this space, and it seems to vary on different tv boxes how much space is being used. There are android partitions that store things like the android boot screen, etd.  Over time by trial and error this 1000M safety buffer was chosen as seeming to work on all (or at least most) tv boxes.

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines