How to build package with sdk?

I have made those steps

First I have download sdk and toolchain

wget https://downloads.openwrt.org/snapshots/targets/lantiq/xrx200/openwrt-sdk-lantiq-xrx200_gcc-13.3.0_musl.Linux-x86_64.tar.zst
wget https://downloads.openwrt.org/snapshots/targets/lantiq/xrx200/openwrt-toolchain-lantiq-xrx200_gcc-13.3.0_musl.Linux-x86_64.tar.zst

checking sha256sums and gpg for security

wget https://downloads.openwrt.org/snapshots/targets/lantiq/xrx200/sha256sums
wget https://downloads.openwrt.org/snapshots/targets/lantiq/xrx200/sha256sums.asc
gpg -v *asc
sha256sum -c --ignore-missing sha256sums

I extract the toolchains and sdk

tar -xvf openwrt-sdk-lantiq-xrx200_gcc-13.3.0_musl.Linux-x86_64.tar.zst
tar -xvf openwrt-toolchain-lantiq-xrx200_gcc-13.3.0_musl.Linux-x86_64.tar.zst

I have created the packages and makefile

cd package
mkdir telnetd-ssl
vim Makefile
# $Id: Makefile 1146 2005-06-05 13:32:28Z nbd $

include $(TOPDIR)/rules.mk

PKG_NAME:=telnetd-ssl
PKG_VERSION:=0.17.41
PKG_RELEASE:=1
PKG_MD5SUM:=3063643c5d200b863cf3a794c22325aa

PKG_SOURCE_URL:=https://packages.debian.org/sid/telnetd-ssl
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_CAT:=zcat

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

include $(INCLUDE_DIR)/package.mk

define Package/telnetd-ssl
  SECTION:=net
  CATEGORY:=Network
  TITLE:=The in.telnetd program is a server that handles the Defense Advanced Research Project Agency (DARPA) interactive telnet communication protocol.
  SSL telnetd replaces the regular telnetd by using SSL authentication and encryption. It works in conjunction with the regular telnetd in both directio
  ns. It checks whether the other side also uses SSL, if not it falls back to the regular telnet protocol.
  URL:=https://packages.debian.org/sid/telnetd-ssl
  DEPENDS:=libopenssl3
endef

define Build/Configure
    $(call Build/Configure/Default,--without-pth-test --with-pth=$(STAGING_DIR),\
                        CXXFLAGS="$(TARGET_CFLAGS) -fno-builtin -nostdinc++" \
                        CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
                        LDFLAGS="-nodefaultlibs -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib -luClibc++ -lc -lm -lgcc")
endef

define Build/Compile
    $(call Build/Compile/Default)
endef

define Package/telnetd-ssl/install
    mkdir -p $(1)/usr/bin
    $(CP) $(PKG_BUILD_DIR)/src/telnetd-ssl $(1)/usr/bin/
endef

$(eval $(call BuildPackage,telnetd-ssl))

Now I have tried to make the package and


make V=99 package/telnetd-ssl
make: 'package/telnetd-ssl' is up to date.

But don't compile nothing!
Why?

Solution found

make package/telnetd-ssl is wrong

make package/telnetd-ssl/compile is ok

Now I'm using this makefile, more complete

include $(TOPDIR)/rules.mk

PKG_NAME:=telnetd-ssl
PKG_VERSION:=0.17.41
PKG_RELEASE:=1

PKG_SOURCE:=netkit-telnet-ssl_0.17.41+really0.17.orig.tar.gz
PKG_SOURCE_URL:=http://deb.debian.org/debian/pool/main/n/netkit-telnet-ssl
PKG_HASH:=9c80d5c7838361a328fb6b60016d503def9ce53ad3c589f3b08ff71a2bb88e00

PKG_MAINTAINER:=Me
PKG_LICENSE:=GPL-3.0-or-later
PKG_LICENSE_FILES:=COPYING

PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
PKG_BUILD_DIR=$(BUILD_DIR)/netkit-telnet-0.17

include $(INCLUDE_DIR)/package.mk

define Package/telnetd-ssl
  SECTION:=net
  CATEGORY:=Network
  DEPENDS:=+libopenssl
  TITLE:=Telnet with ssl support
  URL:=http://deb.debian.org/debian/pool/main/n/netkit-telnet-ssl
endef

define Package/telnetd-ssl/description

