Initial Commit

- initial default booting image
This commit is contained in:
2026-11-06 20:45:42 +01:00
commit b8783708ae
15201 changed files with 602532 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
From 2e53f331104b29db7caf1641a30d3e9316b57184 Mon Sep 17 00:00:00 2001
From: Uri Simchoni <uri@samba.org>
Date: Sun, 20 Oct 2019 00:03:14 +0300
Subject: [PATCH] build: find pre-built heimdal build tools in case of embedded
heimdal
This patch fixes the case of finding asn1_compile and compile_et for
building embedded heimdal, by setting
--bundled-libraries='!asn1_compile,!compile_et' as configure flags.
The Heimdal build tools compile_et and asn1_compile are needed *only*
if we use the embedded heimdal (otherwise we don't build heimdal and
use headers that have been generated by those tools elsewhere).
For cross-compilation with embedded heimdal, it is vital to use host build
tools, and so asn1_compile and compile_et must be supplied and not
built. One way of doing this would be to set the COMPILE_ET and
ASN1_COMPILE env vars to the location of supplied binaries. Another way,
which is more commonly used, is to exclude asn1_compile and compile_et
from bundled packages via the switch
-bundled-libraries='!asn1_compile,!compile_et'. When this is done,
the build script searches the path for those tools and sets the
ASN1_COMPILE and COMPILE_ET vars accordingly. (this is admittedly
kind of a round-about way of doing things but this has become the
de-facto standard amongst embedded distro builders).
In commit 8061983d4882f3ba3f12da71443b035d7b672eec, this process of
finding the binaris has been moved to be carried out only in the
system heimdal case. As explained above, we only need these tools,
and hence the check, in bundled mode.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14164
Signed-off-by: Uri Simchoni <uri@samba.org>
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
[Bernd: rebased for version 4.23.1]
---
wscript_configure_embedded_heimdal | 11 +++++++++++
wscript_configure_system_heimdal | 11 -----------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/wscript_configure_embedded_heimdal b/wscript_configure_embedded_heimdal
index 8c55ae2..4fdae80 100644
--- a/wscript_configure_embedded_heimdal
+++ b/wscript_configure_embedded_heimdal
@@ -16,3 +16,14 @@
conf.define('HAVE_KRB5_INIT_CREDS_STEP', 1)
conf.define('HAVE_GSS_KEY_VALUE_SET_DESC', 1)
+
+def check_system_heimdal_binary(name):
+ if conf.LIB_MAY_BE_BUNDLED(name):
+ return False
+ if not conf.find_program(name, var=name.upper()):
+ return False
+ conf.define('USING_SYSTEM_%s' % name.upper(), 1)
+ return True
+
+check_system_heimdal_binary("compile_et")
+check_system_heimdal_binary("asn1_compile")
--
2.20.1

View File

