7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #include <sys/types.h>
27 /* EXPORT DELETE START */
28 #include <sys/promif.h>
29 #include <sys/obpdefs.h>
30 #include <sys/bootvfs.h>
31 #include <sys/bootconf.h>
32 #include <netinet/in.h>
33 #include <sys/wanboot_impl.h>
34 #include <boot_http.h>
35 #include <aes.h>
36 #include <des3.h>
37 #include <cbc.h>
38 #include <hmac_sha1.h>
39 #include <sys/sha1.h>
40 #include <sys/sha1_consts.h>
41 #include <bootlog.h>
42 #include <parseURL.h>
43 #include <netboot_paths.h>
44 #include <netinet/inetutil.h>
45 #include <sys/salib.h>
46 #include <inet/mac.h>
47 #include <inet/ipv4.h>
1570 return (B_FALSE);
1571 }
1572
1573 /*
1574 * This implementation of bootprog() is used solely by wanboot.
1575 *
1576 * The basic algorithm is as follows:
1577 *
1578 * - The wanboot options (those specified using the "-o" flag) are processed,
1579 * and if necessary the wanboot interpreter is invoked to collect other
1580 * options.
1581 *
1582 * - The wanboot filesystem (containing certificates, wanboot.conf file, etc.)
1583 * is then downloaded into the bootfs ramdisk, which is mounted for use
1584 * by OpenSSL, access to wanboot.conf, etc.
1585 *
1586 * - The wanboot miniroot is downloaded over http/https into the rootfs
1587 * ramdisk. The bootfs filesystem is unmounted, and the rootfs filesystem
1588 * is booted.
1589 */
1590 /* EXPORT DELETE END */
1591 /*ARGSUSED*/
1592 int
1593 bootprog(char *bpath, char *bargs, boolean_t user_specified_filename)
1594 {
1595 /* EXPORT DELETE START */
1596 char *miniroot_path;
1597 url_t server_url;
1598 int ret;
1599
1600 if (!init_netdev(bpath)) {
1601 return (-1);
1602 }
1603
1604 if (!bootinfo_init()) {
1605 bootlog("wanboot", BOOTLOG_CRIT, "Cannot initialize bootinfo");
1606 return (-1);
1607 }
1608
1609 /*
1610 * Get default values from PROM, etc., process any boot arguments
1611 * (specified with the "-o" option), and initialize the interface.
1612 */
1613 if (!wanboot_init_interface(wanboot_arguments)) {
1614 return (-1);
1615 }
1660 */
1661 if (!wanboot_verify_config()) {
1662 return (-1);
1663 }
1664
1665 /*
1666 * Retrieve the miniroot.
1667 */
1668 if (get_miniroot(&miniroot_path) != 0) {
1669 return (-1);
1670 }
1671
1672 /*
1673 * We don't need the wanboot file system mounted anymore and
1674 * should unmount it so that we can mount the miniroot.
1675 */
1676 (void) unmountroot();
1677
1678 boot_ramdisk(RD_ROOTFS);
1679
1680 /* EXPORT DELETE END */
1681 return (0);
1682 }
|
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #include <sys/types.h>
27 #include <sys/promif.h>
28 #include <sys/obpdefs.h>
29 #include <sys/bootvfs.h>
30 #include <sys/bootconf.h>
31 #include <netinet/in.h>
32 #include <sys/wanboot_impl.h>
33 #include <boot_http.h>
34 #include <aes.h>
35 #include <des3.h>
36 #include <cbc.h>
37 #include <hmac_sha1.h>
38 #include <sys/sha1.h>
39 #include <sys/sha1_consts.h>
40 #include <bootlog.h>
41 #include <parseURL.h>
42 #include <netboot_paths.h>
43 #include <netinet/inetutil.h>
44 #include <sys/salib.h>
45 #include <inet/mac.h>
46 #include <inet/ipv4.h>
1569 return (B_FALSE);
1570 }
1571
1572 /*
1573 * This implementation of bootprog() is used solely by wanboot.
1574 *
1575 * The basic algorithm is as follows:
1576 *
1577 * - The wanboot options (those specified using the "-o" flag) are processed,
1578 * and if necessary the wanboot interpreter is invoked to collect other
1579 * options.
1580 *
1581 * - The wanboot filesystem (containing certificates, wanboot.conf file, etc.)
1582 * is then downloaded into the bootfs ramdisk, which is mounted for use
1583 * by OpenSSL, access to wanboot.conf, etc.
1584 *
1585 * - The wanboot miniroot is downloaded over http/https into the rootfs
1586 * ramdisk. The bootfs filesystem is unmounted, and the rootfs filesystem
1587 * is booted.
1588 */
1589 /*ARGSUSED*/
1590 int
1591 bootprog(char *bpath, char *bargs, boolean_t user_specified_filename)
1592 {
1593 char *miniroot_path;
1594 url_t server_url;
1595 int ret;
1596
1597 if (!init_netdev(bpath)) {
1598 return (-1);
1599 }
1600
1601 if (!bootinfo_init()) {
1602 bootlog("wanboot", BOOTLOG_CRIT, "Cannot initialize bootinfo");
1603 return (-1);
1604 }
1605
1606 /*
1607 * Get default values from PROM, etc., process any boot arguments
1608 * (specified with the "-o" option), and initialize the interface.
1609 */
1610 if (!wanboot_init_interface(wanboot_arguments)) {
1611 return (-1);
1612 }
1657 */
1658 if (!wanboot_verify_config()) {
1659 return (-1);
1660 }
1661
1662 /*
1663 * Retrieve the miniroot.
1664 */
1665 if (get_miniroot(&miniroot_path) != 0) {
1666 return (-1);
1667 }
1668
1669 /*
1670 * We don't need the wanboot file system mounted anymore and
1671 * should unmount it so that we can mount the miniroot.
1672 */
1673 (void) unmountroot();
1674
1675 boot_ramdisk(RD_ROOTFS);
1676
1677 return (0);
1678 }
|