How to Port Debian to a new architecture?

Discussion about development of the Debian OS itself
Post Reply
Message
Author
Michele13
Posts: 7
Joined: 2015-04-18 23:07

How to Port Debian to a new architecture?

#1 Post by Michele13 »

Hello There,

Recently a question has come into my mind: How can someone bootstrap debian, or debian-based distros such as Ubuntu, to a new (or a now unsupported) architecture? Can someone give me some instructions, some documentation from where to begin? By searchin on the Debian website I've found some clues:

1. https://www.debian.org/devel/buildd/
2. https://wiki.debian.org/DebianBootstrap

I'm not new to cross-compiling and building software from source, I've read (Cross) Linux From Scratch I build cross-compilers and compile stuff on a day to day basis and I like to study how distributions work under the hood. Unfortunately I'm still learning how to program in C, C++ and Python. However I like writing shell scripts a lot

User avatar
Head_on_a_Stick
Posts: 13450
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: How to Port Debian to a new architecture?

#2 Post by Head_on_a_Stick »

Michele13 wrote:How can someone bootstrap debian, or debian-based distros such as Ubuntu, to a new (or a now unsupported) architecture?
See https://wiki.debian.org/EmDebian/CrossDebootstrap & https://wiki.debian.org/Multistrap
Black Lives Matter

Debian buster-backports ISO image: for new hardware support

Michele13
Posts: 7
Joined: 2015-04-18 23:07

Re: How to Port Debian to a new architecture?

#3 Post by Michele13 »

Sorry, maybe I dis not explain well what I want to do: Let's suppose that I have some kind of system that has an architecture not supporter by debian. I would like to build debian from source code[\i] in order to produce a working system for that platform

LE_746F6D617A7A69
Posts: 517
Joined: 2020-05-03 14:16

Re: How to Port Debian to a new architecture?

#4 Post by LE_746F6D617A7A69 »

Michele13 wrote:Let's suppose that I have some kind of system that has an architecture not supporter by debian. I would like to build debian from source code[\i] in order to produce a working system for that platform


Are You really going to port Debian to some currently unsupported architecture - or Your question is just purely theoretical?
What is Your target architecture/platform?

Porting the entire system is a BIG topic, 2 most important requirements are:
1. You need a compiler which supports the target architecture.
2. The OS kernel (Linux / HURD / kFreeBSD) must support the target architecture, otherwise You will have to port the kernel first.

Regards.
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed

Michele13
Posts: 7
Joined: 2015-04-18 23:07

Re: How to Port Debian to a new architecture?

#5 Post by Michele13 »

LE_746F6D617A7A69 wrote:
Are You really going to port Debian to some currently unsupported architecture - or Your question is just purely theoretical?
What is Your target architecture/platform?
I'd say is both theorical and practical
I would like to port Ubuntu/Debian to i486. But I'm concerned about what would I have to do to if I wanted to port the system to something else. I think that Dpkg has a list of supported architettures, what should I do to add mine?
Porting the entire system is a BIG topic, 2 most important requirements are:
1. You need a compiler which supports the target architecture.
2. The OS kernel (Linux / HURD / kFreeBSD) must support the target architecture, otherwise You will have to port the kernel first.

Regards.
I've made a lot of practice to build cross-compilers and to build the Linux kernel for other Architectures

LE_746F6D617A7A69
Posts: 517
Joined: 2020-05-03 14:16

Re: How to Port Debian to a new architecture?

#6 Post by LE_746F6D617A7A69 »

Michele13 wrote:I would like to port Ubuntu/Debian to i486
Your joke is not funny for me - stop wasting our time. (i.e. the i486 architecture is dead)
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed

User avatar
Bloom
Posts: 365
Joined: 2017-11-11 12:23

Re: How to Port Debian to a new architecture?

#7 Post by Bloom »

Ubuntu doesn't support 32 bit architectures anymore. Debian does. So use the i386 architecture.

LE_746F6D617A7A69
Posts: 517
Joined: 2020-05-03 14:16

Re: How to Port Debian to a new architecture?

#8 Post by LE_746F6D617A7A69 »

Bloom wrote:Ubuntu doesn't support 32 bit architectures anymore. Debian does. So use the i386 architecture.
Debian have officially dropped support for i386 - now it supports i686 only:

