xfs image for "PVR over network share" on-the-fly

Ideas and dreaming about C series TV will go this forum.
Post Reply

User avatar
beatfreak
SamyGO Project Donor
Posts: 597
Joined: Tue Aug 23, 2011 9:03 am
Location: Hamburg
Contact:

xfs image for "PVR over network share" on-the-fly

Post by beatfreak »

thanks to Chicas for the tip.
i made a script out of it :)

Code: Select all

    #!/bin/sh
    . /dtv/SGO.env

    #### Change-your-stuff START

    L1='/core/layer1' # /core is the only tmpfs with more than 10MB available, you may change this to some permanent storage location on TV / USB-Drive
    MPL1='/dtv/ly1mnt'
    L2="$MPL1/layer2"
    MPL2="$MPL1/ly2mnt"

    # Change only if you know what you're doing

    USE4PVR="0"

    #### Change-your-stuff END
    GOON="1"

    WriteToLog ()
    {
       case $2 in
          1)
          NOW=`date +%Y%m%d-%H%M%S`
          echo "$3" "$NOW $1" >>$LOGFILE
          ;;
          2)
          echo "$3" "$1" >>$LOGFILE
          ;;
       esac
    }

    case $1 in
        start)
       touch $LOGFILE
       WriteToLog "start of beatfreaks 03_01_xfsimg.init script" 1
       WriteToLog "1st layer image: " 2 '-n'
       if [ ! -e $L1 ]; then
          mkfs.xfs -f -d file,name=$L1,size=18m >> $LOGFILE
          WriteToLog "created" 2
       else
          WriteToLog "found" 2
       fi
       WriteToLog "1st layer mountpoint : " 2 '-n'
       if [ ! -d $MPL1 ]; then
          mkdir $MPL1
          WriteToLog "created" 2
       else
          WriteToLog "found" 2
       fi
       if [ `/bin/busybox mount | grep -c "$MPL1"` -lt "1" ] ; then
          mount -o loop $L1 $MPL1/
          WriteToLog "mounting layer1 : " 2 '-n'
          if [ `/bin/busybox mount | grep -c "$MPL1"` -lt "1" ] ; then
             WriteToLog "failed, aborting..." 2
             GOON="0"
          else
             WriteToLog "successful" 2
          fi
       else
          WriteToLog "layer1 already mounted" 2
       fi
       if [ $GOON = "1" ]; then
          WriteToLog "2nd layer image : " 2 '-n'
          if [ ! -e $L2 ]; then
             mkfs.xfs -f -d file,name=$L2,size=1536m >> $LOGFILE
             WriteToLog "created" 2
          else
             WriteToLog "found" 2
          fi
          WriteToLog "2nd layer mountpoint : " 2 '-n'
          if [ ! -d $MPL2 ]; then
             mkdir $MPL2
             WriteToLog "created" 2
          else
             WriteToLog "found" 2
          fi
          if [ `/bin/busybox mount | grep -c "$MPL2"` -lt "1" ] ; then
             mount -o loop $L2 $MPL2/
             WriteToLog "mounting layer2 : " 2 '-n'
             if [ `/bin/busybox mount | grep -c "$MPL2"` -lt "1" ] ; then
                WriteToLog "failed, aborting..." 2
                GOON="0"
             else
                WriteToLog "successful" 2
             fi
          else
             WriteToLog "layer 2already mounted" 2
          fi
          if [ $GOON = "1" ]; then
             WriteToLog "PVR Flag : " 2 '-n'
             if [ ! -f $MPL2/.PlaceHolderDO-NOT-REMOVE ]; then
                touch $MPL2/.PlaceHolderDO-NOT-REMOVE
                WriteToLog "created" 2
             else
                WriteToLog "found" 2
             fi
             if [ $USE4PVR != "0" ]; then
             umount $MPL2
             echo "PVRIMAGE=\"$L2\"" >> /dtv/SGO.env #this will be overwritten in vusb.remi71 if you don't fit it
             fi
          fi
       fi
       WriteToLog "end of beatfreaks 03_01_xfsimg.init script" 1
       ;;
        stop)
       [ $USE4PVR = "0" ] && umount $MPL2
       umount $MPL1
       rm -r $MPL1
       rm $L1
       ;;
        restart)
       $0 stop && $0 start || exit 1
       ;;
        status)
       ;;
        *)
        echo "Usage: $0 {start|stop|restart}" 1>&2
        exit 0
        ;;
    esac
