* [PATCH] Add /dev/urandom device.
@ 2012-07-19 8:33 Juergen Kilb
2012-07-19 8:33 ` [PATCH] add possibility to mark blocks as bad during write Juergen Kilb
2012-07-27 8:30 ` [PATCH] Add /dev/urandom device Sascha Hauer
0 siblings, 2 replies; 4+ messages in thread
From: Juergen Kilb @ 2012-07-19 8:33 UTC (permalink / raw)
To: barebox
Nice for testing purposes.
Signed-off-by: Juergen Kilb <J.Kilb@phytec.de>
---
commands/stddev.c | 39 +++++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/commands/stddev.c b/commands/stddev.c
index 098aea8..b807df6 100644
--- a/commands/stddev.c
+++ b/commands/stddev.c
@@ -20,7 +20,9 @@
*/
#include <common.h>
+#include <clock.h>
#include <init.h>
+#include <stdlib.h>
static ssize_t zero_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags)
{
@@ -104,3 +106,40 @@ static int null_init(void)
}
device_initcall(null_init);
+
+static ssize_t urandom_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags)
+{
+ size_t i;
+ unsigned int *buffer;
+
+ buffer = (unsigned int *) buf;
+
+ for (i = 0; i < (count / sizeof(size_t)); i++)
+ buffer[i] = rand() | rand() << 16;
+
+ return count;
+}
+
+static struct file_operations urandomops = {
+ .read = urandom_read,
+ .lseek = dev_lseek_default,
+};
+
+static int urandom_init(void)
+{
+ struct cdev *cdev;
+
+ cdev = xzalloc(sizeof(*cdev));
+
+ cdev->name = "urandom";
+ cdev->size = ~0;
+ cdev->ops = &urandomops;
+
+ devfs_create(cdev);
+
+ srand(get_time_ns());
+
+ return 0;
+}
+
+device_initcall(urandom_init);
--
1.7.0.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] add possibility to mark blocks as bad during write
2012-07-19 8:33 [PATCH] Add /dev/urandom device Juergen Kilb
@ 2012-07-19 8:33 ` Juergen Kilb
2012-07-19 14:14 ` Jean-Christophe PLAGNIOL-VILLARD
2012-07-27 8:30 ` [PATCH] Add /dev/urandom device Sascha Hauer
1 sibling, 1 reply; 4+ messages in thread
From: Juergen Kilb @ 2012-07-19 8:33 UTC (permalink / raw)
To: barebox
and update phyCARD-A-L1 defaultconfig to use this
feature.
Signed-off-by: Juergen Kilb <J.Kilb@phytec.de>
---
arch/arm/configs/phycard_a_l1_defconfig | 122 ++-----------------------------
drivers/mtd/nand/Kconfig | 10 +++
drivers/mtd/nand/nand-bb.c | 15 ++++-
3 files changed, 31 insertions(+), 116 deletions(-)
diff --git a/arch/arm/configs/phycard_a_l1_defconfig b/arch/arm/configs/phycard_a_l1_defconfig
index cf980f7..df0b5a5 100644
--- a/arch/arm/configs/phycard_a_l1_defconfig
+++ b/arch/arm/configs/phycard_a_l1_defconfig
@@ -1,105 +1,33 @@
-CONFIG_GENERIC_LINKER_SCRIPT=y
-CONFIG_ARM=y
-CONFIG_ARM_LINUX=y
CONFIG_ARCH_OMAP=y
-CONFIG_CPU_32=y
-CONFIG_CPU_V7=y
-CONFIG_CPU_32v7=y
-CONFIG_BOARDINFO="Phytec phyCARD-A-L1"
-CONFIG_ARCH_OMAP3=y
-CONFIG_OMAP_CLOCK_ALL=y
-CONFIG_OMAP_CLOCK_SOURCE_S32K=y
-CONFIG_OMAP3_CLOCK_CONFIG=y
-CONFIG_OMAP3_COPY_CLOCK_SRAM=n
-CONFIG_OMAP_GPMC=y
CONFIG_MACH_PCAAL1=y
CONFIG_AEABI=y
-CONFIG_CMD_ARM_CPUINFO=y
-CONFIG_ARM_EXCEPTIONS=y
-CONFIG_DEFCONFIG_LIST="$ARCH_DEFCONFIG"
-CONFIG_GREGORIAN_CALENDER=y
-CONFIG_HAS_KALLSYMS=y
-CONFIG_HAS_MODULES=y
-CONFIG_CMD_MEMORY=y
-CONFIG_ENV_HANDLING=y
-CONFIG_GENERIC_GPIO=y
-CONFIG_BLOCK=y
-CONFIG_BLOCK_WRITE=y
-CONFIG_LOCALVERSION=""
-CONFIG_LOCALVERSION_AUTO=y
-CONFIG_ENVIRONMENT_VARIABLES=y
-CONFIG_HAVE_CONFIGURABLE_TEXT_BASE=y
CONFIG_TEXT_BASE=0x85000000
-CONFIG_HAVE_CONFIGURABLE_MEMORY_LAYOUT=y
-CONFIG_MEMORY_LAYOUT_DEFAULT=y
-CONFIG_STACK_SIZE=0x8000
CONFIG_MALLOC_SIZE=0x1000000
CONFIG_EXPERIMENTAL=y
-CONFIG_MALLOC_DLMALLOC=y
-CONFIG_MACH_HAS_LOWLEVEL_INIT=y
-CONFIG_MACH_DO_LOWLEVEL_INIT=y
-CONFIG_ARCH_HAS_LOWLEVEL_INIT=y
CONFIG_PROMPT="phyCARD-A-L1 >"
-CONFIG_BAUDRATE=115200
CONFIG_LONGHELP=y
-CONFIG_CBSIZE=1024
-CONFIG_MAXARGS=16
-CONFIG_SHELL_HUSH=y
-CONFIG_GLOB=y
-CONFIG_PROMPT_HUSH_PS2="> "
CONFIG_HUSH_FANCY_PROMPT=y
-CONFIG_HUSH_GETOPT=y
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
CONFIG_MENU=y
-CONFIG_PASSWORD=y
-CONFIG_PASSWD_SUM_MD5=y
-CONFIG_DYNAMIC_CRC_TABLE=y
-CONFIG_ERRNO_MESSAGES=y
-CONFIG_TIMESTAMP=y
-CONFIG_CONSOLE_FULL=y
-CONFIG_CONSOLE_ACTIVATE_FIRST=y
-CONFIG_PARTITION=y
-CONFIG_PARTITION_DISK=y
-CONFIG_PARTITION_DISK_DOS=y
-CONFIG_DEFAULT_ENVIRONMENT=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/phycard-a-l1/env"
-CONFIG_COMMAND_SUPPORT=y
CONFIG_CMD_EDIT=y
CONFIG_CMD_SLEEP=y
CONFIG_CMD_SAVEENV=y
-CONFIG_CMD_LOADENV=y
CONFIG_CMD_EXPORT=y
CONFIG_CMD_PRINTENV=y
CONFIG_CMD_READLINE=y
-CONFIG_CMD_TRUE=y
-CONFIG_CMD_FALSE=y
CONFIG_CMD_MENU=y
CONFIG_CMD_MENU_MANAGEMENT=y
-CONFIG_CMD_LOGIN=y
CONFIG_CMD_PASSWD=y
CONFIG_PASSWD_MODE_STAR=y
CONFIG_CMD_TIME=y
-CONFIG_CMD_LS=y
-CONFIG_CMD_RM=y
-CONFIG_CMD_CAT=y
-CONFIG_CMD_MKDIR=y
-CONFIG_CMD_RMDIR=y
-CONFIG_CMD_CP=y
-CONFIG_CMD_PWD=y
-CONFIG_CMD_CD=y
-CONFIG_CMD_MOUNT=y
-CONFIG_CMD_UMOUNT=y
-CONFIG_CMD_NAND=y
-CONFIG_CMD_CLEAR=y
-CONFIG_CMD_ECHO=y
CONFIG_CMD_ECHO_E=y
CONFIG_CMD_LOADB=y
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_IOMEM=y
-CONFIG_CMD_CRC=y
-CONFIG_CMD_CRC_CMP=y
-CONFIG_CMD_DIGEST=y
CONFIG_CMD_MD5SUM=y
CONFIG_CMD_SHA1SUM=y
CONFIG_CMD_SHA256SUM=y
@@ -107,22 +35,15 @@ CONFIG_CMD_SHA224SUM=y
CONFIG_CMD_MTEST=y
CONFIG_CMD_MTEST_ALTERNATIVE=y
CONFIG_CMD_FLASH=y
-CONFIG_CMD_UBI=y
-CONFIG_CMD_BOOTM=y
CONFIG_CMD_BOOTM_SHOW_TYPE=y
-CONFIG_CMD_IMINFO=y
-CONFIG_CMD_BOOTZ=n
-CONFIG_CMD_BOOTU=n
+# CONFIG_CMD_BOOTZ is not set
+# CONFIG_CMD_BOOTU is not set
CONFIG_CMD_RESET=y
CONFIG_CMD_GO=y
CONFIG_CMD_TIMEOUT=y
CONFIG_CMD_PARTITION=y
-CONFIG_CMD_TEST=y
-CONFIG_CMD_VERSION=y
-CONFIG_CMD_HELP=y
CONFIG_CMD_MAGICVAR=y
CONFIG_CMD_MAGICVAR_HELP=y
-CONFIG_CMD_DEVINFO=y
CONFIG_CMD_UNCOMPRESS=y
CONFIG_NET=y
CONFIG_NET_DHCP=y
@@ -134,49 +55,20 @@ CONFIG_NET_NETCONSOLE=y
CONFIG_NET_RESOLV=y
CONFIG_DRIVER_SERIAL_NS16550=y
CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y
-CONFIG_MIIDEV=y
CONFIG_DRIVER_NET_SMC911X=y
-CONFIG_DRIVER_NET_SMC911X_ADDRESS_SHIFT=0
-CONFIG_SPI=n
+# CONFIG_SPI is not set
CONFIG_MTD=y
CONFIG_NAND=y
-CONFIG_NAND_WRITE=y
-CONFIG_NAND_ECC_SOFT=y
-CONFIG_NAND_ECC_HW=y
-CONFIG_NAND_ECC_HW_SYNDROME=y
-CONFIG_NAND_ECC_HW_NONE=y
-CONFIG_NAND_INFO=y
-CONFIG_NAND_READ_OOB=y
-CONFIG_NAND_BBT=y
-CONFIG_NAND_OOB_DEVICE=y
+CONFIG_NAND_MARK_BAD=y
CONFIG_NAND_OMAP_GPMC=y
-CONFIG_MTD_NAND_IDS=y
+CONFIG_MTD_NAND_VERIFY_WRITE=y
CONFIG_UBI=y
-CONFIG_DISK=y
-CONFIG_DISK_WRITE=y
-CONFIG_DISK_ATA=y
CONFIG_DISK_INTF_PLATFORM_IDE=y
CONFIG_MCI=y
-CONFIG_MCI_INFO=y
-CONFIG_MCI_WRITE=y
CONFIG_MCI_OMAP_HSMMC=y
CONFIG_FS_CRAMFS=y
-CONFIG_FS_RAMFS=y
-CONFIG_FS_DEVFS=y
CONFIG_FS_FAT=y
CONFIG_FS_FAT_WRITE=y
CONFIG_FS_FAT_LFN=y
-CONFIG_PARTITION_NEED_MTD=y
-CONFIG_ZLIB=y
CONFIG_BZLIB=y
-CONFIG_PROCESS_ESCAPE_SEQUENCE=y
CONFIG_LZO_DECOMPRESS=y
-CONFIG_FDT=y
-CONFIG_OFTREE=y
-CONFIG_CRC32=y
-CONFIG_CRC16=y
-CONFIG_DIGEST=y
-CONFIG_MD5=y
-CONFIG_SHA1=y
-CONFIG_SHA224=y
-CONFIG_SHA256=y
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 3f90643..e597c3e 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -48,6 +48,16 @@ config NAND_BBT
Say y here to include support for bad block tables. This speeds
up the process of checking for bad blocks
+config NAND_MARK_BAD
+ bool
+ default n
+ prompt "Support marking erronoues blocks as bad"
+ help
+ If an erase/write error occurs during copying data into a *.bb
+ partition, the block will be maked as bad.
+ Attention!! Use with caution,only when your NAND driver is known
+ to work correctly.
+
config NAND_IMX
bool
prompt "i.MX NAND driver"
diff --git a/drivers/mtd/nand/nand-bb.c b/drivers/mtd/nand/nand-bb.c
index 519337e..1cc21c3 100644
--- a/drivers/mtd/nand/nand-bb.c
+++ b/drivers/mtd/nand/nand-bb.c
@@ -112,8 +112,21 @@ static int nand_bb_write_buf(struct nand_bb *bb, size_t count)
now = min(count, (size_t)(bb->info.erasesize));
ret = cdev_write(parent, buf, now, cur_ofs, 0);
- if (ret < 0)
+ if (ret < 0) {
+#ifdef CONFIG_NAND_MARK_BAD
+ debug("marking bad block at 0x%08x\n", cur_ofs);
+ ret = cdev_ioctl(parent, MEMSETBADBLOCK, &cur_ofs);
+ if (ret < 0)
+ return ret;
+
+ bb->offset += bb->info.erasesize;
+ cur_ofs += bb->info.erasesize;
+ continue;
+#else
return ret;
+#endif
+ }
+
buf += now;
count -= now;
cur_ofs += now;
--
1.7.0.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] add possibility to mark blocks as bad during write
2012-07-19 8:33 ` [PATCH] add possibility to mark blocks as bad during write Juergen Kilb
@ 2012-07-19 14:14 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-07-19 14:14 UTC (permalink / raw)
To: Juergen Kilb; +Cc: barebox
On 10:33 Thu 19 Jul , Juergen Kilb wrote:
> and update phyCARD-A-L1 defaultconfig to use this
> feature.
>
need to be 2 patches
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add /dev/urandom device.
2012-07-19 8:33 [PATCH] Add /dev/urandom device Juergen Kilb
2012-07-19 8:33 ` [PATCH] add possibility to mark blocks as bad during write Juergen Kilb
@ 2012-07-27 8:30 ` Sascha Hauer
1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2012-07-27 8:30 UTC (permalink / raw)
To: Juergen Kilb; +Cc: barebox
On Thu, Jul 19, 2012 at 10:33:49AM +0200, Juergen Kilb wrote:
> Nice for testing purposes.
Can we have an extra file with an extra config option for this? I agree
this is nice for debugging, but no need to bloat every build with it.
Sascha
>
> Signed-off-by: Juergen Kilb <J.Kilb@phytec.de>
> ---
> commands/stddev.c | 39 +++++++++++++++++++++++++++++++++++++++
> 1 files changed, 39 insertions(+), 0 deletions(-)
>
> diff --git a/commands/stddev.c b/commands/stddev.c
> index 098aea8..b807df6 100644
> --- a/commands/stddev.c
> +++ b/commands/stddev.c
> @@ -20,7 +20,9 @@
> */
>
> #include <common.h>
> +#include <clock.h>
> #include <init.h>
> +#include <stdlib.h>
>
> static ssize_t zero_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags)
> {
> @@ -104,3 +106,40 @@ static int null_init(void)
> }
>
> device_initcall(null_init);
> +
> +static ssize_t urandom_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags)
> +{
> + size_t i;
> + unsigned int *buffer;
> +
> + buffer = (unsigned int *) buf;
> +
> + for (i = 0; i < (count / sizeof(size_t)); i++)
> + buffer[i] = rand() | rand() << 16;
> +
> + return count;
> +}
> +
> +static struct file_operations urandomops = {
> + .read = urandom_read,
> + .lseek = dev_lseek_default,
> +};
> +
> +static int urandom_init(void)
> +{
> + struct cdev *cdev;
> +
> + cdev = xzalloc(sizeof(*cdev));
> +
> + cdev->name = "urandom";
> + cdev->size = ~0;
> + cdev->ops = &urandomops;
> +
> + devfs_create(cdev);
> +
> + srand(get_time_ns());
> +
> + return 0;
> +}
> +
> +device_initcall(urandom_init);
> --
> 1.7.0.4
>
>
--
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] 4+ messages in thread
end of thread, other threads:[~2012-07-27 8:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-19 8:33 [PATCH] Add /dev/urandom device Juergen Kilb
2012-07-19 8:33 ` [PATCH] add possibility to mark blocks as bad during write Juergen Kilb
2012-07-19 14:14 ` Jean-Christophe PLAGNIOL-VILLARD
2012-07-27 8:30 ` [PATCH] Add /dev/urandom device Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox