Adding kbd tag functionality to WordPress

The <kbd> tags on StackOverflow look awesome. They’re awesome for blogging about keyboard shortcuts. I’d been looking all over the place for these, while I actually stumbled upon Jimmy Peña’s implementation of the StackOverflow CSS for <kbd> tags. You can find his post here.

The custom css that makes this possible is this:

kbd {
padding:0.1em 0.6em;
border:1px solid #ccc;
font-size:11px;
font-family:Arial,Helvetica,sans-serif;
background-color:#f7f7f7;
color:#333;
-moz-box-shadow:0 1px 0px rgba(0, 0, 0, 0.2),0 0 0 2px #ffffff inset;
-webkit-box-shadow:0 1px 0px rgba(0, 0, 0, 0.2),0 0 0 2px #ffffff inset;
box-shadow:0 1px 0px rgba(0, 0, 0, 0.2),0 0 0 2px #ffffff inset;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
display:inline-block;
margin:0 0.1em;
text-shadow:0 1px 0 #fff;
line-height:1.4;
white-space:nowrap;
}

Once added to your css/Wordpress theme, you can start using the kdb tags, which look like these in actual webpage:

Alt+F2

To use these in WordPress, you can do without modifying your theme, if you use a plugin named My Custom CSS.

You can simply paste the CSS code into a box in the plugin’s options page, and straightaway start using it.


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Combining multiple formulae in a single cell, in Excel

An example is provided below:

="ABSTRACT OF CERTIFICATES ISSUED IN THE MONTH OF " &amp;TEXT(TODAY(),"MMMM") &amp;" " &amp;TEXT(TODAY(),"YYYY")

This displays the following:

ABSTRACT OF CERTIFICATES ISSUED IN THE MONTH OF May 2013

Note that Formulae can be combined by using Ampersands (&) and spaces in between them. The cell has to begin with the equals sign (=). Text should be quoted in double quotes. Formulae can be grouped into parentheses.


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.
Midnight commander (mc) shows garbled text characters instead of graphics

Midnight commander (mc) shows garbled text characters instead of graphics

On a Debian ssh shell running via Putty on Windows 8, I started getting this weird display on midnight commander:

MWSnap009 2013-05-06, 21_29_08

 

To fix this,

In Putty>Load Session

Putty>Window>Translation>Remote character set>UTF8

MWSnap010 2013-05-06, 21_29_55

Also export the following variable in your .bashrc file:

NCURSES_NO_UTF8_ACS=1

Save the session. Exit and restart Putty. mc is fixed now.

MWSnap011 2013-05-06, 21_31_41

Credits: 
http://www.andremiller.net/content/getting-midnight-commander-line-drawing-work-putty

 


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Parse text files with assignments, and get the value – Bash

Suppose you have a text file containing the following:

strings=hello world

and you wanted to use the value of strings, which is “hello world” in your script

You can parse it with the following:

grep '^strings=' test | sed 's/strings=//g'

So the generic format is:

grep '^variablename=' filename | sed 's/variablename=//g'

The grep searches for a string beginning with ‘strings=’, in the file ‘test’, and outputs the following:

$grep '^strings=' test
strings=hello world

Next we have to remove the initial assignment part upto and including the ‘=’ sign, this is done by piping the output of grep, to sed.

Now the sed line substitutes the string “strings=” with an empty string. The substitution is done globally. Finally sed outputs just the value of the assigned variable.

Practical example:

I wanted to use the main User directory on the server, to make my backups more generic. I know that the file /etc/imscp/imscp.conf contains the following line:

USER_HOME_DIR = /var/www/virtual

So what I want is to get /var/www/virtual from this file, removing the assignment and spaces.

The solution is:

grep -i 'USER_HOME_DIR' imscp/imscp.conf | sed 's/USER_HOME_DIR[ ]=[ ]//'

which outputs:

/var/www/virtual

without the initial spaces. A space within a square brackets matches any number of spaces in the expression.

However, if you want to use these values in variables, you need to make minor adjustments to take care of variable escaping:

apache_home_var="USER_HOME_DIR"
apache_conf_file=/etc/imscp/imscp.conf
grep -i "$apache_home_var" "$apache_conf_file" | sed 's/'$apache_home_var'[ ]=[ ]//'

 


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Wrap a php parser file in WordPress theme

I created a form parser for a WordPress site that would parse the contents of a posted form, and display a success page. I used pure php instead of trying to use a WordPress template or theme. As a downside, the displayed page would not show any WordPress theme.

So I found a solution to import the theme for the php, and this is by including the theme’s header and footer in the php file.

The complete form parser is included below:

<?php

// If title is not displayed before loading the header, WordPress displays "Page not found" as the title

echo "<head>
<title>Your form has been submitted</title>
</head>";

// Include the Main WordPress blog header
include $_SERVER['DOCUMENT_ROOT']."/wp-blog-header.php";

// Include the specific theme header you need
include $_SERVER['DOCUMENT_ROOT']."/wp-content/themes/studiopress/genesis/header.php";

// Your custom code STARTS here

// My code includes two functions. 
// The first part is the background activity which parses the form, checks for errors and then mails it if there arent any errors
// The second part is html code that is displayed to the user to inform them that the form has been submitted.

if(isset($_POST['email'])) {

    // EDIT THE 2 LINES BELOW AS REQUIRED
    $email_to = "[email protected]";
    $email_subject = "Someone has submitted feedback on your website";

    function died($error) {
        // your error code can go here
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";
        die();
    }

    // validation expected data exists
    if(!isset($_POST['first_name']) ||
        !isset($_POST['last_name']) ||
        !isset($_POST['email']) ||
        !isset($_POST['telephone']) ||
        !isset($_POST['comments'])) {
        died('We are sorry, but there appears to be a problem with the form you submitted.');       
    }

    $first_name = $_POST['first_name']; // required
    $last_name = $_POST['last_name']; // required
    $email_from = $_POST['email']; // required
    $telephone = $_POST['telephone']; // not required
    $comments = $_POST['comments']; // required

    $error_message = "";
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  if(!preg_match($email_exp,$email_from)) {
    $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  }
    $string_exp = "/^[A-Za-z .'-]+$/";
  if(!preg_match($string_exp,$first_name)) {
    $error_message .= 'The First Name you entered does not appear to be valid.<br />';
  }
  if(!preg_match($string_exp,$last_name)) {
    $error_message .= 'The Last Name you entered does not appear to be valid.<br />';
  }
  if(strlen($comments) < 2) {
    $error_message .= 'The Comments you entered do not appear to be valid.<br />';
  }
  if(strlen($error_message) > 0) {
    died($error_message);
  }
    $email_message = "Form details below.\n\n";

    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }

    $email_message .= "First Name: ".clean_string($first_name)."\n";
    $email_message .= "Last Name: ".clean_string($last_name)."\n";
    $email_message .= "Email: ".clean_string($email_from)."\n";
    $email_message .= "Telephone: ".clean_string($telephone)."\n";
    $email_message .= "Comments: ".clean_string($comments)."\n";

// create email headers

$headers = 'From: [email protected]'."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);  
?>

<?php
// Second part starts.
// This part is displayed.

echo "
<h2>
Your form has been submitted
</h2>";

echo "<h4>Dear $first_name,</h4>
<p>Your feedback has been received by us and will be forwarded to the site administrator. You will receive your login details or a response soon.</p>";

echo "<br /><br /><br /><br /><br /><br /><br />
Click <a href=\"http://www.site.com\">here</a> to return to the site.";
// END of custom code

?> 

<?php
}
include $_SERVER['DOCUMENT_ROOT']."/wp-content/themes/studiopress/genesis/footer.php";
?>[/code]
The following is the actual form:
You can use the following form to contact the administrator of this site:

<form action="../phpscripts/send_form_email1.php" method="post" name="contactform">Note: If you're requesting login rights, please add information on how you're related to the family.&nbsp;
<table width="450px">
<tbody>
<tr>
<td valign="top"><label for="first_name">First Name *</label></td>
<td valign="top"><input type="text" maxlength="50" name="first_name" size="30" /></td>
</tr>
<tr>
<td valign="top"><label for="last_name">Last Name *</label></td>
<td valign="top"><input type="text" maxlength="50" name="last_name" size="30" /></td>
</tr>
<tr>
<td valign="top"><label for="email">Email Address *</label></td>
<td valign="top"><input type="text" maxlength="80" name="email" size="30" /></td>
</tr>
<tr>
<td valign="top"><label for="telephone">Telephone Number</label></td>
<td valign="top"><input type="text" maxlength="30" name="telephone" size="30" /></td>
</tr>
<tr>
<td valign="top"><label for="comments">Comments *</label></td>
<td valign="top"><textarea cols="30" maxlength="1000" name="comments" rows="6"></textarea></td>
</tr>
<tr>
<td></td>
<td style="text-align: left;" colspan="2"><input type="submit" value="Submit" /></td>
</tr>
</tbody>
</table>
</form>[/code]
Version 0.2

I made it generic and detect the proper active theme:
&lt;?php

// If title is not displayed before loading the header, WordPress displays "Page not found" as the title

echo "&lt;head&gt;
&lt;title&gt;Your feedback has been submitted&lt;/title&gt;
&lt;/head&gt;";

// Include the Main WordPress blog header
include $_SERVER['DOCUMENT_ROOT']."/wp-blog-header.php";

//bloginfo(‘template_url’);
$homeurl=home_url();
$ddir= get_bloginfo( 'template_directory');
$current_theme_relative_path=substr_replace($ddir, "", 0, strlen($homeurl));
//echo "&lt;br/&gt;The relative path to the currently active theme is ".$newss;

// Include the specific theme header you need
//echo "Full path to header is ".$_SERVER['DOCUMENT_ROOT'].$newss."/header.php";
include $_SERVER['DOCUMENT_ROOT'].$current_theme_relative_path."/header.php";

