Move all filesystem generation code to fs/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
Thomas Petazzoni
2010-03-10 22:30:06 +01:00
parent 325bfd1cba
commit 0585241505
30 changed files with 37 additions and 34 deletions

30
fs/Config.in Normal file
View File

@@ -0,0 +1,30 @@
menu "Target filesystem options"
config BR2_ROOTFS_POST_BUILD_SCRIPT
string "Custom script to run before packing files"
default ""
help
Specify a script to be run after the build has finished and before
the BR2 starts packing the files into selected packages.
This gives users the oportunity to do board-specific cleanups,
add-ons and the like, so the generated files can be used directly
without further processing.
The script is called with the target directory name as first and
only argument. Make sure the exit code of that script is 0,
otherwise make will stop after calling it.
source "fs/cramfs/Config.in"
source "fs/cloop/Config.in"
source "fs/ext2/Config.in"
source "fs/jffs2/Config.in"
source "fs/ubifs/Config.in"
source "fs/squashfs/Config.in"
source "fs/tar/Config.in"
source "fs/cpio/Config.in"
source "fs/iso9660/Config.in"
source "fs/initramfs/Config.in"
source "fs/romfs/Config.in"
endmenu

10
fs/cloop/Config.in Normal file
View File

@@ -0,0 +1,10 @@
config BR2_TARGET_ROOTFS_CLOOP
bool "cloop root filesystem for the target device"
help
Build a cloop root filesystem
cloop is a Linux kernel module that enables compressed
loopback filesystem support. With it you can mount a
compressed filesystem like a block device and seamlessly
decompress its data while accessing it. The majority of the
software on an LNX-BBC is accessed in this fashion.

13
fs/cloop/cloop.mk Normal file
View File

@@ -0,0 +1,13 @@
#############################################################
#
# Build the compressed loop root filesystem image
#
#############################################################
ROOTFS_CLOOP_DEPENDENCIES = host-cloop host-cdrkit
define ROOTFS_CLOOP_CMD
$(HOST_DIR)/usr/bin/genisoimage -r $(TARGET_DIR) | $(HOST_DIR)/usr/bin/create_compressed_fs - 65536 > $$@
endef
$(eval $(call ROOTFS_TARGET,cloop))

70
fs/common.mk Normal file
View File

