Full Debian ARM for Under $200
An anonymous reader writes "With minor elbow grease, you can now set yourself up with a complete Debian ARM Linux box for under $200. This is thanks to Peter Korsgaard, who figured out a cool byteswapped kernel hack for the little $99 Linksys NSLU2. Add a $99 USB harddrive, and the tiny, cute, quiet 'Slug' can run any of about 16,000 Debian ARM packages, 24x7, for pennies per month worth of electricity, since ARM is still orders of magnitude more power-efficient than anything x86. Serve files, music, web pages, printers, backups, kernel images, webcams/motion detection, firewalls/routers, wireless access point... or whatever. Oh, did I mention you can overclock the Slug?"
Where's the $100 ARM device for Debian that includes ethernet and stereo audio out (headphones/speakers)? Even used PocketPCs cost $100, plus $50-100 for PCMCIA ethernet/sleeve.
--
make install -not war
Does it run Li...Oh, right... ^_^
(sorry)
Unpretentious Sydney reviews by unqualified Sydney reviewers
The Linksys NSLU2 has already been hacked so you can run your own applications on it. :-)
OpenWRT is a similar thing for the Linksys WRT54G and GS wireless routers. Same goes for the Asus WL500 series. Linux forever! heh
Cheaper, more efficient, faster (Disk I/O wise), more stable, more flexible (apt-get) than the Mac Mini. Not to mention the ability to hack it when I want (The warranty is already void!). Moreover, I don't have to give the litigious bastards (Apple, of course) any of my dough!
My new media server!
I can't wait to set this up in a cabinet/closet somewhere and stream video/audio from it.
Thank you, thank you.
#define CLUE 0
We have all heard software monoculture is bad from a security standpoint... Would running one of these things be more secure than running debian on x86 since the hardware is different?
This is a cool project and Kudos to Linksys for using Linux as a basis for their NAS and Routers.
But TFA says "built-in 10/100 (not yet supported in litte-endian mode)". If I read this correctly the device works, but the network port doesn't. Hopefully someone can correct me and confirm that the ethernet port does work.
This would be a perfect low-cost always-on media centre server for Slim Devices Squeezebox Server
Orationem pulchram non habens, scribo ista linea in lingua Latina
Will it overheat? Oh well, no 'ARM in trying
My other sig is crap too
But an XBOX cheap when people throw theirs away for XBOX 360 and chip it :-) You can run Linux legally on it and put in any HD you want much cheaper (internal) than a USB drive.
Oh, did I mention, VHS sucks ass? I mean, come on, there's no excuse with Beta around.
Guess who lost that one! Just because it's the best techology, doesn't mean it's going to get used.
It's not our fault you prefer the never-changing BSD and the 1-button MAC mouse. With the second highest install base in the world, you're bound to get breached.
From TFA:
The device has 32MB of SDRAM, 8MB of NOR Flash, built-in 10/100 (not yet supported in litte-endian mode), and dual USB 2.0 ports.
How are you planning on accessing those files? Hopes and dreams? Network Attached Storage with no Network Attached is just a hard drive.
~Will
sig?
the debian LEG?
I have a media server and p2p machine on an old Compaq Prolinea Desktop with an 133 Mhz Pentium and 96 MB RAM which runs Debian Sarge. The I/O-Performance is not very good but I can run mldonkey 24/7 without much noise.
Could this ARM device compete with this? And what is the use of 16000 Debian packages when I can only run very few of them in 32 MB RAM?
we slashdotted Linksys!
1: Can you attach a USB hub to it and daisy-chain devices?
2: If so, can you attach a printer and use it as a print server as well as a file?
In a word...
Yes!
And so am I. Please enlighten us as to why people hate ARM now.
There: Something at a specific location.
Their: Owned by someone.
Please make sure your english compiles.
And be served with an RIAA lawsuit!
"It's the height of ridiculousness to say for those 9 lines you get hundreds of millions."
So why doesn't Linksys admit the obvious and start selling a Linux Appliance sans WiFi hardware? They could increase volume, lower costs, and expand into a new area.
"It's the height of ridiculousness to say for those 9 lines you get hundreds of millions."
I'm pretty sure the daisy-chain thing works for any USB 2.0 port up to 256 devices.
Also, any Linux compatible USB printer should work since it runs Linux and has a USB port.
Can it use other USB 2.0 peripherals?
How much power does it consume? Better than a WRT54G?
Can it be further underclocked?
Namaste
that you'll be needing to add your own serial port.
NOTE: First page says that the built-in ethernet isn't working under the Debian install yet. Not thinking this will be useful for most people. I'll be getting one when that's worked out, I need a low-power box to run an HTTP proxy on.
RTFA. The NSLU has nothing to do with WIFI. Its a NAS device.
"The dinosaurs died because they didn't have a space program." - Niven
It's not our fault you prefer the never-changing BSD and the 1-button MAC mouse.
Weird, my MAC didn't even come with a mouse.
Oh, you mean my Macintosh? I don't use the bundled mouse, nor do I use the mouse that came with my Dell at work. Instead I use a pair of Logitech MX-1000 mice.
Mac and Linux have approximately the same desktop share... The trend is generally around 3%, with Linux slightly ahead.
w3school stats, highly unscientific
And, as a recent OSX switcher, you really don't miss the second mouse button... AppleKey + Click works, and it doesn't inconvenience me.
*has just spent three wonderful weeks discovering his new powerbook*
It's not our fault you prefer the never-changing BSD and the 1-button MAC mouse.
. pdf
Don't be a putz. It's not FreeBSD-6-Beta1, but it's not exactly 4.4BSD either.
http://developer.apple.com/unix/
http://images.apple.com/macosx/pdf/MacOSX_UNIX_TB
1) Yes, see http://www.nslu2-linux.org/ for more info. User's have succeded in adding USB based webcams, bluetooth, ethernet, flashdisks, etc. It's true USB 2.0 so anything that has a Linux driver that will compile under ARM should work fine.
It's flamebait because of the way he said it, not what he said.
It's possible to disagree with a point of view without being insulting.
Advanced users are users too!
Since both the NSLU2 and the Mac Mini support USB2, I don't really understand how one would have faster disk I/O than the other. Now, certainly, there can be questions about file system efficiency, but you could also say that the Mac Mini (for, granted, 5x the price) could have much faster I/O, since you have 256MB of RAM instead of 32MB for things like read-caching.
more stable
I'm very interested as to why the NSLU2 would be more stable than a Mac Mini. Personally, I think the short, square design of the Mini is more stable than the tall, tower design of the NSLU2. From a software standpoint, I'd say the two are rather comparable in stability for comparable activities (i.e., no complaining about 3D games crashing on the Mini when the NSLU2 doesn't even have a graphics chip).
more flexible
While the Mini's certainly not a flexibility powerhouse, I don't see the NSLU2 beating it out here, either. Software flexibility? Mac OS X has a lot of software available, both commerical and software libre (GPL/BSD). You can also run GNU/Linux on the Mini, including the Debian distribution with apt-get.
Not to mention the ability to hack it when I want (The warranty is already void!).
Open your Mini and replace the hard drive. Voila, both can be hacked at will because the warranty is void! ^__^
2) Probably about the same, but of course, a external hard drive is going to suck a lot more power... 3) No. The Intel arm chipped is locked at 266mhz. Linksys used a trick to underclock it. The hack simply restores it to the chips normal speed.
Hacking it will require strongarm tactics.
Buying largue quantities means you're exercising your right to bear ARMs.
People running to get them are conducting an ARMs race.
A beowulf cluster of these will be called an ARMy
Stallman's creating an OS specifically for this called GNU/HARM
They're marketing it and calling it a Linux-Installed Micro Box System (LIMBS) with a monitor called a Linux-Embedded Graphics Station (LEGS)
Oh God. Someone mod this boy up.
#define CLUE 0
Honestly, it took me 5 minutes from reading the slashdot post until ordering the NSLU2 from amazon. Lol.
This is so cool. Does anyone know about a USB 2.0 ISDN hardware that is supported by Debian ARM? I want to make this a PBX using Asterisk.
Christian
--- Eat my sig.
Unslung can be installed without using a serial port modification, because it simply uses the built-in Linksys web administration to upgrade the firmware to the Unslung distribution.
Once Unslung is installed, it only takes a matter of minutes to have your NSLU2 running Samba, OpenSSH, Apache, Slimserver, and even Asterisk!
Show me on the doll where his noodly appendage touched you.
let the flame wars begin! *ggg*
PS: does anyone know wether sd-cards work under openbsd now?
Sounds like a bug...
Doesn't Debian run on PPC?
What exactly are the applications that depend on the backass ints?
The article summary sez: "Serve files, music, web pages, printers, backups, kernel images, webcams/motion detection, firewalls/routers, wireless access point... or whatever." (emphasis mine)
That means the summary is mistaken, since firewall/router type applications are only practical with 2 ethernet ports attached. And I see no expansion slot to plug in a second NIC. Okay, if you're really brave, you might try an USB-to-ethernet adapter, but that isn't something I'd go for.>> Does it play Ogg=
> No!
Why doesn't it play Ogg?
--- Eat my sig.
Unslung supports USB memory sticks, so you don't actually have to use a HD with it.
Also, I have a 40 GB Segate attached to mine that is USB powered.
It still might use more power than the WRT54, but at least you don't need anymore power than is available with the NSLU2's adapter.
Show me on the doll where his noodly appendage touched you.
Okay thousands of Debian packages but many of them are graphical. Is there a way to hook up a monitor to this beastie?
CDE open sourced! https://sourceforge.net/projects/cdesktopenv/
install Debian on my Zaurus and be done with it?
A 400MHz xScale with 64MB flash will beat the socks off this little NSLU2, and you get direct audio in/out, USB, CF and SD storage.
"Nine times out of ten, starting a fire is not the best way to solve the problem." - my wife
This post meant to be useful to you and not condescending:
If you're using Firefox and you were viewing the page in it's own tab, you could install SessionSaver (or some other equivalent extension) and immediately go back and re-open (accidentally?) closed tabs.
works fine on itunes for windows.
Unfortunately it doesn't work with any on-demand services.
That slug must be really pissed off.
I would be too if I had all that elbow grease in my ARM.
I've tried (Asterisk is already ported for Unslung). Unfortunately, the NSLU2 just isn't powerful enough for that.
You can get one side of a conversation at most, and it's really jittery.
Try it out anyway - it's an easy install with Unslung!
Show me on the doll where his noodly appendage touched you.
The site you cite is nothing but a ripoff site designed to lure people into displaying its ads. The site is YEARS out of date, has never done anything to forward LInux on the iPAQ, and merely links to those of us who did the heavy lifting.
Please don't link to ipaqlinux.com. The proper place to find Linux for handhelds is handhelds.org.
-russ
Don't piss off The Angry Economist
The Kuro Box is a NAS-ish appliance with a PPC processor and an internal HD. A Gentoo port is available (currently in beta).
I've got to admit, the NLSU2 is a nifty little unit. Even if you're not modding it like this guy, there's lots of potential - you can install your own server daemons onto it (for example, the Twonkyvision UPnP media server can be installed on the device so you can serve media files without having your PC running).
But why USB2 ports? If you buy the NLSU2 as a home file server, you've then got to buy 2 USB drive bays, and have 3 slots on your power board - probably 5, because the NLSU2 and the USB drive enclosures will all have wall wart transformers and need the extra space between them. And then you have to work out how to organize 3 devices on your desk - and one of them is designed to stand upright.
The same device, but with onboard PATA/SATA interface rather USB would be fantastic. Is anyone out there manufacturing a similar device (i.e., ~$200, zero/web admin), but with 2 (or more) 3.5" drive bays and an [PS]ATA interface in it?
Russ %-)
... and never, ever play leapfrog with a unicorn.
you can. http://www.openzaurus.org/wordpress/
The days of the digital watch are numbered.
Stats for yesterday's hr2 robot slashdotting:6 496
http://www.nedstatbasic.net/s?tab=1&link=5&id=362
10% linux, 7.3 mac.
Yesterday during the peak of the article it was 60 xp, 20 linux, 10 win2k, 5 mac and other misc.
[Note: I wrote about this just a day ago here; I'm paraphrasing and shortening it below]
I just bought myself a wireless router, for the price of 5100 yen (about $45). Of course, it's a real, full single-board computer that happens to have excellent connectivity to everything. Add storage ability and interfaces through USB2 and you can start thinking up some really interesting uses for this kind of gear.
With the kind of price we're starting to see, there's no reason to have only one. How about having two, three or more of them at home, in different rooms to get good wireless coverage anywhere? They could present themselves as being one single friendly system to its users, transparently talking to each other wirelessly and move data to where it's needed.
The units with hard disks could be hidden away in closets or workrooms where the noise doesn't bother anyone, while the ones out in the livingroom or bedrooms would would be small and quiet and have extra communications abilities like being able to play music or show movies stored anywhere in the home network. They would act as an external redundant storage (more convenient and much safer than backing up on CD:s or DVD:s), as backup, as household web, mail and IP telephone server, climate controller and general communications forwarder (whether you are at home, using your cellphone, or being on some conference trip halfway around the world, you can get to your email, voice mail and IM in the same way).
You need more storage or some new hardware functionality? Just get another unit. When powered on it'll join the rest of them and suddenly your home has a bit of added capacity it didn't have before.
When highly capable hardware like this is coming down into the sub-10000yen range, a whole new range of uses is becoming feasible.
Trust the Computer. The Computer is your friend.
I've been looking into playing with Asterisk on my "Unslung" NSLU2. It lacks a FPU, which prevents using the more bandwidth effecient codecs. You'll be stuck with G.711 or GSM. GSM isn't bad, it just doesn't have a lot of support with the various IP phones.
I'm told it can handle about 4 phone calls at a time.
since ARM is still orders of magnitude more power-efficient than anything x86
This is utter bullshit.
On this page it says that at 133MHz, idle, the board consumes 8.6W. There are plenty of embedded x86 boards that run lower power and/or higher clock frequency.
For example, here's a board that runs at 133MHz, 5 Watt at 100% CPU load.
i installed a gentoo/os9 dual boot on my dad's ibook, and the right click is that extra enter button by the space bar with the middle click being fn+alt. thank goodness the screen is to small (800x600) to use drawing programs that take advantage of all three buttons
The ARM610 (1993ish vintage) was regarded as more powerful than a 486DX - a contemporary chip. ARM CPU designs do get more powerful, though there are also lower power devices in the current range, but the prices are nowhere near 1998 desktop prices. Look at the Philips LPC2000 series - under $10 for an ARM7 microcontroller with decent memory, flash and I/O.
I don't see why the inability for some people to program the device should reflect on it's capability (and I wouldn't call VoIP trivial)
Was that before or after you de-neutered it?
... And so it comes to this.
The Roku PhotoBridge ( http://rokulabs.com/products/photobridge/index.php ) has a 300MHz MIPS processor, high-definition video output, and digital audio out, all for under $300. Plus Linux is already preloaded, it couldn't be easier. Just plug it in and log on. There is even an SDK and active developer forums at http://rokulabs.com/forums/
By an odd coincidence, the next Linux Users' Group of Davis (August 15th, near Sacramento, California) meeting happens to be on this very topic!
Anybody familiar with this device know if there are any USB audio interfaces that would mate with this ARM machine? Forgive me for not searching myself, but what does the state of audio tools look like under ARM debian? How many USB device drivers are supported/exist? USB 'webcam' options?
:( If you know, post; if not, yes - I know about google.
How difficult would it be to turn this into a portable audio-capture (and streaming???) or playback device? Could I direct a USB audio interface input stream toward a USB attached HD? What bandwidth might I expect? At 266MHz could I real-time vorbis-encode and stream to disk or network? At what quality? (I'm not expecting much more than guesses here.) Is the vorbis encoder available for ARM and how efficient would this be compared to an X86 machine? Could I do FLAC? Again - leaving tomorrow so no time to search myself
For that matter, does anybody know of any small device that will record in a lossless format (ie. NOT 'voice' or 'mp3' recorder or in a proprietary format) with reasonable sample rate/resolution, has decent [read: low noise] line or mic inputs, removable media slot (or hackable to add a spinning magnetic media device), and doesn't cost >$250?
Everybody seems to be talking about network applications, but with a 12V battery, a keyboard and heads up display or audio interface (yes - I believe you can get software that generates a virtual, audible, terminal via voice prompts) this could be a wonderful wearable device. Do you think so? Too power hungry?
Just thinking/rambling. Tell me slashdot what you think (if you've got the time.)
See this one.
t ml t ml
You can buy it with $160.
http://supertank.iodata.jp/products/sotohdlwu/
CPU: SH-4/266MHz
DRAM: 64MB
NIC: 100BASE-TX (Realtek)
USB: 2.0 x2 (NEC)
SerialConsoleCable: (not include. extention$33)
HDD: 3.5 ATA HDD x2 (not include)
OS: Debian GNU/Linux SH (iohack version)
kernel: 2.4.21
daemons: mt-daapd, akaDAV, vsftpd, wizd,
mdnsresopnder, telnetd
Web reviews (Japanese)
http://pcweb.mycom.co.jp/column/jisakuparts/023/
http://bb.watch.impress.co.jp/cda/special/10056.h
http://bb.watch.impress.co.jp/cda/special/10074.h
The best use for that thing is to run eMule.
If so, it will replace what my home computer is doing all day...
You should have bought a gumstix insead. Or maybe a soekris.
The NSLU2 doesnt really have enough CPU for asterisk.
The crippling factor on the NSLU2 is the limited memory. Fine for what it's intended to do, but they to expand it's capabilities, and you hit the wall. Many people have this problem when trying to use it as a UPnP Mediaserver (using Twonkyvision). The hardware is simply not powerfull enough, or enough memory to cope with large scale media databases and heavy network media streaming.
If you can get hold of a copy of the Windows source code, I'm sure you could compile it to run on this device. Of course it's possible that Windows also has endian issues of its own. But that's because those stupid people at Motorola decided to put the "units" last instead of first. Human beings tend to write numbers that way, because it makes for easier magnitude comparison; but when doing mathematics you have to work backwards: units, tens,hundreds ..... so processor manufacturers such as Intel and MOS Technologies figured to put the units first and the 256es second. 8080 code took up more space than 6502 code so Intel soon found themselves having to put the 65536es third and the 16777216es fourth, but that's by the by. Meanwhile Motorola stuck with their arse-about-face numbers.
The original ARM1 was a pure 32-bit processor, with a 32-bit-wide word and no inbuilt concept of "byte order" as such. Its instruction set was inspired by the 6502, which powered the venerable BBC microcomputer; but with every instruction conditional. The ARM1 had no NOP instruction as such, but there was a "never" condition {the better for writing automutative code, since one need only alter the condition bits in an instruction to block its execution, but preserve the order bits. A simple loop can "comment out" a vast swathe of program; and, thanks to fully conditional execution, the same code can be used later to restore it by using a processor flag to signal "enable" or "disable"} but this rather wasteful {for the time; memory was expensive in those days} setup was eventually abandoned, and most of the "do something never" instruction codes were reused in later ARM revisions for extended instructions.
There is only one branch instruction in ARM1 assembly, BL. It makes the jump and stores the address that would have been next in a register. If you know that your subroutine is not re-entrant and you don't need that register for anything else, you don't need to worry about a stack. If you don't care about returning you can just ignore it.
Je fume. Tu fumes. Nous fûmes!
Due to the 2 fast USB2 ports and the ability to run Linux, this device is well suited for interface projects, eg. connecting any USB device to the internet. See my project about WLAN-interfaces for digital cameras, which uses the Linksys NSLU2 running Unslung-Linux (Kernel 2.4), gphoto and some scripts. It allows you to wirelessly operate almost any digital camera via Web-interface:. html
http://www.fh-furtwangen.de/~dersch/gphoto/remote
I have used the device to connect my Palm Tungsten and printers to the internet, there are more projects, see the yahoo-group.
In theory, a desktop device could be set up using a USB-VGA adapter and USB-connected keyboard+mouse. I have actually done that and ported the necessary VGA-drivers to Linux 2.4, see
http://www.fh-furtwangen.de/~dersch/. However, this will (a) increase cost considerably (more like 350USD/EUR), and (b) you end up with a 133/266MHz, 32 MB system, which is nowhere as powerful as eg. a Mac mini (and still lacks CD/DVD-drive).
Regards
H. Dersch
my personal dream configuration would look like this:
a) a small device, of the physical size of an iPod, and it only needs a small disc (1GB would be enough). On this device, I like to run my DNS server, DHCP server, NIS/LDAP server, netplan server, and all the tiny services that need to run on a network.
An iPod would be good for that if it only had an ethernet port. With a 10GB disc, it could also neatly run a CVS server.
b) a network attached disk. It should run NFS, Samba, FTP, and most importantly, it should work with a network authentification platform.
My personal favorite for this is currently NIS/NFS/autofs because it's so simple to set up and maintain. For a simple network (10 users), it's powerful enough.
They could just put this fancy ARM board on the harddisc, and sell it with an ethernet, instead of an IDE port.
Get in the people with blue hats and white Landcruisers. Quick, pass obscurely-worded resolutions. There's gonna be a war breaking out (again!).
Look buddy, if you're determined to troll for an Endian War, you're gonna get it on Slashdot. Best to let the veterans of that war be left sleeping.
K.
Crumbs. Pyrrhonist's done well for Karma from all of that!
for a debian LEG
My new blog
sounds fast
That's the only practical way to accomplish the task. Hacking a display card into it it NOT practical. Of course, then you need a remote PC to host the remote display, so hmmm...
It comes down to this: Don't expect the NSLU2 to function standalone; you need a remote console over Telnet or SSH or serial port, or use the Web interface in UnSlung, to operate the unit. (BTW, the "serial-port hack" is nothing overly extreme, a competent solderer can assemble it in short order.)
"My strength is as the strength of ten men, for I am wired to the eyeballs on espresso."
Consider the Sony Minidisc player/recorders; the media are quite good (magneto-optic discs), and the ATRAC codec is good at best-quality, though not strictly lossless. Form factor is pocket-calculator-sized.
BIG caveat: Until Sony's recent change of heart, there was NO way to get digital data out of the MD player for idiot DRM reasons, though the capability exists from a technical standpoint. (Makes it annoying to use it as a recorder, you have to play back the audio to another capture device at 1X speed...) I'd suggest checking out whether Sony has decrippled the system before buying.
"My strength is as the strength of ten men, for I am wired to the eyeballs on espresso."
Meh. You can install Linux on an MS Xbox, and the console costs only $150, not $200 like this setup. Not to mention that the Xbox has a built-in hard drive, DVD-ROM, video out, USB, a working Ethernet port...and it's an x86 processor as opposed to an ARM, so you're more likely to find precompiled applications for it.
It can use several other USB peripherals. Some are tested, some are not. Most USB scanners and cameras that are supported by SANE should work (My Canon IXUS for instance).
It consumes about 8.4W, slightly more if you de-underclock it to 266MHz.
It is not possible to underclock it to any lower speed than 133.
I haven't unsoldered R83.
Honestly, though, it doesn't really matter, because one phone call with only Asterisk running will push the NSLU2 to 100% CPU and produce massive jitter on the call regardless of the codec used. There's two issues involved here: One is the lack of an FPU, which limits the available codecs. The other is the fact that a lot of the Ethernet functionality of the device is implemented in the driver, so a good amount of CPU is spent transferring packets. If you bump up the CPU speed, you could probably get one good call out of the box, but as soon as you start making multiple calls and driving up the amount of data bouncing around the system, your call quality is going to suffer.
So, unless you want a PBX capable of only one concurrent call, it's not really the best device to use as a PBX. You could probably make a voicemail server out of it, but that's about it. If you want a still capable but small PBX, my advice to you would be to get a mini-ITX board, which can handle multiple concurrent calls (although some models do have half-speed FPUs).
The NSLU2 does, however, make quite a nice little HTTP/SSH/File server for home use. I have a Segate USB-powered HD hooked up to mine, so I hardly notice that it's on.
Show me on the doll where his noodly appendage touched you.
In some contexts, slug is a synonym for "bullet".;)
Is this a sigs-optional kind of place? 'Cause I am totally down with that if you know what I mean.
Does this thing run MPlayer?
I've been looking for just such a cheap, low noise/power device to "NASify" a bunch of external disks, but with USB 2.0 only support it's not all that useful (you can only get two HDs on there).
It's a little weird too, wouldn't 1394 be a better choise for these little buggers since it's less CPU intensive? Or are the controllers that much more expensive? It seems like availability shouldn't be an issue as most external hard drives support both.
sic transit gloria mundi
-- Heisenberg may have slept here.
if you find out if he did you will never know for how long.
However, if you figure out if he slept well you'll never know if it was here or there...
605413? Yes, it's a prime.
Twos Complement Arithmetic is sensible. Basically it's as though {in 8 bits} you add 256 to any negative number. Since you are already effectively working modulo 256 anyway, then everything Just Works.
Ones Complement appears simpler {one fewer operation in generating a negative number}; but then there is a correction to do after a subtraction if the answer is positive.
Once you have gone to the expense of building an adder array {or, in the case of a drum-memory computer, a single adder is plenty good enough}, you can easily have a "carry-in". Now if you put EOR gates {with one input commoned up} on the adder inputs, so you get a selectable inverter, that takes care of the "flipping ones and zeros" part of doing a negation. If you set the carry input then you can add an extra one, which completes the twos complement operation. What's more, the carry-out will be 1 if the answer is positive, and 0 if it is negative. {Do a few and prove it to yourself}. When doing a multi-word subtraction, this just happens to be right for what to use as carry-in for the next higher order word! So you can use one logic array as both an adder and subtractor, if you're prepared to live with the {slightly counter-intuitive} fact that the carry flag is also not-borrow.
A' = A + B + Cin
In "subtraction mode" we invert B, which {assuming 8 bit words} is equivalent to subtracting from 255;
A' = A + (255 - B) + Cin
If Cin = 1 then
A' = A + (255 - B) + 1
A' = A - B + 256
but since we are working modulo 256,
A' = A - B
If (A - B) is negative then Cout = 0. {This situation also indicates a borrow from a higher order word.}
I would have liked for there to have been a CCA instruction {for clear carry and add} and as SCS instruction {for set carry and subtract} in the 6502, but there wasn't. I'm sure the chip's designers had a good reason for the omission.
BTW, there is a "tens complement" for working in decimal {and correspondingly for all other bases}. To generate the tens complement of a decimal number, transform each digit of the subtrahend by subtracting it from nine {including enough imaginary leading zeros to match the length of the minuend} and add one. If you end up with an extra one on the beginning of the difference, ignore it. If you don't, then the difference is negative; so just take its tens complement and write a minus sign in front.
Je fume. Tu fumes. Nous fûmes!
*Want*, it can even act as a frontend for MythTV
In order to save our freedom it was necessary to destroy it.