// Your custom code STARTS here

// My code includes two functions. 
// The first part is the background activity which parses the form, checks for errors and then mails it if there arent any errors
// The second part is html code that is displayed to the user to inform them that the form has been submitted.

if(isset($_POST['email'])) {

    // EDIT THE 2 LINES BELOW AS REQUIRED
    $email_to = "[email protected]";
    $email_subject = "Someone has submitted feedback on your website";

    function died($error) {
        // your error code can go here
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.&lt;br /&gt;&lt;br /&gt;";
        echo $error."&lt;br /&gt;&lt;br /&gt;";
        echo "Please go back and fix these errors.&lt;br /&gt;&lt;br /&gt;";
        die();
    }

    // validation expected data exists
    if(!isset($_POST['first_name']) ||
        !isset($_POST['last_name']) ||
        !isset($_POST['email']) ||
        !isset($_POST['telephone']) ||
        !isset($_POST['comments'])) {
        died('We are sorry, but there appears to be a problem with the form you submitted.');       
    }

    $first_name = $_POST['first_name']; // required
    $last_name = $_POST['last_name']; // required
    $email_from = $_POST['email']; // required
    $telephone = $_POST['telephone']; // not required
    $comments = $_POST['comments']; // required

    $error_message = "";
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  if(!preg_match($email_exp,$email_from)) {
    $error_message .= 'The Email Address you entered does not appear to be valid.&lt;br /&gt;';
  }
    $string_exp = "/^[A-Za-z .'-]+$/";
  if(!preg_match($string_exp,$first_name)) {
    $error_message .= 'The First Name you entered does not appear to be valid.&lt;br /&gt;';
  }
  if(!preg_match($string_exp,$last_name)) {
    $error_message .= 'The Last Name you entered does not appear to be valid.&lt;br /&gt;';
  }
  if(strlen($comments) &lt; 2) {
    $error_message .= 'The Comments you entered do not appear to be valid.&lt;br /&gt;';
  }
  if(strlen($error_message) &gt; 0) {
    died($error_message);
  }
    $email_message = "Form details below.\n\n";

    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }

    $email_message .= "First Name: ".clean_string($first_name)."\n";
    $email_message .= "Last Name: ".clean_string($last_name)."\n";
    $email_message .= "Email: ".clean_string($email_from)."\n";
    $email_message .= "Telephone: ".clean_string($telephone)."\n";
    $email_message .= "Comments: ".clean_string($comments)."\n";

// create email headers

$headers = 'From: [email protected]'."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);  
?&gt;

&lt;?php
// Second part starts.
// This part is displayed.

echo "
&lt;h2&gt;
Your feedback/request has been submitted
&lt;/h2&gt;";

echo "&lt;h4&gt;Dear $first_name,&lt;/h4&gt;
&lt;p&gt;Your feedback has been received by us and will be forwarded to the site administrator. 
&lt;br/&gt;
You will receive your login details or a response soon.&lt;/p&gt;";

echo "&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
Click &lt;a href=\"http://www.vettathu.com\"&gt;here&lt;/a&gt; to return to the site.";
// END of custom code

//Useful wordpress functions
/*
echo "The current theme name is".get_current_theme()."&lt;br/&gt;";

echo "&lt;br/&gt;";
echo "The dir is ".$ddir."&lt;br/&gt;";

echo "The home url is".$homeurl."&lt;br/&gt;";
*/
//$newdirst=str_replace($homeurl,".",$temp_ddir);

/*
echo "Length of whole is ".strlen($ddir);
echo "Length of substring is ".strlen($homeurl);

*/

?&gt; 

&lt;?php
}
include $_SERVER['DOCUMENT_ROOT'].$current_theme_relative_path."/footer.php";

?&gt;

 


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Drawing concentric circles in Fireworks (scientifically)

You need two circles, one larger than the other, with different fill colors.

You can drag out an ellipse holding the Ctrl key to make it a circle. Note that the height and width have to be equal for it to be a circle.

Note the width of the larger circle, Let it be X

Let the width of the smaller circle be Y

Fit the canvas to the width of the larger circle.

Now, the position of the Left of larger circle is 0, and the right of it (Left+Width=0+width) is equal to its width.

Calculate position of left of smaller circle as follows:

Left [Smaller]=X/2 -Y/2

Top[Smaller]=Left

If you need to position text at the exact centre of the smaller circle, you’d do it like this:

Left of Text=Left of smaller circle+Width of Smaller circle/2 – Width of Text/2

Height of Text=Top of Smaller circle+Height of smaller circle/2 – Height of Text/2

 


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Implementing a “Contact the author” form for WordPress

You dont need bloated plugins for implementing a comment system for WordPress.

I use the following simple prototype for a comment system on WordPress.

The first part is a form using tables and form fields to take care of the user input:

You can use the following form to contact the author:

Next is the php script which runs on the server and takes care of mailing the form data to a specified email address:

<?php
if(isset($_POST['email'])) {

    // EDIT THE 2 LINES BELOW AS REQUIRED
    $email_to = "[email protected]";
    $email_subject = "Someone has submitted feedback on your website";

    function died($error) {
        // your error code can go here
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";
        die();
    }

    // validation expected data exists
    if(!isset($_POST['first_name']) ||
        !isset($_POST['last_name']) ||
        !isset($_POST['email']) ||
        !isset($_POST['telephone']) ||
        !isset($_POST['comments'])) {
        died('We are sorry, but there appears to be a problem with the form you submitted.');       
    }

    $first_name = $_POST['first_name']; // required
    $last_name = $_POST['last_name']; // required
    $email_from = $_POST['email']; // required
    $telephone = $_POST['telephone']; // not required
    $comments = $_POST['comments']; // required

    $error_message = "";
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  if(!preg_match($email_exp,$email_from)) {
    $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  }
    $string_exp = "/^[A-Za-z .'-]+$/";
  if(!preg_match($string_exp,$first_name)) {
    $error_message .= 'The First Name you entered does not appear to be valid.<br />';
  }
  if(!preg_match($string_exp,$last_name)) {
    $error_message .= 'The Last Name you entered does not appear to be valid.<br />';
  }
  if(strlen($comments) < 2) {
    $error_message .= 'The Comments you entered do not appear to be valid.<br />';
  }
  if(strlen($error_message) > 0) {
    died($error_message);
  }
    $email_message = "Form details below.\n\n";

    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }

    $email_message .= "First Name: ".clean_string($first_name)."\n";
    $email_message .= "Last Name: ".clean_string($last_name)."\n";
    $email_message .= "Email: ".clean_string($email_from)."\n";
    $email_message .= "Telephone: ".clean_string($telephone)."\n";
    $email_message .= "Comments: ".clean_string($comments)."\n";

// create email headers

$headers = 'From: [email protected]'."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);  
?>

<!-- include your own success html here -->

Thank you for contacting us. We will be in touch with you very soon.

<?php

}

?>

Note that it includes certain checks to see if mandatory fields have been filled in.


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Emacs complete command list

Emacs Commands List 

C = Control
M = Meta = Alt|Esc

Basics
C-x C-f “find” file i.e. open/create a file in buffer
C-x C-s save the file
C-x C-w write the text to an alternate name
C-x C-v find alternate file
C-x i insert file at cursor position
C-x b create/switch buffers
C-x C-b show buffer list
C-x k kill buffer
C-z suspend emacs
C-X C-c close down emacs

Basic movement
C-f forward char
C-b backward char
C-p previous line
C-n next line
M-f forward one word
M-b backward one word
C-a beginning of line
C-e end of line
C-v one page up
M-v scroll down one page
M-< beginning of text
M-> end of text

Editing
M-n repeat the following command n times
C-u repeat the following command 4 times
C-u n repeat n times
C-d delete a char
M-d delete word
M-Del delete word backwards
C-k kill line

C-Space Set beginning mark (for region marking for example)
C-W “kill” (delete) the marked region region
M-W copy the marked region
C-y “yank” (paste) the copied/killed region/line
M-y yank earlier text (cycle through kill buffer)
C-x C-x exchange cursor and mark

C-t transpose two chars
M-t transpose two words
C-x C-t transpose lines
M-u make letters uppercase in word from cursor position to end
M-c simply make first letter in word uppercase
M-l opposite to M-u

Important
C-g quit the running/entered command
C-x u undo previous action
M-x revert-buffer RETURN (insert like this) undo all changes since last save
M-x recover-file RETURN Recover text from an autosave-file
M-x recover-session RETURN if you edited several files

Online-Help
C-h c which command does this keystroke invoke
C-h k which command does this keystroke invoke and what does it do?
C-h l what were my last 100 typed keys
C-h w what key-combo does this command have?
C-h f what does this function do
C-h v what’s this variable and what is it’s value
C-h b show all keycommands for this buffer
C-h t start the emacs tutorial
C-h i start the info reader
C-h C-k start up info reader and go to a certain key-combo point
C-h F show the emacs FAQ
C-h p show infos about the Elisp package on this machine

Search/Replace
C-s Search forward
C-r search backward
C-g return to where search started (if you are still in search mode)
M-% query replace

Space or y replace this occurence
Del or n don’t replace
only replace this and exit (replace)
replace and pause (resume with Space or y)
replace all following occurences
back to previous match
RETURN or q quit replace


Search/Replace with regular expressions
Characters to use in regular expressions:
beginning of line
end of line
single char
.* group or null of chars
\< beginning of a word
\> end of a word
[] every char inside the backets (for example [a-z] means every small letter)

M C-s RETURN search for regular expression forward
M C-r RETURN search for regular expression backward
M C-s incremental search
C-s repeat incremental search
M C-r incremental search backwards
C-r repeat backwards
M-x query-replace-regexp search and replace

