SlideShare ist ein Scribd-Unternehmen logo
1 von 24
U-boot Source Code Clean
        Up Project
          and
         How-to

  Recruiting Volunteers!
        Macpaul Lin
        (2012/08/18)
Outline
• Why do we do clean up?
• Who should join the clean up project?
  And How will you be benefited with it?
• How to do the clean up work?
• Summary.
Why do we do clean up?
• U-boot is old.
  – It is an old boot loader project and widely be
    used in various embedded systems.
  – There are many dirty historical codes. Linux
    has them, too.
• Coding style are mixed.
  – It supports booting OS from various different
    devices which leverage codes from various
    open source projects. Such as dlmalloc, Linux,
    and etc.
Why do we do clean up?
• Developers usually get confused.
  – Some coding style really introduce problem
    when doing debugging.
  – New contributor usually get confused between
    old and new coding style.
    • This usually lead unnecessary time cost when
      developers reviewing and fixing their patches.
Why do we do clean up?
• It follows Linux coding style.
• However, since u-boot has long history just
  like Linux kernel, source codes some were
  dirty and need to be clean up.
• New comers and new contributors usually
  reference the old coding style. Hence the
  patch is usually need to be reworked and
  viewers spent lots of effort on replying mail.
Who should join the clean up project
  and how will you be benefits with it?
• U-boot uses git and mailing list to
  management the source code developing.
  – Student who wants to be familiar with git
    source version control.
  – Student who wants to join a open source
    project and practice with patch commitment
    mailing discussion.
  – People who is interested in boot loader with
    embedded device development environments.
How to do the clean up work?
• U-boot project uses the checkpatch.pl in
  Linux kernel to check the patches.
• Clean up patches must obey both Linux
  coding style and u-boot coding style.
• Coding style
  – http://www.denx.de/wiki/U-Boot/CodingStyle

• Patch rules
  – http://www.denx.de/wiki/U-Boot/Patches
Steps to join u-boot project
1. Sign-up the mailing list
2. Clone the source code
3. Use checkpatch.pl to check the old
codes.
4. Fix warnings reported by checkpatch.pl
5. Use git send-email to commit the
cleanup back to mailing list.
6. Fix your patch if maintainer give you
suggestion to fix.
1. Sign-up the mailing list
• Subscribe
  http://lists.denx.de/mailman/listinfo/u-boot




                                      Don't choose "yes"
                                    because maintainers
                                will reply your patch by mail.
2. Clone the source code
• Clone the source code
  – git clone git://git.denx.de/u-boot.git u-boot.git
• Setting git users and email
  – git config --global user.name "yourname";
  – git config --global user.email "you@youremail";
• Make a working branch
  – cd u-boot.git
  – git branch cleanup
• Checkout the working branch and getting start
  – git checkout cleanup
3. Use checkpatch.pl to check
         the old codes.
• Once you finish a patch, use
  tools/checkpatch.pl to verify the patch is
  clean before send it out.
• So we can use this checkpatch.pl to check
  if the current files are clean.
• Most of the old code is inside “common
  folder".
3. Use checkpatch.pl to check
         the old codes.
• 3.0 Export the path of checkpatch.pl into
  $PATH
  – export PATH=$PATH:~/u-boot.git/tools
3. Use checkpatch.pl to check
         the old codes.
• 3.1 find a unclean file in folder “common”
  – For example: "bedbug.c"
  – cd common
• 3.2 copy it as a backup
  – cp bedbug.c bedbug.c.bak
3. Use checkpatch.pl to check
         the old codes.
• 3.3 remove “bedbug.c” as commit 'A'
  because we will check the whole file later
  – git rm bedbug.c
  – git commit -s
     • Input some reason because this is just a temporary
       work.
3. Use checkpatch.pl to check
         the old codes.
• 3.4 now we recover the unclean file and
  make this as a commit 'B'.
  – mv bedbug.c.bak bedbug.c
  – git add bedbug.c
  – git commit -s
    • Input the real commit log.
4. Fix warnings reported by
           checkpatch.pl
• 4.1 Create a folder for this commit 'B'
  – mkdir patch
  – cd patch
• 4.2 Export this commit 'B' (the latest
  commit) and use checkpatch.pl to get the
  report.
  – git format-patch HEAD~1

  – checkpatch 0001-cosmetic-add-bedbug.c-
    back.patch
