9
0
Fork 0

include: Move bulk of boot.h to bootm.h

The majority of the stuff currently in include/boot.h is about bootm
code implemented common/bootm.c. To be more consistent move it to a
new file include/bootm.h.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2016-07-20 08:04:11 +02:00
parent cb47ddee1b
commit 4d85cb974a
17 changed files with 141 additions and 130 deletions

View File

@ -9,8 +9,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <boot.h>
#include <common.h>
#include <asm/setup.h>
#include "archos_features.h"
#include "feature_list.h"

View File

@ -1,3 +1,4 @@
#include <bootm.h>
#include <boot.h>
#include <common.h>
#include <command.h>

View File

@ -15,7 +15,7 @@
#include <common.h>
#include <bootsource.h>
#include <envfs.h>
#include <boot.h>
#include <bootm.h>
#include <init.h>
#include <io.h>
#include <fs.h>

View File

@ -33,6 +33,7 @@
#include <errno.h>
#include <init.h>
#include <boot.h>
#include <bootm.h>
#define CMD_LINE_ADDR 0xFF900000 /* L1 scratchpad */

View File

@ -31,6 +31,7 @@
#include <string.h>
#include <linux/err.h>
#include <boot.h>
#include <bootm.h>
#include <fs.h>
#include <libfile.h>
#include <binfmt.h>

View File

@ -1,4 +1,5 @@
#include <boot.h>
#include <bootm.h>
#include <common.h>
#include <libfile.h>
#include <malloc.h>

View File

@ -27,6 +27,7 @@
#include <environment.h>
#include <init.h>
#include <boot.h>
#include <bootm.h>
#include <errno.h>
#include <asm/cache.h>

View File

@ -9,6 +9,7 @@
#include <asm/bitops.h>
#include <asm/processor.h>
#include <boot.h>
#include <bootm.h>
#include <errno.h>
#include <restart.h>
#include <fs.h>

View File

@ -23,7 +23,7 @@
#include <libgen.h>
#include <malloc.h>
#include <clock.h>
#include <boot.h>
#include <bootm.h>
#include <glob.h>
#include <init.h>
#include <menu.h>

View File

@ -32,7 +32,7 @@
#include <fcntl.h>
#include <fs.h>
#include <errno.h>
#include <boot.h>
#include <bootm.h>
#include <of.h>
#include <rtc.h>
#include <init.h>

View File

@ -24,7 +24,7 @@
#include <libfile.h>
#include <libbb.h>
#include <init.h>
#include <boot.h>
#include <bootm.h>
#include <net.h>
#include <fs.h>
#include <of.h>

View File

@ -12,7 +12,7 @@
*/
#include <common.h>
#include <boot.h>
#include <bootm.h>
#include <fs.h>
#include <malloc.h>
#include <memory.h>
@ -20,6 +20,7 @@
#include <image-fit.h>
#include <globalvar.h>
#include <init.h>
#include <environment.h>
#include <linux/stat.h>
#include <magicvar.h>

View File

@ -20,7 +20,7 @@
#define pr_fmt(fmt) "FIT: " fmt
#include <common.h>
#include <init.h>
#include <boot.h>
#include <bootm.h>
#include <libfile.h>
#include <fdt.h>
#include <digest.h>

View File

@ -25,7 +25,7 @@
#include <ioctl.h>
#include <libbb.h>
#include <bbu.h>
#include <boot.h>
#include <bootm.h>
#include <dma.h>
#include <fs.h>
#include <libfile.h>

View File

