Using one Linux kernel for 2 devices with FIT image - c

I want to use one embedded Linux kernel for 2 devices, I build this kernel with mkimage tool and rules in .dts file. Devices differs load and entry points. But u-boot doesn't use load and entry point addresses from configuration, only from kernel section. As result 2 big size data files (fully identical) are included into resulting .dtb file. It's inefficient. Can I transfer correct values from configuration to kernel sections? Or use links to single binary from both kernel sections?
Thank you in advance,
Dmytro Badekha.
Content of ITS file:
/dts-v1/;
/ {
description = "ARM FIT (Flattened Image Tree)";
#address-cells = <1>;
images {
kernel#1 {
description = "ARM OpenWrt Linux-3.14.77";
data = /incbin/("./Image.gz");
type = "kernel";
arch = "arm";
os = "linux";
compression = "gzip";
load = <0x42208000>;
entry = <0x42208000>;
hash#1 {
algo = "crc32";
};
hash#2 {
algo = "sha1";
};
};
kernel#2 {
description = "ARM OpenWrt Linux-3.14.77";
data = /incbin/("./Image.gz");
type = "kernel";
arch = "arm";
os = "linux";
compression = "gzip";
load = <0x80208000>;
entry = <0x80208000>;
hash#1 {
algo = "crc32";
};
hash#2 {
algo = "sha1";
};
};
fdt#v3.0-ap160 {
description = "ARM OpenWrt qcom-ipq806x-akxx device tree blob";
data = /incbin/("./qcom-ipq8064-v3.0-ap160.dtb.gz");
type = "flat_dt";
arch = "arm";
compression = "gzip";
load = <0x43F00000>;
hash#1 {
algo = "crc32";
};
hash#2 {
algo = "sha1";
};
};
fdt#ap.dk04.1-c4 {
description = "ARM OpenWrt qcom-ipq40xx-ap.dkxx device tree blob";
data = /incbin/("./qcom-ipq40xx-ap.dk04.1-c4.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
hash#1 {
algo = "crc32";
};
hash#2 {
algo = "sha1";
};
};
};
configurations {
default = "config#v3.0-ap160";
config#v3.0-ap160 {
description = "OpenWrt";
kernel = "kernel#1";
fdt = "fdt#v3.0-ap160";
};
config#ap.dk04.1-c4 {
description = "OpenWrt";
kernel = "kernel#2";
fdt = "fdt#ap.dk04.1-c4";
};
};
};

Related

is it possible to use several different platform devices in one platform driver (nodes from the device tree)

