Repair uEnv.txt from U-Boot terminal?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I have a BeagleBone Black, with Debian 8.3, Linux 4.1.15-ti-rt-r43.



EDIT:
The system is installed on the internal flash.



I modified the /boot/uEnv.txt to load a different dtb file, apparently with wrong file name, so it doesn't boot into Linux.



So I connected via J1 pins / UART0 -> terminal program on my PC.
I see that U-Boot complains about a file not being found, so it won't start Linux, and gives me the U-Boot commands.
What was listed after entering "help" didn't look very useful.



Is it possible, and feasible, to repair the uEnv.txt from my serial console with U-Boot commands - which would work... how?
Or, what else would the best approach be?




EDIT#2:
Finding some useful scraps on this site, which did not exactly tell, but lead in a useful direction: https://www.compulab.co.il/utilite-computer/wiki/index.php/Utilite_U-Boot_User_How-To%27s I found I can actually see uEnv.txt typing in the U-Boot console: "ls mmc 1 boot", the ls command in U-Boot needs the device name + num, and apparently my SDcard is mmc0, the internal flash mmc1, funny order. Alas, U-Boot has no "cat", let alone an editor apparently. Like a kid with a remote controlled arm trying to grab a plush animal for some coins, can't quite grasp my file, and it's so close, argh!




EDIT#3:
I saw that I have an old backup file of uEnv.txt on mmc1. There is the U-Boot command "load", to load a file into memory, and "save", to save a file. You have to specify address and size. File size you see from "ls mmc 1 boot" command. Looking at the memory map on page 35 of this slide: https://www.slideshare.net/chrissimmonds/embedded-linux-quick-start-guide, the RAM starts at 0x80000000. Guessing that if only U-Boot is in RAM, where will hopefully be nothing at, say, 384 Mbytes, I tried to load file to 98000000, and save from there, but save returned "unable to write file". Too bad.







share|improve this question





















  • Do you have the OS on SDCard? If yes, you can edit this uEnv.txt file on other computer using card reader.
    – mariaczi
    Jun 13 at 12:45











  • Unfortunately, not. It's all on the internal flash on the BeagleBone Black. I guess I could try to boot from SDcard, I don't know whether the available images would then actually mount the internal flash for me to repair the txt file. What I absolutely want to avoid is erasing the system on the internal flash. There's unfinished business and it would mean loss of lots of work. (yeah, I was just about to make an image of the whole thing...)
    – sktpin
    Jun 13 at 13:13






  • 1




    You can start another linux with tftp or from USB stick and fix the broken file.
    – Arkadiusz Drabczyk
    Jun 14 at 9:33











  • TFTP, that sounds interesting. It worked via SDcard boot (see answer), but TFTP sounds optentially useful, for other scenarios also, will keep it in mind.
    – sktpin
    Jun 14 at 12:20














up vote
2
down vote

favorite












I have a BeagleBone Black, with Debian 8.3, Linux 4.1.15-ti-rt-r43.



EDIT:
The system is installed on the internal flash.



I modified the /boot/uEnv.txt to load a different dtb file, apparently with wrong file name, so it doesn't boot into Linux.



So I connected via J1 pins / UART0 -> terminal program on my PC.
I see that U-Boot complains about a file not being found, so it won't start Linux, and gives me the U-Boot commands.
What was listed after entering "help" didn't look very useful.



Is it possible, and feasible, to repair the uEnv.txt from my serial console with U-Boot commands - which would work... how?
Or, what else would the best approach be?




EDIT#2:
Finding some useful scraps on this site, which did not exactly tell, but lead in a useful direction: https://www.compulab.co.il/utilite-computer/wiki/index.php/Utilite_U-Boot_User_How-To%27s I found I can actually see uEnv.txt typing in the U-Boot console: "ls mmc 1 boot", the ls command in U-Boot needs the device name + num, and apparently my SDcard is mmc0, the internal flash mmc1, funny order. Alas, U-Boot has no "cat", let alone an editor apparently. Like a kid with a remote controlled arm trying to grab a plush animal for some coins, can't quite grasp my file, and it's so close, argh!




EDIT#3:
I saw that I have an old backup file of uEnv.txt on mmc1. There is the U-Boot command "load", to load a file into memory, and "save", to save a file. You have to specify address and size. File size you see from "ls mmc 1 boot" command. Looking at the memory map on page 35 of this slide: https://www.slideshare.net/chrissimmonds/embedded-linux-quick-start-guide, the RAM starts at 0x80000000. Guessing that if only U-Boot is in RAM, where will hopefully be nothing at, say, 384 Mbytes, I tried to load file to 98000000, and save from there, but save returned "unable to write file". Too bad.







