diff options
author | Abdoulaye Walsimou Gaye <awg@embtoolkit.org> | 2014-03-18 23:45:27 +0100 |
---|---|---|
committer | Abdoulaye Walsimou Gaye <awg@embtoolkit.org> | 2014-03-18 23:45:27 +0100 |
commit | ef94bcb8905c8c8fefc272dbcb2d5ee0c4efbe35 (patch) | |
tree | e8e85268168e09221e23cdbb4639e47109988d04 /core/mk/rootfs | |
parent | fb516edcaeaa02e435316622b2bcc5314b42d529 (diff) | |
download | embtoolkit-ef94bcb8905c8c8fefc272dbcb2d5ee0c4efbe35.tar.gz embtoolkit-ef94bcb8905c8c8fefc272dbcb2d5ee0c4efbe35.tar.bz2 embtoolkit-ef94bcb8905c8c8fefc272dbcb2d5ee0c4efbe35.tar.xz |
Move mk/ to core/
Signed-off-by: Abdoulaye Walsimou Gaye <awg@embtoolkit.org>
Diffstat (limited to 'core/mk/rootfs')
-rw-r--r-- | core/mk/rootfs/README.busybox.inittab | 6 | ||||
-rw-r--r-- | core/mk/rootfs/fs.mk | 100 | ||||
-rw-r--r-- | core/mk/rootfs/rootfs.mk | 194 |
3 files changed, 300 insertions, 0 deletions
diff --git a/core/mk/rootfs/README.busybox.inittab b/core/mk/rootfs/README.busybox.inittab new file mode 100644 index 0000000..b9eb1e9 --- /dev/null +++ b/core/mk/rootfs/README.busybox.inittab @@ -0,0 +1,6 @@ +# Format for each entry: <id>:<runlevels>:<action>:<process> +# +# id == tty to run on, or empty for /dev/console +# runlevels == ignored +# action == one of sysinit, respawn, askfirst, wait, and once +# process == program to run diff --git a/core/mk/rootfs/fs.mk b/core/mk/rootfs/fs.mk new file mode 100644 index 0000000..e1500e3 --- /dev/null +++ b/core/mk/rootfs/fs.mk @@ -0,0 +1,100 @@ +################################################################################ +# Embtoolkit +# Copyright(C) 2009-2012 Abdoulaye Walsimou GAYE. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +################################################################################ +# +# \file fs.mk +# \brief fs.mk of Embtoolkit, macros for sereval filesystems build. +# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org> +# \date August 2009 +################################################################################ + +# +# TAR.BZ2 rootfs macro +# +__embtk_tarbz2_rootdir = $(strip $(1)) +__embtk_tarbz2_rootfs = $(strip $(2)) +define embtk_rootfs_mktarbz2 + $(call embtk_pinfo,"Generating TAR.BZ2 file of the rootfs...") + cd $(__embtk_tarbz2_rootdir); \ + $(FAKEROOT_BIN) -i $(FAKEROOT_ENV_FILE) -- \ + tar cjf $(__embtk_tarbz2_rootfs) *; \ + mv $(__embtk_tarbz2_rootfs) $(embtk_generated)/ +endef + +# +# JFFS2 rootfs macro +# +__embtk_mkjffs2 := $(embtk_htools)/usr/sbin/mkfs.jffs2 +__embtk_sumtool := $(embtk_htools)/usr/sbin/sumtool +__embtk_jffs2_eraseblksz := $(CONFIG_EMBTK_ROOTFS_HAVE_JFFS2_ERASEBLOCKSIZE) +__embtk_jffs2_pad := $(CONFIG_EMBTK_ROOTFS_HAVE_JFFS2_ERASEBLOCKSIZE) +__embtk_jffs2_pagesz := $(CONFIG_EMBTK_ROOTFS_HAVE_JFFS2_PAGESIZE) +__embtk_jffs2_cleanmarkersz := $(CONFIG_EMBTK_ROOTFS_HAVE_JFFS2_CLEANMARKERSIZE) +__embtk_jffs2_rootdir = $(strip $(1)) +__embtk_jffs2_rootfs = $(strip $(2)) +define embtk_rootfs_mkjffs2 + $(call embtk_pinfo,"Generating JFFS2 rootfs..") + $(FAKEROOT_BIN) -i $(FAKEROOT_ENV_FILE) -- \ + $(__embtk_mkjffs2) \ + --eraseblock=$(__embtk_jffs2_eraseblksz) \ + --pad=$(__embtk_jffs2_pad) \ + --pagesize=$(__embtk_jffs2_pagesz) \ + --cleanmarker=$(__embtk_jffs2_cleanmarkersz) \ + $(if $(CONFIG_EMBTK_TARGET_ARCH_LITTLE_ENDIAN), \ + --little-endian,--big-endian) \ + -n --root=$(__embtk_jffs2_rootdir) \ + -o $(__embtk_jffs2_rootfs).temp + $(__embtk_sumtool) \ + --eraseblock=$(__embtk_jffs2_eraseblksz) \ + --cleanmarker=$(__embtk_jffs2_cleanmarkersz) \ + $(if $(CONFIG_EMBTK_TARGET_ARCH_LITTLE_ENDIAN), \ + --littleendian,--bigendian) \ + -n -p -i $(__embtk_jffs2_rootfs).temp -o $(__embtk_jffs2_rootfs) + rm -rf $(__embtk_jffs2_rootfs).temp +endef + +# +# SQUASHFS rootfs macro +# +__embtk_mksquashfs := $(MKSQUASHFS_BIN) +__embtk_squashfs_rootdir = $(strip $(1)) +__embtk_squashfs_rootfs = $(strip $(2)) +define embtk_rootfs_mksquashfs + $(call embtk_pinfo,"Generating SQUASHFS rootfs...") + $(FAKEROOT_BIN) -i $(FAKEROOT_ENV_FILE) -- \ + $(__embtk_mksquashfs) \ + $(__embtk_squashfs_rootdir) $(__embtk_squashfs_rootfs) \ + $(if $(CONFIG_EMBTK_SQUASHFS_TOOLS_VERSION_3_4), \ + $(if $(CONFIG_EMBTK_TARGET_ARCH_LITTLE_ENDIAN),-le,-be))\ + -all-root +endef + +# +# CPIO (initramfs) rootfs macro +# +__embtk_mkinitramfs := $(EMBTK_ROOT)/scripts/mkinitramfs +__embtk_initramfs_rootdir = $(strip $(1)) +__embtk_initramfs_rootfs = $(strip $(2)) +define embtk_rootfs_mkinitramfs + $(call embtk_pinfo,"Generating INITRAMFS rootfs...") + $(FAKEROOT_BIN) -i $(FAKEROOT_ENV_FILE) -- \ + $(__embtk_mkinitramfs) \ + $(__embtk_initramfs_rootdir) \ + $(if $(EMBTK_ROOTFS_HAVE_INITRAMFS_CPIO_GZIPED),gzip,bzip2) \ + $(__embtk_initramfs_rootfs) +endef diff --git a/core/mk/rootfs/rootfs.mk b/core/mk/rootfs/rootfs.mk new file mode 100644 index 0000000..255e0b3 --- /dev/null +++ b/core/mk/rootfs/rootfs.mk @@ -0,0 +1,194 @@ +################################################################################ +# Embtoolkit +# Copyright(C) 2009-2012 Abdoulaye Walsimou GAYE. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +################################################################################ +# +# \file rootfs.mk +# \brief rootfs.mk of Embtoolkit +# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org> +# \date June 2009 +################################################################################ + +ifeq ($(CONFIG_EMBTK_HAVE_ROOTFS),y) + +# Include various filesystems macros +include core/mk/rootfs/fs.mk + +ROOTFS_JFFS2 := $(embtk_generated)/rootfs-$(GNU_TARGET)-$(EMBTK_MCU_FLAG)-$(embtk_clib).jffs2 +ROOTFS_TARBZ2 := rootfs-$(GNU_TARGET)-$(EMBTK_MCU_FLAG)-$(embtk_clib).tar.bz2 +ROOTFS_SQUASHFS := $(embtk_generated)/rootfs-$(GNU_TARGET)-$(EMBTK_MCU_FLAG)-$(embtk_clib).squashfs +ROOTFS_INITRAMFS := $(embtk_generated)/rootfs-$(GNU_TARGET)-$(EMBTK_MCU_FLAG)-$(embtk_clib).initramfs + +HOSTTOOLS_COMPONENTS-y += makedevs_install +HOSTTOOLS_COMPONENTS-$(CONFIG_EMBTK_ROOTFS_HAVE_JFFS2) += mtdutils_host_install +HOSTTOOLS_COMPONENTS-$(CONFIG_EMBTK_ROOTFS_HAVE_SQUASHFS) += squashfs_tools_install + +# Files to strip if requested + +__embtk_rootfs/libso = $(shell [ -d $(embtk_rootfs)/lib ] && find $(embtk_rootfs)/lib -type f -name *.so*) +__embtk_rootfs/lib32so = $(shell [ -d $(embtk_rootfs)/lib32 ] && find $(embtk_rootfs)/lib32 -type f -name *.so*) +__embtk_rootfs/usr/libso = $(shell [ -d $(embtk_rootfs)/usr/lib ] && find $(embtk_rootfs)/usr/lib -type f -name *.so*) +__embtk_rootfs/usr/lib32so = $(shell [ -d $(embtk_rootfs)/usr/lib32 ] && find $(embtk_rootfs)/usr/lib32 -type f -name *.so*) +__embtk_rootfs/usr/libexec = $(shell [ -d $(embtk_rootfs)/usr/libexec ] && find $(embtk_rootfs)/usr/libexec -type f) +__embtk_rootfs/bins = $(shell [ -d $(embtk_rootfs)/bin ] && find $(embtk_rootfs)/bin -type f) +__embtk_rootfs/sbins = $(shell [ -d $(embtk_rootfs)/sbin ] && find $(embtk_rootfs)/sbin -type f) +__embtk_rootfs/usr/bins = $(shell [ -d $(embtk_rootfs)/usr/bin ] && find $(embtk_rootfs)/usr/bin -type f) +__embtk_rootfs/usr/sbins = $(shell [ -d $(embtk_rootfs)/usr/sbin ] && find $(embtk_rootfs)/usr/sbin -type f) + +define __embtk_rootfs_strip_f + -$(FAKEROOT_BIN) -i $(FAKEROOT_ENV_FILE) -- \ + $(TARGETSTRIP) $(1) >/dev/null 2>&1 +endef + +define __embtk_rootfs_components_strip + $(call embtk_pinfo,"Stripping binaries as specified...") + $(if $(__embtk_rootfs/libso), + $(foreach bin,$(__embtk_rootfs/libso), + $(call __embtk_rootfs_strip_f,$(bin)) &&:)) + $(if $(__embtk_rootfs/lib32so), + $(foreach bin,$(__embtk_rootfs/lib32so), + $(call __embtk_rootfs_strip_f,$(bin)) &&:)) + $(if $(__embtk_rootfs/usr/libso), + $(foreach bin,$(__embtk_rootfs/usr/libso), + $(call __embtk_rootfs_strip_f,$(bin)) &&:)) + $(if $(__embtk_rootfs/usr/lib32so), + $(foreach bin,$(__embtk_rootfs/usr/lib32so), + $(call __embtk_rootfs_strip_f,$(bin)) &&:)) + $(if $(__embtk_rootfs/usr/libexec), + $(foreach bin,$(__embtk_rootfs/usr/libexec), + $(call __embtk_rootfs_strip_f,$(bin)) &&:)) + $(if $(__embtk_rootfs/bins), + $(foreach bin,$(__embtk_rootfs/bins), + $(call __embtk_rootfs_strip_f,$(bin)) &&:)) + $(if $(__embtk_rootfs/sbins), + $(foreach bin,$(__embtk_rootfs/sbins), + $(call __embtk_rootfs_strip_f,$(bin)) &&:)) + $(if $(__embtk_rootfs/usr/bins), + $(foreach bin,$(__embtk_rootfs/usr/bins), + $(call __embtk_rootfs_strip_f,$(bin)) &&:)) + $(if $(__embtk_rootfs/usr/sbins), + $(foreach bin,$(__embtk_rootfs/usr/sbins), + $(call __embtk_rootfs_strip_f,$(bin)) &&:)) +endef + +define __embtk_rootfs_mkdevnodes + $(call embtk_pinfo,"Populating devices nodes of the rootfs...") + $(FAKEROOT_BIN) -s $(FAKEROOT_ENV_FILE) -- $(MAKEDEVS_BIN) \ + -d $(EMBTK_ROOT)/src/devices_table.txt $(embtk_rootfs) +endef + +define __embtk_rootfs_cleanup + $(foreach pkg-n,$(__embtk_rootfs_pkgs-n), + $(call __embtk_cleanup_pkg,$(pkg-n)) &&:) + rm -rf $(embtk_generated)/rootfs-$(GNU_TARGET)-$(EMBTK_MCU_FLAG)* +endef + +define __embtk_rootfs_mkinitpath + mkdir -p $(embtk_rootfs) + cp -Rp $(EMBTK_ROOT)/src/rootfs_skel/* $(embtk_rootfs) + mkdir -p $(embtk_pkgb) + $(if $(CONFIG_EMBTK_64BITS_FS_COMPAT32), + mkdir -p $(embtk_rootfs)/lib32 + mkdir -p $(embtk_rootfs)/usr/lib32) +endef + +define __embtk_rootfs_components_install + mkdir -p $(embtk_rootfs)/$(LIBDIR) + mkdir -p $(embtk_rootfs)/lib + mkdir -p $(embtk_rootfs)/usr + mkdir -p $(embtk_rootfs)/usr/$(LIBDIR) + mkdir -p $(embtk_rootfs)/usr/lib + $(if $(CONFIG_EMBTK_64BITS_FS), + cd $(embtk_rootfs); ln -s lib lib64 + cd $(embtk_rootfs)/usr; ln -s lib lib64) + $(if $(CONFIG_EMBTK_64BITS_FS_COMPAT32), + cd $(embtk_rootfs); ln -s lib lib64 + cd $(embtk_rootfs)/usr; ln -s lib lib64) + -(cd $(embtk_sysroot)/lib/ && tar -cf - *.so*) \ + | tar -xf - -C $(embtk_rootfs)/lib/ + -(cd $(embtk_sysroot)/usr/lib/ && tar -cf - *.so*) \ + | tar -xf - -C $(embtk_rootfs)/usr/lib/ + -cp -R $(embtk_sysroot)/usr/libexec $(embtk_rootfs)/usr/ + rm -rf $(embtk_rootfs)/lib/libgcc_s.so + rm -rf $(embtk_rootfs)/usr/lib/libc.so + $(if $(CONFIG_EMBTK_64BITS_FS_COMPAT32), + -(cd $(embtk_sysroot)/lib32/ && tar -cf - *.so*) \ + | tar -xf - -C $(embtk_rootfs)/lib32/ + -(cd $(embtk_sysroot)/usr/lib32/ && tar -cf - *.so*) \ + | tar -xf - -C $(embtk_rootfs)/usr/lib32/ + rm -rf $(embtk_rootfs)/lib32/libgcc_s.so + rm -rf $(embtk_rootfs)/usr/lib32/libc.so) + -cp -R $(embtk_sysroot)/bin/* $(embtk_rootfs)/bin/ >/dev/null 2>/dev/null + -cp -R $(embtk_sysroot)/usr/bin/* $(embtk_rootfs)/usr/bin/ + -cp -R $(embtk_sysroot)/sbin/* $(embtk_rootfs)/sbin/ >/dev/null 2>/dev/null + -cp -R $(embtk_sysroot)/usr/sbin/* $(embtk_rootfs)/usr/sbin/ + -cp -R $(embtk_sysroot)/etc/* $(embtk_rootfs)/etc/ >/dev/null 2>/dev/null + -rm -rf $$(find $(embtk_rootfs) -type f -name '.empty') + cp -R $(embtk_sysroot)/root $(embtk_rootfs)/ + -$(FAKEROOT_BIN) -i $(FAKEROOT_ENV_FILE) -- \ + rm -rf `find $(embtk_rootfs) -type f -name *.la` +endef + +define __embtk_rootfs_fs_generate + $(call embtk_rootfs_mktarbz2,$(embtk_rootfs),$(ROOTFS_TARBZ2)) + $(if $(CONFIG_EMBTK_ROOTFS_HAVE_INITRAMFS_CPIO), + $(call embtk_rootfs_mkinitramfs,$(embtk_rootfs),$(ROOTFS_INITRAMFS))) + $(if $(CONFIG_EMBTK_ROOTFS_HAVE_JFFS2), + $(call embtk_rootfs_mkjffs2,$(embtk_rootfs),$(ROOTFS_JFFS2))) + $(if $(CONFIG_EMBTK_ROOTFS_HAVE_SQUASHFS), + $(call embtk_rootfs_mksquashfs,$(embtk_rootfs),$(ROOTFS_SQUASHFS))) + rm -rf $(embtk_rootfs) +endef + +__rootfs_build_msg: + $(call embtk_pinfo,"Building selected filesystems - please wait...") + +__rootfs_clean: + $(Q)$(__embtk_rootfs_cleanup) + +__rootfs_mkinitpath: + $(Q)$(__embtk_rootfs_mkinitpath) + +__rootfs_components_build: $(ROOTFS_COMPONENTS-y) + true + +__rootfs_mkdevnodes: + $(Q)$(__embtk_rootfs_mkdevnodes) + +__rootfs_components_install: + $(Q)$(__embtk_rootfs_components_install) + +__rootfs_components_strip: + $(__embtk_rootfs_components_strip) + +__rootfs_prebuild_targets := __rootfs_build_msg +__rootfs_prebuild_targets += __rootfs_clean +__rootfs_prebuild_targets += __rootfs_mkinitpath +__rootfs_prebuild_targets += __rootfs_components_build +__rootfs_prebuild_targets += __rootfs_mkdevnodes +__rootfs_prebuild_targets += __rootfs_components_install +__rootfs_prebuild_targets += $(strip $(if $(CONFIG_EMBTK_TARGET_STRIPPED), \ + __rootfs_components_strip)) + +rootfs_build: toolchain_install host_packages_build $(__rootfs_prebuild_targets) + $(Q)$(__embtk_rootfs_fs_generate) + $(call embtk_pinfo,"Selected root filesystems built successfully!") +else +# Build of root file system not selected +rootfs_build: + $(call embtk_pinfo,"Build of root filesystem not selected") +endif |