Browse Source

support ubuntu and debian rootfs

Signed-off-by: weishanshan1084 <weishanshan1084@phytium.com.cn>
pull/26/head
weishanshan1084 6 months ago
parent
commit
1502f614b2
  1. 2
      Makefile
  2. 4
      package/Makefile.in
  3. 32
      package/skeleton-custom/skeleton-custom.mk
  4. 74
      system/Config.in
  5. 28
      toolchain/toolchain-external/pkg-toolchain-external.mk

2
Makefile

@ -725,6 +725,7 @@ target-finalize: $(PACKAGES) $(TARGET_DIR) host-finalize
@$(call MESSAGE,"Finalizing target directory") @$(call MESSAGE,"Finalizing target directory")
$(call per-package-rsync,$(sort $(PACKAGES)),target,$(TARGET_DIR),copy) $(call per-package-rsync,$(sort $(PACKAGES)),target,$(TARGET_DIR),copy)
$(foreach hook,$(TARGET_FINALIZE_HOOKS),$($(hook))$(sep)) $(foreach hook,$(TARGET_FINALIZE_HOOKS),$($(hook))$(sep))
ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y)
rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \ rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
$(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \ $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \
$(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake \ $(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake \
@ -766,6 +767,7 @@ endif
echo "PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \ echo "PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \
) > $(TARGET_DIR)/usr/lib/os-release ) > $(TARGET_DIR)/usr/lib/os-release
ln -sf ../usr/lib/os-release $(TARGET_DIR)/etc ln -sf ../usr/lib/os-release $(TARGET_DIR)/etc
endif # BR2_ROOTFS_SKELETON_DEFAULT
@$(call MESSAGE,"Sanitizing RPATH in target tree") @$(call MESSAGE,"Sanitizing RPATH in target tree")
PARALLEL_JOBS=$(PARALLEL_JOBS) \ PARALLEL_JOBS=$(PARALLEL_JOBS) \

4
package/Makefile.in

@ -149,6 +149,10 @@ endif
TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS)) TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))
ifeq ($(BR2_ROOTFS_SKELETON_UBUNTU)$(BR2_ROOTFS_SKELETON_DEBIAN),y)
TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib/aarch64-linux-gnu
endif
# By design, _FORTIFY_SOURCE requires gcc optimization to be enabled. # By design, _FORTIFY_SOURCE requires gcc optimization to be enabled.
# Therefore, we need to pass _FORTIFY_SOURCE and the optimization level # Therefore, we need to pass _FORTIFY_SOURCE and the optimization level
# through the same mechanism, i.e currently through CFLAGS. Passing # through the same mechanism, i.e currently through CFLAGS. Passing

32
package/skeleton-custom/skeleton-custom.mk

