Commit 0267768eddc5ca7bc1865bc40c866829ac5efbfe
Committed by
Jon Loeliger
1 parent
f73e73ba0e
Exists in
master
and in
54 other branches
* Modify bootm command to support booting with flat device trees Patch by Matthe…
…w McClintock 26-June-2006
Showing 2 changed files with 80 additions and 14 deletions Side-by-side Diff
README
... | ... | @@ -447,6 +447,11 @@ |
447 | 447 | Board code has addition modification that it wants to make |
448 | 448 | to the flat device tree before handing it off to the kernel |
449 | 449 | |
450 | + CONFIG_OF_BOOT_CPU | |
451 | + | |
452 | + This define fills in the correct boot cpu in the boot | |
453 | + param header, the default value is zero if undefined. | |
454 | + | |
450 | 455 | - Serial Ports: |
451 | 456 | CFG_PL010_SERIAL |
452 | 457 | |
... | ... | @@ -3012,6 +3017,55 @@ |
3012 | 3017 | VFS: Mounted root (ext2 filesystem). |
3013 | 3018 | |
3014 | 3019 | bash# |
3020 | + | |
3021 | +Boot Linux and pass a flat device tree: | |
3022 | +----------- | |
3023 | + | |
3024 | +First, U-Boot must be compiled with the appropriate defines. See the section | |
3025 | +titled "Linux Kernel Interface" above for a more in depth explanation. The | |
3026 | +following is an example of how to start a kernel and pass an updated | |
3027 | +flat device tree: | |
3028 | + | |
3029 | +=> print oftaddr | |
3030 | +oftaddr=0x300000 | |
3031 | +=> print oft | |
3032 | +oft=oftrees/mpc8540ads.dtb | |
3033 | +=> tftp $oftaddr $oft | |
3034 | +Speed: 1000, full duplex | |
3035 | +Using TSEC0 device | |
3036 | +TFTP from server 192.168.1.1; our IP address is 192.168.1.101 | |
3037 | +Filename 'oftrees/mpc8540ads.dtb'. | |
3038 | +Load address: 0x300000 | |
3039 | +Loading: # | |
3040 | +done | |
3041 | +Bytes transferred = 4106 (100a hex) | |
3042 | +=> tftp $loadaddr $bootfile | |
3043 | +Speed: 1000, full duplex | |
3044 | +Using TSEC0 device | |
3045 | +TFTP from server 192.168.1.1; our IP address is 192.168.1.2 | |
3046 | +Filename 'uImage'. | |
3047 | +Load address: 0x200000 | |
3048 | +Loading:############ | |
3049 | +done | |
3050 | +Bytes transferred = 1029407 (fb51f hex) | |
3051 | +=> print loadaddr | |
3052 | +loadaddr=200000 | |
3053 | +=> print oftaddr | |
3054 | +oftaddr=0x300000 | |
3055 | +=> bootm $loadaddr - $oftaddr | |
3056 | +## Booting image at 00200000 ... | |
3057 | + Image Name: Linux-2.6.17-dirty | |
3058 | + Image Type: PowerPC Linux Kernel Image (gzip compressed) | |
3059 | + Data Size: 1029343 Bytes = 1005.2 kB | |
3060 | + Load Address: 00000000 | |
3061 | + Entry Point: 00000000 | |
3062 | + Verifying Checksum ... OK | |
3063 | + Uncompressing Kernel Image ... OK | |
3064 | +Booting using flat device tree at 0x300000 | |
3065 | +Using MPC85xx ADS machine description | |
3066 | +Memory CAM mapping: CAM0=256Mb, CAM1=256Mb, CAM2=0Mb residual: 0Mb | |
3067 | +[snip] | |
3068 | + | |
3015 | 3069 | |
3016 | 3070 | More About U-Boot Image Types: |
3017 | 3071 | ------------------------------ |
common/cmd_bootm.c
... | ... | @@ -465,6 +465,13 @@ |
465 | 465 | "[addr [arg ...]]\n - boot application image stored in memory\n" |
466 | 466 | "\tpassing arguments 'arg ...'; when booting a Linux kernel,\n" |
467 | 467 | "\t'arg' can be the address of an initrd image\n" |
468 | +#ifdef CONFIG_OF_FLAT_TREE | |
469 | + "\tWhen booting a Linux kernel which requires a flat device-tree\n" | |
470 | + "\ta third argument is required which is the address of the of the\n" | |
471 | + "\tdevice-tree blob. To boot that kernel without an initrd image,\n" | |
472 | + "\tuse a '-' for the second argument. If you do not pass a third\n" | |
473 | + "\ta bd_info struct will be passed instead\n" | |
474 | +#endif | |
468 | 475 | ); |
469 | 476 | |
470 | 477 | #ifdef CONFIG_SILENT_CONSOLE |
... | ... | @@ -500,11 +507,6 @@ |
500 | 507 | } |
501 | 508 | #endif /* CONFIG_SILENT_CONSOLE */ |
502 | 509 | |
503 | -#ifdef CONFIG_OF_FLAT_TREE | |
504 | -extern const unsigned char oftree_dtb[]; | |
505 | -extern const unsigned int oftree_dtb_len; | |
506 | -#endif | |
507 | - | |
508 | 510 | #ifdef CONFIG_PPC |
509 | 511 | static void |
510 | 512 | do_bootm_linux (cmd_tbl_t *cmdtp, int flag, |
511 | 513 | |
... | ... | @@ -616,7 +618,17 @@ |
616 | 618 | /* |
617 | 619 | * Check if there is an initrd image |
618 | 620 | */ |
621 | + | |
622 | +#ifdef CONFIG_OF_FLAT_TREE | |
623 | + /* Look for a '-' which indicates to ignore the ramdisk argument */ | |
624 | + if (argc >= 3 && strcmp(argv[2], "-") == 0) { | |
625 | + debug ("Skipping initrd\n"); | |
626 | + data = 0; | |
627 | + } | |
628 | + else | |
629 | +#endif | |
619 | 630 | if (argc >= 3) { |
631 | + debug ("Not skipping initrd\n"); | |
620 | 632 | SHOW_BOOT_PROGRESS (9); |
621 | 633 | |
622 | 634 | addr = simple_strtoul(argv[2], NULL, 16); |
... | ... | @@ -724,6 +736,15 @@ |
724 | 736 | len = data = 0; |
725 | 737 | } |
726 | 738 | |
739 | +#ifdef CONFIG_OF_FLAT_TREE | |
740 | + if (argc >= 3) | |
741 | + { | |
742 | + of_flat_tree = (char *) simple_strtoul(argv[3], NULL, 16); | |
743 | + printf ("Booting using flat device tree at 0x%x\n", | |
744 | + of_flat_tree); | |
745 | + } | |
746 | +#endif | |
747 | + | |
727 | 748 | if (!data) { |
728 | 749 | debug ("No initrd\n"); |
729 | 750 | } |
... | ... | @@ -792,15 +813,6 @@ |
792 | 813 | initrd_start = 0; |
793 | 814 | initrd_end = 0; |
794 | 815 | } |
795 | - | |
796 | -#ifdef CONFIG_OF_FLAT_TREE | |
797 | - if (initrd_start == 0) | |
798 | - of_flat_tree = (char *)(((ulong)kbd - OF_FLAT_TREE_MAX_SIZE - | |
799 | - sizeof(bd_t)) & ~0xF); | |
800 | - else | |
801 | - of_flat_tree = (char *)((initrd_start - OF_FLAT_TREE_MAX_SIZE - | |
802 | - sizeof(bd_t)) & ~0xF); | |
803 | -#endif | |
804 | 816 | |
805 | 817 | debug ("## Transferring control to Linux (at address %08lx) ...\n", |
806 | 818 | (ulong)kernel); |