Reading file would overwrite reserved memory. Failed to load 'hello_world.bin - embedded

I have imx7d-pico with Carrier board. This tiny computer
was used a lot for Android Things. PDF (datasheet) easily
found.
I stay (during the last two weeks) trying this tutorial:
https://github.com/TechNexion/freertos-tn/tree/freertos_1.0.1_imx7d
export ARMGCC_DIR=${HOME}/gcc-arm-none-eabi-4_9-2015q3/
after ./build_release.sh I do
sudo cp ${HOME}/freertos-tn/examples/imx7d_pico_m4/demo_apps/hello_world/armgcc/release/hello_world.bin
/media/neuberfran/boot
ls mmc 0:1 (result command in U-boot)
10572 hello_world.bin
then:
=> fatload mmc 0:1 0x7F8000 hello_world.bin (with issue)
** Reading file would overwrite reserved memory **
Failed to load 'hello_world.bin
=> dcache flush (I can't)
=> bootaux 0x7F8000 (I can't)
I'm correctly generating my image Yocto-hardknott-technexion with this:
$ mkdir tn-imx-yocto
$ cd tn-imx-yocto
$ repo init -u https://github.com/TechNexion/tn-imx-yocto-manifest.git -b hardknott_5.10.y-next -m imx-5.10.52-2.1.0.xml
$ repo sync -j8
$ DISTRO=fsl-imx-x11 MACHINE=pico-imx7 BASEBOARD=pi source tn-setup-release.sh -b build-x11-pico-imx7
$ bitbake core-image-base
imx7d-pico-pi-qca-m4.dts
#include "imx7d-pico-pi-qca.dts"
/ {
memory {
linux,usable-memory = <0x80000000 0x1ff00000>;
};
m4_tcm: tcml#007f8000 {
compatible = "fsl, m4_tcml";
reg = <0x007f8000 0x8000>;
};
gpio-leds {
status = "disabled";
};
};
&adc1 {
status = "disabled";
};
&adc2 {
status = "disabled";
};
&gpt3 {
status = "disabled";
};
&gpt4 {
status = "disabled";
};
&ocram {
reg = <0x00901000 0xf000>;
};
&rpmsg{
vdev-nums = <1>;
reg = <0x9fff0000 0x10000>;
status = "okay";
};
&uart6 {
status = "disabled";
};
&wdog3{
status = "disabled";
pico-imx7.conf
##TYPE: Machine
##NAME: pico-imx7
##SOC: i.MX7/Solo/Dual/UtraLowPower
##DESCRIPTION: Machine configuration for PICO-IMX7 with QCA(Qualcomm)/BRCM(Broadcom) WLAN module
##MAINTAINER: Po Cheng <po.cheng#technexion.com>
MACHINEOVERRIDES =. "mx7:mx7d:"
MACHINEOVERRIDES_EXTENDER_pico-imx7 = "uenv"
include conf/machine/include/imx-base.inc
include conf/machine/include/tune-cortexa7.inc
require conf/machine/tn-base.inc
#
# Kernel Device Trees
#
PREFERRED_PROVIDER_virtual/kernel ?= "linux-tn-imx"
PREFERRED_PROVIDER_virtual/kernel_mx7 = "linux-tn-imx"
KERNEL_DEVICETREE = "imx7d-pico-pi-qca.dtb"
# imx7d-pico-pi-m4.dtb \
#"
KERNEL_DEVICETREE_append = " imx7d-pico-pi-m4.dtb"
# imx7d-pico-pi.dtb \
# imx7d-pico-pi-c2-qca.dtb imx7d-pico-pi-c2.dtb \
# imx7d-pico-nymph-qca.dtb imx7d-pico-nymph.dtb \
# imx7d-pico-dwarf-qca.dtb imx7d-pico-dwarf.dtb \
# imx7d-pico-hobbit-qca.dtb imx7d-pico-hobbit.dtb \
#"
# Setup the additional devicetree file
#KERNEL_DEVICETREE_append_voicehat = " imx7d-pico-pi-qca-voicehat.dtb \
# imx7d-pico-pi-voicehat.dtb \
# imx7d-pico-pi-c2-qca-voicehat.dtb \
# imx7d-pico-pi-c2-voicehat.dtb "
# Bootloader Specifics
UBOOT_MACHINE = "pico-imx7d_spl_defconfig"
#M4_MACHINE = "pico-imx7d-pi"
#IMAGE_BOOTFILES_DEPENDS += "imx-m4-demos-tn:do_deploy"
#IMAGE_BOOTFILES += "hello_world.bin rpmsg_lite_pingpong_rtos_linux_remote.bin rpmsg_lite_str_echo_rtos_imxcm4.bin"
In U-boot printenv command currently I have nothing about m4 and tcm
printenv
arch=arm
baseboard=pi
baudrate=115200
board=pico-imx7d
board_name=pico-imx7d
boot_fdt=try
bootcmd=mmc dev ${mmcdev}; if mmc rescan; then if run loadbootenv; then echo Loaded environment from ${bootenv};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;if run loadbootscript; then run bootscript; fi; if run loadfit; then run fitboot; fi; if run loadimage; then run mmcboot; else echo WARN: Cannot load kernel from boot media; fi; else run netboot; fi
bootdelay=2
bootenv=uEnv.txt
bootscript=echo Running bootscript from mmc ...; source
console=ttymxc4
cpu=armv7
default_baseboard=pi
fastboot_dev=mmc0
fbcmd=fastboot 0
fdt_addr=0x83000000
fdt_file=imx7d-pico-pi-qca-m4.dtb
fdt_high=0xffffffff
fdtcontroladdr=9cd62ed0
fit_addr=0x87880000
fit_high=0xffffffff
fit_overlay=for ov in ${dtoverlay}; do echo Overlaying ${ov}...; setenv fitov "${fitov}#${ov}"; done; echo fit conf: ${fdtfile}${fitov};
fitargs=setenv bootargs console=${console},${baudrate} root=/dev/ram0 rootwait rw modules-load=g_acm_ms g_acm_ms.stall=0 g_acm_ms.removable=1 g_acm_ms.file=${mmcrootdev} g_acm_ms.iSerialNumber=00:00:00:00:00:00 g_acm_ms.iManufacturer=TechNexion
fitboot=echo Booting from FIT image...; run searchbootdev; run setfdt; run fit_overlay; run fitargs; bootm ${fit_addr}#conf#${fdtfile}${fitov};
fitov=""
form=pico
image=zImage
importbootenv=echo Importing environment from mmc ...; env import -t -r $loadaddr $filesize
initrd_high=0xffffffff
ip_dyn=yes
loadaddr=0x80800000
loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdtfile}
loadfit=fatload mmc ${mmcdev}:${mmcpart} ${fit_addr} tnrescue.itb
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot}
mmcautodetect=yes
mmcboot=echo Booting from mmc ...; run m4boot; run searchbootdev; run mmcargs; echo baseboard is ${baseboard}; run setfdt; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then echo WARN: Cannot load the DT; echo fall back to load the default DT; setenv baseboard ${default_baseboard}; run setfdt; run loadfdt; bootz ${loadaddr} - ${fdt_addr}; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
mmcdev=0
mmcpart=1
netargs=setenv bootargs console=${console},${baudrate} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
netboot=echo Booting from net ...; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; run loadbootenv; run importbootenv; run setfdt; run netargs; ${get_cmd} ${loadaddr} ${image}; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if ${get_cmd} ${fdt_addr} ${fdtfile}; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
script=boot.scr
searchbootdev=if test ${bootdev} = SD0; then setenv mmcrootdev /dev/mmcblk2; setenv mmcroot /dev/mmcblk2p2 rootwait rw; else setenv mmcrootdev /dev/mmcblk0; setenv mmcroot /dev/mmcblk0p2 rootwait rw; fi
serial#=0091ceb8deadbeef
setfdt=if test -n ${wifi_module} && test ${wifi_module} = qca; then setenv fdtfile ${som}-${form}-${baseboard}-${wifi_module}${mcu}.dtb; else setenv fdtfile ${som}-${form}-${baseboard}${mcu}.dtb;fi
soc=mx7
soc_type=imx7d
som=imx7d
splashimage=0x8c000000
splashpos=m,m
splashsource=mmc_fs
stdout=serial
update_m4_from_sd=if sf probe 0:0; then if run loadm4image; then setexpr fw_sz ${filesize} + 0xffff; setexpr fw_sz ${fw_sz} / 0x10000; setexpr fw_sz ${fw_sz} * 0x10000; sf erase 0x0 ${fw_sz}; sf write ${loadaddr} 0x0 ${filesize}; fi; fi
vendor=technexion
wifi_module=qca
Environment size: 3808/8188 bytes
How can I solve this? (pls)

