Stefan Roese | e1b8d0b | 2012-08-14 15:04:19 +0200 | [diff] [blame] | 1 | ------------------------------------------------------------------------ |
| 2 | A3M071 board support |
| 3 | ------------------------------------------------------------------------ |
| 4 | |
| 5 | |
| 6 | SPL NOR flash support: |
| 7 | ---------------------- |
| 8 | To boot fast into the OS (Linux), this board port integrates the SPL |
| 9 | framework. This means, that a special, stripped-down version of |
| 10 | U-Boot runs in the beginning. In the case of the A3M071 board, this |
| 11 | SPL U-Boot version is less than 16 KiB big. This SPL U-Boot can either |
| 12 | boot the OS (Linux) or a "real", full-blown U-Boot. This detection |
| 13 | on whether to boot Linux or U-Boot is done by using the "boot_os" |
| 14 | environment variable. If "boot_os" is set to "yes", Linux will be |
| 15 | loaded and booted from the SPL U-Boot version. Otherwise, the |
| 16 | full-blown U-Boot version will be loaded and run. |
| 17 | |
| 18 | Enabling Linux booting: |
| 19 | ----------------------- |
| 20 | From U-Boot: |
| 21 | => setenv boot_os yes |
| 22 | => saveenv |
| 23 | |
| 24 | From Linux: |
| 25 | $ fw_setenv boot_os yes |
| 26 | |
| 27 | Enabling U-Boot booting: |
| 28 | ------------------------ |
| 29 | From U-Boot: |
| 30 | => setenv boot_os no |
| 31 | => saveenv |
| 32 | |
| 33 | From Linux: |
| 34 | $ fw_setenv boot_os no |
| 35 | |
| 36 | |
| 37 | Preparing Linux image(s) for booting from SPL U-Boot: |
| 38 | ----------------------------------------------------- |
| 39 | To boot the Linux kernel from the SPL, the DT blob (fdt) needs to get |
| 40 | prepard/patched first. U-Boot usually inserts some dynamic values into |
| 41 | the DT binary (blob), e.g. autodetected memory size, MAC addresses, |
| 42 | clocks speeds etc. To generate this patched DT blob, you can use |
| 43 | the following command: |
| 44 | |
| 45 | 1. Load fdt blob to SDRAM: |
| 46 | => tftp 1800000 a3m071/a3m071.dtb |
| 47 | |
| 48 | 2. Set bootargs as desired for Linux booting (e.g. flash_mtd): |
| 49 | => run mtdargs addip2 addtty |
| 50 | |
| 51 | 3. Use "fdt" commands to patch the DT blob: |
| 52 | => fdt addr 1800000 |
| 53 | => fdt boardsetup |
| 54 | => fdt chosen |
| 55 | |
| 56 | 4. Display patched DT blob (optional): |
| 57 | => fdt print |
| 58 | |
| 59 | 5. Save fdt to NOR flash: |
| 60 | => erase fc060000 fc07ffff |
| 61 | => cp.b 1800000 fc060000 10000 |
| 62 | |
| 63 | All this can be integrated into an environment command: |
| 64 | => setenv upd_fdt 'tftp 1800000 a3m071/a3m071.dtb;run mtdargs addip2 addtty; \ |
| 65 | fdt addr 1800000;fdt boardsetup;erase fc060000 fc07ffff; \ |
| 66 | cp.b 1800000 fc060000 10000' |
| 67 | => saveenv |
| 68 | |
| 69 | After this, only "run upd_fdt" needs to get called to load, patch |
| 70 | and save the DT blob into NOR flash. |
| 71 | |
| 72 | Additionally, the Linux kernel image has to be saved uncompressed in |
| 73 | its uImage file (and not gzip compressed). This can be done with this |
| 74 | command: |
| 75 | |
| 76 | $ mkimage -A ppc -O linux -T kernel -C none -a 0 -e 0 \ |
| 77 | -n "Linux Kernel Image" -d vmlinux.bin uImage.uncompressed |
| 78 | |
| 79 | ------------------------------------------------------------------------ |
| 80 | Stefan Roese, 2012-08-23 |