@ -15,6 +15,36 @@ SKELETON_CUSTOM_PROVIDES = skeleton
SKELETON_CUSTOM_INSTALL_STAGING = YES SKELETON_CUSTOM_INSTALL_STAGING = YES
ifeq ($(BR2_ROOTFS_SKELETON_UBUNTU)$(BR2_ROOTFS_SKELETON_DEBIAN),y)
define SKELETON_CUSTOM_BUILD_CMDS
$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_CUSTOM_SKELETON_SCRIPT)), \
@$(call MESSAGE,"Executing post-skeleton-custom script $(s)")$(sep) \
$(EXTRA_ENV) $(s) $(@D) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
endef
define SKELETON_CUSTOM_INSTALL_TARGET_CMDS
$(call SYSTEM_RSYNC,$(@D),$(TARGET_DIR))
$(INSTALL) -m 0644 support/misc/target-dir-warning.txt \
$(TARGET_DIR_WARNING_FILE)
cd $(TARGET_DIR)/var && rm run && ln -sf ../run run && rm lock && ln -sf ../run/lock lock
endef
define SKELETON_CUSTOM_INSTALL_STAGING_CMDS
$(call SYSTEM_RSYNC,$(@D),$(STAGING_DIR))
cd $(STAGING_DIR)/var && rm run && ln -sf ../run run && rm lock && ln -sf ../run/lock lock
endef
define SKELETON_CUSTOM_REMOVE_PERMISSION_FOR_SSH_FILES
if [ -d $(TARGET_DIR)/etc/ssh ]; then \
chmod go-r $(TARGET_DIR)/etc/ssh/ssh_host_ecdsa_key; \
chmod go-r $(TARGET_DIR)/etc/ssh/ssh_host_ed25519_key; \
chmod go-r $(TARGET_DIR)/etc/ssh/ssh_host_rsa_key; \
fi
endef
SKELETON_CUSTOM_POST_INSTALL_TARGET_HOOKS += SKELETON_CUSTOM_REMOVE_PERMISSION_FOR_SSH_FILES
else
SKELETON_CUSTOM_PATH = $(call qstrip,$(BR2_ROOTFS_SKELETON_CUSTOM_PATH)) SKELETON_CUSTOM_PATH = $(call qstrip,$(BR2_ROOTFS_SKELETON_CUSTOM_PATH))
ifeq ($(BR2_PACKAGE_SKELETON_CUSTOM)$(BR_BUILDING),yy) ifeq ($(BR2_PACKAGE_SKELETON_CUSTOM)$(BR_BUILDING),yy)
@ -57,5 +87,5 @@ define SKELETON_CUSTOM_INSTALL_STAGING_CMDS
$(call SYSTEM_USR_SYMLINKS_OR_DIRS,$(STAGING_DIR)) $(call SYSTEM_USR_SYMLINKS_OR_DIRS,$(STAGING_DIR))
$(call SYSTEM_LIB_SYMLINK,$(STAGING_DIR)) $(call SYSTEM_LIB_SYMLINK,$(STAGING_DIR))
endef endef
endif # ifeq ($(BR2_ROOTFS_SKELETON_UBUNTU)$(BR2_ROOTFS_SKELETON_DEBIAN),y)
$(eval $(generic-package)) $(eval $(generic-package))

74
system/Config.in

@ -26,6 +26,76 @@ endchoice
if BR2_ROOTFS_SKELETON_CUSTOM if BR2_ROOTFS_SKELETON_CUSTOM
choice
prompt "Choose Ubuntu or Debian"
default BR2_ROOTFS_SKELETON_UBUNTU
config BR2_ROOTFS_SKELETON_UBUNTU
bool "custom target skeleton is ubuntu"
help
Custom target skeleton is ubuntu.
if BR2_ROOTFS_SKELETON_UBUNTU
choice
prompt "Choose Ubuntu version"
default BR2_ROOTFS_SKELETON_UBUNTU_JAMMY
config BR2_ROOTFS_SKELETON_UBUNTU_JAMMY
bool "Ubuntu 22.04"
help
Ubuntu 22.04 LTS (Jammy Jellyfish)
config BR2_ROOTFS_SKELETON_UBUNTU_FOCAL
bool "Ubuntu 20.04"
help
Ubuntu 20.04 LTS (Focal Fossa)
endchoice
endif
config BR2_ROOTFS_SKELETON_DEBIAN
bool "custom target skeleton is debian"
help
Custom target skeleton is debian.
endchoice
config BR2_PACKAGE_ROOTFS_DESKTOP
bool "Ubuntu or Debian desktop"
help
Ubuntu or Debian desktop.
config BR2_TARGET_GENERIC_HOSTNAME
string "System hostname"
default "buildroot"
help
Select system hostname to be stored in /etc/hostname.
Leave empty to not create /etc/hostname, or to keep the
one from a custom skeleton.
config BR2_ROOTFS_LINUX_HEADERS
bool "custom kernel headers"
help
Custom kernel headers for Ubuntu or Debian.
config BR2_ROOTFS_POST_CUSTOM_SKELETON_SCRIPT
string "Custom scripts to run before using custom skeleton"
default ""
help
Specify a space-separated list of scripts to be run after the download
and unzip has finished and before Buildroot starts using the custom skeleton.
This gives users the opportunity to do board/skeleton specific configuration,
add-ons and the like, so the generated files can be used directly
without further processing.
These scripts are called with the build directory name
as first argument. Make sure the exit code of those scripts are 0, otherwise
make will stop after calling them.
config BR2_ROOTFS_SKELETON_CUSTOM_PATH config BR2_ROOTFS_SKELETON_CUSTOM_PATH
string "custom target skeleton path" string "custom target skeleton path"
help help
@ -605,6 +675,10 @@ config BR2_ROOTFS_USERS_TABLES
See manual for details on the usage and syntax of these files. See manual for details on the usage and syntax of these files.
config BR2_ROOTFS_CHOWN
bool "Install rootfs-chown service"
select BR2_PACKAGE_ROOTFS_CHOWN
config BR2_ROOTFS_OVERLAY config BR2_ROOTFS_OVERLAY
string "Root filesystem overlay directories" string "Root filesystem overlay directories"
default "" default ""

28
toolchain/toolchain-external/pkg-toolchain-external.mk

@ -453,6 +453,18 @@ define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS
$(call copy_toolchain_sysroot,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR},$${SUPPORT_LIB_DIR}) $(call copy_toolchain_sysroot,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR},$${SUPPORT_LIB_DIR})
endef endef
define TOOLCHAIN_EXTERNAL_FIX_SYMLINK_IN_STAGING
for link in $$(find $(STAGING_DIR) -type l); do \
target=$$(readlink $${link}) ; \
if [ "$${target}" == "$${target$(SHARP_SIGN)/}" ] ; then \
continue ; \
fi ; \
relpath="$(call relpath_prefix,$${target$(SHARP_SIGN)/})" ; \
echo "Fixing symlink $${link} from $${target} to $${relpath}$${target$(SHARP_SIGN)/}" ; \
ln -sf $${relpath}$${target$(SHARP_SIGN)/} $${link} ; \
done
endef
# Create a symlink from (usr/)$(ARCH_LIB_DIR) to lib. # Create a symlink from (usr/)$(ARCH_LIB_DIR) to lib.
# Note: the skeleton package additionally creates lib32->lib or lib64->lib # Note: the skeleton package additionally creates lib32->lib or lib64->lib
# (as appropriate) # (as appropriate)
@ -595,6 +607,15 @@ $(2)_TOOLCHAIN_WRAPPER_ARGS += $$(TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS)
$(2)_BUILD_CMDS = $$(TOOLCHAIN_WRAPPER_BUILD) $(2)_BUILD_CMDS = $$(TOOLCHAIN_WRAPPER_BUILD)
ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
define $(2)_INSTALL_STAGING_CMDS
$$(TOOLCHAIN_WRAPPER_INSTALL)
$$(TOOLCHAIN_EXTERNAL_FIX_SYMLINK_IN_STAGING)
$$(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER)
$$(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT)
$$(TOOLCHAIN_EXTERNAL_FIXUP_PRETTY_PRINTER_LOADER)
endef
else
define $(2)_INSTALL_STAGING_CMDS define $(2)_INSTALL_STAGING_CMDS
$$(TOOLCHAIN_WRAPPER_INSTALL) $$(TOOLCHAIN_WRAPPER_INSTALL)
$$(TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK) $$(TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK)
@ -603,10 +624,16 @@ define $(2)_INSTALL_STAGING_CMDS
$$(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT) $$(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT)
$$(TOOLCHAIN_EXTERNAL_FIXUP_PRETTY_PRINTER_LOADER) $$(TOOLCHAIN_EXTERNAL_FIXUP_PRETTY_PRINTER_LOADER)
endef endef
endif
# Even though we're installing things in both the staging, the host # Even though we're installing things in both the staging, the host
# and the target directory, we do everything within the # and the target directory, we do everything within the
# install-staging step, arbitrarily. # install-staging step, arbitrarily.
ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
define $(2)_INSTALL_TARGET_CMDS
endef
else
define $(2)_INSTALL_TARGET_CMDS define $(2)_INSTALL_TARGET_CMDS
$$(TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK) $$(TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK)
$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS) $$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS)
@ -614,6 +641,7 @@ define $(2)_INSTALL_TARGET_CMDS
$$(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO) $$(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO)
$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LDD) $$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LDD)
endef endef
endif
# Call the generic package infrastructure to generate the necessary # Call the generic package infrastructure to generate the necessary
# make targets # make targets

Loading…
Cancel
Save