Window-Commands
C-x 2 split window vertically
C-x o change to other window
C-x 0 delete window
C-x 1 close all windows except the one the cursors in
C-x ^ enlarge window
M-x shrink-window command says it 😉
M C-v scroll other window
C-x 4 f find file in other window
C-x 4 o change to other window
C-x 4 0 kill buffer and window
C-x 5 2 make new frame
C-x 5 f find file in other frame
C-x 5 o change to other frame
C-x 5 0 close this frame

Bookmark commands
C-x r m set a bookmark at current cursor pos
C-x r b jump to bookmark
M-x bookmark-rename says it
M-x bookmark-delete 
M-x bookmark-save ”
C-x r l list bookmarks

mark bookmark for deletion
rename bookmark
save all listed bookmarks
show bookmark the cursor is over
mark bookmarks to be shown in multiple window
show marked bookmarks (or the one the cursor is over)
toggle listing of the corresponding paths
” path to this file
delete marked bookmarks
Del ?
quit bookmark list


M-x bookmark-write write all bookmarks in given file
M-x bookmark-load load bookmark from given file

Shell
M-x shell starts shell modus
C-c C-c same as C-c under unix (stop running job)
C-d delete char forward
C-c C-d Send EOF
C-c C-z suspend job (C-z under unix)
M-p show previous commands

