* saveenv & erase with bad blocks present @ 2015-02-03 16:38 Boulais, Marc-Andre 2015-02-03 19:52 ` Uwe Kleine-König 2015-02-03 20:11 ` Sascha Hauer 0 siblings, 2 replies; 11+ messages in thread From: Boulais, Marc-Andre @ 2015-02-03 16:38 UTC (permalink / raw) To: barebox Hi, I have flashed Barebox-2015.02.0 on my omap4 setup (using the Barebox update command) and I am now trying to modify the environment from the Barebox prompt. I have modified the env/config file and I would like to save my changes to NAND. For this task, I call the "saveenv" command and I get this result: barebox@Phytec phyCORE-OMAP4460:/ saveenv saving environment saveenv: No space left on device The "devinfo" command indicates to me that the /dev/nand0.bareboxenv partition is 128 Kb. Just to be sure, I erase it and get the following error: barebox@Phytec phyCORE-OMAP4460:/ erase /dev/nand0.bareboxenv.bb nand: nand_erase_nand: attempt to erase a bad block at page 0x00000140 erase: I/O error So I guess I am a bit confused here. 1) Is "saveenv" the right command to save my changes to the environment ? 2) How can I erase a NAND partition that has bad blocks ? 3) Can bad blocks be marked by software or are they all marked by the manufacturer ? Many thanks, _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: saveenv & erase with bad blocks present 2015-02-03 16:38 saveenv & erase with bad blocks present Boulais, Marc-Andre @ 2015-02-03 19:52 ` Uwe Kleine-König 2015-02-03 20:11 ` Sascha Hauer 1 sibling, 0 replies; 11+ messages in thread From: Uwe Kleine-König @ 2015-02-03 19:52 UTC (permalink / raw) To: Boulais, Marc-Andre; +Cc: barebox Hello, On Tue, Feb 03, 2015 at 04:38:42PM +0000, Boulais, Marc-Andre wrote: > I have flashed Barebox-2015.02.0 on my omap4 setup (using the Barebox > update command) and I am now trying to modify the environment from the > Barebox prompt. I have modified the env/config file and I would like > to save my changes to NAND. > > For this task, I call the "saveenv" command and I get this result: > > barebox@Phytec phyCORE-OMAP4460:/ saveenv > saving environment > saveenv: No space left on device > > The "devinfo" command indicates to me that the /dev/nand0.bareboxenv partition is 128 Kb. > Just to be sure, I erase it and get the following error: What is the block size of your nand device? If your partition only consists of a single block and this one turns bad ... > barebox@Phytec phyCORE-OMAP4460:/ erase /dev/nand0.bareboxenv.bb > nand: nand_erase_nand: attempt to erase a bad block at page 0x00000140 > erase: I/O error I'm not sure why this error is printed, maybe erase must not be given a .bb partition? > So I guess I am a bit confused here. > 1) Is "saveenv" the right command to save my changes to the environment ? Yes > 2) How can I erase a NAND partition that has bad blocks ? It should be transparent to the user. I'd expect that erase does the right thing. > 3) Can bad blocks be marked by software or are they all marked by the manufacturer ? The initial set of bad blocks are (obviously) marked by the manufacturer. I don't know if barebox automatically marks blocks as bad, but Linux does for sure. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: saveenv & erase with bad blocks present 2015-02-03 16:38 saveenv & erase with bad blocks present Boulais, Marc-Andre 2015-02-03 19:52 ` Uwe Kleine-König @ 2015-02-03 20:11 ` Sascha Hauer 2015-02-03 20:44 ` Boulais, Marc-Andre 1 sibling, 1 reply; 11+ messages in thread From: Sascha Hauer @ 2015-02-03 20:11 UTC (permalink / raw) To: Boulais, Marc-Andre; +Cc: barebox On Tue, Feb 03, 2015 at 04:38:42PM +0000, Boulais, Marc-Andre wrote: > Hi, > I have flashed Barebox-2015.02.0 on my omap4 setup (using the Barebox update command) and I am now trying to modify the environment from the Barebox prompt. I have modified the env/config file and I would like to save my changes to NAND. > > For this task, I call the "saveenv" command and I get this result: > > barebox@Phytec phyCORE-OMAP4460:/ saveenv > saving environment > saveenv: No space left on device > > The "devinfo" command indicates to me that the /dev/nand0.bareboxenv partition is 128 Kb. > Just to be sure, I erase it and get the following error: > > barebox@Phytec phyCORE-OMAP4460:/ erase /dev/nand0.bareboxenv.bb > nand: nand_erase_nand: attempt to erase a bad block at page 0x00000140 > erase: I/O error > > So I guess I am a bit confused here. > 1) Is "saveenv" the right command to save my changes to the environment ? Yes. > 2) How can I erase a NAND partition that has bad blocks ? when erasing a .bb device (which you did above) should let barebox just skip the bad blocks. > 3) Can bad blocks be marked by software or are they all marked by the manufacturer ? You can mark blocks as bad using the 'nand' command. barebox tries to erase a bad block at page 0x140 which is 0x140 * 2048 = 0xa0000. In the device trees I see the environment partition starts at 0x100000. Could you tell me which config you built, post the startup messages from barebox and the output of 'ls -l dev/nand0*'? 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] 11+ messages in thread
* RE: saveenv & erase with bad blocks present 2015-02-03 20:11 ` Sascha Hauer @ 2015-02-03 20:44 ` Boulais, Marc-Andre 2015-02-05 10:16 ` Sascha Hauer 0 siblings, 1 reply; 11+ messages in thread From: Boulais, Marc-Andre @ 2015-02-03 20:44 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox [-- Attachment #1: Type: text/plain, Size: 5538 bytes --] Ok, here's the info: 1. My config: arch/arm/configs/phytec-phycore-omap4460_defconfig 2. Output of "ls -l dev/nand0*" barebox@Phytec phyCORE-OMAP4460:/ ls -l dev/nand0* crw------- 1064566784 dev/nand0.root.bb crw------- 1064566784 dev/nand0.root crw------- 4194304 dev/nand0.splash.bb crw------- 4194304 dev/nand0.splash crw------- 4194304 dev/nand0.kernel.bb crw------- 4194304 dev/nand0.kernel crw------- 0 dev/nand0.bareboxenv.bb crw------- 131072 dev/nand0.bareboxenv crw------- 524288 dev/nand0.barebox.bb crw------- 524288 dev/nand0.barebox crw------- 131072 dev/nand0.xload.bb crw------- 131072 dev/nand0.xload crw------- 1073610752 dev/nand0.bb crw------- 1073741824 dev/nand0 3. Barebox startup (MLO from Phytec + Barebox 2015.2.0): barebox 2012.10.0 #3 Wed Feb 27 19:58:34 EST 2013 Board: Phytec phyCORE pcm049 omap-hsmmc@mci0: registered as mci0 probe buswidth NAND device: Manufacturer ID: 0x2c, Chip ID: 0xb3 ( ), page size: 2048, OOB size: 64 Malloc space: 0x84000000 -> 0x85ffffff (size 32 MB) Stack space : 0x8f000000 -> 0x8f008000 (size 32 kB) booting from NAND barebox 2015.02.0 #1 Tue Feb 3 15:32:15 EST 2015 Board: Phytec phyCORE-OMAP4460 i2c-omap i2c-omap40: bus 0 rev0.11 at 100 kHz omap-hsmmc omap4-hsmmc0: registered as omap4-hsmmc0 mci0: detected SD card version 2.0 mci0: registered disk0 smc911x smc911x0: LAN911x identified, idrev: 0x92210000, generation: 4 mdio_bus: miibus0: probed eth0: got preset MAC address: 50:2d:f4:05:65:82 nand: ONFI param page 0 valid nand: ONFI flash detected nand: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xb3 (Micron MT29F8G16ADBDAH4), 1024MiB, page size: 2048, OOB size: 64 omap_fb omap_fb: HW-Revision 0x0040 0x0040 omap_fb omap_fb: registered malloc space: 0x8d000000 -> 0x8effffff (size 32 MiB) read: Directory not empty running /env/bin/init... BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed BCH decoding failed unable to read /dev/nand0.splash.bb splash: Out of memory Hit any key to stop autoboot: 0 booting kernel from /dev/nand0.kernel.bb /dev/nand0.kernel.bb: No such file or directory Unknown OS filetype (try -f) handler failed with: Invalid argument -----Original Message----- From: Sascha Hauer [mailto:s.hauer@pengutronix.de] Sent: February-03-15 3:12 PM To: Boulais, Marc-Andre Cc: barebox@lists.infradead.org Subject: Re: saveenv & erase with bad blocks present On Tue, Feb 03, 2015 at 04:38:42PM +0000, Boulais, Marc-Andre wrote: > Hi, > I have flashed Barebox-2015.02.0 on my omap4 setup (using the Barebox update command) and I am now trying to modify the environment from the Barebox prompt. I have modified the env/config file and I would like to save my changes to NAND. > > For this task, I call the "saveenv" command and I get this result: > > barebox@Phytec phyCORE-OMAP4460:/ saveenv saving environment > saveenv: No space left on device > > The "devinfo" command indicates to me that the /dev/nand0.bareboxenv partition is 128 Kb. > Just to be sure, I erase it and get the following error: > > barebox@Phytec phyCORE-OMAP4460:/ erase /dev/nand0.bareboxenv.bb > nand: nand_erase_nand: attempt to erase a bad block at page 0x00000140 > erase: I/O error > > So I guess I am a bit confused here. > 1) Is "saveenv" the right command to save my changes to the environment ? Yes. > 2) How can I erase a NAND partition that has bad blocks ? when erasing a .bb device (which you did above) should let barebox just skip the bad blocks. > 3) Can bad blocks be marked by software or are they all marked by the manufacturer ? You can mark blocks as bad using the 'nand' command. barebox tries to erase a bad block at page 0x140 which is 0x140 * 2048 = 0xa0000. In the device trees I see the environment partition starts at 0x100000. Could you tell me which config you built, post the startup messages from barebox and the output of 'ls -l dev/nand0*'? 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 | [-- Attachment #2: phytec-phycore-omap4460_defconfig --] [-- Type: application/octet-stream, Size: 1771 bytes --] CONFIG_ARCH_OMAP=y CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x80000 CONFIG_ARCH_OMAP4=y CONFIG_MACH_PCM049=y CONFIG_AEABI=y CONFIG_ARM_UNWIND=y CONFIG_MMU=y CONFIG_TEXT_BASE=0x8f000000 CONFIG_MALLOC_SIZE=0x2000000 CONFIG_KALLSYMS=y CONFIG_PROMPT="barebox> " CONFIG_LONGHELP=y CONFIG_GLOB=y CONFIG_HUSH_FANCY_PROMPT=y CONFIG_CMDLINE_EDITING=y CONFIG_AUTO_COMPLETE=y # CONFIG_TIMESTAMP is not set CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/phytec-phycore-omap4460/env" CONFIG_BAREBOXENV_TARGET=y CONFIG_BAREBOXCRC32_TARGET=y CONFIG_CMD_EDIT=y CONFIG_CMD_SLEEP=y CONFIG_CMD_SAVEENV=y CONFIG_CMD_EXPORT=y CONFIG_CMD_PRINTENV=y CONFIG_CMD_READLINE=y CONFIG_CMD_TIME=y CONFIG_CMD_AUTOMOUNT=y CONFIG_CMD_TFTP=y CONFIG_CMD_ECHO_E=y CONFIG_CMD_LOADB=y CONFIG_CMD_IOMEM=y CONFIG_CMD_FLASH=y CONFIG_CMD_BOOTM_SHOW_TYPE=y CONFIG_CMD_BOOTM_VERBOSE=y CONFIG_CMD_BOOTM_INITRD=y CONFIG_CMD_BOOTM_OFTREE=y CONFIG_CMD_BOOTM_OFTREE_UIMAGE=y CONFIG_CMD_UIMAGE=y # CONFIG_CMD_BOOTU is not set CONFIG_CMD_RESET=y CONFIG_CMD_GO=y CONFIG_CMD_SPLASH=y CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y CONFIG_CMD_MAGICVAR=y CONFIG_CMD_MAGICVAR_HELP=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_NET=y CONFIG_CMD_DHCP=y CONFIG_NET_NFS=y CONFIG_CMD_PING=y CONFIG_DRIVER_SERIAL_NS16550=y CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y CONFIG_SMSC_PHY=y CONFIG_DRIVER_NET_SMC911X=y # CONFIG_SPI is not set CONFIG_I2C=y CONFIG_I2C_OMAP=y CONFIG_MTD=y CONFIG_NAND=y CONFIG_NAND_OMAP_GPMC=y CONFIG_UBI=y CONFIG_USB_HOST=y CONFIG_VIDEO=y CONFIG_DRIVER_VIDEO_OMAP=y CONFIG_IMAGE_RENDERER=y CONFIG_BMP=y CONFIG_MCI=y CONFIG_MCI_STARTUP=y CONFIG_MCI_OMAP_HSMMC=y CONFIG_MFD_TWL6030=y CONFIG_FS_TFTP=y CONFIG_FS_FAT=y CONFIG_FS_FAT_WRITE=y CONFIG_FS_FAT_LFN=y CONFIG_LZO_DECOMPRESS=y [-- Attachment #3: Type: text/plain, Size: 149 bytes --] _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: saveenv & erase with bad blocks present 2015-02-03 20:44 ` Boulais, Marc-Andre @ 2015-02-05 10:16 ` Sascha Hauer 2015-02-05 19:09 ` Boulais, Marc-Andre 0 siblings, 1 reply; 11+ messages in thread From: Sascha Hauer @ 2015-02-05 10:16 UTC (permalink / raw) To: Boulais, Marc-Andre; +Cc: barebox Hi Marc-Andre, I found some bugs preventing your OMAP board from working correctly. I just sent some mtd patches to the list. Could you apply them and retest? If your board complains about bad blocks that weren't there last time that could be because of bugs in the Nand driver. In this case you should do a "nand0.erasebad=1" and erase /dev/nand0.barebox again. Since your flashed version does not work with the Nand correctly you should start the fixed version over network. Do you know how to do that? If you need further help please let me know. 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] 11+ messages in thread
* RE: saveenv & erase with bad blocks present 2015-02-05 10:16 ` Sascha Hauer @ 2015-02-05 19:09 ` Boulais, Marc-Andre 2015-02-05 21:23 ` Sascha Hauer 0 siblings, 1 reply; 11+ messages in thread From: Boulais, Marc-Andre @ 2015-02-05 19:09 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox Sascha, I have installed the patches and tried erasing the environment with the nand0.erasebad flag. I am now able to execute the erase command on the nand device bareboxenv.bb without errors but I noticed its length is set to zero length....and finally, command "saveenv" still fails. Here's my output: ... barebox@Phytec phyCORE-OMAP4460:/ ls -l /dev/nand* crw------- 1064566784 /dev/nand0.root.bb crw------- 1064566784 /dev/nand0.root crw------- 4194304 /dev/nand0.splash.bb crw------- 4194304 /dev/nand0.splash crw------- 4194304 /dev/nand0.kernel.bb crw------- 4194304 /dev/nand0.kernel crw------- 0 /dev/nand0.bareboxenv.bb <-------- This does not look good... crw------- 131072 /dev/nand0.bareboxenv crw------- 524288 /dev/nand0.barebox.bb crw------- 524288 /dev/nand0.barebox crw------- 131072 /dev/nand0.xload.bb crw------- 131072 /dev/nand0.xload cr-------- 33554432 /dev/nand_oob0 crw------- 1073610752 /dev/nand0.bb crw------- 1073741824 /dev/nand0 barebox@Phytec phyCORE-OMAP4460:/ unprotect /dev/nand0.bareboxenv.bb barebox@Phytec phyCORE-OMAP4460:/ nv nand0.erasebad=1 barebox@Phytec phyCORE-OMAP4460:/ erase /dev/nand0.bareboxenv.bb barebox@Phytec phyCORE-OMAP4460:/ loadenv -s -d loading environment from defaultenv barebox@Phytec phyCORE-OMAP4460:/ saveenv saving environment saveenv: No space left on device ... barebox@Phytec phyCORE-OMAP4460:/ md -w -s /dev/nand0.bareboxenv.bb barebox@Phytec phyCORE-OMAP4460:/ md -w -s /dev/nand0.bareboxenv BCH decoding failed read: error 74 .... So I don't have any more bad block errors....but that zero length bareboxenv.bb is puzzling me. I presume it should have a valid length like the other "bb" devices, right ? Do you think I should attempt deleting and recreating it ? I also have this " No renderer found for filetype UBI image" error in the startup messages, I am not sure it is related, but probably it's the next thing I need to figure out...I have included the startup messages right after my signature. Thanks for your help, Marc-Andre barebox 2015.02.0-dirty #4 Thu Feb 5 11:09:33 EST 2015 Board: Phytec phyCORE-OMAP4460 i2c-omap i2c-omap40: bus 0 rev0.11 at 100 kHz omap-hsmmc omap4-hsmmc0: registered as omap4-hsmmc0 mci0: detected SD card version 2.0 mci0: registered disk0 smc911x smc911x0: LAN911x identified, idrev: 0x92210000, generation: 4 mdio_bus: miibus0: probed eth0: got preset MAC address: 50:2d:f4:05:65:82 nand: ONFI param page 0 valid nand: ONFI flash detected nand: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xb3 (Micron MT29F8G16ADBDAH4), 1024MiB, page size: 2048, OOB size: 64 omap_fb omap_fb: HW-Revision 0x0040 0x0040 omap_fb omap_fb: registered malloc space: 0x8d000000 -> 0x8effffff (size 32 MiB) read: Directory not empty running /env/bin/init... set parameter: Invalid argument set parameter: Invalid argument No renderer found for filetype UBI image splash: No such file or directory Hit any key to stop autoboot: 3 barebox@Phytec phyCORE-OMAP4460:/ -----Original Message----- From: Sascha Hauer [mailto:s.hauer@pengutronix.de] Sent: February-05-15 5:17 AM To: Boulais, Marc-Andre Cc: barebox@lists.infradead.org Subject: Re: saveenv & erase with bad blocks present Hi Marc-Andre, I found some bugs preventing your OMAP board from working correctly. I just sent some mtd patches to the list. Could you apply them and retest? If your board complains about bad blocks that weren't there last time that could be because of bugs in the Nand driver. In this case you should do a "nand0.erasebad=1" and erase /dev/nand0.barebox again. Since your flashed version does not work with the Nand correctly you should start the fixed version over network. Do you know how to do that? If you need further help please let me know. 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] 11+ messages in thread
* Re: saveenv & erase with bad blocks present 2015-02-05 19:09 ` Boulais, Marc-Andre @ 2015-02-05 21:23 ` Sascha Hauer 2015-02-06 17:03 ` Boulais, Marc-Andre 0 siblings, 1 reply; 11+ messages in thread From: Sascha Hauer @ 2015-02-05 21:23 UTC (permalink / raw) To: Boulais, Marc-Andre; +Cc: barebox On Thu, Feb 05, 2015 at 07:09:51PM +0000, Boulais, Marc-Andre wrote: > Sascha, > I have installed the patches and tried erasing the environment with the nand0.erasebad flag. I am now able to execute the erase command on the nand device bareboxenv.bb without errors but I noticed its length is set to zero length....and finally, command "saveenv" still fails. Here's my output: > ... > barebox@Phytec phyCORE-OMAP4460:/ ls -l /dev/nand* > crw------- 1064566784 /dev/nand0.root.bb > crw------- 1064566784 /dev/nand0.root > crw------- 4194304 /dev/nand0.splash.bb > crw------- 4194304 /dev/nand0.splash > crw------- 4194304 /dev/nand0.kernel.bb > crw------- 4194304 /dev/nand0.kernel > crw------- 0 /dev/nand0.bareboxenv.bb <-------- This does not look good... This is because the nand bb driver calculates the usable size of the partition. Here the size is 0 because the block is marked as bad due to writing it with the erroneous nand driver. > crw------- 131072 /dev/nand0.bareboxenv > crw------- 524288 /dev/nand0.barebox.bb > crw------- 524288 /dev/nand0.barebox > crw------- 131072 /dev/nand0.xload.bb > crw------- 131072 /dev/nand0.xload > cr-------- 33554432 /dev/nand_oob0 > crw------- 1073610752 /dev/nand0.bb > crw------- 1073741824 /dev/nand0 > barebox@Phytec phyCORE-OMAP4460:/ unprotect /dev/nand0.bareboxenv.bb > barebox@Phytec phyCORE-OMAP4460:/ nv nand0.erasebad=1 Ok, now you can erase bad blocks, > barebox@Phytec phyCORE-OMAP4460:/ erase /dev/nand0.bareboxenv.bb but the bb device skip the bad blocks, so this does effectively nothing. Use /dev/nand0.bareboxenv (without the bb) instead. Restart barebox afterwards so that the size of the bb device gets recalculated. > > I also have this " No renderer found for filetype UBI image" error in > the startup messages, I am not sure it is related, but probably it's > the next thing I need to figure out...I have included the startup > messages right after my signature. The phycore startup script contains a splash command which works directly on a Nand partition. For some reason this partition contains an mtd UBI image. This could be because you wrote it there or because the partition offsets are shifted so that the splash partition is now where your rootfs has been before. 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] 11+ messages in thread
* RE: saveenv & erase with bad blocks present 2015-02-05 21:23 ` Sascha Hauer @ 2015-02-06 17:03 ` Boulais, Marc-Andre 2015-02-09 7:18 ` Sascha Hauer 0 siblings, 1 reply; 11+ messages in thread From: Boulais, Marc-Andre @ 2015-02-06 17:03 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox Ok, I did erase the nand0.bareboxenv partition and after a reset, partition size for the env looks good: barebox@Phytec phyCORE-OMAP4460:/ ls /dev/nand0.bareboxenv* -l crw------- 131072 /dev/nand0.bareboxenv.bb crw------- 131072 /dev/nand0.bareboxenv barebox@Phytec phyCORE-OMAP4460:/ loadenv -d -s loading environment from defaultenv barebox@Phytec phyCORE-OMAP4460:/ saveenv saving environment So I can now save the environment without errors. But if I edit the config file and then do "saveenv" and then I reset, my changes are not there anymore as if the saveenv didn't work. Furthermore, I have this message " wrong crc on env superblock" that appears in the boot output... What do you think ? Thanks for your help, Marc-Andre barebox 2015.02.0-dirty #6 Fri Feb 6 11:44:51 EST 2015 Board: Phytec phyCORE-OMAP4460 i2c-omap i2c-omap40: bus 0 rev0.11 at 100 kHz omap-hsmmc omap4-hsmmc0: registered as omap4-hsmmc0 mci0: detected SD card version 2.0 mci0: registered disk0 smc911x smc911x0: LAN911x identified, idrev: 0x92210000, generation: 4 mdio_bus: miibus0: probed eth0: got preset MAC address: 50:2d:f4:05:65:82 nand: ONFI param page 0 valid nand: ONFI flash detected nand: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xb3 (Micron MT29F8G16ADBDAH4), 1024MiB, page size: 2048, OOB size: 64 omap_fb omap_fb: HW-Revision 0x0040 0x0040 omap_fb omap_fb: registered malloc space: 0x8d000000 -> 0x8effffff (size 32 MiB) BCH decoding failed wrong crc on env superblock running /env/bin/init... -----Original Message----- From: Sascha Hauer [mailto:s.hauer@pengutronix.de] Sent: February-05-15 4:24 PM To: Boulais, Marc-Andre Cc: barebox@lists.infradead.org Subject: Re: saveenv & erase with bad blocks present On Thu, Feb 05, 2015 at 07:09:51PM +0000, Boulais, Marc-Andre wrote: > Sascha, > I have installed the patches and tried erasing the environment with the nand0.erasebad flag. I am now able to execute the erase command on the nand device bareboxenv.bb without errors but I noticed its length is set to zero length....and finally, command "saveenv" still fails. Here's my output: > ... > barebox@Phytec phyCORE-OMAP4460:/ ls -l /dev/nand* > crw------- 1064566784 /dev/nand0.root.bb > crw------- 1064566784 /dev/nand0.root > crw------- 4194304 /dev/nand0.splash.bb > crw------- 4194304 /dev/nand0.splash > crw------- 4194304 /dev/nand0.kernel.bb > crw------- 4194304 /dev/nand0.kernel > crw------- 0 /dev/nand0.bareboxenv.bb <-------- This does not look good... This is because the nand bb driver calculates the usable size of the partition. Here the size is 0 because the block is marked as bad due to writing it with the erroneous nand driver. > crw------- 131072 /dev/nand0.bareboxenv > crw------- 524288 /dev/nand0.barebox.bb > crw------- 524288 /dev/nand0.barebox > crw------- 131072 /dev/nand0.xload.bb > crw------- 131072 /dev/nand0.xload > cr-------- 33554432 /dev/nand_oob0 > crw------- 1073610752 /dev/nand0.bb > crw------- 1073741824 /dev/nand0 > barebox@Phytec phyCORE-OMAP4460:/ unprotect /dev/nand0.bareboxenv.bb > barebox@Phytec phyCORE-OMAP4460:/ nv nand0.erasebad=1 Ok, now you can erase bad blocks, > barebox@Phytec phyCORE-OMAP4460:/ erase /dev/nand0.bareboxenv.bb but the bb device skip the bad blocks, so this does effectively nothing. Use /dev/nand0.bareboxenv (without the bb) instead. Restart barebox afterwards so that the size of the bb device gets recalculated. > > I also have this " No renderer found for filetype UBI image" error in > the startup messages, I am not sure it is related, but probably it's > the next thing I need to figure out...I have included the startup > messages right after my signature. The phycore startup script contains a splash command which works directly on a Nand partition. For some reason this partition contains an mtd UBI image. This could be because you wrote it there or because the partition offsets are shifted so that the splash partition is now where your rootfs has been before. 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] 11+ messages in thread
* Re: saveenv & erase with bad blocks present 2015-02-06 17:03 ` Boulais, Marc-Andre @ 2015-02-09 7:18 ` Sascha Hauer 2015-02-09 13:37 ` Boulais, Marc-Andre 0 siblings, 1 reply; 11+ messages in thread From: Sascha Hauer @ 2015-02-09 7:18 UTC (permalink / raw) To: Boulais, Marc-Andre; +Cc: barebox On Fri, Feb 06, 2015 at 05:03:59PM +0000, Boulais, Marc-Andre wrote: > Ok, I did erase the nand0.bareboxenv partition and after a reset, partition size for the env looks good: > barebox@Phytec phyCORE-OMAP4460:/ ls /dev/nand0.bareboxenv* -l > crw------- 131072 /dev/nand0.bareboxenv.bb > crw------- 131072 /dev/nand0.bareboxenv > barebox@Phytec phyCORE-OMAP4460:/ loadenv -d -s > loading environment from defaultenv > barebox@Phytec phyCORE-OMAP4460:/ saveenv > saving environment > > So I can now save the environment without errors. But if I edit the config file and then do "saveenv" and then I reset, my changes are not there anymore as if the saveenv didn't work. > > Furthermore, I have this message " wrong crc on env superblock" that appears in the boot output... > What do you think ? I'll try to reproduce that tomorrow. Just to be sure: You applied the patches I posted to the list in the meantime. Is the barebox version flashed on your board the version with the patches applied or did you only start the fixed version second stage? 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] 11+ messages in thread
* RE: saveenv & erase with bad blocks present 2015-02-09 7:18 ` Sascha Hauer @ 2015-02-09 13:37 ` Boulais, Marc-Andre 2015-02-10 9:20 ` Sascha Hauer 0 siblings, 1 reply; 11+ messages in thread From: Boulais, Marc-Andre @ 2015-02-09 13:37 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox Hi Sascha, I start the patched/fixed version in second stage. My PCM049 board is programmed with Phytec's BSP Barebox 2013.06.0. Upon entering its prompt, I start v 15.02.0 with your patches using tftp and bootm commands. The "wrong crc on env superblock" message appears after I execute v15.02.0 with the bootm comand. It does not appear in the resident Barebox startup. Note: The first time I tried your patches, I had this error message: nand_erase_nand: attempt to erase a bad block at page [...] Since we were considering potential problems in the nand driver to cause a "false" bad block, I commented out the bad block check in function nand_erase_nand() (nand/nand_base.c): instr->state = MTD_ERASING; while (len) { #if 0 /* Check if we have a bad block, we do not erase bad blocks! */ if (!mtd->allow_erasebad && nand_block_checkbad(mtd, ((loff_t) page) << chip->page_shift, 0, allowbbt)) { pr_warn("%s: attempt to erase a bad block at page 0x%08x\n", __func__, page); instr->state = MTD_ERASE_FAILED; goto erase_exit; } #endif .... And then the erase operation appeared to have succeeded. After doing a reset and reloading Barebox v15.02.0, if I modify the environment and then execute "saveenv", my changes do not appear to ve saved if I do another reset...I am starting to think there was indeed a bad block in the bareboxenv NAND partition...I am checking with Phytec now. Marc-Andre -----Original Message----- From: Sascha Hauer [mailto:s.hauer@pengutronix.de] Sent: February-09-15 2:19 AM To: Boulais, Marc-Andre Cc: barebox@lists.infradead.org Subject: Re: saveenv & erase with bad blocks present On Fri, Feb 06, 2015 at 05:03:59PM +0000, Boulais, Marc-Andre wrote: > Ok, I did erase the nand0.bareboxenv partition and after a reset, partition size for the env looks good: > barebox@Phytec phyCORE-OMAP4460:/ ls /dev/nand0.bareboxenv* -l > crw------- 131072 /dev/nand0.bareboxenv.bb > crw------- 131072 /dev/nand0.bareboxenv > barebox@Phytec phyCORE-OMAP4460:/ loadenv -d -s loading environment > from defaultenv barebox@Phytec phyCORE-OMAP4460:/ saveenv saving > environment > > So I can now save the environment without errors. But if I edit the config file and then do "saveenv" and then I reset, my changes are not there anymore as if the saveenv didn't work. > > Furthermore, I have this message " wrong crc on env superblock" that appears in the boot output... > What do you think ? I'll try to reproduce that tomorrow. Just to be sure: You applied the patches I posted to the list in the meantime. Is the barebox version flashed on your board the version with the patches applied or did you only start the fixed version second stage? 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] 11+ messages in thread
* Re: saveenv & erase with bad blocks present 2015-02-09 13:37 ` Boulais, Marc-Andre @ 2015-02-10 9:20 ` Sascha Hauer 0 siblings, 0 replies; 11+ messages in thread From: Sascha Hauer @ 2015-02-10 9:20 UTC (permalink / raw) To: Boulais, Marc-Andre; +Cc: barebox Hi Marc-Andre, I just sent an updated series for the nand issues. With this I tested bootstrapping the board completly from SD card using the nand_bootstrap script. I also tested 'saveenv' successfully. On Mon, Feb 09, 2015 at 01:37:26PM +0000, Boulais, Marc-Andre wrote: > Hi Sascha, > I start the patched/fixed version in second stage. My PCM049 board is > programmed with Phytec's BSP Barebox 2013.06.0. Upon entering its > prompt, I start v 15.02.0 with your patches using tftp and bootm > commands. > > The "wrong crc on env superblock" message appears after I execute > v15.02.0 with the bootm comand. It does not appear in the resident > Barebox startup. > > Note: The first time I tried your patches, I had this error message: > nand_erase_nand: attempt to erase a bad block at page [...] > > Since we were considering potential problems in the nand driver to > cause a "false" bad block, I commented out the bad block check in > function nand_erase_nand() (nand/nand_base.c): > instr->state = MTD_ERASING; > > while (len) { > #if 0 > /* Check if we have a bad block, we do not erase bad blocks! */ > if (!mtd->allow_erasebad && > nand_block_checkbad(mtd, ((loff_t) page) << > chip->page_shift, 0, allowbbt)) { > pr_warn("%s: attempt to erase a bad block at page 0x%08x\n", > __func__, page); > instr->state = MTD_ERASE_FAILED; > goto erase_exit; > } > #endif The way to do this without sourcecode changes is to enable CONFIG_NAND_ALLOW_ERASE_BAD and do a 'nand0.erasebad=1' You should make sure to use a consistent barebox version state for both the MLO and the full barebox later. Unfortunately the ECC layout information and partition information of the NAND is stored in the bootloader binaries and not on the device. This makes for a good source of unpredictable errors. 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] 11+ messages in thread
end of thread, other threads:[~2015-02-10 9:20 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-02-03 16:38 saveenv & erase with bad blocks present Boulais, Marc-Andre 2015-02-03 19:52 ` Uwe Kleine-König 2015-02-03 20:11 ` Sascha Hauer 2015-02-03 20:44 ` Boulais, Marc-Andre 2015-02-05 10:16 ` Sascha Hauer 2015-02-05 19:09 ` Boulais, Marc-Andre 2015-02-05 21:23 ` Sascha Hauer 2015-02-06 17:03 ` Boulais, Marc-Andre 2015-02-09 7:18 ` Sascha Hauer 2015-02-09 13:37 ` Boulais, Marc-Andre 2015-02-10 9:20 ` Sascha Hauer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox