Difference between revisions of "User:Ted"
m |
m |
||
Line 1,207: | Line 1,207: | ||
FreeRTOS on Arduino development boards . . . | FreeRTOS on Arduino development boards . . . | ||
* https://github.com/feilipu/Arduino_FreeRTOS_Library | * https://github.com/feilipu/Arduino_FreeRTOS_Library | ||
− | |||
− | |||
<!-- comment --> | <!-- comment --> |
Revision as of 15:20, 25 May 2018
-- 2017-07-21 शुक्रवार --
User Ted's wiki page at Neela Nurseries
OVERVIEW
This wiki document a starting point of Ted's notes on Linux use and configuration, Open Source Software and web development. Recent summer 2017 efforts of Ted's are focused on several high-level programming language and web development frameworks, which can be studied and used separately but are often glued together to achieve meaningful tasks and end-user tools and interfaces. This personal page of Ted's notes on Neela Nurseries wiki not yet well organized, but here as a quick stash point for holding useful references, and a starting point for more complete and formal documentation.
Contents
- 1 OVERVIEW
- 2 ↑ ↓ Mediawiki Issues and Notes
- 3 ↑ ↓ Web Site Building Blocks - Summer 2017 Work
- 4 ↑ ↓ Open Source License Types
- 5 ↑ ↓ Linux Packages (Separate Article)
- 6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- 7 ↑ ↓ Bash Shell Scripting
- 8 ↑ ↓ Regex tutorials
- 9 ↑ ↓ Other Computer Programming Languages
- 10 ↑ ↓ GNU Make Utility
- 11 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- 12 ↑ ↓ Aboriginal Linux - project now defunct, new project is 'makeroot'
- 13 ↑ ↓ Linux From Scratch (Separate Article)
- 14 ↑ ↓ QEMU Emulator
- 15 ↑ ↓ Embedded Linux Notes, focus on Rpi Linux Kernel Config
- 16 ↑ ↓ FreeRTOS Notes (Separate Article)
- 17 ↑ ↓ Bootloader U-Boot
- 18 ↑ ↓ LPC11U6x Development Board
- 19 ↑ ↓ avr-libc
- 20 ↑ ↓ Yocto References
- 21 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- 22 ↑ ↓ Mobile App Development On Linux
- 23 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- 24 ↑ ↓ Toradex embedded ARM computers
- 25 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- 26 ↑ ↓ Electronics
- 27 ↑ ↓ Other Things To Explore
- 28 ↑ ↓ Community, Culture, the World
- 29 ^ References
- 2017-10-05 - Ted noting here that would be good to have a technical glossary to make easily accessible all the technical terms which arise in daily work and exploration of technologies . . .
- 2017-10-19 - TO-DO list:
* [✓] complete LFS 8.1 exercise * [ ] configure xserver to run stand-along without window manager (seems to be working on 1604 spare LTS host . . .) * [ ] set up two mysql servers on one host * [ ] write "best photo contribution" practices page for ASI * [ ] code "re-use or reference text block" module for MediaWiki <-- this needs further explanation - TMH * [ ] in local Neela Nurseries PHP code base, amend hybrid building of nav menus to include highlighting parent page of given viewed page * [ ] in OpenCart 2.x find way to customize top-of-page information and links * [ ] in OpenCart 2.x find way to format product lists as compact lists, like Gmail inbox or Windows 'list view' of files
↑ ↓ Mediawiki Issues and Notes
- 2018-01-22 - While editing sidebar of Mediawiki instance at Neela, Ted noticing a difference in Mediawiki's treatment of hyperlinks in the sidebar. Links to external sites don't appear, and links to internal pages require single square brace enclosure to appear with alternate text as a link label . . .
<!-- ** [https://buildroot.org/downloads/manual/manual.html Buildroot manual] <a href="https://buildroot.org/downloads/manual/manual.html">Buildroot manual</a> - 2018-01-22 MON - ** https://wiki.neelanurseries.com/index.php/Nn_embedded_linux_notes#.E2.86.91_.E2.86.93_Buildroot|Buildroot notes . . . only 'notes' shows as non-link text - TMH -->
↑ ↓ Web Site Building Blocks - Summer 2017 Work
Web site building blocks now a separate wiki document, as of 2018-01-08. - TMH
↑ ↓ Open Source License Types
↑ ↓ Linux Packages (Separate Article)
Linux software package notes a separate wiki document on Neela wiki. - TMH
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
↑ ↓ Bash Shell Scripting
Bash (Bourne shell) Quick Reference:
Shell Built-in Variables: $0 Name of given shell script itself $1 Value of first command line parameter (similarly $2, $3, ...) $# In given shell script the number of command line parameters received $* All of the command line parameters $- Options given to the shell $? Return (or holds) the exit status of the last command $$ Process id of given script (really the id of the shell running the script) Shell test constructs: SYNTAX NAME OF SHELL TEST NOTES [ built-in test considers its arguments as comparison expressions or file tests [[...]] in Bash => 2.02 the extended test command ((...)) arithmetic tests example: (( 0 && 1 )) # Logical AND
References:
- http://tldp.org/LDP/abs/html/testconstructs.html
- http://tldp.org/LDP/abs/html/internal.html#BUILTINREF
- http://tldp.org/LDP/abs/html/string-manipulation.html
Shell scripting and use of built-in shell commands is a practical knowledge to employ, when working in Unix-like environments. One common task is to find all the instances of a given file or program. The locate
command can perform this kind of search, but it's results don't show whether the file instances differ. To check at the rough level of file size, we can use a one-line shell script technique involving shell piping, to "long list" the results of the locate
command, like this . . .
$ for file in `locate tavrasm | grep 'asm$'`; do ls -l ${file}; done
Hmm strange, the above command calls `grep` with a pattern that ends in the shell end-of-line anchoring character $, and appears to filter for results of `locate` which end in 'asm'. But on 2017-09-12 needed to add a "one or more wildcard" character pattern to limit search results for instances of `locate` results ending in 'qemu':
$ locate qemu | grep '.*qemu$'
Why the apparent difference in command invocation? Need to test . . . - TMH
Command to break out first ten $PATH environment variable to individual paths each shown on a line of the shell:
$ for path in `echo $PATH | cut -d':' -f1-10 --output-delimiter=' '`; do echo $path; done
2018-04-23 - Monday, command to obtain summary of directories containing 1GB or more data:
$ du -h . | grep [0-9]G
↑ ↓ edit point - shell variable quoting
- 2017-10-19 THU -
Running into issues when need to expand shell variable in single quotes pair . . .
Stack Exchange, Unix forum post 178411
TLPD Advanced Bash Scripting Guide, chapter 4.2 example 4-3 double quotes preserve white space
WIKI WISH LIST - While adding to wiki, Ted noting that would be useful to have relative-depth wiki section markers. The standard wiki section markers '== ==', '=== ===' and similar have fixed depth. That is, '== ==' is always a top-level or first-level section in a wiki document, '=== ===' is always a sub-subsection of wiki documents, and '==== ====' a sub-sub-section. When section gets re-factored into its own article, would be handy to have those section markers rise up to levels of top-most and successive section markers. - TMH
↑ ↓ example shell script - back up several databases
Here is a simple shell script to call mysqldump utility and back up several databases. Couple of things Ted wants to add to this script include script variables to hold back-up filename prefix and infix patterns, and an option to compress the MYSQL dump files . . .
Figure x - shell script to back-up multiple MYSQL databases
#!/bin/bash DATABASE_LIST="information_schema mysql drupal_8p0 phpmyadmin wiki_database" user="root" pass_phrase_for_mysql="mysql_user_password" options_extra="--skip-lock-tables" response="n" mode_interactive="n" echo "shell script starting," for database in ${DATABASE_LIST}; do echo "backing up alta-ubuntu database $database . . ."; # command="mysqldump --databases $database -u$user -p$pass_phrase_for_mysql $options_extra >> au-database-back-up--${database}.sql" command="mysqldump --databases $database -u$user -p$pass_phrase_for_mysql $options_extra" redirect="au-database-back-up--${database}.sql" if [ $mode_interactive = 'y' ]; then echo "build command '$command' and database back-up filename'$redirect'," echo "full command will be '$command' > '$redirect'," echo "trying running this command and redirect? [y/N/q] yes, no, 'q' to quit" read response if [ $response = 'Y' -o $response = 'y' ]; then ${command} > $redirect elif [ $response = 'N' -o $response = 'n' ]; then echo "skipping present command . . ." elif [ $response = 'Q' -o $response = 'q' ]; then echo "stopping script '$0' and exiting." break fi echo else echo "$0: backing up database '$database' to file '$redirect' . . ." ${command} > $redirect ls -l $redirect fi done echo "done." exit 0
↑ ↓ show kernel version script
Following script 'showkversion' can be used in a Linux kernel source tree to determine the kernel's version number, based on the number elements defined in the kernel's top level makefile.
Figure x - simple bash script to show kernel version in root of kernel sources tree
#!/bin/bash ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ## Started 2017-12-15 FRI - script to parse and show Linux kernel ## version from top-level makefile in set of kernel sources. Patterns ## to `grep` chosen based on kernel version identifiers in first ## three lines of typical kernel top-level makefile. Example: ## ## $ head -n 6 Makefile ## VERSION = 4 ## PATCHLEVEL = 9 ## SUBLEVEL = 66 ## EXTRAVERSION = ## NAME = Roaring Lionus ## ## ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - script_name="showkversion" if [ ]; then head -n 5 Makefile | grep ^VERSION | cut -d " " -f 3 head -n 5 Makefile | grep ^PATCH | cut -d " " -f 3 head -n 5 Makefile | grep ^SUBLEVEL | cut -d " " -f 3 fi MAJOR=$(head -n 5 Makefile | grep ^VERSION | cut -d " " -f 3) MINOR1=$(head -n 5 Makefile | grep ^PATCH | cut -d " " -f 3) MINOR2=$(head -n 5 Makefile | grep ^SUBLEVEL | cut -d " " -f 3) KERNEL_REVISION="${MAJOR}.${MINOR1}.${MINOR2}" echo echo "Kernel version in present kernel sources tree, per makefile, is ${KERNEL_REVISION}" echo exit 0
↑ ↓ Other useful shell tutorial references
- http://tldp.org/LDP/abs/html/textproc.html . . . commands cut, paste, join and others
- https://unix.stackexchange.com/questions/131766/why-does-my-shell-script-choke-on-whitespace-or-other-special-characters . . . read shell input line by line
- https://stackoverflow.com/questions/7427262/how-to-read-a-file-into-a-variable-in-shell . . . read file into shell variable
↑ ↓ Regex tutorials
↑ ↓ Other Computer Programming Languages
↑ ↓ Python Scripting Language
↑ ↓ Expect Utility by Don Libes
Installing 'expect' on Ubuntu 16.04.x LTS host, typical dependencies:
ted@localhost:~/projects/shell/expect-work$ sudo apt install expect Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libfontenc1 libxaw7 libxmu6 libxmuu1 libxtst6 libxv1 libxxf86dga1 tcl-expect tcl8.6 tk8.6 x11-utils xbitmaps xterm Suggested packages: tcl-tclreadline mesa-utils xfonts-cyrillic The following NEW packages will be installed: expect libfontenc1 libxaw7 libxmu6 libxmuu1 libxtst6 libxv1 libxxf86dga1 tcl-expect tcl8.6 tk8.6 x11-utils xbitmaps xterm 0 upgraded, 14 newly installed, 0 to remove and 5 not upgraded. Need to get 1,373 kB of archives. After this operation, 4,110 kB of additional disk space will be used. Do you want to continue? [Y/n] y . . .
Some 'expect' utility references:
Good short examples covering range of tasks here at Robert Elder blog page, noting md5sum expect script example . . .
- https://www.ibm.com/developerworks/community/blogs/brian/entry/when_to_use_expect_scripting_and_when_to_avoid_it10?lang=en Expect script with while-loop
- https://wiki.tcl.tk/11584 list of Expect tutorials
How to capture specific results during an expect script's execution:
- 2018-01-30 - Tuesday, picking up from last week researching how to redirect expect output and its spawned processes' output with filtering to log file. The first reference here at Stackoverflow repeats the useful lindex
syntax. There is also mention of the expect
manual and a syntax $::env(action)
which can be expressed in an expect script to access an environment variable that is part of the controlling shell . . .
How to use expect's log_file
key word in an expect script:
From the manual page for expect version 5.45:
log_file [args] [[-a] file] If a filename is provided, log_file will record a transcript of the session (beginning at that point) in the file. log_file will stop recording if no argument is given. Any previous log file is closed. Instead of a filename, a Tcl file identifier may be provided by using the -open or -leaveopen flags. This is similar to the spawn command. (See spawn for more info.) The -a flag forces output to be logged that was suppressed by the log_user command. By default, the log_file command appends to old files rather than truncating them, for the convenience of being able to turn logging off and on multiple times in one session. To truncate files, use the -noappend flag. The -info flag causes log_file to return a description of the most recent non-info arguments given.
Also from the expect manual page, Expect Hints section:
EXPECT HINTS There are a couple of things about Expect that may be non-intuitive. This section attempts to address some of these things with a couple of suggestions. A common expect problem is how to recognize shell prompts. Since these are customized differently by differ- ently people and different shells, portably automating rlogin can be difficult without knowing the prompt. A reasonable convention is to have users store a regular expression describing their prompt (in particular, the end of it) in the environment variable EXPECT_PROMPT. Code like the following can be used. If EXPECT_PROMPT doesn't exist, the code still has a good chance of functioning correctly. set prompt "(%|#|\\$) $" ;# default prompt catch {set prompt $env(EXPECT_PROMPT)} expect -re $prompt I encourage you to write expect patterns that include the end of whatever you expect to see. This avoids the possibility of answering a question before seeing the entire thing. In addition . . .
The expect program has some built-in string buffers, and one of these may hold the latest characters received from a spawned process. Here is a man page excerpt which shows use of one of these expect buffers:
disconnect disconnects a forked process from the terminal. It continues running in the background. The process is given its own process group (if possible). Standard I/O is redirected to /dev/null. The following fragment uses disconnect to continue running the script in the background. if {[fork]!=0} exit disconnect . . . The following script reads a password, and then runs a program every hour that demands a password each time it is run. The script supplies the password so that you only have to type it once. (See the stty command which demonstrates how to turn off password echoing.) send_user "password?\ " expect_user -re "(.*)\n" for {} 1 {} { if {[fork]!=0} {sleep 3600;continue} disconnect spawn priv_prog expect Password: send "$expect_out(1,string)\r" . . . exit }
Further looking for expect's built-in string buffers and variables . . .
Pattern matching syntax in Don Libe's expect . . .
- https://www.pantz.org/software/expect/expect_examples_and_tips.html . . . some timing stuff and expect script blocks
- http://www.asic-world.com/scripting/tcl3.html . . . regex in Tcl must enclose pattern in braces.
From another source, Tcl's string match command:
if [string match "f*b*" "foobar"] { puts "match" else { puts "no match" }
↑ ↓ edit point - Tool command language Tcl
"Practical programming in Tcl and Tk" ISBN 0-13-038560-3
In using Don Libes' expect
utility or program, looks like it will be important and helpful to understand Tool Command Language Tcl to at least some fluency. Here appears to be a good starting point tutorial for Tcl:
Tcl puts
built-in command, channels and code to open log file,
Append a log message to a file: set chan [open my.log a] set timestamp [clock format [clock seconds]] puts $chan "$timestamp - Hello, World!" close $chan
Tcl regular expressions:
Tcl reserved words:
after append array auto_execok auto_import auto_load auto_load_index auto_qualify binary Bgerror break catch cd Clock close concat continue Dde default else elseif Encoding eof error eval Exec exit expr fblocked Fconfigure fcopy file fileevent Flush for foreach format Gets glob global history If info interp join Lappend lindex linsert list Llength load lrange lreplace Lsearch lsort namespace open Package pid pkg_mkIndex proc Puts pwd read regexp Regsub rename resource return Scan seek set socket Source split string subst Switch tclLog tell time Trace unknown unset update Uplevel upvar variable vwait While
↑ ↓ edit point - Tcl pattern matching and anchoring, symbols ^ and $ wrt data not lines
From the Tcl manual page on-line here is a clue about pattern matching in Tcl scripts, which may explain why we are struggling to obtain matched substrings from sequences of bytes from expect-spawned processes . . .
Note that in many editors, the ^ and $ match the beginning and end of lines respectively. However, because expect is not line oriented, these characters match the beginning and end of the data (as opposed to lines) currently in the expect matching buffer. (Also, see the note below on "system indigestion.")
Tcl regular expression syntax:
Expect variables, using global and upvar keywords in Tcl scripts:
Excerpt on Tcl pattern matching from Inguza web site:
2 Expect The expect suite actually consist just of a few commands: expect, send, spawn and interact and is an extension to TCL. Before the expect command can be used a program must be spawned, see expect commands below. expect \ {match1} {action1} \ {match2} {action2} \ {match3} {action3} \ {match4} {action4} It is possible that no such output is encountered within the time period defined by the timeout (variable name "timeout" in seconds, default to 2). In this case expect stops waiting and continues with the next command in the script. You can use '*' to match any characters. You can also match using [] syntax and similar. expect "\[a-f0-9]" ; # strongly preferred as \n and similar is not taken as litteral charactesr \ and n. expect {a-f0-9} ; # can also be used A note on \ characters. The pattern matcher translate \x to x but this is done once before the pattern matcher. So you need to type \\n to match n. This is especially important for * and ? characters. expect "*" ;# match anything (*) expect "\n" ;# match linefeed expect "\*" ;# match anything expect "\\*" ;# match * character expect "\\\*" ;# match * character expect "\\\\*" ;# match \ followed by anything expect "\\\\\*" ;# match \ followed by anything expect "\\\\\\*" ;# match \ followed * character The [ character is special to both tcl and the pattern matcher so it is especially messy. proc xy {} { return "n*w" } expect "[xy]" ;# match n followed by anything followed by w expect "\[xy]" ;# match x or y expect "\\[xy]" ;# match n followed by anything followed by w expect "\\\[xy]" ;# match [xy] expect "\\\\[xy]" ;# match \ followed by n followed ... expect "\\\\\[xy]" ;# match sequence of \ and then x or y. The expect command can also take flags. The default flag is -gl for glob pattern matching. It can also take the flag -re for regular expression matching. expect { -re "a*" { action_when_a_followed_by_any_a } "b*" { action_when_b_followed_by_anything } -gl "-re" { action_when_real_dash_r_e } eof { action_on_end_of_file } timeout { action_on_command_timeout } default { action_on_command_timeout_or_eof } -re "(abc)*" { action_on_any_number_of_a_b_c } -re "-?(0|\[1-9]\[0-9]*)?\\.?\[0-9]*" { action_on_float_or_integer } } You can also pass the pattern as a variable. set v2pats "pat2 act2" set v3pats "pat3 act3" expect pat1 act1 $v2pats $v3pats Observe that the following expect string is wrong as $v2pats and $v3pats is considered as two different arguments. It will try to match $v2pats as a pattern and $v3pats as an action. Instead build up a string and use the -brace flag. You can not use double quotes for that though, unless you use eval and then the -brace flag is not necessary. You also need to protect the pattern and action inside a [list x] or an extra brace if they contain whitespaces. 2.1 Parentheses for feedback In the previous section, parantheses were used to group subpatterns together. They can also play another role. When a regular expression successfully matches a string each part of the string that matches a paranthensized subpattern is stored in "expect_out(1,string)" the second in "expect_out(2,string)" etc up to "expect_out(9,string)". The entire pattern matched is stored in "expect_out(0,string)". Everthing before the pattern and the pattern matched is stored in "expect_out(buffer)". The last two assignments work in glob pattern too. "a*((ab)*|b)" How is this passed to expect_out? It is quite simple. The entire string withing the first parenthesis is stored in 1 (which means up to end of string). The second fount parenthesis is stored in 2. Look for the left parenthesis to determine where the data is put. 2.2 Flags -re -gl -nocase Ignore case. Do not use -nocase with uppercase characters in the pattern as it will never match. -notransfer Prevent expect from removing matching characters from the internal buffer. The characters can be matched repeatedly as long as this option is associated with the pattern. It can be abbreviated with "-n" when expect is running interactively. -brace Expect normally see the first argument as a pattern to match, but sometimes you want to give a list of patterns and actions to expect. You can then use -brace to expand the list before it is handled by expect. expect -brace { pat1 act1 pat2 act2 } This can be useful when building up lists of pattern to match with corresponding actions to do. -i n Use an alternative spawn_id. This applies to all patterns after the -i flag. expect { -i $ftp "ftp>" "exit" eof "exit" } You can also expect values from multiple spawned processes at the same time. At most one action can be executed just as expect normally do. expect { -i $ftp "ftp> " { ftp_action } -i $shell $prompt { shell_action } } There is an input buffer associated with each spawn id. So any output from ftp is kept separate from thta of the shell in the example above. When output appear on terminal it will be mixed, unless you expect one at a time or set log_user 0 and then wrote output explictly using send_user $expect_out(buffer). The process that did not match will keep its buffer until matched by next expect command. When the expect command match something it record the spawn_id to expect_out(spawn_id) so you can know which process that it matched against. You can also set the spawn_id definition to a list of spawn_ids. expect { -i "$host1 $host2 $host3" $prompt { an_action $expect_out(spawn_id) } eof exit -i $host1 another_pattern {host1_action} } This example will do an_action if $prompt is matched agains any of the $hostnr, exit if end of file is matched against same list and do host1_action if matchina another_pattern from host1. 2.3 Special patterns Note that these patcherns will only match if none of the '-gl', '-re' or '-ex' flags has been used. eof Match when end of file is reached. timeout Match when the timeout value has been reached. default Match when end of file or timeout is reached. full_buffer Match when no other pattern match and expect would otherwise throw away part of the input to make room fore more. When this matches, all of the unmatched input is moved to expect_out(buffer). null By default null characters are removed from the buffer before expect matching is done. This can be disabled using the remove_nulls command below. If it is disabled null characters will be matched using this special keyword. Null characters can not be matched inside a pattern as expect first look for null characters and then do pattern matching. If a null character is found the characters before it is skilled. These caracters can be found in expect_out(buffer). Since the null character is used internally to represent the end of a string unanchored patterns cannot be matched past a null. This is not a problem since null pattern can always be listed last.
↑ ↓ Rust programming language
There are two editions of the Rust Programming book. The Rust home page recommends to start by reading the second edition:
↑ ↓ GNU Make Utility
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
↑ ↓ Aboriginal Linux - project now defunct, new project is 'makeroot'
Ok, looks like Robert Landley's Aboriginal Linux project has been superceded by mkroot. Ladnley's newer makeroot project sources are available at GitHub:
Having trouble carrying out the basic build of Aboriginal Linux with armv6l as target . . .
. . . Confirmed e2fsprogs-1.42.13.tar.gz Confirmed zlib-1.2.7.tar.bz2 Confirmed squashfs-4.2.tar.gz === Got all source. real 0m2.240s user 0m1.188s sys 0m0.176s === toybox (host host-tools) Snapshot 'toybox'... scripts/genconfig.sh cc -o kconfig/conf kconfig/conf.c kconfig/zconf.tab.c -DKBUILD_NO_NLS=1 \ -DPROJECT_NAME=\"ToyBox\" kconfig/conf -D /dev/null Config.in > /dev/null scripts/make.sh Generate headers from toys/*/*.c... generated/newtoys.h Library probe....... Make generated/config.h from .config. generated/flags.h generated/globals.h generated/help.h Compile toybox................................................................................................................................................................generated/obj/nsenter.o: In function `unshare_main': nsenter.c:(.text.unshare_main+0x152): undefined reference to `setns' collect2: error: ld returned 1 exit status make: *** [toybox] Error 1 Exiting due to errors (host host-tools toybox)
Robert Landley also has a presence on www.patreon.com/landley, where he talks about the over-arching goals in his programming and software systems level work.
↑ ↓ Linux From Scratch (Separate Article)
Linux From Scratch Book 8.1 - Build and Notes
↑ ↓ QEMU Emulator
Overview
Notes on QEMU, an emulator which can help with building and configuring Linux systems to run on embedded computers and development boards. Ted noting 2017-09-08 that to compile today's latest QEMU source, a 2.10.x release, needed to install Debian stretch packages pkg-config, libglib2.0-dev, dhautoreconf. Here are some links to downloading QEMU project sources, a manual for using QEMU, and an article about emulating a RaspberryPi system by using QEMU:
References:
- QEMU Emulator, source code download site
- QEMU manual
- How to invoke qemu and give it image to run as operating system
QEMU to emulate Arm on Linux . . .
- Emulating ARM on Ubuntu and Debian
- Emulating Raspberry Pi under Linux, Embedonix article
- Medicineyeh - Build your Arm image for QEMU
How to avoid "raw image format" warning . . .
So got QEMU 2.10.0 sources and dependencies installed, ran `configure` and `make` steps, and let the build process run for an hour or two. But in the end could not find any `qemu` executable. Why is the emulator itself apparently missing? Building latest QEMU under Linux . . .
So I'm following the above article author's typical build steps, and run into this message part-way down those steps, at the step of calling `make`:
user@host-6:~/Downloads/qemu/qemu-2.10.0/bin/debug/native$ make Makefile:21: *** This is an out of tree build but your source tree (/home/veris/Downloads/qemu/qemu-2.10.0) seems to have been used for an in-tree build. You can fix this by running "make distclean && rm -rf *-linux-user *-softmmu" in your source tree. Stop. user@host-6:~/Downloads/qemu/qemu-2.10.0/bin/debug/native$
Ok interesting, I know that QEMU is a complicated project with a complex build process, but clearly I don't know what I'm doing. Following the above 'distclean' command given in the error message from QEMU's makefile, I'm now able to begin an "out of tree" build as described in the "Building QEMU" article at qemu.org just above. Tired already however of QEMU project builds taking more than an hour to complete. Here is one of many articles describing how to invoke `make` to build only limited parts of QEMU project, for example just the pieces needed to emulate ARM type systems:
Ted to test this type of build soon . . .
On a different note, QEMU build has completed and the stock RaspberryPi Debian "Stretch" image is coming up. Needed to install a VNC client to interact with the emulated RaspberryPi operating and software, stored in the downloaded .img file from Rpi's web site. Here's a link to a forum post which clued Ted into Remmina VNC client:
- 2017-11-21 Tuesday -
The version of qemu which installed from Debian's package list didn't seem to work. It's been some weeks now since trying that instance, but qemu 2.10.0 works to bring up a command line image built for RaspberryPi. Here are the versions of the two qemu instances:
Figure x - locating qemu instances, determining their versions
user@localhost:~$ which qemu /usr/bin/qemu user@localhost:~$ /usr/bin/qemu --version QEMU emulator version 1.1.2 (Debian 1.1.2+dfsg-6+deb7u23), Copyright (c) 2003-2008 Fabrice Bellard user@localhost:~$ ls /opt/qemu qemu-system-arm user@localhost:~$ ls -l /opt/qemu/qemu-system-arm lrwxrwxrwx 1 root root 83 Sep 12 16:37 /opt/qemu/qemu-system-arm -> /home/user/Downloads/qemu/qemu-2.10.0/bin/debug/native/arm-softmmu/qemu-system-arm user@localhost:~$ /opt/qemu/qemu-system-arm --version QEMU emulator version 2.10.0 Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers user@localhost:~
- 2017-11-22 Wednesday -
Yesterday could not bring up raspbian image in qemu, same image which booted and appeared, and permitted shell based login and shell use a month ago on the local host. Looking at a new on-line reference for running raspbian images in qemu:
* https://ownyourbits.com/2017/02/06/raspbian-on-qemu-with-network-access/
This above article looks really interesting, appears to go to a second installment of the article where the developers there are building some kind of cloud-based or cloud involved web, database, mail and PHP servers. But on my end having trouble with a kernel panic this morning when invoking qemu-system-arm with a large set of options . . . ok, just located a different invocation of qemu-system-arm version 2.10.0, noting here in following code figure:
Figure x - emulate-rpi shell script
#!/bin/bash # Starts raspberry pi image in configuration mode ##---------------------------------------------------------------------- ## - SECTION - script variables ##---------------------------------------------------------------------- EMULATOR=/home/veris/Downloads/qemu/qemu-2.10.0/bin/debug/native/arm-softmmu/qemu-system-arm ##---------------------------------------------------------------------- ## - SECTION - original emulator invocation, everything hard-coded ##---------------------------------------------------------------------- # qemu-system-arm -kernel ./qemu-rpi-kernel/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" -hda rpi.img # qemu-system-arm -kernel ./qemu-rpi-kernel/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda rpi.img ##---------------------------------------------------------------------- ## - SECTION - invocation, emulator as variable: ##---------------------------------------------------------------------- # ${EMULATOR} -kernel ./qemu-rpi-kernel/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" -hda rpi.img # Start RaspberryPi in fully functional mode: ${EMULATOR} -kernel ./qemu-rpi-kernel/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda rpi.img ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ## 2017-09-08 FRI - this script copied from http://embedonix.com/articles/linux/emulating-raspberry-pi-on-linux/ ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - exit 0
The final token rpi.img
points to localhost:/home/user/Downloads/raspberrypi/2017-08-16-raspbian-stretch-lite.img
which we downloaded from https://www.raspberrypi.org/downloads/raspbian/. The working qemu invocation doesn't open qemu's native window, but puts to standard out that is the same shell in which qemu invoked, a couple of lines of output from the booting kernel image. Then using remmina we connect via "VNC server running on ::1:5900".
In summary shell script in latest figure successfully invokes qemu-system-arm 2.10.0 built from sources about August 2017, and boots up Raspbian Stretch lite image and kernel named kernel-qemu-4.4.34-jessie. Next figure is screenshot showing successful login, and last login message . . . though emulation was and is very slow on host system!
Figure x - emulated raspbian stretch lite screenshot, Remmina window
A shorter script to start raspberrypi kernel plus image, running in QEMU:
#!/bin/bash qemu-system-arm -kernel ./kernel-qemu-4.4.34-jessie -cpu arm1176 -m 256 -M versatilepb -serial stdio -append "root=/dev/sda2 rootfstype=ext4 rw" -hda ./2017-09-07-raspbian-stretch-lite.img -redir tcp:5022::22 -no-reboot exit 0
- 2017-12-12 WED -
An excerpt from qemu.org/download#source, on how to download, configure and compile latest QEMU sources:
" Build instructions To download and build QEMU 2.11.0-rc5: wget https://download.qemu.org/qemu-2.11.0-rc5.tar.xz tar xvJf qemu-2.11.0-rc5.tar.xz cd qemu-2.11.0-rc5 ./configure make To download and build QEMU from git: git clone git://git.qemu.org/qemu.git cd qemu git submodule init git submodule update --recursive ./configure make The latest development happens on the master branch. The stable trees are located in branches named stable-X.YY branch, where X.YY is the release version. "
↑ ↓ Embedded Linux Notes, focus on Rpi Linux Kernel Config
Ted looking into a couple of areas of embedded Linux, including custom kernel config for Rpi, the open source Buildroot project, Tiny-Core Linux and FreeRTOS. Ted also stashing some links to embedded studies notes on this wiki here:
↑ ↓ FreeRTOS Notes (Separate Article)
Ted to move this link to nn wiki article named 'FreeRTOS'. For now however Ted noting an openssl library named Wolfssl:
- https://freertos.org/FreeRTOS-Plus/WolfSSL/WolfSSL.shtml
- https://www.wolfssl.com/
- https://www.wolfssl.com/license/
NOTE 2017-12-10: this section 'embedded operating systems' to become a shorter list of major significant embedded OS's. As of 2017 winter Ted studying couple distributions of embedded Linux and FreeRTOS.
↑ ↓ Bootloader U-Boot
Ted noting after several custom Linux-for-Rpi kernel build attempts that Raspberry Pi board uses a bootloader typically other than GRUB, commonly uses U-boot. A first tutorial . . . also running into U-boot sources makefile calling a project script which fails to find gcc-6, though /usr/bin/gcc is a symlink to that newer gcc . . .
- http://etutorials.org/Linux+systems/embedded+linux+systems/Chapter+9.+Setting+Up+the+Bootloader/9.5+U-Boot/
- https://blog.christophersmart.com/2016/10/27/building-and-booting-upstream-linux-and-u-boot-for-raspberry-pi-23-arm-boards/
After installing manually some twenty or thirty gcc-6-arm-linux and gcc-6, gcc-7 files, and installing more modern version of build-essentials package from Ubuntu release codenamed 'bionic', can now build u-boot. Tail of messages from build process . . .
CC lib/strto.o CC lib/strmhz.o LD lib/built-in.o CC examples/standalone/stubs.o CC CC lib/strto.o CC lib/strmhz.o LD lib/built-in.o CC examples/standalone/stubs.o CC examples/standalone/hello_world.o LD examples/standalone/libstubs.o LD examples/standalone/hello_world OBJCOPY examples/standalone/hello_world.srec OBJCOPY examples/standalone/hello_world.bin LD u-boot OBJCOPY u-boot.srec OBJCOPY u-boot-nodtb.bin SYM u-boot.sym COPY u-boot.bin CFGCHK u-boot.cfg ted@rangari:/var/local/ted/projects/u-boot$ examples/standalone/hello_world.o LD examples/standalone/libstubs.o LD examples/standalone/hello_world OBJCOPY examples/standalone/hello_world.srec OBJCOPY examples/standalone/hello_world.bin LD u-boot OBJCOPY u-boot.srec OBJCOPY u-boot-nodtb.bin SYM u-boot.sym COPY u-boot.bin CFGCHK u-boot.cfg ted@rangari:/var/local/ted/projects/u-boot$
↑ ↓ LPC11U6x Development Board
- https://community.nxp.com/thread/389139
- http://www.embeddedartists.com/products/lpcxpresso/lpclink2.php
- https://os.mbed.com/teams/Semtech/code/SX1276TxContinuousWave/
↑ ↓ avr-libc
./avr-libc-1.8.0/include/avr/iom8.h:634:#if !defined(__AVR_LIBC_DEPRECATED_ENABLE__) ./avr-libc-1.8.0/include/avr/iom8.h:657:#endif /* !defined(__AVR_LIBC_DEPRECATED_ENABLE__) */ . . . 633 /* Deprecated items */ 634 #if !defined(__AVR_LIBC_DEPRECATED_ENABLE__) 635 636 #pragma GCC system_header 637 638 #pragma GCC poison SIG_INTERRUPT0 639 #pragma GCC poison SIG_INTERRUPT1 640 #pragma GCC poison SIG_OUTPUT_COMPARE2 641 #pragma GCC poison SIG_OVERFLOW2 642 #pragma GCC poison SIG_INPUT_CAPTURE1 643 #pragma GCC poison SIG_OUTPUT_COMPARE1A 644 #pragma GCC poison SIG_OUTPUT_COMPARE1B 645 #pragma GCC poison SIG_OVERFLOW1 646 #pragma GCC poison SIG_OVERFLOW0 647 #pragma GCC poison SIG_SPI 648 #pragma GCC poison SIG_UART_RECV 649 #pragma GCC poison SIG_UART_DATA 650 #pragma GCC poison SIG_UART_TRANS 651 #pragma GCC poison SIG_ADC 652 #pragma GCC poison SIG_EEPROM_READY 653 #pragma GCC poison SIG_COMPARATOR 654 #pragma GCC poison SIG_2WIRE_SERIAL 655 #pragma GCC poison SIG_SPM_READY 656 657 #endif /* !defined(__AVR_LIBC_DEPRECATED_ENABLE__) */
↑ ↓ Yocto References
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
↑ ↓ Mobile App Development On Linux
- https://www.raywenderlich.com/122189/introduction-to-open-source-swift-on-linux
- http://www.instructables.com/id/Creating-your-first-iOS-app/
- https://developer.apple.com/support/purchase-activation/ . . . required fees to Apple company
- 2018-10-12 FRI -
- 2018-01-15 MON -
- https://andrewmichaelsmith.com/2017/02/developing-an-ios-app-on-linux-in-2017/ . . . Developing an iOS app on Linux in 2017
- https://itsfoss.com/mount-iphone-ipad-ios-7-ubuntu-13-10/ . . . Ubuntu mount iPhone via libimobiledevice4 libimobiledevice-dev libimobiledevice-util and others
- https://beebom.com/how-use-iphone-with-linux/
↑ ↓ Android programming
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
↑ ↓ Toradex embedded ARM computers
Search for Toradex asymmetric core 'system on a module' board:
- 104446-colibri-arm-som-imx6ull-datasheet.pdf . . . looks like this may be only single core, not dual heterogeneous core
It looks like Colibri iMX7S and iMX7D are two-core and three-core processor based modules, with asymmetric cores to handle different kinds of data processing more efficiently,
- Toradex PN: 00391100 - Colibri iMX7 Dual 1GB | V1.1A
- Toradex PN: 01351101 - Iris carrier board
Looks like the Iris carrier board is a smaller form, less featured but more economical carrier board to support use of iMX7D/S systems on modules:
Software to install on this module:
Software projects and stacks to run on asymmetric core systems:
↑ ↓ Build U-boot and Linux kernel from source
↑ ↓ Arduino Development Kit and Documentation
Looking into Arduino boards as a means to configure an I2C protocol programmer . . .
Arduino Uno development board datasheet:
Arduino IDE software download:
Getting started:
A more specifically purposed interface and or programming board called 'Aardvark' . . .
FreeRTOS on Arduino development boards . . .
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
↑ ↓ Electronics
↑ ↓ Other Things To Explore
Here are some technical and science topics to explore, perhaps on a rainy day . . .
Machine learning:
3D Graphics, mathematics behind and programming:
Creative Commons and other Open Source licensed materials:
- Creative Commons licensed icons
- Flaticon.com . . . some freely usable icons, site layout worth review
Dublin Core:
- Dublin Core documents, referenced by Drupal default rss.xml feed page
- Dublin Core article on Wikipedia
- Dublin Core Generator
↑ ↓ edit point
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Javascript and JSON:
PC Video, Bochs VBE Extensions:
Perl programming related:
- https://perldoc.perl.org/perlpod.html . . . reference to
=cut
Perl mark-up or directive, plus lots more
Unix and Linux building blocks:
- nss, Name Service Switch
- "Burrows-Wheeler block sorting text compression algorithm", noted 2017-09-29 FRI from LFS 8.1 chapter 6.21 - TMH
- https://www.collabora.com/news-and-blog/blog/2017/03/13/kernel-debugging-with-qemu-overview-tools-available/ . . . kernel debugging and kmemleak
GNU Make book on-line . . .
Webvanta:
Virtual server image creation:
Github Users Sharing Their Work:
↑ ↓ edit point
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cryptography Scientists and Articles:
- Paul Kocher and Rambus
- Rambus memory and interfaces
- side-channel attack known as 'Row hammer', adjacent DRAM cells changed by frequent write operations
- Robert Morris internet work 1988
- Simile computer virus, metamorphic code
- Zmist metamorphic computer virus
ARM microcontroller related:
Operating system level programming:
Gputils PIC programming tools, W3C Jigsaw validator referenced at end of page
↑ ↓ Community, Culture, the World
- Morocco weather climate and agriculture . . .
↑ ↓ Human languages
- 2017-12-15 FRI -
- https://etohautakuva.deviantart.com/art/Taugedei-Abugida-Alphasyllabary-Cheatsheet-610277914
- http://langventure.strikingly.com/blog/hindi-abugida-in-action
- https://wsotw.weebly.com/blog/alphabets-abugidas-and-syllabaries
↑ ↓ plant and animal references
Searching Google and Amazon for bottom heat sources for seed germination:
" Seedfactor MET certified Seedling Heat Mat, Seedfactor Waterproof Durable Germination Station Heat Mat, Warm Hydroponic Heating Pad for Indoor Home Gardening Seed Starter(10" x 20") "
- https://en.wikipedia.org/wiki/Osmia_bicolor
- https://nativebeeology.com/mind-your-bees-and-gardens-2/carpenter-bee/ bufflehead mason bee
^ References
Reproducible builds, byte-wise reproducible software:
- http://events.linuxfoundation.org/sites/events/files/slides/reproducible-build-zoo-elc.pdf
- https://labs.riseup.net/code/issues/14455
Server Side services . . .
-
Apache2 configuration:
SSL
DNS
MYSQL
Coding standards:
C and C++:
- https://www.tutorialspoint.com/cplusplus/cpp_variable_types.htm "A variable can be declared multiple times but defined only once in a file, routine or code block."
Couple of MediaWiki and publishing issues to look into, which came up during wiki configuration:
- https://www.mediawiki.org/wiki/Manual:User_rights
- https://creativecommons.org/licenses/by-sa/3.0/
- https://choosealicense.com/
Some Hindi language and UTF-8 encoding references, to be factored to a dedicated wiki page later:
- http://jrgraphix.net/r/Unicode/0900-097F
- http://hindilearner.com/hindi_words_phrases/hindi_words_time_days.html
- http://www.learning-hindi.com/post/3072325702/lesson-91-%E0%A4%B8%E0%A4%AA-%E0%A4%A4-%E0%A4%B9-%E0%A4%95-%E0%A4%A6-%E0%A4%A8-days-of-the-week
Linux programs and utilities:
- https://fedoramagazine.org/17-alternatives-to-your-default-image-viewer-on-fedora/
- https://users.cs.cf.ac.uk/Dave.Marshall/C/node33.html
- resize2fs util to resize ext2, ext3, ext4 type partitions
- shell script 'runtest' provided by package dejagnu
Graphics Servers:
- https://www.reddit.com/r/linux/comments/4bq9kl/eli5_wayland_vs_mir_vs_x11/ X11 versus Wayland compositor
Computer hardware and firmware:
QEMU
- running virtual raspberrypi system using QEMU
- Azeria labs with more detailed steps to modifying image, not kernel, to boot fully in QEMU
- Dhruvvyas90 qemu-rpi-kernel
I2C