* flash barebox to NAND
@ 2019-10-23 9:39 Mihaita Ivascu
2019-10-23 10:27 ` Andreas Geisenhainer
2019-10-23 13:33 ` Sascha Hauer
0 siblings, 2 replies; 7+ messages in thread
From: Mihaita Ivascu @ 2019-10-23 9:39 UTC (permalink / raw)
To: barebox
Hello all,
I would like to know what possibilities do I have to flash a barebox
image to mtd partition from Linux?
Using ubifs commands does not work. the barebox will not boot so
probably additional info needs to be written except the barebox image
itself.
Thanks,
Mihaita
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: flash barebox to NAND
2019-10-23 9:39 flash barebox to NAND Mihaita Ivascu
@ 2019-10-23 10:27 ` Andreas Geisenhainer
2019-10-23 10:39 ` Mihaita Ivascu
2019-10-23 13:33 ` Sascha Hauer
1 sibling, 1 reply; 7+ messages in thread
From: Andreas Geisenhainer @ 2019-10-23 10:27 UTC (permalink / raw)
To: barebox; +Cc: Mihaita Ivascu
On 2019-10-23 11:39 a.m., Mihaita Ivascu wrote:
> Hello all,
>
> I would like to know what possibilities do I have to flash a barebox
> image to mtd partition from Linux?
> Using ubifs commands does not work. the barebox will not boot so
> probably additional info needs to be written except the barebox image
> itself.
I needed to flash updates to barebox from userspace myself and struggled
with a solution for a bit.
I'm doing three things:
1) get the correct /dev-device for barebox
2) use `flash_erase` on that device
3) use `nandwrite` to write the barebox_*.img onto the device
This works for me, and there's probably some documentation for this
around, but i do not recall where i found it anymore.
good luck
Andreas
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: flash barebox to NAND
2019-10-23 10:27 ` Andreas Geisenhainer
@ 2019-10-23 10:39 ` Mihaita Ivascu
0 siblings, 0 replies; 7+ messages in thread
From: Mihaita Ivascu @ 2019-10-23 10:39 UTC (permalink / raw)
To: Andreas Geisenhainer; +Cc: barebox
On Wed, Oct 23, 2019 at 12:27 PM Andreas Geisenhainer
<Andreas.Geisenhainer@atsonline.de> wrote:
>
> On 2019-10-23 11:39 a.m., Mihaita Ivascu wrote:
> > Hello all,
> >
> > I would like to know what possibilities do I have to flash a barebox
> > image to mtd partition from Linux?
> > Using ubifs commands does not work. the barebox will not boot so
> > probably additional info needs to be written except the barebox image
> > itself.
>
> I needed to flash updates to barebox from userspace myself and struggled
> with a solution for a bit.
>
> I'm doing three things:
>
> 1) get the correct /dev-device for barebox
> 2) use `flash_erase` on that device
> 3) use `nandwrite` to write the barebox_*.img onto the device
>
Thanks for your prompt reply. I already tried that but it won't
boot for me. Maybe additional info related to barebox env needs to be
written.
I am trying by sending UTP commands from MFGtools:
UTP: received command '$ flash_erase /dev/mtd0 0 0'
UTP: executing "flash_erase /dev/mtd0 0 0"
Erasing 128 Kibyte @ 39002e0000 -- -1 % compl[ 6.275463] utp_poll:
pass returned.
Erasing 128 Kibyte @ 64004e0000 -- -1 % complete
UTP: sending Success to kernel for command $ flash_erase /dev/mtd0 0 0.
UTP: received command 'send'
UTP: sending Success to kernel for command send.
UTP: received command '$ nandwrite -p /dev/mtd0 -p $FILE'
UTP: executing "nandwrite -p /dev/mtd0 -p $FILE"
Writing data to block 0 at offset 0x0
Writing data to block 1 at offset 0x20000
Writing data to block 2 at offset 0x40000
Writing data to block 3 at offset 0x60000
Writing data to block 4 at offset 0x80000
UTP: sending Success to kernel for command $ nandwrite -p /dev/mtd0 -p $FILE.
[ 6.823965] utp_poll: pass returned.
I am writing a barebox.bin using nandwrite but it seems the new
barebox(which is correct should boot) won't boot. So I am wondering if
the nandwrite command is enough?
I know nandwrite you can use it successfully for flashing roots or
kernel on mtd partition but maybe for the bootloader is not working
Thanks,
Mihaita
> This works for me, and there's probably some documentation for this
> around, but i do not recall where i found it anymore.
>
> good luck
> Andreas
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: flash barebox to NAND
2019-10-23 9:39 flash barebox to NAND Mihaita Ivascu
2019-10-23 10:27 ` Andreas Geisenhainer
@ 2019-10-23 13:33 ` Sascha Hauer
2019-10-23 13:47 ` Mihaita Ivascu
1 sibling, 1 reply; 7+ messages in thread
From: Sascha Hauer @ 2019-10-23 13:33 UTC (permalink / raw)
To: Mihaita Ivascu; +Cc: barebox
On Wed, Oct 23, 2019 at 11:39:00AM +0200, Mihaita Ivascu wrote:
> Hello all,
>
> I would like to know what possibilities do I have to flash a barebox
> image to mtd partition from Linux?
> Using ubifs commands does not work. the barebox will not boot so
> probably additional info needs to be written except the barebox image
> itself.
On i.MX a bootloader image can't be written to Nand directly. In barebox
you can update barebox with the barebox_update command which has support
for the special image format requirements of the i.MX6. I currently
don't know any userspace code that can do this, apart from mfgtools or
other tools from the NXP universe that I have never used. Somebody told
me he wanted to port the i.MX6 barebox update code to userspace, but
unfortunately I can't remember who it was and I can't find any pointers
to it.
Regards,
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] 7+ messages in thread
* Re: flash barebox to NAND
2019-10-23 13:33 ` Sascha Hauer
@ 2019-10-23 13:47 ` Mihaita Ivascu
2019-10-24 6:58 ` Sascha Hauer
0 siblings, 1 reply; 7+ messages in thread
From: Mihaita Ivascu @ 2019-10-23 13:47 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On Wed, Oct 23, 2019 at 3:33 PM Sascha Hauer <s.hauer@pengutronix.de> wrote:
>
> On Wed, Oct 23, 2019 at 11:39:00AM +0200, Mihaita Ivascu wrote:
> > Hello all,
> >
> > I would like to know what possibilities do I have to flash a barebox
> > image to mtd partition from Linux?
> > Using ubifs commands does not work. the barebox will not boot so
> > probably additional info needs to be written except the barebox image
> > itself.
>
> On i.MX a bootloader image can't be written to Nand directly. In barebox
> you can update barebox with the barebox_update command which has support
> for the special image format requirements of the i.MX6. I currently
> don't know any userspace code that can do this, apart from mfgtools or
> other tools from the NXP universe that I have never used. Somebody told
> me he wanted to port the i.MX6 barebox update code to userspace, but
> unfortunately I can't remember who it was and I can't find any pointers
> to it.
>
> Regards,
> Sascha
>
Thanks for your detailed answer.
so there is no way to update a barebox on NAND from Linux except
from the barebox itself(using barebox_update command) ?
Yes I am trying with mfgtools but no success. NXP does not support
barebox just u-boot and I was not successful on adding mfgtools/UTP
support in barebox.
And using the u-boot konbs-ng command for flashing bootloader to
NAND is faulty and the reason is documented in the NXP community.
Surely somebody from barebox community must have had the need before
to update the barebox otherway than using barebox_update from the
barebox itself.
Thanks,
Mihaita
> --
> 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] 7+ messages in thread
* Re: flash barebox to NAND
2019-10-23 13:47 ` Mihaita Ivascu
@ 2019-10-24 6:58 ` Sascha Hauer
2019-10-25 16:43 ` Mihaita Ivascu
0 siblings, 1 reply; 7+ messages in thread
From: Sascha Hauer @ 2019-10-24 6:58 UTC (permalink / raw)
To: Mihaita Ivascu; +Cc: barebox
On Wed, Oct 23, 2019 at 03:47:49PM +0200, Mihaita Ivascu wrote:
> On Wed, Oct 23, 2019 at 3:33 PM Sascha Hauer <s.hauer@pengutronix.de> wrote:
> >
> > On Wed, Oct 23, 2019 at 11:39:00AM +0200, Mihaita Ivascu wrote:
> > > Hello all,
> > >
> > > I would like to know what possibilities do I have to flash a barebox
> > > image to mtd partition from Linux?
> > > Using ubifs commands does not work. the barebox will not boot so
> > > probably additional info needs to be written except the barebox image
> > > itself.
> >
> > On i.MX a bootloader image can't be written to Nand directly. In barebox
> > you can update barebox with the barebox_update command which has support
> > for the special image format requirements of the i.MX6. I currently
> > don't know any userspace code that can do this, apart from mfgtools or
> > other tools from the NXP universe that I have never used. Somebody told
> > me he wanted to port the i.MX6 barebox update code to userspace, but
> > unfortunately I can't remember who it was and I can't find any pointers
> > to it.
> >
> > Regards,
> > Sascha
> >
>
> Thanks for your detailed answer.
> so there is no way to update a barebox on NAND from Linux except
> from the barebox itself(using barebox_update command) ?
> Yes I am trying with mfgtools but no success. NXP does not support
> barebox just u-boot and I was not successful on adding mfgtools/UTP
> support in barebox.
> And using the u-boot konbs-ng command for flashing bootloader to
> NAND is faulty and the reason is documented in the NXP community.
> Surely somebody from barebox community must have had the need before
> to update the barebox otherway than using barebox_update from the
> barebox itself.
One way to update barebox indirectly from Linux is to put the new
barebox image to some known place in the rootfs. Now in barebox
write a small script:
/env/init/bbu.sh:
#!/bin/sh
if [ -f /mnt/mmc0.0/boot/barebox-update.bin ]; then
barebox_update -y /mnt/mmc0.0/boot/barebox-update.bin
reset
fi
Then again under Linux delete that file when the running barebox version
(as read from the device tree or kernel commandline) matches the update
image.
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] 7+ messages in thread
* Re: flash barebox to NAND
2019-10-24 6:58 ` Sascha Hauer
@ 2019-10-25 16:43 ` Mihaita Ivascu
0 siblings, 0 replies; 7+ messages in thread
From: Mihaita Ivascu @ 2019-10-25 16:43 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On Thu, Oct 24, 2019 at 8:58 AM Sascha Hauer <s.hauer@pengutronix.de> wrote:
>
> On Wed, Oct 23, 2019 at 03:47:49PM +0200, Mihaita Ivascu wrote:
> > On Wed, Oct 23, 2019 at 3:33 PM Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > >
> > > On Wed, Oct 23, 2019 at 11:39:00AM +0200, Mihaita Ivascu wrote:
> > > > Hello all,
> > > >
> > > > I would like to know what possibilities do I have to flash a barebox
> > > > image to mtd partition from Linux?
> > > > Using ubifs commands does not work. the barebox will not boot so
> > > > probably additional info needs to be written except the barebox image
> > > > itself.
> > >
> > > On i.MX a bootloader image can't be written to Nand directly. In barebox
> > > you can update barebox with the barebox_update command which has support
> > > for the special image format requirements of the i.MX6. I currently
> > > don't know any userspace code that can do this, apart from mfgtools or
> > > other tools from the NXP universe that I have never used. Somebody told
> > > me he wanted to port the i.MX6 barebox update code to userspace, but
> > > unfortunately I can't remember who it was and I can't find any pointers
> > > to it.
> > >
> > > Regards,
> > > Sascha
> > >
> >
> > Thanks for your detailed answer.
> > so there is no way to update a barebox on NAND from Linux except
> > from the barebox itself(using barebox_update command) ?
> > Yes I am trying with mfgtools but no success. NXP does not support
> > barebox just u-boot and I was not successful on adding mfgtools/UTP
> > support in barebox.
> > And using the u-boot konbs-ng command for flashing bootloader to
> > NAND is faulty and the reason is documented in the NXP community.
> > Surely somebody from barebox community must have had the need before
> > to update the barebox otherway than using barebox_update from the
> > barebox itself.
>
> One way to update barebox indirectly from Linux is to put the new
> barebox image to some known place in the rootfs. Now in barebox
> write a small script:
>
> /env/init/bbu.sh:
>
> #!/bin/sh
>
> if [ -f /mnt/mmc0.0/boot/barebox-update.bin ]; then
> barebox_update -y /mnt/mmc0.0/boot/barebox-update.bin
> reset
> fi
>
> Then again under Linux delete that file when the running barebox version
> (as read from the device tree or kernel commandline) matches the update
> image.
>
> Sascha
Hello,
Thanks for the tip. In the meantime I am able to load a barebox
using MFTools in RAM and run it. So i can modify that barebox to
include a script that does this barebox_update
from the barebox that is loaded using MFGTools. My issue now is how do
I make barebox_update to read the barebox.bin which was written in
nand(in some mtd0 partition from Linux)
The problem is that I have no mmc or other mountable device in
barebox. Only the nand
So I don't know how I should access the nand partition from a
script in the barebox.
do you have any suggestion?
Thanks,
Mihaita
>
> --
> 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] 7+ messages in thread
end of thread, other threads:[~2019-10-25 16:43 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-23 9:39 flash barebox to NAND Mihaita Ivascu
2019-10-23 10:27 ` Andreas Geisenhainer
2019-10-23 10:39 ` Mihaita Ivascu
2019-10-23 13:33 ` Sascha Hauer
2019-10-23 13:47 ` Mihaita Ivascu
2019-10-24 6:58 ` Sascha Hauer
2019-10-25 16:43 ` Mihaita Ivascu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox