1################################################################################ 2# 3# system-related variables and macros 4# 5################################################################################ 6 7# This file exists to define variables and macros that pertain to the system 8# settings, like rsyncing a directory for skeletons, or the /lib vs. /usr/lib 9# symlink handling. 10# 11# Some variables may be used as conditions in Makefile code, so they must be 12# defined properly before they are used; this file is included early, before 13# any package is. 14 15# - SYSTEM_USR_SYMLINKS_OR_DIRS 16# create /lib, /bin and /sbin, either as directories or as symlinks to 17# their /usr conterparts 18# 19# - SYSTEM_RSYNC 20# rsync $(1) to $(2), with proper exclusions and rights 21# 22# - SYSTEM_LIB_SYMLINK 23# create the appropriate /lib{32,64} symlinks 24# 25# - SYSTEM_GETTY_PORT 26# - SYSTEM_GETTY_BAUDRATE 27# - SYSTEM_GETTY_TERM 28# - SYSTEM_GETTY_OPTIONS 29# the un-quoted getty setting 30# 31# - SYSTEM_REMOUNT_ROOT_INITTAB 32# set inittab to remount root read-write or read-only 33# 34 35# This function handles the merged or non-merged /usr cases 36ifeq ($(BR2_ROOTFS_MERGED_USR),y) 37define SYSTEM_USR_SYMLINKS_OR_DIRS 38 ln -snf usr/bin $(1)/bin 39 ln -snf usr/sbin $(1)/sbin 40 ln -snf usr/lib $(1)/lib 41endef 42else 43define SYSTEM_USR_SYMLINKS_OR_DIRS 44 $(INSTALL) -d -m 0755 $(1)/bin 45 $(INSTALL) -d -m 0755 $(1)/sbin 46 $(INSTALL) -d -m 0755 $(1)/lib 47endef 48endif 49 50# This function rsyncs the skeleton directory in $(1) to the destination 51# in $(2), which should be either $(TARTGET_DIR) or $(STAGING_DIR) 52define SYSTEM_RSYNC 53 rsync -a --ignore-times $(RSYNC_VCS_EXCLUSIONS) \ 54 --chmod=u=rwX,go=rX --exclude .empty --exclude '*~' \ 55 $(1)/ $(2)/ 56endef 57 58# Make a symlink lib32->lib or lib64->lib as appropriate. 59# MIPS64/n32 requires lib32 even though it's a 64-bit arch. However, since gcc 60# 5.1.0 internal compiler paths in sysroot are relative to lib64, so we must 61# create both. 62# $(1): base dir (either staging or target) 63ifeq ($(BR2_MIPS_NABI32),y) 64define SYSTEM_LIB_SYMLINK 65 ln -snf lib $(1)/lib64 66 ln -snf lib $(1)/usr/lib64 67 ln -snf lib $(1)/lib32 68 ln -snf lib $(1)/usr/lib32 69endef 70else ifeq ($(BR2_ARCH_IS_64),y) 71define SYSTEM_LIB_SYMLINK 72 ln -snf lib $(1)/lib64 73 ln -snf lib $(1)/usr/lib64 74endef 75else 76define SYSTEM_LIB_SYMLINK 77 ln -snf lib $(1)/lib32 78 ln -snf lib $(1)/usr/lib32 79endef 80endif 81 82SYSTEM_GETTY_PORT = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)) 83SYSTEM_GETTY_BAUDRATE = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE)) 84SYSTEM_GETTY_TERM = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_TERM)) 85SYSTEM_GETTY_OPTIONS = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_OPTIONS)) 86 87ifeq ($(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW),y) 88# Find commented line, if any, and remove leading '#'s 89define SYSTEM_REMOUNT_ROOT_INITTAB 90 $(SED) '/^#.*-o remount,rw \/$$/s~^#\+~~' $(TARGET_DIR)/etc/inittab 91endef 92else 93# Find uncommented line, if any, and add a leading '#' 94define SYSTEM_REMOUNT_ROOT_INITTAB 95 $(SED) '/^[^#].*-o remount,rw \/$$/s~^~#~' $(TARGET_DIR)/etc/inittab 96endef 97endif 98 99ifeq ($(BR_BUILDING)$(BR2_SYSTEM_DEFAULT_PATH),y"") 100$(error BR2_SYSTEM_DEFAULT_PATH can't be empty) 101endif 102