]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - arch/x86/lib/bootm.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[karo-tx-uboot.git] / arch / x86 / lib / bootm.c
index ba3875b1bc7e1d362947790809ab4796631146ad..ff158dd6a9d940c823bfc59059ce6151bc60d675 100644 (file)
@@ -5,46 +5,35 @@
  *
  * Copyright (C) 2001  Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <command.h>
 #include <image.h>
 #include <u-boot/zlib.h>
+#include <asm/bootparam.h>
 #include <asm/byteorder.h>
 #include <asm/zimage.h>
 
+#define COMMAND_LINE_OFFSET 0x9000
+
 /*cmd_boot.c*/
 int do_bootm_linux(int flag, int argc, char * const argv[],
                bootm_headers_t *images)
 {
-       void            *base_ptr = NULL;
-       ulong           os_data, os_len;
-       image_header_t  *hdr;
-       void            *load_address;
+       struct boot_params *base_ptr = NULL;
+       ulong os_data, os_len;
+       image_header_t *hdr;
+       void *load_address;
 
 #if defined(CONFIG_FIT)
        const void      *data;
        size_t          len;
 #endif
 
+       if (flag & BOOTM_STATE_OS_PREP)
+               return 0;
        if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
                return 1;
 
@@ -60,6 +49,8 @@ int do_bootm_linux(int flag, int argc, char * const argv[],
                }
 #if defined(CONFIG_FIT)
        } else if (images->fit_uname_os) {
+               int ret;
+
                ret = fit_image_get_data(images->fit_hdr_os,
                                        images->fit_noffset_os, &data, &len);
                if (ret) {
@@ -75,24 +66,20 @@ int do_bootm_linux(int flag, int argc, char * const argv[],
        }
 
 #ifdef CONFIG_CMD_ZBOOT
-       base_ptr = load_zimage((void *)os_data, os_len,
-                       images->rd_start, images->rd_end - images->rd_start,
-                       0, &load_address);
+       base_ptr = load_zimage((void *)os_data, os_len, &load_address);
 #endif
 
        if (NULL == base_ptr) {
                printf("## Kernel loading failed ...\n");
                goto error;
-
        }
 
-#ifdef DEBUG
-       printf("## Transferring control to Linux (at address %08x) ...\n",
-               (u32)base_ptr);
-#endif
-
-       /* we assume that the kernel is in place */
-       printf("\nStarting kernel ...\n\n");
+       if (setup_zimage(base_ptr, (char *)base_ptr + COMMAND_LINE_OFFSET,
+                       0, images->rd_start,
+                       images->rd_end - images->rd_start)) {
+               printf("## Setting up boot parameters failed ...\n");
+               goto error;
+       }
 
        boot_zimage(base_ptr, load_address);
        /* does not return */