The in.telnetd program is a server that handles the Defense Advanced Research Project Agency (DARPA) interactive telnet communication protocol.
SSL telnetd replaces the regular telnetd by using SSL authentication and encryption. It works in conjunction with the regular telnetd in both directions. It checks whether the other side also uses SSL, if not it falls back to the regular telnet protocol.
Advantages over the regular telnetd: passwords and data sent do not go in the clear on the line.
endef

define Build/Configure
  $(call Build/Configure/Default,--prefix=/usr)
endef

define Package/telnetd-ssl/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/telnetd-ssl $(1)/usr/bin/
endef

$(eval $(call BuildPackage,telnetd-ssl))

but give me this error

Unrecognized option: --target=mips-openwrt-linux

how to remove this option?

I use other makefile with Cmake, but still give me the same error using configure script

include $(TOPDIR)/rules.mk

PKG_NAME:=telnetd-ssl
PKG_VERSION:=0.17.41
PKG_RELEASE:=1

PKG_SOURCE:=netkit-telnet-ssl_0.17.41+really0.17.orig.tar.gz
PKG_SOURCE_URL:=http://deb.debian.org/debian/pool/main/n/netkit-telnet-ssl
PKG_HASH:=9c80d5c7838361a328fb6b60016d503def9ce53ad3c589f3b08ff71a2bb88e00

PKG_MAINTAINER:=Me
PKG_LICENSE:=GPL-3.0-or-later
PKG_LICENSE_FILES:=COPYING

PKG_BUILD_PARALLEL:=1
PKG_BUILD_DIR=$(BUILD_DIR)/netkit-telnet-0.17
CMAKE_INSTALL:=1

include $(INCLUDE_DIR)/package.mk

define Package/telnetd-ssl
  SECTION:=net
  CATEGORY:=Network
  DEPENDS:=+libopenssl
  TITLE:=Telnet with ssl support
  URL:=http://deb.debian.org/debian/pool/main/n/netkit-telnet-ssl
endef

define Package/telnetd-ssl/description

The in.telnetd program is a server that handles the Defense Advanced Research Project Agency (DARPA) interactive telnet communication protocol.
SSL telnetd replaces the regular telnetd by using SSL authentication and encryption. It works in conjunction with the regular telnetd in both directions. It checks whether the other side also uses SSL, if not it falls back to the regular telnet protocol.
Advantages over the regular telnetd: passwords and data sent do not go in the clear on the line.
endef

CMAKE_OPTIONS += \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_INSTALL_MANDIR=/usr/man 

define Package/telnetd-ssl/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/telnetd-ssl $(1)/usr/bin/
endef

$(eval $(call BuildPackage,telnetd-ssl))

This makefile works stopping finally to use configure and use cmake

include $(TOPDIR)/rules.mk

PKG_NAME:=telnetd-ssl
PKG_VERSION:=0.17.41
PKG_RELEASE:=1


PKG_SOURCE:=netkit-telnet-ssl_0.17.41+really0.17.orig.tar.gz
PKG_SOURCE_URL:=http://deb.debian.org/debian/pool/main/n/netkit-telnet-ssl
PKG_HASH:=9c80d5c7838361a328fb6b60016d503def9ce53ad3c589f3b08ff71a2bb88e00

PKG_MAINTAINER:=Me
PKG_LICENSE:=GPL-3.0-or-later
PKG_LICENSE_FILES:=COPYING
CMAKE_INSTALL:=1

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
include $(INCLUDE_DIR)/cmake.mk


define Package/telnetd-ssl
  SECTION:=net
  CATEGORY:=Network
  DEPENDS:=+libopenssl
  TITLE:=Telnet with ssl support
  URL:=http://deb.debian.org/debian/pool/main/n/netkit-telnet-ssl
endef

CMAKE_OPTIONS += \
	-DDWITH_GettextLibs=OFF \
	-DWITH_Iconv=OFF \
	-DWITH_Libintl=OFF \
	-DWITH_LibDBI:BOOL=OFF

define Package/telnetd-ssl/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/telnetd-ssl $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/telnetd-ssl-{smsd,smsd-inject,smsd-monitor} $(1)/usr/bin
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{Gammu*,gsmsd*} $(1)/usr/lib
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_DIR) $(1)/etc/config
	$(INSTALL_CONF) ./files/telnetd-ssl $(1)/etc/config/telnetd-ssl
	$(INSTALL_BIN) ./files/telnetd-ssl.init $(1)/etc/init.d/telnetd-ssl
endef

define Package/telnetd-ssl/conffiles
/etc/config/telnetd-ssl
endef

$(eval $(call BuildPackage,telnetd-ssl))

