* Re: How to use eMMC/SD DOS partitions as backend for the state framework? [not found] <1982917789.2703351.1497365376201.ref@mail.yahoo.com> @ 2017-06-13 14:49 ` B Gol 0 siblings, 0 replies; 3+ messages in thread From: B Gol @ 2017-06-13 14:49 UTC (permalink / raw) To: barebox Hi, Thanks for the quick answer and putting me into the right direction. All I was trying to do was getting the Rauc update system work with barebox state framework , and it took almost two weeks of my life to get it done. Now that it is working as expected, it is time to give back to the community, or in other words "state framework for dummies" . ################################################## First of all this is what I have added or modified in my dts file (I have a beaglebone black so that would be the am335x-boneblack.dts file in the barebox source path) : ################################################## *** I modified this part : &mmc1 { vmmc-supply = <&vmmcsd_fixed>; mmc1_state: state@0x96ad000 { reg = <0x96ad000 0x4fffff>; label = "state-sd"; }; }; *** and added this part to the end of the dts file: / { state: state { magic = <0x27031977>; compatible = "barebox,state"; backend-type = "raw"; backend-storage-type = "circular"; backend-stridesize = <0x500>; backend = <&mmc1_state>; bootstate { last_chosen { reg = <0x5 0x4>; type = "uint32"; default = <0x1>; }; system0.boot { reg = <0x20 0xa>; type = "string"; default = "system0"; }; system0.remaining_attempts { reg = <0x2b 0x4>; type = "uint32"; default = <0x3>; }; system0.priority { reg = <0x31 0x4>; type = "uint32"; default = <0x15>; }; system1.boot { reg = <0x60 0xa>; type = "string"; default = "system1"; }; system1.remaining_attempts { reg = <0x6b 0x4>; type = "uint32"; default = <0x3>; }; system1.priority { reg = <0x76 0x4>; type = "uint32"; default = <0x14>; }; }; }; aliases { state = &state; }; }; ################################################## 1) The &mmc1 was already in the dts file , I just added the mmc1_state: ... {...} part to it. 2) The reg = <0x96ad000 0x4fffff> part was also a challenge for me to figure out. Turned out those numbers are there to specify the boundaries of the state partition. You can either find it with fdisk -l -u in your linux shell or with the devinfo command in the barebox shell (second approach is recommended since it is already in Hex and bytes compared to Dec and sectors with fdisk ) this is part of the output I got from devinfo: `-- 0x096ad000-0x09bacfff ( 5 MiB): /dev/mmc0.6 (do not confuse mmc0 in the output with mmc1 in your dts file, mmc0 is just an alias to mmc1. so if you want to specify mmc1 you have to write mmc2 in the dts file) the first number would be the start address , and last_address minus first_address would result in size of your intended partition 0x09bacff - 0x096ad000 = 0x4fffff hence reg = <0x96ad000 0x4fffff>; 3) For the *types I first started with "dtb" and "direct", but got very weird responses (some gibberish on the console after every reboot and some weird characters in my state variables) so I changed them to "raw" and "circular" and I haven't seen any of the weirdness since. 4) You also have to create some nv variables to get it to work: from the barebox shell : nv bootchooser.state_prefix="state.bootstate" nv boot.default="bootchooser net" or you could do it before compiling the barebox: make a file named "bootchooser.state_prefix" containing "state.bootstate" string. make a file named "boot.default" containing "bootchooser net" string.(you can change net with recovery or anything you have in mind, barebox will try to boot net if the bootchooser fails, or you could remove it from the string altogether). And put both of them in the following path of the barebox source code: /source-path/barebox-yyyy.mm.d/defaultenv/defaultenv-2-base/nv/ 5) You also need to make system0 and system1 (based on your naming scheme in the dts file) scripts in the following directory: in the barebox environment: /env/boot/ or in the source code path before compiling: /source-path/barebox-yyyy.mm.d/defaultenv/boot/ I just put my boot scripts here for example: system0 boot script: ############################################################## #!/bin/sh mount /dev/mmc0.1 global.bootm.image=/mnt/mmc0.1/boot/zImage-4.8.12 global.bootm.oftree=/mnt/mmc0.1/boot/devicetree-zImage-am335x-boneblack.dtb global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootfstype=ext4" global linux.bootargs.base="console=ttyO0,115200" ############################################################## system1 boot script: ############################################################## #!/bin/sh mount /dev/mmc0.2 global.bootm.image=/mnt/mmc0.2/boot/zImage-4.8.12 global.bootm.oftree=/mnt/mmc0.2/boot/devicetree-zImage-am335x-boneblack.dtb global.linux.bootargs.dyn.root="root=/dev/mmcblk0p3 rootfstype=ext4" global linux.bootargs.base="console=ttyO0,115200" ############################################################## I hope this helps some barebox noobies like me in the future. _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <1270235505.6719556.1497082449606.ref@mail.yahoo.com>]
* How to use eMMC/SD DOS partitions as backend for the state framework? [not found] <1270235505.6719556.1497082449606.ref@mail.yahoo.com> @ 2017-06-10 8:14 ` B Gol 2017-06-13 7:34 ` Sascha Hauer 0 siblings, 1 reply; 3+ messages in thread From: B Gol @ 2017-06-10 8:14 UTC (permalink / raw) To: barebox Hi, I was trying to figure out the state framework recently , and found out that till version 2017.04.0 it kinda works with the following lines in my dtb : ############################################################################# / { state: state { magic = <0x27031977>; compatible = "barebox,state"; backend-type = "dtb"; backend-storage-type = "direct"; backend-stridesize = <0x500>; backend = &mmc1, "partname:6"; bootchooser { system0 { boot { reg = <0x00 0x10>; type = "string"; default = "system0"; }; remaining_attempts { reg = <0x15 0x4>; type = "uint32"; default = <0x3>; }; priority { reg = <0x20 0x4>; type = "uint32"; default = <0x15>; }; }; system1 { boot { reg = <0x25 0x10>; type = "string"; default = "system1"; }; remaining_attempts { reg = <0x40 0x4>; type = "uint32"; default = <0x3>; }; priority { reg = <0x45 0x4>; type = "uint32"; default = <0x14>; }; }; }; }; }; ############################################################################# The problem was it just worked for the first boot , after that it goes through a boot loop and all the remaining_attempts become zero , and I see the following bizarre logs on the console : ############################################################################# state: set parameter bootchooser.last_chosen: Invalid argument unable to handle paging request at address 0x14040008 pc : [<9fe05314>] lr : [<9fe05363>] sp : 9ffefab8 ip : 0000000c fp : 9fe56ad5 r10: 9fea17c8 r9 : 9fe56f8a r8 : 9fe56f71 r7 : 9011852c r6 : 8fefef40 r5 : 14040000 r4 : edfe0dd0 r3 : 00000000 r2 : 00000004 r1 : 90119214 r0 : 8fefef40 Flags: nzCv IRQs off FIQs on Mode SVC_32 [<9fe05314>] (remove_free_block+0x10/0x3e) from [<9fe05363>] (block_remove+0x21/0x24) [<9fe05363>] (block_remove+0x21/0x24) from [<9fe05667>] (tlsf_free+0x37/0x62) [<9fe05667>] (tlsf_free+0x37/0x62) from [<9fe08875>] (state_save+0x5d/0x6c) [<9fe08875>] (state_save+0x5d/0x6c) from [<9fe09c6b>] (bootchooser_save+0x33/0xa0) [<9fe09c6b>] (bootchooser_save+0x33/0xa0) from [<9fe09e3b>] (bootchooser_get_target+0x5f/0x7c) [<9fe09e3b>] (bootchooser_get_target+0x5f/0x7c) from [<9fe09e7b>] (bootchooser_boot+0x23/0xbc) [<9fe09e7b>] (bootchooser_boot+0x23/0xbc) from [<9fe0ba33>] (boot_entry+0x37/0x60) [<9fe0ba33>] (boot_entry+0x37/0x60) from [<9fe36a1f>] (do_boot+0x137/0x160) [<9fe36a1f>] (do_boot+0x137/0x160) from [<9fe02f25>] (execute_command+0x21/0x48) [<9fe02f25>] (execute_command+0x21/0x48) from [<9fe076d3>] (run_list_real+0x5a3/0x604) [<9fe076d3>] (run_list_real+0x5a3/0x604) from [<9fe073c7>] (run_list_real+0x297/0x604) [<9fe073c7>] (run_list_real+0x297/0x604) from [<9fe07035>] (parse_stream_outer+0x105/0x15c) [<9fe07035>] (parse_stream_outer+0x105/0x15c) from [<9fe070f1>] (parse_string_outer+0x65/0xa4) [<9fe070f1>] (parse_string_outer+0x65/0xa4) from [<9fe07777>] (source_script+0x43/0x68) [<9fe07777>] (source_script+0x43/0x68) from [<9fe077c3>] (do_source+0x27/0x46) [<9fe077c3>] (do_source+0x27/0x46) from [<9fe02f25>] (execute_command+0x21/0x48) [<9fe02f25>] (execute_command+0x21/0x48) from [<9fe076d3>] (run_list_real+0x5a3/0x604) [<9fe076d3>] (run_list_real+0x5a3/0x604) from [<9fe07035>] (parse_stream_outer+0x105/0x15c) [<9fe07035>] (parse_stream_outer+0x105/0x15c) from [<9fe070f1>] (parse_string_outer+0x65/0xa4) [<9fe070f1>] (parse_string_outer+0x65/0xa4) from [<9fe078b5>] (run_command+0x21/0x30) [<9fe078b5>] (run_command+0x21/0x30) from [<9fe0094d>] (start_barebox+0x2d/0x94) [<9fe0094d>] (start_barebox+0x2d/0x94) from [<9fe51e3b>] (barebox_non_pbl_start+0xbb/0xf8) [<9fe51e3b>] (barebox_non_pbl_start+0xbb/0xf8) from [<9fe00005>] (__bare_init_start+0x1/0xc) [<9fe535fd>] (unwind_backtrace+0x1/0x58) from [<9fe00bbd>] (panic+0x1d/0x34) [<9fe00bbd>] (panic+0x1d/0x34) from [<9fe51c11>] (do_exception+0xd/0x10) [<9fe51c11>] (do_exception+0xd/0x10) from [<9fe51c71>] (do_data_abort+0x21/0x2c) [<9fe51c71>] (do_data_abort+0x21/0x2c) from [<9fe51714>] (do_abort_6+0x48/0x54) ############################################################################# Now with the last version (2017.05.0) I have another problem. This is what I see on the console while trying to boot : ############################################################################# state: Cannot resolve "backend" phandle state state.7: probe failed: Invalid argument ############################################################################# The question is, how should I declare the backend in the dts file and which one is the most stable version that supports my case? _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to use eMMC/SD DOS partitions as backend for the state framework? 2017-06-10 8:14 ` B Gol @ 2017-06-13 7:34 ` Sascha Hauer 0 siblings, 0 replies; 3+ messages in thread From: Sascha Hauer @ 2017-06-13 7:34 UTC (permalink / raw) To: B Gol; +Cc: barebox Hi, On Sat, Jun 10, 2017 at 08:14:09AM +0000, B Gol wrote: > Hi, > I was trying to figure out the state framework recently , and found out > that till version 2017.04.0 it kinda works with the following lines in > my dtb : > > ############################################################################# > > / { > state: state { > magic = <0x27031977>; > compatible = "barebox,state"; > backend-type = "dtb"; > backend-storage-type = "direct"; > backend-stridesize = <0x500>; > backend = &mmc1, "partname:6"; Sorry, this doesn't work. We updated the binding, the backend must be a phandle to the partition which contains the state data, like this: backend = <&mmc1_state>; &mmc1 { mmc1_state: state@0x80000 { reg = <0x80000 0x80000>; label = "state-sd"; }; }; Currently it is not possible to directly point to a DOS/GPR partition. We are still looking for solutions to this problem. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-13 14:50 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <1982917789.2703351.1497365376201.ref@mail.yahoo.com> 2017-06-13 14:49 ` How to use eMMC/SD DOS partitions as backend for the state framework? B Gol [not found] <1270235505.6719556.1497082449606.ref@mail.yahoo.com> 2017-06-10 8:14 ` B Gol 2017-06-13 7:34 ` Sascha Hauer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox