示例#1
0
static int beaglebone_coredevice_init(void)
{
	if (!of_machine_is_compatible("ti,am335x-bone"))
		return 0;

	am33xx_register_ethaddr(0, 0);
	return 0;
}
示例#2
0
文件: board.c 项目: bmourit/barebox
static int pcm051_coredevice_init(void)
{
	if (!of_machine_is_compatible("phytec,pcm051"))
		return 0;

	am33xx_register_ethaddr(0, 0);
	return 0;
}
示例#3
0
static void *am33xx_net_boot(void)
{
	void *buf = NULL;
	int err;
	int len;
	struct dhcp_req_param dhcp_param;
	const char *bootfile, *ip;
	char *file;

	am33xx_register_ethaddr(0, 0);

	memset(&dhcp_param, 0, sizeof(struct dhcp_req_param));
	dhcp_param.vendor_id = "am335x barebox-mlo";
	err = dhcp(20, &dhcp_param);
	if (err) {
		printf("dhcp failed\n");
		return NULL;
	}

	/*
	 * Older tftp server don't send the file size.
	 * Then tftpfs needs temporary place to store the file.
	 */
	err = mount("none", "ramfs", "/", NULL);
	if (err < 0) {
		printf("failed to mount ramfs\n");
		return NULL;
	}

	err = make_directory(TFTP_MOUNT);
	if (err)
		return NULL;

	ip = ip_to_string(net_get_serverip());
	err = mount(ip, "tftp", TFTP_MOUNT, NULL);
	if (err < 0) {
		printf("Unable to mount.\n");
		return NULL;
	}

	bootfile = getenv("bootfile");
	if (!bootfile) {
		printf("bootfile not found.\n");
		return NULL;
	}

	file = asprintf("%s/%s", TFTP_MOUNT, bootfile);

	buf = read_file(file, &len);
	if (!buf)
		printf("could not read %s.\n", bootfile);

	free(file);

	umount(TFTP_MOUNT);

	return buf;
}
static void pcm051_eth_init(void)
{
    am33xx_register_ethaddr(0, 0);

    writel(0x49, AM33XX_MAC_MII_SEL);

    am33xx_enable_rmii1_pin_mux();

    am33xx_add_cpsw(&cpsw_data);
}
示例#5
0
文件: board.c 项目: AubrCool/barebox
static int board_console_init(void)
{
	if (!of_machine_is_compatible("afi,gf"))
		return 0;

	switch (bootsource_get()) {
	default:
	case BOOTSOURCE_SPI:
		of_device_enable_path("/chosen/environment-spi");
		break;
	case BOOTSOURCE_MMC:
		omap_set_bootmmc_devname("mmc0");
		break;
	}

	defaultenv_append_directory(defaultenv_gf);
	am33xx_register_ethaddr(0, 0);
	am33xx_register_ethaddr(1, 1);
	barebox_set_hostname("gf");
	am33xx_bbu_spi_nor_mlo_register_handler("MLO.spi", "/dev/m25p0.mlo");
	am33xx_bbu_spi_nor_register_handler("spi", "/dev/m25p0.boot");

	return 0;
}
示例#6
0
文件: xload.c 项目: frantony/barebox
static void *am33xx_net_boot(void)
{
	void *buf = NULL;
	int err;
	int len;
	struct dhcp_req_param dhcp_param;
	const char *bootfile;
	IPaddr_t ip;
	char *file;
	char ip4_str[sizeof("255.255.255.255")];
	struct eth_device *edev;
	struct dhcp_result *dhcp_res;

	am33xx_register_ethaddr(0, 0);

	memset(&dhcp_param, 0, sizeof(struct dhcp_req_param));
	dhcp_param.vendor_id = "am335x barebox-mlo";

	edev = eth_get_byname("eth0");
	if (!edev) {
		printf("eth0 not found\n");
		return NULL;
	}

	err = dhcp_request(edev, &dhcp_param, &dhcp_res);
	if (err) {
		printf("dhcp failed\n");
		return NULL;
	}

	dhcp_set_result(edev, dhcp_res);

	edev->ifup = true;

	/*
	 * Older tftp server don't send the file size.
	 * Then tftpfs needs temporary place to store the file.
	 */
	err = mount("none", "ramfs", "/", NULL);
	if (err < 0) {
		printf("failed to mount ramfs\n");
		return NULL;
	}

	err = make_directory(TFTP_MOUNT);
	if (err)
		return NULL;

	ip = net_get_serverip();
	sprintf(ip4_str, "%pI4", &ip);
	err = mount(ip4_str, "tftp", TFTP_MOUNT, NULL);
	if (err < 0) {
		printf("Unable to mount.\n");
		return NULL;
	}

	bootfile = dhcp_res->bootfile;
	if (!bootfile) {
		printf("bootfile not found.\n");
		return NULL;
	}

	file = basprintf("%s/%s", TFTP_MOUNT, bootfile);

	buf = read_file(file, &len);
	if (!buf)
		printf("could not read %s.\n", bootfile);

	free(file);

	umount(TFTP_MOUNT);

	return buf;
}