it seems to be fast enough to be executed as a init.d script, i think it has become a little too big to be included as a subfunction in vusb.remis71.init
Last edited by beatfreak on Mon Jun 09, 2014 2:15 pm, edited 3 times in total.
//UE40C6500 @ T-VALDEUC 3011 // rooted manual HotelMode style // PVR to NFS via 18MB on-the-fly sparse XFS // >> decommissioned due to tuner death
//UE46F8090 @ T-FXPDEUC 1136 // rooted by new Widget // root starting with empty usb drive
FYI: you can close your ssh session with SamyGO with

Code: Select all

~.
If you can't fix it using dvct tape, you are not using enough dvct tape.
karo2204
SamyGO Project Donor
Posts: 137
Joined: Fri Feb 07, 2014 10:09 am
Location: M?nchen
Contact:

Re: xfs image for "PVR over network share" on-the-fly

Post by karo2204 »

Hi beatfreak,

I tried your script but I always get "mkfs.xfs not found".

I would appreciate your help.

Karolin
Samsung TV: UE46F6500
Website: http://www.karolin-bierbrauer.de
User avatar
beatfreak
SamyGO Project Donor
Posts: 597
Joined: Tue Aug 23, 2011 9:03 am
Location: Hamburg
Contact:

Re: xfs image for "PVR over network share" on-the-fly

Post by beatfreak »

what is your model and firmware?
i have tested it only with T-VALDEUC 3011 and samyGO Extensions v0.03.6-r15
//UE40C6500 @ T-VALDEUC 3011 // rooted manual HotelMode style // PVR to NFS via 18MB on-the-fly sparse XFS // >> decommissioned due to tuner death
//UE46F8090 @ T-FXPDEUC 1136 // rooted by new Widget // root starting with empty usb drive
FYI: you can close your ssh session with SamyGO with

Code: Select all

~.
If you can't fix it using dvct tape, you are not using enough dvct tape.
tempinbox
Posts: 317
Joined: Wed May 11, 2011 7:00 pm

Re: xfs image for "PVR over network share" on-the-fly

Post by tempinbox »

what is this script for?
can i use to simple record on samba share?
User avatar
beatfreak
SamyGO Project Donor
Posts: 597
Joined: Tue Aug 23, 2011 9:03 am
Location: Hamburg
Contact:

Re: xfs image for "PVR over network share" on-the-fly

Post by beatfreak »

yes, it should be ok for samba shares too, it only generates the 1,5GB pvrimage with xfs filesystem so you dont have to keep it on usb or nw-share anymore
//UE40C6500 @ T-VALDEUC 3011 // rooted manual HotelMode style // PVR to NFS via 18MB on-the-fly sparse XFS // >> decommissioned due to tuner death
//UE46F8090 @ T-FXPDEUC 1136 // rooted by new Widget // root starting with empty usb drive
FYI: you can close your ssh session with SamyGO with

Code: Select all

~.
If you can't fix it using dvct tape, you are not using enough dvct tape.
User avatar
beatfreak
SamyGO Project Donor
Posts: 597
Joined: Tue Aug 23, 2011 9:03 am
Location: Hamburg
Contact:

Re: xfs image for "PVR over network share" on-the-fly

Post by beatfreak »

Bugfix/update
improved logging, corrected check error


:oops: just saw the updated script in SF svn repo
DEUS has put the 18m xfs image in $SYSROOT, he checks if it is existing, if not creates it but then he always runs mkfs.xfs over it
this way on every boot/SamyGO init there is a unnecessary write on flash memory
/core is 230MB tmpfs but what is it used for?

@juuso i would have appreciated a hint that we already use this method in current version of vusb script ^^
//UE40C6500 @ T-VALDEUC 3011 // rooted manual HotelMode style // PVR to NFS via 18MB on-the-fly sparse XFS // >> decommissioned due to tuner death
//UE46F8090 @ T-FXPDEUC 1136 // rooted by new Widget // root starting with empty usb drive
FYI: you can close your ssh session with SamyGO with

Code: Select all

~.
If you can't fix it using dvct tape, you are not using enough dvct tape.
User avatar
beatfreak
SamyGO Project Donor
Posts: 597
Joined: Tue Aug 23, 2011 9:03 am
Location: Hamburg
Contact:

Re: xfs image for "PVR over network share" on-the-fly

Post by beatfreak »

i had a chance to adapt this to T-FXPDEUC on F:
required changes to 02_04_vusb.init.remi71Show
find line and just put the # in front
#PVRIMAGE="$SYSROOT/pvrimage"
[/code]
next find:

