quinnwencn / blog

Apache License 2.0
0 stars 0 forks source link

09 在openwrt上使用ostree升级rootfs错误:tls support is not available #20

Closed quinnwencn closed 3 months ago

quinnwencn commented 4 months ago

根据ostree仓库的issue提示,应该是缺少glib-networking,这是gio中的一个ssl支持的子库。

quinnwencn commented 3 months ago

OpenWRT新增glib-networking的Makefile:

include $(TOPDIR)/rules.mk

PKG_NAME:=glib-networking
PKG_VERSION:=2.74.0
PKG_RELEASE:=$(AUTORELEASE)

PKG_SOURCE:=$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/GNOME/glib-networking/archive/refs/tags/
PKG_HASH:=3dd7fe348ce0fef927a0ceeac531548dc2cb344228f70cb6f461d7a1e1d44be6

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
HOST_BUILD_DEPENDS:=pcre2/host libffi/host

include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
include $(INCLUDE_DIR)/meson.mk

define Package/glib-networking
  SECTION:=libs
  CATEGORY:=Libraries
  DEPENDS:=+glib2 +libgnutls +libopenssl
  TITLE:=glib-networking for glib2
  URL:=http://www.gtk.org/
endef

define Package/glib2/description
  Network-related giomodules for glib
endef

TARGET_CFLAGS += -ffunction-sections -fdata-sections
TARGET_LDFLAGS += -Wl,--gc-sections

MESON_HOST_ARGS += $(COMP_ARGS) -Dxattr=false -Ddefault_library=static -Dnls=disabled -Dlibproxy=disabled
MESON_ARGS += $(COMP_ARGS) -Dlibproxy=disabled

define Build/InstallDev
    $(INSTALL_DIR) $(1)/usr/lib/gio/modules
    $(CP) $(PKG_INSTALL_DIR)/usr/lib/gio/modules/libgio*.so $(1)/usr/lib/gio/modules
endef

define Package/$(PKG_NAME)/install
    $(INSTALL_DIR) $(1)/usr/lib/gio/modules
    $(INSTALL_BIN) \
        $(PKG_BUILD_DIR)/openwrt-build/tls/gnutls/libgiognutls.so \
        $(1)/usr/lib/gio/modules

    $(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt-build/proxy/environment/libgioenvironmentproxy.so $(1)/usr/lib/gio/modules
endef

$(eval $(call HostBuild))
$(eval $(call BuildPackage,$(PKG_NAME)))
quinnwencn commented 3 months ago

其中glib-networking的版本和glib2的版本应对应,比如glib-networking的版本是2.74.0,那么glib2的版本也应该是2.74.0.

quinnwencn commented 3 months ago

需要注意的是,glib-networking和glib2以及gnutls的版本号有版本对应,同时,需要安装ca-certificates.