4. Fix warnings reported by
           checkpatch.pl
• 4.3 You will get the report from checkpatch.
4. Fix warnings reported by
           checkpatch.pl
• 4.4 Now you can fix all the error of
  bedbug.c with your favorite editor based on
  this report.
  – cd .. (back to “common" folder)
  – vim bedbug.c
  – (you can also use “git diff” to check your
    changes)
4. Fix warnings reported by
           checkpatch.pl
• 4.5 Create a clean commit "C" as the result
  of your work.
  – git add debug.c
  – git commit -s
4. Fix warnings reported by
           checkpatch.pl
• 4.6 Now you have 3 commits “A,B,C” in
  "cleanup" branch
4. Fix warnings reported by
           checkpatch.pl
• 4.7 We only need the last commit "C" to
  send back to mailing list.
  – Remove commit "B" in patch folder
    • rm patch/0001-cosmetic-add-bedbug.c-back.patch
  – Export the final patch commit "C"
    • cd patch
    • git format-patch HEAD~1

  – Use checkpatch.pl to check it again.
    • checkpatch 0001-cosmetic-clean-up-common-
      bedbug.c-by-checkpatch.pl.patch
5. Use git send-email to commit
 the cleanup back to mailing list.
• 5.1 Finally send the patch out.
  – git send-email 0001-cosmetic-clean-up-
    common-bedbug.c-by-checkpatch.pl.patch
  – Remember add maintainers to “To:” list to
    review the patch.
6. Fix your patch if maintainer
    give you suggestion to fix.
• After a maintainer reviewed your patch, he
  will reply your mail to inform you if the
  patch has been accepted or the patch is
  still need to be fixed.
Summary
• There are many old-style codes need to be
  cleaned up. We need your help.
• Please join u-boot project.
  – Just subscribe
    http://lists.denx.de/mailman/listinfo/u-boot

Weitere ähnliche Inhalte

Was ist angesagt?

Distro Recipes 2013 : Upstream management and consequences on the distributi...
Distro Recipes 2013 : Upstream management and consequences on the  distributi...Distro Recipes 2013 : Upstream management and consequences on the  distributi...
Distro Recipes 2013 : Upstream management and consequences on the distributi...
Anne Nicolas
 
Kernel maintainance in Linux distributions: Debian
Kernel maintainance in Linux distributions: DebianKernel maintainance in Linux distributions: Debian
Kernel maintainance in Linux distributions: Debian
Anne Nicolas
 
OpenNebula Conf 2014: CentOS, QA an OpenNebula - Christoph Galuschka
OpenNebula Conf 2014: CentOS, QA an OpenNebula - Christoph GaluschkaOpenNebula Conf 2014: CentOS, QA an OpenNebula - Christoph Galuschka
OpenNebula Conf 2014: CentOS, QA an OpenNebula - Christoph Galuschka
NETWAYS
 

Was ist angesagt? (20)

Upgrading CentOS on the Facebook fleet
Upgrading CentOS on the Facebook fleetUpgrading CentOS on the Facebook fleet
Upgrading CentOS on the Facebook fleet
 
Introduce fuego
Introduce fuegoIntroduce fuego
Introduce fuego
 
.NET on Linux: Entity Framework Core 1.0
.NET on Linux: Entity Framework Core 1.0.NET on Linux: Entity Framework Core 1.0
.NET on Linux: Entity Framework Core 1.0
 
Distro Recipes 2013 : Upstream management and consequences on the distributi...
Distro Recipes 2013 : Upstream management and consequences on the  distributi...Distro Recipes 2013 : Upstream management and consequences on the  distributi...
Distro Recipes 2013 : Upstream management and consequences on the distributi...
 
Kernel Recipes 2016 - Kernel documentation: what we have and where it’s going
Kernel Recipes 2016 - Kernel documentation: what we have and where it’s goingKernel Recipes 2016 - Kernel documentation: what we have and where it’s going
Kernel Recipes 2016 - Kernel documentation: what we have and where it’s going
 
Kernel Recipes 2016 - The kernel report
Kernel Recipes 2016 - The kernel reportKernel Recipes 2016 - The kernel report
Kernel Recipes 2016 - The kernel report
 
Brief introduction to kselftest
Brief introduction to kselftestBrief introduction to kselftest
Brief introduction to kselftest
 
Linux Kernel - Let's Contribute!
Linux Kernel - Let's Contribute!Linux Kernel - Let's Contribute!
Linux Kernel - Let's Contribute!
 
Tutorial contributing to nf-core
Tutorial contributing to nf-coreTutorial contributing to nf-core
Tutorial contributing to nf-core
 
nf-core usage tutorial
nf-core usage tutorialnf-core usage tutorial
nf-core usage tutorial
 
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the WebCleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
 
Kernel maintainance in Linux distributions: Debian
Kernel maintainance in Linux distributions: DebianKernel maintainance in Linux distributions: Debian
Kernel maintainance in Linux distributions: Debian
 
Yocto Project introduction
Yocto Project introductionYocto Project introduction
Yocto Project introduction
 
Kernel Recipes 2016 - Kernel documentation: what we have and where it’s going
Kernel Recipes 2016 - Kernel documentation: what we have and where it’s goingKernel Recipes 2016 - Kernel documentation: what we have and where it’s going
Kernel Recipes 2016 - Kernel documentation: what we have and where it’s going
 
Docker 2014
Docker 2014Docker 2014
Docker 2014
 
OPNFV Developer Tools and Release Process
OPNFV Developer Tools and Release ProcessOPNFV Developer Tools and Release Process
OPNFV Developer Tools and Release Process
 
Poky meets Debian: Understanding how to make an embedded Linux by using an ex...
Poky meets Debian: Understanding how to make an embedded Linux by using an ex...Poky meets Debian: Understanding how to make an embedded Linux by using an ex...
Poky meets Debian: Understanding how to make an embedded Linux by using an ex...
 
BKK16-400A LuvOS and ACPI Compliance Testing
BKK16-400A LuvOS and ACPI Compliance TestingBKK16-400A LuvOS and ACPI Compliance Testing
BKK16-400A LuvOS and ACPI Compliance Testing
 
OpenNebula Conf 2014: CentOS, QA an OpenNebula - Christoph Galuschka
OpenNebula Conf 2014: CentOS, QA an OpenNebula - Christoph GaluschkaOpenNebula Conf 2014: CentOS, QA an OpenNebula - Christoph Galuschka
OpenNebula Conf 2014: CentOS, QA an OpenNebula - Christoph Galuschka
 
Puppet Camp Sydney 2015: Puppet and AWS is easy right.....?
Puppet Camp Sydney 2015: Puppet and AWS is easy right.....? Puppet Camp Sydney 2015: Puppet and AWS is easy right.....?
Puppet Camp Sydney 2015: Puppet and AWS is easy right.....?
 

Andere mochten auch

USB Specification 2.0 - Chapter 9 - Device Framework
USB Specification 2.0 - Chapter 9 - Device FrameworkUSB Specification 2.0 - Chapter 9 - Device Framework
USB Specification 2.0 - Chapter 9 - Device Framework
Macpaul Lin
 
U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoC
Macpaul Lin
 
政黨票的故事
政黨票的故事政黨票的故事
政黨票的故事
Macpaul Lin
 
Porting a new architecture (NDS32) to open wrt project
Porting a new architecture (NDS32) to open wrt projectPorting a new architecture (NDS32) to open wrt project
Porting a new architecture (NDS32) to open wrt project
Macpaul Lin
 
Why sending patches back is so important
Why sending patches back is so importantWhy sending patches back is so important
Why sending patches back is so important
Macpaul Lin
 
OpenWRT, A value-add base solution for your product. (2nd, Macpual)
OpenWRT, A value-add base solution for your product. (2nd, Macpual)OpenWRT, A value-add base solution for your product. (2nd, Macpual)
OpenWRT, A value-add base solution for your product. (2nd, Macpual)
Macpaul Lin
 
從u-boot 移植 NDS32 談 嵌入式系統開放原始碼開發的 一些經驗
從u-boot 移植 NDS32 談 嵌入式系統開放原始碼開發的 一些經驗從u-boot 移植 NDS32 談 嵌入式系統開放原始碼開發的 一些經驗
從u-boot 移植 NDS32 談 嵌入式系統開放原始碼開發的 一些經驗
Macpaul Lin
 
Linux Power Management Slideshare
Linux Power Management SlideshareLinux Power Management Slideshare
Linux Power Management Slideshare
Patrick Bellasi
 

Andere mochten auch (20)

U boot 程式碼打掃計畫
U boot 程式碼打掃計畫U boot 程式碼打掃計畫
U boot 程式碼打掃計畫
 
How to build a community in a company blue&macpaul coscup2015
How to build a community in a company blue&macpaul coscup2015How to build a community in a company blue&macpaul coscup2015
How to build a community in a company blue&macpaul coscup2015
 
Bootstrap process of u boot (NDS32 RISC CPU)
Bootstrap process of u boot (NDS32 RISC CPU)Bootstrap process of u boot (NDS32 RISC CPU)
Bootstrap process of u boot (NDS32 RISC CPU)
 
USB Specification 2.0 - Chapter 9 - Device Framework
USB Specification 2.0 - Chapter 9 - Device FrameworkUSB Specification 2.0 - Chapter 9 - Device Framework
USB Specification 2.0 - Chapter 9 - Device Framework
 
U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoC
 
政黨票的故事
政黨票的故事政黨票的故事
政黨票的故事
 
Porting linux to a new architecture
Porting linux to a new architecturePorting linux to a new architecture
Porting linux to a new architecture
 
Porting a new architecture (NDS32) to open wrt project
Porting a new architecture (NDS32) to open wrt projectPorting a new architecture (NDS32) to open wrt project
Porting a new architecture (NDS32) to open wrt project
 
Linux Porting
Linux PortingLinux Porting
Linux Porting
 
Why sending patches back is so important
Why sending patches back is so importantWhy sending patches back is so important
Why sending patches back is so important
 
Module 4 Embedded Linux
Module 4 Embedded LinuxModule 4 Embedded Linux
Module 4 Embedded Linux
 
Qt5 embedded
Qt5 embeddedQt5 embedded
Qt5 embedded
 
OpenWRT, A value-add base solution for your product. (2nd, Macpual)
OpenWRT, A value-add base solution for your product. (2nd, Macpual)OpenWRT, A value-add base solution for your product. (2nd, Macpual)
OpenWRT, A value-add base solution for your product. (2nd, Macpual)
 
Constrained Power Management
Constrained Power ManagementConstrained Power Management
Constrained Power Management
 
Evoluzione dei Sistemi Embedded: Verso architetture multi-core
Evoluzione dei Sistemi Embedded: Verso architetture multi-coreEvoluzione dei Sistemi Embedded: Verso architetture multi-core
Evoluzione dei Sistemi Embedded: Verso architetture multi-core
 
高效能執行緒
高效能執行緒高效能執行緒
高效能執行緒
 
Porting Android
Porting AndroidPorting Android
Porting Android
 
Cross-Layer Frameworks for Constrained Power and Resources Management of Embe...
Cross-Layer Frameworks for Constrained Power and Resources Management of Embe...Cross-Layer Frameworks for Constrained Power and Resources Management of Embe...
Cross-Layer Frameworks for Constrained Power and Resources Management of Embe...
 
從u-boot 移植 NDS32 談 嵌入式系統開放原始碼開發的 一些經驗
從u-boot 移植 NDS32 談 嵌入式系統開放原始碼開發的 一些經驗從u-boot 移植 NDS32 談 嵌入式系統開放原始碼開發的 一些經驗
從u-boot 移植 NDS32 談 嵌入式系統開放原始碼開發的 一些經驗
 
Linux Power Management Slideshare
Linux Power Management SlideshareLinux Power Management Slideshare
Linux Power Management Slideshare
 

Ähnlich wie U boot source clean up project how-to

Openstack contribution process
Openstack contribution processOpenstack contribution process
Openstack contribution process
Syed Armani
 
OpenStack Contribution Process
OpenStack Contribution ProcessOpenStack Contribution Process
OpenStack Contribution Process
openstackindia
 
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
Aaron Meurer
 
RedisConf18 - Implementing a New Data Structure for Redis
RedisConf18 - Implementing a New Data Structure for Redis  RedisConf18 - Implementing a New Data Structure for Redis
RedisConf18 - Implementing a New Data Structure for Redis
Redis Labs
 
Assign, commit, and review - A developer’s guide to OpenStack contribution-20...
Assign, commit, and review - A developer’s guide to OpenStack contribution-20...Assign, commit, and review - A developer’s guide to OpenStack contribution-20...
Assign, commit, and review - A developer’s guide to OpenStack contribution-20...
OpenCity Community
 

Ähnlich wie U boot source clean up project how-to (20)

PyCourse - Self driving python course
PyCourse - Self driving python coursePyCourse - Self driving python course
PyCourse - Self driving python course
 
Source control
Source controlSource control
Source control
 
Openstack contribution process
Openstack contribution processOpenstack contribution process
Openstack contribution process
 
OpenStack Contribution Process
OpenStack Contribution ProcessOpenStack Contribution Process
OpenStack Contribution Process
 
Effective C++
Effective C++Effective C++
Effective C++
 
Packaging perl (LPW2010)
Packaging perl (LPW2010)Packaging perl (LPW2010)
Packaging perl (LPW2010)
 
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using Git
 
Bitbucket git-bamboo-jira
Bitbucket git-bamboo-jiraBitbucket git-bamboo-jira
Bitbucket git-bamboo-jira
 
Mercurial training
 Mercurial training Mercurial training
Mercurial training
 
Automatic codefixes
Automatic codefixesAutomatic codefixes
Automatic codefixes
 
Reflections on Trusting Trust
Reflections on Trusting TrustReflections on Trusting Trust
Reflections on Trusting Trust
 
RedisConf18 - Implementing a New Data Structure for Redis
RedisConf18 - Implementing a New Data Structure for Redis  RedisConf18 - Implementing a New Data Structure for Redis
RedisConf18 - Implementing a New Data Structure for Redis
 
Porting a legacy app to python 3
Porting a legacy app to python 3Porting a legacy app to python 3
Porting a legacy app to python 3
 
TYPO3 8 is here - how we keep EXT:solr uptodate with the TYPO3 core
TYPO3 8 is here - how we keep EXT:solr uptodate with the TYPO3 coreTYPO3 8 is here - how we keep EXT:solr uptodate with the TYPO3 core
TYPO3 8 is here - how we keep EXT:solr uptodate with the TYPO3 core
 
Git and Github
Git and GithubGit and Github
Git and Github
 
Facilitating continuous delivery in a FinTech world with Salt, Jenkins, Nexus...
Facilitating continuous delivery in a FinTech world with Salt, Jenkins, Nexus...Facilitating continuous delivery in a FinTech world with Salt, Jenkins, Nexus...
Facilitating continuous delivery in a FinTech world with Salt, Jenkins, Nexus...
 
Facilitating continuous delivery in a FinTech world with Salt, Jenkins, Nexus...
Facilitating continuous delivery in a FinTech world with Salt, Jenkins, Nexus...Facilitating continuous delivery in a FinTech world with Salt, Jenkins, Nexus...
Facilitating continuous delivery in a FinTech world with Salt, Jenkins, Nexus...
 
Assign, commit, and review - A developer’s guide to OpenStack contribution-20...
Assign, commit, and review - A developer’s guide to OpenStack contribution-20...Assign, commit, and review - A developer’s guide to OpenStack contribution-20...
Assign, commit, and review - A developer’s guide to OpenStack contribution-20...
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
 

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Kürzlich hochgeladen (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

U boot source clean up project how-to

  • 1. U-boot Source Code Clean Up Project and How-to Recruiting Volunteers! Macpaul Lin (2012/08/18)
  • 2. Outline • Why do we do clean up? • Who should join the clean up project? And How will you be benefited with it? • How to do the clean up work? • Summary.
  • 3. Why do we do clean up? • U-boot is old. – It is an old boot loader project and widely be used in various embedded systems. – There are many dirty historical codes. Linux has them, too. • Coding style are mixed. – It supports booting OS from various different devices which leverage codes from various open source projects. Such as dlmalloc, Linux, and etc.
  • 4. Why do we do clean up? • Developers usually get confused. – Some coding style really introduce problem when doing debugging. – New contributor usually get confused between old and new coding style. • This usually lead unnecessary time cost when developers reviewing and fixing their patches.
  • 5. Why do we do clean up? • It follows Linux coding style. • However, since u-boot has long history just like Linux kernel, source codes some were dirty and need to be clean up. • New comers and new contributors usually reference the old coding style. Hence the patch is usually need to be reworked and viewers spent lots of effort on replying mail.
  • 6. Who should join the clean up project and how will you be benefits with it? • U-boot uses git and mailing list to management the source code developing. – Student who wants to be familiar with git source version control. – Student who wants to join a open source project and practice with patch commitment mailing discussion. – People who is interested in boot loader with embedded device development environments.
  • 7. How to do the clean up work? • U-boot project uses the checkpatch.pl in Linux kernel to check the patches. • Clean up patches must obey both Linux coding style and u-boot coding style. • Coding style – http://www.denx.de/wiki/U-Boot/CodingStyle • Patch rules – http://www.denx.de/wiki/U-Boot/Patches
  • 8. Steps to join u-boot project 1. Sign-up the mailing list 2. Clone the source code 3. Use checkpatch.pl to check the old codes. 4. Fix warnings reported by checkpatch.pl 5. Use git send-email to commit the cleanup back to mailing list. 6. Fix your patch if maintainer give you suggestion to fix.
  • 9. 1. Sign-up the mailing list • Subscribe http://lists.denx.de/mailman/listinfo/u-boot Don't choose "yes" because maintainers will reply your patch by mail.
  • 10. 2. Clone the source code • Clone the source code – git clone git://git.denx.de/u-boot.git u-boot.git • Setting git users and email – git config --global user.name "yourname"; – git config --global user.email "you@youremail"; • Make a working branch – cd u-boot.git – git branch cleanup • Checkout the working branch and getting start – git checkout cleanup
  • 11. 3. Use checkpatch.pl to check the old codes. • Once you finish a patch, use tools/checkpatch.pl to verify the patch is clean before send it out. • So we can use this checkpatch.pl to check if the current files are clean. • Most of the old code is inside “common folder".
  • 12. 3. Use checkpatch.pl to check the old codes. • 3.0 Export the path of checkpatch.pl into $PATH – export PATH=$PATH:~/u-boot.git/tools
  • 13. 3. Use checkpatch.pl to check the old codes. • 3.1 find a unclean file in folder “common” – For example: "bedbug.c" – cd common • 3.2 copy it as a backup – cp bedbug.c bedbug.c.bak
  • 14. 3. Use checkpatch.pl to check the old codes. • 3.3 remove “bedbug.c” as commit 'A' because we will check the whole file later – git rm bedbug.c – git commit -s • Input some reason because this is just a temporary work.
  • 15. 3. Use checkpatch.pl to check the old codes. • 3.4 now we recover the unclean file and make this as a commit 'B'. – mv bedbug.c.bak bedbug.c – git add bedbug.c – git commit -s • Input the real commit log.
  • 16. 4. Fix warnings reported by checkpatch.pl • 4.1 Create a folder for this commit 'B' – mkdir patch – cd patch • 4.2 Export this commit 'B' (the latest commit) and use checkpatch.pl to get the report. – git format-patch HEAD~1 – checkpatch 0001-cosmetic-add-bedbug.c- back.patch
  • 17. 4. Fix warnings reported by checkpatch.pl • 4.3 You will get the report from checkpatch.
  • 18. 4. Fix warnings reported by checkpatch.pl • 4.4 Now you can fix all the error of bedbug.c with your favorite editor based on this report. – cd .. (back to “common" folder) – vim bedbug.c – (you can also use “git diff” to check your changes)
  • 19. 4. Fix warnings reported by checkpatch.pl • 4.5 Create a clean commit "C" as the result of your work. – git add debug.c – git commit -s
  • 20. 4. Fix warnings reported by checkpatch.pl • 4.6 Now you have 3 commits “A,B,C” in "cleanup" branch
  • 21. 4. Fix warnings reported by checkpatch.pl • 4.7 We only need the last commit "C" to send back to mailing list. – Remove commit "B" in patch folder • rm patch/0001-cosmetic-add-bedbug.c-back.patch – Export the final patch commit "C" • cd patch • git format-patch HEAD~1 – Use checkpatch.pl to check it again. • checkpatch 0001-cosmetic-clean-up-common- bedbug.c-by-checkpatch.pl.patch
  • 22. 5. Use git send-email to commit the cleanup back to mailing list. • 5.1 Finally send the patch out. – git send-email 0001-cosmetic-clean-up- common-bedbug.c-by-checkpatch.pl.patch – Remember add maintainers to “To:” list to review the patch.
  • 23. 6. Fix your patch if maintainer give you suggestion to fix. • After a maintainer reviewed your patch, he will reply your mail to inform you if the patch has been accepted or the patch is still need to be fixed.
  • 24. Summary • There are many old-style codes need to be cleaned up. We need your help. • Please join u-boot project. – Just subscribe http://lists.denx.de/mailman/listinfo/u-boot