Hey guys!
It's been a couple of years! I was here before asking about this very same subject in this thread, and now I'm trying to get the same thing to work on Snow Leopard. I know things should largely be the same, but there are some significant things I must me missing since I cannot get jas's fantastic guide (along with these minor corrections to it) to work on my computer.
This time, I do have both Phosphor and the kernel ready, I just need to know how to make the script (or any other script for that matter, if anyone knows one) run properly. I keep getting the error when I run the perl script
"syntax error at /usr/local/bin/phosphor-kernel-src.pl line 3, near "while ;"
Execution of /usr/local/bin/phosphor-kernel-src.pl aborted due to compilation errors."
And yes, I did make sure I have the DATA correction after the while above.
And before anyone makes a smart remark, I posted this here because it has much more to do with kernels and things of a Linux nature than an OS X matter.
Any help is GREATLY appreciated!![]()
-
inspirations365 Notebook Consultant
-
I'm not a Perl programmer, but it seems Jas' shell script suffered from the vBulletin software eating anything enclosed in a less-than-symbol "<", some text, and a greater than symbol ">".
You could edit line 3 of the generated perl script so that the while semi-colon becomes
while space less-than-symbol DATA greater-than-symbol semi-colon. or while "<"DATA">"; without the double-quotes ". -
inspirations365 Notebook Consultant
Thanks for your reply!
I've tried bothCode:"(DATA)"
Code:<"DATA">
syntax error at /usr/local/bin/phosphor-kernel-src.pl line 3, near "while ;"
Execution of /usr/local/bin/phosphor-kernel-src.pl aborted due to compilation errors.
Ugh...I hate this feeling of being close and hitting these small snags...but such is the life of a programmer, right? -
I downloaded Phosphor for Mac last night and didn't see an option for executing a text program. I looked around in the directores and found phosphor.xml, but it seems that the options presented to the user are contained in another Perl script...
-
inspirations365 Notebook Consultant
Attached Files:
-
-
Maybe this will make it a bit clearer?
-
inspirations365 Notebook Consultant
I notice you don't have any of the "\" slashes on the rand or print lines of your program. Is this intentional? Does your program run when you tested it?
Can you also tell me what the "-w" flag will do in this context?
Thanks, timberwolf!
EDIT***
Gave it a try editing the .sh file to mimic yours, "\"s and all. No dice. I even changed the DATA variable back and forth again to make sure it wasn't causing any issues. -
The phosphor-kernel-script.sh is a shell script (program) used to create the phosphor-kernel-src.pl perl script (program).
Oops, I really should have said, I was debugging and hence editing phosphor-kernel-src.pl program, rather than editing the shell script and rerunning that to generate a new version of the perl script. The backslashes get consumed by the shell as the shell script is interpreted - mmmm, what do I mean? Try the following in a terminal:
echo Fred
then try
echo "Fred"
Do you see the double quotes on the second echo output, no because the shell strips them off. To generate the perl script correctly certain characters that would be stripped off by the shell interpreter have to be protected, so the backslash is used to escape those characters.
The phosphor-kernel-script.sh effectively only needs to be run once (assuming it generated the resultant perl program correctly, if you want you can delete the shell script once you've created the perl script.
The -w switches on extra warning messages, or least that's what I vaguely remember, I've always put that switch on - and it didn't help on this occasion
You could also read the man page for perl to find out about the -w switch i.e. type in a terminal: man perl
In the man viewer, type the letter q to quit. -
inspirations365 Notebook Consultant
Oooh, did it work for you? Should I be working on the shell script instead of the program, assuming I create it correctly? -
Okay, the only bit I added was the DATA and <, and > symbols on the line. Yes, I can run the perl script and it generates the path/filename of a random kernel source file.
For completeness, I've edited the shell script, so you can see what it is supposed to look like. This would be so much easier if the vBulletin software would allow verbatim code quotes
-
inspirations365 Notebook Consultant
Same script, different result.
*rant rant rant*Attached Files:
-
-
What does generated perl code look like?
The shell script is just being used to create the perl code file and then appending all the .c source filenames to the perl file. -
inspirations365 Notebook Consultant
Looks like it's generating the files properly...idk.
Attached Files:
-
-
What are the errors generated when you try to execute phosphor-kernel-src.pl ?
Also note the actual location of Perl on your Mac. Open up Terminal and enter which perl at the prompt. Mine was in /opt/local/bin/perl - that needs to be adjusted at the top of phosphor-kernel-src.pl.
I've gotten the Perl script to work on my Mac...
One quick note - I tried some different ways to pipe the output of the Perl script into the phosphor screensaver and it didn't work... -
inspirations365 Notebook Consultant
Code:#!/bin/sh file=/Users/inspirations365/phosphor-kernel-src.pl # script to create linux_src_dir=/Users/inspirations365/Documents/linux-2.6.39.2 # location of kernel src cat << EOF > "$file" #!/usr/bin/perl srand; rand(\$.) < 1 && (\$line = \$_) while <DATA>; print \$line; __DATA__ EOF find -L "$linux_src_dir" -name \*.c >> $file chmod 755 $file ruw-172:~ inspirations365$ which perl /usr/bin/perl
The error I'm getting is always the same:
Code:syntax error at /usr/local/bin/phosphor-kernel-src.pl line 3, near "while ;" Execution of /usr/local/bin/phosphor-kernel-src.pl aborted due to compilation errors.
-
What version of Perl do you have? Are you running Snow Leopard?
-
inspirations365 Notebook Consultant
Code:ruw-172:~ inspirations365$ perl -v This is perl, v5.10.0 built for darwin-thread-multi-2level (with 2 registered patches, see perl -V for more detail)
Actually I think I got it running. This is my output when the .pl is run in terminal:
Code:ruw-172:~ inspirations365$ /Users/inspirations365/phosphor-kernel-src.pl /Users/inspirations365/Documents/linux-2.6.39.2/arch/mips/loongson/common/platform.c
Now I need the correct command to put into Phosphor to get it to display the contents of the files. -
It was posted somewhere in the original thread, note the space around the pipe symbol seem to be necessary.
/Users/inspirations365/phosphor-kernel-src.pl | xargs cat -
inspirations365 Notebook Consultant
EDIT***
Running the command from Terminal as a test will yield the following:
Code:/Users/inspirations365/phosphor-kernel-src.pl | xargs cat /* * linux/fs/ext3/bitmap.c * * Copyright (C) 1992, 1993, 1994, 1995 * Remy Card ([email protected]) * Laboratoire MASI - Institut Blaise Pascal * Universite Pierre et Marie Curie (Paris VI) */ #include <linux/buffer_head.h> #include <linux/jbd.h> #include <linux/ext3_fs.h> #ifdef EXT3FS_DEBUG static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; unsigned long ext3_count_free (struct buffer_head * map, unsigned int numchars) { unsigned int i; unsigned long sum = 0; if (!map) return (0); for (i = 0; i < numchars; i++) sum += nibblemap[map->b_data[i] & 0xf] + nibblemap[(map->b_data[i] >> 4) & 0xf]; return (sum); } #endif /* EXT3FS_DEBUG */
-
Yeah, it's not going to work out of the box.
If you're interested, the preferences are stored under /Library/Screen Savers/Phosphor.saver/Contents/Resources. There you'll find two files, phosphor.xml and xscreensaver-text (another Perl script).
The Perl script is somehow used to generate the output that's printed to the screen - executing with the --program switch gives the right output.
I just don't know what files need to be modified in order to show the text-program option under System Preferences. -
inspirations365 Notebook Consultant
I'll keep at it. Thanks! -
Just got it working!
This is how I did it - I added the following line to the phosphor.xml file (thanks to this link - http://eins.serverbox.org/chad/index.php?option=com_content&task=view&id=100&Itemid=29):
PHP:<file id='program' _label="Text Program" arg="-program %"/>
Code:#!/bin/sh -e cat `/path/to/phosphor-kernel-src.pl`
Go to System Preferences and select the new shell script and behold - kernel source as a screensaver...
Here are some screenshots -
Phosphor Options pane after modifying phosphor.xml:
The new option appears right under the 'Fade' slider.
Phosphor Screensaver Preview pane:
Last edited by a moderator: May 7, 2015 -
inspirations365 Notebook Consultant
I'm still doing something wrong, believe it or not.
I pasted the line, no problems there, Phosphor shows the new box.
then I did a sudo nano scripthelp.sc, pasted and changed the path, saved, chmodded with your commands, and I get:
/bin/sh:
Dammit.
Can you walk me through it in a bit more detail? Gosh, you're awesome! -
Try running your helper script on its own and see if it prints out a kernel source file. It should work on its own.
You also don't need to have superuser privileges to create the helper script and make it executable.
If all else fails, try deleting your helper script and re-creating it with your normal user account. -
inspirations365 Notebook Consultant
YESSSSSS THAT WAS IT.
Thank you thank you thank you thank you thank you!
Incredible. Absolutely stunning. Awesome.
Kernel Screensaver?
Discussion in 'Linux Compatibility and Software' started by inspirations365, Jun 29, 2011.