@@ -0,0 +1,98 @@
From aab0668cc358e443b243528939947c3eea93ca27 Mon Sep 17 00:00:00 2001
From: Titouan Christophe <titouan.christophe@mind.be>
Date: Sat, 30 May 2026 00:30:00 +0200
Subject: [PATCH] charset: fix iconv_t int/pointer conversion on uClibc
The iconv handles cd_pull, cd_push and cd_direct are stored as 'void *'
in struct smb_iconv_s, but iconv_open() returns and iconv()/iconv_close()
take an iconv_t. On glibc this is harmless because iconv_t is itself a
'void *', so the implicit conversions are between identical types.
On uClibc however iconv_t is a 'long int', so storing iconv_open()'s
result into a 'void *' field (and passing those fields back to iconv()
and iconv_close()) is an implicit integer<->pointer conversion. Since
GCC 14 -Wint-conversion is an error by default, this breaks the build:
iconv.c: In function 'sys_iconv':
iconv.c:166:38: error: passing argument 1 of 'iconv' makes integer
from pointer without a cast [-Wint-conversion]
iconv.c: In function 'smb_iconv_open_ex':
iconv.c:403:30: error: assignment to 'void *' from 'iconv_t'
{aka 'long int'} makes pointer from integer without a cast
[-Wint-conversion]
Add explicit casts between iconv_t and void * so the conversions are
intentional and the code builds on both glibc and uClibc.
Upstream: not applicable to samba, because uclibc has already released
a fix, but this isn't included yet in Buildroot prebuilt toolchains.
The problem is therefore to be patched in Buildroot itself.
Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
---
lib/util/charset/iconv.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/lib/util/charset/iconv.c b/lib/util/charset/iconv.c
index 074794a26e3..90389d6a954 100644
--- a/lib/util/charset/iconv.c
+++ b/lib/util/charset/iconv.c
@@ -163,7 +163,7 @@ static size_t sys_iconv(void *cd,
size_t ret = iconv((iconv_t)cd,
discard_const_p(char *, inbuf), inbytesleft,
outbuf, outbytesleft);
- if (ret == (size_t)-1) iconv(cd, NULL, NULL, NULL, NULL);
+ if (ret == (size_t)-1) iconv((iconv_t)cd, NULL, NULL, NULL, NULL);
return ret;
}
#endif
@@ -345,12 +345,12 @@ static int smb_iconv_t_destructor(smb_iconv_t hwd)
}
#endif
#ifdef HAVE_NATIVE_ICONV
- if (hwd->cd_pull != NULL && hwd->cd_pull != (iconv_t)-1)
- iconv_close(hwd->cd_pull);
- if (hwd->cd_push != NULL && hwd->cd_push != (iconv_t)-1)
- iconv_close(hwd->cd_push);
- if (hwd->cd_direct != NULL && hwd->cd_direct != (iconv_t)-1)
- iconv_close(hwd->cd_direct);
+ if (hwd->cd_pull != NULL && hwd->cd_pull != (void *)(iconv_t)-1)
+ iconv_close((iconv_t)hwd->cd_pull);
+ if (hwd->cd_push != NULL && hwd->cd_push != (void *)(iconv_t)-1)
+ iconv_close((iconv_t)hwd->cd_push);
+ if (hwd->cd_direct != NULL && hwd->cd_direct != (void *)(iconv_t)-1)
+ iconv_close((iconv_t)hwd->cd_direct);
#endif
return 0;
@@ -400,19 +400,19 @@ _PUBLIC_ smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode,
* conversions */
if (from == NULL) {
- ret->cd_pull = iconv_open("UTF-16LE", fromcode);
- if (ret->cd_pull == (iconv_t)-1)
- ret->cd_pull = iconv_open("UCS-2LE", fromcode);
- if (ret->cd_pull != (iconv_t)-1) {
+ ret->cd_pull = (void *)iconv_open("UTF-16LE", fromcode);
+ if (ret->cd_pull == (void *)(iconv_t)-1)
+ ret->cd_pull = (void *)iconv_open("UCS-2LE", fromcode);
+ if (ret->cd_pull != (void *)(iconv_t)-1) {
ret->pull = sys_iconv;
}
}
if (to == NULL) {
- ret->cd_push = iconv_open(tocode, "UTF-16LE");
- if (ret->cd_push == (iconv_t)-1)
- ret->cd_push = iconv_open(tocode, "UCS-2LE");
- if (ret->cd_push != (iconv_t)-1) {
+ ret->cd_push = (void *)iconv_open(tocode, "UTF-16LE");
+ if (ret->cd_push == (void *)(iconv_t)-1)
+ ret->cd_push = (void *)iconv_open(tocode, "UCS-2LE");
+ if (ret->cd_push != (void *)(iconv_t)-1) {
ret->push = sys_iconv;
}
}
--
2.54.0

65
package/samba4/Config.in Normal file
View File

@@ -0,0 +1,65 @@
comment "samba4 needs a uClibc or glibc toolchain w/ wchar, dynamic library, NPTL"
depends on BR2_TOOLCHAIN_HAS_SYNC_4
depends on !BR2_USE_WCHAR || BR2_TOOLCHAIN_USES_MUSL \
|| BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS_NPTL
depends on BR2_USE_MMU
comment "samba4 needs a toolchain w/ gcc >= 7"
depends on BR2_m68k
depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_7
config BR2_PACKAGE_SAMBA4
bool "samba4"
depends on BR2_USE_MMU # fork()
depends on BR2_USE_WCHAR # python
depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL # python -> libffi
depends on !BR2_STATIC_LIBS # cmocka, python, gnutls
depends on BR2_TOOLCHAIN_HAS_SYNC_4
depends on !BR2_TOOLCHAIN_USES_MUSL
depends on !BR2_m68k || BR2_TOOLCHAIN_GCC_AT_LEAST_7 # m68k needs gcc >= 7.x
select BR2_PACKAGE_CMOCKA
select BR2_PACKAGE_E2FSPROGS
select BR2_PACKAGE_GNUTLS
select BR2_PACKAGE_HOST_PYTHON3
select BR2_PACKAGE_HOST_PYTHON3_SSL
select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
select BR2_PACKAGE_LIBTIRPC if !BR2_TOOLCHAIN_HAS_NATIVE_RPC
select BR2_PACKAGE_LIBXCRYPT if BR2_TOOLCHAIN_USES_GLIBC
select BR2_PACKAGE_POPT
select BR2_PACKAGE_ZLIB
help
Provides secure, stable and fast file and print services
for all clients using the SMB/CIFS protocol, such as all
versions of DOS, Windows, OS/2, Linux and many others.
http://www.samba.org/
if BR2_PACKAGE_SAMBA4
config BR2_PACKAGE_SAMBA4_AD_DC
bool "AD DC"
depends on BR2_PACKAGE_PYTHON3
select BR2_PACKAGE_JANSSON
select BR2_PACKAGE_PYTHON_DNSPYTHON
select BR2_PACKAGE_PYTHON_MARKDOWN
select BR2_PACKAGE_SAMBA4_ADS
help
Enable Active Directory Domain Controller functionality.
comment "AD DC depends on python3"
depends on !BR2_PACKAGE_PYTHON3
config BR2_PACKAGE_SAMBA4_ADS
bool "ADS"
select BR2_PACKAGE_OPENLDAP
help
Enable Active Directory member Server functionality.
config BR2_PACKAGE_SAMBA4_SMBTORTURE
bool "smbtorture"
help
Install the smbtorture test suite.
It's normally used for validation and stress testing.
Approximately +5 MB of stripped uncompressed target space.
endif

56
package/samba4/S91smb Normal file
View File

@@ -0,0 +1,56 @@
#!/bin/sh
[ -f /etc/samba/smb.conf ] || exit 0
mkdir -p /var/log/samba
start() {
printf "Starting SMB services: "
smbd -D
[ $? = 0 ] && echo "OK" || echo "FAIL"
printf "Starting NMB services: "
nmbd -D
[ $? = 0 ] && echo "OK" || echo "FAIL"
}
stop() {
printf "Shutting down SMB services: "
kill -9 `pidof smbd`
[ $? = 0 ] && echo "OK" || echo "FAIL"
printf "Shutting down NMB services: "
kill -9 `pidof nmbd`
[ $? = 0 ] && echo "OK" || echo "FAIL"
}
restart() {
stop
start
}
reload() {
printf "Reloading smb.conf file: "
kill -HUP `pidof smbd`
[ $? = 0 ] && echo "OK" || echo "FAIL"
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac
exit $?

View File

@@ -0,0 +1,47 @@
Checking simple C program: OK
rpath library support: OK
-Wl,--version-script support: OK
Checking getconf LFS_CFLAGS: NO
Checking for large file support without additional flags: OK
Checking for -D_LARGE_FILES: OK
Checking correct behavior of strtoll: NO
Checking for working strptime: OK
Checking for C99 vsnprintf: OK
Checking for HAVE_SHARED_MMAP: OK
Checking for HAVE_MREMAP: OK
Checking for HAVE_INCOHERENT_MMAP: NO
Checking for HAVE_SECURE_MKSTEMP: OK
Checking for HAVE_IFACE_GETIFADDRS: OK
Checking for kernel change notify support: OK
Checking for Linux kernel oplocks: OK
Checking for kernel share modes: OK
Checking if can we convert from CP850 to UCS-2LE: OK
Checking if can we convert from UTF-8 to UCS-2LE: OK
Checking whether we can use Linux thread-specific credentials with 32-bit system calls: OK
Checking whether we can use Linux thread-specific credentials: OK
Checking whether setreuid is available: OK
Checking whether setresuid is available: OK
Checking whether seteuid is available: OK
Checking whether fcntl locking is available: OK
Checking whether fcntl lock supports open file description locks: OK
Checking for the maximum value of the 'time_t' type: OK
Checking whether the realpath function allows a NULL argument: OK
Checking whether POSIX capabilities are available: OK
Checking for ftruncate extend: OK
vfs_fileid checking for statfs() and struct statfs.f_fsid: OK
getcwd takes a NULL argument: OK
Checking uname sysname type: "Linux"
Checking uname release type: "3.0.0"
Checking uname version type: "#1 Tue Nov 1 12:34:56 UTC 2013"
Checking value of NSIG: "65"
Checking value of _NSIG: "65"
Checking value of SIGRTMAX: "64"
Checking value of SIGRTMIN: "34"
Checking errno of iconv for illegal multibyte sequence: "0"
checking for clnt_create(): OK
Checking for a 64-bit host to support lmdb: NO
Checking value of GNUTLS_CIPHER_AES_128_CFB8: 29
Checking value of GNUTLS_MAC_AES_CMAC_128: 203
Checking whether fcntl supports flags to send direct I/O availability signals: OK
Checking for gnutls fips mode support: NO
Checking for readlink breakage: NO

View File

@@ -0,0 +1,4 @@
# Locally calculated after checking pgp signature
# https://download.samba.org/pub/samba/stable/samba-4.24.6.tar.asc
sha256 810cc955acb367e9bde556dccfb50db177a02b7c553aa1629a0b905fa7616267 samba-4.24.6.tar.gz
sha256 8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903 COPYING

212
package/samba4/samba4.mk Normal file
View File

@@ -0,0 +1,212 @@
################################################################################
#
# samba4
#
################################################################################
SAMBA4_VERSION = 4.24.6
SAMBA4_SITE = https://download.samba.org/pub/samba/stable
SAMBA4_SOURCE = samba-$(SAMBA4_VERSION).tar.gz
SAMBA4_INSTALL_STAGING = YES
SAMBA4_LICENSE = GPL-3.0+
SAMBA4_LICENSE_FILES = COPYING
SAMBA4_CPE_ID_VENDOR = samba
SAMBA4_CPE_ID_PRODUCT = samba
SAMBA4_SELINUX_MODULES = samba
SAMBA4_DEPENDENCIES = \
host-e2fsprogs host-flex host-heimdal host-nfs-utils \
host-perl host-perl-parse-yapp host-python3 \
cmocka e2fsprogs gnutls popt zlib \
$(if $(BR2_PACKAGE_ICU),icu) \
$(if $(BR2_PACKAGE_LIBAIO),libaio) \
$(if $(BR2_PACKAGE_LIBCAP),libcap) \
$(if $(BR2_PACKAGE_LIBGLIB2),libglib2) \
$(if $(BR2_PACKAGE_READLINE),readline) \
$(if $(BR2_PACKAGE_LIBXCRYPT),libxcrypt) \
$(TARGET_NLS_DEPENDENCIES)
SAMBA4_CFLAGS = $(TARGET_CFLAGS)
SAMBA4_LDFLAGS = $(TARGET_LDFLAGS) $(TARGET_NLS_LIBS)
SAMBA4_CONF_ENV = \
CFLAGS="$(SAMBA4_CFLAGS)" \
LDFLAGS="$(SAMBA4_LDFLAGS)" \
XSLTPROC=false \
WAF_NO_PREFORK=1
# m68k needs 32-bit offsets in switch tables to build
ifeq ($(BR2_m68k),y)
SAMBA4_CFLAGS += -mlong-jump-table-offsets
endif
SAMBA4_PYTHON = PYTHON="$(HOST_DIR)/bin/python3"
ifeq ($(BR2_PACKAGE_PYTHON3),y)
SAMBA4_PYTHON += PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config"
SAMBA4_DEPENDENCIES += python3
else
SAMBA4_CONF_OPTS += --disable-python
endif
ifeq ($(BR2_PACKAGE_LIBICONV),y)
SAMBA4_DEPENDENCIES += libiconv
SAMBA4_LDFLAGS += -liconv
endif
ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
SAMBA4_CFLAGS += `$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc`
SAMBA4_LDFLAGS += `$(PKG_CONFIG_HOST_BINARY) --libs libtirpc`
SAMBA4_DEPENDENCIES += libtirpc host-pkgconf
endif
ifeq ($(BR2_PACKAGE_ACL),y)
SAMBA4_CONF_OPTS += --with-acl-support
SAMBA4_DEPENDENCIES += acl
else
SAMBA4_CONF_OPTS += --without-acl-support
endif
ifeq ($(BR2_PACKAGE_CUPS),y)
SAMBA4_CONF_ENV += CUPS_CONFIG="$(STAGING_DIR)/usr/bin/cups-config"
SAMBA4_CONF_OPTS += --enable-cups
SAMBA4_DEPENDENCIES += cups
else
SAMBA4_CONF_OPTS += --disable-cups
endif
ifeq ($(BR2_PACKAGE_DBUS),y)
SAMBA4_DEPENDENCIES += dbus
SAMBA4_SHARED_MODULES += vfs_snapper
else
SAMBA4_SHARED_MODULES += !vfs_snapper
endif
ifeq ($(BR2_PACKAGE_DBUS)$(BR2_PACKAGE_AVAHI_DAEMON),yy)
SAMBA4_CONF_OPTS += --enable-avahi
SAMBA4_DEPENDENCIES += avahi
else
SAMBA4_CONF_OPTS += --disable-avahi
endif
ifeq ($(BR2_PACKAGE_LIBARCHIVE),y)
SAMBA4_CONF_OPTS += --with-libarchive
SAMBA4_DEPENDENCIES += libarchive
else
SAMBA4_CONF_OPTS += --without-libarchive
endif
ifeq ($(BR2_PACKAGE_LIBUNWIND),y)
SAMBA4_CONF_OPTS += --with-libunwind
SAMBA4_DEPENDENCIES += libunwind
else
SAMBA4_CONF_OPTS += --without-libunwind
endif
ifeq ($(BR2_PACKAGE_NCURSES),y)
SAMBA4_CONF_ENV += NCURSES_CONFIG="$(STAGING_DIR)/usr/bin/$(NCURSES_CONFIG_SCRIPTS)"
SAMBA4_DEPENDENCIES += ncurses
else
SAMBA4_CONF_OPTS += --without-regedit
endif
# The ctdb tests (cluster) need bash and take up some space
# They're normally intended for debugging so remove them
define SAMBA4_REMOVE_CTDB_TESTS
rm -rf $(TARGET_DIR)/usr/lib/ctdb-tests
rm -rf $(TARGET_DIR)/usr/share/ctdb-tests
rm -f $(TARGET_DIR)/usr/bin/ctdb_run_*tests
endef
SAMBA4_POST_INSTALL_TARGET_HOOKS += SAMBA4_REMOVE_CTDB_TESTS
define SAMBA4_CONFIGURE_CMDS
$(INSTALL) -m 0644 package/samba4/samba4-cache.txt $(@D)/cache.txt;
echo 'Checking whether fcntl supports setting/getting hints: $(if $(BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_13),OK,NO)' >>$(@D)/cache.txt;
echo 'Checking uname machine type: $(BR2_ARCH)' >>$(@D)/cache.txt;
(cd $(@D); \
$(SAMBA4_PYTHON) \
python_LDFLAGS="" \
python_LIBDIR="" \
PERL="$(HOST_DIR)/bin/perl" \
$(TARGET_CONFIGURE_OPTS) \
$(SAMBA4_CONF_ENV) \
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--with-libiconv=$(STAGING_DIR)/usr \
--enable-fhs \
--cross-compile \
--cross-answers=$(@D)/cache.txt \
--hostcc=gcc \
--disable-rpath \
--disable-rpath-install \
--disable-iprint \
--without-fam \
--without-pam \
--without-dmapi \
--without-gpgme \
--without-ldb-lmdb \
--disable-glusterfs \
--with-cluster-support \
--bundled-libraries='!asn1_compile,!compile_et' \
--with-shared-modules=$(subst $(space),$(comma),$(strip $(SAMBA4_SHARED_MODULES))) \
$(SAMBA4_CONF_OPTS) \
)
endef
define SAMBA4_BUILD_CMDS
$(TARGET_MAKE_ENV) $(SAMBA4_PYTHON) $(MAKE) -C $(@D)
endef
define SAMBA4_INSTALL_STAGING_CMDS
$(TARGET_MAKE_ENV) $(SAMBA4_PYTHON) $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install
endef
define SAMBA4_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(SAMBA4_PYTHON) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
endef
ifeq ($(BR2_PACKAGE_SAMBA4_AD_DC),y)
# host-python-dnspython and host-python-markdown are not strictly
# needed on the host, but on the target. however, samba's configure
# tests for their availability on the host.
SAMBA4_DEPENDENCIES += \
jansson \
host-python-dnspython \
host-python-markdown \
python-dnspython \
python-markdown
else
SAMBA4_CONF_OPTS += --without-ad-dc --without-json
endif
ifeq ($(BR2_PACKAGE_SAMBA4_ADS),y)
SAMBA4_CONF_OPTS += --with-ads --with-ldap
SAMBA4_DEPENDENCIES += openldap
SAMBA4_SHARED_MODULES += idmap_ad
else
SAMBA4_CONF_OPTS += --without-ads --without-ldap
SAMBA4_SHARED_MODULES += !idmap_ad
endif
ifeq ($(BR2_PACKAGE_SAMBA4_SMBTORTURE),)
define SAMBA4_REMOVE_SMBTORTURE
rm -f $(TARGET_DIR)/usr/bin/smbtorture
endef
SAMBA4_POST_INSTALL_TARGET_HOOKS += SAMBA4_REMOVE_SMBTORTURE
endif
define SAMBA4_INSTALL_INIT_SYSV
$(INSTALL) -m 0755 -D package/samba4/S91smb \
$(TARGET_DIR)/etc/init.d/S91smb
endef
ifeq ($(BR2_INIT_SYSTEMD),y)
SAMBA4_CONF_OPTS += --systemd-install-services
SAMBA4_DEPENDENCIES += systemd
endif
define SAMBA4_INSTALL_INIT_SYSTEMD
$(INSTALL) -D -m 644 $(@D)/packaging/systemd/samba.conf.tmp \
$(TARGET_DIR)/usr/lib/tmpfiles.d/samba.conf
printf "d /var/log/samba 755 root root\n" >>$(TARGET_DIR)/usr/lib/tmpfiles.d/samba.conf
endef
$(eval $(generic-package))