@ -1,115 +1,9 @@
#ifndef __BOOT_H
#define __BOOT_H
#include <image.h>
#include <filetype.h>
#include <of.h>
#include <linux/list.h>
#include <environment.h>
enum bootm_verify {
BOOTM_VERIFY_NONE,
BOOTM_VERIFY_HASH,
BOOTM_VERIFY_SIGNATURE,
BOOTM_VERIFY_AVAILABLE,
};
struct bootm_data {
const char *os_file;
const char *initrd_file;
const char *oftree_file;
int verbose;
enum bootm_verify verify;
bool force;
bool dryrun;
/*
* appendroot - if true, try to add a suitable root= Kernel option to
* mount the rootfs from the same device as the Kernel comes from.
*/
bool appendroot;
unsigned long initrd_address;
unsigned long os_address;
unsigned long os_entry;
};
int bootm_boot(struct bootm_data *data);
struct image_data {
/* simplest case. barebox has already loaded the os here */
struct resource *os_res;
/* if os is an uImage this will be provided */
struct uimage_handle *os;
/* if os is a FIT image this will be provided */
struct fit_handle *os_fit;
char *os_part;
/* otherwise only the filename will be provided */
char *os_file;
/*
* The address the user wants to load the os image to.
* May be UIMAGE_INVALID_ADDRESS to indicate that the
* user has not specified any address. In this case the
* handler may choose a suitable address
*/
unsigned long os_address;
/* entry point to the os. relative to the start of the image */
unsigned long os_entry;
/* if initrd is already loaded this resource will be !NULL */
struct resource *initrd_res;
/* if initrd is an uImage this will be provided */
struct uimage_handle *initrd;
char *initrd_part;
/* otherwise only the filename will be provided */
char *initrd_file;
unsigned long initrd_address;
char *oftree_file;
char *oftree_part;
struct device_node *of_root_node;
struct fdt_header *oftree;
struct resource *oftree_res;
enum bootm_verify verify;
int verbose;
int force;
int dryrun;
};
struct image_handler {
const char *name;
struct list_head list;
int ih_os;
enum filetype filetype;
int (*bootm)(struct image_data *data);
};
int register_image_handler(struct image_handler *handle);
#ifdef CONFIG_BOOTM_VERBOSE
static inline int bootm_verbose(struct image_data *data)
{
return data->verbose;
}
#else
static inline int bootm_verbose(struct image_data *data)
{
return 0;
}
#endif
#ifdef CONFIG_FLEXIBLE_BOOTARGS
const char *linux_bootargs_get(void);
int linux_bootargs_overwrite(const char *bootargs);
@ -125,18 +19,4 @@ static inline int linux_bootargs_overwrite(const char *bootargs)
}
#endif
void bootm_data_init_defaults(struct bootm_data *data);
int bootm_load_os(struct image_data *data, unsigned long load_address);
bool bootm_has_initrd(struct image_data *data);
int bootm_load_initrd(struct image_data *data, unsigned long load_address);
int bootm_load_devicetree(struct image_data *data, unsigned long load_address);
int bootm_get_os_size(struct image_data *data);
enum bootm_verify bootm_get_verify_mode(void);
#define UIMAGE_SOME_ADDRESS (UIMAGE_INVALID_ADDRESS - 1)
#endif /* __BOOT_H */

125
include/bootm.h Normal file
View File

@ -0,0 +1,125 @@
#ifndef __BOOTM_H
#define __BOOTM_H
#include <image.h>
#include <filetype.h>
#include <linux/list.h>
enum bootm_verify {
BOOTM_VERIFY_NONE,
BOOTM_VERIFY_HASH,
BOOTM_VERIFY_SIGNATURE,
BOOTM_VERIFY_AVAILABLE,
};
struct bootm_data {
const char *os_file;
const char *initrd_file;
const char *oftree_file;
int verbose;
enum bootm_verify verify;
bool force;
bool dryrun;
/*
* appendroot - if true, try to add a suitable root= Kernel option to
* mount the rootfs from the same device as the Kernel comes from.
*/
bool appendroot;
unsigned long initrd_address;
unsigned long os_address;
unsigned long os_entry;
};
int bootm_boot(struct bootm_data *data);
struct image_data {
/* simplest case. barebox has already loaded the os here */
struct resource *os_res;
/* if os is an uImage this will be provided */
struct uimage_handle *os;
/* if os is a FIT image this will be provided */
struct fit_handle *os_fit;
char *os_part;
/* otherwise only the filename will be provided */
char *os_file;
/*
* The address the user wants to load the os image to.
* May be UIMAGE_INVALID_ADDRESS to indicate that the
* user has not specified any address. In this case the
* handler may choose a suitable address
*/
unsigned long os_address;
/* entry point to the os. relative to the start of the image */
unsigned long os_entry;
/* if initrd is already loaded this resource will be !NULL */
struct resource *initrd_res;
/* if initrd is an uImage this will be provided */
struct uimage_handle *initrd;
char *initrd_part;
/* otherwise only the filename will be provided */
char *initrd_file;
unsigned long initrd_address;
char *oftree_file;
char *oftree_part;
struct device_node *of_root_node;
struct fdt_header *oftree;
struct resource *oftree_res;
enum bootm_verify verify;
int verbose;
int force;
int dryrun;
};
struct image_handler {
const char *name;
struct list_head list;
int ih_os;
enum filetype filetype;
int (*bootm)(struct image_data *data);
};
int register_image_handler(struct image_handler *handle);
#ifdef CONFIG_BOOTM_VERBOSE
static inline int bootm_verbose(struct image_data *data)
{
return data->verbose;
}
#else
static inline int bootm_verbose(struct image_data *data)
{
return 0;
}
#endif
void bootm_data_init_defaults(struct bootm_data *data);
int bootm_load_os(struct image_data *data, unsigned long load_address);
bool bootm_has_initrd(struct image_data *data);
int bootm_load_initrd(struct image_data *data, unsigned long load_address);
int bootm_load_devicetree(struct image_data *data, unsigned long load_address);
int bootm_get_os_size(struct image_data *data);
enum bootm_verify bootm_get_verify_mode(void);
#define UIMAGE_SOME_ADDRESS (UIMAGE_INVALID_ADDRESS - 1)
#endif /* __BOOTM_H */

View File

@ -19,7 +19,7 @@
#define __IMAGE_FIT_H__
#include <linux/types.h>
#include <boot.h>
#include <bootm.h>
struct fit_handle {
void *fit;