@@ -0,0 +1,70 @@
#
# Macro that builds the needed Makefile target to create a root
# filesystem image.
#
# The following variable must be defined before calling this macro
#
# ROOTFS_$(FSTYPE)_CMD, the command that generates the root
# filesystem image. A single command is allowed. The filename of the
# filesystem image that it must generate is $$@.
#
# The following variables can optionaly be defined
#
# ROOTFS_$(FSTYPE)_DEPENDENCIES, the list of dependencies needed to
# build the root filesystem (usually host tools)
#
# ROOTFS_$(FSTYPE)_PRE_GEN_HOOKS, a list of hooks to call before
# generating the filesystem image
#
# ROOTFS_$(FSTYPE)_POST_GEN_HOOKS, a list of hooks to call after
# generating the filesystem image
#
# In terms of configuration option, this macro assumes that the
# BR2_TARGET_ROOTFS_$(FSTYPE) config option allows to enable/disable
# the generation of a filesystem image of a particular type. If
# configura options BR2_TARGET_ROOTFS_$(FSTYPE)_GZIP,
# BR2_TARGET_ROOTFS_$(FSTYPE)_BZIP2 or
# BR2_TARGET_ROOTFS_$(FSTYPE)_LZMA exist and are enabled, then the
# macro will automatically generate a compressed filesystem image.
FAKEROOT_SCRIPT = $(BUILD_DIR)/_fakeroot.fs
define ROOTFS_TARGET_INTERNAL
$(BINARIES_DIR)/rootfs.$(1): $(ROOTFS_$(2)_DEPENDENCIES) host-fakeroot makedevs $(if $(BR2_TARGET_ROOTFS_$(2)_LZMA),host-lzma)
@$(call MESSAGE,"Generating root filesystem image rootfs.$(1)")
$(foreach hook,$(ROOTFS_$(2)_PRE_GEN_HOOKS),$(call $(hook))$(sep))
rm -f $(FAKEROOT_SCRIPT)
touch $(BUILD_DIR)/.fakeroot.00000
cat $(BUILD_DIR)/.fakeroot* > $(FAKEROOT_SCRIPT)
echo "chown -R 0:0 $(TARGET_DIR)" >> $(FAKEROOT_SCRIPT)
ifneq ($(TARGET_DEVICE_TABLE),)
echo "$(HOST_DIR)/usr/bin/makedevs -d $(TARGET_DEVICE_TABLE) $(TARGET_DIR)" >> $(FAKEROOT_SCRIPT)
endif
echo "$(ROOTFS_$(2)_CMD)" >> $(FAKEROOT_SCRIPT)
chmod a+x $(FAKEROOT_SCRIPT)
$(HOST_DIR)/usr/bin/fakeroot -- $(FAKEROOT_SCRIPT)
-@rm -f $(FAKEROOT_SCRIPT)
$(foreach hook,$(ROOTFS_$(2)_POST_GEN_HOOKS),$(call $(hook))$(sep))
ifeq ($$(BR2_TARGET_ROOTFS_$(2)_GZIP),y)
gzip -9 -c $$@ > $$@.gz
endif
ifeq ($$(BR2_TARGET_ROOTFS_$(2)_BZIP2),y)
bzip2 -9 -c $$@ > $$@.bz2
endif
ifeq ($$(BR2_TARGET_ROOTFS_$(2)_LZMA),y)
$(LZMA) -9 -c $$@ > $$@.lzma
endif
$(1)-root: $(BINARIES_DIR)/rootfs.$(1)
ifeq ($$(BR2_TARGET_ROOTFS_$(2)),y)
TARGETS += $(1)-root
endif
endef
define ROOTFS_TARGET
$(call ROOTFS_TARGET_INTERNAL,$(1),$(call UPPERCASE,$(1)))
endef
include fs/*/*.mk

40
fs/cpio/Config.in Normal file
View File

@@ -0,0 +1,40 @@
config BR2_TARGET_ROOTFS_CPIO
bool "cpio the root filesystem"
help
Build a cpio archive of the root filesystem
choice
prompt "Compression method"
default BR2_TARGET_ROOTFS_CPIO_NONE
depends on BR2_TARGET_ROOTFS_CPIO
help
Select compressor for cpio filesystem of the root filesystem
config BR2_TARGET_ROOTFS_CPIO_NONE
bool "no compression"
help
Do not compress the cpio filesystem.
config BR2_TARGET_ROOTFS_CPIO_GZIP
bool "gzip"
help
Do compress the cpio filesystem with gzip.
Note that you either have to have gzip installed on your host
or select to build a gzip for your host. See the packages submenu.
config BR2_TARGET_ROOTFS_CPIO_BZIP2
bool "bzip2"
help
Do compress the cpio filesystem with bzip2.
Note that you either have to have bzip2 installed on your host
or select to build a bzip2 for your host. See the packages submenu.
config BR2_TARGET_ROOTFS_CPIO_LZMA
bool "lzma"
help
Do compress the cpio filesystem with lzma.
Note that you either have to have lzma installed on your host
or select to build a lzma for your host. See the packages submenu.
endchoice

18
fs/cpio/cpioroot.mk Normal file
View File

@@ -0,0 +1,18 @@
#############################################################
#
# cpio to archive target filesystem
#
#############################################################
define ROOTFS_CPIO_INIT_SYMLINK
rm -f $(TARGET_DIR)/init
ln -s sbin/init $(TARGET_DIR)/init
endef
ROOTFS_CPIO_PRE_GEN_HOOKS += ROOTFS_CPIO_INIT_SYMLINK
define ROOTFS_CPIO_CMD
cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $$@
endef
$(eval $(call ROOTFS_TARGET,cpio))

6
fs/cramfs/Config.in Normal file
View File

@@ -0,0 +1,6 @@
config BR2_TARGET_ROOTFS_CRAMFS
bool "cramfs root filesystem"
help
Build a cramfs root filesystem
http://sourceforge.net/projects/cramfs/

22
fs/cramfs/cramfs.mk Normal file
View File

@@ -0,0 +1,22 @@
#############################################################
#
# Build the cramfs root filesystem image
#
#############################################################
ifeq ($(BR2_ENDIAN),"BIG")
CRAMFS_OPTS=-b
else
CRAMFS_OPTS=-l
endif
ifneq ($(TARGET_DEVICE_TABLE),)
CRAMFS_OPTS += -D $(TARGET_DEVICE_TABLE)
endif
define ROOTFS_CRAMFS_CMD
$(HOST_DIR)/usr/bin/mkcramfs -q $(CRAMFS_OPTS) $(TARGET_DIR) $$@
endef
ROOTFS_CRAMFS_DEPENDENCIES = host-cramfs
$(eval $(call ROOTFS_TARGET,cramfs))

61
fs/ext2/Config.in Normal file
View File

@@ -0,0 +1,61 @@
config BR2_TARGET_ROOTFS_EXT2
bool "ext2 root filesystem"
default y
help
Build an ext2 root filesystem
config BR2_TARGET_ROOTFS_EXT2_BLOCKS
int "size in blocks (leave at 0 for auto calculation)"
depends on BR2_TARGET_ROOTFS_EXT2
default 0
config BR2_TARGET_ROOTFS_EXT2_INODES
int "inodes (leave at 0 for auto calculation)"
depends on BR2_TARGET_ROOTFS_EXT2
default 0
config BR2_TARGET_ROOTFS_EXT2_RESBLKS
int "reserved blocks percentage"
depends on BR2_TARGET_ROOTFS_EXT2
default 0
config BR2_TARGET_ROOTFS_EXT2_SQUASH
bool "Make all files be owned by root"
depends on BR2_TARGET_ROOTFS_EXT2
default y
choice
prompt "Compression method"
default BR2_TARGET_ROOTFS_EXT2_NONE
depends on BR2_TARGET_ROOTFS_EXT2
help
Select compressor for ext2 filesystem of the root filesystem
config BR2_TARGET_ROOTFS_EXT2_NONE
bool "no compression"
help
Do not compress the ext2 filesystem.
config BR2_TARGET_ROOTFS_EXT2_GZIP
bool "gzip"
help
Do compress the ext2 filesystem with gzip.
Note that you either have to have gzip installed on your host
or select to build a gzip for your host. See the packages submenu.
config BR2_TARGET_ROOTFS_EXT2_BZIP2
bool "bzip2"
help
Do compress the ext2 filesystem with bzip2.
Note that you either have to have bzip2 installed on your host
or select to build a bzip2 for your host. See the packages submenu.
config BR2_TARGET_ROOTFS_EXT2_LZMA
bool "lzma"
help
Do compress the ext2 filesystem with lzma.
Note that you either have to have lzma installed on your host
or select to build a lzma for your host. See the packages submenu.
endchoice

40
fs/ext2/ext2root.mk Normal file
View File

@@ -0,0 +1,40 @@
#############################################################
#
# Build the ext2 root filesystem image
#
#############################################################
EXT2_OPTS :=
ifeq ($(BR2_TARGET_ROOTFS_EXT2_SQUASH),y)
EXT2_OPTS += -U
endif
ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0)
EXT2_OPTS += -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
endif
ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_INODES)),0)
EXT2_OPTS += -N $(BR2_TARGET_ROOTFS_EXT2_INODES)
endif
ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)),)
EXT2_OPTS += -m $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)
endif
ROOTFS_EXT2_DEPENDENCIES = host-genext2fs
ifeq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0)
GENEXT2_REALSIZE=$(shell LC_ALL=C du -s -c -k $(TARGET_DIR) | grep total | sed -e "s/total//")
GENEXT2_ADDTOROOTSIZE=$(shell if [ $(GENEXT2_REALSIZE) -ge 20000 ]; then echo 16384; else echo 2400; fi)
GENEXT2_SIZE=$(shell expr $(GENEXT2_REALSIZE) + $(GENEXT2_ADDTOROOTSIZE))
GENEXT2_ADDTOINODESIZE=$(shell find $(TARGET_DIR) | wc -l)
GENEXT2_INODES=$(shell expr $(GENEXT2_ADDTOINODESIZE) + 400)
EXT2_OPTS += -b $(GENEXT2_SIZE) -N $(GENEXT2_INODES)
endif
define ROOTFS_EXT2_CMD
$(HOST_DIR)/usr/bin/genext2fs -d $(TARGET_DIR) $(EXT2_OPTS) $$@
endef
$(eval $(call ROOTFS_TARGET,ext2))

15
fs/initramfs/Config.in Normal file
View File

@@ -0,0 +1,15 @@
config BR2_TARGET_ROOTFS_INITRAMFS
bool "initramfs for initial ramdisk of linux kernel"
help
Build a file which is usable for the gen_init_cpio tool
at linux kernel build.
This file is normally called initramfs_list and can be
generated with gen_initramfs_list.sh script from the root
directory structure.
The file is then used in the kernel build process to generate
the cpio filesystem for the initial ramdisk. Make sure that
you configure this file in kernel build configuration.
The location in the kernel build configuration menu is
Device Drivers -> Block devices -> Initramfs source file(s).
The configuration variable is CONFIG_INITRAMFS_SOURCE

View File

@@ -0,0 +1,203 @@
#!/bin/sh
# Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org>
# Released under the terms of the GNU GPL
#
# Generate a newline separated list of entries from the file/directory
# supplied as an argument.
#
# If a file/directory is not supplied then generate a small dummy file.
#
# The output is suitable for gen_init_cpio built from usr/gen_init_cpio.c.
#
default_initramfs() {
cat <<-EOF
# This is a very simple, default initramfs
dir /dev 0755 0 0
nod /dev/console 0600 0 0 c 5 1
dir /root 0700 0 0
EOF
}
filetype() {
local argv1="$1"
# symlink test must come before file test
if [ -L "$argv1" ]; then
echo "slink"
elif [ -f "$argv1" ]; then
echo "file"
elif [ -d "$argv1" ]; then
echo "dir"
elif [ -b "$argv1" -o -c "$argv1" ]; then
echo "nod"
elif [ -p "$argv1" ]; then
echo "pipe"
elif [ -S "$argv1" ]; then
echo "sock"
else
echo "invalid"
fi
return 0
}
print_mtime() {
local argv1="$1"
local mymtime="0"
if [ -e "$argv1" ]; then
mymtime=$(find "$argv1" -printf "%T@\n" | sort -r | head -n 1)
fi
echo "# Last modified: $mymtime"
echo
}
parse() {
local location="$1"
local name=$(echo "$location" | sed -e "s,$srcdir,,")
# change '//' into '/'
name=$(echo $name | sed -e 's,/[/]*,/,g')
local mode="$2"
local uid="$3"
local gid="$4"
local ftype=$(filetype "$location")
# remap uid/gid to 0 if necessary
[ "x$uid" != "x" ] && [ $uid -eq $root_uid ] && uid=0
[ "x$gid" != "x" ] && [ $gid -eq $root_gid ] && gid=0
local str="$mode $uid $gid"
[ "$ftype" = "invalid" ] && return 0
[ "$location" = "$srcdir" ] && return 0
case "$ftype" in
"file")
str="$ftype $name $location $str"
;;
"nod")
local devtype=
local maj=$(LC_ALL=C ls -l "$location" | \
awk '{sub(/,/, "", $5); print $5}')
local min=$(LC_ALL=C ls -l "$location" | \
awk '{print $6}')
if [ -b "$location" ]; then
devtype="b"
else
devtype="c"
fi
str="$ftype $name $str $devtype $maj $min"
;;
"slink")
local target=$(LC_ALL=C ls -l "$location" | \
awk '{print $11}')
str="$ftype $name $target $str"
;;
*)
str="$ftype $name $str"
;;
esac
echo "$str"
return 0
}
usage() {
printf "Usage:\n"
printf "$0 [ [-u <root_uid>] [-g <root_gid>] [-d | <cpio_source>] ] . . .\n"
printf "\n"
printf -- "-u <root_uid> User ID to map to user ID 0 (root).\n"
printf " <root_uid> is only meaningful if <cpio_source>\n"
printf " is a directory.\n"
printf -- "-g <root_gid> Group ID to map to group ID 0 (root).\n"
printf " <root_gid> is only meaningful if <cpio_source>\n"
printf " is a directory.\n"
printf "<cpio_source> File list or directory for cpio archive.\n"
printf " If <cpio_source> is not provided then a\n"
printf " a default list will be output.\n"
printf -- "-d Output the default cpio list. If no <cpio_source>\n"
printf " is given then the default cpio list will be output.\n"
printf "\n"
printf "All options may be repeated and are interpreted sequentially\n"
printf "and immediately. -u and -g states are preserved across\n"
printf "<cpio_source> options so an explicit \"-u 0 -g 0\" is required\n"
printf "to reset the root/group mapping.\n"
}
build_list() {
printf "\n#####################\n# $cpio_source\n"
if [ -f "$cpio_source" ]; then
print_mtime "$cpio_source"
cat "$cpio_source"
elif [ -d "$cpio_source" ]; then
srcdir=$(echo "$cpio_source" | sed -e 's://*:/:g;s:/$::')
dirlist=$(find "$srcdir" -printf "%p %m %U %G\n" 2>/dev/null)
# If $dirlist is only one line, then the directory is empty
if [ "$(echo "$dirlist" | wc -l)" -gt 1 ]; then
print_mtime "$cpio_source"
echo "$dirlist" | \
while read x; do
parse $x
done
else
# Failsafe in case directory is empty
default_initramfs
fi
else
echo " $0: Cannot open '$cpio_source'" >&2
exit 1
fi
}
root_uid=0
root_gid=0
while [ $# -gt 0 ]; do
arg="$1"
shift
case "$arg" in
"-u")
root_uid="$1"
shift
;;
"-g")
root_gid="$1"
shift
;;
"-d")
default_list="$arg"
default_initramfs
;;
"-h")
usage
exit 0
;;
*)
case "$arg" in
"-"*)
printf "ERROR: unknown option \"$arg\"\n" >&2
printf "If the filename validly begins with '-', then it must be prefixed\n" >&2
printf "by './' so that it won't be interpreted as an option." >&2
printf "\n" >&2
usage >&2
exit 1
;;
*)
cpio_source="$arg"
build_list
;;
esac
;;
esac
done
# spit out the default cpio list if a source hasn't been specified
[ -z "$cpio_source" -a -z "$default_list" ] && default_initramfs
exit 0

18
fs/initramfs/initramfs.mk Normal file
View File

@@ -0,0 +1,18 @@
#############################################################
#
# Make a initramfs_list file to be used by gen_init_cpio
# gen_init_cpio is part of the 2.6 linux kernels to build an
# initial ramdisk filesystem based on cpio
#
#############################################################
define ROOTFS_INITRAMFS_INIT_SYMLINK
rm -f $(TARGET_DIR)/init
ln -s sbin/init $(TARGET_DIR)/init
endef
define ROOTFS_INITRAMFS_CMD
$(SHELL) target/initramfs/gen_initramfs_list.sh -u 0 -g 0 $(TARGET_DIR) > $$@
endef
$(eval $(call ROOTFS_TARGET,initramfs))

16
fs/iso9660/Config.in Normal file
View File

@@ -0,0 +1,16 @@
config BR2_TARGET_ROOTFS_ISO9660
bool "iso image"
depends on BR2_i386
depends on !BR2_KERNEL_none
select BR2_TARGET_ROOTFS_EXT2
select BR2_TARGET_GRUB
help
Build a bootable iso9660 image
config BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU
string "Boot menu.lst file"
depends on BR2_TARGET_ROOTFS_ISO9660
default "target/iso9660/menu.lst"
comment "iso image requires a Linux kernel to be built"
depends on BR2_i386 && BR2_KERNEL_none

49
fs/iso9660/iso9660.mk Normal file
View File

@@ -0,0 +1,49 @@
#############################################################
#
# Build the iso96600 root filesystem image
#
# Cannot be converted to the ROOTFS_TARGET infrastructure, because of
# the temporary construction in ISO9660_TARGET_DIR.
#
#############################################################
ISO9660_TARGET_DIR=$(BUILD_DIR)/iso9660
ISO9660_BOOT_MENU:=$(call qstrip,$(BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU))
ISO9660_OPTS:=
ifeq ($(BR2_TARGET_ROOTFS_ISO9660_SQUASH),y)
ISO9660_OPTS+=-U
endif
$(BINARIES_DIR)/rootfs.iso9660: host-cdrkit host-fakeroot $(LINUX_KERNEL) $(BINARIES_DIR)/rootfs.ext2 grub
@$(call MESSAGE,"Generating root filesystem image rootfs.iso9660")
mkdir -p $(ISO9660_TARGET_DIR)
mkdir -p $(ISO9660_TARGET_DIR)/boot/grub
cp $(GRUB_DIR)/stage2/stage2_eltorito $(ISO9660_TARGET_DIR)/boot/grub/
cp $(ISO9660_BOOT_MENU) $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
cp $(LINUX_KERNEL) $(ISO9660_TARGET_DIR)/kernel
cp $(EXT2_TARGET) $(ISO9660_TARGET_DIR)/initrd
# Use fakeroot to pretend all target binaries are owned by root
rm -f $(FAKEROOT_SCRIPT)
touch $(BUILD_DIR)/.fakeroot.00000
cat $(BUILD_DIR)/.fakeroot* > $(FAKEROOT_SCRIPT)
echo "chown -R 0:0 $(ISO9660_TARGET_DIR)" >> $(FAKEROOT_SCRIPT)
# Use fakeroot so mkisofs believes the previous fakery
echo "$(HOST_DIR)/usr/bin/genisoimage -R -b boot/grub/stage2_eltorito -no-emul-boot " \
"-boot-load-size 4 -boot-info-table -o $@ $(ISO9660_TARGET_DIR)" \
>> $(FAKEROOT_SCRIPT)
chmod a+x $(FAKEROOT_SCRIPT)
$(HOST_DIR)/usr/bin/fakeroot -- $(FAKEROOT_SCRIPT)
-@rm -f $(FAKEROOT_SCRIPT)
-@rm -rf $(ISO9660_TARGET_DIR)
iso9660-root: $(BINARIES_DIR)/rootfs.iso9660
#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(BR2_TARGET_ROOTFS_ISO9660),y)
TARGETS+=iso9660-root
endif

11
fs/iso9660/menu.lst Normal file
View File

@@ -0,0 +1,11 @@
default 0
timeout 10
color cyan/blue white/blue
title Hard Drive (first partition)
rootnoverify (hd0)
chainloader +1
title BuildRoot ISO9660 image
kernel /kernel
initrd /initrd

117
fs/jffs2/Config.in Normal file
View File

@@ -0,0 +1,117 @@
config BR2_TARGET_ROOTFS_JFFS2
bool "jffs2 root filesystem"
help
Build a jffs2 root filesystem
if BR2_TARGET_ROOTFS_JFFS2
choice
prompt "Flash Type"
default BR2_TARGET_ROOTFS_JFFS2_FLASH_128
config BR2_TARGET_ROOTFS_JFFS2_DATAFLASH_1056
bool "AT45 dataflash with 1056 byte pagesize"
select BR2_TARGET_ROOTFS_JFFS2_NOCLEANMARKER
config BR2_TARGET_ROOTFS_JFFS2_DATAFLASH_528
bool "AT45 dataflash with 528 byte pagesize"
select BR2_TARGET_ROOTFS_JFFS2_NOCLEANMARKER
config BR2_TARGET_ROOTFS_JFFS2_NANDFLASH_512_16K
bool "NAND flash with 512B Page and 16 kB erasesize"
select BR2_TARGET_ROOTFS_JFFS2_NOCLEANMARKER
config BR2_TARGET_ROOTFS_JFFS2_NANDFLASH_2K_128K
bool "NAND flash with 2kB Page and 128 kB erasesize"
select BR2_TARGET_ROOTFS_JFFS2_NOCLEANMARKER
config BR2_TARGET_ROOTFS_JFFS2_FLASH_128
bool "Parallel flash with 4 kB pagesize and 128 kB erase size"
config BR2_TARGET_ROOTFS_JFFS2_FLASH_64
bool "Parallel flash with 4 kB pagesize and 64 kB erase size"
config BR2_TARGET_ROOTFS_JFFS2_CUSTOM
bool "Select custom page and erase size"
endchoice
config BR2_TARGET_ROOTFS_JFFS2_CUSTOM_PAGESIZE
hex "Page Size"
depends on BR2_TARGET_ROOTFS_JFFS2_CUSTOM
default 0x1000
help
Set to pagesize of memory
config BR2_TARGET_ROOTFS_JFFS2_CUSTOM_EBSIZE
hex "Erase block size"
depends on BR2_TARGET_ROOTFS_JFFS2_CUSTOM
default 0x20000
help
Set to erase size of memory
config BR2_TARGET_ROOTFS_JFFS2_PAGESIZE
hex
default 0x420 if BR2_TARGET_ROOTFS_JFFS2_DATAFLASH_1056
default 0x210 if BR2_TARGET_ROOTFS_JFFS2_DATAFLASH_528
default 0x200 if BR2_TARGET_ROOTFS_JFFS2_NANDFLASH_512_16K
default 0x800 if BR2_TARGET_ROOTFS_JFFS2_NANDFLASH_2K_128K
default 0x1000 if BR2_TARGET_ROOTFS_JFFS2_FLASH_128
default 0x1000 if BR2_TARGET_ROOTFS_JFFS2_FLASH_64
default $(BR2_TARGET_ROOTFS_JFFS2_CUSTOM_PAGESIZE) if BR2_TARGET_ROOTFS_JFFS2_CUSTOM
config BR2_TARGET_ROOTFS_JFFS2_EBSIZE
hex
default 0x2100 if BR2_TARGET_ROOTFS_JFFS2_DATAFLASH_1056
default 0x1080 if BR2_TARGET_ROOTFS_JFFS2_DATAFLASH_528
default 0x4000 if BR2_TARGET_ROOTFS_JFFS2_NANDFLASH_512_16K
default 0x20000 if BR2_TARGET_ROOTFS_JFFS2_NANDFLASH_2K_128K
default 0x20000 if BR2_TARGET_ROOTFS_JFFS2_FLASH_128
default 0x10000 if BR2_TARGET_ROOTFS_JFFS2_FLASH_64
default $(BR2_TARGET_ROOTFS_JFFS2_CUSTOM_EBSIZE) if BR2_TARGET_ROOTFS_JFFS2_CUSTOM
config BR2_TARGET_ROOTFS_JFFS2_NOCLEANMARKER
bool "Do not use Cleanmarker"
default y if BR2_TARGET_ROOTFS_JFFS2_DATAFLASH_1056
default y if BR2_TARGET_ROOTFS_JFFS2_DATAFLASH_528
default y if BR2_TARGET_ROOTFS_JFFS2_NANDFLASH_512_16K
default y if BR2_TARGET_ROOTFS_JFFS2_NANDFLASH_2K_128K
help
Do not use cleanmarkers if using NAND flash or Dataflash where
the pagesize is not a power of 2
config BR2_JFFS2_TARGET_SREC
bool "RootFS in SREC file formet"
config BR2_TARGET_ROOTFS_JFFS2_PAD
bool "Pad output"
config BR2_TARGET_ROOTFS_JFFS2_PADSIZE
hex "Pad output size (0x0 = to end of EB)"
depends on BR2_TARGET_ROOTFS_JFFS2_PAD
default 0x0
help
Set to 0x0 to pad to end of erase block.
choice
prompt "Endianess"
default BR2_TARGET_ROOTFS_JFFS2_BE if BR2_alpha || BR2_armeb || \
BR2_avr32 || BR2_m68k || BR2_mips || \
BR2_powerpc || BR2_sh2a_nofpueb || BR2_sh2eb || \
BR2_sh3eb || BR2_sh4eb || BR2_sparc || BR2_sparc64
config BR2_TARGET_ROOTFS_JFFS2_LE
bool "little-endian"
config BR2_TARGET_ROOTFS_JFFS2_BE
bool "big-endian"
endchoice
config BR2_TARGET_ROOTFS_JFFS2_SUMMARY
bool "Produce a summarized JFFS2 image"
help
A summarised image can be mounted faster if support is
enabled in the kernel (CONFIG_JFFS2_SUMMARY)
endif

61
fs/jffs2/jffs2root.mk Normal file
View File

@@ -0,0 +1,61 @@
#############################################################
#
# Build the jffs2 root filesystem image
#
#############################################################
JFFS2_OPTS := -e $(BR2_TARGET_ROOTFS_JFFS2_EBSIZE)
SUMTOOL_OPTS := $(JFFS2_OPTS)
ifeq ($(BR2_TARGET_ROOTFS_JFFS2_PAD),y)
ifneq ($(strip $(BR2_TARGET_ROOTFS_JFFS2_PADSIZE)),0x0)
JFFS2_OPTS += --pad=$(strip $(BR2_TARGET_ROOTFS_JFFS2_PADSIZE))
else
JFFS2_OPTS += -p
endif
SUMTOOL_OPTS += -p
endif
ifeq ($(BR2_TARGET_ROOTFS_JFFS2_LE),y)
JFFS2_OPTS += -l
SUMTOOL_OPTS += -l
endif
ifeq ($(BR2_TARGET_ROOTFS_JFFS2_BE),y)
JFFS2_OPTS += -b
SUMTOOL_OPTS += -b
endif
JFFS2_OPTS += -s $(BR2_TARGET_ROOTFS_JFFS2_PAGESIZE)
ifeq ($(BR2_TARGET_ROOTFS_JFFS2_NOCLEANMARKER),y)
JFFS2_OPTS += -n
SUMTOOL_OPTS += -n
endif
ifneq ($(TARGET_DEVICE_TABLE),)
JFFS2_OPTS += -D $(TARGET_DEVICE_TABLE)
endif
ROOTFS_JFFS2_DEPENDENCIES = host-mtd
ifneq ($(BR2_TARGET_ROOTFS_JFFS2_SUMMARY),)
define ROOTFS_JFFS2_CMD
$(MKFS_JFFS2) $(JFFS2_OPTS) -d $(TARGET_DIR) -o $$@.nosummary && \
$(SUMTOOL) $(SUMTOOL_OPTS) -i $$@.nosummary -o $$@ && \
rm $$@.nosummary
endef
else
define ROOTFS_JFFS2_CMD
$(MKFS_JFFS2) $(JFFS2_OPTS) -d $(TARGET_DIR) -o $$@
endef
endif
define JFFS2_GEN_SREC
$(TARGET_CROSS)objcopy -I binary -O srec --adjust-vma 0xa1000000 $$@ $$@.srec
endef
ifeq ($(BR2_JFFS2_TARGET_SREC),y)
ROOTFS_JFFS2_POST_GEN_HOOKS += JFFS2_GEN_SREC
endif
$(eval $(call ROOTFS_TARGET,jffs2))

5
fs/romfs/Config.in Normal file
View File

@@ -0,0 +1,5 @@
config BR2_TARGET_ROOTFS_ROMFS
bool "romfs root filesystem"
help
Build a romfs image of the root filesystem.

15
fs/romfs/romfs.mk Normal file
View File

@@ -0,0 +1,15 @@
#############################################################
#
# Build the romfs root filesystem image
#
#############################################################
ROMFS_TARGET=$(IMAGE).romfs
ROOTFS_ROMFS_DEPENDENCIES = host-genromfs
define ROOTFS_ROMFS_CMD
$(HOST_DIR)/usr/bin/genromfs -d $(TARGET_DIR) -f $$@
endef
$(eval $(call ROOTFS_TARGET,romfs))

4
fs/squashfs/Config.in Normal file
View File

@@ -0,0 +1,4 @@
config BR2_TARGET_ROOTFS_SQUASHFS
bool "squashfs root filesystem"
help
Build a squashfs root filesystem

View File

@@ -0,0 +1,13 @@
#############################################################
#
# Build the squashfs root filesystem image
#
#############################################################
ROOTFS_SQUASHFS_DEPENDENCIES = host-squashfs
define ROOTFS_SQUASHFS_CMD
$(HOST_DIR)/usr/bin/mksquashfs $(TARGET_DIR) $$@ -noappend
endef
$(eval $(call ROOTFS_TARGET,squashfs))

47
fs/tar/Config.in Normal file
View File

@@ -0,0 +1,47 @@
config BR2_TARGET_ROOTFS_TAR
bool "tar the root filesystem"
help
Build a tar archive of the root filesystem
choice
prompt "Compression method"
default BR2_TARGET_ROOTFS_TAR_NONE
depends on BR2_TARGET_ROOTFS_TAR
help
Select compressor for tar archive of the root filesystem
config BR2_TARGET_ROOTFS_TAR_NONE
bool "no compression"
help
Do not compress the tarball.
config BR2_TARGET_ROOTFS_TAR_GZIP
bool "gzip"
help
Do compress the tarball with gzip.
Note that you either have to have gzip installed on your host
or select to build a gzip for your host. See the packages submenu.
config BR2_TARGET_ROOTFS_TAR_BZIP2
bool "bzip2"
help
Do compress the tarball with bzip2.
Note that you either have to have bzip2 installed on your host
or select to build a bzip2 for your host. See the packages submenu.
config BR2_TARGET_ROOTFS_TAR_LZMA
bool "lzma"
help
Do compress the tarball with lzma.
Note that you either have to have lzma installed on your host
or select to build a lzma for your host. See the packages submenu.
endchoice
config BR2_TARGET_ROOTFS_TAR_OPTIONS
string "other random options to pass to tar"
depends on BR2_TARGET_ROOTFS_TAR
default ""
help
Any other flags you want to pass to tar
Refer to tar --help for details

13
fs/tar/tarroot.mk Normal file
View File

@@ -0,0 +1,13 @@
#############################################################
#
# tar to archive target filesystem
#
#############################################################
TAR_OPTS:=$(BR2_TARGET_ROOTFS_TAR_OPTIONS)
define ROOTFS_TAR_CMD
tar -c$(TAR_OPTS)f $$@ -C $(TARGET_DIR) .
endef
$(eval $(call ROOTFS_TARGET,tar))

88
fs/ubifs/Config.in Normal file
View File

@@ -0,0 +1,88 @@
config BR2_TARGET_ROOTFS_UBIFS
bool "ubifs root filesystem"
help
Build a ubifs root filesystem
config BR2_TARGET_ROOTFS_UBIFS_LEBSIZE
hex "UBI logical erase block size"
depends on BR2_TARGET_ROOTFS_UBIFS
default 0x1f800
config BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE
hex "UBI minimum I/O size"
depends on BR2_TARGET_ROOTFS_UBIFS
default 0x800
help
Some comment required here
config BR2_TARGET_ROOTFS_UBIFS_MAXLEBCNT
int "Maximum LEB count"
depends on BR2_TARGET_ROOTFS_UBIFS
default 2048
help
Some comment required here
choice
prompt "ubifs runtime compression"
default BR2_TARGET_ROOTFS_UBIFS_RT_LZO
depends on BR2_TARGET_ROOTFS_UBIFS
help
Select which compression format to use at run-time within
the ubifs file system.
config BR2_TARGET_ROOTFS_UBIFS_RT_NONE
bool "no compression"
help
Don't use run-time compression.
config BR2_TARGET_ROOTFS_UBIFS_RT_ZLIB
bool "gzip"
help
Use zlib compression at run-time.
config BR2_TARGET_ROOTFS_UBIFS_RT_LZO
bool "lzo"
help
Use lzo compression at run-time.
endchoice
choice
prompt "Compression method"
default BR2_TARGET_ROOTFS_UBIFS_NONE
depends on BR2_TARGET_ROOTFS_UBIFS
help
Select which compression format to compress the final image
into.
config BR2_TARGET_ROOTFS_UBIFS_NONE
bool "no compression"
help
Do not compress the ubifs filesystem.
config BR2_TARGET_ROOTFS_UBIFS_GZIP
bool "gzip"
help
Do compress the ubifs filesystem with gzip.
Note that you either have to have gzip installed on your
host or select to build a gzip for your host. See the
packages submenu.
config BR2_TARGET_ROOTFS_UBIFS_BZIP2
bool "bzip2"
help
Do compress the ubifs filesystem with bzip2.
Note that you either have to have bzip2 installed on your
host or select to build a bzip2 for your host. See the
packages submenu.
config BR2_TARGET_ROOTFS_UBIFS_LZMA
bool "lzma"
help
Do compress the ubifs filesystem with lzma.
Note that you either have to have lzma installed on your
host or select to build a lzma for your host. See the
packages submenu.
endchoice

25
fs/ubifs/ubifsroot.mk Normal file
View File

@@ -0,0 +1,25 @@
#############################################################
#
# Build the ubifs root filesystem image
#
#############################################################
UBIFS_OPTS := -e $(BR2_TARGET_ROOTFS_UBIFS_LEBSIZE) -c $(BR2_TARGET_ROOTFS_UBIFS_MAXLEBCNT) -m $(BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE)
ifeq ($(BR2_TARGET_ROOTFS_UBIFS_RT_ZLIB),y)
UBIFS_OPTS += -x zlib
endif
ifeq ($(BR2_TARGET_ROOTFS_UBIFS_RT_LZI),y)
UBIFS_OPTS += -x lzo
endif
ifeq ($(BR2_TARGET_ROOTFS_UBIFS_RT_NONE),y)
UBIFS_OPTS += -x none
endif
ROOTFS_UBIFS_DEPENDENCIES = host-mtd
define ROOTFS_UBIFS_CMD
$(HOST_DIR)/usr/sbin/mkfs.ubifs -d $(TARGET_DIR) $(UBIFS_OPTS) -o $$@
endef
$(eval $(call ROOTFS_TARGET,ubifs))