https://lists.debian.org/debian-devel-a ... 00001.html

NOTE:
In case you missed that change, gcc for i386 has recently been changed
to target 686-class processors and is generating code that will crash
on other processors.

Regards
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed

Michele13
Posts: 7
Joined: 2015-04-18 23:07

Re: How to Port Debian to a new architecture?

#9 Post by Michele13 »

LE_746F6D617A7A69 wrote: Your joke is not funny for me - stop wasting our time. (i.e. the i486 architecture is dead)
I'm not joking, I just want to learn something new. Since when I discovered that Ubuntu dropped 32bit support (like Arch and others) I was wondering what could be done to continue using it on old PCs after 18.04 reached its EOL.
Bloom wrote: Ubuntu doesn't support 32 bit architectures anymore. Debian does. So use the i386 architecture.
That's fortunate. This is probably one of the reason I chose Debian as my main operative system. But what if Debian one day decided to do the same?
However my question remains always the same. What should I do if I wanted to port debian to a new computer architecture or to an abandoned one? It does not have to be i486, it can also be something else. (Risc V for example)
LE_746F6D617A7A69 wrote:
Bloom wrote:Ubuntu doesn't support 32 bit architectures anymore. Debian does. So use the i386 architecture.
Debian have officially dropped support for i386 - now it supports i686 only:

https://lists.debian.org/debian-devel-a ... 00001.html

NOTE:
In case you missed that change, gcc for i386 has recently been changed
to target 686-class processors and is generating code that will crash
on other processors.

Regards
So, for example, even if I specify something like i386-linux-musl in the target parameter when building the cross-compiler it will still generate i686 code?

LE_746F6D617A7A69
Posts: 517
Joined: 2020-05-03 14:16

Re: How to Port Debian to a new architecture?

#10 Post by LE_746F6D617A7A69 »

Michele13 wrote:So, for example, even if I specify something like i386-linux-musl in the target parameter when building the cross-compiler it will still generate i686 code?
You're still wasting our time:
Since gcc have dropped support for i386, it's Your job to handle the "special cases" - I'm guessing that nobody is interested in Your toy project which is targeting archaic architectures - If You really want to do this, You are on your own boat - You should either find other enthusiasts to create a team for working on Your project, or - just give up.

Regards.
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed

User avatar
pylkko
Posts: 1801
Joined: 2014-11-06 19:02

Re: How to Port Debian to a new architecture?

#11 Post by pylkko »

It's kind of ironic that one, and hopefully only person, that thinks that this discussion is "a waste of time" is participating in the discussion the most :lol:
What kind of decent person even uses that kind of language towards other people they do not know?

However, as stated, porting an OS to another new architecture starts from having compiler. If you really want to see this in practice, you can go look at the RISC-V Debian page, where there is the ongoing effort to bring RISC-V support to Debian. But essentially, first you need the compiler (think gcc, glibc, binutils etc). Then it becomes possible to compile the kernel. You probably want some kind of virtual/emulated environment to do initial development. There are core components of the OS that are needed to launch (bootloaders etc), and there are more peripheral packages that can be done later. You would want to use some kind of build system.

In your case, you would not be porting to a new architecture in the true sense, given that this architecture was once supported. It follows from this that you can use old compilers to create code that will run on the machine, or indeed old operating systems. In practice, therefore, it will make more sense to keep the machine on the latest LTS version of Ubuntu or Debian and take it offline/repurpose or dump it after that.

https://wiki.debian.org/RISC-V

cuckooflew
Posts: 681
Joined: 2018-05-10 19:34
Location: Some where out west

Re: How to Port Debian to a new architecture?

#12 Post by cuckooflew »

Michele13 »I think that Dpkg has a list of supported architettures, what should I do to add mine?
Learn how to do searches, and research these things before asking theoretical questions, that can be answered by doing your own research: EG:
https://wiki.debian.org/Teams/Dpkg/FAQ
========================

https://wiki.debian.org/Teams/Dpkg/FAQ# ... ectures.3F
Q. Can we add support for new dpkg architectures?--
Read it, ...if you really want to learn something.
I know dpkg has a list of supported architectures, you could have done a simple search to check that.
Did it ever even occur to you to read the dpkg-architecture manual ?
No, it didn't : Try

Code: Select all

