Script to make a USB Thumb Drive to Flash your BIOS with
ubf2 v2.0.0
-New BIOS
-rm the MBR
-Should come executable
usbbiosflasher v1.0.1
-Changed some little stuff....
usbbiosflasher v1.0.0
This script makes this task as EZ as 1,2,3...
You should still read through the description on page=1 of this thread just for the hell of it. There are also a few "notes" there that are not here. If you don't know what the BIOS is then read through my post on page=3 of this thread.
Thanks one more time to wyth for posting the .ROM file That makes life way more simple.
Code:#!/bin/bash # # Shell script to make a USB Tumb Drive for Flashing BIOS on a Lenovo Ideapad Y510. # This script needs to me owned and run as ROOT with the "sudo command" # i.e. sudo usbbiosflasher # # If you have anyideas send be a PM on ubuntufourms.org my user name is HunterThomson # Name/Rename this script usbbiosflasher and save it to the ~/home directory. # Then run the command- chown root:root usbbiosflasher # Then run the command- chmod 755 usbbiosflasher # Then copy the script to the directory /usr/bin. # Run this comand to do that- sudo cp ~/usbbiosflasher /usr/bin # # You also must have the program "mbr" installed # You can install the mbr program by running this comand in the shell on Ubuntu # sudo apt-get install mbr # In Arch Linux you have to get it from Aur # # First you will need to know a few things... # # You will also need to know the Mount Point i.e. /media/disk and the /dev path i.e. /dev/sdb1. # You can find these by using the df -T comand. # Run df -T in the shell. Then plug in the USB Thumb Drive and run the df -T comand agin. # The new listing is the USB Thumb Dirve. # Also check to make sure the File System tipe is vFAT or FAT16 or FAT32. # If it is not use gparted to format it to FAT32. # I am farly certen that all USB Thumb drives come formated with FAT file system out of the BOX. # You may want to fromat it anyway just to make sure. # # # # echo "Interactive Shell Script to Make a USB Thumb Drive \for Flashing BIOS On a Lenovo Ideapad Y510" echo "You will need to have the USB Memory stick formated FAT32 and give it a BOOT flag with a program like gpartted" # The next comand will make a directory to put needed files into. Note this file and everything init will be owned by root. mkdir ~/usbbiosfiles if [ $? != 0 ] ; then #failed echo "Could not \make directory usbbiosfiles" echo "look above \for \info" echo "Fix the problem and run this scrip agin" exit 1 else echo "Made directory usbbiosfiles... OK" fi # The next two comands will get the FreeDOS file and the .ROM file. cd ~/usbbiosfiles if [ $? != 0 ] ; then echo "Could not Change to the usbbiosfiles directory" echo "look above \for \info" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Changing to the usbbiosfiles directory... OK" fi wget "http://www.fdos.org/bootdisks/autogen/FDOEM.144.gz" if [ $? != 0 ] ; then echo "Could not Download FreeDOS" echo "look above \for \info" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Download of FreeDOS... OK" fi wget "http://ubuntuforums.org/attachment.php?attachmentid=84991&d=1221204455" if [ $? != 0 ] ; then echo "Could not Downlad the BIOS.ROM \file" echo "look above \for \info" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Download of the BIOS.ROM \file... OK" fi # The next comand will name the .ROM file to the right name. mv ~/usbbiosfiles/attachment.php?attachmentid=84991\&d=1221204455 ~/usbbiosfiles/06CN31WW.ROM.tar.gz if [ $? != 0 ] ; then echo "Could not rename the BIOS.ROM \file" echo "look above \for \info" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Renameing of the BIOS.ROM \file... OK" fi echo "" # The next two comands set the variables. DEVX for the path i.e. /dev/xxx and MOUNTX for the mount point i.e. /media/xxx verify="n" while [ "$verify" != y ] do echo "You will need to know the Mount Point and the dev Path. You will also need to \make sure the File System \type is vFAT, FAT16 or FAT32." echo "" echo "With the USB Thumb Drive unpluged, Open another shell and run the comand df -T Then plug \in the USB Thumb Drive and run the comand df -T one \more time. The new device listed is the USB Thumb Drive. Note the Mount Point and The dev Path and the File system Type i.e. vFAT... If the File System \type is not vFAT, FAT16 or FAT32 you will need to fromat it with gparted. You may want to format the USB Thumb Drive anyway just to \make sure. In any \case delete all files and directorys on the USB drive before you go any ferther with this program." echo "" printf "Enter the dev path the USB Thumb Drive is at?" read DEVX echo "" echo "Are you sure $DEVX is the dev path of the USB Thumb Drive... y or n?" read verify done echo "" verify="n" while [ "$verify" != y ] do printf "What is the Mount Point of the USB Thumb Drive?" read MOUNTX echo "" echo "Are you sure $MOUNTX is the Mount Point of the USB Drive... y or n?" read verify done echo "" tar xvf ~/usbbiosfiles/*.tar if [ $? != 0 ] ; then echo "Could not unpack BIOS.ROM file" echo "look above \for \info" echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Unpacking BIOS.ROM file... OK" fi gunzip ~/usbbiosfiles/FDOEM.144.gz if [ $? != 0 ] ; then echo "Could not unpack FreeDOS files" echo "look above \for \info" echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Unpacking FreeDOS files... OK" fi mkdir ~/usbbiosfiles/fdoem144 if [ $? != 0 ] ; then echo "Could not make directory fdoem144 in usbbiosfiles directory" echo "look above \for \info" echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Made directory fdoem144 in direcoty usbbiosfiles... OK" echo "" echo "Going to \sleep \for 5secs" fi modprobe loop && sleep 5 if [ $? != 0 ] ; then echo "Could not \modprobe loop" echo "look above \for \info" echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Modprobeing loop... OK" fi mount -o loop ~/usbbiosfiles/FDOEM.144 ~/usbbiosfiles/fdoem144 if [ $? != 0 ] ; then echo "Could not \mount FreeDOS on the fdoem144 directory" echo "look above \for \info" echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Mounting FreeDOS on the fdoem144 directory... OK" fi cp ~/usbbiosfiles/fdoem144/* $MOUNTX if [ $? != 0 ] ; then echo "Could not copy FreeDOS files to $MOUNTX" echo "look above \for \info" echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Copying FreeDOS files to $MOUNTX... OK" fi cp ~/usbbiosfiles/*.ROM $MOUNTX if [ $? != 0 ] ; then echo "Could not copy BIOS.ROM files to $MOUNTX" echo "look above \for \info" echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Copying BIOS.ROM files to $MOUNTX... OK" fi sync if [ $? != 0 ] ; then echo "Could not run the syncing command" echo "look above \for \info" echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Runing the syncing command... OK" fi umount ~/usbbiosfiles/fdoem144 if [ $? != 0 ] ; then echo "Could not unmount FreeDOS" echo "Look above for errors or problems reported and fix the problem" echo "" echo "removeing directory usbbiosfiles..." echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this script agin" rm -r ~/usbbiosfiles exit else echo "Unmounting of FreeDOS... OK" fi verify="n" while [ "$verify" != y ] do printf "Do you see any errors... yes or no?" read AN2 echo "" printf "You answered... $AN2 to errors. Is this correct... y or n?" read verify done echo "" if [ "$AN2" == "yes" ] then echo "Prosses Check Repoted... Error" echo "Look above for errors or problems reported and fix the problem" echo "" echo "removeing directory usbbiosfiles..." echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this script agin" rm -r ~/usbbiosfiles exit else echo "Success" echo "I did a lot of error checking too and didnt find anything" echo "" echo "Go get a pen and paper to write down these instructions" printf "Then hit the Enter to continue" read WAIT echo "#!/bin/bash # # Shell script to make a USB Tumb Drive for Flashing BIOS on a Lenovo Ideapad Y510. # This script needs to me owned and run as ROOT with the "sudo command" # i.e. sudo usbbiosflasher # # If you have anyideas send be a PM on ubuntufourms.org my user name is HunterThomson # Name/Rename this script usbbiosflasher and save it to the ~/home directory. # Then run the command- chown root:root usbbiosflasher # Then run the command- chmod 755 usbbiosflasher # Then copy the script to the directory /usr/bin. # Run this comand to do that- sudo cp ~/usbbiosflasher /usr/bin # # You also must have the program "mbr" installed # You can install the mbr program by running this comand in the shell on Ubuntu # sudo apt-get install mbr # In Arch Linux you have to get it from Aur # # First you will need to know a few things... # # You will also need to know the Mount Point i.e. /media/disk and the /dev path i.e. /dev/sdb1. # You can find these by using the df -T comand. # Run df -T in the shell. Then plug in the USB Thumb Drive and run the df -T comand agin. # The new listing is the USB Thumb Dirve. # Also check to make sure the File System tipe is vFAT or FAT16 or FAT32. # If it is not use gparted to format it to FAT32. # I am farly certen that all USB Thumb drives come formated with FAT file system out of the BOX. # You may want to fromat it anyway just to make sure. # # # # echo "Interactive Shell Script to Make a USB Thumb Drive \for Flashing BIOS On a Lenovo Ideapad Y510" # The next comand will make a directory to put needed files into. Note this file and everything init will be owned by root. mkdir ~/usbbiosfiles if [ $? != 0 ] ; then #failed echo "Could not \make directory usbbiosfiles" echo "look above \for \info" echo "Fix the problem and run this scrip agin" exit 1 else echo "Made directory usbbiosfiles... OK" fi # The next two comands will get the FreeDOS file and the .ROM file. cd ~/usbbiosfiles if [ $? != 0 ] ; then echo "Could not Change to the usbbiosfiles directory" echo "look above \for \info" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Changing to the usbbiosfiles directory... OK" fi wget "http://www.fdos.org/bootdisks/autogen/FDOEM.144.gz" if [ $? != 0 ] ; then echo "Could not Download FreeDOS" echo "look above \for \info" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Download of FreeDOS... OK" fi wget "http://ubuntuforums.org/attachment.php?attachmentid=84991&d=1221204455" if [ $? != 0 ] ; then echo "Could not Downlad the BIOS.ROM \file" echo "look above \for \info" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Download of the BIOS.ROM \file... OK" fi # The next comand will name the .ROM file to the right name. mv ~/usbbiosfiles/attachment.php?attachmentid=84991\&d=1221204455 ~/usbbiosfiles/06CN31WW.ROM.tar.gz if [ $? != 0 ] ; then echo "Could not rename the BIOS.ROM \file" echo "look above \for \info" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Renameing of the BIOS.ROM \file... OK" fi echo "" # The next two comands set the variables. DEVX for the path i.e. /dev/xxx and MOUNTX for the mount point i.e. /media/xxx verify="n" while [ "$verify" != y ] do echo "You will need to know the Mount Point and the dev Path. You will also need to \make sure the File System \type is vFAT, FAT16 or FAT32." echo "" echo "With the USB Thumb Drive unpluged, Open another shell and run the comand df -T Then plug \in the USB Thumb Drive and run the comand df -T one \more time. The new device listed is the USB Thumb Drive. Note the Mount Point and The dev Path and the File system Type i.e. vFAT... If the File System \type is not vFAT, FAT16 or FAT32 you will need to fromat it with gparted. You may want to format the USB Thumb Drive anyway just to \make sure. In any \case delete all files and directorys on the USB drive before you go any ferther with this program." echo "" printf "Enter the dev path the USB Thumb Drive is at?" read DEVX echo "" echo "Are you sure $DEVX is the dev path of the USB Thumb Drive... y or n?" read verify done echo "" verify="n" while [ "$verify" != y ] do printf "What is the Mount Point of the USB Thumb Drive?" read MOUNTX echo "" echo "Are you sure $MOUNTX is the Mount Point of the USB Drive... y or n?" read verify done echo "" tar xvf ~/usbbiosfiles/*.tar if [ $? != 0 ] ; then echo "Could not unpack BIOS.ROM file" echo "look above \for \info" echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Unpacking BIOS.ROM file... OK" fi gunzip ~/usbbiosfiles/FDOEM.144.gz if [ $? != 0 ] ; then echo "Could not unpack FreeDOS files" echo "look above \for \info" echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Unpacking FreeDOS files... OK" fi mkdir ~/usbbiosfiles/fdoem144 if [ $? != 0 ] ; then echo "Could not make directory fdoem144 in usbbiosfiles directory" echo "look above \for \info" echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Made directory fdoem144 in direcoty usbbiosfiles... OK" echo "" echo "Going to \sleep \for 5secs" fi modprobe loop && sleep 5 if [ $? != 0 ] ; then echo "Could not \modprobe loop" echo "look above \for \info" echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Modprobeing loop... OK" fi mount -o loop ~/usbbiosfiles/FDOEM.144 ~/usbbiosfiles/fdoem144 if [ $? != 0 ] ; then echo "Could not \mount FreeDOS on the fdoem144 directory" echo "look above \for \info" echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Mounting FreeDOS on the fdoem144 directory... OK" fi cp ~/usbbiosfiles/fdoem144/* $MOUNTX if [ $? != 0 ] ; then echo "Could not copy FreeDOS files to $MOUNTX" echo "look above \for \info" echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Copying FreeDOS files to $MOUNTX... OK" fi cp ~/usbbiosfiles/*.ROM $MOUNTX if [ $? != 0 ] ; then echo "Could not copy BIOS.ROM files to $MOUNTX" echo "look above \for \info" echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Copying BIOS.ROM files to $MOUNTX... OK" fi sync if [ $? != 0 ] ; then echo "Could not run the syncing command" echo "look above \for \info" echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this scrip agin" echo "" echo "removeing directory usbbiosfiles..." echo "" rm -r ~/usbbiosfiles exit else echo "Runing the syncing command... OK" fi umount ~/usbbiosfiles/fdoem144 if [ $? != 0 ] ; then echo "Could not unmount FreeDOS" echo "Look above for errors or problems reported and fix the problem" echo "" echo "removeing directory usbbiosfiles..." echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this script agin" rm -r ~/usbbiosfiles exit else echo "Unmounting of FreeDOS... OK" fi verify="n" while [ "$verify" != y ] do printf "Do you see any errors... yes or no?" read AN2 echo "" printf "You answered... $AN2 to errors. Is this correct... y or n?" read verify done echo "" if [ "$AN2" == "yes" ] then echo "Prosses Check Repoted... Error" echo "Look above for errors or problems reported and fix the problem" echo "" echo "removeing directory usbbiosfiles..." echo "" echo "Reformat the USB Stick to FAT32 with gparted" echo "Fix the problem and run this script agin" rm -r ~/usbbiosfiles exit else echo "Success" echo "I did a lot of error checking too and didnt find anything" echo "" echo "Go get a pen and paper to write down these instructions" printf "Then hit the Enter to continue" read WAIT echo """
Bookmarks