diff --git a/MAKEALL b/MAKEALL index c08e484..18ed862 100755 --- a/MAKEALL +++ b/MAKEALL @@ -56,6 +56,7 @@ echo "JOBS -j jobs" echo "BUILDDIR -O build dir" echo "LOGDIR -l log dir" + echo "REGEX -e regex" echo "" } @@ -152,8 +153,9 @@ do_build() { local arch=$1 + local regex=$2 - for i in arch/${arch}/configs/*_defconfig + find arch/${arch}/configs -name "${regex}_defconfig" | while read i do local target=$(basename $i) @@ -178,7 +180,7 @@ return $build_target } -while getopts "hc:j:O:l:a:" Option +while getopts "hc:j:O:l:a:e:" Option do case $Option in a ) @@ -196,6 +198,9 @@ O ) BUILDDIR=${OPTARG} ;; + e ) + REGEX=${OPTARG} + ;; h ) usage exit 0 @@ -241,6 +246,11 @@ [ -d "${LOGDIR}" ] || mkdir ${LOGDIR} || exit 1 +if [ ! "${REGEX}" ] +then + REGEX="*" +fi + if [ ! "${CONFIG}" ] && [ ! "${CROSS_COMPILE+set}" ] then echo "You need to specify a CONFIG or a CROSS_COMPILE" @@ -262,7 +272,7 @@ if [ $# -eq 0 ] then - do_build ${ARCH} + do_build ${ARCH} "${REGEX}" else do_build_target ${ARCH} $1 fi diff --git a/arch/arm/configs/archosg9_xload_defconfig b/arch/arm/configs/archosg9_xload_defconfig index 6c6782f..83743fa 100644 --- a/arch/arm/configs/archosg9_xload_defconfig +++ b/arch/arm/configs/archosg9_xload_defconfig @@ -15,7 +15,7 @@ CONFIG_SHELL_NONE=y # CONFIG_ERRNO_MESSAGES is not set # CONFIG_TIMESTAMP is not set -# CONFIG_CONSOLE_FULL is not set +CONFIG_CONSOLE_SIMPLE=y # CONFIG_DEFAULT_ENVIRONMENT is not set CONFIG_DRIVER_SERIAL_OMAP4_USBBOOT=y # CONFIG_SPI is not set diff --git a/arch/arm/configs/omap3530_beagle_xload_defconfig b/arch/arm/configs/omap3530_beagle_xload_defconfig index d951b1c..244891b 100644 --- a/arch/arm/configs/omap3530_beagle_xload_defconfig +++ b/arch/arm/configs/omap3530_beagle_xload_defconfig @@ -14,7 +14,7 @@ CONFIG_SHELL_NONE=y # CONFIG_ERRNO_MESSAGES is not set # CONFIG_TIMESTAMP is not set -# CONFIG_CONSOLE_FULL is not set +CONFIG_CONSOLE_SIMPLE=y # CONFIG_DEFAULT_ENVIRONMENT is not set CONFIG_DRIVER_SERIAL_NS16550=y CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y diff --git a/arch/arm/configs/panda_xload_defconfig b/arch/arm/configs/panda_xload_defconfig index fec09ce..1ed20a1 100644 --- a/arch/arm/configs/panda_xload_defconfig +++ b/arch/arm/configs/panda_xload_defconfig @@ -14,7 +14,7 @@ CONFIG_SHELL_NONE=y # CONFIG_ERRNO_MESSAGES is not set # CONFIG_TIMESTAMP is not set -# CONFIG_CONSOLE_FULL is not set +CONFIG_CONSOLE_SIMPLE=y # CONFIG_DEFAULT_ENVIRONMENT is not set CONFIG_DRIVER_SERIAL_NS16550=y CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y diff --git a/arch/arm/configs/pcm049_xload_defconfig b/arch/arm/configs/pcm049_xload_defconfig index b6d3a7a..9dfc30d 100644 --- a/arch/arm/configs/pcm049_xload_defconfig +++ b/arch/arm/configs/pcm049_xload_defconfig @@ -17,7 +17,7 @@ CONFIG_SHELL_NONE=y # CONFIG_ERRNO_MESSAGES is not set # CONFIG_TIMESTAMP is not set -# CONFIG_CONSOLE_FULL is not set +CONFIG_CONSOLE_SIMPLE=y # CONFIG_DEFAULT_ENVIRONMENT is not set CONFIG_DRIVER_SERIAL_NS16550=y CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y diff --git a/arch/arm/configs/phycard_a_l1_xload_defconfig b/arch/arm/configs/phycard_a_l1_xload_defconfig index 30253cb..5901ed1 100644 --- a/arch/arm/configs/phycard_a_l1_xload_defconfig +++ b/arch/arm/configs/phycard_a_l1_xload_defconfig @@ -20,7 +20,7 @@ CONFIG_SHELL_NONE=y # CONFIG_ERRNO_MESSAGES is not set # CONFIG_TIMESTAMP is not set -# CONFIG_CONSOLE_FULL is not set +CONFIG_CONSOLE_SIMPLE=y # CONFIG_DEFAULT_ENVIRONMENT is not set CONFIG_DRIVER_SERIAL_NS16550=y CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y diff --git a/arch/arm/configs/phycard_a_xl2_xload_defconfig b/arch/arm/configs/phycard_a_xl2_xload_defconfig index 7975220..84160e3 100644 --- a/arch/arm/configs/phycard_a_xl2_xload_defconfig +++ b/arch/arm/configs/phycard_a_xl2_xload_defconfig @@ -17,7 +17,7 @@ CONFIG_SHELL_NONE=y # CONFIG_ERRNO_MESSAGES is not set # CONFIG_TIMESTAMP is not set -# CONFIG_CONSOLE_FULL is not set +CONFIG_CONSOLE_SIMPLE=y # CONFIG_DEFAULT_ENVIRONMENT is not set CONFIG_DRIVER_SERIAL_NS16550=y CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c index 4b6db37..8f9a43e 100644 --- a/arch/arm/cpu/mmu.c +++ b/arch/arm/cpu/mmu.c @@ -73,11 +73,25 @@ #define PTE_FLAGS_CACHED_V4 (PTE_SMALL_AP_UNO_SRW | PTE_BUFFERABLE | PTE_CACHEABLE) #define PTE_FLAGS_UNCACHED_V4 PTE_SMALL_AP_UNO_SRW -static uint32_t PTE_FLAGS_CACHED; -static uint32_t PTE_FLAGS_UNCACHED; +/* + * PTE flags to set cached and uncached areas. + * This will be determined at runtime. + */ +static uint32_t pte_flags_cached; +static uint32_t pte_flags_uncached; #define PTE_MASK ((1 << 12) - 1) +uint32_t mmu_get_pte_cached_flags() +{ + return pte_flags_cached; +} + +uint32_t mmu_get_pte_uncached_flags() +{ + return pte_flags_uncached; +} + /* * Create a second level translation table for the given virtual address. * We initially create a flat uncached mapping on it. @@ -93,7 +107,7 @@ ttb[virt >> 20] = (unsigned long)table | PMD_TYPE_TABLE; for (i = 0; i < 256; i++) { - table[i] = virt | PTE_TYPE_SMALL | PTE_FLAGS_UNCACHED; + table[i] = virt | PTE_TYPE_SMALL | pte_flags_uncached; virt += PAGE_SIZE; } @@ -114,7 +128,7 @@ return &table[(adr >> PAGE_SHIFT) & 0xff]; } -static void remap_range(void *_start, size_t size, uint32_t flags) +void remap_range(void *_start, size_t size, uint32_t flags) { unsigned long start = (unsigned long)_start; u32 *p; @@ -176,7 +190,7 @@ for (i = 0; i < num_ptes; i++) { ptes[i] = (phys + i * 4096) | PTE_TYPE_SMALL | - PTE_FLAGS_CACHED; + pte_flags_cached; } pte = 0; @@ -238,9 +252,10 @@ memcpy(vectors, __exceptions_start, __exceptions_stop - __exceptions_start); if (cr & CR_V) - exc[256 - 16] = (u32)vectors | PTE_TYPE_SMALL | PTE_FLAGS_CACHED; + exc[256 - 16] = (u32)vectors | PTE_TYPE_SMALL | + pte_flags_cached; else - exc[0] = (u32)vectors | PTE_TYPE_SMALL | PTE_FLAGS_CACHED; + exc[0] = (u32)vectors | PTE_TYPE_SMALL | pte_flags_cached; } /* @@ -254,11 +269,11 @@ arm_set_cache_functions(); if (cpu_architecture() >= CPU_ARCH_ARMv7) { - PTE_FLAGS_CACHED = PTE_FLAGS_CACHED_V7; - PTE_FLAGS_UNCACHED = PTE_FLAGS_UNCACHED_V7; + pte_flags_cached = PTE_FLAGS_CACHED_V7; + pte_flags_uncached = PTE_FLAGS_UNCACHED_V7; } else { - PTE_FLAGS_CACHED = PTE_FLAGS_CACHED_V4; - PTE_FLAGS_UNCACHED = PTE_FLAGS_UNCACHED_V4; + pte_flags_cached = PTE_FLAGS_CACHED_V4; + pte_flags_uncached = PTE_FLAGS_UNCACHED_V4; } ttb = memalign(0x10000, 0x4000); @@ -315,8 +330,6 @@ __mmu_cache_off(); } -#define PAGE_ALIGN(s) (((s) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)) - void *dma_alloc_coherent(size_t size) { void *ret; @@ -326,7 +339,7 @@ dma_inv_range((unsigned long)ret, (unsigned long)ret + size); - remap_range(ret, size, PTE_FLAGS_UNCACHED); + remap_range(ret, size, pte_flags_uncached); return ret; } @@ -343,7 +356,7 @@ void dma_free_coherent(void *mem, size_t size) { - remap_range(mem, size, PTE_FLAGS_CACHED); + remap_range(mem, size, pte_flags_cached); free(mem); } diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h index a66da8c..f32cea6 100644 --- a/arch/arm/include/asm/mmu.h +++ b/arch/arm/include/asm/mmu.h @@ -41,7 +41,10 @@ void dma_inv_range(unsigned long, unsigned long); unsigned long virt_to_phys(void *virt); void *phys_to_virt(unsigned long phys); +void remap_range(void *_start, size_t size, uint32_t flags); void *map_io_sections(unsigned long physaddr, void *start, size_t size); +uint32_t mmu_get_pte_cached_flags(void); +uint32_t mmu_get_pte_uncached_flags(void); #else static inline void *dma_alloc_coherent(size_t size) @@ -76,11 +79,25 @@ { } +static inline void remap_range(void *_start, size_t size, uint32_t flags) +{ +} + static inline void *map_io_sections(unsigned long phys, void *start, size_t size) { return (void *)phys; } +static inline uint32_t mmu_get_pte_cached_flags(void) +{ + return 0; +} + +static inline uint32_t mmu_get_pte_uncached_flags(void) +{ + return 0; +} + #endif #ifdef CONFIG_CACHE_L2X0 diff --git a/arch/arm/lib/barebox.lds.S b/arch/arm/lib/barebox.lds.S index bac1a04..e5aee8c 100644 --- a/arch/arm/lib/barebox.lds.S +++ b/arch/arm/lib/barebox.lds.S @@ -66,6 +66,7 @@ } #endif _etext = .; /* End of text and rodata section */ + _sdata = .; . = ALIGN(4); .data : { *(.data*) } @@ -87,6 +88,7 @@ __usymtab : { BAREBOX_SYMS } __usymtab_end = .; + _edata = .; . = ALIGN(4); __bss_start = .; .bss : { *(.bss*) } diff --git a/arch/blackfin/boards/ipe337/barebox.lds.S b/arch/blackfin/boards/ipe337/barebox.lds.S index 6a07b43..21a91ee 100644 --- a/arch/blackfin/boards/ipe337/barebox.lds.S +++ b/arch/blackfin/boards/ipe337/barebox.lds.S @@ -55,6 +55,7 @@ .rodata : { *(.rodata) } __etext = .; /* End of text and rodata section */ + __sdata = .; . = ALIGN(4); .data : { *(.data) } @@ -79,6 +80,7 @@ __usymtab : { BAREBOX_SYMS } ___usymtab_end = .; + __edata = .; . = ALIGN(4); ___bss_start = .; .bss : { *(.bss) } diff --git a/arch/blackfin/include/asm/mmu.h b/arch/blackfin/include/asm/mmu.h new file mode 100644 index 0000000..bf65420 --- /dev/null +++ b/arch/blackfin/include/asm/mmu.h @@ -0,0 +1,18 @@ +#ifndef __ASM_MMU_H +#define __ASM_MMU_H + +static inline void remap_range(void *_start, size_t size, uint32_t flags) +{ +} + +static inline uint32_t mmu_get_pte_cached_flags(void) +{ + return 0; +} + +static inline uint32_t mmu_get_pte_uncached_flags(void) +{ + return 0; +} + +#endif /* __ASM_MMU_H */ diff --git a/arch/mips/include/asm/mmu.h b/arch/mips/include/asm/mmu.h new file mode 100644 index 0000000..bf65420 --- /dev/null +++ b/arch/mips/include/asm/mmu.h @@ -0,0 +1,18 @@ +#ifndef __ASM_MMU_H +#define __ASM_MMU_H + +static inline void remap_range(void *_start, size_t size, uint32_t flags) +{ +} + +static inline uint32_t mmu_get_pte_cached_flags(void) +{ + return 0; +} + +static inline uint32_t mmu_get_pte_uncached_flags(void) +{ + return 0; +} + +#endif /* __ASM_MMU_H */ diff --git a/arch/mips/lib/barebox.lds.S b/arch/mips/lib/barebox.lds.S index 0cbf2d7..5b3d45d 100644 --- a/arch/mips/lib/barebox.lds.S +++ b/arch/mips/lib/barebox.lds.S @@ -44,6 +44,7 @@ .rodata : { *(.rodata*) } _etext = .; /* End of text and rodata section */ + _sdata = .; . = ALIGN(4); .data : { *(.data*) } @@ -68,6 +69,7 @@ __usymtab : { BAREBOX_SYMS } __usymtab_end = .; + _edata = .; . = ALIGN(4); __bss_start = .; .bss : { *(.bss*) } diff --git a/arch/nios2/cpu/barebox.lds.S b/arch/nios2/cpu/barebox.lds.S index af7be4d..943c507 100644 --- a/arch/nios2/cpu/barebox.lds.S +++ b/arch/nios2/cpu/barebox.lds.S @@ -74,6 +74,7 @@ * adjacent to simplify the startup code -- and provide * the global pointer for gp-relative access. */ + _sdata = .; _data = .; .data : { diff --git a/arch/nios2/include/asm/mmu.h b/arch/nios2/include/asm/mmu.h new file mode 100644 index 0000000..bf65420 --- /dev/null +++ b/arch/nios2/include/asm/mmu.h @@ -0,0 +1,18 @@ +#ifndef __ASM_MMU_H +#define __ASM_MMU_H + +static inline void remap_range(void *_start, size_t size, uint32_t flags) +{ +} + +static inline uint32_t mmu_get_pte_cached_flags(void) +{ + return 0; +} + +static inline uint32_t mmu_get_pte_uncached_flags(void) +{ + return 0; +} + +#endif /* __ASM_MMU_H */ diff --git a/arch/openrisc/include/asm/mmu.h b/arch/openrisc/include/asm/mmu.h new file mode 100644 index 0000000..bf65420 --- /dev/null +++ b/arch/openrisc/include/asm/mmu.h @@ -0,0 +1,18 @@ +#ifndef __ASM_MMU_H +#define __ASM_MMU_H + +static inline void remap_range(void *_start, size_t size, uint32_t flags) +{ +} + +static inline uint32_t mmu_get_pte_cached_flags(void) +{ + return 0; +} + +static inline uint32_t mmu_get_pte_uncached_flags(void) +{ + return 0; +} + +#endif /* __ASM_MMU_H */ diff --git a/arch/ppc/boards/freescale-p2020rdb/barebox.lds.S b/arch/ppc/boards/freescale-p2020rdb/barebox.lds.S index 95033d4..85a864e 100644 --- a/arch/ppc/boards/freescale-p2020rdb/barebox.lds.S +++ b/arch/ppc/boards/freescale-p2020rdb/barebox.lds.S @@ -41,6 +41,7 @@ _etext = .; PROVIDE (etext = .); + _sdata = .; .rodata : { diff --git a/arch/ppc/boards/pcm030/barebox.lds.S b/arch/ppc/boards/pcm030/barebox.lds.S index cc86d82..20ac0d8 100644 --- a/arch/ppc/boards/pcm030/barebox.lds.S +++ b/arch/ppc/boards/pcm030/barebox.lds.S @@ -69,6 +69,7 @@ . = (. + 0x0FFF) & 0xFFFFF000; _etext = .; PROVIDE (erotext = .); + _sdata = .; .reloc : { *(.got) diff --git a/arch/ppc/include/asm/mmu.h b/arch/ppc/include/asm/mmu.h index b2dd0b7..179ec2b 100644 --- a/arch/ppc/include/asm/mmu.h +++ b/arch/ppc/include/asm/mmu.h @@ -540,4 +540,22 @@ (rt<<21)|(ra<<16)|(ws<<11)|(946<<1) #endif + +#ifndef __ASSEMBLY__ + +static inline void remap_range(void *_start, size_t size, uint32_t flags) +{ +} + +static inline uint32_t mmu_get_pte_cached_flags(void) +{ + return 0; +} + +static inline uint32_t mmu_get_pte_uncached_flags(void) +{ + return 0; +} +#endif + #endif /* _PPC_MMU_H_ */ diff --git a/arch/sandbox/include/asm/mmu.h b/arch/sandbox/include/asm/mmu.h new file mode 100644 index 0000000..bf65420 --- /dev/null +++ b/arch/sandbox/include/asm/mmu.h @@ -0,0 +1,18 @@ +#ifndef __ASM_MMU_H +#define __ASM_MMU_H + +static inline void remap_range(void *_start, size_t size, uint32_t flags) +{ +} + +static inline uint32_t mmu_get_pte_cached_flags(void) +{ + return 0; +} + +static inline uint32_t mmu_get_pte_uncached_flags(void) +{ + return 0; +} + +#endif /* __ASM_MMU_H */ diff --git a/arch/x86/include/asm/mmu.h b/arch/x86/include/asm/mmu.h new file mode 100644 index 0000000..bf65420 --- /dev/null +++ b/arch/x86/include/asm/mmu.h @@ -0,0 +1,18 @@ +#ifndef __ASM_MMU_H +#define __ASM_MMU_H + +static inline void remap_range(void *_start, size_t size, uint32_t flags) +{ +} + +static inline uint32_t mmu_get_pte_cached_flags(void) +{ + return 0; +} + +static inline uint32_t mmu_get_pte_uncached_flags(void) +{ + return 0; +} + +#endif /* __ASM_MMU_H */ diff --git a/arch/x86/lib/barebox.lds.S b/arch/x86/lib/barebox.lds.S index 8bd2a7b..05d0f77 100644 --- a/arch/x86/lib/barebox.lds.S +++ b/arch/x86/lib/barebox.lds.S @@ -153,6 +153,7 @@ } > barebox BAREBOX_BARE_INIT_SIZE + _sdata = .; .data : AT ( LOADADDR(.text) + SIZEOF(.text) ) { *(.data*) . = ALIGN(4); @@ -191,6 +192,7 @@ . = ALIGN(4); } > barebox + _edata = .; .bss : { __bss_start = .; *(.bss*); diff --git a/commands/Kconfig b/commands/Kconfig index c9a53b7..1addd91 100644 --- a/commands/Kconfig +++ b/commands/Kconfig @@ -267,6 +267,7 @@ menu "memory" config CMD_LOADB + depends on !CONSOLE_NONE select CRC16 tristate prompt "loadb" @@ -274,10 +275,12 @@ config CMD_LOADY select CRC16 select XYMODEM + depends on !CONSOLE_NONE tristate prompt "loady" config CMD_LOADS + depends on !CONSOLE_NONE tristate prompt "loads" diff --git a/commands/bootm.c b/commands/bootm.c index 483e6a1..5ccf237 100644 --- a/commands/bootm.c +++ b/commands/bootm.c @@ -143,8 +143,7 @@ size_t size; unsigned int align; - if (bootm_verbose(data)) - printf("Loading oftree from '%s'\n", oftree); + printf("Loading devicetree from '%s'\n", oftree); ft = file_name_detect_type(oftree); if ((int)ft < 0) { @@ -380,13 +379,14 @@ } } + printf("\nLoading OS %s '%s'", file_type_to_string(os_type), + data.os_file); + if (os_type == filetype_uimage && + data.os->header.ih_type == IH_TYPE_MULTI) + printf(", multifile image %d", data.os_num); + printf("\n"); + if (bootm_verbose(&data)) { - printf("\nLoading OS %s '%s'", file_type_to_string(os_type), - data.os_file); - if (os_type == filetype_uimage && - data.os->header.ih_type == IH_TYPE_MULTI) - printf(", multifile image %d", data.os_num); - printf("\n"); if (data.os_res) printf("OS image is at 0x%08x-0x%08x\n", data.os_res->start, diff --git a/commands/reset.c b/commands/reset.c index 835926b..79885f4 100644 --- a/commands/reset.c +++ b/commands/reset.c @@ -20,17 +20,40 @@ #include #include #include +#include static int cmd_reset(int argc, char *argv[]) { + int opt, shutdown_flag; + + shutdown_flag = 1; + + while ((opt = getopt(argc, argv, "f")) > 0) { + switch (opt) { + case 'f': + shutdown_flag = 0; + break; + } + } + + if (shutdown_flag) + shutdown_barebox(); + reset_cpu(0); /* Not reached */ return 1; } +BAREBOX_CMD_HELP_START(reset) +BAREBOX_CMD_HELP_USAGE("reset [-f]\n") +BAREBOX_CMD_HELP_SHORT("Perform RESET of the CPU.\n") +BAREBOX_CMD_HELP_OPT("-f", "force RESET, don't call shutdown\n") +BAREBOX_CMD_HELP_END + BAREBOX_CMD_START(reset) .cmd = cmd_reset, .usage = "Perform RESET of the CPU", + BAREBOX_CMD_HELP(cmd_reset_help) BAREBOX_CMD_COMPLETE(empty_complete) BAREBOX_CMD_END diff --git a/common/Kconfig b/common/Kconfig index 42a54f7..609b6d9 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -460,10 +460,13 @@ commands like bootm or iminfo. This option is automatically enabled when you select CFG_CMD_DATE . +choice + prompt "console support" + default CONSOLE_FULL + config CONSOLE_FULL bool - default y - prompt "Enable full console support" + prompt "full" help This option enables full console support capable of handling multiple consoles. Also the full console support @@ -472,6 +475,16 @@ once the first console is registered. Recommended for most usecases. +config CONSOLE_SIMPLE + bool + prompt "simple" + +config CONSOLE_NONE + bool + prompt "none" + +endchoice + choice prompt "Console activation strategy" depends on CONSOLE_FULL @@ -504,11 +517,6 @@ endchoice -config CONSOLE_SIMPLE - bool - default y - depends on !CONSOLE_FULL - config PARTITION bool prompt "Enable Partitions" diff --git a/common/Makefile b/common/Makefile index d82fc99..7206eed 100644 --- a/common/Makefile +++ b/common/Makefile @@ -23,6 +23,7 @@ obj-$(CONFIG_COMMAND_SUPPORT) += command.o obj-$(CONFIG_CONSOLE_FULL) += console.o obj-$(CONFIG_CONSOLE_SIMPLE) += console_simple.o +obj-$(CONFIG_CONSOLE_NONE) += console_none.o obj-$(CONFIG_DIGEST) += digest.o obj-$(CONFIG_ENVIRONMENT_VARIABLES) += env.o obj-$(CONFIG_UIMAGE) += image.o diff --git a/common/console_none.c b/common/console_none.c new file mode 100644 index 0000000..b601814 --- /dev/null +++ b/common/console_none.c @@ -0,0 +1,42 @@ +#include +#include +#include +#include +#include + +int fputc(int fd, char c) +{ + if (fd != 1 && fd != 2) + return write(fd, &c, 1); + return 0; +} +EXPORT_SYMBOL(fputc); + +int fputs(int fd, const char *s) +{ + if (fd != 1 && fd != 2) + return write(fd, s, strlen(s)); + return 0; +} +EXPORT_SYMBOL(fputs); + +int fprintf(int file, const char *fmt, ...) +{ + va_list args; + uint i; + char printbuffer[CFG_PBSIZE]; + + va_start (args, fmt); + + /* For this to work, printbuffer must be larger than + * anything we ever want to print. + */ + i = vsprintf (printbuffer, fmt, args); + va_end (args); + + /* Print the string */ + fputs(file, printbuffer); + + return i; +} +EXPORT_SYMBOL(fprintf); diff --git a/common/memory.c b/common/memory.c index 7dd1384..81641f0 100644 --- a/common/memory.c +++ b/common/memory.c @@ -75,6 +75,10 @@ (unsigned long)&_stext, (unsigned long)&_etext - (unsigned long)&_stext); + request_sdram_region("barebox data", + (unsigned long)&_sdata, + (unsigned long)&_edata - + (unsigned long)&_sdata); request_sdram_region("bss", (unsigned long)&__bss_start, (unsigned long)&__bss_stop - diff --git a/defaultenv-2/base/bin/init b/defaultenv-2/base/bin/init index bb4abcd..b606b63 100644 --- a/defaultenv-2/base/bin/init +++ b/defaultenv-2/base/bin/init @@ -15,20 +15,15 @@ /env/config -if [ ${global.allow_color} = "true" ]; then - export PS1="\e[1;32mbarebox@\e[1;36m\h:\w\e[0m " -else - export PS1="barebox@\h:\w " -fi - if [ -e /env/menu ]; then echo -e -n "\nHit m for menu or any other key to stop autoboot: " else echo -e -n "\nHit any key to stop autoboot: " fi -timeout -a $global.autoboot_timeout -v key -autoboot="$?" +# allow to stop the boot before execute the /env/init/* +# but without waiting +timeout -s -a -v key 0 if [ "${key}" = "q" ]; then exit @@ -38,6 +33,13 @@ . $i done +timeout -a $global.autoboot_timeout -v key +autoboot="$?" + +if [ "${key}" = "q" ]; then + exit +fi + if [ "$autoboot" = 0 ]; then boot fi diff --git a/defaultenv-2/base/init/ps1 b/defaultenv-2/base/init/ps1 new file mode 100644 index 0000000..fcbf4b6 --- /dev/null +++ b/defaultenv-2/base/init/ps1 @@ -0,0 +1,9 @@ +#!/bin/sh + +/env/config + +if [ ${global.allow_color} = "true" ]; then + export PS1="\e[1;32mbarebox@\e[1;36m\h:\w\e[0m " +else + export PS1="barebox@\h:\w " +fi diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index a8be9cd..f61d670 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -1,4 +1,5 @@ menu "serial drivers" + depends on !CONSOLE_NONE config DRIVER_SERIAL_ARM_DCC depends on ARM diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 6501d42..5f65cea 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -44,7 +44,7 @@ config USB_GADGET_SERIAL bool - depends on EXPERIMENTAL + depends on EXPERIMENTAL && !CONSOLE_NONE prompt "Serial Gadget" endif diff --git a/drivers/w1/slaves/Kconfig b/drivers/w1/slaves/Kconfig index 946a0b3..19942ad 100644 --- a/drivers/w1/slaves/Kconfig +++ b/drivers/w1/slaves/Kconfig @@ -15,10 +15,10 @@ depends on W1_SLAVE_DS2431 config W1_SLAVE_DS2433 - bool "4kb EEPROM family support (DS2433)" + bool "EEPROM family support (DS2433 4Kb or DS28EC20 20kb)" help Say Y here if you want to use a 1-wire - 4kb EEPROM family device (DS2433). + EEPROM family device (DS2433 4Kb or DS28EC20 20kb). config W1_SLAVE_DS2433_WRITE bool "write support" diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c index 51279fb..a840d9a 100644 --- a/drivers/w1/slaves/w1_ds2433.c +++ b/drivers/w1/slaves/w1_ds2433.c @@ -10,8 +10,6 @@ #include #include "../w1.h" -#define W1_EEPROM_SIZE 512 -#define W1_PAGE_COUNT 16 #define W1_PAGE_SIZE 32 #define W1_PAGE_BITS 5 #define W1_PAGE_MASK 0x1F @@ -23,9 +21,8 @@ #define W1_F23_READ_SCRATCH 0xAA #define W1_F23_COPY_SCRATCH 0x55 -#define DRIVERNAME "ds2433" - static int ds2433_count = 0; +static int ds28ec20_count = 0; /** * Check the file size bounds and adjusts count as needed. @@ -49,7 +46,7 @@ struct w1_bus *bus = dev->bus; u8 wrbuf[3]; - if ((count = ds2433_fix_count(off, count, W1_EEPROM_SIZE)) == 0) + if ((count = ds2433_fix_count(off, count, cdev->size)) == 0) return 0; /* read directly from the EEPROM */ @@ -134,7 +131,7 @@ int addr, len, idx; const u8 *buf8 = buf; - if ((count = ds2433_fix_count(off, count, W1_EEPROM_SIZE)) == 0) + if ((count = ds2433_fix_count(off, count, cdev->size)) == 0) return 0; /* Can only write data to one page at a time */ @@ -165,7 +162,7 @@ .lseek = dev_lseek_default, }; -static int ds2433_probe(struct w1_device *dev) +static int ds2433_cdev_create(struct w1_device *dev, int size, int id) { struct cdev *cdev; @@ -173,24 +170,48 @@ cdev->dev = &dev->dev; cdev->priv = dev; cdev->ops = &ds2433_ops; - cdev->size = W1_EEPROM_SIZE; - cdev->name = asprintf(DRIVERNAME"%d", ds2433_count++); + cdev->size = size; + cdev->name = asprintf("%s%d", dev->dev.driver->name, id); if (cdev->name == NULL) return -ENOMEM; return devfs_create(cdev); } +static int ds2433_probe(struct w1_device *dev) +{ + return ds2433_cdev_create(dev, 512, ds2433_count++); +} + +static int ds28ec20_probe(struct w1_device *dev) +{ + return ds2433_cdev_create(dev, 2560, ds28ec20_count++); +} + struct w1_driver ds2433_driver = { .drv = { - .name = DRIVERNAME, + .name = "ds2433", }, .probe = ds2433_probe, .fid = 0x23, }; +struct w1_driver ds28ec20_driver = { + .drv = { + .name = "ds28ec20", + }, + .probe = ds28ec20_probe, + .fid = 0x43, +}; + static int w1_ds2433_init(void) { - return w1_driver_register(&ds2433_driver); + int ret; + + ret = w1_driver_register(&ds2433_driver); + if (ret) + return ret; + + return w1_driver_register(&ds28ec20_driver); } device_initcall(w1_ds2433_init); diff --git a/fs/tftp.c b/fs/tftp.c index b40353b..f86a7d1 100644 --- a/fs/tftp.c +++ b/fs/tftp.c @@ -246,6 +246,11 @@ } } +static void tftp_timer_reset(struct file_priv *priv) +{ + priv->progress_timeout = priv->resend_timeout = get_time_ns(); +} + static void tftp_handler(void *ctx, char *packet, unsigned len) { struct file_priv *priv = ctx; @@ -282,6 +287,9 @@ } priv->block++; + + tftp_timer_reset(priv); + if (priv->state == STATE_LAST) { priv->state = STATE_DONE; break; @@ -335,6 +343,8 @@ priv->last_block = priv->block; + tftp_timer_reset(priv); + kfifo_put(priv->fifo, pkt + 2, len); if (len < priv->blocksize) { @@ -364,11 +374,6 @@ } } -static void tftp_timer_reset(struct file_priv *priv) -{ - priv->progress_timeout = priv->resend_timeout = get_time_ns(); -} - static struct file_priv *tftp_do_open(struct device_d *dev, int accmode, const char *filename) { @@ -549,8 +554,6 @@ debug("%s %zu\n", __func__, insize); - tftp_timer_reset(priv); - while (insize) { now = kfifo_get(priv->fifo, buf, insize); if (priv->state == STATE_DONE) @@ -561,10 +564,8 @@ insize -= now; } - if (TFTP_FIFO_SIZE - kfifo_len(priv->fifo) >= priv->blocksize) { + if (TFTP_FIFO_SIZE - kfifo_len(priv->fifo) >= priv->blocksize) tftp_send(priv); - tftp_timer_reset(priv); - } ret = tftp_poll(priv); if (ret == TFTP_ERR_RESEND) diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index 17d5fd1..5492aa4 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h @@ -3,6 +3,7 @@ extern char _text[], _stext[], _etext[]; extern char __bss_start[], __bss_stop[]; +extern char _sdata[], _edata[]; extern char __bare_init_start[], __bare_init_end[]; extern char _end[]; extern void *_barebox_image_size; diff --git a/include/common.h b/include/common.h index 56347df..e559b94 100644 --- a/include/common.h +++ b/include/common.h @@ -216,6 +216,8 @@ #define PAGE_SIZE 4096 #define PAGE_SHIFT 12 +#define PAGE_ALIGN(s) (((s) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)) +#define PAGE_ALIGN_DOWN(x) ((x) & ~(PAGE_SIZE - 1)) int memory_display(char *addr, loff_t offs, ulong nbytes, int size, int swab); diff --git a/include/stdio.h b/include/stdio.h index 4901bc7..5c091a8 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -11,6 +11,15 @@ /* serial stuff */ void serial_printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2))); +int sprintf(char *buf, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3))); +int snprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(__printf__, 3, 4))); +int vsprintf(char *buf, const char *fmt, va_list args); +char *asprintf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2))); +char *vasprintf(const char *fmt, va_list ap); +int vsnprintf(char *buf, size_t size, const char *fmt, va_list args); +int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); + +#ifndef CONFIG_CONSOLE_NONE /* stdin */ int tstc(void); @@ -20,6 +29,51 @@ int console_puts(unsigned int ch, const char *s); void console_flush(void); + +int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2))); +int vprintf(const char *fmt, va_list args); +#else +static inline int tstc(void) +{ + return 0; +} + +static inline int console_puts(unsigned int ch, const char *str) +{ + return 0; +} + +static inline int getc(void) +{ + return -EINVAL; +} + +static inline void console_putc(unsigned int ch, char c) {} + +static inline void console_flush(void) {} + +static int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2))); +static inline int printf(const char *fmt, ...) +{ + return 0; +} + + +static inline int vprintf(const char *fmt, va_list args) +{ + return 0; +} + +#ifndef ARCH_HAS_CTRLC +/* test if ctrl-c was pressed */ +static inline int ctrlc (void) +{ + return 0; +} +#endif /* ARCH_HAS_CTRC */ + +#endif + static inline int puts(const char *s) { return console_puts(CONSOLE_STDOUT, s); @@ -30,16 +84,6 @@ console_putc(CONSOLE_STDOUT, c); } -int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2))); -int vprintf(const char *fmt, va_list args); -int sprintf(char *buf, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3))); -int snprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(__printf__, 3, 4))); -int vsprintf(char *buf, const char *fmt, va_list args); -char *asprintf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2))); -char *vasprintf(const char *fmt, va_list ap); -int vsnprintf(char *buf, size_t size, const char *fmt, va_list args); -int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); - /* stderr */ #define eputc(c) console_putc(CONSOLE_STDERR, c) #define eputs(s) console_puts(CONSOLE_STDERR, s) diff --git a/net/Kconfig b/net/Kconfig index acd92ff..c12193d 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -17,6 +17,7 @@ config NET_NETCONSOLE bool + depends on !CONSOLE_NONE prompt "network console support" help This option adds support for a simple udp based network console.