From: wchang kim Date: Thu, 17 Dec 2015 09:06:22 +0000 (+0900) Subject: Description : Creating and Adding new layer for tizen micro profile base. X-Git-Url: http://review.tizen.org/git/?p=scm%2Fbb%2Fmeta-tizen.git;a=commitdiff_plain;h=0c5a55fc7f76c165579e6244eee56040a5445729 Description : Creating and Adding new layer for tizen micro profile base. Tizen micro profile has minimul system , nodejs and nginx. rpi-hwup-image-tizen-micro.bb is the target recipe for raspberry pi2 board. Some files was generated by yocto-layer tool. Some files was copied from meta-openembedded. We are preparing the wiki page how to build and apply the tizen micro image for raspberry pi2 board. Change-Id: I0a76d7852f7a4f54e4f74669985224276150b168 Signed-off-by: wchang kim --- diff --git a/meta-tizen-micro/COPYING.MIT b/meta-tizen-micro/COPYING.MIT new file mode 100644 index 0000000..89de354 --- /dev/null +++ b/meta-tizen-micro/COPYING.MIT @@ -0,0 +1,17 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/meta-tizen-micro/README b/meta-tizen-micro/README new file mode 100644 index 0000000..75d002b --- /dev/null +++ b/meta-tizen-micro/README @@ -0,0 +1,64 @@ +This README file contains information on the contents of the +tizen-micro layer. + +Please see the corresponding sections below for details. + + +Dependencies +============ + +This layer depends on: + + URI: git://git.openembedded.org/bitbake + branch: master + + URI: git://git.openembedded.org/openembedded-core + layers: meta + branch: master + + URI: git://git.yoctoproject.org/xxxx + layers: xxxx + branch: master + + +Patches +======= + +Please submit any patches against the tizen-micro layer to the +xxxx mailing list (xxxx@zzzz.org) and cc: the maintainer: + +Maintainer: XXX YYYYYY + + +Table of Contents +================= + + I. Adding the tizen-micro layer to your build + II. Misc + + +I. Adding the tizen-micro layer to your build +================================================= + +--- replace with specific instructions for the tizen-micro layer --- + +In order to use this layer, you need to make the build system aware of +it. + +Assuming the tizen-micro layer exists at the top-level of your +yocto build tree, you can add it to the build system by adding the +location of the tizen-micro layer to bblayers.conf, along with any +other layers needed. e.g.: + + BBLAYERS ?= " \ + /path/to/yocto/meta \ + /path/to/yocto/meta-yocto \ + /path/to/yocto/meta-yocto-bsp \ + /path/to/yocto/meta-tizen-micro \ + " + + +II. Misc +======== + +--- replace with specific information about the tizen-micro layer --- diff --git a/meta-tizen-micro/conf/layer.conf b/meta-tizen-micro/conf/layer.conf new file mode 100644 index 0000000..8604b24 --- /dev/null +++ b/meta-tizen-micro/conf/layer.conf @@ -0,0 +1,10 @@ +# We have a conf and classes directory, append to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have a recipes directory containing .bb and .bbappend files, add to BBFILES +BBFILES += "${LAYERDIR}/recipes*/*/*.bb \ + ${LAYERDIR}/recipes*/*/*.bbappend" + +BBFILE_COLLECTIONS += "tizen-micro" +BBFILE_PATTERN_tizen-micro := "^${LAYERDIR}/" +BBFILE_PRIORITY_tizen-micro = "9" \ No newline at end of file diff --git a/meta-tizen-micro/recipes-devtools/nodejs/nodejs/enable-armv5e-build.patch b/meta-tizen-micro/recipes-devtools/nodejs/nodejs/enable-armv5e-build.patch new file mode 100644 index 0000000..cc7c9ab --- /dev/null +++ b/meta-tizen-micro/recipes-devtools/nodejs/nodejs/enable-armv5e-build.patch @@ -0,0 +1,22 @@ +Building for qemuarm without thumb enabled is using -march=armv5e which isn't +recognized here. Fix it by adding __ARM_ARCH_5E__. + +v0.12.2 branch of node doesn't seem to be affected, because it's using +different version of v8 + +Upstream-Status: Pending + +Signed-off-by: Martin Jansa + +diff -uNr node-v0.12.2/deps/v8/src/base/atomicops_internals_arm_gcc.h node-v0.12.2-fix/deps/v8/src/base/atomicops_internals_arm_gcc.h +--- node-v0.12.2/deps/v8/src/base/atomicops_internals_arm_gcc.h 2015-04-01 00:13:01.000000000 +0200 ++++ node-v0.12.2-fix/deps/v8/src/base/atomicops_internals_arm_gcc.h 2015-04-28 14:30:43.119509207 +0200 +@@ -156,7 +156,7 @@ + + // This tests against any known ARMv5 variant. + #elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) || \ +- defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__) ++ defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__) + + // The kernel also provides a helper function to perform an atomic + // compare-and-swap operation at the hard-wired address 0xffff0fc0. diff --git a/meta-tizen-micro/recipes-devtools/nodejs/nodejs/no-registry.patch b/meta-tizen-micro/recipes-devtools/nodejs/nodejs/no-registry.patch new file mode 100644 index 0000000..ed24738 --- /dev/null +++ b/meta-tizen-micro/recipes-devtools/nodejs/nodejs/no-registry.patch @@ -0,0 +1,59 @@ +Bugfix for --no-registry in nodejs-v0.12.2 + +diff -u -r node-v0.12.2_def/deps/npm/lib/cache/caching-client.js node-v0.12.2/deps/npm/lib/cache/caching-client.js +--- node-v0.12.2_def/deps/npm/lib/cache/caching-client.js 2015-04-01 01:13:01.000000000 +0300 ++++ node-v0.12.2/deps/npm/lib/cache/caching-client.js 2015-05-18 00:47:10.738599686 +0300 +@@ -67,6 +67,22 @@ + var cacheBase = cacheFile(npm.config.get("cache"))(uri) + var cachePath = path.join(cacheBase, ".cache.json") + ++ if (parsed.host === "noregistry") (function() { ++ var stat = null ++ var file = npm.config.get("cache") + parsed.pathname + "/.cache.json" ++ try { ++ stat = fs.statSync(cachePath) ++ } catch (ex) {} ++ if (!stat) try { ++ stat = fs.statSync(file) ++ cachePath = file ++ } catch (ex) { ++ stat = "Registry not defined and registry files not found: \"" + ++ cachePath + "\", \"" + file + "\"." ++ throw new Error(stat) ++ } ++ })() ++ + // If the GET is part of a write operation (PUT or DELETE), then + // skip past the cache entirely, but still save the results. + if (uri.match(/\?write=true$/)) { +@@ -83,12 +99,17 @@ + } + catch (ex) { + data = null ++ if (parsed.host === "noregistry") ++ throw new Error("File \"" + cachePath+"\"" + " corrupted.") + } + + params.stat = stat + params.data = data + +- get_.call(client, uri, cachePath, params, cb) ++ if (parsed.host === "noregistry") ++ cb(null, data, JSON.stringify(data), { statusCode : 304 }) ++ else ++ get_.call(client, uri, cachePath, params, cb) + }) + } + else { +diff -u -r node-v0.12.2_def/deps/npm/lib/utils/map-to-registry.js node-v0.12.2/deps/npm/lib/utils/map-to-registry.js +--- node-v0.12.2_def/deps/npm/lib/utils/map-to-registry.js 2015-04-01 01:13:01.000000000 +0300 ++++ node-v0.12.2/deps/npm/lib/utils/map-to-registry.js 2015-05-18 01:15:10.030569613 +0300 +@@ -45,6 +45,8 @@ + + log.silly("mapToRegistry", "registry", registry) + ++ if (!registry) return cb(null, "http://noregistry/" + name, {}) ++ + var auth = config.getCredentialsByURI(registry) + + // normalize registry URL so resolution doesn't drop a piece of registry URL diff --git a/meta-tizen-micro/recipes-devtools/nodejs/nodejs_0.12.7.bb b/meta-tizen-micro/recipes-devtools/nodejs/nodejs_0.12.7.bb new file mode 100644 index 0000000..41eb5ee --- /dev/null +++ b/meta-tizen-micro/recipes-devtools/nodejs/nodejs_0.12.7.bb @@ -0,0 +1,80 @@ +DESCRIPTION = "nodeJS Evented I/O for V8 JavaScript" +HOMEPAGE = "http://nodejs.org" +LICENSE = "MIT & BSD & Artistic-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=14115ff11211df04b031ec7d40b6d31b" + +DEPENDS = "openssl" + +SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.gz \ + file://enable-armv5e-build.patch \ + file://no-registry.patch \ +" +SRC_URI[md5sum] = "5523ec4347d7fe6b0f6dda1d1c7799d5" +SRC_URI[sha256sum] = "b23d64df051c9c969b0c583f802d5d71de342e53067127a5061415be7e12f39d" + +S = "${WORKDIR}/node-v${PV}" + +# v8 errors out if you have set CCACHE +CCACHE = "" + +def map_nodejs_arch(a, d): + import re + + if re.match('p(pc|owerpc)(|64)', a): return 'ppc' + elif re.match('i.86$', a): return 'ia32' + elif re.match('x86_64$', a): return 'x64' + elif re.match('arm64$', a): return 'arm' + return a + +ARCHFLAGS_arm = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', '--with-arm-float-abi=hard', '--with-arm-float-abi=softfp', d)}" +GYP_DEFINES_append_mipsel = " mips_arch_variant='r1' " +ARCHFLAGS ?= "" + +# Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi +do_configure () { + export LD="${CXX}" + GYP_DEFINES="${GYP_DEFINES}" export GYP_DEFINES + # $TARGET_ARCH settings don't match --dest-cpu settings + ./configure --prefix=${prefix} --without-snapshot --shared-openssl \ + --dest-cpu="${@map_nodejs_arch(d.getVar('TARGET_ARCH', True), d)}" \ + --dest-os=linux \ + ${ARCHFLAGS} +} + +do_compile () { + export LD="${CXX}" + oe_runmake BUILDTYPE=Release +} + +do_install () { + oe_runmake install DESTDIR=${D} +} + +do_install_append_class-native() { + # use node from PATH instead of absolute path to sysroot + # node-v0.10.25/tools/install.py is using: + # shebang = os.path.join(node_prefix, 'bin/node') + # update_shebang(link_path, shebang) + # and node_prefix can be very long path to bindir in native sysroot and + # when it exceeds 128 character shebang limit it's stripped to incorrect path + # and npm fails to execute like in this case with 133 characters show in log.do_install: + # updating shebang of /home/jenkins/workspace/build-webos-nightly/device/qemux86/label/open-webos-builder/BUILD-qemux86/work/x86_64-linux/nodejs-native/0.10.15-r0/image/home/jenkins/workspace/build-webos-nightly/device/qemux86/label/open-webos-builder/BUILD-qemux86/sysroots/x86_64-linux/usr/bin/npm to /home/jenkins/workspace/build-webos-nightly/device/qemux86/label/open-webos-builder/BUILD-qemux86/sysroots/x86_64-linux/usr/bin/node + # /usr/bin/npm is symlink to /usr/lib/node_modules/npm/bin/npm-cli.js + # use sed on npm-cli.js because otherwise symlink is replaced with normal file and + # npm-cli.js continues to use old shebang + sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js +} + +do_install_append_class-target() { + sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js +} + +PACKAGES =+ "${PN}-npm" +FILES_${PN}-npm = "${exec_prefix}/lib/node_modules ${bindir}/npm" +RDEPENDS_${PN}-npm = "bash python-shell python-datetime python-subprocess python-textutils" + +PACKAGES =+ "${PN}-systemtap" +FILES_${PN}-systemtap = "${datadir}/systemtap" + + +BBCLASSEXTEND = "native" diff --git a/meta-tizen-micro/recipes-httpd/nginx/files/nginx-cross.patch b/meta-tizen-micro/recipes-httpd/nginx/files/nginx-cross.patch new file mode 100644 index 0000000..46792ba --- /dev/null +++ b/meta-tizen-micro/recipes-httpd/nginx/files/nginx-cross.patch @@ -0,0 +1,218 @@ +We do not have capability to run binaries when cross compiling + +Upstream-Status: Pending + + +diff -uraN nginx-1.0.11.orig/auto/feature nginx-1.0.11/auto/feature +--- nginx-1.0.11.orig/auto/feature 2011-05-11 06:50:19.000000000 -0500 ++++ nginx-1.0.11/auto/feature 2011-12-27 13:56:42.323370040 -0600 +@@ -48,12 +48,20 @@ + + if [ -x $NGX_AUTOTEST ]; then + ++ if [ ".$NGX_CROSS_COMPILE" = ".yes" ]; then ++ NGX_AUTOTEST_EXEC="true" ++ NGX_FOUND_MSG=" (not tested, cross compiling)" ++ else ++ NGX_AUTOTEST_EXEC="$NGX_AUTOTEST" ++ NGX_FOUND_MSG="" ++ fi ++ + case "$ngx_feature_run" in + + yes) + # /bin/sh is used to intercept "Killed" or "Abort trap" messages +- if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then +- echo " found" ++ if /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then ++ echo " found$NGX_FOUND_MSG" + ngx_found=yes + + if test -n "$ngx_feature_name"; then +@@ -67,17 +75,27 @@ + + value) + # /bin/sh is used to intercept "Killed" or "Abort trap" messages +- if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then +- echo " found" ++ if /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then ++ echo " found$NGX_FOUND_MSG" + ngx_found=yes + +- cat << END >> $NGX_AUTO_CONFIG_H ++ if [ ".$NGX_CROSS_COMPILE" = ".yes" ]; then ++ cat << END >> $NGX_AUTO_CONFIG_H + + #ifndef $ngx_feature_name +-#define $ngx_feature_name `$NGX_AUTOTEST` ++#define $ngx_feature_name $(eval "echo \$NGX_WITH_${ngx_feature_name}") + #endif + + END ++ else ++ cat << END >> $NGX_AUTO_CONFIG_H ++ ++#ifndef $ngx_feature_name ++#define $ngx_feature_name `$NGX_AUTOTEST_EXEC` ++#endif ++ ++END ++ fi + else + echo " found but is not working" + fi +@@ -85,7 +103,7 @@ + + bug) + # /bin/sh is used to intercept "Killed" or "Abort trap" messages +- if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then ++ if /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then + echo " not found" + + else +diff -uraN nginx-1.0.11.orig/auto/options nginx-1.0.11/auto/options +--- nginx-1.0.11.orig/auto/options 2011-12-14 07:34:16.000000000 -0600 ++++ nginx-1.0.11/auto/options 2011-12-27 13:56:42.323370040 -0600 +@@ -289,6 +289,18 @@ + --test-build-rtsig) NGX_TEST_BUILD_RTSIG=YES ;; + --test-build-solaris-sendfilev) NGX_TEST_BUILD_SOLARIS_SENDFILEV=YES ;; + ++ # cross compile support ++ --with-int=*) NGX_WITH_INT="$value" ;; ++ --with-long=*) NGX_WITH_LONG="$value" ;; ++ --with-long-long=*) NGX_WITH_LONG_LONG="$value" ;; ++ --with-ptr-size=*) NGX_WITH_PTR_SIZE="$value" ;; ++ --with-sig-atomic-t=*) NGX_WITH_SIG_ATOMIC_T="$value" ;; ++ --with-size-t=*) NGX_WITH_SIZE_T="$value" ;; ++ --with-off-t=*) NGX_WITH_OFF_T="$value" ;; ++ --with-time-t=*) NGX_WITH_TIME_T="$value" ;; ++ --with-sys-nerr=*) NGX_WITH_NGX_SYS_NERR="$value" ;; ++ --with-endian=*) NGX_WITH_ENDIAN="$value" ;; ++ + *) + echo "$0: error: invalid option \"$option\"" + exit 1 +@@ -434,6 +446,17 @@ + + --with-debug enable debug logging + ++ --with-int=VALUE force int size ++ --with-long=VALUE force long size ++ --with-long-long=VALUE force long long size ++ --with-ptr-size=VALUE force pointer size ++ --with-sig-atomic-t=VALUE force sig_atomic_t size ++ --with-size-t=VALUE force size_t size ++ --with-off-t=VALUE force off_t size ++ --with-time-t=VALUE force time_t size ++ --with-sys-nerr=VALUE force sys_nerr value ++ --with-endian=VALUE force system endianess ++ + END + + exit 1 +@@ -455,6 +478,8 @@ + + if [ ".$NGX_PLATFORM" = ".win32" ]; then + NGX_WINE=$WINE ++elif [ ! -z "$NGX_PLATFORM" ]; then ++ NGX_CROSS_COMPILE="yes" + fi + + +diff -uraN nginx-1.0.11.orig/auto/types/sizeof nginx-1.0.11/auto/types/sizeof +--- nginx-1.0.11.orig/auto/types/sizeof 2006-06-28 11:00:26.000000000 -0500 ++++ nginx-1.0.11/auto/types/sizeof 2011-12-27 13:56:42.323370040 -0600 +@@ -12,9 +12,12 @@ + + END + +-ngx_size= ++ngx_size=$(eval "echo \$NGX_WITH_${ngx_param}") + +-cat << END > $NGX_AUTOTEST.c ++if [ ".$ngx_size" != "." ]; then ++ echo " $ngx_size bytes" ++else ++ cat << END > $NGX_AUTOTEST.c + + #include + #include +@@ -33,20 +36,20 @@ + END + + +-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \ +- -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs" ++ ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \ ++ -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs" + +-eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1" ++ eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1" + + +-if [ -x $NGX_AUTOTEST ]; then +- ngx_size=`$NGX_AUTOTEST` +- echo " $ngx_size bytes" +-fi ++ if [ -x $NGX_AUTOTEST ]; then ++ ngx_size=`$NGX_AUTOTEST` ++ echo " $ngx_size bytes" ++ fi + + +-rm -rf $NGX_AUTOTEST* +- ++ rm -rf $NGX_AUTOTEST* ++fi + + case $ngx_size in + 4) +diff -uraN nginx-1.0.11.orig/auto/unix nginx-1.0.11/auto/unix +--- nginx-1.0.11.orig/auto/unix 2011-12-14 07:34:16.000000000 -0600 ++++ nginx-1.0.11/auto/unix 2011-12-27 13:56:42.327370060 -0600 +@@ -393,13 +393,13 @@ + + # C types + +-ngx_type="int"; . auto/types/sizeof ++ngx_type="int"; ngx_param="INT"; . auto/types/sizeof + +-ngx_type="long"; . auto/types/sizeof ++ngx_type="long"; ngx_param="LONG"; . auto/types/sizeof + +-ngx_type="long long"; . auto/types/sizeof ++ngx_type="long long"; ngx_param="LONG_LONG"; . auto/types/sizeof + +-ngx_type="void *"; . auto/types/sizeof; ngx_ptr_size=$ngx_size ++ngx_type="void *"; ngx_param="PTR_SIZE"; . auto/types/sizeof; ngx_ptr_size=$ngx_size + ngx_param=NGX_PTR_SIZE; ngx_value=$ngx_size; . auto/types/value + + +@@ -416,7 +416,7 @@ + + ngx_type="uint64_t"; ngx_types="u_int64_t"; . auto/types/typedef + +-ngx_type="sig_atomic_t"; ngx_types="int"; . auto/types/typedef ++ngx_type="sig_atomic_t"; ngx_param="SIG_ATOMIC_T"; ngx_types="int"; . auto/types/typedef + . auto/types/sizeof + ngx_param=NGX_SIG_ATOMIC_T_SIZE; ngx_value=$ngx_size; . auto/types/value + +@@ -432,15 +432,15 @@ + + . auto/endianess + +-ngx_type="size_t"; . auto/types/sizeof ++ngx_type="size_t"; ngx_param="SIZE_T"; . auto/types/sizeof + ngx_param=NGX_MAX_SIZE_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value + ngx_param=NGX_SIZE_T_LEN; ngx_value=$ngx_max_len; . auto/types/value + +-ngx_type="off_t"; . auto/types/sizeof ++ngx_type="off_t"; ngx_param="OFF_T"; . auto/types/sizeof + ngx_param=NGX_MAX_OFF_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value + ngx_param=NGX_OFF_T_LEN; ngx_value=$ngx_max_len; . auto/types/value + +-ngx_type="time_t"; . auto/types/sizeof ++ngx_type="time_t"; ngx_param="TIME_T"; . auto/types/sizeof + ngx_param=NGX_TIME_T_SIZE; ngx_value=$ngx_size; . auto/types/value + ngx_param=NGX_TIME_T_LEN; ngx_value=$ngx_max_len; . auto/types/value + diff --git a/meta-tizen-micro/recipes-httpd/nginx/files/nginx-volatile.conf b/meta-tizen-micro/recipes-httpd/nginx/files/nginx-volatile.conf new file mode 100644 index 0000000..93f3c66 --- /dev/null +++ b/meta-tizen-micro/recipes-httpd/nginx/files/nginx-volatile.conf @@ -0,0 +1,2 @@ +d www www-data 0755 /run/nginx none +d root root 0755 /var/log/nginx none diff --git a/meta-tizen-micro/recipes-httpd/nginx/files/nginx.conf b/meta-tizen-micro/recipes-httpd/nginx/files/nginx.conf new file mode 100644 index 0000000..fb7e4b6 --- /dev/null +++ b/meta-tizen-micro/recipes-httpd/nginx/files/nginx.conf @@ -0,0 +1,118 @@ + +user www-data; +worker_processes 1; + +error_log /var/log/nginx/error.log; +#error_log logs/error.log notice; +#error_log logs/error.log info; + +pid /run/nginx/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + #keepalive_timeout 0; + keepalive_timeout 65; + + #gzip on; + + server { + listen 80; + server_name localhost; + + #charset koi8-r; + + #access_log logs/host.access.log main; + + location / { + root /var/www/localhost/html; + index index.html index.htm; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /var/www/localhost/html; + } + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # + #location ~ \.php$ { + # proxy_pass http://127.0.0.1; + #} + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + #location ~ \.php$ { + # root html; + # fastcgi_pass 127.0.0.1:9000; + # fastcgi_index index.php; + # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; + # include fastcgi_params; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} + } + + + # another virtual host using mix of IP-, name-, and port-based configuration + # + #server { + # listen 8000; + # listen somename:8080; + # server_name somename alias another.alias; + + # location / { + # root html; + # index index.html index.htm; + # } + #} + + + # HTTPS server + # + #server { + # listen 443; + # server_name localhost; + + # ssl on; + # ssl_certificate cert.pem; + # ssl_certificate_key cert.key; + + # ssl_session_timeout 5m; + + # ssl_protocols SSLv2 SSLv3 TLSv1; + # ssl_ciphers HIGH:!aNULL:!MD5; + # ssl_prefer_server_ciphers on; + + # location / { + # root html; + # index index.html index.htm; + # } + #} + +} diff --git a/meta-tizen-micro/recipes-httpd/nginx/files/nginx.init b/meta-tizen-micro/recipes-httpd/nginx/files/nginx.init new file mode 100644 index 0000000..0f38b9c --- /dev/null +++ b/meta-tizen-micro/recipes-httpd/nginx/files/nginx.init @@ -0,0 +1,52 @@ +#! /bin/sh +PATH=/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/sbin/nginx +NAME=nginx +DESC=nginx +PID=/var/run/nginx/nginx.pid + +test -x $DAEMON || exit 0 + +# Include nginx defaults if available +if [ -f /etc/default/nginx ] ; then + . /etc/default/nginx +fi + +set -e + +case "$1" in + start) + echo -n "Starting $DESC: " + start-stop-daemon --start --quiet --pidfile $PID \ + --name $NAME --exec $DAEMON -- $DAEMON_OPTS + echo "$NAME." + ;; + stop) + echo -n "Stopping $DESC: " + start-stop-daemon -K --quiet --pidfile $PID \ + --name $NAME + echo "$NAME." + ;; + restart|force-reload) + echo -n "Restarting $DESC: " + start-stop-daemon -K --quiet --pidfile $PID \ + --name $NAME + sleep 1 + start-stop-daemon --start --quiet --pidfile $PID \ + --name $NAME --exec $DAEMON -- $DAEMON_OPTS + echo "$NAME." + ;; + reload) + echo -n "Reloading $DESC configuration: " + start-stop-daemon --stop --signal HUP --quiet --pidfile $PID \ + --exec $DAEMON + echo "$NAME." + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/meta-tizen-micro/recipes-httpd/nginx/files/nginx.service b/meta-tizen-micro/recipes-httpd/nginx/files/nginx.service new file mode 100644 index 0000000..705450e --- /dev/null +++ b/meta-tizen-micro/recipes-httpd/nginx/files/nginx.service @@ -0,0 +1,12 @@ +[Unit] +Description=Nginx Server +After=network.target +[Service] +Type=forking +PIDFile=@SYSCONFDIR@/nginx/run/nginx.pid +ExecStartPre=mkdir -p @LOCALSTATEDIR@/log/nginx +ExecStart=@SYSCONFDIR@/init.d/nginx start +ExecStop=@SYSCONFDIR@/init.d/nginx stop +[Install] +WantedBy=multi-user.target + diff --git a/meta-tizen-micro/recipes-httpd/nginx/nginx_1.9.5.bb b/meta-tizen-micro/recipes-httpd/nginx/nginx_1.9.5.bb new file mode 100644 index 0000000..a251523 --- /dev/null +++ b/meta-tizen-micro/recipes-httpd/nginx/nginx_1.9.5.bb @@ -0,0 +1,131 @@ +SUMMARY = "HTTP and reverse proxy server" + +DESCRIPTION = "Nginx is a web server and a reverse proxy server for \ +HTTP, SMTP, POP3 and IMAP protocols, with a strong focus on high \ +concurrency, performance and low memory usage." + +HOMEPAGE = "http://nginx.org/" +LICENSE = "BSD-2-Clause" +LIC_FILES_CHKSUM = "file://LICENSE;md5=3845852aedfa8d6d7765f55d06cc3ebd" +SECTION = "net" + +DEPENDS = "libpcre gzip openssl" + +SRC_URI = " \ + http://nginx.org/download/nginx-${PV}.tar.gz \ + file://nginx-cross.patch \ + file://nginx.conf \ + file://nginx.init \ + file://nginx-volatile.conf \ + file://nginx.service \ +" +SRC_URI[md5sum] = "2562320f1535e3e31d165e337ae94f21" +SRC_URI[sha256sum] = "48e2787a6b245277e37cb7c5a31b1549a0bbacf288aa4731baacf9eaacdb481b" + +inherit update-rc.d useradd + +CFLAGS_append = " -fPIE -pie" +CXXFLAGS_append = " -fPIE -pie" + +do_configure () { + if [ "${SITEINFO_BITS}" = "64" ]; then + PTRSIZE=8 + else + PTRSIZE=4 + fi + + echo $CFLAGS + echo $LDFLAGS + + ./configure \ + --crossbuild=Linux:${TUNE_ARCH} \ + --with-endian=${@base_conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \ + --with-int=4 \ + --with-long=${PTRSIZE} \ + --with-long-long=8 \ + --with-ptr-size=${PTRSIZE} \ + --with-sig-atomic-t=${PTRSIZE} \ + --with-size-t=${PTRSIZE} \ + --with-off-t=${PTRSIZE} \ + --with-time-t=${PTRSIZE} \ + --with-sys-nerr=132 \ + --conf-path=${sysconfdir}/nginx/nginx.conf \ + --http-log-path=${localstatedir}/log/nginx/access.log \ + --error-log-path=${localstatedir}/log/nginx/error.log \ + --pid-path=/run/nginx/nginx.pid \ + --prefix=${prefix} \ + --with-http_ssl_module \ + --with-http_gzip_static_module +} + +do_install () { + oe_runmake 'DESTDIR=${D}' install + rm -fr ${D}${localstatedir}/run ${D}/run + if ${@base_contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/tmpfiles.d + echo "d /run/${BPN} - - - -" \ + > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf + fi + install -d ${D}${sysconfdir}/${BPN} + ln -snf ${localstatedir}/run/${BPN} ${D}${sysconfdir}/${BPN}/run + install -d ${D}${localstatedir}/www/localhost + mv ${D}/usr/html ${D}${localstatedir}/www/localhost/ + chown www:www-data -R ${D}${localstatedir} + + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/nginx.init ${D}${sysconfdir}/init.d/nginx + sed -i 's,/usr/sbin/,${sbindir}/,g' ${D}${sysconfdir}/init.d/nginx + sed -i 's,/etc/,${sysconfdir}/,g' ${D}${sysconfdir}/init.d/nginx + + install -d ${D}${sysconfdir}/nginx + install -m 0644 ${WORKDIR}/nginx.conf ${D}${sysconfdir}/nginx/nginx.conf + sed -i 's,/var/,${localstatedir}/,g' ${D}${sysconfdir}/nginx/nginx.conf + install -d ${D}${sysconfdir}/nginx/sites-enabled + + install -d ${D}${sysconfdir}/default/volatiles + install -m 0644 ${WORKDIR}/nginx-volatile.conf ${D}${sysconfdir}/default/volatiles/99_nginx + sed -i 's,/var/,${localstatedir}/,g' ${D}${sysconfdir}/default/volatiles/99_nginx + + if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/nginx.service ${D}${systemd_unitdir}/system/ + sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \ + -e 's,@LOCALSTATEDIR@,${localstatedir},g' \ + ${D}${systemd_unitdir}/system/nginx.service + fi +} + +pkg_postinst_${PN} () { + if [ -z "$D" ]; then + if type systemd-tmpfiles >/dev/null; then + systemd-tmpfiles --create + elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then + ${sysconfdir}/init.d/populate-volatile.sh update + fi + fi +} + +FILES_${PN} += "${localstatedir}/ \ + ${systemd_unitdir}/system/nginx.service \ + " + +CONFFILES_${PN} = "${sysconfdir}/nginx/nginx.conf \ + ${sysconfdir}/nginx/fastcgi.conf\ + ${sysconfdir}/nginx/fastcgi_params \ + ${sysconfdir}/nginx/koi-utf \ + ${sysconfdir}/nginx/koi-win \ + ${sysconfdir}/nginx/mime.types \ + ${sysconfdir}/nginx/scgi_params \ + ${sysconfdir}/nginx/uwsgi_params \ + ${sysconfdir}/nginx/win-utf \ +" + +INITSCRIPT_NAME = "nginx" +INITSCRIPT_PARAMS = "defaults 92 20" + +USERADD_PACKAGES = "${PN}" +USERADD_PARAM_${PN} = " \ + --system --no-create-home \ + --home ${localstatedir}/www/localhost \ + --groups www-data \ + --user-group www" diff --git a/meta-tizen-micro/recipes-image/raspberrypi2/rpi-hwup-image-tizen-micro.bb b/meta-tizen-micro/recipes-image/raspberrypi2/rpi-hwup-image-tizen-micro.bb new file mode 100755 index 0000000..6f130aa --- /dev/null +++ b/meta-tizen-micro/recipes-image/raspberrypi2/rpi-hwup-image-tizen-micro.bb @@ -0,0 +1,30 @@ +# Base this image on rpi-hwup-image +include recipes-core/images/rpi-hwup-image.bb + +CORE_IMAGE_EXTRA_INSTALL += "nodejs" +CORE_IMAGE_EXTRA_INSTALL += "nodejs-npm" +CORE_IMAGE_EXTRA_INSTALL += "nginx" +CORE_IMAGE_EXTRA_INSTALL += "wpa-supplicant" +CORE_IMAGE_EXTRA_INSTALL += "openssh openssh-sftp-server" +CORE_IMAGE_EXTRA_INSTALL += "systemd-serialgetty util-linux-agetty procps" +CORE_IMAGE_EXTRA_INSTALL += "userland" + +# Set root password to "root" +ROOTFS_POSTPROCESS_COMMAND += "set_root_passwd;" +set_root_passwd() { + sed 's%^root:[^:]*:%root:wYNffsf6sozwE:%' \ + < ${IMAGE_ROOTFS}/etc/shadow \ + > ${IMAGE_ROOTFS}/etc/shadow.new; + mv ${IMAGE_ROOTFS}/etc/shadow.new ${IMAGE_ROOTFS}/etc/shadow ; +} + +def get_kernelversion_file(p): + fn = p + '/kernel-abiversion' + + try: + with open(fn, 'r') as f: + return f.readlines()[0].strip() + except IOError: + return None + +STAGING_KERNEL_BUILDDIR = "${TMPDIR}/work-shared/${MACHINE}/kernel-build-artifacts"