I am writing a kernel driver for beaglebone c. My assignment: write a uart driver that receives data from the gpyo and sends it to the user I have Device Tree and I have to use two platform devices: uart and gpio
here is an excerpt from DT:
uarts{
pinctrl-names = "default";
pinctrl-0 = <&user_uarts_s0>;
compatible = "serial";
:
:
&gpio_pins {
compatible = "gpio_device";
pinctrl-names = "default";
pinctrl-0 = <&gpio_pins>;
};
I can use one platform devices (code is attached below), but how can I use two? where should I put "gpio_device"
static struct platform_driver serial8250_driver = {
.driver = {
.name = "serial",
.owner = THIS_MODULE,
.of_match_table = hw_match_table},
.probe = Serial_probe,
.remove = Serial_remove
};
static struct of_device_id hw_match_table[] =
{
{
.compatible = "serial",
},
};
this is my first driver so please don't judge too harshly and help me!

Glance fails to load images using the coil

I did this in Glance to get a bitmap of the online URI for display, but it failed.
Does Glance still support weight ratios?
val context = LocalContext.current val imageLoader = ImageLoader(context)
var bitmap = currentState<Bitmap>()
imageLoader.enqueue(
ImageRequest.Builder(context)
.data(parcelItem.artUri)
.error(R.drawable.music)
.target(
onSuccess = {
bitmap = it.toBitmap()
},
onError = {
it?.let {
bitmap = it.toBitmap()
}
}
)
.build()
)
Image(
provider = ImageProvider(bitmap),
modifier = GlanceModifier.size(50.dp).cornerRadius(10.dp).padding(8.dp),
contentDescription = ""
)
It is not possible to use the Coil directly, because the Glance component is required, and the ImageProvider(URI) does not support online resolution.
I just need to get the Bitmap before the update and pass it to the Widget

How to override compile flags for a single package in nixos?

How can I override compile flags (as in CFLAGS) for a single package in NixOS/Nix environments?
Here's what I've got by now:
let
optimizeForThisHost = pkg:
pkgs.lib.overrideDerivation pkg (old: {
exportOptimizations = ''
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -fPIC -O3 -march=native"
'';
phaseNames = ["exportOptimizations"] ++ old.phaseNames;
});
in
muttWithoutThings = pkgs: (pkgs.mutt.override {
sslSupport = false;
saslSupport = false;
imapSupport = false;
withSidebar = false;
};
});
mutt = pkgs:
(optimizeForThisHost (muttWithoutThings pkgs));
in my configuration.nix, though this fails with
error: attribute ‘phaseNames’ missing
Here is a working example that builds (and runs) a copy of GNU hello with custom compiler flags:
nix-shell -p 'hello.overrideDerivation (old: { NIX_CFLAGS_COMPILE = "-Ofoo"; })' --run "hello --version"
If you want to convince yourself whether this really works, try passing a non-existent flag to the compiler, like -Ofoo, and verify that the builds fails as expected.
More information about the overrideDerivation function (and similar alternatives) can found in the Nixpkgs manual at http://nixos.org/nixpkgs/manual/index.html#sec-pkg-overrideDerivation.
I managed to write a function which I can apply to the packages I want to compile with custom flags:
optimizeWithFlags = pkg: flags:
pkgs.lib.overrideDerivation pkg (old:
let
newflags = pkgs.lib.foldl' (acc: x: "${acc} ${x}") "" flags;
oldflags = if (pkgs.lib.hasAttr "NIX_CFLAGS_COMPILE" old)
then "${old.NIX_CFLAGS_COMPILE}"
else "";
in
{
NIX_CFLAGS_COMPILE = "${oldflags} ${newflags}";
});
This function takes a package and a list of strings (which are the flags) and builds a new package with the existing one, but with the additional compiler flags.
For convenience, I wrote another set of helper functions:
optimizeForThisHost = pkg:
optimizeWithFlags pkg [ "-O3" "-march=native" "-fPIC" ];
withDebuggingCompiled = pkg:
optimizeWithFlags pkg [ "-DDEBUG" ];
Now, I can override packages (here mutt and dmenu):
muttWithoutThings = pkgs: (pkgs.mutt.override {
sslSupport = false;
saslSupport = false;
imapSupport = false;
withSidebar = false;
});
mutt = pkgs:
(utils pkgs).withoutConfigureFlag "--enable-debug"
((utils pkgs).optimizeForThisHost (muttWithoutThings pkgs)
);
dmenu = pkgs:
(utils pkgs).optimizeForThisHost
(pkgs.dmenu.override {
patches = [ ./patches/dmenu-fuzzymatch-4.6.diff ];
});
In the above utils is utils = pkgs: import ./util.nix { pkgs = pkgs; }; and the util.nix file returns a function which spits out a set of functions.

Copy DNN HTML Pro module in content to another module

Below code is working fine for HTML module but not working for HTML PRO module.
HtmlTextController htmlTextController = new HtmlTextController();
WorkflowStateController workflowStateController = new WorkflowStateController();
int workflowId = htmlTextController.GetWorkflow(ModuleId, TabId, PortalId).Value;
List<HtmlTextInfo> htmlContents = htmlTextController.GetAllHtmlText(ModuleModId);
htmlContents = htmlContents.OrderBy(c => c.Version).ToList();
foreach (var content in htmlContents)
{
HtmlTextInfo htmlContent = new HtmlTextInfo();
htmlContent.ItemID = -1;
htmlContent.StateID = workflowStateController.GetFirstWorkflowStateID(workflowId);
htmlContent.WorkflowID = workflowId;
htmlContent.ModuleID = ModuleId;
htmlContent.IsPublished = content.IsPublished;
htmlContent.Approved = content.Approved;
htmlContent.IsActive = content.IsActive;
htmlContent.Content = content.Content;
htmlContent.Summary = content.Summary;
htmlContent.Version = content.Version;
}
htmlTextController.UpdateHtmlText(htmlContent, htmlTextController.GetMaximumVersionHistory(PortalId));
This is occurred due to HTML Pro module has different methods. That is partially different from DNN HTML Module. below is the code.
HtmlTextController htmlTextController = new HtmlTextController();
WorkflowStateController workflowStateController = new WorkflowStateController();
WorkflowStateInfo wsinfo = new WorkflowStateInfo();
int workflowId = wsinfo.WorkflowID;
HtmlTextInfo htmlContents = htmlTextController.GetLatestHTMLContent(ModuleModId);
HtmlTextInfo htmlContent = new HtmlTextInfo();
htmlContent.ItemID = -1;
htmlContent.StateID = workflowStateController.GetFirstWorkflowStateID(workflowId);
htmlContent.WorkflowID = workflowId;
htmlContent.ModuleID = ModuleId;
htmlContent.IsPublished = htmlContents.IsPublished;
htmlContent.Approved = htmlContents.Approved;
htmlContent.IsActive = htmlContents.IsActive;
htmlContent.Content = htmlContents.Content;
htmlContent.Summary = htmlContents.Summary;
htmlContent.Version = htmlContents.Version;
if (Tags != null && Tags.Count > 0)
{
foreach (KeyValuePair<string, string> tag in Tags)
{
if (htmlContent.Content.Contains(tag.Key))
{
htmlContent.Content = htmlContent.Content.Replace(tag.Key, tag.Value);
}
}
}
htmlTextController.SaveHtmlContent(htmlContent, newModule);
And please add below reference to the code to refer the methods.
using DotNetNuke.Modules.HtmlPro;
using DotNetNuke.Professional.HtmlPro;
using DotNetNuke.Professional.HtmlPro.Components;
using DotNetNuke.Professional.HtmlPro.Services;
If you are looking to simply "copy" the content from one to the other, you might investigate the usage of the "Import" and "Export" functions that are part of these modules.
I recommend using this route to help you ensure better compatibility as time progresses. Should they update fields or other data elements you will not have to investigate and then update your code as part of this.
You can simply look at the .dnn manifest for each of these modules and find the BusinessControllerClass which will have two methods "ImportModule" and "ExportModule" that you could use.