I solved with two changes in device-tree files:
in imx7d.dtsi
I put status = "okay";
in rpmsg: rpmsg{
in imx7d-pico-pi-qca-m4.dts
I put:
reserved-memory {
rpmsg_vrings: vrings0#0x8ff00000 {
reg = <0x8fff0000 0x10000>;
no-map;
};
};
&
&rpmsg{
memory-region = <&rpmsg_vrings>;
vdev-nums = <1>;
reg = <0x9fff0000 0x10000>;
status = "okay";
};

Related

Ctrl-j is always changed to Ctrl-m in session started by aws session manager

I used to use ssh to connect remote sever, but recently I started trying AWS session manager. Previously after remote server is connected, I would use tmux for my daily work, and with tmux I prefer Ctrl-j as prefix, this works just fine with ssh connection, but ever since I started with AWS session manager, I found Ctrl-j binding does not work as expected, then I found below key stroke printing.
with ssh connection started by ssh <hostname>
$ showkey -a
Press any keys - Ctrl-D will terminate this program
^J 10 0012 0x0a
^M 13 0015 0x0d
with AWS session manager session started by aws ssm start-session --target <instance_id>
$ showkey -a
Press any keys - Ctrl-D will terminate this program
^M 13 0015 0x0d # I actually stroke Ctrl-j here
^M 13 0015 0x0d
Both connections were made from the same terminal window, so I guess there should be nothing to do with my terminal configuration, does anyone happen to know what's going on? And how could I manage to use Ctrl-j as tmux prefix in AWS session?
BTW, if it will help, here are the stty settings both locally and on remote server
###### Locally
$ stty -a
speed 38400 baud; 54 rows; 213 columns;
lflags: icanon isig iexten echo echoe echok echoke -echonl echoctl
-echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
-extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel iutf8
-ignbrk brkint -inpck -ignpar -parmrk
oflags: opost onlcr -oxtabs -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
-dtrflow -mdmbuf
cchars: discard = ^O; dsusp = <undef>; eof = ^D; eol = <undef>;
eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
stop = ^S; susp = ^Z; time = 0; werase = ^W;
#### ssh connection server
$ stty -a
speed 38400 baud; rows 54; columns 213; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
#### AWS session connection server
$ stty -a
speed 38400 baud; rows 54; columns 213; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

