[9fans] rc scripts, how to get spaces in array elements generated by command output?

2019-01-05 Thread Mack Wallace
I apologize if this is not the correct forum for this question. However, since 
I am trying to write a script in Plan 9’s rc shell, this seemed to be the best 
place to go - as most scripting resources are based on bash, and I could not 
find the answer in the rc references I could find. - and I’m rather new to 
scripting in general as it is.

My question: Is there a way to take the string output of a command that 
contains spaces and make it a single element of an array in rc script?

For example:

If I declare an array and output its contents with the following script:

declared_array = (‘hello world’ ‘good luck’)
echo $declared_array(1) 
echo $declared_array(2)

I will get:

hello world
good luck
 

However, if I am receiving output from sed that contains spaces from the 
following script line

string_var = `{echo some_string | sed ’s/x/y/g’}

If the output was ‘hello world’, string_var would become a two element array 
which
echo $some_string(1) 
echo $some_string(2)

Would output 
hello
world


The long version of what I am trying to do. 

I am trying to take a .CSV spreadsheet and make each row into a separate text 
file with the column header followed by the data for however many columns there 
are. The script will also make an index file of all files generated. This is so 
I can use Russ Cox’s Slide+ script to view each file, make changes, notes - and 
eventually use another script to put all the files back together into a new 
.CSV.

I already have a sed script that obfuscates extra quotes and commas of each 
record and returns a long string that’s comma delimited


The first task of the script is to read headers (first line) and store them to 
be used for each file. I want to anticipate that there may be spaces in 
individual headings. 


Ideally, I’d like to do this in one shot, with each heading being an individual 
element of an array. I tried changing the comma delimiters to various types of 
quotes in the sed script to keep headers with spaces together, but without 
success. So, to move on, I obfuscated the spaces and changed the commas to 
spaces. This allows the header row to be broken up appropriately, but then I 
still have to reverse the obfuscation.

header = `{read $1 | sed ’s/^/,/; s/\\”/☹/g; s/,”([^”]*)”/,☺\1☻/g; s/,”/,☺/; 
:MC; s/☺([^☻]*),([^☻]*)/☺\1☯\2/g; tMC; s/^,//; s/ /♪/g; s/,/ /g’}
(I quickly typed the script line, so there may be mistakes - the characters 
used for obfuscation will probably be \x02 ..\x05, however, I’m using unicode 
characters here as they are easier to see and debug.)


I could run sed for each header every time I generate a file, but that seems 
quite redundant if I can just run sed for the header once and save the result 
in a manner that is easily accessible. 

This is my first foray into scripting, so I am not sure what is good practice 
and form. Any suggestions are appreciated.

Thanks and best regards.

Mack




[9fans] How does one read a file line by line in an rc script?

2019-01-05 Thread Mack Wallace
Another, probably more stupid question - How does one read a text file line by 
line in an rc script.

In bash this works:

#!/bin/bash  

while read line  
do  
echo $line  
done < $1 

I’ve tried:

#!/bin/rc  

while (line=`{read $1})  
{
echo $line  
} 

Which produces the first line of the file in an infinite loop. I’ve tried the 
-m argument with no output.


It’s probably simple, but just can’t seem to find the equivalent.

Regards,

Mack





Re: [9fans] How does one read a file line by line in an rc script?

2019-01-05 Thread Mack Wallace
Thank you Steve.

But unfortunately...

That gives me “rc (testread): variable name not singleton!”

Trying the read with the -m option gets me the following errors repeated over 
and over until I escape out.
“awk i/o error occurred on /dev/stdin
 source line number 1
awk: i/o error occurred while closing /dev/stdin
 source line number 1" 

From the command line:

cat testdata | read

Gives me the first line of the file.

cat testdata | read -m

Puts all lines of the file to stdout.

There was a sample script at the bottom of 
http://doc.cat-v.org/plan_9/4th_edition/papers/rc 
<http://doc.cat-v.org/plan_9/4th_edition/papers/rc> that I’ve copied below.

It creates its own read function. This is for getting text from stdin. But I’m 
not seeing how it works - or if it is a path to get where I want to go. I tried 
to copy that read function and put it at the top of my script and the 
“while(read line) syntax below my other work. When I ran the script it just 
waits for some input - after which, it runs trough my other lines, not 
responding to my input file as $1 is defined in the function, and then when it 
gets to the while, it prompts me again. I tried to cat into the awk ‘{print; 
exit}’ in the while structure - but that didn’t work either.


hmmm….

Mack




t=/tmp/holmdel$pid

fn read{
$1=‘{awk ’{print;exit}’}
}

ifs=’
’  # just a newline

fn sigexit sigint sigquit sighup{
rm -f $t
exit
}

cat <<’!’ >$t
Allentown 
...
Holmdel
...
West Long Branch
!

while(){
   lab=‘{fortune $t}
   echo $lab
   if(~ $lab Holmdel){
  echo You lose.
  exit
   }
   while(read lab; ! grep -i -s $lab $t) echo No such location.
   if(~ $lab [hH]olmdel){
  echo You win.
  exit
   }
}





> On Jan 5, 2019, at 5:45 PM, Steve Simon  wrote:
> 
> 
> try
> 
> cat $1 | while(line=`{read}){
> echo $line
> }
> 
> no doubt you cam do without the cat but i am unsure off hand where to put the 
> redirect in and i am not on plan9 just now.
> 
> -Steve
> 
> On 5 Jan 2019, at 10:34 pm, Mack Wallace  <mailto:mac...@mapinternet.com>> wrote:
> 
>> Another, probably more stupid question - How does one read a text file line 
>> by line in an rc script.
>> 
>> In bash this works:
>> 
>> #!/bin/bash  
>> 
>> while read line  
>> do  
>> echo $line  
>> done < $1 
>> 
>> I’ve tried:
>> 
>> #!/bin/rc  
>> 
>> while (line=`{read $1})  
>> {
>> echo $line  
>> } 
>> 
>> Which produces the first line of the file in an infinite loop. I’ve tried 
>> the -m argument with no output.
>> 
>> 
>> It’s probably simple, but just can’t seem to find the equivalent.
>> 
>> Regards,
>> 
>> Mack
>> 
>> 
>> 



Re: [9fans] How does one read a file line by line in an rc script?

2019-01-05 Thread Mack Wallace
Thanks...


I'm running Bell Labs Plan 9 in Virtualbox. (I’m not sure how to get the 
version from the os or from rc)

I copied and pasted the snip directly into a script with only that in it - same 
error as before:“rc (testread): variable name not singleton!”

As for the second part - I will move that to the other thread. There are now 
some things I’m exploring there with the ifs variable, (which I thought the ifs 
variable was limited in plan 9 from what I read). 

Mack
 

> On Jan 5, 2019, at 6:46 PM, Steve Simon  wrote:
> 
> What are you running this on, is this byron's rc on unix?
> 
> I just tried the secript I posted, cut and pasted into a
> tiny shell scropt called testread, and it just worked™
> 
> maybe some other part of your script has a problem?
> 
> My script below
> -snip-snip-
> #!/bin/rc
> 
> cat $1 | while(line=`{read}){
> echo $line
> }
> 
> -snip-snip-
> 
> 
> Also, I didn't have the time to read all of your previous question,
> but I think what you are after is $"varname, this expands to the value
> of the variable but as a single argument, no matter if it, when
> it was assigned, had multiple, white space seperated words in it.
> 
> for example:  (NB: hugo% is my prompt)
> 
>   hugo% fred=(a b c d)
> 
>   hugo% echo $fred^-letter
>   a-letter b-letter c-letter d-letter
> 
>   hugo% echo $"fred^-letter
>   a b c d-letter
> 
> -Steve
> 
> 




Re: [9fans] rc scripts, how to get spaces in array elements generated by command output?

2019-01-05 Thread Mack Wallace
Thank you Anthony!

I had thought that IFS in Plan 9 was not the way to go after reading from ‘Rc - 
The Plan 9 Shell’ 

 “IFS is no longer used, except in the one case where it was indispensable:
  converting command output into argument lists during command 
substitution.”

The document then followed about avoiding a UNIX security hole, and lacking 
examples was not sure what this meant. Of course, in retrospect, it means 
exactly what I want to do.

So what I’ve ended up doing:

headrec = `{read $1 | sed ’s/^/,/; s/\\”/☹/g; s/,”([^”]*)”/,☺\1☻/g; s/,”/,☺/; 
:MC; s/☺([^☻]*),([^☻]*)/☺\1☯\2/g; tMC; s/^,//; s/,/♪/g’}
oldifs = $ifs
ifs = ♪
headers = `{echo $headrec | sed ‘/s/☹/\\”/g; s/(☺|☻)/“/g; s/☯/,/g’}
ifs = $oldifs

I’m not sure if there is a cleaner way to do this - but it gets the array of 
headers how they should be.

I’ll look at your other message.

Thanks,

Mack




> On Jan 5, 2019, at 6:52 PM, Anthony Martin  wrote:
> 
> Mack Wallace  once said:
>> My question: Is there a way to take the string output of a command that
>> contains spaces and make it a single element of an array in rc script?
>> 
>> [...]
>> 
>> However, if I am receiving output from sed that contains spaces from
>> the following script line
>> 
>> string_var = `{echo some_string | sed ’s/x/y/g’}
>> 
>> If the output was ‘hello world’, string_var would become a two
>> element array which
>> echo $some_string(1) 
>> echo $some_string(2)
>> 
>> Would output 
>> hello
>> world
> 
> You need to change the input field separator, $ifs.
> 
> The default value is any whitespace character:
> 
>   % x = `{echo -n hello world}
>   % echo $#x
>   2
>   % echo $x(1)
>   hello
>   % echo $x(2)
>   world
> 
> Using only newline as the separator yields:
> 
>   % ifs = '
>   ' # this is a newline character
>   %   y = `{echo -n hello world}
>   % echo $#y
>   1
>   % echo $y(1)
>   hello world
> 
> You might want to use a comma instead:
> 
>   % ifs = ,
>   % z = `{echo -n hello world,good luck}
>   % echo $#z
>   2
>   % echo $z(1)
>   hello world
>   % echo $z(2)
>   good luck
> 
> Cheers,
>  Anthony
> 
> 



[9fans] Couple of questions - not sure where best to ask

2020-10-14 Thread Mack Wallace
Hi all,

I am trying to set up a super simple wiki that can be used by either the web, 
or bulk editing through acme. Wikifs seems to address this quite well. However 
i have run into a number of questions across various Plan 9 platforms and am 
not sure if they all should be in separate e-mail threads, or to different 
groups. 

I have set up an experimental Plan9 cpu/file/auth server using 9front and am 
able to 9fs and rcpu into the box from another 9front VM. I understand that 
9front has updated the authentication methods and encryption which is why I can 
not access from a Labs version (or plan9port) without some minor changes to the 
auth startup or open up the old cpu port. I have a number of questions related 
to plan9port as well as some more general Plan9/Acme/Wikifs questions.

My general questions: Is it possible to secure wikifs through the auth server? 
I am scratching for ideas, and certainly do not fully understand all the 
mechanisms of Plan 9 - From my guesses, Acme users could 9fs into the server 
(requiring auth), and run wiki on their own machine. However, I presume then 
there would be no management for write collisions. If one can manage the Wikifs 
by file permissions, wouldn’t that affect the ability of httpd to access the 
system? Another question, although, I am in a position to try this - is it 
possible to run multiple different Wikis, each as a different service? I know 
that does not work so well for http serving, but I may want to keep a couple 
separate wikis.


I have been able to get into the wiki from Windows using acme-sac, but I have 
had troubles with plan9port. Looking at plan9port, it looks like wikifs access 
is not in the port. Is this something that would be difficult to add? I seem to 
have more basic problems with plan9port from my Mac. During the build there was 
an issue with 'ambiguous recipes for macargv.o:.’ If I try to run the command 
to connect to a wiki, or even just the term “Local srv,” Acme crashes. For the 
ambiguous recipes, I am not sure if I should write a post in the plan9port-dev 
mail list, or in the plan9port github issues page. The discussions in those 
seem more about development than how I may be stupidly using the software.

Thanks in advance to anyone willing to provide guidance.

M. B. Wallace



--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T91e362252ef80bee-M0010bbc4259100fcc2308687
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


[9fans] Plan9 on Raspberry Pi 400?

2021-01-14 Thread Mack Wallace
I recently purchased a Raspberry Pi 400, which is supposed to be a Raspberry Pi 
4 already inside a keyboard. I thought it would be great to get a plan 9 
terminal on it. However, I am having some trouble; and I don’t know if it is 
specific to the Pi 400, myself, or both.

The Pi 400 is the Raspberry Pi keyboard with a ‘Pi 4’ inside. However, the 
Raspberry Pi 4 is on a different piece of copper. I don’t know how significant 
this is or not.

Anyway, I downloaded the new 9front image and first used dd to get it onto a 
32GB micro SD card. 

On first boot, the Plan 9 kernel appears to start loading, and then I got the 
following error repeated over and over

sdhc: read error intr 2008002 stat 1fff

and then finally /dev/sdM0/data
bootargs is (tcp, tls, il, local!device)

I’ve tried creating images on the Pi itself in Raspian. Tried booting off of a 
USB to micro SD adapter - all with similar results, possibly different or 
additional errors. I also tried using balenaEtcher to transfer the image… 
similar results.

One attempted startup looked like this:

127 holes free
0x004f 0x3e60 1041301504
1041301504 bytes free

Plan 9
cpu0: 1500 MHz ARM Cortex-A72 r0p3
4006M Memory: 998M kernel data, 3008M user, 15011M swap
pcienable PCI.0.0.0: pcr 0->7
pcienable PCI.1.0.0: pcr 0->2
bus dev type vid  did  intl memory
0   0/0 06 04 00 14e4 2711   0  ioa:-1000 4096 
nema:6-60010 1048576 ->1
1   0/0 0c 03 30 1106 3483   0  0:60007 4096
#l0: genet: 1000Mbps port 0xBD58 irq 189 ea dca632e63357
usbxhci: 0x1106 0x3483: port 6 size 4096 irq 0
cpu3: 1500MHz ARM Cortex-A72 r0p3
cpu2: 1500MHz ARM Cortex-A72 r0p3
cpu1: 1500MHz ARM Cortex-A72 r0p3
#l0: phy1 id 600d84a2 oui 80361

emmc: cmd 371a arg 0 error intr 0 stat 1fff0001
{repeats 15 times}
/dev/sdM0: BCM SD Host Controller 02 Version 10
emmc: cmd 371a arg 0 error intr 0 stat 1fff0001
{repeats 10 times}
/dev/sdM0/data
bootargs is (tcp, tls, il, local!device)[]


As mentioned before, where that emmc error is - I’ve seen the previous 
mentioned error repeated. Or the following two errors.

sdhc: read error intr 2008000 stat 1fff0206
emmccmd: need to reset Datainhibit intr 0 stat 1fff0206

I realize this may be because I need a different firmware for the Pi 400. I see 
what looks like a file on github for the Pi 400. But I am not sure what to do 
with it. Is it supposed to be as easy as copying it to the boot partition? (I 
tried that and didn’t work). Do I need to recompile a kernel? Do I need to 
update the other files in the boot partition with those for the bootloader 
firmware for the Pi?

Thanks in advance!

Mack




--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T0178132f3d2ed689-M908bcace3647dd9b93065b3f
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] Plan9 on Raspberry Pi 400?

