summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorJuergen Beisert <jbe@isonoe.(none)>2007-10-19 11:58:33 +0200
committerJuergen Beisert <jbe@isonoe.(none)>2007-10-19 11:58:33 +0200
commit6ad2703e6e7779fd1d2d7295443d04cecaef56e8 (patch)
tree5780f4707616c154c4e698050485bf9a8c1d7981 /common
parentc616179204072ba3dcf1e31aa2029fa6c2de3efe (diff)
parent95db50e812816127caf570449205a80cd626c263 (diff)
downloadbarebox-6ad2703e6e7779fd1d2d7295443d04cecaef56e8.tar.gz
barebox-6ad2703e6e7779fd1d2d7295443d04cecaef56e8.tar.xz
Merge branch 'master' of jbe@octopus:/home/git/projects/u-boot-v2
Diffstat (limited to 'common')
-rw-r--r--common/console.c21
-rw-r--r--common/partition.c11
-rw-r--r--common/startup.c24
3 files changed, 32 insertions, 24 deletions
diff --git a/common/console.c b/common/console.c
index 3868bfab1b..80f8cdb890 100644
--- a/common/console.c
+++ b/common/console.c
@@ -35,6 +35,7 @@
#include <kfifo.h>
#include <module.h>
#include <list.h>
+#include <linux/utsrelease.h>
LIST_HEAD(console_list);
EXPORT_SYMBOL(console_list);
@@ -43,6 +44,15 @@ EXPORT_SYMBOL(console_list);
#define CONSOLE_INIT_EARLY 1
#define CONSOLE_INIT_FULL 2
+const char version_string[] =
+ "U-Boot " UTS_RELEASE " (" __DATE__ " - " __TIME__ ")";
+
+static void display_banner (void)
+{
+ printf (RELOC("\n\n%s\n\n"), RELOC_VAR(version_string));
+ printf(RELOC("Board: " CONFIG_BOARDINFO "\n"));
+}
+
static int __initdata initialized = 0;
static int console_std_set(struct device_d *dev, struct param_d *param,
@@ -98,6 +108,7 @@ static int console_baudrate_set(struct device_d *dev, struct param_d *param,
int console_register(struct console_device *newcdev)
{
struct device_d *dev = newcdev->dev;
+ int first = 0;
if (newcdev->setbrg) {
newcdev->baudrate_param.set = console_baudrate_set;
@@ -120,12 +131,19 @@ int console_register(struct console_device *newcdev)
console_std_set(dev, &newcdev->active_param, "ioe");
#endif
#ifdef CONFIG_CONSOLE_ACTIVATE_FIRST
- if (list_empty(&console_list))
+ if (list_empty(&console_list)) {
+ first = 1;
console_std_set(dev, &newcdev->active_param, "ioe");
+ }
#endif
list_add_tail(&newcdev->list, &console_list);
+#ifndef CONFIG_HAS_EARLY_INIT
+ if (first)
+ display_banner();
+#endif
+
return 0;
}
EXPORT_SYMBOL(console_register);
@@ -358,6 +376,7 @@ void early_console_start(const char *name, int baudrate)
early_console_init(base, baudrate);
INITDATA(initialized) = CONSOLE_INIT_EARLY;
INITDATA(early_console_base) = base;
+ display_banner();
}
}
diff --git a/common/partition.c b/common/partition.c
index 20fef58842..69b269e34f 100644
--- a/common/partition.c
+++ b/common/partition.c
@@ -33,7 +33,8 @@
#include <partition.h>
#include <xfuncs.h>
-struct device_d *dev_add_partition(struct device_d *dev, unsigned long offset, size_t size, char *name)
+struct device_d *dev_add_partition(struct device_d *dev, unsigned long offset,
+ size_t size, int flags, const char *name)
{
struct partition *part;
@@ -50,8 +51,10 @@ struct device_d *dev_add_partition(struct device_d *dev, unsigned long offset, s
part->offset = offset;
part->physdev = dev;
+ part->flags = flags;
register_device(&part->device);
+ dev_add_child(dev, &part->device);
if (part->device.driver)
return &part->device;
@@ -107,15 +110,17 @@ static ssize_t part_write(struct device_d *dev, const void *buf, size_t count, u
{
struct partition *part = dev->type_data;
- if (part->readonly)
- return -EROFS;
+ if (part->flags & PARTITION_READONLY)
+ return -EROFS;
else
return dev_write(part->physdev, buf, count, offset + part->offset, flags);
}
static int part_probe(struct device_d *dev)
{
+#ifdef DEBUG
struct partition *part = dev->type_data;
+#endif
debug("registering partition %s on device %s (size=0x%08x, name=%s)\n",
dev->id, part->physdev->id, dev->size, part->name);
diff --git a/common/startup.c b/common/startup.c
index bdd20ec43d..49d758bd98 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -29,7 +29,6 @@
#include <init.h>
#include <command.h>
#include <malloc.h>
-#include <linux/utsrelease.h>
#include <mem_malloc.h>
#include <debug_ll.h>
#include <fs.h>
@@ -37,22 +36,9 @@
#include <environment.h>
#include <reloc.h>
-#ifndef CONFIG_IDENT_STRING
-#define CONFIG_IDENT_STRING ""
-#endif
-
extern initcall_t __u_boot_initcalls_start[], __u_boot_early_initcalls_end[],
__u_boot_initcalls_end[];
-const char version_string[] =
- "U-Boot " UTS_RELEASE " (" __DATE__ " - " __TIME__ ")"CONFIG_IDENT_STRING;
-
-static void display_banner (void)
-{
- printf (RELOC("\n\n%s\n\n"), RELOC_VAR(version_string));
- printf(RELOC("Board: " CONFIG_BOARDINFO "\n"));
-}
-
static void display_meminfo(void)
{
ulong mstart = mem_malloc_start();
@@ -79,8 +65,6 @@ void early_init (void)
(ulong)&__early_init_data_end -
(ulong)&__early_init_data_begin);
early_console_start(RELOC("psc3"), 115200);
-
- display_banner();
}
#endif /* CONFIG_HAS_EARLY_INIT */
@@ -130,9 +114,6 @@ void start_uboot (void)
hang();
}
-#ifndef CONFIG_HAS_EARLY_INIT
- display_banner();
-#endif
display_meminfo();
register_default_env();
@@ -150,9 +131,12 @@ void start_uboot (void)
#endif
}
#endif
+ printf("running /env/bin/init...\n");
+
if (!stat("/env/bin/init", &s)) {
- printf("running /env/bin/init\n");
run_command("source /env/bin/init", 0);
+ } else {
+ printf("not found\n");
}
/* main_loop() can return to retry autoboot, if so just run it again. */