static int bootm_init(void) { globalvar_add_simple("bootm.image", NULL); globalvar_add_simple("bootm.image.loadaddr", NULL); globalvar_add_simple("bootm.oftree", NULL); if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD)) { globalvar_add_simple("bootm.initrd", NULL); globalvar_add_simple("bootm.initrd.loadaddr", NULL); } return 0; }
static int beaglebone_devices_init(void) { int black; if (!of_machine_is_compatible("ti,am335x-bone")) return 0; if (bootsource_get() == BOOTSOURCE_MMC) { if (bootsource_get_instance() == 0) omap_set_bootmmc_devname("mmc0"); else omap_set_bootmmc_devname("mmc1"); } black = is_beaglebone_black(); defaultenv_append_directory(defaultenv_beaglebone); globalvar_add_simple("board.variant", black ? "boneblack" : "bone"); printf("detected 'BeagleBone %s'\n", black ? "Black" : "White"); armlinux_set_architecture(MACH_TYPE_BEAGLEBONE); return 0; }
static int beaglebone_devices_init(void) { int black; if (!of_machine_is_compatible("ti,am335x-bone")) return 0; if (bootsource_get() == BOOTSOURCE_MMC) { if (bootsource_get_instance() == 0) omap_set_bootmmc_devname("mmc0"); else omap_set_bootmmc_devname("mmc1"); } black = is_beaglebone_black(); defaultenv_append_directory(defaultenv_beaglebone); globalvar_add_simple("board.variant", black ? "boneblack" : "bone"); printf("detected 'BeagleBone %s'\n", black ? "Black" : "White"); armlinux_set_architecture(MACH_TYPE_BEAGLEBONE); /* Register update handler */ am33xx_bbu_emmc_mlo_register_handler("MLO.emmc", "/dev/mmc1"); if (IS_ENABLED(CONFIG_SHELL_NONE)) return am33xx_of_register_bootdevice(); return 0; }
/* * The hostname is supposed to be the shortname of a board. It should * contain only lowercase letters, numbers, '-', '_'. No whitespaces * allowed. */ void barebox_set_hostname(const char *__hostname) { if (IS_ENABLED(CONFIG_GLOBALVAR)) { globalvar_add_simple("hostname", __hostname); } else { free(hostname); hostname = xstrdup(__hostname); } }
/* * The model is the verbose name of a board. It can contain * whitespaces, uppercase/lowcer letters, digits, ',', '.' * '-', '_' */ void barebox_set_model(const char *__model) { if (IS_ENABLED(CONFIG_GLOBALVAR)) { globalvar_add_simple("model", __model); } else { free(model); model = xstrdup(__model); } }
static void dhcp_global_add(const char *var) { char * var_global = asprintf("dhcp.%s", var); if (!var_global) return; globalvar_add_simple(var_global, NULL); free(var_global); }
static int vexpress_devices_init(void) { writel(1, v2m_sysreg_base + V2M_SYS_FLASH); v2m_init->devices_init(); devfs_add_partition("nor0", 0x00000, 0x40000, DEVFS_PARTITION_FIXED, "self"); devfs_add_partition("nor0", 0x40000, 0x20000, DEVFS_PARTITION_FIXED, "env0"); globalvar_add_simple("hostname"); setenv("global.hostname", v2m_init->hostname); return 0; }
static void console_set_stdoutpath(struct console_device *cdev) { int id; char *str; if (!cdev->linux_console_name) return; id = of_alias_get_id(cdev->dev->device_node, "serial"); if (id < 0) return; str = asprintf("console=%s%d,%dn8", cdev->linux_console_name, id, cdev->baudrate); globalvar_add_simple("linux.bootargs.console", str); free(str); }
static int do_global(int argc, char *argv[]) { int opt, i; int do_remove = 0; char *value; while ((opt = getopt(argc, argv, "r")) > 0) { switch (opt) { case 'r': do_remove = 1; break; } } if (argc == optind) { globalvar_print(); return 0; } argc -= optind; argv += optind; if (argc < 1) return COMMAND_ERROR_USAGE; for (i = 0; i < argc; i++) { value = strchr(argv[i], '='); if (value) { *value = 0; value++; } if (do_remove) globalvar_remove(argv[i]); else globalvar_add_simple(argv[i], value); } return 0; }
static int do_global(int argc, char *argv[]) { int ret; char *value; if (argc != 2) return COMMAND_ERROR_USAGE; value = strchr(argv[1], '='); if (value) { *value = 0; value++; } ret = globalvar_add_simple(argv[1]); if (value) { char *name = asprintf("global.%s", argv[1]); ret = setenv(name, value); free(name); } return ret ? 1 : 0; }
/* ensure this runs after the 'global' device is already registerd */ static int init_reset_source(void) { globalvar_add_simple("system.reset", reset_src_names[RESET_UKWN]); return 0; }