
Hi Wolfgang,
Wolfgang Denk wrote:
Note that your code references a non-existing U-Boot command "gofsk"!
Indeed it does :-)
I have a couple of more patches, things a little more contentious than simple cpu or board add.
The gofsk command is something I added to support loading snapgear/uClinux-dist style raw filesystem+kernel images.
The image itself is a simple concatenation of a root filesystem and a kernel. Typically it is used with a CRAMfs root filesystem. The primary motivator for not having any header on this image is that it can be dumped directly into an MTD flash partition, and it can be directly mounted as the root filesystem. For known filesystem types (like CRAMfs and ROMfs) the loader simply looks over the filesystem to get to the kernel for boot time starting.
Patch attached is my current implementation of this.
Is this something that you would allow into the main tree?
Regards Greg
------------------------------------------------------------------------ Greg Ungerer -- Chief Software Dude EMAIL: gerg@snapgear.com SnapGear -- a CyberGuard Company PHONE: +61 7 3435 2888 825 Stanley St, FAX: +61 7 3891 3630 Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com
diff -Naur --exclude=CVS u-boot.cvs/common/cmd_bootr.c u-boot/common/cmd_bootr.c --- u-boot.cvs/common/cmd_bootr.c 1970-01-01 10:00:00.000000000 +1000 +++ u-boot/common/cmd_bootr.c 2005-05-19 23:29:06.000000000 +1000 @@ -0,0 +1,117 @@ +/* + * (C) Copyright 2005 + * Greg Ungerer, OpenGear Inc, greg.ungerer@opengear.com + * + * (C) Copyright 2000-2003 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +/* + * Misc boot support + */ +#include <common.h> +#include <command.h> +#include <net.h> + + +/* -------------------------------------------------------------------- */ + +int do_gofsk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ +#if defined(CONFIG_I386) + DECLARE_GLOBAL_DATA_PTR; +#endif + ulong fsaddr, fslen, kaddr, klen, rc; + uchar *s; + int rcode = 0; + + kaddr = CFG_LOAD_ADDR; + klen = 0x100000; + + if (argc < 2) { + printf ("Usage:\n%s\n", cmdtp->usage); + return 1; + } + + fsaddr = simple_strtoul(argv[1], NULL, 16); + if (argc > 2) + kaddr = simple_strtoul(argv[2], NULL, 16); + if (argc > 3) + klen = simple_strtoul(argv[3], NULL, 16); + + printf ("## Checking Filesystem at 0x%08lX ...\n", fsaddr); + + s = (uchar *) fsaddr; + fslen = 0; + + if (memcmp(fsaddr, "-rom1fs-", 8) == 0) { + /* ROMfs */ + fslen = (s[8] << 24) | (s[9] << 16) | (s[10] << 8) | s[11]; + fslen = (fslen + 1023) & ~1023; + printf ("## Found ROMfs filesystem at 0x%08lX size 0x%08lX\n", + fsaddr, fslen); + } else if ((s[0] == 0x45) && (s[1] == 0x3d) && (s[2] == 0xcd) && (s[3]== 0x28)) { + /* CRAMfs */ + fslen = (s[7] << 24) | (s[6] << 16) | (s[5] << 8) | s[4]; + printf ("## Found CRAMfs filesystem at 0x%08lX size 0x%08lX\n", + fsaddr, fslen); + } else { + printf("## Unknown filesystem type, cannot skip\n"); + return 1; + } + + fsaddr += fslen; + + printf ("## Copying Linux Kernel from 0x%08lX to 0x%08lX...\n", + fsaddr, kaddr); + + memcpy(kaddr, fsaddr, klen); + + printf ("## Starting Linux Kernel at 0x%08lX ...\n", kaddr); + +#if defined(CONFIG_ARM) + make_tags(); +#endif + cleanup_before_linux(); +#if !defined(CONFIG_NIOS) + rc = ((ulong (*)(void))kaddr) (); +#else + /* + * Nios function pointers are address >> 1 + */ + rc = ((ulong (*)(int, char *[]))(kaddr>>1)) (); +#endif + if (rc != 0) rcode = 1; + + printf ("## Application terminated, rc = 0x%lX\n", rc); + return rcode; +} + +/* -------------------------------------------------------------------- */ + +U_BOOT_CMD( + gofsk, CFG_MAXARGS, 3, do_gofsk, + "gofsk - copy and start kernel after fileystem\n", + "fsaddr [kaddr [klen]]\n" + " - copy kernel after fileystem at address 'fsaddr'\n" + " to 'kaddr' (of length 'klen') and then jump to it\n" +); + diff -Naur --exclude=CVS u-boot.cvs/common/Makefile u-boot/common/Makefile --- u-boot.cvs/common/Makefile 2005-05-19 20:57:31.000000000 +1000 +++ u-boot/common/Makefile 2005-05-19 23:29:06.000000000 +1000 @@ -29,7 +29,7 @@
COBJS = main.o ACEX1K.o altera.o bedbug.o circbuf.o \ cmd_ace.o cmd_autoscript.o \ - cmd_bdinfo.o cmd_bedbug.o cmd_bmp.o cmd_boot.o cmd_bootm.o \ + cmd_bdinfo.o cmd_bedbug.o cmd_bmp.o cmd_boot.o cmd_bootm.o cmd_bootr.o \ cmd_cache.o cmd_console.o \ cmd_date.o cmd_dcr.o cmd_diag.o cmd_doc.o cmd_dtt.o \ cmd_eeprom.o cmd_elf.o cmd_ext2.o \ diff -Naur --exclude=CVS u-boot.cvs/lib_arm/armlinux.c u-boot/lib_arm/armlinux.c --- u-boot.cvs/lib_arm/armlinux.c 2005-05-19 20:57:45.000000000 +1000 +++ u-boot/lib_arm/armlinux.c 2005-05-19 23:43:51.000000000 +1000 @@ -278,6 +278,41 @@ defined (CONFIG_REVISION_TAG) || \ defined (CONFIG_LCD) || \ defined (CONFIG_VFD) +void make_tags (void) +{ + DECLARE_GLOBAL_DATA_PTR; + + bd_t *bd = gd->bd; + +#ifdef CONFIG_CMDLINE_TAG + char *commandline = getenv ("bootargs"); +#endif + + setup_start_tag (bd); +#ifdef CONFIG_SERIAL_TAG + setup_serial_tag (¶ms); +#endif +#ifdef CONFIG_REVISION_TAG + setup_revision_tag (¶ms); +#endif +#ifdef CONFIG_SETUP_MEMORY_TAGS + setup_memory_tags (bd); +#endif +#ifdef CONFIG_CMDLINE_TAG + setup_commandline_tag (bd, commandline); +#endif +#if defined (CONFIG_VFD) + setup_videolfb_tag ((gd_t *) gd); +#endif + setup_end_tag (bd); +} + static void setup_start_tag (bd_t *bd) { params = (struct tag *) bd->bi_boot_params;