Using GPL Code

From SecuriWiki
Revision as of 14:45, 21 September 2014 by Lars (Talk | contribs)

Jump to: navigation, search

First you must download the GPL code from the URL found in the forums.

Then, if you're running on an 64bit OS, you may need to patch m4 and bison.

Patching Tools

You will be creating patches directories in tools/m4/ and tools/bison, and adding the following files.

cd $TOOLCHAIN_DIR
mkdir tools/m4/patches tools/bison/patches

tools/m4/patches/010-stdio.in.h.patch

--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -141,7 +141,8 @@ _GL_WARN_ON_USE (fflush, "fflush is not
    so any use of gets warrants an unconditional warning.  Assume it is
    always declared, since it is required by C89.  */
 #undef gets
-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+/*_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");*/
+#define gets(a) fgets( a, sizeof(*(a)), stdin)

 #if @GNULIB_FOPEN@
 # if @REPLACE_FOPEN@

tools/bison/patches/010-stdio.in.h.patch

--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -143,7 +143,8 @@ _GL_WARN_ON_USE (fflush, "fflush is not
    so any use of gets warrants an unconditional warning.  Assume it is
    always declared, since it is required by C89.  */
 #undef gets
-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+/*_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");*/
+#define gets(a) fgets( a, sizeof(*(a)), stdin)

 #if @GNULIB_FOPEN@
 # if @REPLACE_FOPEN@


Compiling Packages

You can use the instructions at [1]

For example for recompiling udev (a simpler package without dependencies):

make tools/install
make toolchain/install
make package/udev/compile

After the first time, only the last command needs to be run. Then the package can be found in bin/g2/packages. You can also do make menuconfig and choose the packages you want to build, then just run make package/install.