apps/examples/cromfs: Add an example of how to build a CROMFS file system image.

This commit is contained in:
Gregory Nutt 2018-03-20 08:44:16 -06:00
parent 29c576c820
commit 08083d3b2e
11 changed files with 237 additions and 0 deletions

13
examples/cromfs/.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
/Make.dep
/.depend
/.built
/*.asm
/*.obj
/*.rel
/*.lst
/*.sym
/*.adb
/*.lib
/*.src
/cromfs.c

19
examples/cromfs/Kconfig Normal file
View File

@ -0,0 +1,19 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
config EXAMPLES_CROMFS
bool "CROMFS Example"
default n
depends on FS_CROMFS && BUILD_FLAT
---help---
Enable the CROMFS loader example
NOTE: This example simple creates a CROMFS image. There is no
program to be executed. If properly constructed, it should provide
the in-memory, compressed file system image used by the CROMFS file
system.
NOTE: Since this example does export symbols used with the OS, it
can only be used in the FLAT build mode.

39
examples/cromfs/Make.defs Normal file
View File

@ -0,0 +1,39 @@
############################################################################
# apps/examples/cromfs/Make.defs
# Adds selected applications to apps/ build
#
# Copyright (C) 2018 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_CROMFS),y)
CONFIGURED_APPS += examples/cromfs
endif

104
examples/cromfs/Makefile Normal file
View File

@ -0,0 +1,104 @@
############################################################################
# apps/examples/cromfs/Makefile
#
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
# CROMFS Example
CSRCS = cromfs.c
COBJS = $(CSRCS:.c=$(OBJEXT))
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
BIN = ../../libapps$(LIBEXT)
endif
endif
NXTOOLDIR = $(TOPDIR)/tools
GENCROMFSSRC = gencromfs.c
GENCROMFSEXE = gencromfs$(EXEEXT)
ROOTDEPPATH = --dep-path .
# Build targets
VPATH = .
all: .built
.PHONY: clean depend distclean preconfig
.PRECIOUS: ../../libapps$(LIBEXT)
$(COBJS) : %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
$(NXTOOLDIR)$(DELIM)$(GENCROMFSEXE): $(NXTOOLDIR)$(DELIM)$(GENCROMFSSRC)
$(Q) $(MAKE) -C $(NXTOOLDIR) -f Makefile.host $(GENCROMFSEXE)
cromfs.c: $(NXTOOLDIR)$(DELIM)$(GENCROMFSEXE)
$(Q) $(NXTOOLDIR)$(DELIM)$(GENCROMFSEXE) cromfs cromfs.c
.built: cromfs.c $(COBJS)
$(call ARCHIVE, $(BIN), $(COBJS))
@touch .built
install:
context:
# We can't make dependencies in this directory because the required
# header files may not yet exist.
.depend:
@touch $@
depend: .depend
clean:
$(call DELFILE, .built)
$(call CLEAN)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
$(call DELFILE, cromfs.c)
preconfig:
-include Make.dep

View File

@ -0,0 +1,8 @@
Baa, baa, black sheep,
Have you any wool?
Yes sir, yes sir,
Three bags full;
One for the master,
And one for the dame,
And one for the little boy
Who lives down the lane.

View File

@ -0,0 +1,4 @@
Jack Sprat could eat no fat,
His wife could eat no lean,
And so betwixt the two of them
They licked the platter clean

View File

@ -0,0 +1,11 @@
Ding, dong, bell,
Pussy's in the well.
Who put her in?
Little Johnny Green.
Who pulled her out?
Little Tommy Stout.
What a naughty boy was that,
To try to drown poor pussy cat,
Who never did him any harm,
And killed the mice in his father's barn.

View File

@ -0,0 +1,8 @@
See, saw, Marjorie Daw,
Jennie shall have a new master.
She shall have but a penny a day,
because she can't work any faster.
See, saw, Marjorie Daw,
Jimmy shall have a new master.
He shall have but a penny a day,
because he can't work any faster.

View File

@ -0,0 +1,5 @@
Hickory, dickory, dock,
The mouse ran up the clock.
The clock struck one,
The mouse ran down!
Hickory, dickory, dock.

View File

@ -0,0 +1,17 @@
Once upon a time there were three little pigs and the time came for them to leave home and seek their fortunes. Before they left, their mother told them " Whatever you do , do it the best that you can because that's the way to get along in the world.
The first little pig built his house out of straw because it was the easiest thing to do. The second little pig built his house out of sticks. This was a little bit stronger than a straw house. The third little pig built his house out of bricks.
One night the big bad wolf, who dearly loved to eat fat little piggies, came along and saw the first little pig in his house of straw. He said "Let me in, Let me in, little pig or I'll huff and I'll puff and I'll blow your house in!" "Not by the hair of my chinny chin chin", said the little pig. But of course the wolf did blow the house in and ate the first little pig.
The wolf then came to the house of sticks. "Let me in ,Let me in little pig or I'll huff and I'll puff and I'll blow your house in" "Not by the hair of my chinny chin chin", said the little pig. But the wolf blew that house in too, and ate the second little pig.
The wolf then came to the house of bricks. " Let me in , let me in" cried the wolf "Or I'll huff and I'll puff till I blow your house in" "Not by the hair of my chinny chin chin" said the pigs. Well, the wolf huffed and puffed but he could not blow down that brick house.
But the wolf was a sly old wolf and he climbed up on the roof to look for a way into the brick house.
The little pig saw the wolf climb up on the roof and lit a roaring fire in the fireplace and placed on it a large kettle of water.
When the wolf finally found the hole in the chimney he crawled down and KERSPLASH right into that kettle of water and that was the end of his troubles with the big bad wolf.
The next day the little pig invited his mother over . She said "You see it is just as I told you. The way to get along in the world is to do things as well as you can." Fortunately for that little pig, he learned that lesson. And he just lived happily ever after!

View File

@ -0,0 +1,9 @@
Jack, be nimble,
Jack, be quick,
Jack, jump over
The candlestick.
Jack jumped high
Jack jumped low
Jack jumped over
and burned his toe.