Code: Select all

                if [ $GFILESIZE -ge 1536000 ]; then
and change it to

Code: Select all

                if [ $GFILESIZE -ge 32768 ]; then
(i didnt find a good way to tell the size of the filesystem within a sparse image without mounting it)
in the same file find

Code: Select all

                if [ `cat $i | grep -c "SamyGO Virt"` -gt "0" ]; then
and change it to

Code: Select all

                if [ `cat $i | grep -c "Virt"` -gt "0" ]; then
because on F the SamyGO in the Virt.USB drive name somehow gets swallowed
you may also want to add an a usbPopDown here similar to the standard vusb-script
and the adapted pvr-image preparation script:
02_03_ext4img.initShow

Code: Select all


root@tv:/mnt $ cat etc/init.d/02_03_ext4img.init
#!/bin/sh
. /dtv/SGO.env

#### Change-your-stuff START

L1='/core/layer1' # /core is the only tmpfs with more than 60MB available, you may change this to some permanent storage location on TV / USB-Drive
MPL1='/dtv/ly1mnt'
#L2="/core/layer2"
#MPL2="$MPL1/ly2mnt"

# Change only if you know what you're doing

USE4PVR="1"

#### Change-your-stuff END
GOON="1"

WriteToLog ()
        {
        case $2 in
        1)
                NOW=`date +%Y%m%d-%H%M%S`
                echo "$3" "$NOW $1" >>$LOGFILE
                ;;
        2)
                echo "$3" "$1" >>$LOGFILE
                ;;
        esac
        }

case $1 in
        start)
                touch $LOGFILE
                WriteToLog "start of beatfreaks 02_03_ext4img.init script" 1
                WriteToLog "1st layer image: " 2 '-n'
                if [ ! -e $L1 ]; then
                        busybox dd of=$L1 bs=1k seek=1536k </dev/null
                        mkfs.ext4 -F -t ext4 $L1 >> $LOGFILE
                        WriteToLog "created" 2
                else
                        WriteToLog "found" 2
                fi
                WriteToLog "1st layer mountpoint : " 2 '-n'
                if [ ! -d $MPL1 ]; then
                        mkdir -p $MPL1
                        WriteToLog "created" 2
                else
                        WriteToLog "found" 2
                fi
                if [ `/bin/busybox mount | grep -c "$MPL1"` -lt "1" ] ; then
                        mount -o loop $L1 $MPL1/
                        WriteToLog "mounting layer1 : " 2 '-n'
                        if [ `/bin/busybox mount | grep -c "$MPL1"` -lt "1" ] ; then
                                WriteToLog "failed, aborting..." 2
                                GOON="0"
                        else
                                WriteToLog "successful" 2
                        fi
                else
                        WriteToLog "layer1 already mounted" 2
                fi
                if [ $GOON = "1" ]; then
                        WriteToLog "PVR Flag : " 2 '-n'
                        if [ ! -f $MPL1/.PlaceHolderDO-NOT-REMOVE ]; then
                                touch $MPL1/.PlaceHolderDO-NOT-REMOVE
                                WriteToLog "created" 2
                        else
                                WriteToLog "found" 2
                        fi
                        if [ $USE4PVR != "0" ]; then
                                umount $MPL1
                                echo "PVRIMAGE=\"$L1\"" >> /dtv/SGO.env #this will be overwritten in vusb.remi71 if you don't fit it
                        fi
                fi
                WriteToLog "end of beatfreaks 02_03_ext4img.init script" 1
        ;;
        stop)
                [ $USE4PVR = "0" ] && umount $MPL1
                #umount $MPL1
                rm -r $MPL1
                rm $L1
        ;;
        restart)
        $0 stop && $0 start || exit 1
        ;;
        status)
        ;;
        *)
                echo "Usage: $0 {start|stop|restart}" 1>&2
                exit 0
        ;;
esac
root@tv:/mnt $
//UE40C6500 @ T-VALDEUC 3011 // rooted manual HotelMode style // PVR to NFS via 18MB on-the-fly sparse XFS // >> decommissioned due to tuner death
//UE46F8090 @ T-FXPDEUC 1136 // rooted by new Widget // root starting with empty usb drive
FYI: you can close your ssh session with SamyGO with

Code: Select all

~.
If you can't fix it using dvct tape, you are not using enough dvct tape.

Post Reply

Return to “[C] Brainstorm”