share|improve this question





















  • Do you have the OS on SDCard? If yes, you can edit this uEnv.txt file on other computer using card reader.
    – mariaczi
    Jun 13 at 12:45











  • Unfortunately, not. It's all on the internal flash on the BeagleBone Black. I guess I could try to boot from SDcard, I don't know whether the available images would then actually mount the internal flash for me to repair the txt file. What I absolutely want to avoid is erasing the system on the internal flash. There's unfinished business and it would mean loss of lots of work. (yeah, I was just about to make an image of the whole thing...)
    – sktpin
    Jun 13 at 13:13






  • 1




    You can start another linux with tftp or from USB stick and fix the broken file.
    – Arkadiusz Drabczyk
    Jun 14 at 9:33











  • TFTP, that sounds interesting. It worked via SDcard boot (see answer), but TFTP sounds optentially useful, for other scenarios also, will keep it in mind.
    – sktpin
    Jun 14 at 12:20












up vote
2
down vote

favorite









up vote
2
down vote

favorite











I have a BeagleBone Black, with Debian 8.3, Linux 4.1.15-ti-rt-r43.



EDIT:
The system is installed on the internal flash.



I modified the /boot/uEnv.txt to load a different dtb file, apparently with wrong file name, so it doesn't boot into Linux.



So I connected via J1 pins / UART0 -> terminal program on my PC.
I see that U-Boot complains about a file not being found, so it won't start Linux, and gives me the U-Boot commands.
What was listed after entering "help" didn't look very useful.



Is it possible, and feasible, to repair the uEnv.txt from my serial console with U-Boot commands - which would work... how?
Or, what else would the best approach be?




EDIT#2:
Finding some useful scraps on this site, which did not exactly tell, but lead in a useful direction: https://www.compulab.co.il/utilite-computer/wiki/index.php/Utilite_U-Boot_User_How-To%27s I found I can actually see uEnv.txt typing in the U-Boot console: "ls mmc 1 boot", the ls command in U-Boot needs the device name + num, and apparently my SDcard is mmc0, the internal flash mmc1, funny order. Alas, U-Boot has no "cat", let alone an editor apparently. Like a kid with a remote controlled arm trying to grab a plush animal for some coins, can't quite grasp my file, and it's so close, argh!




EDIT#3:
I saw that I have an old backup file of uEnv.txt on mmc1. There is the U-Boot command "load", to load a file into memory, and "save", to save a file. You have to specify address and size. File size you see from "ls mmc 1 boot" command. Looking at the memory map on page 35 of this slide: https://www.slideshare.net/chrissimmonds/embedded-linux-quick-start-guide, the RAM starts at 0x80000000. Guessing that if only U-Boot is in RAM, where will hopefully be nothing at, say, 384 Mbytes, I tried to load file to 98000000, and save from there, but save returned "unable to write file". Too bad.







share|improve this question













I have a BeagleBone Black, with Debian 8.3, Linux 4.1.15-ti-rt-r43.



EDIT:
The system is installed on the internal flash.



I modified the /boot/uEnv.txt to load a different dtb file, apparently with wrong file name, so it doesn't boot into Linux.



So I connected via J1 pins / UART0 -> terminal program on my PC.
I see that U-Boot complains about a file not being found, so it won't start Linux, and gives me the U-Boot commands.
What was listed after entering "help" didn't look very useful.



Is it possible, and feasible, to repair the uEnv.txt from my serial console with U-Boot commands - which would work... how?
Or, what else would the best approach be?




EDIT#2:
Finding some useful scraps on this site, which did not exactly tell, but lead in a useful direction: https://www.compulab.co.il/utilite-computer/wiki/index.php/Utilite_U-Boot_User_How-To%27s I found I can actually see uEnv.txt typing in the U-Boot console: "ls mmc 1 boot", the ls command in U-Boot needs the device name + num, and apparently my SDcard is mmc0, the internal flash mmc1, funny order. Alas, U-Boot has no "cat", let alone an editor apparently. Like a kid with a remote controlled arm trying to grab a plush animal for some coins, can't quite grasp my file, and it's so close, argh!




EDIT#3:
I saw that I have an old backup file of uEnv.txt on mmc1. There is the U-Boot command "load", to load a file into memory, and "save", to save a file. You have to specify address and size. File size you see from "ls mmc 1 boot" command. Looking at the memory map on page 35 of this slide: https://www.slideshare.net/chrissimmonds/embedded-linux-quick-start-guide, the RAM starts at 0x80000000. Guessing that if only U-Boot is in RAM, where will hopefully be nothing at, say, 384 Mbytes, I tried to load file to 98000000, and save from there, but save returned "unable to write file". Too bad.









share|improve this question












share|improve this question




share|improve this question








edited Jun 14 at 9:30
























asked Jun 13 at 12:07









sktpin

164