How to automate synchronizing Windows 10 guest's time with the Linux host?

On Arch Linux I have a Windows 10 Guest on top of libvirt, kvm and virsh (still having some trouble to connect all these dots mentally together). Every time I suspend the laptop and a day is gone the Windows 10 host goes out of sync. I learned that with the following command I can force a time sync in the host:
➜ ~ virsh qemu-agent-command win10 '{"execute":"guest-set-time"}'
{"return":{}}
In order to make this work I modifed the clock XML block and added a kvm clock entry. This is how the block looks like now:
<clock offset="localtime">
<timer name="tsc" tickpolicy="delay"/>
<timer name="kvmclock"/>
<timer name="rtc" tickpolicy="delay" track="wall"/>
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="yes"/>
</clock>
I would like to know whether I can automate this step or trigger an update everytime I wake up the machine or log-in.
Thanks in advance
I was not able to get anywhere specifically using virsh. Here is how I fixed this issue in a Windows 11 guest on MacOS in UTM 3.6.4 and 4.1.5.
At first I tried many workarounds using w32tm - but this was always flaky.
This helped slightly:
disable "use local time for base clock" (otherwise you can't add a manual -rtc argument if using UTM)
add -rtc base=localtime,driftfix=slew
This wasn't great, because it won't recover a significant delta.
This is the solution I settled on (run in the Windows guest). It creates a scheduled task that runs every 5 minutes, gets the time from NTP, converts it to local time, measures the drift, and if the drift is >30 seconds in either direction it updates the system clock.
function Get-NtpTime
{
[OutputType([datetime])]
[CmdletBinding()]
param
(
[string]$Server = "time.nist.gov",
[int]$Port = 13
)
if (-not $PSBoundParameters.ContainsKey('ErrorAction'))
{
$ErrorActionPreference = 'Stop'
}
$Client = [Net.Sockets.TcpClient]::new($Server, $Port)
$Reader = [IO.StreamReader]::new($Client.GetStream())
try
{
$Response = $Reader.ReadToEnd()
$UtcString = $Response.Substring(7, 17)
$LocalTime = [datetime]::ParseExact(
$UtcString,
"yy-MM-dd HH:mm:ss",
[cultureinfo]::InvariantCulture,
[Globalization.DateTimeStyles]::AssumeUniversal
)
}
finally
{
$Reader.Dispose()
$Client.Dispose()
}
$LocalTime
}
function Register-TimeSync
{
[CmdletBinding()]
param
(
[Parameter()]
[timespan]$RepetitionInterval = (New-TimeSpan -Minutes 5),
[Parameter()]
[timespan]$ExecutionTimeLimit = (New-TimeSpan -Minutes 3)
)
$Invocation = {
$NtpTime = Get-NtpTime
$Delta = [datetime]::Now - $NtpTime
if ([Math]::Abs($Delta.TotalSeconds) -gt 30)
{
Set-Date $NtpTime
}
}
$PSName = if ($PSVersionTable.PSVersion.Major -le 5) {'powershell'} else {'pwsh'}
$Path = (Get-Command $PSName).Source
$Command = Get-Command Get-NtpTime
$Definition = "function Get-NtpTime`n{$($Command.Definition)}"
$Invocation = $Definition, $Invocation -join "`n"
$Bytes = [Text.Encoding]::Unicode.GetBytes($Invocation)
$Encoded = [Convert]::ToBase64String($Bytes)
$TriggerParams = #{
Once = $true
At = [datetime]::Today
RepetitionInterval = $RepetitionInterval
}
$Trigger = New-ScheduledTaskTrigger #TriggerParams
$Action = New-ScheduledTaskAction -Execute $Path -Argument "-NoProfile -EncodedCommand $Encoded"
$Settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit $ExecutionTimeLimit -MultipleInstances IgnoreNew
$Principal = New-ScheduledTaskPrincipal -UserID "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount -RunLevel Highest
$RegisterParams = #{
TaskName = "Update system time from NTP"
Trigger = $Trigger
Action = $Action
Settings = $Settings
Principal = $Principal
Force = $true
}
Register-ScheduledTask #RegisterParams
}
Usage (run as admin):
Register-TimeSync