TYPO3 Formhandler finisher does not write to database

After the TYPO3 (6.1.7) website of a customer has gone online, the Formhandler forms do not work correctly anymore. They do send an email, but it seems that they do not execute the Finisher_DB for writing into the database anymore.
The TypoScript settings look like this:
plugin.Tx_Formhandler.settings {
debug = 0
# GENERAL CONFIGURATION
name = Default
addErrorAnchors = 1
formValuesPrefix = formhandler
fillValueMarkersBeforeLangMarkers = 1
# ERRORS LAYOUT
singleErrorTemplate {
totalWrap = <div>|</div>
singleWrap = <span class="error">|</span><br />
}
errorListTemplate {
totalWrap = <ul>|</ul>
singleWrap = <li class="error">|</li>
}
validators {
1.class = Tx_Formhandler_Validator_Default
1.config {
fieldConf {
wish.errorCheck.1 = required
alternative.errorCheck.1 = required
firstname.errorCheck.1 = required
surname.errorCheck.1 = required
nationality.errorCheck.1 = required
dateofbirth.errorCheck.1 = required
phone.errorCheck.1 = required
email.errorCheck.1 = required
street.errorCheck.1 = required
zip.errorCheck.1 = required
city.errorCheck.1 = required
country.errorCheck.1 = required
}
}
}
# Finishers configuration
finishers {
1.class = Tx_Formhandler_Finisher_Mail
1.config {
checkBinaryCrLf = registrationMessagePlain, registrationMessageHtml
limitMailsToUser = 10
admin {
}
user {
}
}
2.class = Tx_Formhandler_Finisher_DB
2.config{
table = tx_chilifhregistration
key = uid
fields {
timeslot = Sommerplatz
timeslot_july.mapping = timeslotSummerJuly
timeslot_august.mapping = timeslotSummerAugust
timeslot_september.mapping = timeslotSummerSeptember
wish.mapping = wish
wishcategory11.mapping = wishCategory11
wishcategory19.mapping = wishCategory19
wishcategory22.mapping = wishCategory22
wishcategorydb.mapping = wishCategoryDb
alternative.mapping = alternative
alternativecategory11.mapping = alternativeCategory11
alternativecategory19.mapping = alternativeCategory19
alternativecategory22.mapping = alternativeCategory22
alternativecategorydb.mapping = alternativeCategoryDb
salutation.mapping = salutation
firstname.mapping = firstname
surname.mapping = surname
nationality.mapping = nationality
dateofbirth.mapping = dateofbirth
phone.mapping = phone
email.mapping = email
street.mapping = street
zip.mapping = zip
city.mapping = city
country.mapping = country
salutation2.mapping = salutation2
firstname2.mapping = firstname2
surname2.mapping = surname2
nationality2.mapping = nationality2
dateofbirth2.mapping = dateofbirth2
phone2.mapping = phone2
email2.mapping = email2
street2.mapping = street2
zip2.mapping = zip2
city2.mapping = city2
country2.mapping = country2
}
}
}
}
What could be the problem?
You should better use the predef-definition-style for forms. This will save you trouble with multiple forms and is a cleaner implementation.
plugin.Tx_Formhandler.settings.predef.yourformularname { ...config... }
You can find a bunch of examples on the offical site/examples
I assume that your admin and user mail-config is only empty because you won´t post any customerinformation?
Did the form work if you fill in every single field?
In my own usecases all field i map with the finisher are required, maybe you should set a ...IfEmpty-option for non-require fields.
Here are the available ifEmpty-options.

Resources