2021-01-14 Thread Mack Wallace
Thank you for the reply Stuart, but no luck.

I did download Mr. Miller’s image. It would not boot at all until I replaced 
the files that you mention, but the kernel in that image locks up after 
detecting the fourth core of the CPU. However, from that failure I learned that 
those files, (start_cd.elf, start4cd.elf, fixup_cd.dat, fixup4cd.dat) are 
necessary for the Pi to boot, and that those with the bootcode.bin and 
presumably, but it doesn’t seem to matter whether I use bcm2711-rpi-4-b.dtb or 
bcm2711-rpi-400.dtb - the dtbs are vital to the process. - and that all those 
files simply need to be copied into the fat partition/boot directory.

So I burned another image (actually many, trying different SD cards, and 
different configurations, older kernels, etc) and replaced all the files I’ve 
mentioned with the ones from 
https://github.com/raspberrypi/firmware/tree/master/boot 
 (hopefully that’s 
where I should get them). My most recent iteration just has the single error 
repeated:

sdhc: read error intr 2008002 stat 1fff

This occurs many times. In the middle of these errors is 

/dev/sdM0: BCM SD Host Controller 02 Version 10

then the error repeats itself over 50 times before printing out the lines
/dev/sdM0/data
bootargs is (tcp, tls, il, local!device)[]

