Index: Makefile
===================================================================
--- Makefile (nonexistent)
+++ Makefile (revision 5)
@@ -0,0 +1,424 @@
+
+COMPONENT_TARGETS = $(HARDWARE_EBOX_3350DX2)
+
+
+NEED_ABS_PATH = true
+COMPONENT_IS_3PP = true
+
+
+include ../../../../build-system/constants.mk
+
+
+SOURCE_REQUIRES = sources/GNU/grub
+
+REQUIRES = app/xz/5.2.7
+REQUIRES += libs/zlib/1.2.13
+REQUIRES += libs/zstd/1.5.2
+REQUIRES += dev/bison/3.7.4
+REQUIRES += dev/flex/2.6.4
+
+REQUIRES += share/fonts-collection
+
+# ======= __END_OF_REQUIRES__ =======
+
+
+version = 2.06
+tar_xz_archive = $(SRC_PACKAGE_PATH)/GNU/grub/grub-$(version).tar.xz
+SRC_ARCHIVE = $(tar_xz_archive)
+SRC_DIR = $(TARGET_BUILD_DIR)/grub-$(version)
+src_dir_name = grub-$(version)
+src_done = $(TARGET_BUILD_DIR)/.source_done
+
+PATCHES = PATCHES
+
+build_dev_dir = $(TARGET_BUILD_DIR)/build-dev
+build_dev_target = $(TARGET_BUILD_DIR)/.build_dev_done
+install_dev_target = $(TARGET_BUILD_DIR)/.install_dev_done
+
+build_dir = $(TARGET_BUILD_DIR)/build
+build_target = $(TARGET_BUILD_DIR)/.build_done
+install_target = $(TARGET_BUILD_DIR)/.install_done
+
+grub_config = $(TARGET_BUILD_DIR)/$(HARDWARE).grub-config
+
+grub_records = $(TARGET_BUILD_DIR)/$(HARDWARE).grub-records
+install_records = $(TARGET_BUILD_DIR)/.install_records_done
+
+
+####### Targets
+
+PKG_GROUP = boot
+
+#
+# *PKG_NAME & *PKG_VERSION shouldn't be a reference to value.
+#
+GRUB_PKG_NAME = grub
+GRUB_PKG_VERSION = 2.06
+GRUB_PKG_ARCH = $(PKGARCH)
+GRUB_PKG_DISTRO_NAME = $(DISTRO_NAME)
+GRUB_PKG_DISTRO_VERSION = $(DISTRO_VERSION)
+GRUB_PKG_GROUP = $(PKG_GROUP)
+### |---handy-ruler-------------------------------|
+GRUB_PKG_SHORT_DESCRIPTION = the GRand Unified Bootloader
+GRUB_PKG_URL = $(BUG_URL)
+GRUB_PKG_LICENSE = GPLv3
+GRUB_PKG_DESCRIPTION_FILE = $(TARGET_BUILD_DIR)/$(GRUB_PKG_NAME)-pkg-description
+GRUB_PKG_DESCRIPTION_GRUB_IN = $(GRUB_PKG_NAME)-pkg-description.in
+GRUB_PKG_INSTALL_SCRIPT = $(GRUB_PKG_NAME)-pkg-install.sh
+
+GRUB_PKG = $(CURDIR)/$(TARGET_BUILD_DIR)/$(GRUB_PKG_NAME)-package
+
+pkg_basename = $(GRUB_PKG_NAME)-$(GRUB_PKG_VERSION)-$(GRUB_PKG_ARCH)-$(GRUB_PKG_DISTRO_NAME)-$(GRUB_PKG_DISTRO_VERSION)
+
+pkg_archive = $(TARGET_BUILD_DIR)/$(PKG_GROUP)/$(pkg_basename).$(pkg_arch_suffix)
+pkg_certificate = $(call cert-name,$(pkg_archive))
+pkg_signature = $(call sign-name,$(pkg_archive))
+pkg_description = $(call desc-name,$(pkg_archive))
+products = $(call pkg-files,$(pkg_archive))
+
+BUILD_TARGETS = $(build_target)
+BUILD_TARGETS += $(install_target)
+BUILD_TARGETS += $(install_records)
+
+PRODUCT_TARGETS = $(products)
+
+ROOTFS_TARGETS = $(pkg_archive)
+
+
+include ../../../../build-system/core.mk
+
+
+env_sysroot = DESTDIR=$(GRUB_PKG)
+
+
+extra_configure_switches = --libdir=/usr/lib$(LIBSUFFIX)
+extra_configure_switches += --docdir=/usr/share/doc/$(src_dir_name)
+extra_configure_switches += --infodir=/usr/share/info
+extra_configure_switches += --mandir=/usr/share/man
+extra_configure_switches += --disable-dependency-tracking
+extra_configure_switches += --sysconfdir=/etc
+extra_configure_switches += --localstatedir=/var
+
+extra_configure_switches += --enable-threads=posix
+extra_configure_switches += --disable-rpath
+extra_configure_switches += --enable-stack-protector=no
+extra_configure_switches += --enable-mm-debug=no
+extra_configure_switches += --enable-cache-stats=no
+extra_configure_switches += --enable-boot-time=no
+extra_configure_switches += --enable-grub-emu-sdl=no
+extra_configure_switches += --enable-grub-emu-pci=no
+extra_configure_switches += --enable-grub-themes=no
+extra_configure_switches += --enable-device-mapper=no
+extra_configure_switches += --enable-efiemu=no
+extra_configure_switches += --enable-liblzma
+extra_configure_switches += --enable-libzfs=no
+extra_configure_switches += --disable-werror
+extra_configure_switches += --enable-grub-themes
+extra_configure_switches += --enable-grub-mkfont
+
+extra_configure_switches += --with-bootdir='/boot'
+extra_configure_switches += --with-grubdir='grub'
+
+#
+# GRUB for Development environment:
+#
+build_dev_switches += --target=$(TARGET)
+build_dev_switches += --program-prefix=$(TARGET)-
+build_dev_switches += --enable-grub-mkfont
+build_dev_switches += --enable-grub-mount
+
+BUILD_DEV_ENVIRONMENT = HOST_CC=gcc
+BUILD_DEV_ENVIRONMENT += BUILD_CC=gcc
+BUILD_DEV_ENVIRONMENT += BUILD_CFLAGS='-I/usr/include'
+BUILD_DEV_ENVIRONMENT += BUILD_CPPFLAGS='-I/usr/include'
+BUILD_DEV_ENVIRONMENT += BUILD_LDFLAGS='-L/usr/lib$(BUILD_MULTILIB_SUFFIX)'
+BUILD_DEV_ENVIRONMENT += TARGET_CC='$(CC)'
+BUILD_DEV_ENVIRONMENT += TARGET_NM='$(NM)'
+BUILD_DEV_ENVIRONMENT += TARGET_RANLIB='$(RANLIB)'
+BUILD_DEV_ENVIRONMENT += TARGET_STRIP='$(STRIP)'
+BUILD_DEV_ENVIRONMENT += TARGET_OBJCOPY='$(OBJCOPY)'
+
+#
+# Redefine optimization flags:
+#
+OPTIMIZATION_FLAGS := -Os
+
+grub_CFLAGS = -isystem $(TARGET_DEST_DIR)/usr/include $(OPTIMIZATION_FLAGS) $(ARCH_FLAGS) $(HW_FLAGS)
+BUILD_DEV_ENVIRONMENT += TARGET_CFLAGS='--sysroot=$(TARGET_DEST_DIR) $(grub_CFLAGS)'
+BUILD_DEV_ENVIRONMENT += TARGET_LDFLAGS='--sysroot=$(TARGET_DEST_DIR)'
+
+
+#
+# GRUB for TARGET machine:
+#
+target_switches += --target=$(TARGET)
+target_switches += --program-prefix=''
+
+extra_environment = HOST_CC=gcc
+extra_environment += BUILD_CC=gcc
+extra_environment += BUILD_CFLAGS='-I/usr/include'
+extra_environment += BUILD_CPPFLAGS='-I/usr/include'
+extra_environment += BUILD_LDFLAGS='-L/usr/lib$(BUILD_MULTILIB_SUFFIX)'
+extra_environment += BUILD_FREETYPE_CFLAGS='-I/usr/include -I/usr/include/freetype2'
+extra_environment += BUILD_FREETYPE_LIBS='-L/usr/lib$(BUILD_MULTILIB_SUFFIX) -lfreetype'
+extra_environment += TARGET_CC='$(CC)'
+extra_environment += TARGET_NM='$(NM)'
+extra_environment += TARGET_RANLIB='$(RANLIB)'
+extra_environment += TARGET_STRIP='$(STRIP)'
+extra_environment += TARGET_OBJCOPY='$(OBJCOPY)'
+extra_environment += TARGET_CFLAGS='--sysroot=$(TARGET_DEST_DIR) $(grub_CFLAGS)'
+extra_environment += TARGET_LDFLAGS='--sysroot=$(TARGET_DEST_DIR)'
+
+
+#
+# GRUB MBR image for TARGET machine:
+#
+create_tmp_image = $(CURDIR)/scripts/create-tmp-image
+grub_disk_image = $(TARGET_BUILD_DIR)/grub-disk
+grub_core_image = $(TARGET_BUILD_DIR)/grub-core
+grub_embedded_cfg = $(TARGET_BUILD_DIR)/$(HARDWARE).grub-embedded.cfg
+root_uuid = eaf0eef1-f13a-726F-6F74-203aefe0f0f2
+linux_cmdline = console=tty0
+
+grub_modules = part_gpt part_msdos fat f2fs ext2 hfs hfsplus iso9660 udf ufs1 ufs2 chain linux
+grub_modules += boot biosdisk configfile normal regexp minicmd reboot halt search search_fs_file
+grub_modules += search_fs_uuid search_label gfxterm gfxmenu all_video gzio echo true probe loadenv
+grub_modules += bitmap_scale font cat help ls png jpeg tga test at_keyboard usb_keyboard zstd
+
+FONT_SIZE = 19
+
+part-uuid = $(shell $(DD) if=$(1) bs=1 count=4 skip=440 2>/dev/null | od -t x4 -An | sed 's,^[ ]*,,')-01
+
+
+####### Dependencies
+
+$(src_done): $(SRC_ARCHIVE) $(PATCHES_DEP)
+ $(UNPACK_SRC_ARCHIVE)
+ $(APPLY_PATCHES)
+ @touch $@
+
+$(build_dev_target): $(src_done)
+ @mkdir -p $(build_dev_dir)
+ @cd $(build_dev_dir) && \
+ PKG_CONFIG_PATH= $(BUILD_DEV_ENVIRONMENT) ../$(src_dir_name)/configure \
+ --prefix=/usr \
+ --build=$(BUILD) \
+ --host=$(BUILD) \
+ $(extra_configure_switches) \
+ $(build_dev_switches)
+ @cd $(build_dev_dir) && $(BUILD_DEV_ENVIRONMENT) $(MAKE)
+ @touch $@
+
+$(install_dev_target): $(build_dev_target)
+ @mkdir -p $(GRUB_PKG)
+ @cd $(build_dev_dir) && $(BUILD_DEV_ENVIRONMENT) $(MAKE) -j1 install $(env_sysroot)
+ @rm -rf $(GRUB_PKG)/etc
+ @rm -rf $(GRUB_PKG)/usr/share
+ @rm -rf $(GRUB_PKG)/usr/lib
+ @touch $@
+
+$(build_target): $(install_dev_target)
+ @mkdir -p $(build_dir)
+ @cd $(build_dir) && \
+ $(BUILD_ENVIRONMENT) $(extra_environment) ../$(src_dir_name)/configure \
+ --prefix=/usr \
+ --build=$(BUILD) \
+ --host=$(TARGET) \
+ $(extra_configure_switches) \
+ $(target_switches)
+ @cd $(build_dir) && $(BUILD_ENVIRONMENT) $(extra_environment) $(MAKE)
+ @cd $(build_dir) && $(BUILD_ENVIRONMENT) $(extra_environment) $(MAKE) html
+ @touch $@
+
+$(install_target): $(build_target)
+ @mkdir -p $(GRUB_PKG)
+ @cd $(build_dir) && $(BUILD_ENVIRONMENT) $(extra_environment) $(MAKE) -j1 install $(env_sysroot)
+ # ======= Install MANs (GRUB sources cannot generate MANs during cross-compilation) =======
+ @cd $(build_dev_dir) && $(MAKE) -j1 install-man1 $(env_sysroot)
+ @cd $(build_dev_dir) && $(MAKE) -j1 install-man8 $(env_sysroot)
+ @( cd $(GRUB_PKG)/usr/share/man ; \
+ for sname in `find . -type f -name '$(TARGET)-*'` ; do \
+ dname=`echo $${sname} | sed 's,$(TARGET)-,,'` ; \
+ mv $${sname} $${dname} ; \
+ done ; \
+ echo "# ======= remove MANs of not provided utils =======" ; \
+ rm -f man1/grub-mount.1 ; \
+ )
+ # ======= Install default options file =======
+ @mkdir -p $(GRUB_PKG)/etc/default
+ @cat $(CURDIR)/conf/etc.default > $(GRUB_PKG)/etc/default/grub.new
+ # ======= Preserve the contents of /etc/grub.d/40_custom =======
+ @mv $(GRUB_PKG)/etc/grub.d/40_custom $(GRUB_PKG)/etc/grub.d/40_custom.new
+ # ======= Put bash-completion file in system directory =======
+ @mkdir -p $(GRUB_PKG)/usr/share/bash-completion/completions/
+ @mv $(GRUB_PKG)/etc/bash_completion.d/grub \
+ $(GRUB_PKG)/usr/share/bash-completion/completions/grub
+ @rm -rf $(GRUB_PKG)/etc/bash_completion.d
+ # ======= Add fonts, if found on the system =======
+ @if [ -r $(TARGET_DEST_DIR)/usr/share/fonts/TTF/unifont.ttf ] ; then \
+ $(GRUB_PKG)/usr/bin/$(TARGET)-grub-mkfont \
+ -o $(GRUB_PKG)/usr/share/grub/unifont.pf2 -abv \
+ -s $(FONT_SIZE) /usr/share/fonts/TTF/unifont.ttf \
+ 2>/dev/null 1>/dev/null ; \
+ fi
+ @if [ -r $(TARGET_DEST_DIR)/usr/share/fonts/TTF/DejaVuSansMono.ttf ] ; then \
+ $(GRUB_PKG)/usr/bin/$(TARGET)-grub-mkfont \
+ -o $(GRUB_PKG)/usr/share/grub/dejavusansmono.pf2 -abv \
+ -s $(FONT_SIZE) /usr/share/fonts/TTF/DejaVuSansMono.ttf \
+ 2>/dev/null 1>/dev/null ; \
+ fi
+ # ======= remove devenv paths from modinfo.sh script =======
+ @( cd $(GRUB_PKG)/usr/lib$(LIBSUFFIX)/grub/i386-pc ; \
+ sed -i 's,$(TARGET_DEST_DIR),,g' modinfo.sh ; \
+ sed -i 's,$(TOOLCHAIN_PATH),,g' modinfo.sh ; \
+ sed -i 's,$(CROSS_PREFIX),,g' modinfo.sh ; \
+ sed -i 's,$(TARGET)-,,g' modinfo.sh ; \
+ sed -i 's,--sysroot= ,,g' modinfo.sh ; \
+ sed -i 's,-isystem /lib,-isystem /usr/lib,g' modinfo.sh ; \
+ )
+ # ======= Create temporary disk image for GRUB Records =======
+ @$(create_tmp_image) $(grub_disk_image)
+ # ======= Install GRUB =======
+ @$(GRUB_PKG)/usr/sbin/$(TARGET)-grub-install \
+ --skip-fs-probe \
+ --fonts=dejavusansmono \
+ --boot-directory=$(GRUB_PKG)/boot \
+ --directory=$(GRUB_PKG)/usr/lib$(LIBSUFFIX)/grub/i386-pc \
+ --target=i386-pc \
+ --modules='$(grub_modules)' \
+ --disk-module=biosdisk \
+ $(grub_disk_image)
+ # ======= Create embedded config =======
+ @echo "" > $(grub_embedded_cfg)
+ @echo "set color_normal=black/black" >> $(grub_embedded_cfg)
+ @echo "" >> $(grub_embedded_cfg)
+ @echo "set pager=1" >> $(grub_embedded_cfg)
+ @echo "search.fs_uuid $(root_uuid) root" >> $(grub_embedded_cfg)
+ @echo "set prefix=(\$$root)/boot/grub" >> $(grub_embedded_cfg)
+ @echo "" >> $(grub_embedded_cfg)
+ @echo "set color_normal=light-gray/black" >> $(grub_embedded_cfg)
+ @echo "clear" >> $(grub_embedded_cfg)
+ @cp -a $(grub_embedded_cfg) $(GRUB_PKG)/boot/grub/i386-pc/load.cfg
+ # ======= Build MBR gap image =======
+ @$(GRUB_PKG)/usr/bin/$(TARGET)-grub-mkimage \
+ --format=i386-pc \
+ --directory=$(GRUB_PKG)/usr/lib$(LIBSUFFIX)/grub/i386-pc \
+ --prefix=/boot/grub \
+ --config=$(grub_embedded_cfg) \
+ --output=$(grub_core_image) \
+ $(grub_modules)
+ # ======= Install Documentation =======
+ @rm -f $(GRUB_PKG)/usr/share/info/dir
+ @gzip -9 $(GRUB_PKG)/usr/share/info/*
+ @if [ -d $(GRUB_PKG)/usr/share/man ]; then \
+ ( cd $(GRUB_PKG)/usr/share/man ; \
+ for manpagedir in `find . -type d -name "man*"` ; do \
+ ( cd $$manpagedir ; \
+ for eachpage in `find . -type l -maxdepth 1` ; do \
+ ln -s `readlink $$eachpage`.gz $$eachpage.gz ; \
+ rm $$eachpage ; \
+ done ; \
+ gzip -9 *.? ; \
+ ) \
+ done \
+ ) \
+ fi
+ @mkdir -p $(GRUB_PKG)/usr/doc/$(src_dir_name)
+ @cp -a $(SRC_DIR)/AUTHORS $(SRC_DIR)/COPYING \
+ $(GRUB_PKG)/usr/doc/$(src_dir_name)
+ @mkdir -p $(GRUB_PKG)/usr/share/doc/$(src_dir_name)/html/grub{,-dev}
+ @( cd $(SRC_DIR) ; \
+ cp -a AUTHORS COPYING INSTALL NEWS README THANKS TODO \
+ $(GRUB_PKG)/usr/share/doc/$(src_dir_name) \
+ )
+ @cp -a $(build_dir)/docs/grub-dev.html/*.html \
+ $(GRUB_PKG)/usr/share/doc/$(src_dir_name)/html/grub-dev
+ @cp -a $(build_dir)/docs/grub.html/*.html \
+ $(GRUB_PKG)/usr/share/doc/$(src_dir_name)/html/grub
+ @( cd $(SRC_DIR) ; \
+ if [ -r ChangeLog ]; then \
+ DOCSDIR=`echo $(GRUB_PKG)/usr/share/doc/$(src_dir_name)` ; \
+ cat ChangeLog | head -n 1000 > $$DOCSDIR/ChangeLog ; \
+ touch -r ChangeLog $$DOCSDIR/ChangeLog ; \
+ fi \
+ )
+ # ======= Install the same to $(TARGET_DEST_DIR) =======
+ $(call install-into-devenv, $(GRUB_PKG))
+ # ======= remove devenv utils from target package =======
+ @( cd $(GRUB_PKG)/usr ; \
+ find . -type f -name '$(TARGET)-*' -exec rm -f {} \+ ; \
+ )
+ # ======= Strip binaries =======
+ @( cd $(GRUB_PKG) ; \
+ find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs $(STRIP) --strip-unneeded 2> /dev/null ; \
+ )
+ @touch $@
+
+$(grub_config): $(install_target)
+ # ======= Create a grub.cfg =======
+ @mkdir -p $(GRUB_PKG)/boot/grub
+ @echo "" > $@
+ @echo "set menu_color_normal=black/light-gray" >> $@
+ @echo "set menu_color_highlight=white/light-gray" >> $@
+ @echo "set background_color=black" >> $@
+ @echo "" >> $@
+ @echo "set timeout=5" >> $@
+ @echo "" >> $@
+ @echo "loadfont dejavusansmono" >> $@
+ @echo "" >> $@
+ @echo "menuentry 'Radix cross Linux' {" >> $@
+ @echo " set root_uuid=$(root_uuid)" >> $@
+ @echo " set part_uuid=$(call part-uuid,$(grub_disk_image))" >> $@
+ @echo "" >> $@
+ @echo " insmod gzio" >> $@
+ @echo " insmod xzio" >> $@
+ @echo " insmod part_msdos" >> $@
+ @echo " insmod part_gpt" >> $@
+ @echo " insmod ext2" >> $@
+ @echo "" >> $@
+ @echo " search --set=root --fs-uuid \$$root_uuid" >> $@
+ @echo " linux (\$$root)/boot/vmlinuz root=PARTUUID=\$$part_uuid ro rootwait $(linux_cmdline)" >> $@
+ @echo "}" >> $@
+ @cp $@ $(GRUB_PKG)/boot/grub/grub.cfg
+ @touch $@
+
+$(grub_records): $(grub_config)
+ @$(DD) if=/dev/zero of=$@ bs=512 count=2048 conv=notrunc
+ # ======= Setup MBR & MBR gap into unallocated space of disk image =======
+ @$(DD) if=$(grub_disk_image) of=$@ obs=512 count=1 conv=notrunc
+ @$(DD) if=$(grub_core_image) of=$@ obs=512 seek=1 conv=notrunc
+ @rm -f $(grub_disk_image) $(grub_core_image)
+ @touch $@
+
+$(install_records): $(grub_records)
+ @$(BUILDSYSTEM)/install_targets \
+ --destination=$(PRODUCTS_DEST_DIR) \
+ --toolchain=$(TOOLCHAIN) \
+ --hardware=$(HARDWARE) \
+ --flavour=$(FLAVOUR) \
+ $^
+ @touch $@
+
+$(GRUB_PKG_DESCRIPTION_FILE): $(GRUB_PKG_DESCRIPTION_GRUB_IN)
+ @cat $< | $(SED) -e "s/@VERSION@/$(version)/g" > $@
+
+$(pkg_certificate) : $(pkg_archive) ;
+$(pkg_signature) : $(pkg_archive) ;
+$(pkg_description) : $(pkg_archive) ;
+
+$(pkg_archive): $(install_efi32fs) $(GRUB_PKG_DESCRIPTION_FILE) $(GRUB_PKG_INSTALL_SCRIPT)
+ @cp $(GRUB_PKG_DESCRIPTION_FILE) $(GRUB_PKG)/.DESCRIPTION
+ @cp $(GRUB_PKG_INSTALL_SCRIPT) $(GRUB_PKG)/.INSTALL
+ @$(BUILD_PKG_REQUIRES) $(GRUB_PKG)/.REQUIRES
+ @echo "pkgname=$(GRUB_PKG_NAME)" > $(GRUB_PKG)/.PKGINFO ; \
+ echo "pkgver=$(GRUB_PKG_VERSION)" >> $(GRUB_PKG)/.PKGINFO ; \
+ echo "arch=$(GRUB_PKG_ARCH)" >> $(GRUB_PKG)/.PKGINFO ; \
+ echo "distroname=$(GRUB_PKG_DISTRO_NAME)" >> $(GRUB_PKG)/.PKGINFO ; \
+ echo "distrover=$(GRUB_PKG_DISTRO_VERSION)" >> $(GRUB_PKG)/.PKGINFO ; \
+ echo "group=$(GRUB_PKG_GROUP)" >> $(GRUB_PKG)/.PKGINFO ; \
+ echo "short_description=\"$(GRUB_PKG_SHORT_DESCRIPTION)\"" >> $(GRUB_PKG)/.PKGINFO ; \
+ echo "url=$(GRUB_PKG_URL)" >> $(GRUB_PKG)/.PKGINFO ; \
+ echo "license=$(GRUB_PKG_LICENSE)" >> $(GRUB_PKG)/.PKGINFO
+ @$(PSEUDO) sh -c "cd $(GRUB_PKG) && \
+ chown -R root:root . && \
+ $(MAKE_PACKAGE) -J --linkadd=yes $(GNUPG_OPTIONS) -m -d .. ."