I had to fix some things but is a good start
Another problem now, this program needs to patched in this order to compile

patch -p1 < $CWD/patches/010-full_set_in_18.diff
patch -p1 < $CWD/patches/020-from_18_to_24.diff
patch -p1 < $CWD/patches/500-implement_ssl.diff
patch -p1 < $CWD/patches/510-can_2004_0640_and_0998.diff
patch -p1 < $CWD/patches/022-buffer_overflow_by_HOME.diff
patch -p1 < $CWD/patches/024-can_2004-0911.diff
patch -p1 < $CWD/patches/026-can_2005_0469.diff
patch -p1 < $CWD/patches/512-numeric_hosts.diff
patch -p1 < $CWD/patches/514-mixed_up_to_24_7_1.diff
patch -p1 < $CWD/patches/516-telnet_up_to_24_7_1.diff
patch -p1 < $CWD/patches/518-telnetd_up_to_24_7_1.diff
patch -p1 < $CWD/patches/030-reject_invalid_port.diff
patch -p1 < $CWD/patches/520-from_7_1_to_14.diff
patch -p1 < $CWD/patches/530-from_14_to_21.diff
patch -p1 < $CWD/patches/540-buffer_overflow.diff
patch -p1 < $CWD/patches/545-track_scm.diff
patch -p1 < $CWD/patches/045-avoid_unsetting_term.diff
patch -p1 < $CWD/patches/100-format_security_error.diff
patch -p1 < $CWD/patches/120-some_protocol_refinement.diff
patch -p1 < $CWD/patches/130-drain_input_from_child.diff
patch -p1 < $CWD/patches/600-better_diagnostic.diff
patch -p1 < $CWD/patches/610-support_uservar.diff
patch -p1 < $CWD/patches/630-recent_libssl.diff
patch -p1 < $CWD/patches/650-improve_abilities.diff
patch -p1 < $CWD/patches/110-markup_errors.diff
patch -p1 < $CWD/patches/telnet-netwritebuf-fix.diff
patch -p1 < $CWD/patches/use-cmake-as-buildsystem.patch
patch -p1 < $CWD/patches/700-fix_UTF8.diff

How to make this in the makefile?

This makefile works, patches ok

include $(TOPDIR)/rules.mk

PKG_NAME:=telnetd-ssl
PKG_VERSION:=0.17.41
PKG_RELEASE:=1


PKG_SOURCE:=netkit-telnet-ssl_0.17.41+really0.17.orig.tar.gz
PKG_SOURCE_URL:=http://deb.debian.org/debian/pool/main/n/netkit-telnet-ssl
PKG_HASH:=9c80d5c7838361a328fb6b60016d503def9ce53ad3c589f3b08ff71a2bb88e00

PKG_MAINTAINER:=Me
PKG_LICENSE:=GPL-3.0-or-later
PKG_LICENSE_FILES:=COPYING
PKG_BUILD_DIR=$(BUILD_DIR)/netkit-telnet-0.17
CMAKE_INSTALL:=1

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
include $(INCLUDE_DIR)/cmake.mk


define Package/telnetd-ssl
  SECTION:=net
  CATEGORY:=Network
  DEPENDS:=+libopenssl
  TITLE:=Telnet with ssl support
  URL:=http://deb.debian.org/debian/pool/main/n/netkit-telnet-ssl
endef

CMAKE_OPTIONS += \
	-DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_INSTALL_MANDIR=/usr/man

define Package/telnetd-ssl/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/telnetd-ssl $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/telnetd-ssl-{smsd,smsd-inject,smsd-monitor} $(1)/usr/bin
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{Gammu*,gsmsd*} $(1)/usr/lib
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_DIR) $(1)/etc/config
	$(INSTALL_CONF) ./files/telnetd-ssl $(1)/etc/config/telnetd-ssl
	$(INSTALL_BIN) ./files/telnetd-ssl.init $(1)/etc/init.d/telnetd-ssl
endef

define Package/telnetd-ssl/conffiles
/etc/config/telnetd-ssl
endef

$(eval $(call BuildPackage,telnetd-ssl))

but now give me this error

Not searching for unused variables given on the command line.
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


CMake Error at CMakeLists.txt:29 (find_library):
  Could not find USE_TERMCAP using the following names: ncurses

Seems is not found the ncurses library
i have solved compiling with the sdk also the deps (ncurses)

I think it's easier to use the containerized SDK, so you know that all the setup and dependencies are there and of correct versions.

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.