‰Alrighty, I've seen two pretty openly hostile responses to this so far so I thought I would try to contribute something positive... > > Hi, > > I would like to create a smaller release for personal use (to learn...) and > > I looked inside various Makefile. > > I noticed that they have each directory tree listed, so if I remove a dir > > I've to modify also the Makefile. > > I would like to know how these makefiles were made (by hand ?) and if there > > is a way to quicky add/remove src tree parts and succeed in "make release". > > And, to "make release" is needed a previous "make build" ? [Y/N] The short answer is that the OpenBSD release you downloaded (or otherwise bought) is pretty much the smallest yet functional version you can get. It is perfectly suitable for personal use and experimentation. OpenBSD (as opposed to the other BSDs) is designed to be as secure as possible out of the box, and one of the most significant ways it does this is by turning off or otherwise eliminating all non- crucial services. If you start removing any more functionality, you more than likely will break the system. If you want to reduce it even smaller, then don't add the source code (src.tar.gz), the ports, or any such packages. Just install the bare minimum consisting of the bsd kernal, base31.tgz and etc31.tgz. See the following section of the FAQ: http://www.openbsd.org/faq/faq4.html#FilesNeeded And you can run this in less than 100 MB of disk space and (I get the impression) 16 MB of RAM. Read the rest of the Installation FAQ to see how to do this. If you would like to learn how to modify makefiles (and other parts of the system), the best way to do so is through addition, not subtraction. For example, download the source code for the Apache web server, and try to compile it. Read the man page on Make, or better yet, buy O'Reilly's book on Using Makefiles. That will show you the difference between make clean, make depend, make build, make release, make install, etc etc AND you can play around with it all you want without breaking your computer. A bit of fair warning. BSD in general is considered to be an "advanced" operating system that assumes you have some working experience with using UNIX or UNIX-similar operating systems. It is not exactly ideal for beginners. OpenBSD in particular assumes you already have a pretty good idea of what you want to do and how to do it. My recommendation (to novices) is generally to... 1) Learn how to use the UNIX (or Linux) system at your school or workplace. This involves basic file manipulation, launching programs, a little bit of programming, and compiling programs (with or without make). If you get into trouble, you always have the system administrators there to help you out. 2) Get really really familiar with how Microsoft Windows or any Macintosh operating system works. The basic ideas you learn (filesystems and networking for example) will help you out a great deal. 3) Try a "starter" version of Linux which will hold your hand and has extensive documentation. RedHat and Mandrake are probably the best for this, although this new Lindows is supposidly even easier. Whichever you use, get comfortable with it, including adding additional applications or modifying the kernal. 4) Become familiar with the resources available on the Net. Get used to looking up information in FAQs, in mailing list archives, and in newsgroups. Or failing that, learn how to use Google effectively. Try to build an overall picture of how UNIX works. 5) THEN finally try out NetBSD or OpenBSD. You probably can try FreeBSD before step 4 if you really want to as that version does have extensive printed documentation. NetBSD and OpenBSD are geared more towards people who know what they're doing, including how to modify make and the dangers of mucking around with the core operating system source files. Now, to formally answer your questions: 1) Yes, we usually create makefiles by hand, although many of us just tweak a generic "take everything and compile it into obj files, then link all the obj files into a binary executable of this name" version of the makefile. 2) No, if you set up your makefile correctly, it only cares about the directories it needs. So if you then remove a directory and edit the makefile, you won't get the program you want. 3) If you want to remove applications from your system, you remove the applications themselves. You do not recompile them minus the source code. In most cases, pkg_delete will do what you want. See the man page on pkg_delete(1). (If you do not know how to deal with man pages, then you shouldn't be modifying makefiles or trying to minimize your system.) 3B) Or alternatively, if you want to get rid of the source code, just delete the source code. 4) Make build may or may not be the same as make release. It depends on the original programmer's intentions. In some cases, make build puts additional debugging info into the binary executable, whereas make release omits them. On the other hand, many programmers do not bother differentiating between the two and instead modify the excutable to give debug info if a certain flag (or command line argument) is provided. If you didn't write the application and you don't know which option is best for you, read the README file or the INSTALL file that came with it. 5) It sounds like what you want to ultimately do is remove all of the extraneous programs and applications and so forth, and have a bare bones system. You don't have to compile them out - OpenBSD already comes bare bones (which is why it's not recommended for newbies). David d...@earthlink.net ---------------------------------------------------------------------------------------------------------------------------------------------------------------- ok. assuming that you have a functioning 2.8-release system: (1) obtain all the kernel source you will need. this will put the files right onto your system. (a) log in as root (b) follow http://www.openbsd.org/anoncvs.html as it describes the proper process (i) bash-2# export CVS_RSH="/usr/bin/ssh" (ii) bash-2# export CVSROOT="anon...@anoncvs2.usa.openbsd.org:/cvs" (that server works well for me. read the above page for more info) (iii) bash-2# cd /usr (iv) bash-2# cvs -q checkout -P -rOPENBSD_2_8 src/ (c) this will install all kernel files, as well as full source for the entire O/S it's good stuff to have around. you'll grow to appreciate it. trust me. (2) once that godawful process is done with (may take awhile, hombre), simply bash-2# cd /usr/src/sys/arch/i386/conf and then follow the directions on http://www.openbsd.org/faq/faq5.html compiling a kernel is very easy. do a dmesg in one terminal, and then edit your kernel config file in another. if dmesg didn't talk about it, it's probably not in your system (this is for the hardware sections of the kernel conf, btw). just copy the GENERIC file to something else, and then muck with it. keep mucking until you like how it all fits together. fucking with kernels is often the first step to really getting your hands dirty in someone else's unix doodoo. open...@crackula.com if you got more questions. ----------------------------------------------------------------------------------------------------------------------------------------------------------------http://www.onlamp.com/pub/a/bsd/2000/10/31/OpenBSD.html ---------------------------------------------------------------------------------------------------------------------------------------------------------------- http://svn.wirelessleiden.nl/svn/node-config/other/iDive/nmea/nmea. ---------------------------------------------------------------------------------------------------------------------------------------------------------------- http://cvsbook.red-bean.com/ ---------------------------------------------------------------------------------------------------------------------------------------------------------------- You know, you are really wasting your time on this. This does not improve security, but I suppoise you'll learn someting about C in the process, so it isn't a total waste. Make a src tree, and then cd in /usr/src/libexec/ftpd. The data you want is in ftpd.c. You'll want to do a man on printf, which the lreply() function uses. Understanding vprintf() and fflush() would be good too. You can then run make to create a new ftpd. It would help if you read all of release(8) too, so you know how to rebuild the world. Once you have a new ftpd you need ot move it to /usr/libexec. Before moving the new one, you might want to keep the original somewhere like ftpd.old so you can revert to it if needed as you work on fixing the new one. So while a useful exercise in compiling things you are focusing in on the wrong concepts in security. But go ahead--you aren't perverting anything, at least. --STeve Andre' ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Citing Christian Schäfer : > - how should my sources be (folder-)structured depends on size of program. If you look at /usr/src/usr.bin, you'll find, that almost every program just takes up only one directory (not counting CVS and obj). > - are there any standards for writing makefiles 'man make' and /usr/share/doc/psd/12.make/tutorial.ms (read /usr/share/doc/README first on how to make a readable version) provide a good description/intro to writing Makefiles. > - how to write a man page there are templates in /usr/share/misc/man.template and /usr/share/misc/mdoc.template. Also a look at the manpage sources for various programs (e.g. basically almost every subdir in /usr/src/usr.bin of the source tree should have a *.1 file, which is the manpage source for the respective program) > - what will I have to consider to make my project compilable on most > *nix platforms > - is it necassary to use configure and how It is not strictly neccessary, for pros and cons and as answer to your portability question read this message and the following thread: http://marc.theaimsgroup.com/?l=openbsd-misc&m=109181591004160&w=2 > - what does it need to make a project/programm complete Depends on your definition of complete. Look at how the openbsd developers do stuff: - keep it simple and modular - provide good documentation - keep your code clean and readable I consider this complete. > I tried anjuta for development once and it created a structure and a lot > of stuff before I wrote the first line of code. what was all that stuff > and do I need it? don't know what it was, I use vi(m) for doing development ;-), but very probably you don't strictly need it. Again look at OpenBSD's program's sources to find out what is really needed. > right now I decided to use eclipse/cdt for development. > the sources are stored in cvs on openbsd which is the primary target as > well. the developing clients are mostly running linux (gentoo). > is it possible to have two makefiles one for each platform? yes ---------------------------------------------------------------------------------------------------------------------------------------------------------------- Here is how someone using anoncvs regularly would update his source tree: * First, start out by `get'-ing an initial tree: (If you are following current): # cd /usr # cvs -qd anoncvs@anoncvs.ca.openbsd.org:/cvs get -P src (If you are following the patch branch for 4.1): # cd /usr # cvs -qd anoncvs@anoncvs.ca.openbsd.org:/cvs get -rOPENBSD_4_1 -P src * Anytime afterwards, to `update' this tree: (If you are following current): # cd /usr/src # cvs -q up -Pd (If you are following the patch branch for 4.1): # cd /usr/src # cvs -q up -rOPENBSD_4_1 -Pd Every time you ran this it would synchronize your /usr/src tree. It would not destroy any of your local changes, rather it would attempt to merge changes in. * NOTE: If you are updating a source tree that you initially fetched from a different server, or from a CD, you must add the -d anoncvs@anoncvs.ca.openbsd.org:/cvs options to cvs. # cd /usr/src # cvs -d anoncvs@anoncvs.ca.openbsd.org:/cvs -q up -Pd To use ports, it is similar to src: * (If you are following current): # cd /usr # cvs -qd anoncvs@anoncvs.ca.openbsd.org:/cvs get -P ports You know, you are really wasting your time on this. This does not improve security, but I suppoise you'll learn someting about C in the process, so it isn't a total waste. Make a src tree, and then cd in /usr/src/libexec/ftpd. The data you want is in ftpd.c. You'll want to do a man on printf, which the lreply() function uses. Understanding vprintf() and fflush() would be good too. You can then run make to create a new ftpd. It would help if you read all of release(8) too, so you know how to rebuild the world. Once you have a new ftpd you need ot move it to /usr/libexec. Before moving the new one, you might want to keep the original somewhere like ftpd.old so you can revert to it if needed as you work on fixing the new one. So while a useful exercise in compiling things you are focusing in on the wrong concepts in security. But go ahead--you aren't perverting anything, at least. --STeve Andre' Florian Schaeffer wrote: > No. I have 1 image of 2 pages that build 1 page in the PDF (scanned double- > sided document). I want to cut this image into halves to make 2 pages in > the PDF. One page with the left halve and one page with the right halve of > the pic. I want to build a (new) PDF not for printing and so on. > Now clear? First, use "pdfimages -j" to get the scanned images out of the PDF file into JPEG files. pdfimages -j file.pdf page Then use Imagemagick's 'convert' to make two cropped half images. for %i in (*.jpg) do convert -crop "0,0 50%,100%" %i half%~ni_l.jpg for %i in (*.jpg) do convert -crop "50%,0 100%,100%" %i half%~ni_r.jpg Then use Imagemagick's 'convert' to convert the JPEG images of the half pages to PDF. convert halfpage*.jpg result.pdf Finally, garbage collection: del *.jpg That's it. No GUI, all command line tools.