At no time during this process is the keyboard or mouse responsive. Though the 
mouse icon did become visible during the boot process. 

I am hoping I am wrong, but I am thinking there is some sort of driver issue. 
At the very least, checking what media there is to mount, or reading the SD 
card. And then possibly for other things, but the former could be gumming up 
the works for everything else.


> On Jan 14, 2021, at 6:05 PM, Stuart Morrow  wrote:
> 
> Try copying the .dtb *and* the start4 and fixup4.

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T0178132f3d2ed689-M63bd5d3f548dbbf61c8f5402
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] Plan9 on Raspberry Pi 400?

2021-01-15 Thread Mack Wallace
Dear Skip,

That pushed the ball forward significantly, but I still have issues. (But thank 
you, every little advancement helps.) So with that flag, I was able to get 
Richard’s port to boot into Glenda’s account (showing acme, faces, stats, etc). 
However, I do not seem to have any USB; no mouse; nor keyboard. Stats is moving 
on the screen, so things are not too locked up. I did try rebooting with an 
external keyboard and another mouse. Still nothing. The external keyboard 
doesn’t respond to anything (no caps lock nor num lock.) One mouse is in the 
USB 2.0 port, another and the external keyboard are in the USB 3.0 ports. 

on boot, I see the following:
usbxhci: 0x1106 0x3483 port 6 size 0x1000 irq0
#u/usb/ep1.0: xhci port 0x0 irq 0