$ dpkg-architecture -L  
Michele13 » I'm not new to cross-compiling and building software from source, I've read (Cross) Linux From Scratch I build cross-compilers and compile stuff on a day to day basis and I like to study how distributions work under the hood. Unfortunately I'm still learning how to program in C, C++ and Python. However I like writing shell scripts a lot
I don't buy this, it smells like a bull dumped it,... :mrgreen:
I like to study how distributions work under the hood.

Then why don't you try reading the manual, and documentation ? Why don't you know how to use search engines ? Is this some kind of home work project ?
Try pasting these keywords into a search engine:

Code: Select all

How to Port Debian to a new architecture? 
One of the many educational hits: https://ftp-master.debian.org/archive-criteria.html


P.S. I am inclined to think this is a waste of time myself, there is tons of documentation the OP could have read, and a lot of it is very informative, I am not going to waste any more time on it. ...
Please Read What we expect you have already Done
Search Engines know a lot, and
"If God had wanted computers to work all the time, He wouldn't have invented RESET buttons"
and
Just say NO to help vampires!

LE_746F6D617A7A69
Posts: 517
Joined: 2020-05-03 14:16

Re: How to Port Debian to a new architecture?

#13 Post by LE_746F6D617A7A69 »

pylkko wrote:It's kind of ironic that one, and hopefully only person, that thinks that this discussion is "a waste of time" is participating in the discussion the most :lol:
...sleepless night - I had a lot of time to waste...

The difference between RISC-V and i486 is quite obvious: RISC-V is the future, i486 is dead - and probably You won't even find a single working unit today (excluding museums) - why not ENIAC?

I think the OP has a good laugh while looking how You people are wasting Your time by writing lenghty posts and explaining everything You can to a person who never meant and never will port anything...
cuckooflew wrote:I don't buy this, it smells like a bull dumped it,... :mrgreen:
Exactly.
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed

Michele13
Posts: 7
Joined: 2015-04-18 23:07

Re: How to Port Debian to a new architecture?

#14 Post by Michele13 »

cuckooflew wrote: I don't buy this, it smells like a bull dumped it,... :mrgreen:
I'm not saying anithing unbelivable
cuckooflew wrote:
I like to study how distributions work under the hood.
Then why don't you try reading the manual, and documentation ? Why don't you know how to use search engines ? Is this some kind of home work project ?
Try pasting these keywords into a search engine:

Code: Select all

How to Port Debian to a new architecture?
I've tried to search on the net and there were tons of informations available that I didn't know where to start. I asked here because I wanted to know how a Debian Developer would attempt this task.
LE_746F6D617A7A69 wrote: You're still wasting our time:
...
I'm guessing that nobody is interested in Your toy project which is targeting archaic architectures - If You really want to do this, You are on your own boat - You should either find other enthusiasts to create a team for working on Your project, or - just give up.
I sincerely don't like your attitude, this is not the kind of behavior that you should have with someone who just approached to the forum. In such a manner you can drive users away from here and they could have a bad impression of the whole community. Not everyone has the kind of experience needed to troubleshoot his own problems, to do some tasks he needs to do, someone could even feel overwhelmed by the techical documentation on the website. Certain peolple might need a hand to learn how to do something.
LE_746F6D617A7A69 wrote: I think the OP has a good laugh while looking how You people are wasting Your time by writing lenghty posts and explaining everything You can to a person who never meant and never will port anything...
Do you think I'm some kind of troll? What makes you think that I might not try to attempt that? As a matter of fact, I've already started compiling dpkg by hand on a tiny i486 rootfs, now it's time for APT to join the party. My interest is in the i486 architecture, but someone else could be interested in porting the system to another architecture that is NOT obsolete and does not have a port yet. The questions that I made here can still help someone, I don't think that it is a waste of time to help me.

If someone thinks that I'm just playing with you and I'm wasting your precious time then do a favor to yourselves and don't reply

I asked this question to get some advices, to know where to start, perhaps someone could have guided me in what to read, in which order do things since there are a lot of informations to read on this site. Eg:
  1. 1. Build a toolchain,
    2. Bootstrap dpkg and developer tools,
    3. Setup a Buildd, etc
I don't want to be rude whith who tried to help me or to offend anyone, on the contrary, I want to thank all of you for the answers that you're giving me :)

cuckooflew
Posts: 681
Joined: 2018-05-10 19:34
Location: Some where out west

Re: How to Port Debian to a new architecture?

#15 Post by cuckooflew »

Ok well your welcome, but
I don't want to be rude whith who tried to help me or to offend anyone,
Then why are you doing that ?
Michele13 »I wanted to know how a Debian Developer would attempt this task.
Did you not notice: This is : Debian User Forums, we are all Debian Users, not developers..
Maybe try : https://www.debian.org/contact
Also,
https://www.debian.org/doc/manuals/deve ... urces.html
====================================================
I've tried to search on the net and there were tons of informations available that I didn't know where to start.
Start with reading some of the "tons" of information, a little bit at a time. This is also how Debian Developers learn what they need to learn to actually begin being a developer. https://www.debian.org/ Has all the information you need, diddling around here, with all the witty witty , (BS), is not the best place to start.
Although:
LE_746F6D617A7A69 wrote:
Michele13 wrote:Let's suppose that I have some kind of system that has an architecture not supporter by debian. I would like to build debian from source code[\i] in order to produce a working system for that platform


Are You really going to port Debian to some currently unsupported architecture - or Your question is just purely theoretical?
What is Your target architecture/platform?

Porting the entire system is a BIG topic, 2 most important requirements are:
1. You need a compiler which supports the target architecture.
2. The OS kernel (Linux / HURD / kFreeBSD) must support the target architecture, otherwise You will have to port the kernel first.

Regards.


The above was actually the best answer here, it is short and concise, they tell you the first 2 most important requirements, Why don't you start with that, and come back later when you have actually done something,? besides just talk.(I mean write), and they also explain, "
Porting the entire system is a BIG topic,", it is a HUGE topic, there are entire books on this, it is just plain silly to think it can be explained in a few forum posts, the "noise to signal ratio" will also be extremely high. In other words, stop wasting your time, and ours, start reading some material.
Below, in case you did not know what Hurd is
https://www.debian.org/ports/hurd/hurd-contact
================================
https://www.debian.org/ports/hurd/
================================
https://wiki.debian.org/Debian_GNU/Hurd
++++++++++++++++++++++++++++++++++++++++++++++++
You did say thanks, in a way, BUT, have you even looked at any of the links I provided, and read them? it does not sound like you have,... I gave you some links to help get you started, but you still keep asking How to get started ?,... :?: ... This one in particular, should be of interest:https://wiki.debian.org/Teams/Dpkg/FAQ# ... ectures.3F
I all ready posted it, but I don't think the OP even followed it and read it,....so I am going to copy paste part, this would not be necessary , if the person really was trying to learn something. Any way:
Q. Can we add support for new dpkg architectures?

A: Sure. These are the current requirements for a new dpkg architecture:

It should have an official GNU triplet in the GNU config project.

It should have support merged upstream in at least GNU binutils, gcc, and the respective libc project used.

