Merge tag 'printk-for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/printk...
[linux-2.6-microblaze.git] / init / main.c
index 20baced..6feee7f 100644 (file)
@@ -58,7 +58,6 @@
 #include <linux/rmap.h>
 #include <linux/mempolicy.h>
 #include <linux/key.h>
-#include <linux/buffer_head.h>
 #include <linux/page_ext.h>
 #include <linux/debug_locks.h>
 #include <linux/debugobjects.h>
@@ -288,8 +287,8 @@ static void * __init get_boot_config_from_initrd(u32 *_size, u32 *_csum)
 
 found:
        hdr = (u32 *)(data - 8);
-       size = hdr[0];
-       csum = hdr[1];
+       size = le32_to_cpu(hdr[0]);
+       csum = le32_to_cpu(hdr[1]);
 
        data = ((void *)hdr) - size;
        if ((unsigned long)data < initrd_start) {
@@ -825,9 +824,11 @@ static void __init mm_init(void)
         * bigger than MAX_ORDER unless SPARSEMEM.
         */
        page_ext_init_flatmem();
-       init_debug_pagealloc();
+       init_mem_debugging_and_hardening();
        report_meminit();
        mem_init();
+       /* page_owner must be initialized after buddy is ready */
+       page_ext_init_flatmem_late();
        kmem_cache_init();
        kmemleak_init();
        pgtable_init();
@@ -1034,7 +1035,6 @@ asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
        fork_init();
        proc_caches_init();
        uts_ns_init();
-       buffer_init();
        key_init();
        security_init();
        dbg_late_init();
@@ -1480,8 +1480,14 @@ void __init console_on_rootfs(void)
        struct file *file = filp_open("/dev/console", O_RDWR, 0);
 
        if (IS_ERR(file)) {
-               pr_err("Warning: unable to open an initial console.\n");
-               return;
+               pr_err("Warning: unable to open an initial console. Fallback to ttynull.\n");
+               register_ttynull_console();
+
+               file = filp_open("/dev/console", O_RDWR, 0);
+               if (IS_ERR(file)) {
+                       pr_err("Warning: Failed to add ttynull console. No stdin, stdout, and stderr for the init process!\n");
+                       return;
+               }
        }
        init_dup(file);
        init_dup(file);