How could I make a alternative boot?


10 posts
by carl_retrotext » Tue May 29, 2012 5:17 pm
I have a Commodore emulator that would work well with different over scan parameters to startx, is there a way of writing a config file and putting it somewhere that would first change the over-scan, then run the emulator, but it I reset the bios it will revert to the normal GUI over-scan?

just got the hang of sudo nano in command line, that is my level of experience. ;)

thanks
User avatar
Posts: 76
Joined: Sun May 06, 2012 1:05 pm
Location: essex
by felix123 » Wed May 30, 2012 1:54 pm
config.txt is only read at boot, so you'll need to change it, then reboot before the settings take place.
Posts: 153
Joined: Tue May 15, 2012 6:06 am
by AndrewS » Wed May 30, 2012 2:00 pm
I made a couple of little bash-scripts last night to make this easier, but all the rebooting corrupted my filesysytem so I lost my changes! :( I'll try to reproduce it for you again this evening.
User avatar
Posts: 3626
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by carl_retrotext » Wed May 30, 2012 4:36 pm
AndrewS wrote:I made a couple of little bash-scripts last night to make this easier, but all the rebooting corrupted my filesysytem so I lost my changes! :( I'll try to reproduce it for you again this evening.



Thank you AndrewS

Its so I can initiate an emulator that needs plenty of overscan but of course it would then be a nightmare to re configure it to normal for startx. :)
User avatar
Posts: 76
Joined: Sun May 06, 2012 1:05 pm
Location: essex
by AndrewS » Thu May 31, 2012 1:24 am
Okay...
    copy config.txt to two other files
    Code: Select all
    sudo cp /boot/config.txt /boot/config_normal.txt
    sudo cp /boot/config.txt /boot/config_emu.txt
    and edit the two files to suit - one with your 'normal' overscan and the other with your emulator overscan
    Create /usr/local/bin/runemu containing this code
    Code: Select all
    #!/bin/bash
    if [[ $EUID -ne 0 ]]
    then
      echo "This tool must be run as root"
      exit 1
    fi
    cp /boot/config_emu.txt /boot/config.txt
    touch /boot/run_emu
    sync
    reboot
    and make it executable
    Code: Select all
    sudo chmod +x /usr/bin/local/runemu
    Add this code to /etc/rc.local (just before the final "return 0"
    Code: Select all
    if [ -f /boot/run_emu ]; then
        cp /boot/config_normal.txt /boot/config.txt
        rm /boot/run_emu
        sync
    fi

Now when you run "sudo runemu" it'll switch to the emulator overscan settings and reboot, and the very next time you reboot after that, it'll be back to your normal overscan settings 8-)
User avatar
Posts: 3626
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by carl_retrotext » Thu May 31, 2012 4:37 pm
THANK YOU :D

Andrew you have played a blinder, also I understand what code you included so its a win win.

I will put it in the Pi tonight, and play with the emulator overscan settings. :)
User avatar
Posts: 76
Joined: Sun May 06, 2012 1:05 pm
Location: essex
by AndrewS » Fri Jun 01, 2012 12:29 pm
Glad to hear that you got it working okay, and that you actually understand what it's doing - I deliberately kept it simple :)
Now you've got your scripting-toes wet ;) if you're feeling adventurous maybe you could try extending this system to also auto-run the emulator viewtopic.php?f=29&t=7192 and then auto-reboot after quitting the emulator? :D
(you'd probably need some kind of secondary 'marker file')
User avatar
Posts: 3626
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by carl_retrotext » Sat Jun 16, 2012 5:24 pm
Thanks again Andrew I have put this into the I and it works perfectly, in fact when I runemu the pi will indeed reboot, if I reboot in the normal way it always just hangs and I re power it, something that does not bother me.

You should be a mod or something, Kudos :)
User avatar
Posts: 76
Joined: Sun May 06, 2012 1:05 pm
Location: essex
by carl_retrotext » Thu Aug 09, 2012 7:02 pm
Hi since upgrading to Wheezy Beta, this script does not work as well, it executes runemu okay and reboots in the eum overscan settings, however it never changes back.

what code should I use to make a 'runnormal' command that will manually return the rebooted pi to normal overscan settings- this is fine for me.
User avatar
Posts: 76
Joined: Sun May 06, 2012 1:05 pm
Location: essex
by carl_retrotext » Thu Aug 09, 2012 7:40 pm
all sorted, I made another runemu file but called runnorm, and then made it pull the _normal.txt file.

happy days!
User avatar
Posts: 76
Joined: Sun May 06, 2012 1:05 pm
Location: essex