It should not require the machine manufacturer (or vendor) part of the GNU triplet to be used to distinguish the ABI, nor it should expose it as unknown in the GNU triplet names nor internally in the Debian tuple.
It should not have the same (full) ABI as any existing dpkg architecture.
The mapping between a GNU triplet and a dpkg architecture should be 1:1 (i.e. bijective).
The dpkg architecture name should have been vetted by the current architecture porting team and/or the dpkg maintainers.
The dpkg architecture name should try to use a pattern similar to an already existing and related architecture (although there's existing exceptions to this due to historical reasons, but those should not be used as precedent!).
The bits size gets appended to the base architecture cpu name (for example sparc and sparc64).

The endianness gets appended to the base architecture cpu name. The suffixes are eb for big-endian and el for little-endian. If the architecture is not capable of operating with either endianness, then there's no need to suffix it. If one of the endianness is the prevalent one and the other sees marginal use, then the prevalent one can obviate the endianness suffix.
The dpkg architecture name has the following additional characteristics:

The name is a tuple with the components in reverse order compared to the GNU triplet, <abi>-<libc>-<kernel>-<cpu>.

If the tuple only has one component the <kernel> is assumed to be linux.

If the tuple is kernel independent then <kernel> should be none.

If the tuple only has one or two components the <libc> is assumed to be the baseline for that port, so on a glibc-centric port uncommon variations should use the three or four-form triplet (e.g. uclibc or musl variants).

If the tuple only has three components the <abi> is assumed to be the baseline for that port, which will be assumed to be base.

If the <abi> is different than base, then it will normally be the merged ABI part of the GNU triplet as <cpu>-<kernel>-<libc><abi> in something like arm-linux-gnueabi with gnu and eabi respectively.

Actually, I quoted all of it.
Any way, it is not a total waste of time, based on the title, "How to Port Debian to a new architecture?".
there might be someone genuinely interested and trying to learn about this, and if they stumble on to it , they will read the topic, and have various sources to help them get started. ,... But I still can't take the OP seriously, if they are serious, they need to stop the BS, and start the actual reading/studying and trying some things,... that is the work part.
Please Read What we expect you have already Done
Search Engines know a lot, and
"If God had wanted computers to work all the time, He wouldn't have invented RESET buttons"
and
Just say NO to help vampires!

cuckooflew
Posts: 681
Joined: 2018-05-10 19:34
Location: Some where out west

Re: How to Port Debian to a new architecture?

#16 Post by cuckooflew »

I also suggest that you don't derail your own topic with this kind of nonsense:
by Michele13 »
I sincerely don't like your attitude, this is not the kind of behavior that you should have with someone who just approached to the forum. In such a manner you can drive users away from here and they could have a bad impression of the whole community.
First , nobody cares if you like our/their attitude or not, Second, someone so narrow minded ,as to judge the entire community based on the manner of 2 or 3 persons that they are "driven away", when in fact they just go away on their own,... well it is best when they just go away.
Did you read this: Please Read.. What we expect you have already Done., when you first joined the forum ? If you have not read it, you really should.
1) We expect that you have used Google or another search engine to find your answer.
In away this first line is humorous, Obviously if the person used a search engine to find their answer, they would not need to ask here, or anywhere else,... so go figure... But read the rest, if you want to undersand a little about our "philosophy" ,... :mrgreen:
And remember, I showed you a command, that you would have used , if you had read the manual,..remember ?
Michele13 »I think that Dpkg has a list of supported architettures, what should I do to add mine?
Key words " I think",... If you had read the manual, you would have said "I know",.... the other part :
what should I do to add mine?
Was answered when I did a search, keywords "How to add a new architecture to dpkg ? "
The first hit: https://wiki.debian.org/Teams/Dpkg/FAQ
and the index showed, https://wiki.debian.org/Teams/Dpkg/FAQ# ... ectures.3F
So, don't derail your own topic, calling people rude, and trying to BS us, claiming you tried to find information doing searches,... We know the information will come up if we do some good search foo, that is how we find the information we need to solve our problems and in many cases the problems others have as well. Learning how to search data bases, is probably the first thing you need to learn, ....heck , even on my PC, I have so much info and documentation, I can not possibly remember it all, and it goes back as far as mid 19080's, so we need to learn not just to use google, but also search the data bases on our systems, they are filled with info, EG : the manual, and a command:

Code: Select all

$ dpkg-architecture -L 
, so I know, dpkg has a list, and it is a very BIG list,.....
Last edited by cuckooflew on 2020-05-18 20:09, edited 1 time in total.
Please Read What we expect you have already Done
Search Engines know a lot, and
"If God had wanted computers to work all the time, He wouldn't have invented RESET buttons"
and
Just say NO to help vampires!

cuckooflew
Posts: 681
Joined: 2018-05-10 19:34
Location: Some where out west

Re: How to Port Debian to a new architecture?

#17 Post by cuckooflew »

Michele13 » Certain peolple might need a hand to learn how to do something.
Oh, and another thing..Actually not just "certain people", most , probably everyone needs a hand, that is why we have schools and teachers, that is why we put our documentation on a webserver, (online), but saddly so many clueless teachers and clueless students , remain clueless , because they never learn or teach , "How to use a search engine" nor "how to search a data base".
It is also why Debian.org has a mentor program, where those trying to learn these things can ask for a mentor, and start working with the mentor and other developers, packagers, etc. I am NOT going to give you any more hand holding and hand outs, if you are serious, I still have my doubts, but for someone else that is really serious, go practice your search foo, the words Debian and mentors is all you need to find out more, if you really try.
Please Read What we expect you have already Done
Search Engines know a lot, and
"If God had wanted computers to work all the time, He wouldn't have invented RESET buttons"
and
Just say NO to help vampires!

Post Reply