164











  • Do you have the OS on SDCard? If yes, you can edit this uEnv.txt file on other computer using card reader.
    – mariaczi
    Jun 13 at 12:45











  • Unfortunately, not. It's all on the internal flash on the BeagleBone Black. I guess I could try to boot from SDcard, I don't know whether the available images would then actually mount the internal flash for me to repair the txt file. What I absolutely want to avoid is erasing the system on the internal flash. There's unfinished business and it would mean loss of lots of work. (yeah, I was just about to make an image of the whole thing...)
    – sktpin
    Jun 13 at 13:13






  • 1




    You can start another linux with tftp or from USB stick and fix the broken file.
    – Arkadiusz Drabczyk
    Jun 14 at 9:33











  • TFTP, that sounds interesting. It worked via SDcard boot (see answer), but TFTP sounds optentially useful, for other scenarios also, will keep it in mind.
    – sktpin
    Jun 14 at 12:20
















  • Do you have the OS on SDCard? If yes, you can edit this uEnv.txt file on other computer using card reader.
    – mariaczi
    Jun 13 at 12:45











  • Unfortunately, not. It's all on the internal flash on the BeagleBone Black. I guess I could try to boot from SDcard, I don't know whether the available images would then actually mount the internal flash for me to repair the txt file. What I absolutely want to avoid is erasing the system on the internal flash. There's unfinished business and it would mean loss of lots of work. (yeah, I was just about to make an image of the whole thing...)
    – sktpin
    Jun 13 at 13:13






  • 1




    You can start another linux with tftp or from USB stick and fix the broken file.
    – Arkadiusz Drabczyk
    Jun 14 at 9:33











  • TFTP, that sounds interesting. It worked via SDcard boot (see answer), but TFTP sounds optentially useful, for other scenarios also, will keep it in mind.
    – sktpin
    Jun 14 at 12:20















Do you have the OS on SDCard? If yes, you can edit this uEnv.txt file on other computer using card reader.
– mariaczi
Jun 13 at 12:45





Do you have the OS on SDCard? If yes, you can edit this uEnv.txt file on other computer using card reader.
– mariaczi
Jun 13 at 12:45













Unfortunately, not. It's all on the internal flash on the BeagleBone Black. I guess I could try to boot from SDcard, I don't know whether the available images would then actually mount the internal flash for me to repair the txt file. What I absolutely want to avoid is erasing the system on the internal flash. There's unfinished business and it would mean loss of lots of work. (yeah, I was just about to make an image of the whole thing...)
– sktpin
Jun 13 at 13:13




Unfortunately, not. It's all on the internal flash on the BeagleBone Black. I guess I could try to boot from SDcard, I don't know whether the available images would then actually mount the internal flash for me to repair the txt file. What I absolutely want to avoid is erasing the system on the internal flash. There's unfinished business and it would mean loss of lots of work. (yeah, I was just about to make an image of the whole thing...)
– sktpin
Jun 13 at 13:13




1




1




You can start another linux with tftp or from USB stick and fix the broken file.
– Arkadiusz Drabczyk
Jun 14 at 9:33





You can start another linux with tftp or from USB stick and fix the broken file.
– Arkadiusz Drabczyk
Jun 14 at 9:33













TFTP, that sounds interesting. It worked via SDcard boot (see answer), but TFTP sounds optentially useful, for other scenarios also, will keep it in mind.
– sktpin
Jun 14 at 12:20




TFTP, that sounds interesting. It worked via SDcard boot (see answer), but TFTP sounds optentially useful, for other scenarios also, will keep it in mind.
– sktpin
Jun 14 at 12:20










1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










Ok, I gave up the U-Boot route, although it would have been cool, had that worked.



I grabbed the IoT variant (console only, no GUI, downloads quicker) of the BeagleBone Debian image, e.g. "Stretch IoT (without graphical desktop)":
https://beagleboard.org/latest-images



and followed the steps here:
http://beagleboard.org/getting-started



There is a link of how to flash it, i.e. extra steps are needed for that - good, I remembered that wrong. Was afraid that the sdcard boot would flash the internal emmc, which I don't want.



As mentioned earlier, when a SDcard is inserted, the sdcard mmc device will be number 0, and internal flash (emmc) will be 1. Also, the file system on the emmc is apparently ext4. So you need to mount that:



debian@beaglebone:~$ sudo mkdir /mnt/emmc
debian@beaglebone:~$ sudo mount -t ext4 /dev/mmcblk1p1 /mnt/emmc


Then you can just go to the boot folder on the mounted emmc:



debian@beaglebone:/$ cd /mnt/emmc/boot/


and fix the uEnv.txt lying there with an editor or the backup you certainly made beforehand ;)






