IRC log for #elinux on 20100318

01:30.36*** join/#elinux planetbeing (~planetbei@c-71-236-164-204.hsd1.or.comcast.net)
01:31.17planetbeingwhoa, hey pytey.
01:31.30planetbeingand roxfan
01:36.48*** join/#elinux linac (~lin@117.25.50.239)
04:27.22*** join/#elinux ZeZu (~null@in-67-236-122-199.dhcp.embarqhsd.net)
04:39.58pyteyplanetbeing: hey o/
04:43.18planetbeingQuiet here. :)
04:47.50*** join/#elinux linac (~lin@117.25.50.239)
07:14.32*** join/#elinux lyakh (~lyakh@p57BD1C95.dip0.t-ipconnect.de)
07:14.32*** join/#elinux roxfan (dunno@195.216-200-80.adsl-dyn.isp.belgacom.be)
07:14.32*** join/#elinux janinge (j@ninge.net)
07:14.32*** join/#elinux lewellyn (~lewellyn@greenviolet/lewellyn)
07:14.32*** join/#elinux markl_ (~mark@tpsit.com)
07:14.32*** join/#elinux ashes (ashes@modemcable076.241-176-173.mc.videotron.ca)
07:14.32*** join/#elinux CIA-21 (cia@208.69.182.149)
07:14.32*** join/#elinux Aim__ (~frank@office.aivd.net)
07:14.33*** join/#elinux file (~file@asterisk/developer-and-muffin-lover/file)
07:14.33*** join/#elinux Kmarc (kari@kallio.biz)
07:14.33*** join/#elinux ChanServ (ChanServ@services.)
07:14.33*** mode/#elinux [+vo file ChanServ] by farmer.freenode.net
07:22.34*** join/#elinux hw_ (~hw@p578b3905.dip0.t-ipconnect.de)
07:33.01*** join/#elinux hw_ (~hw@p578b3905.dip0.t-ipconnect.de)
10:21.17*** join/#elinux pirho (debian-tor@gateway/tor-sasl/pirho)
11:21.52*** join/#elinux krushia (~krushia@h69-131-86-88.cntcnh.dsl.dynamic.tds.net)
11:39.56*** join/#elinux linac (~lin@122.90.134.22)
12:05.24*** join/#elinux likewise (~likewise@82-171-51-231.ip.telfort.nl)
12:47.33*** join/#elinux gustavoz (~gustavoz@201.253.240.226)
12:49.26*** join/#elinux likewhoa (~likewhoa@ool-45717734.dyn.optonline.net)
12:53.49*** join/#elinux flavioribeiro (~flavio@187.64.42.101)
13:21.27wmatplanetbeing: the chatter comes in waves ;)
13:21.32*** join/#elinux bzzbzz (~franco@modemcable240.34-83-70.mc.videotron.ca)
13:22.15*** join/#elinux pirho (debian-tor@gateway/tor-sasl/pirho)
13:29.07*** join/#elinux linac (~lin@122.90.103.33)
14:56.17*** join/#elinux mnemoc (~amery@shell.opensde.net)
15:43.57*** join/#elinux Pupuser402 (~puppy@pd95b6ec5.dip0.t-ipconnect.de)
15:47.07*** part/#elinux Pupuser402 (~puppy@pd95b6ec5.dip0.t-ipconnect.de)
15:48.39*** join/#elinux markl (~mark@tpsit.com)
16:35.15*** join/#elinux GPSFan (~kenm@64.92.145.112)
17:23.56*** join/#elinux ibot (ibot@rikers.org)
17:23.56*** topic/#elinux is Embedded Linux || http://eLinux.org/ || cross compile, uClibc, busybox, handhelds, post-sale linux installs ;-), etc.
17:23.58*** mode/#elinux [+o ibot] by ChanServ
17:34.58*** join/#elinux roxfan (dunno@91.181.60.178)
17:49.59*** join/#elinux toi (~toi@d54C2A96D.access.telenet.be)
17:58.26*** join/#elinux ersin (~quassel@c-76-100-172-199.hsd1.md.comcast.net)
17:58.33ersinhi everyone
17:58.40ersini've got a question about init
17:58.45ersinspecifically, busybox init
17:59.03ersinbusybox has an option for building init without support for inittab
17:59.40ersinideally, i want to avoid using init at all; i've actually been trying to just use an init script that boots straight into single user mode w/ a shell
17:59.58ersinbut that hasn't been working because i can't get job control, which is why i'm now trying to use a real init program
18:00.09ersinhowever, i would really, really like to avoid using an inittab file
18:00.14ersinand busybox seems to support this
18:00.27ersinmy question is, how on earth does an init program work w/o an inittab file =P?
18:00.52ersincan i somehow just tell it to run a shell...?
18:10.57*** join/#elinux pirho (debian-tor@gateway/tor-sasl/pirho)
18:16.38planetbeingersin,  I'm not very familiar with this myself, but what's wrong with writing an inittab?
18:17.35ersinaesthetic concerns...i'm creating a small experimental distro to test out some ideas i have about distro design and i'm trying to avoid files in /etc
18:17.46ersinso...nothing technical, lol
18:18.43ersinthe weird part is that i just tried using busybox's init applet without the inittab support compiled in, and when i don't have a symbolic link from /bin/sh to /bin/ash it complains that "-/bin/sh" failed to run
18:18.52ersinwhich means that it's trying to run it by default, which would be fine for me
18:18.53ersinbut
18:19.15ersinwhen i DO put in the symbolic link or rename ash to sh, it does what you'd expect: absolutely nothing
18:20.05planetbeingHmm.
18:20.09ersinsorry, i should be more specific here
18:20.18planetbeingWhat I don't get is why it doesn't work if you just have bash BE init.
18:20.31ersinright
18:20.38ersinwell, not bash but busybox's ash
18:20.38planetbeingThe kernel just executes whatever program is named that and gives it /dev/console.
18:20.52planetbeingRight. Which might take cues from the command line on what to do.
18:20.52ersinwell according to many e-mails on the busybox list
18:21.08ersingiving /dev/console is incorrect and results in "no job control" errors
18:21.23ersininstead, i'm supposed to give a "controlling tty" like /dev/tty1 or some such
18:21.33ersinbut i can't seem to do that w/o an init program
18:22.13planetbeingYou'd need a wrapper that opens up the /dev/tty1 and gives that console to bash.
18:23.01ersinnot sure what that might look like...(i should note that there is something in busybox called "cttyhack" that i think does something similar to what you're proposing, but it doesn't work for me)
18:23.18planetbeingHmm, what if you just have a shell script execute: /sbin/getty 38400 tty1?
18:23.22planetbeingas your init.
18:23.38ersindoesn't getty usually require a login?
18:23.50planetbeingYes.
18:23.59ersin=)
18:24.06ersinthat won't do, then
18:24.08planetbeingYou just want something without a login?
18:24.10ersinall single user
18:24.10ersinyep
18:25.23planetbeingHow about /sbin/getty -l /bin/ash 38400 tty1?
18:25.34planetbeingUse /bin/ash as the login prompt. :P A bit hacky but worth a try.
18:25.39ersinlol
18:25.44ersini'll try it, just a sec
18:26.42planetbeingIf that doesn't work, you might just change inittab to add the -l /bin/ash argument, if the main thing you're going for is no login prompt.
18:27.06ersinnope, kind of have to have both
18:27.10*** join/#elinux Kmarc (kari@kallio.biz)
18:27.19ersini'm really surprised that there isn't some simpler way...
18:28.03planetbeingI wonder if you can just directly have a shell script do something like /bin/ash &> /dev/tty1 < /dev/tty1
18:28.25ersini've tried that, too
18:28.34ersinstill get job control errors
18:29.01planetbeingPerhaps it fails because ash is required for the shell script to work and ash will refuse to work when given /dev/console as stdin/stdout.
18:29.13ersinyes yes, i was wondering that myself
18:29.29planetbeingI'm just speculating, but I thought you might at least want SOMEONE to respond instead of just talking to yourself. :)
18:29.46ersinhaha, i appreciate it, thank you
18:29.49ersinok firing up virtualbox...
18:30.20ersinlol
18:30.24ersini got a login =(
18:31.26ersinok so about the ash being the shell that executes the script thing
18:31.51ersini tried making my own init program that does a few system calls to run the appropriate programs, basically just rewriting my script in c
18:31.56planetbeingRight.
18:32.04ersinwhen i compiled statically and put it in my initramfs, however, it just didn't run at all
18:32.09ersinand i chmod 755 and all
18:32.26planetbeingYou sure it compiles correctly?
18:32.39ersinyep, it ran fine on my host machine
18:32.54planetbeingHave you tried running it from the device?
18:33.02*** join/#elinux GPSFan (~kenm@64.92.145.112)
18:33.05ersinyeah...well, in virtual box
18:33.40ersinhaven't yet tested anything on actual hardware...well, i was using real hardware a long time ago, and i had the exact same problems w/ job control, so i know that it's not a hardware issue
18:33.59planetbeingCan you pastie the source to the program?
18:34.08ersinyep, one sec
18:34.13planetbeingIt might be best to start off with a simple printf and then while(1); to make sure SOMETHING runs.
18:35.05ersinhttp://pastie.org/875862
18:35.22ersincompiled with "gcc -static ./init.c"
18:35.26planetbeingOh no, system won't work at all.
18:35.30planetbeingThat depends on a shell being present.
18:35.34ersinhaha
18:35.38ersinalright, what do i use?
18:35.41planetbeingUse execv.
18:35.45ersinaha
18:35.47planetbeingIt's a bit. Complex.
18:35.56planetbeingWell, more complex to use than system.
18:35.58ersinlooks up
18:39.02planetbeingHere's some code I wrote once to be like init: http://code.google.com/p/independence/source/browse/trunk/iNdependence/Other+Files/RAMdisk/boost.c?r=308
18:39.09planetbeingIt's for a BSD-ish OS, but principles should be the same.
18:40.13planetbeingIt's a little more involved (with assembly syscalls) since I couldn't depend on even libc being available.
18:42.36planetbeingIn utilities.c there's a cmd_system that you can use. You have to separate the arguments out into an array of strings. There's usage examples in jailbreak.c. Should be the same for LInux
18:42.54planetbeingI guess it might be easier than figuring out the syscalls required for mounting in Linux.
18:43.20ersinhmm
18:43.37ersini'm trying out the execv thing right now, but i will take a look at utilities.c, too
18:44.03planetbeingexecv will replace your current process.
18:44.16ersinoh
18:44.19planetbeingSo once you run it, you don't get back control. You have to use fork() to start a new process first.
18:44.35ersini see
18:44.51ersinman this feels way more hardcore than i thought it would be
18:45.05planetbeingThere's probably a simple solution we're missing. :)
18:45.11ersini'm really surprised that my usage case doesn't come up more often
18:45.14ersinyeah lol
18:45.37planetbeingBut sometimes things are like that. I still for the life of me can't figure out how to disable the "feature" that Linux has of blanking the framebuffer console when there has been inactivity.
18:45.50ersinhahaha
18:46.20planetbeingBelieve it or not, I think that's hardcoded into the kernel for some ungodly reason.
18:48.14ersinso for utilities.c, is it as simple as separating the arguments and passing it to cmd_system?
18:50.00ersinoh silly me
18:50.07ersinthis is basically a wrapper to do the forking for me =)
18:51.38planetbeingYes. :)
18:55.39planetbeingOkay, I just solved my problem btw with LXR. echo 0 > /sys/module/kernel/parameters/consoleblank. Though it does sort of suck that the source is oftentimes the only documentation.
18:55.59ersinoh, congrats!  i'll have to keep that in mind
18:56.09ersinthe focus of the distro i'm making is going to be on framebuffer apps =)
18:57.02planetbeingAccording to the source, that particular feature is in drivers/char/vt.c, and it'll only attempt to do that if the console is in "text mode". So it might not affect you depending on what you're doing. :)
19:00.44ersindoh lol
19:01.07ersinhey, do you know what to do about "exec" calls in my script...?
19:01.13ersini mean...are those just execv calls...?
19:01.30ersinlike i have "exec </dev/tty0 >/dev/tty0 2>/dev/tty0"
19:01.48ersinwould i just pass cmd_system four separate arguments in the array?
19:02.09planetbeingHmm, you would open /dev/tty0
19:02.14planetbeingwith the open syscall.
19:02.24planetbeingAnd then dup those file descriptors over stdin, stdout and stderr.
19:02.31planetbeingAnd then execv ash or whatever.
19:02.41ersinO_O i feel like such a noob
19:03.56planetbeinghaha. Well. The idea is that when you fork(), the resulting process is a "child" process of the original process you forked from. It's also an exact clone and it inherits all the file descriptors its parent has.
19:04.29planetbeingstdin, stdout, and stderr are just file descriptor numbers 0, 1 and 2.
19:04.46ersinoh...so then when i fork ash it will inherit the three
19:04.52ersinwhich are "linked" to tty
19:05.07*** join/#elinux likewise_ (~likewise@82-171-51-231.ip.telfort.nl)
19:05.20planetbeingRight. The tty is opened as a file (and you might want to use ioctl to assign the baud rate, etc. at this point)
19:05.29planetbeingAnd then you fork to whatever other process you want.
19:06.15ersini see.  so then i'd just use something like dup2(ttyfd, 2)?
19:07.31planetbeingYes.
19:08.30planetbeingTheoretically, at any rate. I've only tried to do it with files.
19:11.59ersinerr...hmm
19:12.19ersini'm getting errors like WNOHANG undeclared, SIGCHLD undeclared...
19:12.39ersini'm including all the files that are included in utilities.c, save for the corefoundation stuff
19:13.08planetbeing#include <sys/wait.h> probably.
19:13.16planetbeingThe headers'd be different for BSD and Linux.
19:13.18planetbeinghttp://www.delorie.com/gnu/docs/glibc/libc_569.html
19:13.58ersinaha, thanks
19:24.41ersinplanetbeing: lol well none of that worked, i got a whole bunch of errors

Generated by irclog2html.pl Modified by Tim Riker to work with infobot.