The line before is #l for the network,
The line after is the detection of the other three cores.

The changing of the enable_gic=1 on the 9front image seemed to have to effect.

Thanks again!

Mack


On Jan 14, 2021, at 8:15 PM, Skip Tavakkolian  
wrote:
> 
> I'm using a RPi400 with Richard's port. I'm netbooting without issues and up 
> for days.  The only issue I had was forgetting to set 'enable_gic=1' as 
> Richard instructed in the sources. Pi4 works ok without it, pi400 doesn't.
> 
> 
> On Thu, Jan 14, 2021, 3:39 PM Mack Wallace  <mailto:mac...@mapinternet.com>> wrote:
> Thank you for the reply Stuart, but no luck.
> 
> I did download Mr. Miller’s image. It would not boot at all until I replaced 
> the files that you mention, but the kernel in that image locks up after 
> detecting the fourth core of the CPU. However, from that failure I learned 
> that those files, (start_cd.elf, start4cd.elf, fixup_cd.dat, fixup4cd.dat) 
> are necessary for the Pi to boot, and that those with the bootcode.bin and 
> presumably, but it doesn’t seem to matter whether I use bcm2711-rpi-4-b.dtb 
> or bcm2711-rpi-400.dtb - the dtbs are vital to the process. - and that all 
> those files simply need to be copied into the fat partition/boot directory.
> 
> So I burned another image (actually many, trying different SD cards, and 
> different configurations, older kernels, etc) and replaced all the files I’ve 
> mentioned with the ones from 
> https://github.com/raspberrypi/firmware/tree/master/boot 
> <https://github.com/raspberrypi/firmware/tree/master/boot> (hopefully that’s 
> where I should get them). My most recent iteration just has the single error 
> repeated:
> 
> sdhc: read error intr 2008002 stat 1fff
> 
> This occurs many times. In the middle of these errors is 
> 
> /dev/sdM0: BCM SD Host Controller 02 Version 10
> 
> then the error repeats itself over 50 times before printing out the lines
> /dev/sdM0/data
> bootargs is (tcp, tls, il, local!device)[]
> 
> At no time during this process is the keyboard or mouse responsive. Though 
> the mouse icon did become visible during the boot process. 
> 
> I am hoping I am wrong, but I am thinking there is some sort of driver issue. 
> At the very least, checking what media there is to mount, or reading the SD 
> card. And then possibly for other things, but the former could be gumming up 
> the works for everything else.
> 
> 
>> On Jan 14, 2021, at 6:05 PM, Stuart Morrow > <mailto:morrow.stu...@gmail.com>> wrote:
>> 
>> Try copying the .dtb *and* the start4 and fixup4.
>> 
>> --
>> 9fans: 9fans
>> Permalink: 
>> https://9fans.topicbox.com/groups/9fans/T0178132f3d2ed689-M9f2c8a9a58f03931b399b823
>>  
>> <https://9fans.topicbox.com/groups/9fans/T0178132f3d2ed689-M9f2c8a9a58f03931b399b823>
>> Delivery options: https://9fans.topicbox.com/groups/9fans/subscription 
>> <https://9fans.topicbox.com/groups/9fans/subscription>
>> 
> 
> 9fans <https://9fans.topicbox.com/latest> / 9fans / see discussions 
> <https://9fans.topicbox.com/groups/9fans> + participants 
> <https://9fans.topicbox.com/groups/9fans/members> + delivery options 
> <https://9fans.topicbox.com/groups/9fans/subscription>Permalink 
> <https://9fans.topicbox.com/groups/9fans/T0178132f3d2ed689-Mdb22009f6100a35d3e0184c1>

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T0178132f3d2ed689-M3e4eaa51003d3faf4b21f271
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] Plan9 on Raspberry Pi 400?

2021-01-15 Thread Mack Wallace
I took that microSD card that has the bootable image without USB and put it 
into a traditional Pi4. It boots on that without a problem and has mouse and 
keyboard. I notices that after the additional CPU cores are detected, that is 
mentions usb/hub… usb/kbd….  The image when booting on the Pi 400 never 
provides those messages.

Regards,

Mack 

> On Jan 15, 2021, at 1:44 PM, Mack Wallace  wrote:
> 
> Dear Skip,
> 
> That pushed the ball forward significantly, but I still have issues. (But 
> thank you, every little advancement helps.) So with that flag, I was able to 
> get Richard’s port to boot into Glenda’s account (showing acme, faces, stats, 
> etc). However, I do not seem to have any USB; no mouse; nor keyboard. Stats 
> is moving on the screen, so things are not too locked up. I did try rebooting 
> with an external keyboard and another mouse. Still nothing. The external 
> keyboard doesn’t respond to anything (no caps lock nor num lock.) One mouse 
> is in the USB 2.0 port, another and the external keyboard are in the USB 3.0 
> ports. 
> 
> on boot, I see the following:
> usbxhci: 0x1106 0x3483 port 6 size 0x1000 irq0
> #u/usb/ep1.0: xhci port 0x0 irq 0
> 
> The line before is #l for the network,
> The line after is the detection of the other three cores.
> 
> The changing of the enable_gic=1 on the 9front image seemed to have to effect.
> 
> Thanks again!
> 
> Mack
> 
> 
> On Jan 14, 2021, at 8:15 PM, Skip Tavakkolian  <mailto:skip.tavakkol...@gmail.com>> wrote:
>> 
>> I'm using a RPi400 with Richard's port. I'm netbooting without issues and up 
>> for days.  The only issue I had was forgetting to set 'enable_gic=1' as 
>> Richard instructed in the sources. Pi4 works ok without it, pi400 doesn't.
>> 
>> 
>> On Thu, Jan 14, 2021, 3:39 PM Mack Wallace > <mailto:mac...@mapinternet.com>> wrote:
>> Thank you for the reply Stuart, but no luck.
>> 
>> I did download Mr. Miller’s image. It would not boot at all until I replaced 
>> the files that you mention, but the kernel in that image locks up after 
>> detecting the fourth core of the CPU. However, from that failure I learned 
>> that those files, (start_cd.elf, start4cd.elf, fixup_cd.dat, fixup4cd.dat) 
>> are necessary for the Pi to boot, and that those with the bootcode.bin and 
>> presumably, but it doesn’t seem to matter whether I use bcm2711-rpi-4-b.dtb 
>> or bcm2711-rpi-400.dtb - the dtbs are vital to the process. - and that all 
>> those files simply need to be copied into the fat partition/boot directory.
>> 
>> So I burned another image (actually many, trying different SD cards, and 
>> different configurations, older kernels, etc) and replaced all the files 
>> I’ve mentioned with the ones from 
>> https://github.com/raspberrypi/firmware/tree/master/boot 
>> <https://github.com/raspberrypi/firmware/tree/master/boot> (hopefully that’s 
>> where I should get them). My most recent iteration just has the single error 
>> repeated:
>> 
>> sdhc: read error intr 2008002 stat 1fff
>> 
>> This occurs many times. In the middle of these errors is 
>> 
>> /dev/sdM0: BCM SD Host Controller 02 Version 10
>> 
>> then the error repeats itself over 50 times before printing out the lines
>> /dev/sdM0/data
>> bootargs is (tcp, tls, il, local!device)[]
>> 
>> At no time during this process is the keyboard or mouse responsive. Though 
>> the mouse icon did become visible during the boot process. 
>> 
>> I am hoping I am wrong, but I am thinking there is some sort of driver 
>> issue. At the very least, checking what media there is to mount, or reading 
>> the SD card. And then possibly for other things, but the former could be 
>> gumming up the works for everything else.
>> 
>> 
>>> On Jan 14, 2021, at 6:05 PM, Stuart Morrow >> <mailto:morrow.stu...@gmail.com>> wrote:
>>> 
>>> Try copying the .dtb *and* the start4 and fixup4.
>>> 
>>> --
>>> 9fans: 9fans
>>> Permalink: 
>>> https://9fans.topicbox.com/groups/9fans/T0178132f3d2ed689-M9f2c8a9a58f03931b399b823
>>>  
>>> <https://9fans.topicbox.com/groups/9fans/T0178132f3d2ed689-M9f2c8a9a58f03931b399b823>
>>> Delivery options: https://9fans.topicbox.com/groups/9fans/subscription 
>>> <https://9fans.topicbox.com/groups/9fans/subscription>
>>> 
> 
> 9fans <https://9fans.topicbox.com/latest> / 9fans / see discussions 
> <https://9fans.topicbox.com/groups/9fans> + participants 
> <https://9fans.topicbox.com/groups/9fans/members> + delivery options 
> <https://9fans.topicbox.com/groups/9fans/subscription>Permalink 
> <https://9fans.topicbox.com/groups/9fans/T0178132f3d2ed689-M3e4eaa51003d3faf4b21f271>

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T0178132f3d2ed689-M7fc239ed3107974a45f2ee07
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] Plan9 on Raspberry Pi 400?

2021-01-15 Thread Mack Wallace
I did try to boot into Linux and then d a soft reset into Plan9. Still the same 
thing, no USB. I tried booting from the on-board card slot, and then as I soft 
rebooted, swapped out the card. As well as booted Raspian off of a microSD 
adapter and after booting, put the plan 9 card in the on-board slot. No luck.

As those that have been looking (Thank you btw). I started searching when 
Michael mentioned that the xhci firmware is not resident on the Pi 400. Of 
course there was talk about the Compute module, and then about memory offsets 
depending on how much memory is on the Pi… a bit over my head at this point.

I did notice, that Richards image that I have, seems to only recognize 1GB of 
ram. I am not terribly worried about that unless it’s a symptom of something 
else.

Thanks,

Mack

> On Jan 15, 2021, at 5:52 PM, Michael Engel  wrote:
> 
> I assume loading the firmware via Linux first won't help since a PCIe reset 
> probably also 
> resets the USB controller.
> 
> However, I just checked Richard's kernel source and it seems the firmware 
> loading functionality
> is already included, there is a call to
> 
>xhcireset(BUSBNO(hp->tbdf)<<20 | BUSDNO(hp->tbdf)<<15 | 
> BUSFNO(hp->tbdf)<<12);
> 
> in http://9p.io/sources/contrib/miller/9/bcm/usbxhci.c
> 
> The comment for xhcireset in 
> http://9p.io/sources/contrib/miller/9/bcm/vcore.c confirms this:
> /*
> * Notify gpu that xhci firmware might need loading. This is for some
> * pi4 board versions which are missing the eeprom chip for the vl805,
> * requiring its firmware to come from the boot eeprom instead.
> */
> 
> It seems that this source code is more recent than the images for the SD card 
> and kernel in 
> http://9p.io/sources/contrib/miller/ - I'll try building a kernel based on 
> the updated sources.
> 
> - Michael
> 
> 
>> On 15 Jan 2021, at 23:32, Bakul Shah  wrote:
>> 
>> Can you netboot Linux followed by netbooting Paln9 and have a working USB?
>> 
>>> On Jan 15, 2021, at 1:17 PM, Michael Engel  wrote:
>>> 
>>> Hi,
>>> 
>>> I didn't test Plan 9 on my RPi 400 so far, but I think the reason for the 
>>> USB problems 
>>> is the following:
>>> 
>>> The Raspberry Pi 400 (along with the Compute Module 4 and the 8 GB RAM 
>>> version 
>>> of the RPI4) uses a new stepping C0 of the BCM2711. This version does not 
>>> have a 
>>> dedicated EEPROM for the firmware of the xHCI USB controller and needs an 
>>> additional property mailbox call for loading the xHCI firmware after PCIe 
>>> reset. 
>>> 
>>> Some code to load the firmware can be found in the circle bare-metal 
>>> library (l. 88ff):
>>> https://github.com/rsta2/circle/blob/Step42.1/lib/usb/xhcidevice.cpp
>>> 
>>> -- Michael
>>> 
>>> 
>>>> On 15 Jan 2021, at 20:54, Mack Wallace  wrote:
>>>> 
>>>> I took that microSD card that has the bootable image without USB and put 
>>>> it into a traditional Pi4. It boots on that without a problem and has 
>>>> mouse and keyboard. I notices that after the additional CPU cores are 
>>>> detected, that is mentions usb/hub… usb/kbd….  The image when booting on 
>>>> the Pi 400 never provides those messages.
>>>> 
>>>> Regards,
>>>> 
>>>> Mack 
>>>> 
>>>>> On Jan 15, 2021, at 1:44 PM, Mack Wallace  wrote:
>>>>> 
>>>>> Dear Skip,
>>>>> 
>>>>> That pushed the ball forward significantly, but I still have issues. (But 
>>>>> thank you, every little advancement helps.) So with that flag, I was able 
>>>>> to get Richard’s port to boot into Glenda’s account (showing acme, faces, 
>>>>> stats, etc). However, I do not seem to have any USB; no mouse; nor 
>>>>> keyboard. Stats is moving on the screen, so things are not too locked up. 
>>>>> I did try rebooting with an external keyboard and another mouse. Still 
>>>>> nothing. The external keyboard doesn’t respond to anything (no caps lock 
>>>>> nor num lock.) One mouse is in the USB 2.0 port, another and the external 
>>>>> keyboard are in the USB 3.0 ports. 
>>>>> 
>>>>> on boot, I see the following:
>>>>> usbxhci: 0x1106 0x3483 port 6 size 0x1000 irq0
>>>>> #u/usb/ep1.0: xhci port 0x0 irq 0
>>>>> 
>>>>> The line before is #l for the network,
>>>>> The line after is the detection of the other