How to fix integration issue Magento store with POS system after site migration?

We migrated our Magento site (Magento 1.8.1.0) from old server to a new server.
But, we can't use the Winepos integration extension any more.
Our site is connected with Winepos system, and this Magento extension had been operated before migrating work.
This is Winepos API manual.
At this time, we think some PHP modules were not installed on our new server.
But, we don't know which PHP modules were not installed. It seems all PHP modules were installed on our new server.
The Magento extension to integrate with Winepos are as follow. This extension is consisted with two files.
Config.xml
<config>
<global>
<events>
<checkout_onepage_controller_success_action>
<observers>
<igor_winepos_order_success_observer>
<type>singleton</type>
<class>igor_Winepos_Model_Wineposobserver</class>
<method>checkoutSuccessObserve</method>
</igor_winepos_order_success_observer>
</observers>
</checkout_onepage_controller_success_action>
</events>
</global>
</config>
wineposobserver.php
class igor_Winepos_Model_Wineposobserver extends Varien_Event_Observer {
function customlog($obj) {
ob_start();
var_dump($obj);
$out1 = ob_get_contents();
ob_end_clean();
$f = fopen('/tmp/log.txt', 'ab');
fwrite($f, $out1);
fclose($f);
}
public function __construct() {
}
public function checkoutSuccessObserve($observer) {
// $event = $observer->getEvent();
$order_ids = $observer->getData('order_ids');
if(gettype($order_ids) == 'array' && count($order_ids) == 1) {
$the_order = Mage::getModel('sales/order')->load($order_ids[0]);
Mage::helper('globalfunc')->registerOrderWithWinePOSAsynchronousWithTimeout($the_order);
}
}
}
I am getting the following in the Apache log:
PHP Warning: PHP Startup: apc.shm_segments setting ignored in MMAP mode in Unknown on line 0 [Sun Apr 30 06:32:30 2017] [notice] Apache/2.2.22 (Ubuntu) mod_ssl/2.2.22 OpenSSL/1.0.1 configured -- resuming normal operations
285: function registerOrderWithWinePOSAsynchronousWithTimeout($the_order) {
286 try {
287 $items = $the_order->getAllItems();
...
426 $ordered_raw_item = $ordered_products_raw_items[$ordered_product_id];
428: $product_winepos_id = trim(strval($product->getResource()->getAttribute('winepos_id')->getFrontend()->getValue($product)));
429
430 $item_element = $doc->createElement('item');
432 $item_num_element = $doc->createElement('item-num');
433: $item_num_element->appendChild($doc->createTextNode(strval($product_winepos_id)));
434 $item_element->appendChild($item_num_element);
...
466 $the_xml = $doc->saveXML();
468: // $post_result = Mage::helper('globalfunc')->post_to_api_winepos('https://wines-in-november.vznlink.com/orders', $the_xml, 'admin276975', '8dc670fb943dc2c0a1415405cdf00e3ec579c4e6', 8, 10);
470: return Mage::helper('globalfunc')->delayed_post_to_winepos($the_xml);
471 } catch(Exception $e) {
472 $this->customlog($e);
...
475 }
I created a new module to integrate with POS system and implemented inventory synchronization successfully.
This work should be done by cron job. To do it, I created three individual script files.
Also, POS provider should provide ordered product information including inventory information as txt file via ftp in every time interval.
lftp -u [username],[password] -e'set ftp:passive-mode false; cd files; put data.txt; quit' [folder name]
The cron job operating blocks are as follow.
cron_file_mover.php
$start = microtime(true);
shell_exec('cp /home/files/data.txt /var/www/vhosts/magento/');
shell_exec('chown -R www-data:www-data /var/www/vhosts/magento/');
$end = microtime(true);
echo 'Run time: '.round($end-$start, 4).'s';
cron_pos_post_script.php
Utils::initMagento(); $MAX_RETRIES = 5;
$delayed_jobs = Utils::mageGetRows("select * from delayed_jobs where job_type = 'pos_order' and status = 'todo' order by created_at DESC");
$current_index = 0;
foreach($delayed_jobs as $delayed_job) {
$current_index += 1;
$retry_count = intval($delayed_job['retry_count']);
$retry_count += 1;
$post_result = Mage::helper('globalfunc')->post_to_api_pos('https://vznlink.com/orders', $delayed_job['job_details'], 'admin', 'fd93d2de58ab', 8, 10);
Utils::mageSqlExecute("update delayed_jobs set status = 'done' where id = " . $delayed_job['id']);
Utils::mageSqlExecute("update delayed_jobs set status = '" . $new_status . "', retry_count = " . $retry_count . " where id = " . $delayed_job['id']);
}
cron_pos_update_script.php
$PATH_TO_FILE = '/var/www/vhosts/magento/data.txt';
function read_pos_file($path_to_file) {
$min_count_required_for_product = 12;
$f = fopen($path_to_file, 'rb');
$text = trim(fread($f, 100000000));
fclose($f);
$lines = preg_split('/\r\n|\r|\n/i', $text);
$products = array();
foreach($lines as $line) {
$product = preg_split('/\t/i', trim($line));
if(count($product) >= $min_count_required_for_product) {
$product[0] = strval(trim($product[0]));
$product[1] = strval(trim($product[1]));
$product[2] = strval(trim($product[2]));
$product[11] = intval(strval(trim($product[11])));
$products []= $product;
}
}
return $products;
}
function update_stock_for_stock_item($product_id, $new_stock) {
$stock_item = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product_id);
$stock_item->setData('qty', $new_stock);
if($new_stock > 0) {
$stock_item->setData('is_in_stock', 1);
}
$stock_item->save();
}
$products = read_pos_file($PATH_TO_FILE);
$total_count = 0; $processed_count = 0;
foreach($products as $product) {
$total_count += 1;
$item_number = $product[0];
$new_stock = $product[11];
if($new_stock < 0) {
$new_stock = 0;
}
$products_matching_item_number = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('pos_id')->addFieldToFilter('pos_id', $item_number)->getItems();
if(count($products_matching_item_number) == 1) {
$products_matching_item_number = array_values($products_matching_item_number);
$matching_product = $products_matching_item_number[0];
$matching_product_id = $matching_product->getId();
update_stock_for_stock_item($matching_product_id, $new_stock);
$processed_count += 1;
}
}
The cron job settings are as follows.
10 * * * * /usr/bin/php /var/www/vhosts/magento/pos/cron_winepos_post_script.php &> /dev/null
10 * * * * /usr/bin/php /var/www/vhosts/magento/pos/cron_winepos_update_script.php &> /dev/null
20 * * * * /usr/bin/php /var/www/vhosts/magento/pos/cron_pos_file_mover.php &> /dev/null
Keep in mind, checking POS data provided from POS system, cron job setting, checking update script operations.

