Basically, you will have to create an XML file inside the ~/.mozilla/firefox/XYZ.default/searchplugins directory (replace XYZ with your profile's characters, could be any name there), with the following content (I will use Ubuntu Forums for this example):
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
<os:ShortName>Ubuntu Forums</os:ShortName>
<os:InputEncoding>utf-8</os:InputEncoding>
<os:Url type="text/html" method="GET" template="http://ubuntuforums.org/search.php?q={searchTerms}">
</os:Url>
</SearchPlugin>
You can name this file ubuntuforums.xml for example, and place it inside the searchplugins directory mentioned above. This example will search on Ubuntu Forums. Remember to enter the answer to the secret question before searching.
To make other search engines, just replace Ubuntu Forums with another name and http://ubuntuforums.org/search.php?q={searchTerms} with the search address that you want.
Here is another example, for searching the Linux Mint forums with Google:
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
<os:ShortName>Mint Forums</os:ShortName>
<os:InputEncoding>utf-8</os:InputEncoding>
<os:Url type="text/html" method="GET" template="http://www.google.com/search?q={searchTerms}&sitesearch=forums.linuxmint.com">
</os:Url>
</SearchPlugin>
To automatically focus the search bar in Firefox, press Ctrl+K.
You can also set an icon to appear beside the search entry, which should be a .gif image with a size of 16x16 pixels, and it should have the same name (except the extension) with the search engine (e.g. ubuntuforums.gif). Here's the KFind icon, converted to GIF at 16x16 pixels: You can save it inside the searchplugin folder, just make sure it has the same name as the .xml file, without the extension.
References