Re: [9fans] Plan9 on Raspberry Pi 400?

2021-01-18 Thread Mack Wallace
Thank you Michael for the kernel, it worked well. Skip for your config.txt, and 
certainly Richard for all your efforts porting 9 to the pi, and trying to keep 
it up to date. 

I have a 9front server - I had tried compiling a new kernel (of the 9front 
variety) there, but with lackluster results (i.e. kernel panic) on the Pi. 

Anyway, once I got the Pi usable between Michael's and Skip’s contributions, I 
was able to get the latest files from Richard’s contrib to update the source on 
the Pi and then build a new kernel. I found it interesting that the kernel size 
was different from what Michael had provided. But of course, there are so many 
variables that may affect such things. 

The two issues I saw were the aforementioned only recognizing 1GB of ram and 
the Caps Lock and Num Lock keys not functioning. (The caps lock acts like a 
control key, num-lock does nothing - I presume it’s a mapping issue). Neither 
issue I was particularly concerned with, I was happy just to have my Pi working 
with 9. 

I will certainly download the updated main.c and make a new kernel and get let 
you know the results.

So thank you!





> On Jan 18, 2021, at 9:51 AM, Richard Miller <9f...@hamnavoe.com> wrote:
> 
>> I did notice, that Richards image that I have, seems to only recognize 1GB 
>> of ram.
> 
> I put a new contrib/miller/9/bcm/main.c on 9p.io which should correct that.
> 

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T0178132f3d2ed689-M645899f15e112c4b1314
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] Plan9 on Raspberry Pi 400?

2021-01-20 Thread Mack Wallace
Just wanted to update. I was able to download the new main.c and compile a new 
kernel. 4GB of ram is now recognized.

Thank you!

> On Jan 19, 2021, at 4:52 AM, Richard Miller <9f...@hamnavoe.com> wrote:
> 
>> Sometimes I wish we'd stuck to the clunky original IBM 3270-style keyboard...
> 
> My raspberry pi terminal is connected to an IBM Model M keyboard
> (the compact version without a separate number pad), which I expect will
> outlast me.  I've never seen a pi400 but I don't imagine I would like it.
> 

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T0178132f3d2ed689-M50f339cd4bd3f36a32bb32c2
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] searching advice

2021-04-12 Thread Mack Wallace
I recently stumbled through the process of compiling u9fs for a linux machine 
and then connecting to it from a 9front computer. Perhaps that will work?

u9fs is a program for linux / unix that allows plan 9 boxes to connect with 
9fs. The source for it was in /sys/src/cmd/unix in the ‘labs version of Plan 9. 
I did not see it at that location in 9front and I don’t know if it is included, 
either on that distribution or on 9legacy. There is also a git site, 
https://github.com/unofficial-mirror/u9fs, which I recently used and seems to 
work. There are also some useful notes on how to set up u9fs in the Readme.md 
file in that git distribution.

For my distribution, modifying inetd.conf and services in /etc of the linux box 
is what was applicable. This may be different depending on your linux 
distribution.

in my inetd.conf I added the line:
u9fsstream  tcp nowait  root/bin/9/u9fs u9fs-a none -u root

note: by using -a none -u root, anyone can 9fs into the linux box and have root 
access to your file system. I’ve just started out in a lab environment where I 
am not worried about that. If you look at the u9fs man page there are ways of 
better securing the connection.

in my services I added:
u9fs564/tcp 9fs

After rebooting, (with the compiled u9fs in /bin/9/), I was then able to 9fs 
from the plan 9 box into the linux box.

Hope that helps. 



> On Apr 11, 2021, at 5:59 PM, ibrahim.a.71 via 9fans <9fans@9fans.net> wrote:
> 
> Hi 9fans,
> 
> I'm currently trying plan9. During my test phase I installed 9legacy on qemu. 
>  Everythings works fine but I couldn't master to exchange files with my host 
> system (linux). I tried a virtfs, virtual fat drives an ext image and failed 
> mounting the filesystem in plan9
> 
> I would prefer ext2 as a shared partition :
> 
> I tried
> 
> ext2srv
> mount -c /srv/ext2 /n/hostfs /dev/sdD0
> 
> and this results in an error message :
> mount: mount /n/hostfs : no file system device specified
> 
> I looked in the man pages and on internet but couldn't find an example for 
> mounting a harddisk or a setup to share files between host and guest. 
> 
> Perhaps someone can point out how to exchange data using virtual harddisks or 
> u9fs.
> 
> Thanks in advance
> 9fans / 9fans / see discussions + participants + delivery options Permalink

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T267dbe605a36a2f5-Mb191e6cfc42886efe984282d
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription