From b26c1c30ebf212bf5c18b56856c7ae8241e7db32 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Tue, 15 Jan 2013 21:43:32 +0100 Subject: [PATCH 01/14] defaultenv-2: execute init/* before timeout so we can have splash, usb serial, etc... Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Sascha Hauer --- defaultenv-2/base/bin/init | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/defaultenv-2/base/bin/init b/defaultenv-2/base/bin/init index bb4abcdec..c377ecafc 100644 --- a/defaultenv-2/base/bin/init +++ b/defaultenv-2/base/bin/init @@ -27,8 +27,9 @@ 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 +39,13 @@ for i in /env/init/*; do . $i done +timeout -a $global.autoboot_timeout -v key +autoboot="$?" + +if [ "${key}" = "q" ]; then + exit +fi + if [ "$autoboot" = 0 ]; then boot fi From 47326f80a9a18ae2dee436e21bfc6770d935be55 Mon Sep 17 00:00:00 2001 From: Alexander Aring Date: Tue, 15 Jan 2013 14:48:43 +0100 Subject: [PATCH 02/14] remap_range: make function 'remap_range' global Change function remap_range in arm architecture to make it global accessable. For example command 'memtest' can change pte flags to enable or disable cache. Add dummy function for others architectures that doesn't have mmu or pte support. Signed-off-by: Alexander Aring Signed-off-by: Sascha Hauer --- arch/arm/cpu/mmu.c | 16 +++++++++++++++- arch/arm/include/asm/mmu.h | 17 +++++++++++++++++ arch/blackfin/include/asm/mmu.h | 18 ++++++++++++++++++ arch/mips/include/asm/mmu.h | 18 ++++++++++++++++++ arch/nios2/include/asm/mmu.h | 18 ++++++++++++++++++ arch/openrisc/include/asm/mmu.h | 18 ++++++++++++++++++ arch/ppc/include/asm/mmu.h | 18 ++++++++++++++++++ arch/sandbox/include/asm/mmu.h | 18 ++++++++++++++++++ arch/x86/include/asm/mmu.h | 18 ++++++++++++++++++ 9 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 arch/blackfin/include/asm/mmu.h create mode 100644 arch/mips/include/asm/mmu.h create mode 100644 arch/nios2/include/asm/mmu.h create mode 100644 arch/openrisc/include/asm/mmu.h create mode 100644 arch/sandbox/include/asm/mmu.h create mode 100644 arch/x86/include/asm/mmu.h diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c index 40b7ec4e8..6e2eccaf2 100644 --- a/arch/arm/cpu/mmu.c +++ b/arch/arm/cpu/mmu.c @@ -52,11 +52,25 @@ extern int arm_architecture; #define PTE_FLAGS_CACHED_V4 (PTE_SMALL_AP_UNO_SRW | PTE_BUFFERABLE | PTE_CACHEABLE) #define PTE_FLAGS_UNCACHED_V4 PTE_SMALL_AP_UNO_SRW +/* + * 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 @@ static u32 *find_pte(unsigned long adr) 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; diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h index a66da8c0a..f32cea639 100644 --- a/arch/arm/include/asm/mmu.h +++ b/arch/arm/include/asm/mmu.h @@ -41,7 +41,10 @@ void dma_flush_range(unsigned long, unsigned long); 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 dma_inv_range(unsigned long s, unsigned long e) { } +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/blackfin/include/asm/mmu.h b/arch/blackfin/include/asm/mmu.h new file mode 100644 index 000000000..bf654206a --- /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 000000000..bf654206a --- /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/nios2/include/asm/mmu.h b/arch/nios2/include/asm/mmu.h new file mode 100644 index 000000000..bf654206a --- /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 000000000..bf654206a --- /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/include/asm/mmu.h b/arch/ppc/include/asm/mmu.h index b2dd0b7b2..179ec2b1a 100644 --- a/arch/ppc/include/asm/mmu.h +++ b/arch/ppc/include/asm/mmu.h @@ -540,4 +540,22 @@ extern int write_bat(ppc_bat_t bat, unsigned long upper, unsigned long lower); (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 000000000..bf654206a --- /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 000000000..bf654206a --- /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 */ From d32b75f0033f9802712bbf112d4220e8536229df Mon Sep 17 00:00:00 2001 From: Alexander Aring Date: Tue, 15 Jan 2013 14:48:45 +0100 Subject: [PATCH 03/14] arm-mmu: move PAGE_ALIGN macro to common.h PAGE_ALIGN macro is needed to align addresses to page boundaries. Move this macro to another PAGE_* defines. Commands which uses remap_range function needs this macro. Signed-off-by: Alexander Aring Signed-off-by: Sascha Hauer --- arch/arm/cpu/mmu.c | 2 -- include/common.h | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c index 6e2eccaf2..6e2435622 100644 --- a/arch/arm/cpu/mmu.c +++ b/arch/arm/cpu/mmu.c @@ -308,8 +308,6 @@ void mmu_disable(void) __mmu_cache_off(); } -#define PAGE_ALIGN(s) (((s) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)) - void *dma_alloc_coherent(size_t size) { void *ret; diff --git a/include/common.h b/include/common.h index b1c96de88..95333441f 100644 --- a/include/common.h +++ b/include/common.h @@ -225,6 +225,7 @@ int run_shell(void); #define PAGE_SIZE 4096 #define PAGE_SHIFT 12 +#define PAGE_ALIGN(s) (((s) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)) int memory_display(char *addr, loff_t offs, ulong nbytes, int size, int swab); From f8fd03225d05ce96cdeaf8d96fb73780eb77805c Mon Sep 17 00:00:00 2001 From: Alexander Aring Date: Tue, 15 Jan 2013 14:48:46 +0100 Subject: [PATCH 04/14] common: add PAGE_ALIGN_DOWN macro Add PAGE_ALIGN_DOWN macro, which is like PAGE_ALIGN macro but returns the lower page boundary of address. Signed-off-by: Alexander Aring Signed-off-by: Sascha Hauer --- include/common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/common.h b/include/common.h index 95333441f..3e67164ea 100644 --- a/include/common.h +++ b/include/common.h @@ -226,6 +226,7 @@ int run_shell(void); #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); From 43afe67390697041d1d16d4e5c934d2bfa831399 Mon Sep 17 00:00:00 2001 From: Alexander Aring Date: Tue, 15 Jan 2013 14:48:48 +0100 Subject: [PATCH 05/14] barebox-data: add barebox-data sections Add barebox-data section in arm branch to get complete barebox regions in sdram regions tree. Signed-off-by: Alexander Aring Signed-off-by: Sascha Hauer --- arch/arm/lib/barebox.lds.S | 2 ++ arch/blackfin/boards/ipe337/barebox.lds.S | 2 ++ arch/mips/lib/barebox.lds.S | 2 ++ arch/nios2/cpu/barebox.lds.S | 1 + arch/ppc/boards/freescale-p2020rdb/barebox.lds.S | 1 + arch/ppc/boards/pcm030/barebox.lds.S | 1 + arch/x86/lib/barebox.lds.S | 2 ++ common/memory.c | 4 ++++ include/asm-generic/sections.h | 1 + 9 files changed, 16 insertions(+) diff --git a/arch/arm/lib/barebox.lds.S b/arch/arm/lib/barebox.lds.S index bac1a04f8..e5aee8cd8 100644 --- a/arch/arm/lib/barebox.lds.S +++ b/arch/arm/lib/barebox.lds.S @@ -66,6 +66,7 @@ SECTIONS } #endif _etext = .; /* End of text and rodata section */ + _sdata = .; . = ALIGN(4); .data : { *(.data*) } @@ -87,6 +88,7 @@ SECTIONS __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 6a07b43a1..21a91eeb0 100644 --- a/arch/blackfin/boards/ipe337/barebox.lds.S +++ b/arch/blackfin/boards/ipe337/barebox.lds.S @@ -55,6 +55,7 @@ SECTIONS .rodata : { *(.rodata) } __etext = .; /* End of text and rodata section */ + __sdata = .; . = ALIGN(4); .data : { *(.data) } @@ -79,6 +80,7 @@ SECTIONS __usymtab : { BAREBOX_SYMS } ___usymtab_end = .; + __edata = .; . = ALIGN(4); ___bss_start = .; .bss : { *(.bss) } diff --git a/arch/mips/lib/barebox.lds.S b/arch/mips/lib/barebox.lds.S index 0cbf2d71e..5b3d45dc3 100644 --- a/arch/mips/lib/barebox.lds.S +++ b/arch/mips/lib/barebox.lds.S @@ -44,6 +44,7 @@ SECTIONS .rodata : { *(.rodata*) } _etext = .; /* End of text and rodata section */ + _sdata = .; . = ALIGN(4); .data : { *(.data*) } @@ -68,6 +69,7 @@ SECTIONS __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 af7be4de3..943c50753 100644 --- a/arch/nios2/cpu/barebox.lds.S +++ b/arch/nios2/cpu/barebox.lds.S @@ -74,6 +74,7 @@ SECTIONS * adjacent to simplify the startup code -- and provide * the global pointer for gp-relative access. */ + _sdata = .; _data = .; .data : { diff --git a/arch/ppc/boards/freescale-p2020rdb/barebox.lds.S b/arch/ppc/boards/freescale-p2020rdb/barebox.lds.S index 95033d490..85a864ec8 100644 --- a/arch/ppc/boards/freescale-p2020rdb/barebox.lds.S +++ b/arch/ppc/boards/freescale-p2020rdb/barebox.lds.S @@ -41,6 +41,7 @@ SECTIONS _etext = .; PROVIDE (etext = .); + _sdata = .; .rodata : { diff --git a/arch/ppc/boards/pcm030/barebox.lds.S b/arch/ppc/boards/pcm030/barebox.lds.S index cc86d82db..20ac0d8a0 100644 --- a/arch/ppc/boards/pcm030/barebox.lds.S +++ b/arch/ppc/boards/pcm030/barebox.lds.S @@ -69,6 +69,7 @@ SECTIONS . = (. + 0x0FFF) & 0xFFFFF000; _etext = .; PROVIDE (erotext = .); + _sdata = .; .reloc : { *(.got) diff --git a/arch/x86/lib/barebox.lds.S b/arch/x86/lib/barebox.lds.S index 8bd2a7b30..05d0f778e 100644 --- a/arch/x86/lib/barebox.lds.S +++ b/arch/x86/lib/barebox.lds.S @@ -153,6 +153,7 @@ SECTIONS } > barebox BAREBOX_BARE_INIT_SIZE + _sdata = .; .data : AT ( LOADADDR(.text) + SIZEOF(.text) ) { *(.data*) . = ALIGN(4); @@ -191,6 +192,7 @@ SECTIONS . = ALIGN(4); } > barebox + _edata = .; .bss : { __bss_start = .; *(.bss*); diff --git a/common/memory.c b/common/memory.c index 7dd13849c..81641f052 100644 --- a/common/memory.c +++ b/common/memory.c @@ -75,6 +75,10 @@ static int mem_malloc_resource(void) (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/include/asm-generic/sections.h b/include/asm-generic/sections.h index 17d5fd1ae..5492aa4d9 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; From 525d82f33e32427da0eefe0878b53ad73a6a7139 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 17 Jan 2013 10:24:16 +0100 Subject: [PATCH 06/14] bootm: move printing of file locations outside verbose mode The location of files that are booted is a precious information, so print it by default and not only in verbose mode. Signed-off-by: Sascha Hauer Cc: Michael Olbrich --- commands/bootm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/commands/bootm.c b/commands/bootm.c index 483e6a193..5ccf2372a 100644 --- a/commands/bootm.c +++ b/commands/bootm.c @@ -143,8 +143,7 @@ static int bootm_open_oftree(struct image_data *data, const char *oftree, int nu 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 @@ static int do_bootm(int argc, char *argv[]) } } + 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, From 12ef4d0df9ad86a7dc3eb4abf9175e227d7a7305 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 16 Jan 2013 11:11:41 +0100 Subject: [PATCH 07/14] tftp: reset timer on progress When during tftp receive operation a ACK packet can't successfully be sent the timer was resetted directly after send resulting in a deadlock. This patch changes the timer reset operation in a way that it is only resetted when the actually is progress, namely in the TFTP_ACK/TFTP_DATA pathes in the tftp handler. Reported-by: Antony Pavlov Signed-off-by: Sascha Hauer Tested-by: Antony Pavlov --- fs/tftp.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/fs/tftp.c b/fs/tftp.c index 98cbb379b..4d32b0d2a 100644 --- a/fs/tftp.c +++ b/fs/tftp.c @@ -246,6 +246,11 @@ static void tftp_parse_oack(struct file_priv *priv, unsigned char *pkt, int len) } } +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 @@ static void tftp_handler(void *ctx, char *packet, unsigned len) } priv->block++; + + tftp_timer_reset(priv); + if (priv->state == STATE_LAST) { priv->state = STATE_DONE; break; @@ -335,6 +343,8 @@ static void tftp_handler(void *ctx, char *packet, unsigned len) 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_handler(void *ctx, char *packet, unsigned len) } } -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 @@ static int tftp_read(struct device_d *dev, FILE *f, void *buf, size_t insize) debug("%s %d\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 @@ static int tftp_read(struct device_d *dev, FILE *f, void *buf, size_t insize) 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) From f19a924f92abfc994f300200abedbae32ce9807a Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sat, 19 Jan 2013 08:37:55 +0100 Subject: [PATCH 08/14] defaultenv-2: move ps1 to base/init/ps1 so we can overwrite it Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Sascha Hauer --- defaultenv-2/base/bin/init | 6 ------ defaultenv-2/base/init/ps1 | 9 +++++++++ 2 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 defaultenv-2/base/init/ps1 diff --git a/defaultenv-2/base/bin/init b/defaultenv-2/base/bin/init index c377ecafc..b606b634a 100644 --- a/defaultenv-2/base/bin/init +++ b/defaultenv-2/base/bin/init @@ -15,12 +15,6 @@ global editcmd=sedit /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 diff --git a/defaultenv-2/base/init/ps1 b/defaultenv-2/base/init/ps1 new file mode 100644 index 000000000..fcbf4b63f --- /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 From c4d0b665dc4eac9ebd835e04f60ca46cac4c0469 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sun, 20 Jan 2013 13:45:18 +0100 Subject: [PATCH 09/14] w1: add ds28ec20 eeprom support Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Sascha Hauer --- drivers/w1/slaves/Kconfig | 4 ++-- drivers/w1/slaves/w1_ds2433.c | 43 ++++++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/drivers/w1/slaves/Kconfig b/drivers/w1/slaves/Kconfig index 946a0b3bb..19942ad1d 100644 --- a/drivers/w1/slaves/Kconfig +++ b/drivers/w1/slaves/Kconfig @@ -15,10 +15,10 @@ config W1_SLAVE_DS2431_WRITE 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 51279fb0e..a840d9a2f 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 @@ static ssize_t ds2433_cdev_read(struct cdev *cdev, void *buf, size_t count, 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 @@ static ssize_t ds2433_cdev_write(struct cdev *cdev, const void *buf, size_t coun 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 @@ static struct file_operations ds2433_ops = { .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 @@ static int ds2433_probe(struct w1_device *dev) 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); From 2bdc28c475654435f0c92a578d7ad44de6638f61 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Wed, 23 Jan 2013 11:01:19 +0100 Subject: [PATCH 10/14] console: switch select to choice so we can add easly the console_none support Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Sascha Hauer --- arch/arm/configs/archosg9_xload_defconfig | 2 +- .../configs/omap3530_beagle_xload_defconfig | 2 +- arch/arm/configs/panda_xload_defconfig | 2 +- arch/arm/configs/pcm049_xload_defconfig | 2 +- arch/arm/configs/phycard_a_l1_xload_defconfig | 2 +- arch/arm/configs/phycard_a_xl2_xload_defconfig | 2 +- common/Kconfig | 18 +++++++++++------- 7 files changed, 17 insertions(+), 13 deletions(-) diff --git a/arch/arm/configs/archosg9_xload_defconfig b/arch/arm/configs/archosg9_xload_defconfig index 6c6782f8e..83743fa94 100644 --- a/arch/arm/configs/archosg9_xload_defconfig +++ b/arch/arm/configs/archosg9_xload_defconfig @@ -15,7 +15,7 @@ CONFIG_MALLOC_SIZE=0x2000000 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 d951b1c98..244891b3c 100644 --- a/arch/arm/configs/omap3530_beagle_xload_defconfig +++ b/arch/arm/configs/omap3530_beagle_xload_defconfig @@ -14,7 +14,7 @@ CONFIG_PROMPT="X-load Beagle>" 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 fec09cec9..1ed20a157 100644 --- a/arch/arm/configs/panda_xload_defconfig +++ b/arch/arm/configs/panda_xload_defconfig @@ -14,7 +14,7 @@ CONFIG_PROMPT="barebox> " 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 b6d3a7a37..9dfc30d95 100644 --- a/arch/arm/configs/pcm049_xload_defconfig +++ b/arch/arm/configs/pcm049_xload_defconfig @@ -17,7 +17,7 @@ CONFIG_PROMPT="barebox> " 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 30253cba1..5901ed10a 100644 --- a/arch/arm/configs/phycard_a_l1_xload_defconfig +++ b/arch/arm/configs/phycard_a_l1_xload_defconfig @@ -20,7 +20,7 @@ CONFIG_CBSIZE=128 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 797522065..84160e341 100644 --- a/arch/arm/configs/phycard_a_xl2_xload_defconfig +++ b/arch/arm/configs/phycard_a_xl2_xload_defconfig @@ -17,7 +17,7 @@ CONFIG_PROMPT="barebox> " 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/common/Kconfig b/common/Kconfig index b60b78bb8..541c512df 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -465,10 +465,13 @@ config TIMESTAMP 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 @@ -477,6 +480,12 @@ config CONSOLE_FULL once the first console is registered. Recommended for most usecases. +config CONSOLE_SIMPLE + bool + prompt "simple" + +endchoice + choice prompt "Console activation strategy" depends on CONSOLE_FULL @@ -509,11 +518,6 @@ config CONSOLE_ACTIVATE_NONE endchoice -config CONSOLE_SIMPLE - bool - default y - depends on !CONSOLE_FULL - config PARTITION bool prompt "Enable Partitions" From b1da925c8a8ab9145cbbc3d9359f8d81881b261d Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Wed, 23 Jan 2013 11:01:20 +0100 Subject: [PATCH 11/14] introduce console none support this will allow to have no console support Use full for bootstrap as we can save 6.5 KiB (barebox.bin) and 3.8 KiB (zbarebox.bin lzo) on at91sam9263 as example vs console simple As on bootstrap we have often very limited size. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Sascha Hauer --- commands/Kconfig | 3 ++ common/Kconfig | 4 +++ common/Makefile | 1 + common/console_none.c | 42 +++++++++++++++++++++++++ drivers/serial/Kconfig | 1 + drivers/usb/gadget/Kconfig | 2 +- include/stdio.h | 64 ++++++++++++++++++++++++++++++++------ net/Kconfig | 1 + 8 files changed, 107 insertions(+), 11 deletions(-) create mode 100644 common/console_none.c diff --git a/commands/Kconfig b/commands/Kconfig index 53cee5cbf..2e8f214ea 100644 --- a/commands/Kconfig +++ b/commands/Kconfig @@ -260,6 +260,7 @@ endmenu menu "memory" config CMD_LOADB + depends on !CONSOLE_NONE select CRC16 tristate prompt "loadb" @@ -267,10 +268,12 @@ config CMD_LOADB 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/common/Kconfig b/common/Kconfig index 541c512df..43e693646 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -484,6 +484,10 @@ config CONSOLE_SIMPLE bool prompt "simple" +config CONSOLE_NONE + bool + prompt "none" + endchoice choice diff --git a/common/Makefile b/common/Makefile index d82fc998b..7206eed8b 100644 --- a/common/Makefile +++ b/common/Makefile @@ -23,6 +23,7 @@ obj-$(CONFIG_MEMINFO) += meminfo.o 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 000000000..b6018148d --- /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/drivers/serial/Kconfig b/drivers/serial/Kconfig index a8be9cdc8..f61d6708a 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 6501d4287..5f65cea98 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -44,7 +44,7 @@ config USB_GADGET_DFU config USB_GADGET_SERIAL bool - depends on EXPERIMENTAL + depends on EXPERIMENTAL && !CONSOLE_NONE prompt "Serial Gadget" endif diff --git a/include/stdio.h b/include/stdio.h index 4901bc718..5c091a8ea 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 getc(void); 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 @@ static inline void putchar(char c) 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 acd92ffe2..c12193db5 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -17,6 +17,7 @@ config NET_PING config NET_NETCONSOLE bool + depends on !CONSOLE_NONE prompt "network console support" help This option adds support for a simple udp based network console. From 56f99ec44a7253ae5f010be978fd8f205c066625 Mon Sep 17 00:00:00 2001 From: Alexander Aring Date: Fri, 25 Jan 2013 01:59:43 +0100 Subject: [PATCH 12/14] arm-mmu: switch pte flags vars to lower case Old cache/uncache pte flags were declared as defines. Since these flags are determine at runtime they are static variables. This patch switch the naming style of these variables to lower case which is typically used for variables. Signed-off-by: Alexander Aring Signed-off-by: Sascha Hauer --- arch/arm/cpu/mmu.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c index 6e2435622..7b5f4eeeb 100644 --- a/arch/arm/cpu/mmu.c +++ b/arch/arm/cpu/mmu.c @@ -56,19 +56,19 @@ extern int arm_architecture; * 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; +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; + return pte_flags_cached; } uint32_t mmu_get_pte_uncached_flags() { - return PTE_FLAGS_UNCACHED; + return pte_flags_uncached; } /* @@ -86,7 +86,7 @@ static u32 *arm_create_pte(unsigned long virt) 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; } @@ -169,7 +169,7 @@ static int arm_mmu_remap_sdram(struct memory_bank *bank) for (i = 0; i < num_ptes; i++) { ptes[i] = (phys + i * 4096) | PTE_TYPE_SMALL | - PTE_FLAGS_CACHED; + pte_flags_cached; } pte = 0; @@ -231,9 +231,10 @@ static void vectors_init(void) 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; } /* @@ -247,11 +248,11 @@ static int mmu_init(void) 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); @@ -317,7 +318,7 @@ void *dma_alloc_coherent(size_t size) 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; } @@ -334,7 +335,7 @@ void *phys_to_virt(unsigned long phys) 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); } From 263e454f7fceb399a55c847b967ea3bd89b46373 Mon Sep 17 00:00:00 2001 From: Antony Pavlov Date: Tue, 29 Jan 2013 15:03:05 +0400 Subject: [PATCH 13/14] commands: reset: add shutdown_barebox() before reset_cpu() Some of controlled by barebox peripheral devices may be not affected by CPU reset, so we need call shutdown_barebox() to stop them. Signed-off-by: Antony Pavlov Signed-off-by: Sascha Hauer --- commands/reset.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/commands/reset.c b/commands/reset.c index 835926b27..79885f4af 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 From 195310fd7b48e2c1198f216f9b4122d8f63e620e Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sun, 3 Feb 2013 11:16:55 +0100 Subject: [PATCH 14/14] MAKEALL: add regex support this will allow to compile only a subset of defconfig Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Sascha Hauer --- MAKEALL | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/MAKEALL b/MAKEALL index c08e484cd..18ed86216 100755 --- a/MAKEALL +++ b/MAKEALL @@ -56,6 +56,7 @@ usage() { 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_target() { 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 @@ do_build_all() { 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 @@ case $Option in O ) BUILDDIR=${OPTARG} ;; + e ) + REGEX=${OPTARG} + ;; h ) usage exit 0 @@ -241,6 +246,11 @@ fi [ -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 @@ fi if [ $# -eq 0 ] then - do_build ${ARCH} + do_build ${ARCH} "${REGEX}" else do_build_target ${ARCH} $1 fi