share|improve this answer





















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f449529%2frepair-uenv-txt-from-u-boot-terminal%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote



    accepted










    Ok, I gave up the U-Boot route, although it would have been cool, had that worked.



    I grabbed the IoT variant (console only, no GUI, downloads quicker) of the BeagleBone Debian image, e.g. "Stretch IoT (without graphical desktop)":
    https://beagleboard.org/latest-images



    and followed the steps here:
    http://beagleboard.org/getting-started



    There is a link of how to flash it, i.e. extra steps are needed for that - good, I remembered that wrong. Was afraid that the sdcard boot would flash the internal emmc, which I don't want.



    As mentioned earlier, when a SDcard is inserted, the sdcard mmc device will be number 0, and internal flash (emmc) will be 1. Also, the file system on the emmc is apparently ext4. So you need to mount that:



    debian@beaglebone:~$ sudo mkdir /mnt/emmc
    debian@beaglebone:~$ sudo mount -t ext4 /dev/mmcblk1p1 /mnt/emmc


    Then you can just go to the boot folder on the mounted emmc:



    debian@beaglebone:/$ cd /mnt/emmc/boot/


    and fix the uEnv.txt lying there with an editor or the backup you certainly made beforehand ;)






    share|improve this answer

























      up vote
      0
      down vote



      accepted










      Ok, I gave up the U-Boot route, although it would have been cool, had that worked.



      I grabbed the IoT variant (console only, no GUI, downloads quicker) of the BeagleBone Debian image, e.g. "Stretch IoT (without graphical desktop)":
      https://beagleboard.org/latest-images



      and followed the steps here:
      http://beagleboard.org/getting-started



      There is a link of how to flash it, i.e. extra steps are needed for that - good, I remembered that wrong. Was afraid that the sdcard boot would flash the internal emmc, which I don't want.



      As mentioned earlier, when a SDcard is inserted, the sdcard mmc device will be number 0, and internal flash (emmc) will be 1. Also, the file system on the emmc is apparently ext4. So you need to mount that:



      debian@beaglebone:~$ sudo mkdir /mnt/emmc
      debian@beaglebone:~$ sudo mount -t ext4 /dev/mmcblk1p1 /mnt/emmc


      Then you can just go to the boot folder on the mounted emmc:



      debian@beaglebone:/$ cd /mnt/emmc/boot/


      and fix the uEnv.txt lying there with an editor or the backup you certainly made beforehand ;)






      share|improve this answer























        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        Ok, I gave up the U-Boot route, although it would have been cool, had that worked.



        I grabbed the IoT variant (console only, no GUI, downloads quicker) of the BeagleBone Debian image, e.g. "Stretch IoT (without graphical desktop)":
        https://beagleboard.org/latest-images



        and followed the steps here:
        http://beagleboard.org/getting-started



        There is a link of how to flash it, i.e. extra steps are needed for that - good, I remembered that wrong. Was afraid that the sdcard boot would flash the internal emmc, which I don't want.



        As mentioned earlier, when a SDcard is inserted, the sdcard mmc device will be number 0, and internal flash (emmc) will be 1. Also, the file system on the emmc is apparently ext4. So you need to mount that:



        debian@beaglebone:~$ sudo mkdir /mnt/emmc
        debian@beaglebone:~$ sudo mount -t ext4 /dev/mmcblk1p1 /mnt/emmc


        Then you can just go to the boot folder on the mounted emmc:



        debian@beaglebone:/$ cd /mnt/emmc/boot/


        and fix the uEnv.txt lying there with an editor or the backup you certainly made beforehand ;)






        share|improve this answer













        Ok, I gave up the U-Boot route, although it would have been cool, had that worked.



        I grabbed the IoT variant (console only, no GUI, downloads quicker) of the BeagleBone Debian image, e.g. "Stretch IoT (without graphical desktop)":
        https://beagleboard.org/latest-images



        and followed the steps here:
        http://beagleboard.org/getting-started



        There is a link of how to flash it, i.e. extra steps are needed for that - good, I remembered that wrong. Was afraid that the sdcard boot would flash the internal emmc, which I don't want.



        As mentioned earlier, when a SDcard is inserted, the sdcard mmc device will be number 0, and internal flash (emmc) will be 1. Also, the file system on the emmc is apparently ext4. So you need to mount that:



        debian@beaglebone:~$ sudo mkdir /mnt/emmc
        debian@beaglebone:~$ sudo mount -t ext4 /dev/mmcblk1p1 /mnt/emmc


        Then you can just go to the boot folder on the mounted emmc:



        debian@beaglebone:/$ cd /mnt/emmc/boot/


        and fix the uEnv.txt lying there with an editor or the backup you certainly made beforehand ;)







        share|improve this answer













        share|improve this answer



        share|improve this answer











        answered Jun 14 at 12:19









        sktpin

        164




        164






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f449529%2frepair-uenv-txt-from-u-boot-terminal%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay