Thank you ..

Attaching latest patch with this mail.
1>taken boot_args maximum size to 256.
2>copied boot_args to loaders local memory and then passed to kernel.

Regards,
Sourav Punoriyar
Bazaar identity: Sourav Punoriyar <sourav.punoriyar@spunor>

On Sun, Mar 5, 2017 at 11:52 AM, Jakub Jermář <[email protected]> wrote:

> On 03/05/2017 02:21 PM, sourav punoriyar wrote:
> > 1>I forgot to make a copy in loader. I will make a copy in loader and
> > change the code accordingly. :-)
>
> Thanks.
>
> > 2> I did not find any size for bootargs env variable in uboot.
> >      It is dynamically allocating memory for the cmdline parameter
> > before passing.
>
> I see.
>
> > Do we have a malloc implementation in loader ?
> > i see something as balloc. i will check its usecase.
>
> No, there is no malloc in the loader. Some architectures (like ppc32 and
> sparc64) use balloc as a simple allocate-only allocator. The benefit is
> that the kernel understands these allocations so it will not overwrite
> the underlying memory.
>
> Even though you could theoretically use balloc on arm too, I think that
> would be an overkill. Simply add a static char[256] or so to the
> bootinfo and that should do the trick.
>
> ppc32 and sparc64 need to use balloc because they need to copy the
> entire open firmware tree which involves a lot of small allocations and
> is very dynamic in nature.
>
> Jakub
>
> _______________________________________________
> HelenOS-devel mailing list
> [email protected]
> http://lists.modry.cz/listinfo/helenos-devel
>



-- 
Regards,
Sourav Punoriyar
Bazaar identity: Sourav Punoriyar <sourav.punoriyar@spunor>
=== modified file 'boot/arch/arm32/include/main.h'
--- boot/arch/arm32/include/main.h	2013-03-24 14:55:36 +0000
+++ boot/arch/arm32/include/main.h	2017-03-05 17:02:19 +0000
@@ -94,7 +94,7 @@
 
 
 
-extern void bootstrap(void);
+extern void bootstrap(char *); 
 
 #endif
 

=== modified file 'boot/arch/arm32/include/types.h'
--- boot/arch/arm32/include/types.h	2012-04-02 15:52:07 +0000
+++ boot/arch/arm32/include/types.h	2017-03-06 05:02:53 +0000
@@ -39,6 +39,8 @@
 #define TASKMAP_MAX_RECORDS        32
 #define BOOTINFO_TASK_NAME_BUFLEN  32
 
+#define BOOT_ARGS_SIZE 256
+
 typedef uint32_t size_t;
 typedef uint32_t uintptr_t;
 
@@ -53,11 +55,14 @@
 	char name[BOOTINFO_TASK_NAME_BUFLEN];
 } task_t;
 
+
 typedef struct {
 	size_t cnt;
 	task_t tasks[TASKMAP_MAX_RECORDS];
+	char cmdline[BOOT_ARGS_SIZE];
 } bootinfo_t;
 
+
 #endif
 
 /** @}

=== modified file 'boot/arch/arm32/src/asm.S'
--- boot/arch/arm32/src/asm.S	2016-04-21 20:00:18 +0000
+++ boot/arch/arm32/src/asm.S	2017-03-05 17:05:49 +0000
@@ -33,6 +33,7 @@
 
 SYMBOL(start)
 	ldr sp, =boot_stack
+	mov r0,r3 
 	b bootstrap
 
 .section BOOTPT

=== modified file 'boot/arch/arm32/src/main.c'
--- boot/arch/arm32/src/main.c	2015-10-06 20:23:44 +0000
+++ boot/arch/arm32/src/main.c	2017-03-06 05:04:22 +0000
@@ -82,7 +82,8 @@
 
 static bootinfo_t bootinfo;
 
-void bootstrap(void)
+
+void bootstrap(char* boot_args)
 {
 	/* Enable MMU and caches */
 	mmu_start();
@@ -101,7 +102,8 @@
 		    components[i].start, components[i].name, components[i].inflated,
 		    components[i].size);
 	}
-	
+	str_cpy(bootinfo.cmdline, BOOT_ARGS_SIZE, boot_args);
+	printf(" %p : boot _args passed to kernel\n",bootinfo.cmdline);
 	void *dest[COMPONENTS];
 	size_t top = 0;
 	size_t cnt = 0;

=== modified file 'kernel/arch/arm32/include/arch/arch.h'
--- kernel/arch/arm32/include/arch/arch.h	2016-06-06 16:29:56 +0000
+++ kernel/arch/arm32/include/arch/arch.h	2017-03-06 05:06:22 +0000
@@ -41,8 +41,12 @@
 
 #define BOOTINFO_TASK_NAME_BUFLEN 32
 
+#define BOOT_ARGS_SIZE 256
+
 #include <typedefs.h>
 
+char boot_args[BOOT_ARGS_SIZE];
+
 typedef struct {
 	void *addr;
 	size_t size;
@@ -52,6 +56,7 @@
 typedef struct {
 	size_t cnt;
 	utask_t tasks[TASKMAP_MAX_RECORDS];
+	char bootargs[BOOT_ARGS_SIZE];
 } bootinfo_t;
 
 extern void arm32_pre_main(void *entry, bootinfo_t *bootinfo);

=== modified file 'kernel/arch/arm32/src/arm32.c'
--- kernel/arch/arm32/src/arm32.c	2016-06-06 16:29:56 +0000
+++ kernel/arch/arm32/src/arm32.c	2017-03-06 05:07:17 +0000
@@ -51,6 +51,7 @@
 #include <arch/ras.h>
 #include <sysinfo/sysinfo.h>
 
+
 static void arm32_pre_mm_init(void);
 static void arm32_post_mm_init(void);
 static void arm32_post_smp_init(void);
@@ -63,7 +64,7 @@
 
 arch_ops_t *arch_ops = &arm32_ops;
 
-
+extern char boot_args[BOOT_ARGS_SIZE];
 /** Performs arm32-specific initialization before main_bsp() is called. */
 void arm32_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo)
 {
@@ -77,6 +78,7 @@
 		    bootinfo->tasks[i].name);
 	}
 
+    str_cpy(boot_args, BOOT_ARGS_SIZE, bootinfo->bootargs);
 	/* Initialize machine_ops pointer. */
 	machine_ops_init();
 }

=== modified file 'kernel/generic/src/main/main.c'
--- kernel/generic/src/main/main.c	2016-12-26 20:02:04 +0000
+++ kernel/generic/src/main/main.c	2017-03-06 05:08:31 +0000
@@ -205,6 +205,7 @@
 	/* not reached */
 }
 
+extern char boot_args[BOOT_ARGS_SIZE];
 /** Main kernel routine for bootstrap CPU using new stack.
  *
  * Second part of main_bsp().
@@ -217,6 +218,7 @@
 	
 	version_print();
 	
+	printf("bootargs kernel : [%s] \n",boot_args);
 	LOG("\nconfig.base=%p config.kernel_size=%zu"
 	    "\nconfig.stack_base=%p config.stack_size=%zu",
 	    (void *) config.base, config.kernel_size,

_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/listinfo/helenos-devel

Reply via email to