DIRectory EDitor (dired)
C-x d start up dired
(large C) copy
mark for erase
delete right away
e or f open file or directory
reread directory structure from file
change group permissions (chgrp)
delete line from listing on screen (don’t actually delete)
mark with *
move to next line
open file in other window and go there
C-o open file in other window but don’t change there
print file
quit dired
do query-replace in marked files
rename file
remove mark
view file content
delete files marked with D
compress file
M-Del remove all marks (whatever kind)
mark backup files (name~ files) for deletion
mark auto-save files (#name#) for deletion
*/ mark directory with * (C-u * removes that mark again)
compare this file with marked file
M-= compare this file with it’s backup file
apply shell command to this file
M-} change to the next file marked with * od D
M-{ ” previous ”
% d mark files described through regular expression for deletion
% m ” (with *)
create directory
changed to next dir
change to previous dir
toggle between sorting by name or date

Maybe into this category also fits this command:
M-x speedbar starts up a separate window with a directory view

Telnet
M-x telnet starts up telnet-modus
C-d either delete char or send EOF
C-c C-c stop running job (similar to C-c under unix)
C-c C-d send EOF
C-c C-o clear output of last command
C-c C-z suspend execution of command
C-c C-u kill line backwards
M-p recall previous command

Text
Works only in text mode
M-s center line
M-S center paragraph
M-x center-region name says

Macro-commands
C-x ( start macro definition
C-x ) end of macro definition
C-x e execute last definied macro
M-n C-x e execute last defined macro n times
M-x name-last-kbd-macro give name to macro (for saving)
M-x insert-keyboard-macro save named macro into file
M-x load-file load macro
M-x macroname execute macroname

Programming
M C-\ indent region between cursor and mark
M-m move to first (non-space) char in this line
M-^ attach this line to previous
M-; formatize and indent comment
C, C++ and Java Modes
M-a beginning of statement
M-e end of statement
M C-a beginning of function
M C-e end of function
C-c RETURN Set cursor to beginning of function and mark at the end
C-c C-q indent the whole function according to indention style
C-c C-a toggle modus in which after electric signs (like {}:’;./*) emacs does the indention
C-c C-d toggle auto hungry mode in which emacs deletes groups of spaces with one del-press
C-c C-u go to beginning of this preprocessor statement
C-c C-c comment out marked area
More general (I guess)
M-x outline-minor-mode collapses function definitions in a file to a mere {…}
M-x show-subtree If you are in one of the collapsed functions, this un-collapses it
In order to achive some of the feats coming up now you have to run etags *.c *.h *.cpp (or what ever ending you source files have) in the source directory
M-. (Thats Meta dot) If you are in a function call, this will take you to it’s definition
M-x tags-search ENTER Searches through all you etaged
M-, (Meta comma) jumps to the next occurence for tags-search
M-x tags-query-replace yum. This lets you replace some text in all the tagged files

GDB (Debugger)
M-x gdb starts up gdm in an extra window

Version Control
C-x v d show all registered files in this dir
C-x v = show diff between versions
C-x v u remove all changes since last checkin
C-x v ~ show certain version in different window
C-x v l print log
C-x v i mark file for version control add
C-x v h insert version control header into file
C-x v r check out named snapshot
C-x v s create named snapshot
C-x v a create changelog file in gnu-style



You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Simple curl based download manager

It resumes downloads and loops till the file is downloaded. On  the anvil-A conf file which can be parsed for list of urls.

It even shuts down after a predetermined interval.

#!/bin/bash
url="$1"
#export CURLOPT_CONNECTTIMEOUT=200000
#export CURLOPT_TIMEOUT=200000

#See if the last char in path is a slash. Else add it
#lchr=`expr substr $targetDIR ${#targetDIR} 1`
#lchr=${targetDIR#${targetDIR%?}}
minstoshutdown=120

sudo shutdown -h +$minstoshutdown &

sleeptime=10
syntax="\
Syntax:
cdown [URL]"

if [ "$url" = "" ]
then
echo "You need to url a file to upload!"
echo $syntax
exit 1
fi

coman="curl -C - -J -O $url"
echo "Command is :"
echo $coman

excode=1
text="Starting download...."
tries=0

while [ "$excode" -ne "0" ];
do
echo
let tries++
echo $text$tries
eval $coman

excode=$?

echo
echo "Exited with code - $excode"
echo
if [ "$excode" -eq "6" ]
then
echo "Your internet connection seems to be down!"
fi
echo "Waiting $sleeptime secs before trying again..."
sleep $sleeptime;
text="Restarting download...Attempt No: "
done

if [ "$excode" -eq "0" ]
then
echo "Completed upload after $tries tries"
else
echo "Tried $tries times. Upload was interrupted."
fi[/code]
 


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Compiling statically linked Busybox for Android (arm) devices

******* INSTRUCTIONS (updated 09 Apr 2017 ) *******
Step 1: Get and prepare toolchain and configure environment:

mkdir ~/aarch64-toolchain/
wget http://releases.linaro.org/components/toolchain/binaries/latest-6/aarch64-linux-gnu/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz
tar xf gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz
export PATH=$PATH:~/aarch64-toolchain/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin

Step 2: Get source for busybox and install

cd aarch64-toolchain/
wget https://busybox.net/downloads/snapshots/busybox-snapshot.tar.bz2
export PATH=$PATH:~/aarch64-toolchain/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/
tar xf busybox-snapshot.tar.bz2 
cd busybox
export CROSS_COMPILE="/root/aarch64-toolchain/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-"
sudo apt-get install libncurses-dev
make ARCH=arm64 CROSS_COMPILE="$CROSS_COMPILE" menuconfig
make ARCH=arm64 CROSS_COMPILE="$CROSS_COMPILE" 

busybox should now be available in this directory. Let’s test it:

file busybox
busybox: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, for GNU/Linux 3.7.0, BuildID[sha1]=b91832a884c7ab10fed01b5b186128cc842e68c5, stripped

There you go-a static busybox for your Android device

Download “Busybox 1.27.0” busybox.zip – Downloaded 5 times – 1 MB

******* INSTRUCTIONS (updated 06 Aug 2014 ) *******

apt-get install ia32-libs ia32-libs-gtk
wget https://sourcery.mentor.com/GNUToolchain/kbattach150/getlibs-all.deb
sudo dpkg -i getlibs-all.deb
getlibs -p xulrunner-1.9.2
wget https://sourcery.mentor.com/GNUToolchain/package12815/public/arm-none-linux-gnueabi/arm-2014.05-29-arm-none-linux-gnueabi.bin
/bin/sh arm-2014.05-29-arm-none-linux-gnueabi.bin -console
export PATH=/root/MentorGraphics/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin:$PATH

wget http://www.busybox.net/downloads/snapshots/busybox-20140805.tar.bz2
tar vjxf busybox-20140805.tar.bz2
cd busybox/
export CROSS_COMPILE="/root/MentorGraphics/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi-"
make ARCH=arm CROSS_COMPILE="$CROSS_COMPILE" menuconfig
make

Working config file:

#
# Automatically generated make config: don't edit
# Busybox version: 1.23.0.git
# Wed Aug  6 06:34:13 2014
#
CONFIG_HAVE_DOT_CONFIG=y

#
# Busybox Settings
#

#
# General Configuration
#
CONFIG_DESKTOP=y
# CONFIG_EXTRA_COMPAT is not set
CONFIG_INCLUDE_SUSv2=y
# CONFIG_USE_PORTABLE_CODE is not set
CONFIG_PLATFORM_LINUX=y
CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set
# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
CONFIG_SHOW_USAGE=y
CONFIG_FEATURE_VERBOSE_USAGE=y
CONFIG_FEATURE_COMPRESS_USAGE=y
CONFIG_FEATURE_INSTALLER=y
CONFIG_INSTALL_NO_USR=y
# CONFIG_LOCALE_SUPPORT is not set
CONFIG_UNICODE_SUPPORT=y
# CONFIG_UNICODE_USING_LOCALE is not set
# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set
CONFIG_SUBST_WCHAR=63
CONFIG_LAST_SUPPORTED_WCHAR=767
# CONFIG_UNICODE_COMBINING_WCHARS is not set
# CONFIG_UNICODE_WIDE_WCHARS is not set
# CONFIG_UNICODE_BIDI_SUPPORT is not set
# CONFIG_UNICODE_NEUTRAL_TABLE is not set
# CONFIG_UNICODE_PRESERVE_BROKEN is not set
# CONFIG_PAM is not set
CONFIG_LONG_OPTS=y
CONFIG_FEATURE_DEVPTS=y
# CONFIG_FEATURE_CLEAN_UP is not set
CONFIG_FEATURE_UTMP=y
CONFIG_FEATURE_WTMP=y
CONFIG_FEATURE_PIDFILE=y
CONFIG_PID_FILE_PATH="/var/run"
CONFIG_FEATURE_SUID=y
CONFIG_FEATURE_SUID_CONFIG=y
CONFIG_FEATURE_SUID_CONFIG_QUIET=y
# CONFIG_SELINUX is not set
# CONFIG_FEATURE_PREFER_APPLETS is not set
CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
CONFIG_FEATURE_SYSLOG=y
# CONFIG_FEATURE_HAVE_RPC is not set

#
# Build Options
#
CONFIG_STATIC=y
# CONFIG_PIE is not set
# CONFIG_NOMMU is not set
# CONFIG_BUILD_LIBBUSYBOX is not set
# CONFIG_FEATURE_INDIVIDUAL is not set
# CONFIG_FEATURE_SHARED_BUSYBOX is not set
CONFIG_LFS=y
CONFIG_CROSS_COMPILER_PREFIX=""
CONFIG_SYSROOT=""
CONFIG_EXTRA_CFLAGS=""
CONFIG_EXTRA_LDFLAGS=""
CONFIG_EXTRA_LDLIBS=""

#
# Debugging Options
#
# CONFIG_DEBUG is not set
# CONFIG_DEBUG_PESSIMIZE is not set
# CONFIG_UNIT_TEST is not set
# CONFIG_WERROR is not set
CONFIG_NO_DEBUG_LIB=y
# CONFIG_DMALLOC is not set
# CONFIG_EFENCE is not set

#
# Installation Options ("make install" behavior)
#
CONFIG_INSTALL_APPLET_SYMLINKS=y
# CONFIG_INSTALL_APPLET_HARDLINKS is not set
# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set
# CONFIG_INSTALL_APPLET_DONT is not set
# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set
# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set
# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set
CONFIG_PREFIX="./_install"

#
# Busybox Library Tuning
#
CONFIG_FEATURE_SYSTEMD=y
CONFIG_FEATURE_RTMINMAX=y
CONFIG_PASSWORD_MINLEN=6
CONFIG_MD5_SMALL=1
CONFIG_SHA3_SMALL=1
CONFIG_FEATURE_FAST_TOP=y
# CONFIG_FEATURE_ETC_NETWORKS is not set
CONFIG_FEATURE_USE_TERMIOS=y
CONFIG_FEATURE_EDITING=y
CONFIG_FEATURE_EDITING_MAX_LEN=1024
# CONFIG_FEATURE_EDITING_VI is not set
CONFIG_FEATURE_EDITING_HISTORY=255
CONFIG_FEATURE_EDITING_SAVEHISTORY=y
# CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set
CONFIG_FEATURE_REVERSE_SEARCH=y
CONFIG_FEATURE_TAB_COMPLETION=y
# CONFIG_FEATURE_USERNAME_COMPLETION is not set
CONFIG_FEATURE_EDITING_FANCY_PROMPT=y
# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set
CONFIG_FEATURE_NON_POSIX_CP=y
# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set
CONFIG_FEATURE_COPYBUF_KB=4
CONFIG_FEATURE_SKIP_ROOTFS=y
# CONFIG_MONOTONIC_SYSCALL is not set
CONFIG_IOCTL_HEX2STR_ERROR=y
CONFIG_FEATURE_HWIB=y

#
# Applets
#

#
# Archival Utilities
#
CONFIG_FEATURE_SEAMLESS_XZ=y
CONFIG_FEATURE_SEAMLESS_LZMA=y
CONFIG_FEATURE_SEAMLESS_BZ2=y
CONFIG_FEATURE_SEAMLESS_GZ=y
# CONFIG_FEATURE_SEAMLESS_Z is not set
# CONFIG_AR is not set
# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
# CONFIG_FEATURE_AR_CREATE is not set
# CONFIG_UNCOMPRESS is not set
CONFIG_GUNZIP=y
CONFIG_BUNZIP2=y
CONFIG_UNLZMA=y
# CONFIG_FEATURE_LZMA_FAST is not set
CONFIG_LZMA=y
CONFIG_UNXZ=y
CONFIG_XZ=y
CONFIG_BZIP2=y
CONFIG_CPIO=y
CONFIG_FEATURE_CPIO_O=y
CONFIG_FEATURE_CPIO_P=y
# CONFIG_DPKG is not set
# CONFIG_DPKG_DEB is not set
# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
CONFIG_GZIP=y
CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
CONFIG_GZIP_FAST=0
CONFIG_LZOP=y
# CONFIG_LZOP_COMPR_HIGH is not set
CONFIG_RPM=y
CONFIG_RPM2CPIO=y
CONFIG_TAR=y
CONFIG_FEATURE_TAR_CREATE=y
CONFIG_FEATURE_TAR_AUTODETECT=y
CONFIG_FEATURE_TAR_FROM=y
CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y
CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY=y
CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
CONFIG_FEATURE_TAR_LONG_OPTIONS=y
CONFIG_FEATURE_TAR_TO_COMMAND=y
CONFIG_FEATURE_TAR_UNAME_GNAME=y
CONFIG_FEATURE_TAR_NOPRESERVE_TIME=y
# CONFIG_FEATURE_TAR_SELINUX is not set
CONFIG_UNZIP=y

#
# Coreutils
#
CONFIG_BASENAME=y
CONFIG_CAT=y
CONFIG_DATE=y
CONFIG_FEATURE_DATE_ISOFMT=y
# CONFIG_FEATURE_DATE_NANO is not set
CONFIG_FEATURE_DATE_COMPAT=y
CONFIG_HOSTID=y
CONFIG_ID=y
CONFIG_GROUPS=y
CONFIG_SHUF=y
CONFIG_TEST=y
CONFIG_FEATURE_TEST_64=y
CONFIG_TOUCH=y
CONFIG_FEATURE_TOUCH_NODEREF=y
CONFIG_FEATURE_TOUCH_SUSV3=y
CONFIG_TR=y
CONFIG_FEATURE_TR_CLASSES=y
CONFIG_FEATURE_TR_EQUIV=y
CONFIG_UNLINK=y
CONFIG_BASE64=y
CONFIG_WHO=y
CONFIG_USERS=y
CONFIG_CAL=y
CONFIG_CATV=y
CONFIG_CHGRP=y
CONFIG_CHMOD=y
CONFIG_CHOWN=y
CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y
CONFIG_CHROOT=y
CONFIG_CKSUM=y
CONFIG_COMM=y
CONFIG_CP=y
CONFIG_FEATURE_CP_LONG_OPTIONS=y
CONFIG_CUT=y
CONFIG_DD=y
CONFIG_FEATURE_DD_SIGNAL_HANDLING=y
CONFIG_FEATURE_DD_THIRD_STATUS_LINE=y
CONFIG_FEATURE_DD_IBS_OBS=y
CONFIG_DF=y
CONFIG_FEATURE_DF_FANCY=y
CONFIG_DIRNAME=y
CONFIG_DOS2UNIX=y
CONFIG_UNIX2DOS=y
CONFIG_DU=y
CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y
CONFIG_ECHO=y
CONFIG_FEATURE_FANCY_ECHO=y
CONFIG_ENV=y
CONFIG_FEATURE_ENV_LONG_OPTIONS=y
CONFIG_EXPAND=y
CONFIG_FEATURE_EXPAND_LONG_OPTIONS=y
CONFIG_EXPR=y
CONFIG_EXPR_MATH_SUPPORT_64=y
CONFIG_FALSE=y
CONFIG_FOLD=y
CONFIG_FSYNC=y
CONFIG_HEAD=y
CONFIG_FEATURE_FANCY_HEAD=y
CONFIG_INSTALL=y
CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y
CONFIG_LN=y
CONFIG_LOGNAME=y
CONFIG_LS=y
CONFIG_FEATURE_LS_FILETYPES=y
CONFIG_FEATURE_LS_FOLLOWLINKS=y
CONFIG_FEATURE_LS_RECURSIVE=y
CONFIG_FEATURE_LS_SORTFILES=y
CONFIG_FEATURE_LS_TIMESTAMPS=y
CONFIG_FEATURE_LS_USERNAME=y
CONFIG_FEATURE_LS_COLOR=y
CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y
CONFIG_MD5SUM=y
CONFIG_MKDIR=y
CONFIG_FEATURE_MKDIR_LONG_OPTIONS=y
CONFIG_MKFIFO=y
CONFIG_MKNOD=y
CONFIG_MV=y
CONFIG_FEATURE_MV_LONG_OPTIONS=y
CONFIG_NICE=y
CONFIG_NOHUP=y
CONFIG_OD=y
CONFIG_PRINTENV=y
CONFIG_PRINTF=y
CONFIG_PWD=y
CONFIG_READLINK=y
CONFIG_FEATURE_READLINK_FOLLOW=y
CONFIG_REALPATH=y
CONFIG_RM=y
CONFIG_RMDIR=y
CONFIG_FEATURE_RMDIR_LONG_OPTIONS=y
CONFIG_SEQ=y
CONFIG_SHA1SUM=y
CONFIG_SHA256SUM=y
CONFIG_SHA512SUM=y
CONFIG_SHA3SUM=y
CONFIG_SLEEP=y
CONFIG_FEATURE_FANCY_SLEEP=y
CONFIG_FEATURE_FLOAT_SLEEP=y
CONFIG_SORT=y
CONFIG_FEATURE_SORT_BIG=y
CONFIG_SPLIT=y
CONFIG_FEATURE_SPLIT_FANCY=y
CONFIG_STAT=y
CONFIG_FEATURE_STAT_FORMAT=y
CONFIG_STTY=y
CONFIG_SUM=y
CONFIG_SYNC=y
CONFIG_TAC=y
CONFIG_TAIL=y
CONFIG_FEATURE_FANCY_TAIL=y
CONFIG_TEE=y
CONFIG_FEATURE_TEE_USE_BLOCK_IO=y
CONFIG_TRUE=y
CONFIG_TTY=y
CONFIG_UNAME=y
CONFIG_UNEXPAND=y
CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS=y
CONFIG_UNIQ=y
CONFIG_USLEEP=y
CONFIG_UUDECODE=y
CONFIG_UUENCODE=y
CONFIG_WC=y
CONFIG_FEATURE_WC_LARGE=y
CONFIG_WHOAMI=y
CONFIG_YES=y

#
# Common options
#
CONFIG_FEATURE_VERBOSE=y

#
# Common options for cp and mv
#
CONFIG_FEATURE_PRESERVE_HARDLINKS=y

#
# Common options for ls, more and telnet
#
CONFIG_FEATURE_AUTOWIDTH=y

#
# Common options for df, du, ls
#
CONFIG_FEATURE_HUMAN_READABLE=y

#
# Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum
#
CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y

#
# Console Utilities
#
CONFIG_CHVT=y
CONFIG_FGCONSOLE=y
CONFIG_CLEAR=y
CONFIG_DEALLOCVT=y
CONFIG_DUMPKMAP=y
CONFIG_KBD_MODE=y
CONFIG_LOADFONT=y
CONFIG_LOADKMAP=y
CONFIG_OPENVT=y
CONFIG_RESET=y
CONFIG_RESIZE=y
CONFIG_FEATURE_RESIZE_PRINT=y
CONFIG_SETCONSOLE=y
CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS=y
CONFIG_SETFONT=y
CONFIG_FEATURE_SETFONT_TEXTUAL_MAP=y
CONFIG_DEFAULT_SETFONT_DIR=""
CONFIG_SETKEYCODES=y
CONFIG_SETLOGCONS=y
CONFIG_SHOWKEY=y

#
# Common options for loadfont and setfont
#
CONFIG_FEATURE_LOADFONT_PSF2=y
CONFIG_FEATURE_LOADFONT_RAW=y

#
# Debian Utilities
#
CONFIG_MKTEMP=y
CONFIG_PIPE_PROGRESS=y
CONFIG_RUN_PARTS=y
CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y
CONFIG_FEATURE_RUN_PARTS_FANCY=y
CONFIG_START_STOP_DAEMON=y
CONFIG_FEATURE_START_STOP_DAEMON_FANCY=y
CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS=y
CONFIG_WHICH=y

#
# Editors
#
CONFIG_AWK=y
CONFIG_FEATURE_AWK_LIBM=y
CONFIG_FEATURE_AWK_GNU_EXTENSIONS=y
CONFIG_CMP=y
CONFIG_DIFF=y
CONFIG_FEATURE_DIFF_LONG_OPTIONS=y
CONFIG_FEATURE_DIFF_DIR=y
CONFIG_ED=y
CONFIG_PATCH=y
CONFIG_SED=y
CONFIG_VI=y
CONFIG_FEATURE_VI_MAX_LEN=4096
# CONFIG_FEATURE_VI_8BIT is not set
CONFIG_FEATURE_VI_COLON=y
CONFIG_FEATURE_VI_YANKMARK=y
CONFIG_FEATURE_VI_SEARCH=y
# CONFIG_FEATURE_VI_REGEX_SEARCH is not set
CONFIG_FEATURE_VI_USE_SIGNALS=y
CONFIG_FEATURE_VI_DOT_CMD=y
CONFIG_FEATURE_VI_READONLY=y
CONFIG_FEATURE_VI_SETOPTS=y
CONFIG_FEATURE_VI_SET=y
CONFIG_FEATURE_VI_WIN_RESIZE=y
CONFIG_FEATURE_VI_ASK_TERMINAL=y
CONFIG_FEATURE_VI_UNDO=y
CONFIG_FEATURE_VI_UNDO_QUEUE=y
CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=256
CONFIG_FEATURE_ALLOW_EXEC=y

#
# Finding Utilities
#
CONFIG_FIND=y
CONFIG_FEATURE_FIND_PRINT0=y
CONFIG_FEATURE_FIND_MTIME=y
CONFIG_FEATURE_FIND_MMIN=y
CONFIG_FEATURE_FIND_PERM=y
CONFIG_FEATURE_FIND_TYPE=y
CONFIG_FEATURE_FIND_XDEV=y
CONFIG_FEATURE_FIND_MAXDEPTH=y
CONFIG_FEATURE_FIND_NEWER=y
CONFIG_FEATURE_FIND_INUM=y
CONFIG_FEATURE_FIND_EXEC=y
CONFIG_FEATURE_FIND_EXEC_PLUS=y
CONFIG_FEATURE_FIND_USER=y
CONFIG_FEATURE_FIND_GROUP=y
CONFIG_FEATURE_FIND_NOT=y
CONFIG_FEATURE_FIND_DEPTH=y
CONFIG_FEATURE_FIND_PAREN=y
CONFIG_FEATURE_FIND_SIZE=y
CONFIG_FEATURE_FIND_PRUNE=y
CONFIG_FEATURE_FIND_DELETE=y
CONFIG_FEATURE_FIND_PATH=y
CONFIG_FEATURE_FIND_REGEX=y
# CONFIG_FEATURE_FIND_CONTEXT is not set
CONFIG_FEATURE_FIND_LINKS=y
CONFIG_GREP=y
CONFIG_FEATURE_GREP_EGREP_ALIAS=y
CONFIG_FEATURE_GREP_FGREP_ALIAS=y
CONFIG_FEATURE_GREP_CONTEXT=y
CONFIG_XARGS=y
CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y
CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y
CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y
CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y

#
# Init Utilities
#
CONFIG_BOOTCHARTD=y
CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER=y
CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE=y
CONFIG_HALT=y
# CONFIG_FEATURE_CALL_TELINIT is not set
CONFIG_TELINIT_PATH=""
CONFIG_INIT=y
CONFIG_FEATURE_USE_INITTAB=y
# CONFIG_FEATURE_KILL_REMOVED is not set
CONFIG_FEATURE_KILL_DELAY=0
CONFIG_FEATURE_INIT_SCTTY=y
CONFIG_FEATURE_INIT_SYSLOG=y
CONFIG_FEATURE_EXTRA_QUIET=y
CONFIG_FEATURE_INIT_COREDUMPS=y
CONFIG_FEATURE_INITRD=y
CONFIG_INIT_TERMINAL_TYPE="linux"
CONFIG_MESG=y
CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP=y

#
# Login/Password Management Utilities
#
CONFIG_ADD_SHELL=y
CONFIG_REMOVE_SHELL=y
CONFIG_FEATURE_SHADOWPASSWDS=y
CONFIG_USE_BB_PWD_GRP=y
CONFIG_USE_BB_SHADOW=y
CONFIG_USE_BB_CRYPT=y
CONFIG_USE_BB_CRYPT_SHA=y
CONFIG_ADDUSER=y
CONFIG_FEATURE_ADDUSER_LONG_OPTIONS=y
# CONFIG_FEATURE_CHECK_NAMES is not set
CONFIG_LAST_ID=60000
CONFIG_FIRST_SYSTEM_ID=100
CONFIG_LAST_SYSTEM_ID=999
CONFIG_ADDGROUP=y
CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS=y
CONFIG_FEATURE_ADDUSER_TO_GROUP=y
CONFIG_DELUSER=y
CONFIG_DELGROUP=y
CONFIG_FEATURE_DEL_USER_FROM_GROUP=y
CONFIG_GETTY=y
CONFIG_LOGIN=y
# CONFIG_LOGIN_SESSION_AS_CHILD is not set
CONFIG_LOGIN_SCRIPTS=y
CONFIG_FEATURE_NOLOGIN=y
CONFIG_FEATURE_SECURETTY=y
CONFIG_PASSWD=y
CONFIG_FEATURE_PASSWD_WEAK_CHECK=y
CONFIG_CRYPTPW=y
CONFIG_CHPASSWD=y
CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="des"
CONFIG_SU=y
CONFIG_FEATURE_SU_SYSLOG=y
CONFIG_FEATURE_SU_CHECKS_SHELLS=y
CONFIG_SULOGIN=y
CONFIG_VLOCK=y

#
# Linux Ext2 FS Progs
#
CONFIG_CHATTR=y
CONFIG_FSCK=y
CONFIG_LSATTR=y
# CONFIG_TUNE2FS is not set

#
# Linux Module Utilities
#
CONFIG_MODINFO=y
CONFIG_MODPROBE_SMALL=y
CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE=y
CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y
# CONFIG_INSMOD is not set
# CONFIG_RMMOD is not set
# CONFIG_LSMOD is not set
# CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set
# CONFIG_MODPROBE is not set
# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set
# CONFIG_DEPMOD is not set

#
# Options common to multiple modutils
#
# CONFIG_FEATURE_2_4_MODULES is not set
# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set
# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set
# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set
# CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set
# CONFIG_FEATURE_MODUTILS_ALIAS is not set
# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set
CONFIG_DEFAULT_MODULES_DIR=""
CONFIG_DEFAULT_DEPMOD_FILE=""

#
# Linux System Utilities
#
CONFIG_BLOCKDEV=y
CONFIG_FATATTR=y
CONFIG_FSTRIM=y
CONFIG_MDEV=y
CONFIG_FEATURE_MDEV_CONF=y
CONFIG_FEATURE_MDEV_RENAME=y
CONFIG_FEATURE_MDEV_RENAME_REGEXP=y
CONFIG_FEATURE_MDEV_EXEC=y
CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
CONFIG_REV=y
CONFIG_ACPID=y
CONFIG_FEATURE_ACPID_COMPAT=y
CONFIG_BLKID=y
# CONFIG_FEATURE_BLKID_TYPE is not set
CONFIG_DMESG=y
CONFIG_FEATURE_DMESG_PRETTY=y
CONFIG_FBSET=y
CONFIG_FEATURE_FBSET_FANCY=y
CONFIG_FEATURE_FBSET_READMODE=y
CONFIG_FDFLUSH=y
CONFIG_FDFORMAT=y
CONFIG_FDISK=y
# CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set
CONFIG_FEATURE_FDISK_WRITABLE=y
# CONFIG_FEATURE_AIX_LABEL is not set
# CONFIG_FEATURE_SGI_LABEL is not set
# CONFIG_FEATURE_SUN_LABEL is not set
# CONFIG_FEATURE_OSF_LABEL is not set
# CONFIG_FEATURE_GPT_LABEL is not set
CONFIG_FEATURE_FDISK_ADVANCED=y
CONFIG_FINDFS=y
CONFIG_FLOCK=y
CONFIG_FREERAMDISK=y
CONFIG_FSCK_MINIX=y
CONFIG_MKFS_EXT2=y
CONFIG_MKFS_MINIX=y
CONFIG_FEATURE_MINIX2=y
# CONFIG_MKFS_REISER is not set
CONFIG_MKFS_VFAT=y
CONFIG_GETOPT=y
CONFIG_FEATURE_GETOPT_LONG=y
CONFIG_HEXDUMP=y
CONFIG_FEATURE_HEXDUMP_REVERSE=y
CONFIG_HD=y
CONFIG_HWCLOCK=y
CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS=y
# CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set
CONFIG_IPCRM=y
CONFIG_IPCS=y
CONFIG_LOSETUP=y
CONFIG_LSPCI=y
CONFIG_LSUSB=y
CONFIG_MKSWAP=y
CONFIG_FEATURE_MKSWAP_UUID=y
CONFIG_MORE=y
CONFIG_MOUNT=y
CONFIG_FEATURE_MOUNT_FAKE=y
CONFIG_FEATURE_MOUNT_VERBOSE=y
# CONFIG_FEATURE_MOUNT_HELPERS is not set
CONFIG_FEATURE_MOUNT_LABEL=y
# CONFIG_FEATURE_MOUNT_NFS is not set
CONFIG_FEATURE_MOUNT_CIFS=y
CONFIG_FEATURE_MOUNT_FLAGS=y
CONFIG_FEATURE_MOUNT_FSTAB=y
CONFIG_PIVOT_ROOT=y
CONFIG_RDATE=y
CONFIG_RDEV=y
CONFIG_READPROFILE=y
CONFIG_RTCWAKE=y
CONFIG_SCRIPT=y
CONFIG_SCRIPTREPLAY=y
CONFIG_SETARCH=y
CONFIG_SWAPONOFF=y
CONFIG_FEATURE_SWAPON_DISCARD=y
CONFIG_FEATURE_SWAPON_PRI=y
CONFIG_SWITCH_ROOT=y
CONFIG_UMOUNT=y
CONFIG_FEATURE_UMOUNT_ALL=y

#
# Common options for mount/umount
#
CONFIG_FEATURE_MOUNT_LOOP=y
CONFIG_FEATURE_MOUNT_LOOP_CREATE=y
# CONFIG_FEATURE_MTAB_SUPPORT is not set
CONFIG_VOLUMEID=y

#
# Filesystem/Volume identification
#
CONFIG_FEATURE_VOLUMEID_BTRFS=y
CONFIG_FEATURE_VOLUMEID_CRAMFS=y
CONFIG_FEATURE_VOLUMEID_EXFAT=y
CONFIG_FEATURE_VOLUMEID_EXT=y
CONFIG_FEATURE_VOLUMEID_F2FS=y
CONFIG_FEATURE_VOLUMEID_FAT=y
CONFIG_FEATURE_VOLUMEID_HFS=y
CONFIG_FEATURE_VOLUMEID_ISO9660=y
CONFIG_FEATURE_VOLUMEID_JFS=y
CONFIG_FEATURE_VOLUMEID_LINUXRAID=y
CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y
CONFIG_FEATURE_VOLUMEID_LUKS=y
CONFIG_FEATURE_VOLUMEID_NILFS=y
CONFIG_FEATURE_VOLUMEID_NTFS=y
CONFIG_FEATURE_VOLUMEID_OCFS2=y
CONFIG_FEATURE_VOLUMEID_REISERFS=y
CONFIG_FEATURE_VOLUMEID_ROMFS=y
# CONFIG_FEATURE_VOLUMEID_SQUASHFS is not set
CONFIG_FEATURE_VOLUMEID_SYSV=y
CONFIG_FEATURE_VOLUMEID_UDF=y
CONFIG_FEATURE_VOLUMEID_XFS=y

#
# Miscellaneous Utilities
#
CONFIG_CONSPY=y
CONFIG_CROND=y
CONFIG_FEATURE_CROND_D=y
CONFIG_FEATURE_CROND_CALL_SENDMAIL=y
CONFIG_FEATURE_CROND_DIR="/var/spool/cron"
CONFIG_LESS=y
CONFIG_FEATURE_LESS_MAXLINES=9999999
CONFIG_FEATURE_LESS_BRACKETS=y
CONFIG_FEATURE_LESS_FLAGS=y
CONFIG_FEATURE_LESS_MARKS=y
CONFIG_FEATURE_LESS_REGEXP=y
CONFIG_FEATURE_LESS_WINCH=y
CONFIG_FEATURE_LESS_ASK_TERMINAL=y
CONFIG_FEATURE_LESS_DASHCMD=y
CONFIG_FEATURE_LESS_LINENUMS=y
CONFIG_NANDWRITE=y
CONFIG_NANDDUMP=y
# CONFIG_RFKILL is not set
CONFIG_SETSERIAL=y
CONFIG_UBIATTACH=y
CONFIG_UBIDETACH=y
CONFIG_UBIMKVOL=y
CONFIG_UBIRMVOL=y
CONFIG_UBIRSVOL=y
CONFIG_UBIUPDATEVOL=y
CONFIG_WALL=y
CONFIG_ADJTIMEX=y
# CONFIG_BBCONFIG is not set
# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set
CONFIG_BEEP=y
CONFIG_FEATURE_BEEP_FREQ=4000
CONFIG_FEATURE_BEEP_LENGTH_MS=30
CONFIG_CHAT=y
CONFIG_FEATURE_CHAT_NOFAIL=y
# CONFIG_FEATURE_CHAT_TTY_HIFI is not set
CONFIG_FEATURE_CHAT_IMPLICIT_CR=y
CONFIG_FEATURE_CHAT_SWALLOW_OPTS=y
CONFIG_FEATURE_CHAT_SEND_ESCAPES=y
CONFIG_FEATURE_CHAT_VAR_ABORT_LEN=y
CONFIG_FEATURE_CHAT_CLR_ABORT=y
CONFIG_CHRT=y
CONFIG_CRONTAB=y
CONFIG_DC=y
CONFIG_FEATURE_DC_LIBM=y
# CONFIG_DEVFSD is not set
# CONFIG_DEVFSD_MODLOAD is not set
# CONFIG_DEVFSD_FG_NP is not set
# CONFIG_DEVFSD_VERBOSE is not set
# CONFIG_FEATURE_DEVFS is not set
CONFIG_DEVMEM=y
CONFIG_EJECT=y
CONFIG_FEATURE_EJECT_SCSI=y
CONFIG_FBSPLASH=y
# CONFIG_FLASHCP is not set
# CONFIG_FLASH_LOCK is not set
# CONFIG_FLASH_UNLOCK is not set
# CONFIG_FLASH_ERASEALL is not set
CONFIG_IONICE=y
# CONFIG_INOTIFYD is not set
CONFIG_LAST=y
# CONFIG_FEATURE_LAST_SMALL is not set
CONFIG_FEATURE_LAST_FANCY=y
CONFIG_HDPARM=y
CONFIG_FEATURE_HDPARM_GET_IDENTITY=y
CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF=y
CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF=y
CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET=y
CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF=y
CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA=y
CONFIG_MAKEDEVS=y
# CONFIG_FEATURE_MAKEDEVS_LEAF is not set
CONFIG_FEATURE_MAKEDEVS_TABLE=y
CONFIG_MAN=y
CONFIG_MICROCOM=y
CONFIG_MOUNTPOINT=y
CONFIG_MT=y
CONFIG_RAIDAUTORUN=y
CONFIG_READAHEAD=y
CONFIG_RUNLEVEL=y
CONFIG_RX=y
CONFIG_SETSID=y
CONFIG_STRINGS=y
# CONFIG_TASKSET is not set
# CONFIG_FEATURE_TASKSET_FANCY is not set
CONFIG_TIME=y
CONFIG_TIMEOUT=y
CONFIG_TTYSIZE=y
CONFIG_VOLNAME=y
CONFIG_WATCHDOG=y

#
# Networking Utilities
#
CONFIG_NAMEIF=y
CONFIG_FEATURE_NAMEIF_EXTENDED=y
CONFIG_NBDCLIENT=y
CONFIG_NC=y
CONFIG_NC_SERVER=y
CONFIG_NC_EXTRA=y
# CONFIG_NC_110_COMPAT is not set
CONFIG_PING=y
CONFIG_PING6=y
CONFIG_FEATURE_FANCY_PING=y
CONFIG_WHOIS=y
CONFIG_FEATURE_IPV6=y
# CONFIG_FEATURE_UNIX_LOCAL is not set
CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
CONFIG_ARP=y
CONFIG_ARPING=y
CONFIG_BRCTL=y
CONFIG_FEATURE_BRCTL_FANCY=y
CONFIG_FEATURE_BRCTL_SHOW=y
CONFIG_DNSD=y
CONFIG_ETHER_WAKE=y
CONFIG_FAKEIDENTD=y
CONFIG_FTPD=y
CONFIG_FEATURE_FTP_WRITE=y
CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST=y
CONFIG_FTPGET=y
CONFIG_FTPPUT=y
CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS=y
CONFIG_HOSTNAME=y
CONFIG_HTTPD=y
CONFIG_FEATURE_HTTPD_RANGES=y
CONFIG_FEATURE_HTTPD_USE_SENDFILE=y
CONFIG_FEATURE_HTTPD_SETUID=y
CONFIG_FEATURE_HTTPD_BASIC_AUTH=y
CONFIG_FEATURE_HTTPD_AUTH_MD5=y
CONFIG_FEATURE_HTTPD_CGI=y
CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR=y
CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV=y
CONFIG_FEATURE_HTTPD_ENCODE_URL_STR=y
CONFIG_FEATURE_HTTPD_ERROR_PAGES=y
CONFIG_FEATURE_HTTPD_PROXY=y
CONFIG_FEATURE_HTTPD_GZIP=y
CONFIG_IFCONFIG=y
CONFIG_FEATURE_IFCONFIG_STATUS=y
CONFIG_FEATURE_IFCONFIG_SLIP=y
CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y
CONFIG_FEATURE_IFCONFIG_HW=y
CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y
CONFIG_IFENSLAVE=y
CONFIG_IFPLUGD=y
CONFIG_IFUPDOWN=y
CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate"
CONFIG_FEATURE_IFUPDOWN_IP=y
CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN=y
# CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set
CONFIG_FEATURE_IFUPDOWN_IPV4=y
CONFIG_FEATURE_IFUPDOWN_IPV6=y
CONFIG_FEATURE_IFUPDOWN_MAPPING=y
# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
CONFIG_INETD=y
CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO=y
CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD=y
CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME=y
CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME=y
CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN=y
# CONFIG_FEATURE_INETD_RPC is not set
CONFIG_IP=y
CONFIG_FEATURE_IP_ADDRESS=y
CONFIG_FEATURE_IP_LINK=y
CONFIG_FEATURE_IP_ROUTE=y
CONFIG_FEATURE_IP_TUNNEL=y
CONFIG_FEATURE_IP_RULE=y
CONFIG_FEATURE_IP_SHORT_FORMS=y
# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set
CONFIG_IPADDR=y
CONFIG_IPLINK=y
CONFIG_IPROUTE=y
CONFIG_IPTUNNEL=y
CONFIG_IPRULE=y
CONFIG_IPCALC=y
CONFIG_FEATURE_IPCALC_FANCY=y
CONFIG_FEATURE_IPCALC_LONG_OPTIONS=y
CONFIG_NETSTAT=y
CONFIG_FEATURE_NETSTAT_WIDE=y
CONFIG_FEATURE_NETSTAT_PRG=y
CONFIG_NSLOOKUP=y
CONFIG_NTPD=y
CONFIG_FEATURE_NTPD_SERVER=y
CONFIG_FEATURE_NTPD_CONF=y
CONFIG_PSCAN=y
CONFIG_ROUTE=y
CONFIG_SLATTACH=y
CONFIG_TCPSVD=y
CONFIG_TELNET=y
CONFIG_FEATURE_TELNET_TTYPE=y
CONFIG_FEATURE_TELNET_AUTOLOGIN=y
CONFIG_TELNETD=y
CONFIG_FEATURE_TELNETD_STANDALONE=y
CONFIG_FEATURE_TELNETD_INETD_WAIT=y
CONFIG_TFTP=y
CONFIG_TFTPD=y

#
# Common options for tftp/tftpd
#
CONFIG_FEATURE_TFTP_GET=y
CONFIG_FEATURE_TFTP_PUT=y
CONFIG_FEATURE_TFTP_BLOCKSIZE=y
CONFIG_FEATURE_TFTP_PROGRESS_BAR=y
# CONFIG_TFTP_DEBUG is not set
CONFIG_TRACEROUTE=y
CONFIG_TRACEROUTE6=y
CONFIG_FEATURE_TRACEROUTE_VERBOSE=y
# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set
# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
CONFIG_TUNCTL=y
CONFIG_FEATURE_TUNCTL_UG=y
# CONFIG_UDHCPC6 is not set
CONFIG_UDHCPD=y
CONFIG_DHCPRELAY=y
CONFIG_DUMPLEASES=y
CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY=y
# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set
CONFIG_DHCPD_LEASES_FILE="/var/lib/misc/udhcpd.leases"
CONFIG_UDHCPC=y
CONFIG_FEATURE_UDHCPC_ARPING=y
CONFIG_FEATURE_UDHCPC_SANITIZEOPT=y
# CONFIG_FEATURE_UDHCP_PORT is not set
CONFIG_UDHCP_DEBUG=9
CONFIG_FEATURE_UDHCP_RFC3397=y
CONFIG_FEATURE_UDHCP_8021Q=y
CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n"
CONFIG_UDPSVD=y
CONFIG_VCONFIG=y
CONFIG_WGET=y
CONFIG_FEATURE_WGET_STATUSBAR=y
CONFIG_FEATURE_WGET_AUTHENTICATION=y
CONFIG_FEATURE_WGET_LONG_OPTIONS=y
CONFIG_FEATURE_WGET_TIMEOUT=y
CONFIG_ZCIP=y

#
# Print Utilities
#
CONFIG_LPD=y
CONFIG_LPR=y
CONFIG_LPQ=y

#
# Mail Utilities
#
CONFIG_MAKEMIME=y
CONFIG_FEATURE_MIME_CHARSET="us-ascii"
CONFIG_POPMAILDIR=y
CONFIG_FEATURE_POPMAILDIR_DELIVERY=y
CONFIG_REFORMIME=y
CONFIG_FEATURE_REFORMIME_COMPAT=y
CONFIG_SENDMAIL=y

#
# Process Utilities
#
CONFIG_IOSTAT=y
CONFIG_LSOF=y
CONFIG_MPSTAT=y
CONFIG_NMETER=y
CONFIG_PMAP=y
CONFIG_POWERTOP=y
CONFIG_PSTREE=y
CONFIG_PWDX=y
CONFIG_SMEMCAP=y
CONFIG_TOP=y
CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y
CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y
CONFIG_FEATURE_TOP_SMP_CPU=y
CONFIG_FEATURE_TOP_DECIMALS=y
CONFIG_FEATURE_TOP_SMP_PROCESS=y
CONFIG_FEATURE_TOPMEM=y
CONFIG_UPTIME=y
CONFIG_FEATURE_UPTIME_UTMP_SUPPORT=y
CONFIG_FREE=y
CONFIG_FUSER=y
CONFIG_KILL=y
CONFIG_KILLALL=y
CONFIG_KILLALL5=y
CONFIG_PGREP=y
CONFIG_PIDOF=y
CONFIG_FEATURE_PIDOF_SINGLE=y
CONFIG_FEATURE_PIDOF_OMIT=y
CONFIG_PKILL=y
CONFIG_PS=y
# CONFIG_FEATURE_PS_WIDE is not set
# CONFIG_FEATURE_PS_LONG is not set
CONFIG_FEATURE_PS_TIME=y
CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS=y
# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set
CONFIG_RENICE=y
CONFIG_BB_SYSCTL=y
CONFIG_FEATURE_SHOW_THREADS=y
CONFIG_WATCH=y

#
# Runit Utilities
#
CONFIG_RUNSV=y
CONFIG_RUNSVDIR=y
# CONFIG_FEATURE_RUNSVDIR_LOG is not set
CONFIG_SV=y
CONFIG_SV_DEFAULT_SERVICE_DIR="/var/service"
CONFIG_SVLOGD=y
CONFIG_CHPST=y
CONFIG_SETUIDGID=y
CONFIG_ENVUIDGID=y
CONFIG_ENVDIR=y
CONFIG_SOFTLIMIT=y
# CONFIG_CHCON is not set
# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set
# CONFIG_GETENFORCE is not set
# CONFIG_GETSEBOOL is not set
# CONFIG_LOAD_POLICY is not set
# CONFIG_MATCHPATHCON is not set
# CONFIG_RESTORECON is not set
# CONFIG_RUNCON is not set
# CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set
# CONFIG_SELINUXENABLED is not set
# CONFIG_SETENFORCE is not set
# CONFIG_SETFILES is not set
# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set
# CONFIG_SETSEBOOL is not set
# CONFIG_SESTATUS is not set

#
# Shells
#
CONFIG_ASH=y
CONFIG_ASH_BASH_COMPAT=y
# CONFIG_ASH_IDLE_TIMEOUT is not set
CONFIG_ASH_JOB_CONTROL=y
CONFIG_ASH_ALIAS=y
CONFIG_ASH_GETOPTS=y
CONFIG_ASH_BUILTIN_ECHO=y
CONFIG_ASH_BUILTIN_PRINTF=y
CONFIG_ASH_BUILTIN_TEST=y
CONFIG_ASH_CMDCMD=y
# CONFIG_ASH_MAIL is not set
CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
CONFIG_ASH_RANDOM_SUPPORT=y
CONFIG_ASH_EXPAND_PRMT=y
CONFIG_CTTYHACK=y
CONFIG_HUSH=y
CONFIG_HUSH_BASH_COMPAT=y
CONFIG_HUSH_BRACE_EXPANSION=y
CONFIG_HUSH_HELP=y
CONFIG_HUSH_INTERACTIVE=y
CONFIG_HUSH_SAVEHISTORY=y
CONFIG_HUSH_JOB=y
CONFIG_HUSH_TICK=y
CONFIG_HUSH_IF=y
CONFIG_HUSH_LOOPS=y
CONFIG_HUSH_CASE=y
CONFIG_HUSH_FUNCTIONS=y
CONFIG_HUSH_LOCAL=y
CONFIG_HUSH_RANDOM_SUPPORT=y
CONFIG_HUSH_EXPORT_N=y
CONFIG_HUSH_MODE_X=y
# CONFIG_MSH is not set
CONFIG_FEATURE_SH_IS_ASH=y
# CONFIG_FEATURE_SH_IS_HUSH is not set
# CONFIG_FEATURE_SH_IS_NONE is not set
# CONFIG_FEATURE_BASH_IS_ASH is not set
# CONFIG_FEATURE_BASH_IS_HUSH is not set
CONFIG_FEATURE_BASH_IS_NONE=y
CONFIG_SH_MATH_SUPPORT=y
CONFIG_SH_MATH_SUPPORT_64=y
CONFIG_FEATURE_SH_EXTRA_QUIET=y
# CONFIG_FEATURE_SH_STANDALONE is not set
# CONFIG_FEATURE_SH_NOFORK is not set
CONFIG_FEATURE_SH_HISTFILESIZE=y

#
# System Logging Utilities
#
CONFIG_SYSLOGD=y
CONFIG_FEATURE_ROTATE_LOGFILE=y
CONFIG_FEATURE_REMOTE_LOG=y
CONFIG_FEATURE_SYSLOGD_DUP=y
CONFIG_FEATURE_SYSLOGD_CFG=y
CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256
CONFIG_FEATURE_IPC_SYSLOG=y
CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16
CONFIG_LOGREAD=y
CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y
CONFIG_FEATURE_KMSG_SYSLOG=y
CONFIG_KLOGD=y

#
# klogd should not be used together with syslog to kernel printk buffer
#
CONFIG_FEATURE_KLOGD_KLOGCTL=y
CONFIG_LOGGER=y

******* End of NEW INSTRUCTIONS (updated 06 Aug 2014 ) *******

This post is about how to cross compile a version of busybox for arm devices. If you’re just looking to get a generic version of busybox, go to the bottom of the post where you can download them.

First get the busybox source. I tried with the latest one busybox-1.20.2 and 1.20.1.

I compiled 1.20.2 with GCC Linaro toolchain: gcc-linaro-arm-linux-gnueabihf-4.7-2012.10-20121022_linux

export PATH=$PATH:~/toolchains/gcc-linaro-arm-linux-gnueabihf-4.7-2012.10-20121022_linux/bin
export CROSS_COMPILE="arm-linux-gnueabihf-"

 

make ARCH=arm CROSS_COMPILE="$CROSS_COMPILE" menuconfig

 

Busybox settings:
-General config>[*] Dont use /usr
-Build options>[*]Build Busybox as a static library (no dynamic libs)
-Build options>Cross compiler prefix: arm-linux-gnueabihf- (Optional. Alternately one can set the CROSS_COMPILE prefix at build time like I've demonstrated. It's also been told that it works with arm-none-linux-gnueabi-)

Linux Module utilities: Clear both the following:
()Default directory containing modules
()Default name of modules.dep

Networking Utilities:
-[ ] Support RPC services (Clear this!)[/code]
 
make ARCH=arm CROSS_COMPILE="$CROSS_COMPILE"[/code]
Busybox binaries will be compiled in the current directory.

If you dont remove "Support for RPC" build fails with the following error:
  CC      networking/inetd.o
  AR      networking/lib.a
  LINK    busybox_unstripped
Trying libraries: crypt m
Failed: -Wl,--start-group -lcrypt -lm -Wl,--end-group
Output of:
arm-linux-gnueabihf-gcc -Wall -Wshadow -Wwrite-strings -Wundef -Wstrict-prototypes -Wunused -Wunused-parameter -Wunused-function -Wunused-value -Wmissing-prototypes -Wmissing-declarations -Wdeclaration-after-statement -Wold-style-definition -fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-guess-branch-probability -funsigned-char -static-libgcc -falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1 -Os -static -o busybox_unstripped -Wl,--sort-common -Wl,--sort-section,alignment -Wl,--start-group applets/built-in.o archival/lib.a archival/libarchive/lib.a console-tools/lib.a coreutils/lib.a coreutils/libcoreutils/lib.a debianutils/lib.a e2fsprogs/lib.a editors/lib.a findutils/lib.a init/lib.a libbb/lib.a libpwdgrp/lib.a loginutils/lib.a mailutils/lib.a miscutils/lib.a modutils/lib.a networking/lib.a networking/libiproute/lib.a networking/udhcp/lib.a printutils/lib.a procps/lib.a runit/lib.a selinux/lib.a shell/lib.a sysklogd/lib.a util-linux/lib.a util-linux/volume_id/lib.a archival/built-in.o archival/libarchive/built-in.o console-tools/built-in.o coreutils/built-in.o coreutils/libcoreutils/built-in.o debianutils/built-in.o e2fsprogs/built-in.o editors/built-in.o findutils/built-in.o init/built-in.o libbb/built-in.o libpwdgrp/built-in.o loginutils/built-in.o mailutils/built-in.o miscutils/built-in.o modutils/built-in.o networking/built-in.o networking/libiproute/built-in.o networking/udhcp/built-in.o printutils/built-in.o procps/built-in.o runit/built-in.o selinux/built-in.o shell/built-in.o sysklogd/built-in.o util-linux/built-in.o util-linux/volume_id/built-in.o -Wl,--end-group -Wl,--start-group -lcrypt -lm -Wl,--end-group
==========
debianutils/lib.a(mktemp.o): In function `mktemp_main':
mktemp.c:(.text.mktemp_main+0x70): warning: the use of `tempnam' is dangerous, better use `mkstemp'
networking/lib.a(nslookup.o): In function `print_host':
nslookup.c:(.text.print_host+0x24): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
networking/lib.a(ipcalc.o): In function `ipcalc_main':
ipcalc.c:(.text.ipcalc_main+0x15e): warning: Using 'gethostbyaddr' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
libbb/lib.a(inet_common.o): In function `INET_resolve':
inet_common.c:(.text.INET_resolve+0x32): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
networking/lib.a(inetd.o): In function `reread_config_file':
inetd.c:(.text.reread_config_file+0x4e4): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
networking/lib.a(netstat.o): In function `ip_port_str':
netstat.c:(.text.ip_port_str+0x28): warning: Using 'getservbyport' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
networking/lib.a(inetd.o): In function `reread_config_file':
inetd.c:(.text.reread_config_file+0x48e): warning: Using 'getrpcbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
networking/lib.a(inetd.o): In function `unregister_rpc':
inetd.c:(.text.unregister_rpc+0xc): undefined reference to `pmap_unset'
networking/lib.a(inetd.o): In function `register_rpc':
inetd.c:(.text.register_rpc+0x28): undefined reference to `pmap_unset'
inetd.c:(.text.register_rpc+0x3e): undefined reference to `pmap_set'
networking/lib.a(inetd.o): In function `prepare_socket_fd':
inetd.c:(.text.prepare_socket_fd+0x52): undefined reference to `bindresvport'
collect2: error: ld returned 1 exit status
make: *** [busybox_unstripped] Error 1

I had to disable RPC services to get past this error.
Menuconfig>Networking Utilities>Support RPC services.
It seems the error is in the library "crypt".

I am attaching a copy of .config file for 1.20.2:

[Download not found]

Installing Busybox on your Android device

Note that Busybox provides basic function like cp. Without busybox (at least in sbin), all these will fail. So for a fresh non rooted phone, it first needs to be rooted (pushing and providing permissions for su binary and a Superuser apk). After rooting, one needs to install busybox in a convenient location in path like /system/xbin (usual location)

You cant even push to /system/xbin with adb because you dont have permissions for that. So it needs to be either done in recovery, or using a app like Root explorer.

adb push busybox /sdcard/

 

Run Root explorer, copy busybox from /sdcard to /system/xbin.

Or in recovery:

mount /system
adb push busybox /system/xbin

Now:

adb shell
mount -o rw,remount /dev/block/mtdblock3 /system
chmod 755 /system/xbin/busybox
/system/xbin/busybox --install /system/xbin

 Download links:

[Download not found]

 

[Download not found]

 

Feedback and Remarks:

 

Zeppelinrox said:

Hey thanks for the write up!

It came in VERY handy - I probably would have given up if not for your tip about RPC and I would have settled for a more bloated binary that I compiled using CodeBench.

However, it still would not compile - for another RPC related reason.
In the .config file, the setting you say to disable results in:
# CONFIG_FEATURE_INETD_RPC is not set

But there is another RPC setting:
CONFIG_FEATURE_HAVE_RPC
This one gets set automatically and can't be changed in the menu.

This setting has to remain disabled: Linux System Utilities > Support mounting NFS file systems on Linux < 2.6.23
If it's enabled, the build will fail because CONFIG_FEATURE_HAVE_RPC gets automatically activated :p

Other settings to make note of:
Login/Password Management Utilities > Use internal crypt functions
Login/Password Management Utilities > Enable SHA256/512 crypt functions
Make sure those 2 are enabled.
Disabling them also cause build failures for me.

Bottom line: I've successfully compiled BusyBox v1.21.0 with gcc-linaro-arm-linux-gnueabihf-4.7-2012.11-20121123_win32.exe
Yep! I used Cygwin on Windows XP!

With identical .configs (apart from compiler prefix)
Linaro Static build is 1406 KB
CodeBench Static build 2037 KB


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.