Custom Linux distro - mono runtime not found

I am trying to add mono to core-image-minimal for P202RDB custom Linux distro. Here is my bblayers.conf file:
# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
LCONF_VERSION = "6"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
/home/testuser/QorIQ-SDK-V1.9-20151210-yocto/sources/poky/meta \
/home/testuser/QorIQ-SDK-V1.9-20151210-yocto/sources/poky/meta-yocto \
/home/testuser/QorIQ-SDK-V1.9-20151210-yocto/sources/poky/meta-yocto-bsp \
/home/testuser/QorIQ-SDK-V1.9-20151210-yocto/sources/meta-freescale \
/home/testuser/QorIQ-SDK-V1.9-20151210-yocto/sources/meta-freescale-internal \
/home/testuser/QorIQ-SDK-V1.9-20151210-yocto/sources/meta-freescale-extra \
/home/testuser/QorIQ-SDK-V1.9-20151210-yocto/sources/meta-mono \
"
BBLAYERS_NON_REMOVABLE ?= " \
/home/testuser/QorIQ-SDK-V1.9-20151210-yocto/sources/poky/meta \
/home/testuser/QorIQ-SDK-V1.9-20151210-yocto/sources/poky/meta-yocto \
"
Now, when I try to build image using bitbake core-image-minimal, I get following output from it:
Loading cache: 100% |##############################################################################################################| ETA: 00:00:00
Loaded 1496 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
Build Configuration:
BB_VERSION = "1.26.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "Debian-8.6"
TARGET_SYS = "powerpc-fsl-linux-gnuspe"
MACHINE = "p2020rdb"
DISTRO = "fsl-qoriq"
DISTRO_VERSION = "1.9"
TUNE_FEATURES = "m32 spe ppce500v2"
TARGET_FPU = "ppc-efd"
meta
meta-yocto
meta-yocto-bsp = "(detachedfromb74ea96):ddf114933ccfc6e3ce51a10e8e8f95e514b73578"
meta-freescale = "(detachedfrom7fb32a2):7fb32a20983a0ebd5503eb42e851550b0deb8679"
meta-freescale-internal = "(detachedfrom220bff8):220bff8b2030e5af7393b5870d74c6f0af0d76d1"
meta-freescale-extra = "(nobranch):ced26c806cb566b1400a2f4f26a94d8d44d13233"
meta-mono = "daisy:f01b4f7a98d07abcf4c1f845c057199e112fb7d6"
NOTE: Preparing RunQueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 1248 tasks of which 1248 didn't need to be rerun and all succeeded.
It seems mono repository is found, then I prepare SD card using this image and it boots without problems on target board, however, mono command is not available. What am I missing?
Add
IMAGE_INSTALL_append = " mono"
to your local.conf. Just adding a layer doesn't add any package to your image.
Even better, create your own image, and add mono to IMAGE_INSTALL in that recipe.

How and when and where jvm change the max open files value of Linux?

In linux there is a limit for max open files for every process of each login user, as below:
$ ulimit -n
1024
When I study java nio, I'd like to check this value. Because channel also is a file in Linux,I wrote a client code to create socketChannel continuely until throwing below exception:
java.net.SocketException: Too many open files
at sun.nio.ch.Net.socket0(Native Method)
at sun.nio.ch.Net.socket(Net.java:423)
at sun.nio.ch.Net.socket(Net.java:416)
at sun.nio.ch.SocketChannelImpl.<init>(SocketChannelImpl.java:104)
at sun.nio.ch.SelectorProviderImpl.openSocketChannel(SelectorProviderImpl.java:60)
at java.nio.channels.SocketChannel.open(SocketChannel.java:142)
But I found it till created about 4085 socketChannel, it will throw this exception. This number is more than 1024. Somebody told me jvm changed the value implicitly. And I wrote a java program to execute ulimit command, and found jvm do change the value. As below:
String [] cmdArray = {"sh","-c","ulimit -n"};
Process p = Runtime.getRuntime().exec(cmdArray);
BufferedInputStream in = new BufferedInputStream(p.getInputStream());
byte[] buf = new byte[1024];
int len = in.read(buf);
System.out.println(new String(buf, 0, len)); //4096
Does anybody know when and where and how jvm changes this value? Does exist some sys log to record this change or some sys tool could monitor this change?
$ strace -f -o HelloWorld.strace java HelloWorld
Hello World!
$ vi HelloWorld.strace
...
16341 getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=4*1024}) = 0
16341 setrlimit(RLIMIT_NOFILE, {rlim_cur=4*1024, rlim_max=4*1024}) = 0
...
Download openjdk, then cd into hotspot dir,
$ grep -r setrlimit
...
src/os/linux/vm/os_linux.cpp: status = setrlimit(RLIMIT_NOFILE, &nbr_files);
...
$ vi src/os/linux/vm/os_linux.cpp
...
if (MaxFDLimit) {
// set the number of file descriptors to max. print out error
// if getrlimit/setrlimit fails but continue regardless.
struct rlimit nbr_files;
int status = getrlimit(RLIMIT_NOFILE, &nbr_files);
if (status != 0) {
if (PrintMiscellaneous && (Verbose || WizardMode))
perror("os::init_2 getrlimit failed");
} else {
nbr_files.rlim_cur = nbr_files.rlim_max;
status = setrlimit(RLIMIT_NOFILE, &nbr_files);
if (status != 0) {
if (PrintMiscellaneous && (Verbose || WizardMode))
perror("os::init_2 setrlimit failed");
}
}
...
If you modify above code, e.g.
//nbr_files.rlim_cur = nbr_files.rlim_max;
nbr_files.rlim_cur = 2048;
then rebuild this openjdk, then use this new jdk to execute above code, you'll find the output is 2048.